From 60e5f2a0486f9e8dd7eac64ebc59490578ec2339 Mon Sep 17 00:00:00 2001 From: Steven Lambright Date: Fri, 21 Dec 2012 17:44:12 +0000 Subject: [PATCH] Isis now handles textual data in a much more consistent manner... this shouldn't impact any user-functionality. To developers: Isis' API now only utilizes QStrings. Please use the toString(...) and to*(QString) (i.e. toBool(QString), toInt(QString), ...) methods. All public API's should use/expect QString (not IString, not std::string). Fixes #1312. git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@4928 41f8697f-d340-4b68-9986-7bafba869bb8 --- .../apollo/apps/apollo2isis/apollo2isis.cpp | 54 +- isis/src/apollo/apps/apollocal/apollocal.cpp | 6 +- .../apollo/apps/apollofindrx/apollofindrx.cpp | 52 +- .../apps/apollopaninit/apollopaninit.cpp | 66 +- .../apollopanstitcher/apollopanstitcher.cpp | 18 +- .../apollo/apps/apolloremrx/apolloremrx.cpp | 30 +- .../apollo/apps/apollowarp/WarpTransform.cpp | 6 +- .../src/apollo/apps/apollowarp/apollowarp.cpp | 20 +- isis/src/apollo/objs/Apollo/Apollo.h | 40 +- isis/src/apollo/objs/Apollo/Apollo.truth | 2 +- isis/src/apollo/objs/Apollo/unitTest.cpp | 15 +- .../ApolloMetricCamera/ApolloMetricCamera.cpp | 18 +- .../objs/ApolloMetricCamera/unitTest.cpp | 4 +- .../ApolloPanoramicCamera.cpp | 20 +- isis/src/base/apps/algebra/algebra.cpp | 2 +- .../apps/appjit/LineScanCameraRotation.cpp | 4 +- isis/src/base/apps/appjit/PixelOffset.cpp | 24 +- isis/src/base/apps/appjit/PixelOffset.h | 14 +- isis/src/base/apps/appjit/appjit.cpp | 12 +- isis/src/base/apps/ascii2isis/ascii2isis.cpp | 8 +- isis/src/base/apps/automos/automos.cpp | 16 +- .../apps/autoregtemplate/autoregtemplate.cpp | 68 +- isis/src/base/apps/bandnorm/bandnorm.cpp | 31 +- isis/src/base/apps/bit2bit/bit2bit.cpp | 32 +- isis/src/base/apps/blend/blend.cpp | 31 +- .../src/base/apps/butterworth/butterworth.cpp | 4 +- isis/src/base/apps/cam2cam/cam2cam.cpp | 2 +- isis/src/base/apps/cam2map/cam2map.cpp | 74 +- isis/src/base/apps/caminfo/CamTools.cpp | 26 +- isis/src/base/apps/caminfo/CamTools.h | 14 +- isis/src/base/apps/caminfo/caminfo.cpp | 108 +-- isis/src/base/apps/campt/campt.cpp | 14 +- isis/src/base/apps/camrange/camrange.cpp | 42 +- isis/src/base/apps/camstats/camstats.cpp | 12 +- isis/src/base/apps/cathist/cathist.cpp | 14 +- isis/src/base/apps/catlab/catlab.cpp | 2 +- isis/src/base/apps/catoriglab/catoriglab.cpp | 2 +- .../src/base/apps/ckwriter/CkKernelWriter.cpp | 50 +- isis/src/base/apps/ckwriter/CkKernelWriter.h | 16 +- isis/src/base/apps/ckwriter/SpiceKernel.cpp | 20 +- isis/src/base/apps/ckwriter/SpiceKernel.h | 10 +- isis/src/base/apps/ckwriter/SpiceSegment.cpp | 70 +- isis/src/base/apps/ckwriter/SpiceSegment.h | 58 +- isis/src/base/apps/ckwriter/ckwriter.cpp | 10 +- isis/src/base/apps/copylabel/copylabel.cpp | 30 +- isis/src/base/apps/crop/crop.cpp | 32 +- .../src/base/apps/cropspecial/cropspecial.cpp | 20 +- isis/src/base/apps/cubeavg/cubeavg.cpp | 18 +- isis/src/base/apps/cubediff/WriteTabular.cpp | 96 +-- isis/src/base/apps/cubediff/WriteTabular.h | 8 +- isis/src/base/apps/cubediff/cubediff.cpp | 52 +- isis/src/base/apps/cubefunc/cubefunc.cpp | 6 +- isis/src/base/apps/cubeit/cubeit.cpp | 28 +- isis/src/base/apps/cubenorm/cubenorm.cpp | 72 +- .../base/apps/decorstretch/decorstretch.cpp | 4 +- isis/src/base/apps/demprep/demprep.cpp | 16 +- isis/src/base/apps/deriv/deriv.cpp | 2 +- isis/src/base/apps/dstripe/dstripe.cpp | 24 +- isis/src/base/apps/editlab/editlab.cpp | 8 +- isis/src/base/apps/edrget/edrget.cpp | 31 +- isis/src/base/apps/edrget/ftpget.cpp | 10 +- isis/src/base/apps/edrget/ftpget.h | 2 +- isis/src/base/apps/edrget/httpget.cpp | 22 +- isis/src/base/apps/edrget/httpget.h | 2 +- isis/src/base/apps/enlarge/enlarge.cpp | 4 +- isis/src/base/apps/equalizer/equalizer.cpp | 6 +- isis/src/base/apps/errors/errors.cpp | 6 +- isis/src/base/apps/explode/explode.cpp | 8 +- isis/src/base/apps/fakecube/fakecube.cpp | 2 +- isis/src/base/apps/fft/fft.cpp | 14 +- isis/src/base/apps/fillgap/fillgap.cpp | 8 +- .../base/apps/findgaps/FindGapsFunctor.cpp | 26 +- isis/src/base/apps/findgaps/FindGapsFunctor.h | 6 +- .../findimageoverlaps/findimageoverlaps.cpp | 8 +- isis/src/base/apps/findrx/findrx.cpp | 34 +- isis/src/base/apps/fits2isis/fits2isis.cpp | 41 +- .../base/apps/footprintinit/footprintinit.cpp | 22 +- .../apps/footprintmerge/footprintmerge.cpp | 20 +- isis/src/base/apps/getkey/getkey.cpp | 32 +- isis/src/base/apps/getsn/getsn.cpp | 12 +- isis/src/base/apps/gradient/gradient.cpp | 2 +- isis/src/base/apps/grid/grid.cpp | 4 +- isis/src/base/apps/handmos/handmos.cpp | 6 +- isis/src/base/apps/hist/hist.cpp | 24 +- isis/src/base/apps/ifft/ifft.cpp | 8 +- .../base/apps/interestcube/interestcube.cpp | 8 +- isis/src/base/apps/isis2ascii/isis2ascii.cpp | 4 +- isis/src/base/apps/isis2fits/isis2fits.cpp | 48 +- isis/src/base/apps/isis2gml/isis2gml.cpp | 8 +- isis/src/base/apps/isis2pds/isis2pds.cpp | 18 +- isis/src/base/apps/isis2raw/isis2raw.cpp | 22 +- isis/src/base/apps/isis2std/isis2std.cpp | 18 +- isis/src/base/apps/kernfilter/kernfilter.cpp | 2 +- isis/src/base/apps/lineeq/lineeq.cpp | 6 +- isis/src/base/apps/makecube/makecube.cpp | 2 +- isis/src/base/apps/makeflat/makeflat.cpp | 38 +- isis/src/base/apps/map2map/map2map.cpp | 94 +-- isis/src/base/apps/mapgrid/mapgrid.cpp | 18 +- isis/src/base/apps/maplab/maplab.cpp | 28 +- isis/src/base/apps/mapmos/mapmos.cpp | 10 +- isis/src/base/apps/mappt/mappt.cpp | 46 +- isis/src/base/apps/mapsize/mapsize.cpp | 16 +- .../src/base/apps/maptemplate/maptemplate.cpp | 154 ++-- isis/src/base/apps/maptrim/maptrim.cpp | 14 +- isis/src/base/apps/mask/mask.cpp | 6 +- isis/src/base/apps/minmax/minmax.cpp | 2 +- isis/src/base/apps/mosrange/mosrange.cpp | 76 +- isis/src/base/apps/mvstats/mvstats.cpp | 28 +- isis/src/base/apps/nocam2map/nocam2map.cpp | 102 +-- .../src/base/apps/noisefilter/noisefilter.cpp | 10 +- isis/src/base/apps/noproj/noproj.cpp | 75 +- isis/src/base/apps/noseam/noseam.cpp | 24 +- .../base/apps/overlapstats/overlapstats.cpp | 82 +- isis/src/base/apps/pad/pad.cpp | 16 +- isis/src/base/apps/pca/pca.cpp | 4 +- isis/src/base/apps/pds2isis/pds2isis.cpp | 4 +- isis/src/base/apps/percent/percent.cpp | 15 +- isis/src/base/apps/phocube/phocube.cpp | 22 +- .../base/apps/phoempglobal/phoempglobal.cpp | 38 +- .../src/base/apps/phoemplocal/phoemplocal.cpp | 42 +- isis/src/base/apps/phohillier/Hillier.cpp | 70 +- isis/src/base/apps/phohillier/Hillier.h | 8 +- .../src/base/apps/photemplate/photemplate.cpp | 198 ++--- isis/src/base/apps/photomet/photomet.cpp | 718 +++++++++--------- isis/src/base/apps/pvldiff/pvldiff.cpp | 31 +- isis/src/base/apps/reduce/reduce.cpp | 14 +- isis/src/base/apps/remrx/remrx.cpp | 36 +- isis/src/base/apps/rotate/rotate.cpp | 4 +- isis/src/base/apps/segment/segment.cpp | 10 +- isis/src/base/apps/shade/shade.cpp | 4 +- isis/src/base/apps/shadowtau/shadowtau.cpp | 122 +-- isis/src/base/apps/skymap/skymap.cpp | 48 +- isis/src/base/apps/skypt/skypt.cpp | 26 +- isis/src/base/apps/skyrange/skyrange.cpp | 22 +- isis/src/base/apps/smtk/PointPlot.h | 2 +- isis/src/base/apps/smtk/smtk.cpp | 58 +- .../base/apps/specdivfilter/specdivfilter.cpp | 4 +- .../base/apps/spechighpass/spechighpass.cpp | 4 +- .../src/base/apps/speclowpass/speclowpass.cpp | 4 +- isis/src/base/apps/specpix/specpix.cpp | 16 +- isis/src/base/apps/spicefit/spicefit.cpp | 4 +- isis/src/base/apps/spiceinit/SpiceClient.cpp | 88 +-- isis/src/base/apps/spiceinit/SpiceClient.h | 20 +- isis/src/base/apps/spiceinit/spiceinit.cpp | 40 +- .../src/base/apps/spiceserver/spiceserver.cpp | 86 +-- isis/src/base/apps/spkwriter/Commentor.h | 26 +- isis/src/base/apps/spkwriter/KernelWriter.h | 40 +- isis/src/base/apps/spkwriter/SpiceKernel.h | 2 +- isis/src/base/apps/spkwriter/SpiceSegment.cpp | 42 +- isis/src/base/apps/spkwriter/SpiceSegment.h | 42 +- .../base/apps/spkwriter/SpkKernelWriter.cpp | 6 +- .../src/base/apps/spkwriter/SpkKernelWriter.h | 30 +- isis/src/base/apps/spkwriter/SpkSegment.cpp | 20 +- isis/src/base/apps/spkwriter/SpkSegment.h | 14 +- isis/src/base/apps/spkwriter/spkwriter.cpp | 10 +- isis/src/base/apps/stats/stats.cpp | 46 +- isis/src/base/apps/stretch/stretch.cpp | 4 +- isis/src/base/apps/svfilter/svfilter.cpp | 2 +- isis/src/base/apps/table2cube/table2cube.cpp | 2 +- isis/src/base/apps/tabledump/tabledump.cpp | 32 +- isis/src/base/apps/tabledump/tabledump.xml | 8 +- isis/src/base/apps/translate/translate.cpp | 4 +- isis/src/base/apps/uncrop/uncrop.cpp | 2 +- .../base/objs/AdaptiveGruen/AdaptiveGruen.h | 4 +- isis/src/base/objs/AdaptiveGruen/unitTest.cpp | 16 +- isis/src/base/objs/Affine/Affine.cpp | 3 +- isis/src/base/objs/Albedo/Albedo.cpp | 19 +- isis/src/base/objs/Albedo/Albedo.h | 2 +- isis/src/base/objs/AlbedoAtm/AlbedoAtm.cpp | 16 +- isis/src/base/objs/AlphaCube/AlphaCube.cpp | 34 +- isis/src/base/objs/AlphaCube/AlphaCube.h | 2 +- isis/src/base/objs/AlphaCube/unitTest.cpp | 4 +- isis/src/base/objs/Angle/Angle.cpp | 6 +- isis/src/base/objs/Angle/Angle.h | 5 +- isis/src/base/objs/Angle/unitTest.cpp | 3 +- .../base/objs/Anisotropic1/Anisotropic1.cpp | 2 +- isis/src/base/objs/Anisotropic1/unitTest.cpp | 6 +- .../base/objs/Anisotropic2/Anisotropic2.cpp | 6 +- isis/src/base/objs/Anisotropic2/unitTest.cpp | 2 +- .../src/base/objs/Application/Application.cpp | 200 ++--- isis/src/base/objs/Application/Application.h | 42 +- .../base/objs/Application/Application.truth | 2 +- isis/src/base/objs/Application/unitTest.cpp | 6 +- isis/src/base/objs/Area3D/Area3D.cpp | 20 +- isis/src/base/objs/Area3D/Area3D.truth | 6 +- isis/src/base/objs/AtmosModel/AtmosModel.cpp | 8 +- .../AtmosModelFactory/AtmosModelFactory.cpp | 8 +- isis/src/base/objs/AutoReg/AutoReg.cpp | 60 +- isis/src/base/objs/AutoReg/AutoReg.h | 13 +- isis/src/base/objs/AutoReg/unitTest.cpp | 26 +- .../objs/AutoRegFactory/AutoRegFactory.cpp | 2 +- isis/src/base/objs/BandManager/unitTest.cpp | 11 +- .../Basis1VariableFunction.cpp | 2 +- .../Basis1VariableFunction.h | 4 +- .../base/objs/BasisFunction/BasisFunction.cpp | 8 +- .../base/objs/BasisFunction/BasisFunction.h | 8 +- isis/src/base/objs/BasisFunction/unitTest.cpp | 5 +- isis/src/base/objs/Blob/Blob.cpp | 83 +- isis/src/base/objs/Blob/Blob.h | 26 +- isis/src/base/objs/Blob/unitTest.cpp | 6 +- isis/src/base/objs/Blobber/Blobber.cpp | 27 +- isis/src/base/objs/Blobber/Blobber.h | 31 +- isis/src/base/objs/Blobber/unitTest.cpp | 8 +- .../base/objs/BoxcarManager/BoxcarManager.h | 2 +- isis/src/base/objs/BoxcarManager/unitTest.cpp | 11 +- isis/src/base/objs/Brick/Brick.cpp | 2 +- isis/src/base/objs/Brick/Brick.h | 2 +- isis/src/base/objs/Buffer/Buffer.cpp | 12 +- isis/src/base/objs/CSVReader/CSVReader.cpp | 18 +- isis/src/base/objs/CSVReader/CSVReader.h | 46 +- isis/src/base/objs/CSVReader/unitTest.cpp | 2 +- isis/src/base/objs/Camera/Camera.cpp | 34 +- isis/src/base/objs/Camera/unitTest.cpp | 10 +- .../CameraDistortionMap.cpp | 6 +- .../CameraDistortionMap/CameraDistortionMap.h | 6 +- .../base/objs/CameraFactory/CameraFactory.cpp | 30 +- .../base/objs/CameraFactory/CameraFactory.h | 2 +- .../CameraFocalPlaneMap.cpp | 16 +- .../objs/CameraPointInfo/CameraPointInfo.cpp | 106 +-- .../objs/CameraPointInfo/CameraPointInfo.h | 4 +- .../base/objs/CameraPointInfo/unitTest.cpp | 4 +- .../CameraStatistics/CameraStatistics.cpp | 16 +- .../objs/CameraStatistics/CameraStatistics.h | 14 +- .../base/objs/CameraStatistics/unitTest.cpp | 19 +- isis/src/base/objs/Chip/Chip.cpp | 8 +- isis/src/base/objs/Chip/Chip.h | 28 +- isis/src/base/objs/Chip/Chip.truth | 18 +- isis/src/base/objs/Chip/unitTest.cpp | 41 +- .../src/base/objs/CollectorMap/CollectorMap.h | 12 +- isis/src/base/objs/CollectorMap/unitTest.cpp | 8 +- isis/src/base/objs/Column/Column.cpp | 20 +- isis/src/base/objs/Column/Column.h | 11 +- isis/src/base/objs/Column/Column.truth | 2 +- isis/src/base/objs/Cube/Cube.cpp | 156 ++-- isis/src/base/objs/Cube/Cube.h | 38 +- isis/src/base/objs/Cube/CubeIoHandler.cpp | 4 +- isis/src/base/objs/Cube/CubeIoHandler.h | 1 + isis/src/base/objs/Cube/CubeTileHandler.cpp | 4 +- isis/src/base/objs/Cube/unitTest.cpp | 6 +- .../base/objs/CubeAttribute/CubeAttribute.cpp | 102 ++- .../base/objs/CubeAttribute/CubeAttribute.h | 87 +-- isis/src/base/objs/CubeAttribute/unitTest.cpp | 16 +- .../objs/CubeCalculator/CubeCalculator.cpp | 4 +- .../base/objs/CubeCalculator/CubeCalculator.h | 2 +- .../src/base/objs/CubeCalculator/unitTest.cpp | 2 +- .../CubeInfixToPostfix/CubeInfixToPostfix.cpp | 8 +- .../CubeInfixToPostfix/CubeInfixToPostfix.h | 5 +- .../base/objs/CubeInfixToPostfix/unitTest.cpp | 2 +- .../src/base/objs/CubeManager/CubeManager.cpp | 14 +- isis/src/base/objs/CubeManager/CubeManager.h | 12 +- isis/src/base/objs/DemShape/DemShape.cpp | 6 +- isis/src/base/objs/DemShape/unitTest.cpp | 6 +- isis/src/base/objs/Distance/Distance.cpp | 6 +- isis/src/base/objs/Distance/Distance.h | 5 +- .../src/base/objs/EllipsoidShape/unitTest.cpp | 2 +- isis/src/base/objs/Endian/Endian.h | 11 +- isis/src/base/objs/Endian/unitTest.cpp | 28 +- .../base/objs/EndianSwapper/EndianSwapper.cpp | 2 +- .../base/objs/EndianSwapper/EndianSwapper.h | 2 +- isis/src/base/objs/Enlarge/Enlarge.cpp | 20 +- isis/src/base/objs/Enlarge/unitTest.cpp | 2 +- .../src/base/objs/Environment/Environment.cpp | 16 +- isis/src/base/objs/Environment/Environment.h | 10 +- isis/src/base/objs/Environment/unitTest.cpp | 2 +- .../base/objs/Equalization/Equalization.cpp | 127 ++-- .../src/base/objs/Equalization/Equalization.h | 22 +- isis/src/base/objs/Equalization/unitTest.cpp | 6 +- .../EquatorialCylindricalShape.cpp | 2 +- .../EquatorialCylindricalShape/unitTest.cpp | 2 +- .../objs/Equirectangular/Equirectangular.cpp | 18 +- .../objs/Equirectangular/Equirectangular.h | 4 +- .../base/objs/Equirectangular/unitTest.cpp | 20 +- .../ExportDescription/ExportDescription.cpp | 5 +- .../base/objs/ExportDescription/unitTest.cpp | 6 +- .../objs/ExportPdsTable/ExportPdsTable.cpp | 63 +- .../base/objs/ExportPdsTable/ExportPdsTable.h | 12 +- .../objs/ExportPdsTable/ExportPdsTable.truth | Bin 1060 -> 1058 bytes .../src/base/objs/ExportPdsTable/unitTest.cpp | 35 +- isis/src/base/objs/FileList/FileList.cpp | 12 +- isis/src/base/objs/FileList/FileList.h | 7 +- isis/src/base/objs/FileName/FileName.cpp | 94 +-- isis/src/base/objs/FileName/FileName.h | 40 +- isis/src/base/objs/FileName/unitTest.cpp | 26 +- .../objs/ForstnerOperator/ForstnerOperator.h | 2 +- .../base/objs/ForstnerOperator/unitTest.cpp | 22 +- isis/src/base/objs/FramingCamera/unitTest.cpp | 6 +- .../base/objs/FunctionTools/FunctionTools.h | 28 +- isis/src/base/objs/GSLUtility/GSLUtility.h | 22 +- .../objs/GradientOperator/GradientOperator.h | 2 +- .../base/objs/GradientOperator/unitTest.cpp | 22 +- .../GridPolygonSeeder/GridPolygonSeeder.cpp | 30 +- .../GridPolygonSeeder/GridPolygonSeeder.h | 4 +- .../GridPolygonSeeder/GridPolygonSeeder.truth | 2 +- .../base/objs/GridPolygonSeeder/unitTest.cpp | 30 +- isis/src/base/objs/GroundGrid/GroundGrid.cpp | 12 +- .../GroupedStatistics/GroupedStatistics.cpp | 2 +- isis/src/base/objs/Gruen/Gruen.cpp | 68 +- isis/src/base/objs/Gruen/Gruen.h | 63 +- isis/src/base/objs/Gruen/GruenTypes.h | 6 +- isis/src/base/objs/Gruen/unitTest.cpp | 16 +- isis/src/base/objs/Gui/Gui.cpp | 101 ++- isis/src/base/objs/Gui/Gui.h | 8 +- .../src/base/objs/Gui/GuiBooleanParameter.cpp | 19 +- isis/src/base/objs/Gui/GuiBooleanParameter.h | 6 +- .../base/objs/Gui/GuiComboBoxParameter.cpp | 18 +- isis/src/base/objs/Gui/GuiComboBoxParameter.h | 6 +- isis/src/base/objs/Gui/GuiCubeParameter.cpp | 28 +- isis/src/base/objs/Gui/GuiDoubleParameter.cpp | 8 +- isis/src/base/objs/Gui/GuiDoubleParameter.h | 4 +- isis/src/base/objs/Gui/GuiEditFile.cpp | 12 +- isis/src/base/objs/Gui/GuiEditFile.h | 6 +- .../base/objs/Gui/GuiFilenameParameter.cpp | 30 +- isis/src/base/objs/Gui/GuiFilenameParameter.h | 4 +- isis/src/base/objs/Gui/GuiHelperAction.h | 2 +- isis/src/base/objs/Gui/GuiInputAttribute.cpp | 24 +- isis/src/base/objs/Gui/GuiInputAttribute.h | 10 +- .../src/base/objs/Gui/GuiIntegerParameter.cpp | 6 +- isis/src/base/objs/Gui/GuiIntegerParameter.h | 4 +- isis/src/base/objs/Gui/GuiListParameter.cpp | 26 +- isis/src/base/objs/Gui/GuiListParameter.h | 6 +- isis/src/base/objs/Gui/GuiOutputAttribute.cpp | 20 +- isis/src/base/objs/Gui/GuiOutputAttribute.h | 10 +- isis/src/base/objs/Gui/GuiParameter.cpp | 96 +-- isis/src/base/objs/Gui/GuiParameter.h | 13 +- .../src/base/objs/Gui/GuiParameterFactory.cpp | 4 +- isis/src/base/objs/Gui/GuiStringParameter.cpp | 8 +- isis/src/base/objs/Gui/GuiStringParameter.h | 8 +- isis/src/base/objs/Hapke/Hapke.cpp | 9 +- isis/src/base/objs/Hapke/Hapke.h | 8 +- isis/src/base/objs/Hapke/unitTest.cpp | 60 +- isis/src/base/objs/Histogram/Histogram.cpp | 6 +- isis/src/base/objs/History/History.cpp | 4 +- isis/src/base/objs/History/History.h | 4 +- isis/src/base/objs/History/unitTest.cpp | 4 +- isis/src/base/objs/ID/ID.cpp | 28 +- isis/src/base/objs/ID/ID.h | 10 +- isis/src/base/objs/ID/unitTest.cpp | 43 +- isis/src/base/objs/IException/IException.cpp | 173 +++-- isis/src/base/objs/IException/IException.h | 27 +- isis/src/base/objs/IException/unitTest.cpp | 4 +- isis/src/base/objs/IString/IString.cpp | 147 +++- isis/src/base/objs/IString/IString.h | 60 +- isis/src/base/objs/IString/IString.truth | 5 +- isis/src/base/objs/IString/unitTest.cpp | 7 +- .../src/base/objs/IdealCamera/IdealCamera.cpp | 10 +- .../base/objs/ImageExporter/ImageExporter.cpp | 10 +- .../base/objs/ImageExporter/ImageExporter.h | 10 +- .../base/objs/ImageImporter/ImageImporter.cpp | 2 +- isis/src/base/objs/ImageImporter/unitTest.cpp | 4 +- .../base/objs/ImageOverlap/ImageOverlap.cpp | 18 +- .../src/base/objs/ImageOverlap/ImageOverlap.h | 15 +- isis/src/base/objs/ImageOverlap/unitTest.cpp | 52 +- .../objs/ImageOverlapSet/ImageOverlapSet.cpp | 40 +- .../objs/ImageOverlapSet/ImageOverlapSet.h | 18 +- .../base/objs/ImageOverlapSet/unitTest.cpp | 49 +- .../base/objs/ImagePolygon/ImagePolygon.cpp | 8 +- isis/src/base/objs/ImagePolygon/unitTest.cpp | 20 +- .../objs/ImportPdsTable/ImportPdsTable.cpp | 215 +++--- .../base/objs/ImportPdsTable/ImportPdsTable.h | 51 +- .../objs/ImportPdsTable/ImportPdsTable.truth | Bin 5475 -> 5472 bytes .../src/base/objs/ImportPdsTable/unitTest.cpp | 41 +- .../objs/InfixToPostfix/InfixToPostfix.cpp | 115 +-- .../base/objs/InfixToPostfix/InfixToPostfix.h | 41 +- .../src/base/objs/InfixToPostfix/unitTest.cpp | 6 +- isis/src/base/objs/Isis/Isis.h | 6 +- isis/src/base/objs/Isis/IsisDebug.h | 6 +- isis/src/base/objs/IsisAml/IsisAml.cpp | 650 ++++++++-------- isis/src/base/objs/IsisAml/IsisAml.h | 153 ++-- isis/src/base/objs/IsisAml/IsisAml.truth | 4 +- isis/src/base/objs/IsisAml/IsisAmlData.cpp | 41 - isis/src/base/objs/IsisAml/IsisAmlData.h | 84 +- .../base/objs/IsisAml/IsisXMLApplication.cpp | 4 +- isis/src/base/objs/IsisAml/IsisXMLGroup.cpp | 2 +- isis/src/base/objs/IsisAml/IsisXMLHandler.cpp | 16 +- isis/src/base/objs/IsisAml/IsisXMLHandler.h | 4 +- .../objs/IsisAml/IsisXMLMultipleValues.cpp | 2 +- .../base/objs/IsisAml/IsisXMLMultipleValues.h | 4 +- .../base/objs/IsisAml/IsisXMLParameter.cpp | 14 +- isis/src/base/objs/IsisAml/unitTest.cpp | 170 ++--- isis/src/base/objs/JP2Decoder/JP2Decoder.cpp | 12 +- isis/src/base/objs/JP2Decoder/JP2Decoder.h | 10 +- isis/src/base/objs/JP2Encoder/JP2Encoder.cpp | 4 +- isis/src/base/objs/JP2Encoder/JP2Encoder.h | 4 +- .../src/base/objs/JP2Exporter/JP2Exporter.cpp | 5 +- isis/src/base/objs/JP2Exporter/JP2Exporter.h | 2 +- isis/src/base/objs/JP2Importer/unitTest.cpp | 4 +- isis/src/base/objs/Kernels/Kernels.cpp | 125 ++- isis/src/base/objs/Kernels/Kernels.h | 48 +- isis/src/base/objs/Kernels/Kernels.truth | 2 + isis/src/base/objs/Kernels/unitTest.cpp | 52 +- isis/src/base/objs/Lambert/Lambert.h | 2 +- .../LambertAzimuthalEqualArea.cpp | 12 +- .../LambertAzimuthalEqualArea.h | 4 +- .../LambertAzimuthalEqualArea.truth | 4 +- .../LambertAzimuthalEqualArea/unitTest.cpp | 192 ++--- .../LambertConformal/LambertConformal.cpp | 20 +- .../objs/LambertConformal/LambertConformal.h | 4 +- .../base/objs/LambertConformal/unitTest.cpp | 85 ++- isis/src/base/objs/Latitude/Latitude.cpp | 14 +- isis/src/base/objs/Latitude/unitTest.cpp | 20 +- .../base/objs/LeastSquares/LeastSquares.cpp | 16 +- .../src/base/objs/LeastSquares/LeastSquares.h | 6 +- .../LimitPolygonSeeder/LimitPolygonSeeder.cpp | 20 +- .../LimitPolygonSeeder/LimitPolygonSeeder.h | 4 +- .../base/objs/LimitPolygonSeeder/unitTest.cpp | 28 +- .../src/base/objs/LineEquation/LineEquation.h | 2 +- .../src/base/objs/LineManager/LineManager.cpp | 6 +- isis/src/base/objs/LineManager/unitTest.cpp | 3 +- .../src/base/objs/LineScanCamera/unitTest.cpp | 2 +- .../objs/LineScanCameraGroundMap/unitTest.cpp | 2 +- .../base/objs/LommelSeeliger/LommelSeeliger.h | 2 +- .../LunarAzimuthalEqualArea.cpp | 10 +- .../LunarAzimuthalEqualArea.h | 4 +- .../LunarAzimuthalEqualArea.truth | 2 +- .../objs/LunarAzimuthalEqualArea/unitTest.cpp | 50 +- .../src/base/objs/LunarLambert/LunarLambert.h | 2 +- .../LunarLambertEmpirical.cpp | 20 +- .../LunarLambertEmpirical.h | 8 +- .../MaximumCorrelation/MaximumCorrelation.h | 4 +- .../base/objs/MaximumCorrelation/unitTest.cpp | 14 +- isis/src/base/objs/Mercator/Mercator.cpp | 14 +- isis/src/base/objs/Mercator/Mercator.h | 4 +- isis/src/base/objs/Mercator/unitTest.cpp | 58 +- .../objs/Message/ArraySubscriptNotInRange.cpp | 8 +- isis/src/base/objs/Message/FileCreate.cpp | 6 +- isis/src/base/objs/Message/FileOpen.cpp | 6 +- isis/src/base/objs/Message/FileRead.cpp | 6 +- isis/src/base/objs/Message/FileWrite.cpp | 6 +- .../base/objs/Message/KeywordAmbiguous.cpp | 6 +- .../objs/Message/KeywordBlockEndMissing.cpp | 8 +- .../base/objs/Message/KeywordBlockInvalid.cpp | 6 +- .../objs/Message/KeywordBlockStartMissing.cpp | 8 +- .../base/objs/Message/KeywordDuplicated.cpp | 6 +- .../src/base/objs/Message/KeywordNotArray.cpp | 6 +- .../src/base/objs/Message/KeywordNotFound.cpp | 6 +- .../base/objs/Message/KeywordUnrecognized.cpp | 6 +- .../src/base/objs/Message/KeywordValueBad.cpp | 12 +- .../objs/Message/KeywordValueExpected.cpp | 6 +- .../objs/Message/KeywordValueNotInList.cpp | 6 +- .../objs/Message/KeywordValueNotInRange.cpp | 8 +- .../objs/Message/MemoryAllocationFailed.cpp | 6 +- isis/src/base/objs/Message/Message.h | 97 ++- .../base/objs/Message/MissingDelimiter.cpp | 22 +- isis/src/base/objs/Message/unitTest.cpp | 53 +- .../MinimumDifference/MinimumDifference.h | 4 +- .../base/objs/MinimumDifference/unitTest.cpp | 16 +- isis/src/base/objs/Minnaert/Minnaert.h | 2 +- .../MinnaertEmpirical/MinnaertEmpirical.cpp | 6 +- .../MinnaertEmpirical/MinnaertEmpirical.h | 8 +- isis/src/base/objs/Mixed/Mixed.h | 2 +- isis/src/base/objs/Mixed/Mixed.truth | 2 +- isis/src/base/objs/Mixed/unitTest.cpp | 4 +- isis/src/base/objs/MoonAlbedo/MoonAlbedo.h | 2 +- .../base/objs/MoravecOperator/unitTest.cpp | 26 +- isis/src/base/objs/NaifStatus/NaifStatus.cpp | 6 +- .../objs/NoNormalization/NoNormalization.h | 2 +- isis/src/base/objs/NoOperator/unitTest.cpp | 26 +- isis/src/base/objs/NormModel/NormModel.h | 2 +- .../NormModelFactory/NormModelFactory.cpp | 14 +- .../ObliqueCylindrical/ObliqueCylindrical.cpp | 34 +- .../ObliqueCylindrical/ObliqueCylindrical.h | 4 +- .../base/objs/ObliqueCylindrical/unitTest.cpp | 80 +- .../ObservationNumber/ObservationNumber.cpp | 40 +- .../ObservationNumber/ObservationNumber.h | 10 +- .../base/objs/ObservationNumber/unitTest.cpp | 10 +- .../ObservationNumberList.cpp | 48 +- .../ObservationNumberList.h | 16 +- .../objs/ObservationNumberList/unitTest.cpp | 4 +- .../base/objs/OriginalLabel/OriginalLabel.cpp | 2 +- .../base/objs/OriginalLabel/OriginalLabel.h | 2 +- .../base/objs/Orthographic/Orthographic.cpp | 14 +- .../src/base/objs/Orthographic/Orthographic.h | 4 +- isis/src/base/objs/Orthographic/unitTest.cpp | 58 +- .../OverlapStatistics/OverlapStatistics.cpp | 61 +- .../OverlapStatistics/OverlapStatistics.h | 6 +- .../base/objs/OverlapStatistics/unitTest.cpp | 13 +- isis/src/base/objs/Parabola/Parabola.h | 2 +- isis/src/base/objs/Parabola/unitTest.cpp | 5 +- isis/src/base/objs/PhotoModel/PhotoModel.cpp | 4 +- isis/src/base/objs/PhotoModel/PhotoModel.h | 6 +- .../PhotoModelFactory/PhotoModelFactory.cpp | 8 +- isis/src/base/objs/Pipeline/Pipeline.cpp | 134 ++-- isis/src/base/objs/Pipeline/Pipeline.h | 61 +- isis/src/base/objs/Pipeline/Pipeline.truth | 20 +- .../objs/Pipeline/PipelineApplication.cpp | 106 +-- .../base/objs/Pipeline/PipelineApplication.h | 118 +-- isis/src/base/objs/Pipeline/unitTest.cpp | 8 +- isis/src/base/objs/PixelType/PixelType.h | 14 +- isis/src/base/objs/PixelType/unitTest.cpp | 57 +- isis/src/base/objs/Plugin/Plugin.cpp | 18 +- isis/src/base/objs/Plugin/Plugin.h | 2 +- .../PointPerspective/PointPerspective.cpp | 14 +- .../objs/PointPerspective/PointPerspective.h | 4 +- .../base/objs/PointPerspective/unitTest.cpp | 64 +- .../PolarStereographic/PolarStereographic.cpp | 20 +- .../PolarStereographic/PolarStereographic.h | 4 +- .../base/objs/PolarStereographic/unitTest.cpp | 64 +- .../base/objs/PolygonSeeder/PolygonSeeder.cpp | 28 +- .../base/objs/PolygonSeeder/PolygonSeeder.h | 8 +- isis/src/base/objs/PolygonSeeder/unitTest.cpp | 8 +- .../PolygonSeederFactory.cpp | 2 +- .../PolygonSeederFactory.h | 2 +- .../base/objs/PolygonTools/PolygonTools.cpp | 8 +- .../src/base/objs/PolygonTools/PolygonTools.h | 12 +- isis/src/base/objs/PolygonTools/unitTest.cpp | 16 +- .../objs/PolynomialBivariate/unitTest.cpp | 7 +- .../objs/PolynomialUnivariate/unitTest.cpp | 7 +- isis/src/base/objs/Portal/Portal.h | 2 +- isis/src/base/objs/Portal/unitTest.cpp | 2 +- isis/src/base/objs/Preference/Preference.cpp | 2 +- isis/src/base/objs/Preference/Preference.h | 2 +- isis/src/base/objs/Preference/unitTest.cpp | 6 +- isis/src/base/objs/Process/Process.cpp | 76 +- isis/src/base/objs/Process/Process.h | 18 +- .../objs/ProcessByBrick/ProcessByBrick.cpp | 4 +- .../base/objs/ProcessByBrick/ProcessByBrick.h | 4 +- .../base/objs/ProcessByLine/ProcessByLine.cpp | 4 +- .../base/objs/ProcessByLine/ProcessByLine.h | 4 +- .../objs/ProcessBySample/ProcessBySample.cpp | 4 +- .../objs/ProcessBySample/ProcessBySample.h | 4 +- .../ProcessBySpectra/ProcessBySpectra.cpp | 4 +- .../objs/ProcessBySpectra/ProcessBySpectra.h | 4 +- .../base/objs/ProcessExport/ProcessExport.cpp | 6 +- .../base/objs/ProcessExport/ProcessExport.h | 2 +- .../ProcessExportPds/ProcessExportPds.cpp | 286 +++---- .../objs/ProcessExportPds/ProcessExportPds.h | 11 +- .../ProcessGroundPolygons.cpp | 38 +- .../ProcessGroundPolygons.h | 14 +- .../objs/ProcessGroundPolygons/unitTest.cpp | 15 +- .../base/objs/ProcessImport/ProcessImport.cpp | 259 ++++--- .../base/objs/ProcessImport/ProcessImport.h | 10 +- .../objs/ProcessImport/ProcessImport.truth | 2 +- isis/src/base/objs/ProcessImport/unitTest.cpp | 66 +- .../ProcessImportPds/ProcessImportPds.cpp | 250 +++--- .../objs/ProcessImportPds/ProcessImportPds.h | 24 +- .../ProcessImportPds/ProcessImportPds.truth | 7 +- .../base/objs/ProcessImportPds/unitTest.cpp | 61 +- .../ProcessImportVicar/ProcessImportVicar.cpp | 34 +- .../ProcessImportVicar/ProcessImportVicar.h | 4 +- .../base/objs/ProcessImportVicar/unitTest.cpp | 23 +- .../ProcessMapMosaic/ProcessMapMosaic.cpp | 56 +- .../objs/ProcessMapMosaic/ProcessMapMosaic.h | 18 +- .../base/objs/ProcessMosaic/ProcessMosaic.cpp | 132 ++-- .../base/objs/ProcessMosaic/ProcessMosaic.h | 16 +- isis/src/base/objs/ProcessMosaic/unitTest.cpp | 4 +- .../objs/ProcessPolygons/ProcessPolygons.cpp | 34 +- .../objs/ProcessPolygons/ProcessPolygons.h | 8 +- .../base/objs/ProcessPolygons/unitTest.cpp | 11 +- .../base/objs/ProcessRubberSheet/unitTest.cpp | 2 +- .../objs/ProgramLauncher/ProgramLauncher.cpp | 44 +- .../objs/ProgramLauncher/ProgramLauncher.h | 9 +- isis/src/base/objs/Progress/Progress.cpp | 8 +- isis/src/base/objs/Progress/Progress.h | 10 +- isis/src/base/objs/Progress/unitTest.cpp | 4 +- isis/src/base/objs/Projection/Projection.cpp | 106 +-- isis/src/base/objs/Projection/Projection.h | 16 +- .../src/base/objs/Projection/Projection.truth | 2 +- isis/src/base/objs/Projection/unitTest.cpp | 70 +- .../ProjectionFactory/ProjectionFactory.cpp | 56 +- .../ProjectionFactory/ProjectionFactory.truth | 2 +- .../base/objs/ProjectionFactory/unitTest.cpp | 83 +- .../base/objs/PushFrameCamera/unitTest.cpp | 2 +- isis/src/base/objs/Pvl/Pvl.cpp | 54 +- isis/src/base/objs/Pvl/Pvl.h | 16 +- isis/src/base/objs/Pvl/unitTest.cpp | 42 +- .../base/objs/PvlContainer/PvlContainer.cpp | 64 +- .../src/base/objs/PvlContainer/PvlContainer.h | 50 +- isis/src/base/objs/PvlContainer/unitTest.cpp | 22 +- .../base/objs/PvlEditDialog/PvlEditDialog.cpp | 10 +- isis/src/base/objs/PvlFormat/PvlFormat.cpp | 48 +- isis/src/base/objs/PvlFormat/PvlFormat.h | 23 +- isis/src/base/objs/PvlFormat/PvlFormat.truth | 8 +- isis/src/base/objs/PvlFormat/unitTest.cpp | 16 +- .../base/objs/PvlFormatPds/PvlFormatPds.cpp | 144 ++-- .../src/base/objs/PvlFormatPds/PvlFormatPds.h | 28 +- isis/src/base/objs/PvlFormatPds/unitTest.cpp | 322 ++++---- isis/src/base/objs/PvlGroup/PvlGroup.cpp | 12 +- isis/src/base/objs/PvlGroup/PvlGroup.h | 2 +- isis/src/base/objs/PvlGroup/unitTest.cpp | 16 +- isis/src/base/objs/PvlKeyword/PvlKeyword.cpp | 561 +++++++------- isis/src/base/objs/PvlKeyword/PvlKeyword.h | 87 +-- isis/src/base/objs/PvlKeyword/unitTest.cpp | 82 +- isis/src/base/objs/PvlObject/PvlObject.cpp | 70 +- isis/src/base/objs/PvlObject/PvlObject.h | 30 +- isis/src/base/objs/PvlObject/unitTest.cpp | 6 +- .../src/base/objs/PvlSequence/PvlSequence.cpp | 22 +- isis/src/base/objs/PvlSequence/PvlSequence.h | 12 +- isis/src/base/objs/PvlSequence/unitTest.cpp | 23 +- isis/src/base/objs/PvlToken/PvlToken.cpp | 44 +- isis/src/base/objs/PvlToken/PvlToken.h | 23 +- isis/src/base/objs/PvlToken/unitTest.cpp | 9 +- .../base/objs/PvlTokenizer/PvlTokenizer.cpp | 114 +-- .../src/base/objs/PvlTokenizer/PvlTokenizer.h | 18 +- isis/src/base/objs/PvlTokenizer/unitTest.cpp | 26 +- .../PvlTranslationManager.cpp | 26 +- .../PvlTranslationManager.h | 14 +- .../PvlTranslationManager.truth | 2 +- .../objs/PvlTranslationManager/unitTest.cpp | 26 +- .../PvlTranslationTable.cpp | 101 ++- .../PvlTranslationTable/PvlTranslationTable.h | 18 +- isis/src/base/objs/QtExporter/QtExporter.cpp | 17 +- isis/src/base/objs/QtExporter/QtExporter.h | 8 +- isis/src/base/objs/QtImporter/unitTest.cpp | 2 +- isis/src/base/objs/RadarCamera/unitTest.cpp | 2 +- .../RadarSlantRangeMap/RadarSlantRangeMap.cpp | 12 +- isis/src/base/objs/Ransac/Ransac.h | 2 +- isis/src/base/objs/Reduce/Reduce.cpp | 20 +- isis/src/base/objs/Reduce/Reduce.h | 6 +- isis/src/base/objs/Reduce/unitTest.cpp | 6 +- .../ReseauDistortionMap.cpp | 10 +- .../ReseauDistortionMap/ReseauDistortionMap.h | 2 +- isis/src/base/objs/SampleManager/unitTest.cpp | 9 +- isis/src/base/objs/Sensor/unitTest.cpp | 6 +- .../base/objs/SerialNumber/SerialNumber.cpp | 42 +- .../src/base/objs/SerialNumber/SerialNumber.h | 10 +- isis/src/base/objs/SerialNumber/unitTest.cpp | 36 +- .../SerialNumberList/SerialNumberList.cpp | 131 ++-- .../objs/SerialNumberList/SerialNumberList.h | 39 +- .../base/objs/SerialNumberList/unitTest.cpp | 2 +- isis/src/base/objs/SessionLog/SessionLog.cpp | 8 +- isis/src/base/objs/SessionLog/SessionLog.h | 6 +- isis/src/base/objs/SessionLog/unitTest.cpp | 39 +- isis/src/base/objs/Shade/Shade.truth | 2 +- isis/src/base/objs/Shade/unitTest.cpp | 2 +- isis/src/base/objs/ShadeAtm/unitTest.cpp | 4 +- isis/src/base/objs/ShapeModel/ShapeModel.cpp | 6 +- isis/src/base/objs/ShapeModel/ShapeModel.h | 9 +- isis/src/base/objs/ShapeModel/unitTest.cpp | 8 +- .../ShapeModelFactory/ShapeModelFactory.cpp | 14 +- .../ShapeModelFactory/ShapeModelFactory.truth | 6 +- .../base/objs/ShapeModelFactory/unitTest.cpp | 16 +- .../SimpleCylindrical/SimpleCylindrical.cpp | 12 +- .../SimpleCylindrical/SimpleCylindrical.h | 4 +- .../base/objs/SimpleCylindrical/unitTest.cpp | 50 +- isis/src/base/objs/Sinusoidal/Sinusoidal.cpp | 12 +- isis/src/base/objs/Sinusoidal/Sinusoidal.h | 4 +- isis/src/base/objs/Sinusoidal/unitTest.cpp | 52 +- .../src/base/objs/SmtkMatcher/SmtkMatcher.cpp | 20 +- isis/src/base/objs/SmtkMatcher/SmtkMatcher.h | 10 +- isis/src/base/objs/SmtkMatcher/SmtkPoint.h | 2 +- isis/src/base/objs/SmtkMatcher/SmtkStack.h | 2 +- .../src/base/objs/SpecialPixel/SpecialPixel.h | 43 +- .../base/objs/SpecialPixel/SpecialPixel.truth | 6 +- isis/src/base/objs/SpecialPixel/unitTest.cpp | 11 +- .../objs/Spice/LightTimeCorrectionState.cpp | 18 +- .../base/objs/Spice/SpacecraftPosition.cpp | 8 +- isis/src/base/objs/Spice/SpacecraftPosition.h | 4 +- isis/src/base/objs/Spice/Spice.cpp | 87 ++- isis/src/base/objs/Spice/Spice.h | 22 +- .../src/base/objs/Spice/getSpkAbCorrState.hpp | 8 +- isis/src/base/objs/Spice/unitTest.cpp | 14 +- .../base/objs/SpicePosition/SpicePosition.cpp | 62 +- .../base/objs/SpicePosition/SpicePosition.h | 16 +- isis/src/base/objs/SpicePosition/unitTest.cpp | 71 +- .../base/objs/SpiceRotation/SpiceRotation.cpp | 74 +- .../base/objs/SpiceRotation/SpiceRotation.h | 4 +- isis/src/base/objs/SpiceRotation/unitTest.cpp | 38 +- .../StandardDeviationOperator.h | 2 +- .../StandardDeviationOperator/unitTest.cpp | 26 +- isis/src/base/objs/Stretch/Stretch.cpp | 78 +- isis/src/base/objs/Stretch/Stretch.h | 16 +- isis/src/base/objs/Stretch/unitTest.cpp | 49 +- .../StripPolygonSeeder/StripPolygonSeeder.cpp | 20 +- .../StripPolygonSeeder/StripPolygonSeeder.h | 4 +- .../base/objs/StripPolygonSeeder/unitTest.cpp | 28 +- isis/src/base/objs/SubArea/SubArea.cpp | 14 +- isis/src/base/objs/SubArea/unitTest.cpp | 206 ++--- isis/src/base/objs/Table/Table.cpp | 30 +- isis/src/base/objs/Table/Table.h | 8 +- isis/src/base/objs/Table/Table.truth | Bin 1678 -> 1542 bytes isis/src/base/objs/Table/unitTest.cpp | 14 +- isis/src/base/objs/TableField/TableField.cpp | 112 +-- isis/src/base/objs/TableField/TableField.h | 15 +- isis/src/base/objs/TableField/unitTest.cpp | 20 +- .../src/base/objs/TableRecord/TableRecord.cpp | 8 +- isis/src/base/objs/TableRecord/TableRecord.h | 2 +- isis/src/base/objs/Target/Target.cpp | 12 +- isis/src/base/objs/Target/Target.h | 7 +- isis/src/base/objs/Target/unitTest.cpp | 16 +- isis/src/base/objs/TextFile/TextFile.cpp | 100 +-- isis/src/base/objs/TextFile/TextFile.h | 46 +- isis/src/base/objs/TextFile/TextFile.truth | 10 +- isis/src/base/objs/TextFile/unitTest.cpp | 96 +-- .../base/objs/TiffExporter/TiffExporter.cpp | 7 +- .../src/base/objs/TiffExporter/TiffExporter.h | 2 +- .../base/objs/TiffImporter/TiffImporter.cpp | 2 +- isis/src/base/objs/TiffImporter/unitTest.cpp | 5 +- isis/src/base/objs/TileManager/TileManager.h | 2 +- isis/src/base/objs/TileManager/unitTest.cpp | 14 +- isis/src/base/objs/Topo/unitTest.cpp | 4 +- isis/src/base/objs/TopoAtm/unitTest.cpp | 6 +- .../TransverseMercator/TransverseMercator.cpp | 10 +- .../TransverseMercator/TransverseMercator.h | 4 +- .../base/objs/TransverseMercator/unitTest.cpp | 104 +-- .../UniversalGroundMap/UniversalGroundMap.cpp | 2 +- .../base/objs/UserInterface/UserInterface.cpp | 199 ++--- .../base/objs/UserInterface/UserInterface.h | 24 +- isis/src/base/objs/UserInterface/unitTest.cpp | 17 +- isis/src/base/objs/VecFilter/VecFilter.cpp | 2 +- isis/src/base/objs/VecFilter/VecFilter.h | 4 +- isis/src/base/objs/iTime/iTime.cpp | 82 +- isis/src/base/objs/iTime/iTime.h | 31 +- isis/src/base/objs/iTime/iTime.truth | 14 +- isis/src/base/objs/iTime/unitTest.cpp | 102 +-- isis/src/cassini/apps/ciss2isis/ciss2isis.cpp | 86 +-- isis/src/cassini/apps/cisscal/DarkCurrent.cpp | 30 +- isis/src/cassini/apps/cisscal/DarkCurrent.h | 26 +- isis/src/cassini/apps/cisscal/cisscal.cpp | 216 +++--- isis/src/cassini/apps/vims2isis/vims2isis.cpp | 116 +-- isis/src/cassini/apps/vims2map/vims2map.cpp | 54 +- isis/src/cassini/apps/vimscal/vimscal.cpp | 58 +- .../cassini/objs/CissLabels/CissLabels.cpp | 30 +- isis/src/cassini/objs/CissLabels/CissLabels.h | 74 +- .../cassini/objs/CisscalFile/CisscalFile.cpp | 17 +- .../cassini/objs/CisscalFile/CisscalFile.h | 11 +- .../src/cassini/objs/CisscalFile/unitTest.cpp | 12 +- .../cassini/objs/IssNACamera/IssNACamera.cpp | 14 +- .../src/cassini/objs/IssNACamera/unitTest.cpp | 4 +- .../cassini/objs/IssWACamera/IssWACamera.cpp | 14 +- .../cassini/objs/IssWACamera/IssWACamera.h | 2 +- .../src/cassini/objs/IssWACamera/unitTest.cpp | 4 +- .../cassini/objs/VimsCamera/VimsCamera.cpp | 18 +- .../cassini/objs/VimsCamera/VimsGroundMap.cpp | 13 +- .../cassini/objs/VimsCamera/VimsGroundMap.h | 2 +- .../cassini/objs/VimsCamera/VimsSkyMap.cpp | 19 +- isis/src/cassini/objs/VimsCamera/VimsSkyMap.h | 2 +- .../clementine/apps/clem2isis/clem2isis.cpp | 52 +- .../apps/clemhirescal/clemhirescal.cpp | 18 +- .../clementine/apps/clemnircal/clemnircal.cpp | 99 +-- .../apps/clemuvviscal/clemuvviscal.cpp | 66 +- .../objs/HiresCamera/HiresCamera.cpp | 10 +- .../clementine/objs/HiresCamera/unitTest.cpp | 4 +- .../clementine/objs/LwirCamera/LwirCamera.cpp | 10 +- .../clementine/objs/LwirCamera/unitTest.cpp | 4 +- .../clementine/objs/NirCamera/NirCamera.cpp | 10 +- .../clementine/objs/NirCamera/unitTest.cpp | 4 +- .../objs/UvvisCamera/UvvisCamera.cpp | 6 +- .../clementine/objs/UvvisCamera/UvvisCamera.h | 2 +- .../clementine/objs/UvvisCamera/unitTest.cpp | 4 +- isis/src/control/apps/autoseed/autoseed.cpp | 44 +- isis/src/control/apps/cnet2mat/cnet2mat.cpp | 48 +- isis/src/control/apps/cnetadd/cnetadd.cpp | 18 +- isis/src/control/apps/cnetcheck/cnetcheck.cpp | 194 +++-- isis/src/control/apps/cnetdiff/cnetdiff.cpp | 52 +- isis/src/control/apps/cnetedit/cnetedit.cpp | 127 ++-- .../control/apps/cnetextract/cnetextract.cpp | 160 ++-- isis/src/control/apps/cnethist/cnethist.cpp | 32 +- isis/src/control/apps/cnetmerge/cnetmerge.cpp | 31 +- .../apps/cnetnewradii/cnetnewradii.cpp | 18 +- .../apps/cnetref/CnetRefByEmission.cpp | 44 +- .../control/apps/cnetref/CnetRefByEmission.h | 2 +- .../apps/cnetref/CnetRefByIncidence.cpp | 42 +- .../control/apps/cnetref/CnetRefByIncidence.h | 2 +- .../apps/cnetref/CnetRefByResolution.cpp | 46 +- .../apps/cnetref/CnetRefByResolution.h | 2 +- isis/src/control/apps/cnetref/cnetref.cpp | 40 +- isis/src/control/apps/cnetsplit/cnetsplit.cpp | 6 +- isis/src/control/apps/cnetstats/cnetstats.cpp | 18 +- isis/src/control/apps/cnettable/cnettable.cpp | 172 ++--- .../control/apps/cnetwinnow/cnetwinnow.cpp | 22 +- isis/src/control/apps/coreg/coreg.cpp | 62 +- isis/src/control/apps/deltack/deltack.cpp | 16 +- isis/src/control/apps/fplanemap/fplanemap.cpp | 22 +- isis/src/control/apps/jigsaw/jigsaw.cpp | 20 +- isis/src/control/apps/mat2cnet/mat2cnet.cpp | 153 ++-- isis/src/control/apps/pointreg/pointreg.cpp | 74 +- isis/src/control/apps/seedgrid/seedgrid.cpp | 72 +- isis/src/control/apps/slither/ControlByRow.h | 2 +- isis/src/control/apps/slither/slither.cpp | 12 +- isis/src/control/apps/warp/WarpTransform.cpp | 6 +- isis/src/control/apps/warp/warp.cpp | 12 +- .../objs/BundleAdjust/BundleAdjust.cpp | 430 +++++------ .../control/objs/BundleAdjust/BundleAdjust.h | 40 +- .../ControlCubeGraphNode.cpp | 20 +- .../ControlCubeGraphNode.h | 7 +- .../objs/ControlGraph/ControlGraph.cpp | 2 +- .../objs/ControlMeasure/ControlMeasure.cpp | 56 +- .../objs/ControlMeasure/ControlMeasure.h | 27 +- .../ControlMeasureLogData.cpp | 15 +- .../ControlMeasureLogData.h | 6 +- .../objs/ControlMeasureLogData/unitTest.cpp | 2 +- .../control/objs/ControlNet/ControlNet.cpp | 102 +-- isis/src/control/objs/ControlNet/ControlNet.h | 78 +- isis/src/control/objs/ControlNet/unitTest.cpp | 6 +- .../objs/ControlNetDiff/ControlNetDiff.cpp | 62 +- .../objs/ControlNetDiff/ControlNetDiff.h | 18 +- .../ControlNetFilter/ControlNetFilter.cpp | 180 +++-- .../objs/ControlNetFilter/ControlNetFilter.h | 14 +- .../objs/ControlNetFilter/unitTest.cpp | 40 +- .../ControlNetStatistics.cpp | 102 +-- .../ControlNetStatistics.h | 24 +- .../objs/ControlNetStatistics/unitTest.cpp | 8 +- .../ControlNetValidMeasure.cpp | 130 ++-- .../ControlNetValidMeasure.h | 7 +- .../objs/ControlNetValidMeasure/unitTest.cpp | 148 ++-- .../ControlNetFileV0001.cpp | 84 +- .../ControlNetFileV0002.cpp | 142 ++-- .../ControlNetVersioner.cpp | 162 ++-- .../ControlNetVersioner/ControlNetVersioner.h | 26 +- .../objs/ControlNetVersioner/unitTest.cpp | 6 +- .../objs/ControlPoint/ControlPoint.cpp | 134 ++-- .../control/objs/ControlPoint/ControlPoint.h | 68 +- .../ControlPointList/ControlPointList.cpp | 34 +- .../objs/ControlPointList/ControlPointList.h | 6 +- .../objs/ControlPointList/unitTest.cpp | 1 + .../InterestOperator/InterestOperator.cpp | 92 +-- .../objs/InterestOperator/InterestOperator.h | 6 +- .../objs/InterestOperator/unitTest.cpp | 22 +- .../InterestOperatorFactory.cpp | 2 +- .../InterestOperatorFactory.h | 2 +- isis/src/database/objs/Database/Database.cpp | 76 +- isis/src/database/objs/Database/Database.h | 38 +- isis/src/database/objs/Database/unitTest.cpp | 8 +- .../objs/DatabaseFactory/DatabaseFactory.cpp | 71 +- .../objs/DatabaseFactory/DatabaseFactory.h | 52 +- .../objs/DatabaseFactory/unitTest.cpp | 4 +- isis/src/database/objs/DbAccess/DbAccess.cpp | 23 +- isis/src/database/objs/DbAccess/DbAccess.h | 22 +- .../src/database/objs/DbProfile/DbProfile.cpp | 21 +- isis/src/database/objs/DbProfile/DbProfile.h | 38 +- isis/src/database/objs/SqlQuery/SqlQuery.cpp | 2 +- isis/src/database/objs/SqlQuery/SqlQuery.h | 28 +- .../src/database/objs/SqlRecord/SqlRecord.cpp | 52 +- isis/src/database/objs/SqlRecord/SqlRecord.h | 29 +- isis/src/database/objs/SqlRecord/unitTest.cpp | 9 +- .../src/dawn/apps/dawnfc2isis/dawnfc2isis.cpp | 52 +- .../dawn/apps/dawnvir2isis/dawnvir2isis.cpp | 48 +- .../dawn/objs/DawnFcCamera/DawnFcCamera.cpp | 10 +- isis/src/dawn/objs/DawnFcCamera/unitTest.cpp | 4 +- .../dawn/objs/DawnVirCamera/DawnVirCamera.cpp | 76 +- .../dawn/objs/DawnVirCamera/DawnVirCamera.h | 10 +- .../galileo/apps/gllssi2isis/gllssi2isis.cpp | 44 +- isis/src/galileo/apps/gllssical/gllssical.cpp | 131 ++-- isis/src/galileo/objs/SsiCamera/SsiCamera.cpp | 12 +- isis/src/galileo/objs/SsiCamera/unitTest.cpp | 4 +- .../apps/kaguyatc2isis/kaguyatc2isis.cpp | 20 +- isis/src/lo/apps/lo2isis/lo2isis.cpp | 36 +- isis/src/lo/apps/lopdsgen/lopdsgen.cpp | 52 +- .../LoCameraFiducialMap.cpp | 8 +- .../src/lo/objs/LoHighCamera/LoHighCamera.cpp | 6 +- .../objs/LoHighCamera/LoHighDistortionMap.cpp | 4 +- isis/src/lo/objs/LoHighCamera/unitTest.cpp | 4 +- .../lo/objs/LoMediumCamera/LoMediumCamera.cpp | 6 +- .../LoMediumCamera/LoMediumDistortionMap.cpp | 2 +- isis/src/lo/objs/LoMediumCamera/unitTest.cpp | 4 +- isis/src/local/apps/basemapmos/basemapmos.cpp | 72 +- isis/src/local/apps/camcoeffs/camcoeffs.cpp | 48 +- .../local/apps/cissua2isis/cissua2isis.cpp | 66 +- .../apps/kaguyami2isis/kaguyami2isis.cpp | 36 +- isis/src/local/apps/polytool/polytool.cpp | 10 +- .../objs/KaguyaMiCamera/KaguyaMiCamera.cpp | 6 +- .../KaguyaMiCameraDistortionMap.cpp | 6 +- isis/src/lro/apps/lronac2isis/lronac2isis.cpp | 34 +- isis/src/lro/apps/lronac2pds/lronac2pds.cpp | 72 +- isis/src/lro/apps/lronac2pds/md5wrapper.cpp | 32 +- isis/src/lro/apps/lronac2pds/md5wrapper.h | 12 +- isis/src/lro/apps/lronaccal/lronaccal.cpp | 118 +-- isis/src/lro/apps/lrowac2isis/lrowac2isis.cpp | 114 +-- isis/src/lro/apps/lrowac2pds/lrowac2pds.cpp | 82 +- isis/src/lro/apps/lrowac2pds/md5wrapper.cpp | 32 +- isis/src/lro/apps/lrowac2pds/md5wrapper.h | 31 +- isis/src/lro/apps/lrowaccal/lrowaccal.cpp | 154 ++-- isis/src/lro/apps/lrowacpho/Exponential.cpp | 54 +- isis/src/lro/apps/lrowacpho/Exponential.h | 6 +- .../lro/apps/lrowacpho/HapkeExponential.cpp | 52 +- .../src/lro/apps/lrowacpho/HapkeExponential.h | 4 +- isis/src/lro/apps/lrowacpho/Hillier.cpp | 68 +- isis/src/lro/apps/lrowacpho/Hillier.h | 4 +- .../lro/apps/lrowacpho/PhotometricFunction.h | 10 +- isis/src/lro/apps/mrf2isis/mrf2isis.cpp | 42 +- isis/src/lro/apps/mrf2pds/mrf2pds.cpp | 60 +- .../LroNarrowAngleCamera.cpp | 16 +- .../LroNarrowAngleDistortionMap.cpp | 2 +- .../LroWideAngleCamera/LroWideAngleCamera.cpp | 30 +- .../LroWideAngleCamera/LroWideAngleCamera.h | 4 +- .../LroWideAngleCameraDistortionMap.cpp | 2 +- isis/src/lro/objs/MiniRF/MiniRF.cpp | 4 +- .../mariner/apps/mar102isis/mar102isis.cpp | 147 ++-- isis/src/mariner/apps/mar10cal/mar10cal.cpp | 30 +- .../mariner/apps/mar10clean/mar10clean.cpp | 8 +- .../apps/mar10nonoise/mar10nonoise.cpp | 4 +- .../apps/mar10restore/mar10restore.cpp | 14 +- .../objs/Mariner10Camera/Mariner10Camera.cpp | 22 +- .../mariner/objs/Mariner10Camera/unitTest.cpp | 4 +- isis/src/mer/apps/mer2isis/mer2isis.cpp | 16 +- isis/src/mer/apps/mical/MiCalibration.cpp | 22 +- isis/src/mer/apps/mical/MiCalibration.h | 32 +- isis/src/mer/apps/mical/mical.cpp | 50 +- .../messenger/apps/mdis2isis/mdis2isis.cpp | 66 +- isis/src/messenger/apps/mdis2pds/mdis2pds.cpp | 48 +- .../messenger/apps/mdiscal/DarkModelPixel.h | 10 +- .../src/messenger/apps/mdiscal/MdisCalUtils.h | 98 +-- isis/src/messenger/apps/mdiscal/mdiscal.cpp | 90 +-- isis/src/messenger/apps/mdisddr/mdisddr.cpp | 73 +- .../messenger/apps/mdisedrinfo/MdisEdrKeys.h | 64 +- .../apps/mdisedrinfo/MdisGeometry.cpp | 66 +- .../messenger/apps/mdisedrinfo/MdisGeometry.h | 33 +- .../apps/mdisedrinfo/SpiceManager.cpp | 36 +- .../messenger/apps/mdisedrinfo/SpiceManager.h | 14 +- .../apps/mdisedrinfo/mdisedrinfo.cpp | 59 +- isis/src/messenger/apps/mdisproc/mdisproc.cpp | 6 +- .../messenger/objs/MdisCamera/MdisCamera.cpp | 20 +- .../messenger/objs/MdisCamera/MdisCamera.h | 2 +- .../MdisCamera/TaylorCameraDistortionMap.cpp | 4 +- .../messenger/objs/MdisCamera/unitTest.cpp | 4 +- isis/src/mex/apps/hrsc2isis/hrsc2isis.cpp | 48 +- isis/src/mex/objs/HrscCamera/HrscCamera.cpp | 10 +- isis/src/mex/objs/HrscCamera/HrscCamera.h | 2 +- isis/src/mgs/apps/moc2isis/moc2isis.cpp | 119 ++- isis/src/mgs/apps/moccal/moccal.cpp | 70 +- isis/src/mgs/apps/mocnoise50/mocnoise50.cpp | 18 +- isis/src/mgs/apps/mocproc/mocproc.cpp | 8 +- isis/src/mgs/apps/mocuncompress/CheckSum.h | 2 +- isis/src/mgs/apps/mocuncompress/bitsOut.h | 2 +- isis/src/mgs/apps/mocuncompress/decompNONE.h | 2 +- isis/src/mgs/apps/mocuncompress/decompSYNC.h | 2 +- isis/src/mgs/apps/mocuncompress/decompXPRED.h | 2 +- .../mgs/apps/mocuncompress/decompXPREDYPRED.h | 2 +- isis/src/mgs/apps/mocuncompress/decompYPRED.h | 2 +- .../apps/mocuncompress/encodeCoefs.static.h | 2 +- isis/src/mgs/apps/mocuncompress/fs.h | 2 +- isis/src/mgs/apps/mocuncompress/initBlock.h | 2 +- isis/src/mgs/apps/mocuncompress/limits.h | 2 +- isis/src/mgs/apps/mocuncompress/nextValue.h | 2 +- .../mgs/apps/mocuncompress/predCompCommon.h | 2 +- .../mgs/apps/mocuncompress/predDecompCommon.h | 2 +- .../mocuncompress/predictiveDecompressor.h | 2 +- isis/src/mgs/apps/mocuncompress/readBits.h | 2 +- isis/src/mgs/apps/mocuncompress/readBlock.h | 2 +- isis/src/mgs/apps/mocuncompress/readCoef.h | 2 +- isis/src/mgs/apps/mocuncompress/readGroups.h | 2 +- isis/src/mgs/apps/mocuncompress/reorder.h | 2 +- .../mgs/apps/mocuncompress/reorder.static.h | 2 +- isis/src/mgs/apps/mocuncompress/types.h | 2 +- isis/src/mgs/objs/MocLabels/MocLabels.cpp | 77 +- isis/src/mgs/objs/MocLabels/MocLabels.h | 27 +- .../MocNarrowAngleCamera.cpp | 2 +- .../MocWideAngleCamera/MocWideAngleCamera.cpp | 2 +- isis/src/mro/apps/crism2isis/crism2isis.cpp | 49 +- isis/src/mro/apps/ctxcal/ctxcal.cpp | 24 +- isis/src/mro/apps/ctxevenodd/ctxevenodd.cpp | 8 +- isis/src/mro/apps/hi2isis/hi2isis.cpp | 106 ++- .../src/mro/apps/hical/GainChannelNormalize.h | 2 +- isis/src/mro/apps/hical/GainFlatField.h | 4 +- isis/src/mro/apps/hical/GainLineDrift.h | 4 +- isis/src/mro/apps/hical/GainNonLinearity.h | 4 +- isis/src/mro/apps/hical/GainTemperature.h | 6 +- isis/src/mro/apps/hical/GainUnitConversion.h | 6 +- isis/src/mro/apps/hical/HiBlob.h | 8 +- isis/src/mro/apps/hical/HiCalConf.cpp | 110 +-- isis/src/mro/apps/hical/HiCalConf.h | 40 +- isis/src/mro/apps/hical/HiCalData.h | 2 +- isis/src/mro/apps/hical/HiCalTypes.h | 20 +- isis/src/mro/apps/hical/HiCalUtil.h | 42 +- isis/src/mro/apps/hical/LoadCSV.cpp | 99 +-- isis/src/mro/apps/hical/LoadCSV.h | 28 +- isis/src/mro/apps/hical/LowPassFilter.h | 6 +- isis/src/mro/apps/hical/Module.h | 34 +- isis/src/mro/apps/hical/NonLinearLSQ.cpp | 4 +- isis/src/mro/apps/hical/NonLinearLSQ.h | 26 +- isis/src/mro/apps/hical/SplineFill.h | 8 +- isis/src/mro/apps/hical/ZeroBufferFit.cpp | 22 +- isis/src/mro/apps/hical/ZeroBufferFit.h | 2 +- isis/src/mro/apps/hical/ZeroBufferSmooth.h | 10 +- isis/src/mro/apps/hical/ZeroDark.h | 8 +- isis/src/mro/apps/hical/ZeroReverse.h | 20 +- isis/src/mro/apps/hical/hical.cpp | 34 +- .../mro/apps/hicalbeta/GainChannelNormalize.h | 2 +- isis/src/mro/apps/hicalbeta/GainFlatField.h | 2 +- isis/src/mro/apps/hicalbeta/GainLineDrift.h | 2 +- .../src/mro/apps/hicalbeta/GainNonLinearity.h | 2 +- isis/src/mro/apps/hicalbeta/GainTemperature.h | 4 +- .../mro/apps/hicalbeta/GainUnitConversion.h | 6 +- isis/src/mro/apps/hicalbeta/HiBlob.h | 8 +- isis/src/mro/apps/hicalbeta/HiCalConf.cpp | 114 +-- isis/src/mro/apps/hicalbeta/HiCalConf.h | 42 +- isis/src/mro/apps/hicalbeta/HiCalData.h | 2 +- isis/src/mro/apps/hicalbeta/HiCalTypes.h | 22 +- isis/src/mro/apps/hicalbeta/HiCalUtil.h | 42 +- isis/src/mro/apps/hicalbeta/LoadCSV.cpp | 105 +-- isis/src/mro/apps/hicalbeta/LoadCSV.h | 28 +- isis/src/mro/apps/hicalbeta/LowPassFilter.h | 6 +- isis/src/mro/apps/hicalbeta/Module.h | 34 +- isis/src/mro/apps/hicalbeta/NonLinearLSQ.h | 2 +- isis/src/mro/apps/hicalbeta/SplineFill.h | 8 +- isis/src/mro/apps/hicalbeta/ZeroBufferFit.cpp | 22 +- isis/src/mro/apps/hicalbeta/ZeroBufferFit.h | 2 +- .../src/mro/apps/hicalbeta/ZeroBufferSmooth.h | 10 +- isis/src/mro/apps/hicalbeta/ZeroDark.h | 8 +- isis/src/mro/apps/hicalbeta/ZeroReverse.h | 20 +- isis/src/mro/apps/hicalbeta/hicalbeta.cpp | 32 +- isis/src/mro/apps/hicalproc/hicalproc.cpp | 87 ++- isis/src/mro/apps/hiccdstitch/hiccdstitch.cpp | 60 +- isis/src/mro/apps/hicolormos/hicolormos.cpp | 56 +- isis/src/mro/apps/hicrop/hicrop.cpp | 50 +- .../hicrop/tsts/cropByJitterFile/Makefile | 6 +- isis/src/mro/apps/hicubeit/hicubeit.cpp | 74 +- isis/src/mro/apps/hicubenorm/hicubenorm.cpp | 78 +- isis/src/mro/apps/hideal2pds/hideal2pds.cpp | 82 +- isis/src/mro/apps/hidestripe/hidestripe.cpp | 16 +- isis/src/mro/apps/hidtmgen/hidtmgen.cpp | 102 +-- isis/src/mro/apps/hiequal/hiequal.cpp | 2 +- isis/src/mro/apps/hifringe/hifringe.cpp | 43 +- isis/src/mro/apps/hifurrows/hifurrows.cpp | 6 +- isis/src/mro/apps/higlob/higlob.cpp | 2 +- isis/src/mro/apps/hijitreg/HiJitCube.cpp | 29 +- isis/src/mro/apps/hijitreg/HiJitCube.h | 22 +- isis/src/mro/apps/hijitreg/hijitreg.cpp | 32 +- isis/src/mro/apps/hijitter/hijitter.cpp | 158 ++-- .../mro/apps/hijitter/tsts/default/Makefile | 2 +- .../mro/apps/hijitter/tsts/withCrop/Makefile | 2 +- isis/src/mro/apps/himos/himos.cpp | 88 +-- isis/src/mro/apps/hinoise/hinoise.cpp | 144 ++-- isis/src/mro/apps/hirdr2isis/hirdr2isis.cpp | 16 +- isis/src/mro/apps/hirdrgen/hirdrgen.cpp | 58 +- isis/src/mro/apps/hisharpen/hisharpen.cpp | 68 +- isis/src/mro/apps/histat/histat.cpp | 36 +- isis/src/mro/apps/histitch/histitch.cpp | 46 +- isis/src/mro/apps/marci2isis/marci2isis.cpp | 68 +- isis/src/mro/apps/marcical/marcical.cpp | 44 +- isis/src/mro/apps/marciflip/marciflip.cpp | 2 +- isis/src/mro/apps/mroctx2isis/mroctx2isis.cpp | 34 +- isis/src/mro/apps/pds2hideal/pds2hideal.cpp | 38 +- isis/src/mro/objs/CTXCamera/CTXCamera.cpp | 6 +- .../objs/HiEqualization/HiEqualization.cpp | 22 +- .../mro/objs/HiEqualization/HiEqualization.h | 8 +- isis/src/mro/objs/HiEqualization/unitTest.cpp | 4 +- .../mro/objs/HiriseCamera/HiriseCamera.cpp | 2 +- isis/src/mro/objs/MarciCamera/MarciCamera.cpp | 56 +- .../objs/MarciCamera/MarciDistortionMap.cpp | 2 +- isis/src/odyssey/apps/thm2isis/thm2isis.cpp | 86 +-- .../odyssey/apps/thmbasemap1/thmbasemap1.cpp | 108 +-- isis/src/odyssey/apps/thmnoseam/thmnoseam.cpp | 14 +- isis/src/odyssey/apps/thmproc/thmproc.cpp | 6 +- .../odyssey/apps/thmvisflat/thmvisflat.cpp | 14 +- .../odyssey/apps/thmvistrim/thmvistrim.cpp | 6 +- .../objs/ThemisIrCamera/ThemisIrCamera.cpp | 6 +- .../objs/ThemisIrCamera/ThemisIrCamera.h | 2 +- .../objs/ThemisVisCamera/ThemisVisCamera.cpp | 4 +- .../apps/cneteditor/AbstractTreeModel.cpp | 4 +- .../apps/cneteditor/CnetDisplayProperties.cpp | 4 +- .../apps/cneteditor/CnetEditorWindow.cpp | 8 +- .../apps/cneteditor/PointTableDelegate.cpp | 2 +- .../qisis/apps/qnet/QnetCubeNameFilter.cpp | 8 +- isis/src/qisis/apps/qnet/QnetFileTool.cpp | 38 +- isis/src/qisis/apps/qnet/QnetFileTool.h | 3 - .../qisis/apps/qnet/QnetFixedPointDialog.cpp | 2 +- .../qisis/apps/qnet/QnetFixedPointDialog.h | 4 +- isis/src/qisis/apps/qnet/QnetNavTool.cpp | 28 +- .../qisis/apps/qnet/QnetNewMeasureDialog.cpp | 4 +- .../qisis/apps/qnet/QnetNewMeasureDialog.h | 4 +- .../qisis/apps/qnet/QnetNewPointDialog.cpp | 2 +- .../apps/qnet/QnetPointCubeNameFilter.cpp | 6 +- .../src/qisis/apps/qnet/QnetPointIdFilter.cpp | 4 +- .../qisis/apps/qnet/QnetSetAprioriDialog.cpp | 2 +- isis/src/qisis/apps/qnet/QnetTool.cpp | 138 ++-- isis/src/qisis/apps/qnet/QnetTool.h | 19 +- isis/src/qisis/apps/qnet/qnet.cpp | 6 +- isis/src/qisis/apps/qtie/QtieFileTool.cpp | 34 +- isis/src/qisis/apps/qtie/QtieTool.cpp | 40 +- isis/src/qisis/apps/qtie/QtieTool.h | 4 +- isis/src/qisis/apps/qview/qview.cpp | 28 +- .../AdvancedTrackTool/AdvancedTrackTool.cpp | 38 +- .../AdvancedTrackTool/AdvancedTrackTool.h | 4 +- .../qisis/objs/BandSpinBox/BandSpinBox.cpp | 6 +- isis/src/qisis/objs/BandTool/BandTool.cpp | 8 +- isis/src/qisis/objs/BlinkTool/BlinkTool.cpp | 8 +- .../qisis/objs/ChipViewport/ChipViewport.cpp | 14 +- .../ConcurrentControlNetReader.cpp | 16 +- .../ControlPointEdit/ControlPointEdit.cpp | 54 +- .../objs/ControlPointEdit/ControlPointEdit.h | 20 +- .../CubeDisplayProperties.cpp | 12 +- .../objs/CubePlotCurve/CubePlotCurve.cpp | 2 +- .../qisis/objs/CubeViewport/CubeViewport.cpp | 52 +- .../FeatureNomenclature.cpp | 108 +-- .../FeatureNomenclature/FeatureNomenclature.h | 54 +- .../FeatureNomenclatureTool.cpp | 18 +- .../FeatureNomenclatureTool.h | 2 +- isis/src/qisis/objs/FileDialog/FileDialog.cpp | 14 +- isis/src/qisis/objs/FileDialog/FileDialog.h | 2 +- isis/src/qisis/objs/FileTool/FileTool.cpp | 30 +- isis/src/qisis/objs/HelpTool/HelpTool.cpp | 14 +- isis/src/qisis/objs/MatchTool/MatchTool.cpp | 137 ++-- isis/src/qisis/objs/MatchTool/MatchTool.h | 21 +- .../objs/MdiCubeViewport/MdiCubeViewport.cpp | 12 +- .../qisis/objs/MeasureTool/MeasureTool.cpp | 8 +- isis/src/qisis/objs/MeasureTool/MeasureTool.h | 11 +- .../MosaicFileList/MosaicFileListWidget.cpp | 20 +- .../MosaicMainWindow/MosaicController.cpp | 10 +- .../MosaicMainWindow/MosaicMainWindow.cpp | 10 +- .../objs/MosaicMainWindow/MosaicMainWindow.h | 6 +- .../ControlNetGraphicsItem.cpp | 7 +- .../ControlPointGraphicsItem.cpp | 9 +- .../MosaicSceneWidget/GridGraphicsItem.cpp | 4 +- .../objs/MosaicSceneWidget/MosaicAreaTool.cpp | 6 +- .../objs/MosaicSceneWidget/MosaicAreaTool.h | 2 +- .../MosaicControlNetTool.cpp | 16 +- .../MosaicSceneWidget/MosaicControlNetTool.h | 2 +- .../objs/MosaicSceneWidget/MosaicFindTool.cpp | 6 +- .../objs/MosaicSceneWidget/MosaicFindTool.h | 2 +- .../objs/MosaicSceneWidget/MosaicGridTool.cpp | 64 +- .../objs/MosaicSceneWidget/MosaicGridTool.h | 2 +- .../MosaicSceneWidget/MosaicSceneWidget.cpp | 57 +- .../objs/MosaicSceneWidget/MosaicTool.cpp | 8 +- .../qisis/objs/MosaicSceneWidget/MosaicTool.h | 11 +- .../objs/PaletteWindow/PaletteWindow.cpp | 10 +- .../qisis/objs/PaletteWindow/PaletteWindow.h | 2 +- isis/src/qisis/objs/PanTool/PanTool.cpp | 4 +- .../ScatterPlotTool/ScatterPlotWindow.cpp | 8 +- .../qisis/objs/SocketThread/SocketThread.cpp | 2 +- .../SpecialPixelTool/SpecialPixelTool.cpp | 12 +- .../SpectralPlotTool/SpectralPlotTool.cpp | 2 +- .../SpectralPlotTool/SpectralPlotWindow.cpp | 8 +- .../objs/StatisticsTool/StatisticsTool.cpp | 4 +- isis/src/qisis/objs/StereoTool/StereoTool.cpp | 54 +- isis/src/qisis/objs/StereoTool/StereoTool.h | 6 +- .../qisis/objs/StretchTool/AdvancedStretch.h | 7 +- .../objs/StretchTool/BinaryStretchType.h | 12 +- .../objs/StretchTool/LinearStretchType.h | 11 +- .../objs/StretchTool/ManualStretchType.cpp | 4 +- .../objs/StretchTool/SawtoothStretchType.h | 12 +- .../qisis/objs/StretchTool/StretchType.cpp | 2 +- .../objs/SunShadowTool/SunShadowTool.cpp | 8 +- .../qisis/objs/SunShadowTool/SunShadowTool.h | 14 +- .../objs/TableMainWindow/TableMainWindow.cpp | 2 +- isis/src/qisis/objs/Tool/Tool.cpp | 4 +- .../objs/WarningWidget/WarningWidget.cpp | 4 +- isis/src/qisis/objs/Workspace/Workspace.cpp | 8 +- isis/src/rolo/apps/rolo2isis/rolo2isis.cpp | 4 +- isis/src/system/apps/blobdump/blobdump.cpp | 18 +- isis/src/system/apps/csspckgen/csspckgen.cpp | 6 +- isis/src/system/apps/dempack/dempack.cpp | 22 +- .../system/apps/isiscomplete/isiscomplete.cpp | 42 +- .../system/apps/kerneldbgen/SpiceDbGen.cpp | 54 +- isis/src/system/apps/kerneldbgen/SpiceDbGen.h | 34 +- .../system/apps/kerneldbgen/kerneldbgen.cpp | 34 +- isis/src/system/apps/messckgen/messckgen.cpp | 48 +- .../src/system/apps/messspkgen/messspkgen.cpp | 17 +- .../apps/prtloganalyzer/ProgramAnalyzer.cpp | 120 ++- .../apps/prtloganalyzer/ProgramAnalyzer.h | 52 +- .../apps/prtloganalyzer/prtloganalyzer.cpp | 6 +- isis/src/system/objs/KernelDb/KernelDb.cpp | 72 +- isis/src/system/objs/KernelDb/KernelDb.h | 38 +- isis/src/system/objs/KernelDb/unitTest.cpp | 31 +- isis/src/viking/apps/vik2isis/vik2isis.cpp | 78 +- isis/src/viking/apps/vikcal/CalParameters.cpp | 287 +++---- isis/src/viking/apps/vikcal/CalParameters.h | 25 +- isis/src/viking/apps/vikcal/vikcal.cpp | 36 +- .../viking/apps/viknobutter/viknobutter.cpp | 12 +- .../viking/objs/VikingCamera/VikingCamera.cpp | 22 +- .../src/viking/objs/VikingCamera/unitTest.cpp | 4 +- isis/src/voyager/apps/voy2isis/voy2isis.cpp | 111 +-- isis/src/voyager/apps/voycal/voycal.cpp | 46 +- isis/src/voyager/apps/voyramp/voyramp.cpp | 20 +- .../objs/VoyagerCamera/VoyagerCamera.cpp | 18 +- .../voyager/objs/VoyagerCamera/unitTest.cpp | 4 +- 1156 files changed, 17379 insertions(+), 17325 deletions(-) diff --git a/isis/src/apollo/apps/apollo2isis/apollo2isis.cpp b/isis/src/apollo/apps/apollo2isis/apollo2isis.cpp index 47f040cd61..0d05509a9c 100644 --- a/isis/src/apollo/apps/apollo2isis/apollo2isis.cpp +++ b/isis/src/apollo/apps/apollo2isis/apollo2isis.cpp @@ -22,10 +22,10 @@ void RefineCodeLocation(); void TranslateCode(); void TranslateApolloLabels (IString filename, Cube *pack); bool IsValidCode(); -IString FrameTime(); +QString FrameTime(); int Altitude(); double ShutterInterval(); -IString FMC(); +QString FMC(); int codeSample, codeLine; bool code[4][32]; @@ -33,7 +33,7 @@ bool codeFound = true; Cube cube; Apollo *apollo; -IString utcTime; +QString utcTime; int RADIUS = 46; double rotation, sampleTranslation, lineTranslation; @@ -47,12 +47,12 @@ void IsisMain() { p.SetPdsFile(inFile.expanded(), "", pdsLabel); - IString filename = FileName(ui.GetFileName("FROM")).baseName(); + QString filename = FileName(ui.GetFileName("FROM")).baseName(); FileName toFile = ui.GetFileName("TO"); apollo = new Apollo(filename); - utcTime = (string)pdsLabel["START_TIME"]; + utcTime = (QString)pdsLabel["START_TIME"]; // Setup the output cube attributes for a 16-bit unsigned tiff Isis::CubeAttributeOutput cao; @@ -231,9 +231,9 @@ void TranslateApolloLabels (IString filename, Cube *opack) { PvlGroup error("ERROR"); error.AddComment("The decrypted code is invalid."); for (int i=0; i<4; i++) { - PvlKeyword keyword("Column"+IString(i+1)); + PvlKeyword keyword("Column"+toString(i+1)); for (int j=0; j<32; j++) { - keyword += code[i][j]; + keyword += toString((int)code[i][j]); } error.AddKeyword(keyword); codeGroup += keyword; @@ -242,17 +242,17 @@ void TranslateApolloLabels (IString filename, Cube *opack) { } else { codeGroup += PvlKeyword("StartTime", FrameTime()); - codeGroup += PvlKeyword("SpacecraftAltitude", Altitude(),"meters"); + codeGroup += PvlKeyword("SpacecraftAltitude", toString(Altitude()),"meters"); if (apollo->IsMetric()){ - codeGroup += PvlKeyword("ExposureDuration", ShutterInterval(), "milliseconds"); + codeGroup += PvlKeyword("ExposureDuration", toString(ShutterInterval()), "milliseconds"); codeGroup += PvlKeyword("ForwardMotionCompensation", FMC()); } for (int i=0; i<4; i++) { - PvlKeyword keyword("Column"+IString(i+1)); + PvlKeyword keyword("Column"+toString(i+1)); for (int j=0; j<32; j++) { - keyword += code[i][j]; + keyword += toString((int)code[i][j]); } codeGroup += keyword; } @@ -262,7 +262,7 @@ void TranslateApolloLabels (IString filename, Cube *opack) { // There are no filters on the camera, so the default is clear with id # of 1 // the BandBin group is only included to work with the spiceinit application bandBin += PvlKeyword("FilterName", "CLEAR"); - bandBin += PvlKeyword("FilterId", 1); + bandBin += PvlKeyword("FilterId", "1"); kern += PvlKeyword("NaifFrameCode", apollo->NaifFrameCode()); @@ -270,23 +270,25 @@ void TranslateApolloLabels (IString filename, Cube *opack) { Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); Process p; PvlTranslationTable tTable( - (IString)p.MissionData("base", "translations/MissionName2DataDir.trn")); - IString missionDir = dataDir[tTable.Translate("MissionName", apollo->SpacecraftName())][0]; + (QString)p.MissionData("base", "translations/MissionName2DataDir.trn")); + QString missionDir = dataDir[tTable.Translate("MissionName", apollo->SpacecraftName())][0]; Pvl resTemplate(missionDir + "/reseaus/" + apollo->InstrumentId() + "_NOMINAL.pvl"); PvlGroup *reseaus = &resTemplate.FindGroup("Reseaus"); // Update reseau locations based on refined code location for (int i=0; i<(reseaus->FindKeyword("Type")).Size(); i++) { - double x = (double)(reseaus->FindKeyword("Sample")[i]) + sampleTranslation + 2278, - y = (double)(reseaus->FindKeyword("Line")[i]) + lineTranslation - 20231; + double x = toDouble(reseaus->FindKeyword("Sample")[i]) + sampleTranslation + 2278, + y = toDouble(reseaus->FindKeyword("Line")[i]) + lineTranslation - 20231; if (apollo->IsApollo17()) { x += 50; y += 20; } - reseaus->FindKeyword("Sample")[i] = cos(rotation)*(x-sampleTranslation) - sin(rotation)*(y-lineTranslation) + sampleTranslation; - reseaus->FindKeyword("Line")[i] = sin(rotation)*(x-sampleTranslation) + cos(rotation)*(y-lineTranslation) + lineTranslation; + reseaus->FindKeyword("Sample")[i] = toString( + cos(rotation)*(x-sampleTranslation) - sin(rotation)*(y-lineTranslation) + sampleTranslation); + reseaus->FindKeyword("Line")[i] = toString( + sin(rotation)*(x-sampleTranslation) + cos(rotation)*(y-lineTranslation) + lineTranslation); } inst += PvlKeyword("StartTime", utcTime); @@ -306,7 +308,7 @@ bool IsValidCode() { !code[3][22] || !code[3][23] || !code[3][24] || !code[3][25] || !code[3][26] || !code[3][27] || !code[3][28] || !code[3][30] || code[3][31])); } -IString FrameTime() { +QString FrameTime() { iTime launch = apollo->LaunchDate(); int year = launch.Year(), month = launch.Month(), @@ -362,17 +364,17 @@ IString FrameTime() { month += 1; } - IString sTime = IString(year) + "-"; + QString sTime = toString(year) + "-"; if (month < 10) sTime += "0"; - sTime += IString(month)+ "-"; + sTime += toString(month)+ "-"; if (days <10) sTime += "0"; - sTime += IString(days) + "T"; + sTime += toString(days) + "T"; if (hours <10) sTime += "0"; - sTime += IString(hours) + ":"; + sTime += toString(hours) + ":"; if (minutes <10) sTime += "0"; - sTime += IString(minutes) + ":"; + sTime += toString(minutes) + ":"; if (seconds <10) sTime += "0"; - sTime += IString(seconds); + sTime += toString(seconds); return sTime; } @@ -394,7 +396,7 @@ double ShutterInterval() { return 0.1*shutterInterval; } -IString FMC() { +QString FMC() { if (code[3][29]) return "True"; return "False"; } diff --git a/isis/src/apollo/apps/apollocal/apollocal.cpp b/isis/src/apollo/apps/apollocal/apollocal.cpp index 1b47682074..ac8f674d29 100644 --- a/isis/src/apollo/apps/apollocal/apollocal.cpp +++ b/isis/src/apollo/apps/apollocal/apollocal.cpp @@ -21,10 +21,10 @@ void IsisMain() { PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); PvlTranslationTable tTable( - (IString)p.MissionData("base", "translations/MissionName2DataDir.trn")); - IString missionDir = dataDir[tTable.Translate("MissionName", + (QString)p.MissionData("base", "translations/MissionName2DataDir.trn")); + QString missionDir = dataDir[tTable.Translate("MissionName", (inCube->getGroup("Instrument")).FindKeyword("SpacecraftName")[0])][0]; - string camera = + QString camera = (inCube->getGroup("Instrument")).FindKeyword("InstrumentId")[0]; CubeAttributeInput cai; diff --git a/isis/src/apollo/apps/apollofindrx/apollofindrx.cpp b/isis/src/apollo/apps/apollofindrx/apollofindrx.cpp index ffb841b18e..26fa7b9819 100644 --- a/isis/src/apollo/apps/apollofindrx/apollofindrx.cpp +++ b/isis/src/apollo/apps/apollofindrx/apollofindrx.cpp @@ -41,32 +41,32 @@ void IsisMain () cube.open(ui.GetFileName("FROM"),"rw"); PvlGroup &reseaus = cube.getLabel()->FindGroup("Reseaus",Pvl::Traverse); - string mission = (cube.getLabel()->FindGroup("Instrument",Pvl::Traverse))["SpacecraftName"]; - string instrument = (cube.getLabel()->FindGroup("Instrument",Pvl::Traverse))["InstrumentId"]; + QString mission = (cube.getLabel()->FindGroup("Instrument",Pvl::Traverse))["SpacecraftName"]; + QString instrument = (cube.getLabel()->FindGroup("Instrument",Pvl::Traverse))["InstrumentId"]; Apollo apollo(mission, instrument); - if (mission.substr(0,6) != "APOLLO") { - string msg = "This application is for use with Apollo spacecrafts only."; + if (mission.mid(0,6) != "APOLLO") { + QString msg = "This application is for use with Apollo spacecrafts only."; throw IException(IException::Unknown, msg, _FILEINFO_); } // If the Keyword sizes don't match up, throw errors. int nres = reseaus["Line"].Size(); if (nres != reseaus["Sample"].Size()) { - string msg = "Sample size incorrect [Sample size " + - IString(reseaus["Sample"].Size()) + " != " + " Line size " + - IString(reseaus["Line"].Size()) + "]"; + QString msg = "Sample size incorrect [Sample size " + + toString(reseaus["Sample"].Size()) + " != " + " Line size " + + toString(reseaus["Line"].Size()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } if (nres != reseaus["Type"].Size()) { - string msg = "Type size incorrect [Type size " + - IString(reseaus["Type"].Size()) + " != " + " Line size " + - IString(reseaus["Line"].Size()) + "]"; + QString msg = "Type size incorrect [Type size " + + toString(reseaus["Type"].Size()) + " != " + " Line size " + + toString(reseaus["Line"].Size()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } if (nres != reseaus["Valid"].Size()) { - string msg = "Valid size incorrect [Valid size " + - IString(reseaus["Valid"].Size()) + " != " + " Line size " + - IString(reseaus["Line"].Size()) + "]"; + QString msg = "Valid size incorrect [Valid size " + + toString(reseaus["Valid"].Size()) + " != " + " Line size " + + toString(reseaus["Line"].Size()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -94,8 +94,8 @@ void IsisMain () // for (int res=0; res 0 && reseaus["Valid"][res-1] == "1") dy = currentLine - patternSize/2 - dl + bestLine-1 - (double)(reseaus["Line"][res]); - if (res/dim > 0 && reseaus["Valid"][res - dim] == "1") dx = currentSample - patternSize/2 - ds + bestSample-1 - (double)(reseaus["Sample"][res]); - double horizontalShift = currentSample - patternSize/2 - ds + bestSample-1 - (double)(reseaus["Sample"][res]) - dx, - verticalShift = currentLine - patternSize/2 - dl + bestLine-1 - (double)(reseaus["Line"][res]) - dy; + if (res%dim > 0 && reseaus["Valid"][res-1] == "1") dy = currentLine - patternSize/2 - dl + bestLine-1 - toDouble(reseaus["Line"][res]); + if (res/dim > 0 && reseaus["Valid"][res - dim] == "1") dx = currentSample - patternSize/2 - ds + bestSample-1 - toDouble(reseaus["Sample"][res]); + double horizontalShift = currentSample - patternSize/2 - ds + bestSample-1 - toDouble(reseaus["Sample"][res]) - dx, + verticalShift = currentLine - patternSize/2 - dl + bestLine-1 - toDouble(reseaus["Line"][res]) - dy; for (int i=res; i xy; xy.push_back(res%(int)sqrt(nres)); xy.push_back(res/(int)sqrt(nres)); - sampFunc.AddKnown(xy, reseaus["Sample"][res]); - lineFunc.AddKnown(xy, reseaus["Line"][res]); + sampFunc.AddKnown(xy, toDouble(reseaus["Sample"][res])); + lineFunc.AddKnown(xy, toDouble(reseaus["Line"][res])); ds = (int)(MIN_DISP+ abs(dx) + abs(horizontalShift)); dl = (int)(MIN_DISP + abs(dy) + abs(verticalShift)); } else { - reseaus["Valid"][res] = 0; + reseaus["Valid"][res] = "0"; } prog.CheckStatus(); @@ -138,7 +138,7 @@ void IsisMain () // for invalid reseaus, refine the estimated locations for (int res=0; res xy; xy.push_back(res%(int)sqrt(nres)); xy.push_back(res/(int)sqrt(nres)); @@ -151,7 +151,7 @@ void IsisMain () reseaus["Status"] = "Refined"; } else { - string msg = "No Reseaus located. Labels will not be changed."; + QString msg = "No Reseaus located. Labels will not be changed."; msg += "Try changing the registration parameters."; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/apollo/apps/apollopaninit/apollopaninit.cpp b/isis/src/apollo/apps/apollopaninit/apollopaninit.cpp index 18e21513da..954202862c 100644 --- a/isis/src/apollo/apps/apollopaninit/apollopaninit.cpp +++ b/isis/src/apollo/apps/apollopaninit/apollopaninit.cpp @@ -100,11 +100,11 @@ void IsisMain() { Cube panCube; iTime isisTime; - IString iStrTEMP; + QString iStrTEMP; int i,j,k,scFrameCode,insCode; - std::string mission; + QString mission; SpicePosition *spPos; SpiceRotation *spRot; @@ -193,7 +193,7 @@ void IsisMain() { keyword.SetName("LineExposureDuration"); //converted led to msec/mm--negative sign to account for the anti-parallel time and line axes - keyword.SetValue(iStrTEMP=-led,"sec/mm"); + keyword.SetValue(iStrTEMP=toString(-led),"sec/mm"); inst_pvlG.AddKeyword(keyword); panCube.putGroup(inst_pvlG); @@ -203,7 +203,7 @@ void IsisMain() { kernels_pvlG.Clear(); keyword.SetName("NaifFrameCode"); - keyword.SetValue(insCode); + keyword.SetValue(toString(insCode)); kernels_pvlG.AddKeyword(keyword); keyword.SetName("LeapSecond"); @@ -252,10 +252,10 @@ void IsisMain() { //get the framecode from the body code (301=MOON) cidfrm_c(301, sizeof(frameName), &frameCode, frameName, &found); if(!found) { - string naifTarget = string("IAU_MOOM"); - namfrm_c(naifTarget.c_str(), &frameCode); + QString naifTarget = QString("IAU_MOOM"); + namfrm_c(naifTarget.toAscii().data(), &frameCode); if(frameCode == 0) { - string msg = "Can not find NAIF code for [" + naifTarget + "]"; + QString msg = "Can not find NAIF code for [" + naifTarget + "]"; throw IException(IException::Io, msg, _FILEINFO_); } } @@ -272,8 +272,8 @@ void IsisMain() { //create a table from starttime to endtime (stretched by 3%) with NODES entries spPos->LoadCache(time0-0.015*(time1-time0), time1+0.015*(time1-time0), NODES); Table tableSunPos = spPos->Cache("SunPosition"); - tableSunPos.Label() += PvlKeyword("SpkTableStartTime", time0-0.015*(time1-time0)); - tableSunPos.Label() += PvlKeyword("SpkTablleEndTime", time1+0.015*(time1-time0)); + tableSunPos.Label() += PvlKeyword("SpkTableStartTime", toString(time0-0.015*(time1-time0))); + tableSunPos.Label() += PvlKeyword("SpkTablleEndTime", toString(time1+0.015*(time1-time0))); tableSunPos.Label() += PvlKeyword("Description", "Created by apollopaninit"); panCube.write(tableSunPos); //attach the table to the cube @@ -415,7 +415,7 @@ void IsisMain() { recordPos[2] = posJ20[2]; recordPos[3] = temp; //temp = et (right now anyway) tablePos += recordPos; - tablePos.Label() += PvlKeyword("SpkTableStartTime",temp); + tablePos.Label() += PvlKeyword("SpkTableStartTime",toString(temp)); //now the other node temp = 0.515*(time1-time0); //3% extension posSel[0] = pos0[0] + temp*vel[0]; //selenocentric coordinate calculation @@ -435,7 +435,7 @@ void IsisMain() { recordPos[2] = posJ20[2]; recordPos[3] = temp; //temp = et (right now anyway) tablePos += recordPos; - tablePos.Label() += PvlKeyword("SpkTableEndTime",temp); + tablePos.Label() += PvlKeyword("SpkTableEndTime",toString(temp)); tablePos.Label() += PvlKeyword("CacheType","Linear"); tablePos.Label() += PvlKeyword("Description","Created by apollopaninit"); panCube.write(tablePos); //now attach it to the table @@ -558,25 +558,25 @@ void IsisMain() { recordRot[4] = Q[i][4]; tableRot += recordRot; } - tableRot.Label() += PvlKeyword("CkTableStartTime", Q[0][4]); - tableRot.Label() += PvlKeyword("CkTableEndTime", Q[NODES-1][4]); + tableRot.Label() += PvlKeyword("CkTableStartTime", toString(Q[0][4])); + tableRot.Label() += PvlKeyword("CkTableEndTime", toString(Q[NODES-1][4])); tableRot.Label() += PvlKeyword("Description", "Created by appollopan2isis"); keyword.SetName("TimeDependentFrames"); - keyword.SetValue(scFrameCode); - keyword.AddValue(1); + keyword.SetValue(toString(scFrameCode)); + keyword.AddValue("1"); tableRot.Label() += keyword; keyword.SetName("ConstantFrames"); - keyword.SetValue(insCode); - keyword.AddValue(scFrameCode); + keyword.SetValue(toString(insCode)); + keyword.AddValue(toString(scFrameCode)); tableRot.Label() += keyword; keyword.SetName("ConstantRotation"); - keyword.SetValue(1); + keyword.SetValue("1"); for (i=1;i<9;i++) - if (i%4 == 0) keyword.AddValue(1); - else keyword.AddValue(0); + if (i%4 == 0) keyword.AddValue("1"); + else keyword.AddValue("0"); tableRot.Label() += keyword; panCube.write(tableRot); @@ -597,7 +597,7 @@ void IsisMain() { bool foundFirst=false; - IString fileName; + QString fileName; panS = panCube.getSampleCount(); @@ -628,7 +628,7 @@ void IsisMain() { FileName fiducialFileName("$apollo15/calibration/ApolloPanFiducialMark.cub"); fidC.open(fiducialFileName.expanded(),"r"); if( !fidC.isOpen() ) { - string msg = "Unable to open the fiducial patternS cube: ApolloPanFiducialMark.cub\n"; + QString msg = "Unable to open the fiducial patternS cube: ApolloPanFiducialMark.cub\n"; throw IException(IException::User, msg, _FILEINFO_); } refL = fidC.getLineCount(); @@ -692,7 +692,7 @@ void IsisMain() { } } if(s>=averageLines+searchCellSize/2.0) { - string msg = "Unable to locate a fiducial mark in the input cube [" + fileName + + QString msg = "Unable to locate a fiducial mark in the input cube [" + fileName + "]. Check FROM and MICRONS parameters."; throw IException(IException::Io, msg, _FILEINFO_); return; @@ -788,10 +788,10 @@ void IsisMain() { ApolloPanoramicCamera* cam = (ApolloPanoramicCamera*)(panCube.getCamera()); //log the residual report from interior orientation PvlGroup residualStats("InteriorOrientationStats"); - residualStats += PvlKeyword("FiducialsFound", tableFid.Records()); - residualStats += PvlKeyword("ResidualMax", cam->intOriResidualMax(),"pixels"); - residualStats += PvlKeyword("ResidualMean", cam->intOriResidualMean(),"pixels"); - residualStats += PvlKeyword("ResidualStdev", cam->intOriResidualStdev(),"pixels"); + residualStats += PvlKeyword("FiducialsFound", toString(tableFid.Records())); + residualStats += PvlKeyword("ResidualMax", toString(cam->intOriResidualMax()),"pixels"); + residualStats += PvlKeyword("ResidualMean", toString(cam->intOriResidualMean()),"pixels"); + residualStats += PvlKeyword("ResidualStdev", toString(cam->intOriResidualStdev()),"pixels"); Application::Log( residualStats ); @@ -808,18 +808,18 @@ void Load_Kernel(Isis::PvlKeyword &key) { for(int i = 0; i < key.Size(); i++) { if(key[i] == "") continue; - if(IString(key[i]).UpCase() == "NULL") break; - if(IString(key[i]).UpCase() == "NADIR") break; + if(QString(key[i]).toUpper() == "NULL") break; + if(QString(key[i]).toUpper() == "NADIR") break; //Table was left as the first value of these keywords because one is about to be attached, // still though it needs to be skipped in this loop - if(IString(key[i]).UpCase() == "TABLE") continue; + if(QString(key[i]).toUpper() == "TABLE") continue; Isis::FileName file(key[i]); if(!file.fileExists()) { - string msg = "Spice file does not exist [" + file.expanded() + "]"; + QString msg = "Spice file does not exist [" + file.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } - string fileName(file.expanded()); - furnsh_c(fileName.c_str()); + QString fileName(file.expanded()); + furnsh_c(fileName.toAscii().data()); } NaifStatus::CheckErrors(); diff --git a/isis/src/apollo/apps/apollopanstitcher/apollopanstitcher.cpp b/isis/src/apollo/apps/apollopanstitcher/apollopanstitcher.cpp index 70573b3aca..b77a11d5f9 100644 --- a/isis/src/apollo/apps/apollopanstitcher/apollopanstitcher.cpp +++ b/isis/src/apollo/apps/apollopanstitcher/apollopanstitcher.cpp @@ -11,7 +11,7 @@ Program uses the fiducial marks along the edges of Apollo Panoramic Images to st #include //QT libraries if needed if needed - +#include //third party libraries if needed #include @@ -103,8 +103,8 @@ void IsisMain() { TRANS2d3p trans[8]; //final solutions for the transformations-one for each sub-scan - IString fileName,tempIString; - std::string fileBaseName, tempString; + QString fileName,tempIString; + QString fileBaseName, tempString; UserInterface &ui = Application::GetUserInterface(); double l=1,s=1,sample,line,temp, //line and sample coordinates for looping through the panC @@ -149,7 +149,7 @@ void IsisMain() { fileBaseName = ui.GetString("FILE_BASE"); for (i=1; i<=8; i++) { panC[i-1] = new Cube; - fileName = fileBaseName + IString("-000") + IString(i) + IString(".cub"); + fileName = fileBaseName + "-000" + toString(i) + ".cub"; panC[i-1]->open(fileName, "r"); if (!panC[i-1]->isOpen()){ string msg = "Unable to open input cube: " + IString(fileName) + "\n"; @@ -223,8 +223,8 @@ void IsisMain() { } } if(s>=averageLines+searchCellSize/2.0) { - string msg = "Unable to locate a fiducial mark in the input cube [" + panC[i]->getFileName() - + "]. Check FROM and MICRONS parameters."; + QString msg = "Unable to locate a fiducial mark in the input cube [" + panC[i]->getFileName() + + "]. Check FROM and MICRONS parameters."; throw IException(IException::Io, msg, _FILEINFO_); return; } @@ -691,8 +691,8 @@ void IsisMain() { //define an output cube outputC.setDimensions(int(maxS),int(maxL),1); outputC.setPixelType(panC[0]->getPixelType()); //set pixel type - tempIString = ui.GetFileName("TO"); - outputC.create(tempIString); + tempString = ui.GetFileName("TO"); + outputC.create(tempString); outputC.close(); //closing the output cube so that it can be opened by the mosaic process ProcessMosaic mosaic; mosaic.SetOutputCube("TO"); @@ -745,7 +745,7 @@ void IsisMain() { //clear input cube mosaic.ClearInputCubes(); - remove(tempFile.expanded().c_str()); //delete temporary cube if it exists + QFile::remove(tempFile.expanded()); //delete temporary cube if it exists } mosaic.EndProcess(); } diff --git a/isis/src/apollo/apps/apolloremrx/apolloremrx.cpp b/isis/src/apollo/apps/apolloremrx/apolloremrx.cpp index 08b025073f..4c809468ef 100644 --- a/isis/src/apollo/apps/apolloremrx/apolloremrx.cpp +++ b/isis/src/apollo/apps/apolloremrx/apolloremrx.cpp @@ -5,7 +5,7 @@ #include "UserInterface.h" #include "Brick.h" #include "Apollo.h" -#include +#include #include using namespace std; @@ -14,7 +14,7 @@ using namespace Isis; void cpy(Buffer &in, Buffer &out); static int dim; static bool resvalid; -static string action; +static QString action; void IsisMain() { // We will be processing by line @@ -25,24 +25,24 @@ void IsisMain() { Cube* info = p.SetInputCube("FROM"); PvlKeyword &status = info ->getGroup("RESEAUS")["STATUS"]; UserInterface &ui = Application::GetUserInterface(); - string in = ui.GetFileName("FROM"); + QString in = ui.GetFileName("FROM"); - string spacecraft = (info->getGroup("Instrument")["SpacecraftName"]); - string instrument = (info->getGroup("Instrument")["InstrumentId"]); + QString spacecraft = (info->getGroup("Instrument")["SpacecraftName"]); + QString instrument = (info->getGroup("Instrument")["InstrumentId"]); Apollo apollo(spacecraft, instrument); - if (spacecraft.substr(0,6) != "APOLLO") { - string msg = "This application is for use with Apollo spacecrafts only. "; + if (spacecraft.mid(0,6) != "APOLLO") { + QString msg = "This application is for use with Apollo spacecrafts only. "; throw IException(IException::Unknown, msg, _FILEINFO_); } // Check reseau status and make sure it is not nominal or removed - if ((string)status == "Nominal") { - string msg = "Input file [" + in + + if ((QString)status == "Nominal") { + QString msg = "Input file [" + in + "] appears to have nominal reseau status. You must run findrx first."; throw IException(IException::User,msg, _FILEINFO_); } - if ((string)status == "Removed") { - string msg = "Input file [" + in + + if ((QString)status == "Removed") { + QString msg = "Input file [" + in + "] appears to already have reseaus removed."; throw IException(IException::User,msg, _FILEINFO_); } @@ -58,7 +58,7 @@ void IsisMain() { dim = apollo.ReseauDimension(); // Get other user entered options - string out= ui.GetFileName("TO"); + QString out= ui.GetFileName("TO"); resvalid = ui.GetBoolean("RESVALID"); action = ui.GetString("ACTION"); @@ -78,9 +78,9 @@ void IsisMain() { Brick brick(dim,dim,1,cube.getPixelType()); int width = ui.GetInteger("WIDTH"); for (int res=0; resKnowns(); i++) { - PvlKeyword p("POINT"+IString(i+1)); - p += p_lsqInputLine->Residual(i); - p += p_lsqInputSamp->Residual(i); + PvlKeyword p("POINT"+toString(i+1)); + p += toString(p_lsqInputLine->Residual(i)); + p += toString(p_lsqInputSamp->Residual(i)); errs += p; } return errs; diff --git a/isis/src/apollo/apps/apollowarp/apollowarp.cpp b/isis/src/apollo/apps/apollowarp/apollowarp.cpp index 6278380d2e..9bd73e0f23 100644 --- a/isis/src/apollo/apps/apollowarp/apollowarp.cpp +++ b/isis/src/apollo/apps/apollowarp/apollowarp.cpp @@ -19,13 +19,13 @@ void IsisMain() { // Check to see if it is an Apollo image and if the reseaus have been refined // (note: a status of 'Removed' implies it is also 'Refined') PvlGroup &reseaus = ipacket->getGroup("Reseaus"); - string mission = (ipacket->getGroup("Instrument"))["SpacecraftName"]; - if (mission.substr(0,6) != "APOLLO") { - string msg = "This application is for use with Apollo spacecrafts only. "; + QString mission = (ipacket->getGroup("Instrument"))["SpacecraftName"]; + if (mission.mid(0,6) != "APOLLO") { + QString msg = "This application is for use with Apollo spacecrafts only. "; throw IException(IException::Unknown, msg, _FILEINFO_); } - if ((string)reseaus["Status"] != "Refined" && (string)reseaus["Status"] != "Removed") { - string msg = "This application can only be run after findapollorx."; + if ((QString)reseaus["Status"] != "Refined" && (QString)reseaus["Status"] != "Removed") { + QString msg = "This application can only be run after findapollorx."; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -35,10 +35,10 @@ void IsisMain() { vector inputLine,inputSample,outputLine,outputSample; // Setup the parameters for the transform for (int i=0; iIsMetric() << endl; cout << "IsPanoramic: " << apollo->IsPanoramic() << endl; @@ -37,11 +38,11 @@ int main(int argc, char *argv[]) { cout << "InstrumentId: " << apollo->InstrumentId() << endl; cout << "NaifFrameCode: " << apollo->NaifFrameCode() << endl; cout << "TargetName: " << apollo->TargetName() << endl; - string time=(apollo->LaunchDate().UTC()); + QString time=(apollo->LaunchDate().UTC()); cout << "Time: " << time << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/apollo/objs/ApolloMetricCamera/ApolloMetricCamera.cpp b/isis/src/apollo/objs/ApolloMetricCamera/ApolloMetricCamera.cpp index c50ba651c1..2254bea0c7 100644 --- a/isis/src/apollo/objs/ApolloMetricCamera/ApolloMetricCamera.cpp +++ b/isis/src/apollo/objs/ApolloMetricCamera/ApolloMetricCamera.cpp @@ -57,9 +57,9 @@ namespace Isis { CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); focalMap->SetDetectorOrigin(ParentSamples() / 2.0, ParentLines() / 2.0); - IString ppKey("INS" + IString((int)naifIkCode()) + "_PP"); - IString odkKey("INS" + IString((int)naifIkCode()) + "_OD_K"); - IString decenterKey("INS" + IString((int)naifIkCode()) + "_DECENTER"); + QString ppKey("INS" + toString(naifIkCode()) + "_PP"); + QString odkKey("INS" + toString(naifIkCode()) + "_OD_K"); + QString decenterKey("INS" + toString(naifIkCode()) + "_DECENTER"); new ApolloMetricDistortionMap(this, getDouble(ppKey, 0), getDouble(ppKey, 1), getDouble(odkKey, 0), getDouble(odkKey, 1), @@ -75,31 +75,31 @@ namespace Isis { // The Spacecraft Name should be either Apollo 15, 16, or 17. The name // itself could be formatted any number of ways, but the number contained // in the name should be unique between the missions - string spacecraft = inst.FindKeyword("SpacecraftName")[0]; - if (spacecraft.find("15") != string::npos) { + QString spacecraft = inst.FindKeyword("SpacecraftName")[0]; + if (spacecraft.contains("15")) { p_ckFrameId = -915240; p_ckReferenceId = 1400015; p_spkTargetId = -915; } - else if (spacecraft.find("16") != string::npos) { + else if (spacecraft.contains("16")) { p_ckFrameId = -916240; p_ckReferenceId = 1400016; p_spkTargetId = -916; } - else if (spacecraft.find("17") != string::npos) { + else if (spacecraft.contains("17")) { p_ckFrameId = -917240; p_ckReferenceId = 1400017; p_spkTargetId = -917; } else { - string msg = "File does not appear to be an Apollo image"; + QString msg = "File does not appear to be an Apollo image"; throw IException(IException::User, msg, _FILEINFO_); } // Create a cache and grab spice info since it does not change for // a framing camera (fixed spacecraft position and pointing) // Convert the start time to et - setTime((string)inst["StartTime"]); + setTime((QString)inst["StartTime"]); LoadCache(); NaifStatus::CheckErrors(); } diff --git a/isis/src/apollo/objs/ApolloMetricCamera/unitTest.cpp b/isis/src/apollo/objs/ApolloMetricCamera/unitTest.cpp index 1b09ad3d1d..c42ece3635 100644 --- a/isis/src/apollo/objs/ApolloMetricCamera/unitTest.cpp +++ b/isis/src/apollo/objs/ApolloMetricCamera/unitTest.cpp @@ -62,9 +62,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); // approximate 1 tenth of a second since Apollo did not provide double exposureDuration = .1; pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); diff --git a/isis/src/apollo/objs/ApolloPanoramicCamera/ApolloPanoramicCamera.cpp b/isis/src/apollo/objs/ApolloPanoramicCamera/ApolloPanoramicCamera.cpp index 455f6b55dd..2368ec6c81 100644 --- a/isis/src/apollo/objs/ApolloPanoramicCamera/ApolloPanoramicCamera.cpp +++ b/isis/src/apollo/objs/ApolloPanoramicCamera/ApolloPanoramicCamera.cpp @@ -35,26 +35,26 @@ namespace Isis { //following keywords in InstrumentAddendum file - IString ikernKey = "INS" + IString((int)naifIkCode()) + "_CONSTANT_TIME_OFFSET"; + QString ikernKey = "INS" + toString((int)naifIkCode()) + "_CONSTANT_TIME_OFFSET"; constantTimeOffset = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_ADDITIONAL_PREROLL"; + ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIONAL_PREROLL"; additionalPreroll = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_ADDITIVE_LINE_ERROR"; + ikernKey = "INS" + toString((int)naifIkCode()) + "_ADDITIVE_LINE_ERROR"; additiveLineTimeError = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_MULTIPLI_LINE_ERROR"; + ikernKey = "INS" + toString((int)naifIkCode()) + "_MULTIPLI_LINE_ERROR"; multiplicativeLineTimeError = getDouble(ikernKey); Isis::PvlGroup &inst = lab.FindGroup("Instrument", Isis::Pvl::Traverse); - IString stime = (string)inst["StartTime"]; + QString stime = (QString)inst["StartTime"]; SpiceDouble etStart; - str2et_c(stime.c_str(), &etStart); - stime = (string) inst["StopTime"]; + str2et_c(stime.toAscii().data(), &etStart); + stime = (QString) inst["StopTime"]; SpiceDouble etStop; - str2et_c(stime.c_str(), &etStop); - iTime isisTime( (string) inst["StartTime"]); + str2et_c(stime.toAscii().data(), &etStop); + iTime isisTime( (QString) inst["StartTime"]); // Get other info from labels // line exposure duration, sec/mm @@ -101,7 +101,7 @@ namespace Isis { new LineScanCameraSkyMap(this); Isis::PvlGroup &instP = lab.FindGroup("Kernels", Isis::Pvl::Traverse); - m_CkFrameId = (int) instP["NaifFrameCode"][0]; + m_CkFrameId = toInt(instP["NaifFrameCode"][0]); m_CkFrameId = -int(-m_CkFrameId/1000)*1000; LoadCache(); diff --git a/isis/src/base/apps/algebra/algebra.cpp b/isis/src/base/apps/algebra/algebra.cpp index a3a3a5fbae..89d39ed431 100644 --- a/isis/src/base/apps/algebra/algebra.cpp +++ b/isis/src/base/apps/algebra/algebra.cpp @@ -38,7 +38,7 @@ void IsisMain() { Isise = ui.GetDouble("E"); // Start the processing based on the operator - string op = ui.GetString("OPERATOR"); + QString op = ui.GetString("OPERATOR"); if(op == "ADD") p.ProcessCubes(&add); if(op == "SUBTRACT") p.ProcessCubes(&sub); if(op == "MULTIPLY") p.ProcessCubes(&mult); diff --git a/isis/src/base/apps/appjit/LineScanCameraRotation.cpp b/isis/src/base/apps/appjit/LineScanCameraRotation.cpp index 71ce17b2f4..d4c9fe1d7d 100644 --- a/isis/src/base/apps/appjit/LineScanCameraRotation.cpp +++ b/isis/src/base/apps/appjit/LineScanCameraRotation.cpp @@ -42,7 +42,7 @@ namespace Isis { // Make sure the kernels are written to the labels and not just the tables (blobs) if(!p_spi->hasKernels(lab)) { - std::string msg = "The master file must contain the kernel files. Rerun spiceinit with attach=no"; + QString msg = "The master file must contain the kernel files. Rerun spiceinit with attach=no"; throw IException(IException::User, msg, _FILEINFO_); } @@ -180,7 +180,7 @@ namespace Isis { // Make sure caches are already loaded if(!p_cachesLoaded) { - std::string msg = "A LineScanCameraRotation cache has not been loaded yet"; + QString msg = "A LineScanCameraRotation cache has not been loaded yet"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/appjit/PixelOffset.cpp b/isis/src/base/apps/appjit/PixelOffset.cpp index 12cba36d32..328d570a2c 100644 --- a/isis/src/base/apps/appjit/PixelOffset.cpp +++ b/isis/src/base/apps/appjit/PixelOffset.cpp @@ -25,7 +25,7 @@ namespace Isis { * @param fl Focal length of instrument in mm. * @param pixpitch Pixel pitch of instrument in mm/pixel. */ - PixelOffset::PixelOffset(const std::string &tableList, double fl, double pixPitch, double baseTime, + PixelOffset::PixelOffset(const QString &tableList, double fl, double pixPitch, double baseTime, double timeScale, int degree) { p_focalLen = fl; p_pixPitch = pixPitch; @@ -35,9 +35,9 @@ namespace Isis { p_baseTime = baseTime; p_timeScale = timeScale; p_angleScale = p_pixPitch / p_focalLen; - std::vector lines; + std::vector lines; Isis::TextFile inputFile(tableList, "input", lines); - std::vector fields; + QStringList fields; p_I.push_back(1.0); p_I.push_back(0.0); p_I.push_back(0.0); @@ -59,14 +59,14 @@ namespace Isis { for(size_t iline = 0; iline < lines.size(); iline++) { - int num = IString::Split(' ', IString::ConvertWhiteSpace(lines[iline]), fields, false); - if(num != 3) { - Isis::IString msg = "Three fields are required: sample, line, and ephemeris time."; + fields = lines[iline].simplified().split(" ", QString::SkipEmptyParts); + if(fields.count() != 3) { + QString msg = "Three fields are required: sample, line, and ephemeris time."; throw IException(IException::Io, msg, _FILEINFO_); } - p_samples.push_back(IString::ToDouble(fields[0])); - p_lines.push_back(IString::ToDouble(fields[1])); - p_times.push_back(IString::ToDouble(fields[2])); + p_samples.push_back(toDouble(fields[0])); + p_lines.push_back(toDouble(fields[1])); + p_times.push_back(toDouble(fields[2])); } // Compute scalers @@ -125,7 +125,7 @@ namespace Isis { loc0 = p_lines[index]; } else { - std::string msg; + QString msg; msg = "Error in extrapolation code"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -165,7 +165,7 @@ namespace Isis { // Make sure angles aren't already loaded TBD /* if () { - std::string msg = "An angle cache has already been created"; + QString msg = "An angle cache has already been created"; throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_); } */ @@ -237,7 +237,7 @@ namespace Isis { } if(fitAng1->Knowns() == 0) { - std::string msg; + QString msg; msg = "Cube time range is not covered by jitter file"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/appjit/PixelOffset.h b/isis/src/base/apps/appjit/PixelOffset.h index 02a781a0ee..ea68243c4c 100644 --- a/isis/src/base/apps/appjit/PixelOffset.h +++ b/isis/src/base/apps/appjit/PixelOffset.h @@ -22,13 +22,15 @@ * http://www.usgs.gov/privacy.html. */ -#include #include -#include "PolynomialUnivariate.h" -#include "naif/SpiceUsr.h" -#include "naif/SpiceZfc.h" -#include "naif/SpiceZmc.h" +#include +#include +#include + +#include + +#include "PolynomialUnivariate.h" namespace Isis { /** @@ -58,7 +60,7 @@ namespace Isis { class PixelOffset { public: //! Constructors - PixelOffset(const std::string &tableList, double fl, double pixPitch, double baseTime, + PixelOffset(const QString &tableList, double fl, double pixPitch, double baseTime, double timeScale, int degree); //! Destructor diff --git a/isis/src/base/apps/appjit/appjit.cpp b/isis/src/base/apps/appjit/appjit.cpp index da6e8989bd..643b1118f3 100644 --- a/isis/src/base/apps/appjit/appjit.cpp +++ b/isis/src/base/apps/appjit/appjit.cpp @@ -31,7 +31,7 @@ void IsisMain() { list.read(ui.GetFileName("FROMLIST")); if(list.size() < 1) { - string msg = "The input list file [" + ui.GetFileName("FROMLIST") + "is empty"; + QString msg = "The input list file [" + ui.GetFileName("FROMLIST") + "is empty"; throw IException(IException::User, msg, _FILEINFO_); } @@ -42,7 +42,7 @@ void IsisMain() { } if(ifile >= list.size()) { - string msg = "The master file, [" + FileName(ui.GetFileName("MASTER")).expanded() + " is not included in " + + QString msg = "The master file, [" + FileName(ui.GetFileName("MASTER")).expanded() + " is not included in " + "the input list file " + ui.GetFileName("FROMLIST") + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -65,7 +65,7 @@ void IsisMain() { // Get the camera Camera *cam = cube.getCamera(); if(cam->DetectorMap()->LineRate() == 0.0) { - string msg = "[" + ui.GetFileName("MASTER") + "] is not a line scan camera image"; + QString msg = "[" + ui.GetFileName("MASTER") + "] is not a line scan camera image"; throw IException(IException::User, msg, _FILEINFO_); } @@ -140,7 +140,7 @@ void IsisMain() { // Get the camera and make sure it is a line scan camera Camera *cam = cube.getCamera(); if(cam->DetectorMap()->LineRate() == 0.0) { - string msg = "[" + ui.GetFileName("FROM") + "] is not a line scan camera"; + QString msg = "[" + ui.GetFileName("FROM") + "] is not a line scan camera"; throw IException(IException::User, msg, _FILEINFO_); } // Write out the pointing cache as a table @@ -158,13 +158,13 @@ void IsisMain() { } cube.putGroup(kernels); cube.close(); - gp += PvlKeyword("Status" + IString(ifile), list[ifile].toString() + ": camera pointing updated"); + gp += PvlKeyword("Status" + toString(ifile), list[ifile].toString() + ": camera pointing updated"); } } Application::Log(gp); } catch(IException &e) { - string msg; + QString msg; if(!step2) { msg = "Unable to fit pointing for [" + ui.GetFileName("MASTER") + "]"; } diff --git a/isis/src/base/apps/ascii2isis/ascii2isis.cpp b/isis/src/base/apps/ascii2isis/ascii2isis.cpp index 0c09ff002a..ffd4eba817 100644 --- a/isis/src/base/apps/ascii2isis/ascii2isis.cpp +++ b/isis/src/base/apps/ascii2isis/ascii2isis.cpp @@ -14,7 +14,7 @@ using namespace Isis; double TestSpecial(const double pixel); void ascii2isis(Buffer &out); ifstream fin; -string order; +QString order; //Initialize values to make special pixels invalid double null_min = DBL_MAX; double null_max = DBL_MIN; @@ -27,7 +27,7 @@ void IsisMain() { // Open input text file UserInterface &ui = Application::GetUserInterface(); - string from = ui.GetFileName("FROM"); + QString from = ui.GetFileName("FROM"); // Get storage order of data order = ui.GetString("ORDER"); @@ -54,9 +54,9 @@ void IsisMain() { lrs_max = ui.GetDouble("LRSMAX"); } - fin.open(from.c_str(), std::ios::in); + fin.open(from.toAscii().data(), std::ios::in); if(!fin.is_open()) { - string msg = "Cannot open input file [" + from + "]"; + QString msg = "Cannot open input file [" + from + "]"; throw IException(IException::Io, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/automos/automos.cpp b/isis/src/base/apps/automos/automos.cpp index abc82f555f..1a72868ca3 100644 --- a/isis/src/base/apps/automos/automos.cpp +++ b/isis/src/base/apps/automos/automos.cpp @@ -14,8 +14,8 @@ using namespace Isis; void calcRange(double &minLat, double &maxLat, double &minLon, double &maxLon); void helperButtonCalcRange(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonCalcRange"] = (void *) helperButtonCalcRange; return helper; } @@ -27,16 +27,16 @@ void IsisMain() { // Get the list of cubes to mosaic list.read(FileName(ui.GetFileName("FROMLIST"))); if(list.size() < 1) { - string msg = "The list file [" + ui.GetFileName("FROMLIST") +"does not contain any data"; + QString msg = "The list file [" + ui.GetFileName("FROMLIST") +"does not contain any data"; throw IException(IException::User, msg, _FILEINFO_); } fstream os; bool olistFlag = false; if (ui.WasEntered("TOLIST")){ - string olist = ui.GetFileName("TOLIST"); + QString olist = ui.GetFileName("TOLIST"); olistFlag = true; - os.open(olist.c_str(), std::ios::out); + os.open(olist.toAscii().data(), std::ios::out); } ProcessMapMosaic m; @@ -144,8 +144,8 @@ void calcRange(double &minLat, double &maxLat, double &minLon, double &maxLon) { firstProj = proj; } else if(*proj != *firstProj) { - string msg = "Mapping groups do not match between cubes [" + list[0].toString() + - "] and [" + list[i].toString() + "]"; + QString msg = "Mapping groups do not match between cubes [" + list[0].toString() + + "] and [" + list[i].toString() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -175,7 +175,7 @@ void helperButtonCalcRange() { calcRange(minLat, maxLat, minLon, maxLon); // Write ranges to the GUI - string use = "USER"; + QString use = "USER"; ui.Clear("GRANGE"); ui.PutAsString("GRANGE", use); ui.Clear("MINLAT"); diff --git a/isis/src/base/apps/autoregtemplate/autoregtemplate.cpp b/isis/src/base/apps/autoregtemplate/autoregtemplate.cpp index bbbb099657..efd936ded9 100644 --- a/isis/src/base/apps/autoregtemplate/autoregtemplate.cpp +++ b/isis/src/base/apps/autoregtemplate/autoregtemplate.cpp @@ -18,10 +18,10 @@ void IsisMain() { PvlObject autoreg("AutoRegistration"); // Make sure the entered algorithm name is valid - string algoName = ui.GetString("ALGORITHM"); + QString algoName = ui.GetString("ALGORITHM"); if(!algos.HasGroup(algoName)) { // Give the user a list of possible algorithms - string msg = "Invalid value for [ALGORITHM] entered [" + algoName + "]. " + QString msg = "Invalid value for [ALGORITHM] entered [" + algoName + "]. " + "Must be one of ["; for(int i = 0; i < algos.Groups(); i++) { @@ -41,16 +41,16 @@ void IsisMain() { // Set the tolerance double tol = ui.GetDouble("TOLERANCE"); - algorithm += PvlKeyword("Tolerance", IString(tol)); + algorithm += PvlKeyword("Tolerance", toString(tol)); // Set the reduction factor if the user entered it if(ui.WasEntered("REDUCTIONFACTOR")) { int reduction = ui.GetInteger("REDUCTIONFACTOR"); - algorithm += PvlKeyword("ReductionFactor", IString(reduction)); + algorithm += PvlKeyword("ReductionFactor", toString(reduction)); if(reduction < 1) { - string msg = "Invalid value for [REDUCTIONFACTOR] entered [" - + IString(reduction) + "]. Must be greater than or equal to 1 (Default = 1)"; + QString msg = "Invalid value for [REDUCTIONFACTOR] entered [" + + toString(reduction) + "]. Must be greater than or equal to 1 (Default = 1)"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -59,7 +59,7 @@ void IsisMain() { algorithm += PvlKeyword("SubpixelAccuracy", (subPixelAccuracy) ? "True" : "False"); // Set the chip interpolator type - QMap paramToInterpMap; + QMap paramToInterpMap; paramToInterpMap["NEARESTNEIGHBORTYPE"] = "NearestNeighborType"; paramToInterpMap["BILINEARTYPE"] = "BiLinearType"; paramToInterpMap["CUBICCONVOLUTIONTYPE"] = "CubicConvolutionType"; @@ -77,70 +77,70 @@ void IsisMain() { // Make sure the pattern chip is not just one pixel if(psamp + pline < 3) { - string msg = "The Pattern Chip must be larger than one pixel for the "; + QString msg = "The Pattern Chip must be larger than one pixel for the "; msg += "autoregistration to work properly"; throw IException(IException::User, msg, _FILEINFO_); } // Make sure the pattern chip is smaller than the search chip if(ssamp < psamp || sline < pline) { - string msg = "The Pattern Chip must be smaller than the Search Chip"; + QString msg = "The Pattern Chip must be smaller than the Search Chip"; throw IException(IException::User, msg, _FILEINFO_); } // Make sure the pattern chip spans at least a 3x3 window in the search chip if(psamp + 2 > ssamp || pline + 2 > sline) { - string msg = "The Pattern Chip must span at least a 3x3 window in the "; + QString msg = "The Pattern Chip must span at least a 3x3 window in the "; msg += "Search Chip"; throw IException(IException::User, msg, _FILEINFO_); } // Set up the pattern chip group PvlGroup patternChip("PatternChip"); - patternChip += PvlKeyword("Samples", IString(psamp)); - patternChip += PvlKeyword("Lines", IString(pline)); + patternChip += PvlKeyword("Samples", toString(psamp)); + patternChip += PvlKeyword("Lines", toString(pline)); if(ui.WasEntered("PMIN")) { - patternChip += PvlKeyword("ValidMinimum", IString(ui.GetInteger("PMIN"))); + patternChip += PvlKeyword("ValidMinimum", toString(ui.GetInteger("PMIN"))); } if(ui.WasEntered("PMAX")) { - patternChip += PvlKeyword("ValidMaximum", IString(ui.GetInteger("PMAX"))); + patternChip += PvlKeyword("ValidMaximum", toString(ui.GetInteger("PMAX"))); } if(ui.WasEntered("MINIMUMZSCORE")) { double minimum = ui.GetDouble("MINIMUMZSCORE"); - patternChip += PvlKeyword("MinimumZScore", IString(minimum)); + patternChip += PvlKeyword("MinimumZScore", toString(minimum)); if(minimum <= 0.0) { - string msg = "Invalid value for [MINIMUMZSCORE] entered [" - + IString(minimum) + "]. Must be greater than 0.0 (Default = 1.0)"; + QString msg = "Invalid value for [MINIMUMZSCORE] entered [" + + toString(minimum) + "]. Must be greater than 0.0 (Default = 1.0)"; throw IException(IException::User, msg, _FILEINFO_); } } if(ui.WasEntered("PVALIDPERCENT")) { double percent = ui.GetDouble("PVALIDPERCENT"); if((percent <= 0.0) || (percent > 100.0)) { - string msg = "Invalid value for [PVALIDPERCENT] entered [" - + IString(percent) + "]. Must be greater than 0.0 and less than or equal to 100.0 (Default = 50.0)"; + QString msg = "Invalid value for [PVALIDPERCENT] entered [" + + toString(percent) + "]. Must be greater than 0.0 and less than or equal to 100.0 (Default = 50.0)"; throw IException(IException::User, msg, _FILEINFO_); } - patternChip += PvlKeyword("ValidPercent", IString(percent)); + patternChip += PvlKeyword("ValidPercent", toString(percent)); } // Set up the search chip group PvlGroup searchChip("SearchChip"); - searchChip += PvlKeyword("Samples", IString(ssamp)); - searchChip += PvlKeyword("Lines", IString(sline)); + searchChip += PvlKeyword("Samples", toString(ssamp)); + searchChip += PvlKeyword("Lines", toString(sline)); if(ui.WasEntered("SMIN")) { - searchChip += PvlKeyword("ValidMinimum", IString(ui.GetInteger("SMIN"))); + searchChip += PvlKeyword("ValidMinimum", toString(ui.GetInteger("SMIN"))); } if(ui.WasEntered("SMAX")) { - searchChip += PvlKeyword("ValidMaximum", IString(ui.GetInteger("SMAX"))); + searchChip += PvlKeyword("ValidMaximum", toString(ui.GetInteger("SMAX"))); } if(ui.WasEntered("SSUBCHIPVALIDPERCENT")) { double percent = ui.GetDouble("SSUBCHIPVALIDPERCENT"); if((percent <= 0.0) || (percent > 100.0)) { - string msg = "Invalid value for [SSUBCHIPVALIDPERCENT] entered [" - + IString(percent) + "]. Must be greater than 0.0 and less than or equal to 100.0 (Default = 50.0)"; + QString msg = "Invalid value for [SSUBCHIPVALIDPERCENT] entered [" + + toString(percent) + "]. Must be greater than 0.0 and less than or equal to 100.0 (Default = 50.0)"; throw IException(IException::User, msg, _FILEINFO_); } - searchChip += PvlKeyword("SubchipValidPercent", IString(percent)); + searchChip += PvlKeyword("SubchipValidPercent", toString(percent)); } // Add groups to the autoreg object @@ -152,21 +152,21 @@ void IsisMain() { PvlGroup surfaceModel("SurfaceModel"); double distanceTol = ui.GetDouble("DISTANCETOLERANCE"); - surfaceModel += PvlKeyword("DistanceTolerance", IString(distanceTol)); + surfaceModel += PvlKeyword("DistanceTolerance", toString(distanceTol)); if(distanceTol <= 0.0) { - string msg = "Invalid value for [DISTANCETOLERANCE] entered [" - + IString(distanceTol) + "]. Must be greater than 0.0 (Default = 1.5)"; + QString msg = "Invalid value for [DISTANCETOLERANCE] entered [" + + toString(distanceTol) + "]. Must be greater than 0.0 (Default = 1.5)"; throw IException(IException::User, msg, _FILEINFO_); } int winSize = ui.GetInteger("WINDOWSIZE"); - surfaceModel += PvlKeyword("WindowSize", IString(winSize)); + surfaceModel += PvlKeyword("WindowSize", toString(winSize)); // Make sure the window size is odd if(winSize % 2 == 0) { - string msg = "Invalid value for [WINDOWSIZE] entered [" - + IString(winSize) + "]. Must be an odd number (Default = 5)"; + QString msg = "Invalid value for [WINDOWSIZE] entered [" + + toString(winSize) + "]. Must be an odd number (Default = 5)"; throw IException(IException::User, msg, _FILEINFO_); } autoreg.AddGroup(surfaceModel); @@ -176,7 +176,7 @@ void IsisMain() { p.AddObject(autoreg); // Write the autoreg group pvl to the output file - string output = ui.GetFileName("TOPVL"); + QString output = ui.GetFileName("TOPVL"); p.Write(output); Isis::Application::GuiLog(p); diff --git a/isis/src/base/apps/bandnorm/bandnorm.cpp b/isis/src/base/apps/bandnorm/bandnorm.cpp index 58fa72b875..19d9a1d7e2 100644 --- a/isis/src/base/apps/bandnorm/bandnorm.cpp +++ b/isis/src/base/apps/bandnorm/bandnorm.cpp @@ -25,9 +25,9 @@ static vector normalizer; // function prototypes void getStats(Buffer &in); void normalize(Buffer &in, Buffer &out); -void Tokenize(const string &str, - vector & tokens, - const string &delimiters = " "); +void Tokenize(const QString &str, + vector & tokens, + const QString &delimiters = " "); void IsisMain() { // We will be processing by line @@ -38,7 +38,7 @@ void IsisMain() { Cube *icube = p.SetInputCube("FROM"); // Now get the statistics for each band or the entire cube - string avg = ui.GetString("AVERAGE"); + QString avg = ui.GetString("AVERAGE"); p.StartProcess(getStats); if(avg == "BAND") { int b = 0; @@ -59,13 +59,13 @@ void IsisMain() { TextFile pencil; pencil.Open(ui.GetFileName("SPECTRUM")); if(pencil.LineCount() - 1 < icube->getBandCount()) { - string msg = "The spectral pencil file [" + ui.GetAsString("SPECTRUM") + - "] does not contain enough data for all bands."; + QString msg = "The spectral pencil file [" + ui.GetAsString("SPECTRUM") + + "] does not contain enough data for all bands."; throw IException(IException::User, msg, _FILEINFO_); } - string st; + QString st; int column = -1; - vector tokens; + vector tokens; pencil.GetLine(st); //Takes care of title line Tokenize(st, tokens, ", \"-+"); if(ui.GetAsString("METHOD") == "number") { @@ -80,8 +80,8 @@ void IsisMain() { } } if(column < 0 || (unsigned)column > tokens.size()) { - string msg = "The column specified in file [" + ui.GetFileName("SPECTRUM") - + "] was not found."; + QString msg = "The column specified in file [" + ui.GetFileName("SPECTRUM") + + "] was not found."; throw IException(IException::User, msg, _FILEINFO_); } // Add the correct column of data to normalizer @@ -142,9 +142,12 @@ void normalize(Buffer &in, Buffer &out) { } // Tokenizer -void Tokenize(const string &str, - vector & tokens, - const string &delimiters) { +void Tokenize(const QString &strQStr, + vector & tokens, + const QString &delimitersQStr) { + IString str = strQStr; + IString delimiters = delimitersQStr; + //Skip delimiters at the beginning string::size_type lastPos = str.find_first_not_of(delimiters, 0); // Find first "non-delimiter". @@ -152,7 +155,7 @@ void Tokenize(const string &str, while(string::npos != pos || string::npos != lastPos) { // Found a token, add it to the vector - tokens.push_back(str.substr(lastPos, pos - lastPos)); + tokens.push_back(str.substr(lastPos, pos - lastPos).c_str()); // Skip delimiters lastPos = str.find_first_not_of(delimiters, pos); // Find next "non-delimiter" diff --git a/isis/src/base/apps/bit2bit/bit2bit.cpp b/isis/src/base/apps/bit2bit/bit2bit.cpp index 3d5fafa873..99cf8a7ba9 100644 --- a/isis/src/base/apps/bit2bit/bit2bit.cpp +++ b/isis/src/base/apps/bit2bit/bit2bit.cpp @@ -98,16 +98,16 @@ void IsisMain(){ //!Write bit2bit summary to print.prt logfile PvlGroup results("bit2bit_Results"); - results += PvlKeyword ("INPUT_LRS",iLrs); - results += PvlKeyword ("INPUT_HRS",iHrs); - results += PvlKeyword ("INPUT_NULL",iNull); - results += PvlKeyword ("INPUT_INVALID_PERCENT",invalid_pi); - results += PvlKeyword ("OUTPUT_MIN",validMin); - results += PvlKeyword ("OUTPUT_MAX",validMax); - results += PvlKeyword ("OUTPUT_LRS",oLrs); - results += PvlKeyword ("OUTPUT_HRS",oHrs); - results += PvlKeyword ("OUTPUT_NULL",oNull); - results += PvlKeyword ("OUTPUT_INVALID_PERCENT",invalid_po); + results += PvlKeyword ("INPUT_LRS",toString(iLrs)); + results += PvlKeyword ("INPUT_HRS",toString(iHrs)); + results += PvlKeyword ("INPUT_NULL",toString(iNull)); + results += PvlKeyword ("INPUT_INVALID_PERCENT",toString(invalid_pi)); + results += PvlKeyword ("OUTPUT_MIN",toString(validMin)); + results += PvlKeyword ("OUTPUT_MAX",toString(validMax)); + results += PvlKeyword ("OUTPUT_LRS",toString(oLrs)); + results += PvlKeyword ("OUTPUT_HRS",toString(oHrs)); + results += PvlKeyword ("OUTPUT_NULL",toString(oNull)); + results += PvlKeyword ("OUTPUT_INVALID_PERCENT",toString(invalid_po)); Application::Log(results); delete histptr; @@ -134,12 +134,12 @@ void IsisMain(){ //!Write bit2bit summary to print.prt logfile PvlGroup results("bit2bit_Results"); - results += PvlKeyword ("INPUT_LRS",iLrs); - results += PvlKeyword ("INPUT_HRS",iHrs); - results += PvlKeyword ("INPUT_NULL",iNull); - results += PvlKeyword ("INPUT_INVALID_PERCENT",invalid_pi); - results += PvlKeyword ("OUTPUT_MIN",validMin); - results += PvlKeyword ("OUTPUT_MAX",validMax); + results += PvlKeyword ("INPUT_LRS",toString(iLrs)); + results += PvlKeyword ("INPUT_HRS",toString(iHrs)); + results += PvlKeyword ("INPUT_NULL",toString(iNull)); + results += PvlKeyword ("INPUT_INVALID_PERCENT",toString(invalid_pi)); + results += PvlKeyword ("OUTPUT_MIN",toString(validMin)); + results += PvlKeyword ("OUTPUT_MAX",toString(validMax)); Application::Log(results); delete histptr; diff --git a/isis/src/base/apps/blend/blend.cpp b/isis/src/base/apps/blend/blend.cpp index 557accdaae..56fc8e6bb4 100644 --- a/isis/src/base/apps/blend/blend.cpp +++ b/isis/src/base/apps/blend/blend.cpp @@ -18,7 +18,6 @@ using namespace Isis; -using std::string; int r1; @@ -107,7 +106,7 @@ Chip * createRamp(Chip *pic1, Chip *pic2, int stop); void processNodes(QQueue &nodes, QVector &ol, int &maxScore, int stop); -void readOutputs(string outName, const FileList &inputs, FileList &outputs); +void readOutputs(QString outName, const FileList &inputs, FileList &outputs); void generateOutputs(const FileList &inputs, FileList &outputs); @@ -131,7 +130,7 @@ void IsisMain() { FileList inputs(ui.GetFileName("FROMLIST")); if (inputs.size() < 2) { - string msg = "FROMLIST must have at least two images to blend"; + QString msg = "FROMLIST must have at least two images to blend"; throw IException(IException::User, msg, _FILEINFO_); } @@ -148,7 +147,7 @@ void IsisMain() { QFile::remove(output); if (!QFile::copy(input, output)) { - string msg = "Cannot create output cube [" + output.toStdString() + "]"; + QString msg = "Cannot create output cube [" + output + "]"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -165,8 +164,8 @@ void IsisMain() { OverlapStatistics oStats(from1, from2); if (oStats.HasOverlap()) { - overlapped.insert(QString::fromStdString(inputs[j].toString())); - overlapped.insert(QString::fromStdString(inputs[i].toString())); + overlapped.insert(inputs[j].toString()); + overlapped.insert(inputs[i].toString()); i1 = new Chip(oStats.Samples() + 2, oStats.Lines() + 2); int from1CenterSample = @@ -200,7 +199,7 @@ void IsisMain() { ProcessByLine p; CubeAttributeInput att; - IString cubeName = outputs[i].toString(); + QString cubeName = outputs[i].toString(); p.SetInputCube(cubeName, att, ReadWrite); p.StartProcess(blend); @@ -236,9 +235,9 @@ void IsisMain() { // Make sure cube projection overlaps at least one other cube if (ui.GetBoolean("ERROR")) { for (int i = 1; i < inputs.size(); i++) { - if (!overlapped.contains(QString::fromStdString(inputs[i].toString()))) { - string msg = "Input Cube [" + inputs[i].toString() + - "] does not overlap another cube"; + if (!overlapped.contains(inputs[i].toString())) { + QString msg = "Input Cube [" + inputs[i].toString() + + "] does not overlap another cube"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -285,7 +284,7 @@ Chip * createRamp(Chip *pic1, Chip *pic2, int stop) { int y = pic1->Lines(); if (x != pic2->Samples() || y != pic2->Lines()) { - string msg = "The two pictures need to be of the exact same dimensions"; + QString msg = "The two pictures need to be of the exact same dimensions"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -391,12 +390,12 @@ void processNodes(QQueue &nodes, QVector &ol, } -void readOutputs(string outName, const FileList &inputs, FileList &outputs) { +void readOutputs(QString outName, const FileList &inputs, FileList &outputs) { outputs.read(outName); // Make sure each file in the tolist matches a file in the fromlist if (outputs.size() != inputs.size()) { - string msg = "There must be exactly one output image in the TOLIST for " + QString msg = "There must be exactly one output image in the TOLIST for " "each input image in the FROMLIST"; throw IException(IException::User, msg, _FILEINFO_); } @@ -405,8 +404,8 @@ void readOutputs(string outName, const FileList &inputs, FileList &outputs) { // corresponding input file for (int i = 0; i < outputs.size(); i++) { if (outputs[i].toString().compare(inputs[i].toString()) == 0) { - string msg = "The to list file [" + outputs[i].toString() + - "] has the same name as its corresponding from list file."; + QString msg = "The to list file [" + outputs[i].toString() + + "] has the same name as its corresponding from list file."; throw IException(IException::User, msg, _FILEINFO_); } } @@ -416,7 +415,7 @@ void readOutputs(string outName, const FileList &inputs, FileList &outputs) { void generateOutputs(const FileList &inputs, FileList &outputs) { for (int i = 0; i < inputs.size(); i++) { FileName file=inputs[i]; - IString filename = file.path() + "/" + file.baseName() + + QString filename = file.path() + "/" + file.baseName() + ".blend." + file.extension(); outputs.push_back(filename); } diff --git a/isis/src/base/apps/butterworth/butterworth.cpp b/isis/src/base/apps/butterworth/butterworth.cpp index a34a30e9c0..9833ee8639 100644 --- a/isis/src/base/apps/butterworth/butterworth.cpp +++ b/isis/src/base/apps/butterworth/butterworth.cpp @@ -51,8 +51,8 @@ void IsisMain() { p.StartProcess(bandstop); } else { - string msg = "Unknow value for TYPE [" + - ui.GetString("TYPE") + "]"; + QString msg = "Unknow value for TYPE [" + + ui.GetString("TYPE") + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/cam2cam/cam2cam.cpp b/isis/src/base/apps/cam2cam/cam2cam.cpp index 1a30bb5c22..9a70687ca3 100644 --- a/isis/src/base/apps/cam2cam/cam2cam.cpp +++ b/isis/src/base/apps/cam2cam/cam2cam.cpp @@ -39,7 +39,7 @@ void IsisMain() { // Set the reference band we want to match PvlGroup instgrp = mcube->getGroup("Instrument"); if(!outcam->IsBandIndependent()) { - PvlKeyword rBand("ReferenceBand", referenceBand); + PvlKeyword rBand("ReferenceBand", toString(referenceBand)); rBand.AddComment("# All bands are aligned to reference band"); instgrp += rBand; mcube->putGroup(instgrp); diff --git a/isis/src/base/apps/cam2map/cam2map.cpp b/isis/src/base/apps/cam2map/cam2map.cpp index a9120112cc..6a2d608b79 100644 --- a/isis/src/base/apps/cam2map/cam2map.cpp +++ b/isis/src/base/apps/cam2map/cam2map.cpp @@ -21,8 +21,8 @@ void LoadCameraRes(); void LoadMapRange(); void LoadCameraRange(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["PrintMap"] = (void *) PrintMap; helper ["LoadMapRes"] = (void *) LoadMapRes; helper ["LoadCameraRes"] = (void *) LoadCameraRes; @@ -53,8 +53,8 @@ void IsisMain() { // Make sure it is not the sky if(incam->target()->isSky()) { - string msg = "The image [" + ui.GetFileName("FROM") + - "] is targeting the sky, use skymap instead."; + QString msg = "The image [" + ui.GetFileName("FROM") + + "] is targeting the sky, use skymap instead."; throw IException(IException::User, msg, _FILEINFO_); } @@ -67,10 +67,10 @@ void IsisMain() { // Make the target info match the user mapfile double minlat, maxlat, minlon, maxlon; incam->GroundRange(minlat, maxlat, minlon, maxlon, userMap); - camGrp.AddKeyword(PvlKeyword("MinimumLatitude", minlat), Pvl::Replace); - camGrp.AddKeyword(PvlKeyword("MaximumLatitude", maxlat), Pvl::Replace); - camGrp.AddKeyword(PvlKeyword("MinimumLongitude", minlon), Pvl::Replace); - camGrp.AddKeyword(PvlKeyword("MaximumLongitude", maxlon), Pvl::Replace); + camGrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(minlat)), Pvl::Replace); + camGrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(maxlat)), Pvl::Replace); + camGrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(minlon)), Pvl::Replace); + camGrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(maxlon)), Pvl::Replace); // We want to delete the keywords we just added if the user wants the range @@ -102,22 +102,22 @@ void IsisMain() { // If the user decided to enter a ground range then override if(ui.WasEntered("MINLON") && !ui.GetBoolean("MATCHMAP")) { userGrp.AddKeyword(PvlKeyword("MinimumLongitude", - ui.GetDouble("MINLON")), Pvl::Replace); + toString(ui.GetDouble("MINLON"))), Pvl::Replace); } if(ui.WasEntered("MAXLON") && !ui.GetBoolean("MATCHMAP")) { userGrp.AddKeyword(PvlKeyword("MaximumLongitude", - ui.GetDouble("MAXLON")), Pvl::Replace); + toString(ui.GetDouble("MAXLON"))), Pvl::Replace); } if(ui.WasEntered("MINLAT") && !ui.GetBoolean("MATCHMAP")) { userGrp.AddKeyword(PvlKeyword("MinimumLatitude", - ui.GetDouble("MINLAT")), Pvl::Replace); + toString(ui.GetDouble("MINLAT"))), Pvl::Replace); } if(ui.WasEntered("MAXLAT") && !ui.GetBoolean("MATCHMAP")) { userGrp.AddKeyword(PvlKeyword("MaximumLatitude", - ui.GetDouble("MAXLAT")), Pvl::Replace); + toString(ui.GetDouble("MAXLAT"))), Pvl::Replace); } // If they want the res. from the mapfile, delete it from the camera so @@ -146,7 +146,7 @@ void IsisMain() { // If the user decided to enter a resolution then override if(ui.GetString("PIXRES") == "MPP" && !ui.GetBoolean("MATCHMAP")) { userGrp.AddKeyword(PvlKeyword("PixelResolution", - ui.GetDouble("RESOLUTION")), + toString(ui.GetDouble("RESOLUTION"))), Pvl::Replace); if(userGrp.HasKeyword("Scale")) { userGrp.DeleteKeyword("Scale"); @@ -154,7 +154,7 @@ void IsisMain() { } else if(ui.GetString("PIXRES") == "PPD" && !ui.GetBoolean("MATCHMAP")) { userGrp.AddKeyword(PvlKeyword("Scale", - ui.GetDouble("RESOLUTION")), + toString(ui.GetDouble("RESOLUTION"))), Pvl::Replace); if(userGrp.HasKeyword("PixelResolution")) { userGrp.DeleteKeyword("PixelResolution"); @@ -167,22 +167,22 @@ void IsisMain() { if(incam->IntersectsLongitudeDomain(userMap)) { if(ui.GetString("LONSEAM") == "AUTO") { if((int) userGrp["LongitudeDomain"] == 360) { - userGrp.AddKeyword(PvlKeyword("LongitudeDomain", 180), + userGrp.AddKeyword(PvlKeyword("LongitudeDomain", "180"), Pvl::Replace); if(incam->IntersectsLongitudeDomain(userMap)) { // Its looks like a global image so switch back to the // users preference - userGrp.AddKeyword(PvlKeyword("LongitudeDomain", 360), + userGrp.AddKeyword(PvlKeyword("LongitudeDomain", "360"), Pvl::Replace); } } else { - userGrp.AddKeyword(PvlKeyword("LongitudeDomain", 360), + userGrp.AddKeyword(PvlKeyword("LongitudeDomain", "360"), Pvl::Replace); if(incam->IntersectsLongitudeDomain(userMap)) { // Its looks like a global image so switch back to the // users preference - userGrp.AddKeyword(PvlKeyword("LongitudeDomain", 180), + userGrp.AddKeyword(PvlKeyword("LongitudeDomain", "180"), Pvl::Replace); } } @@ -190,22 +190,22 @@ void IsisMain() { double minlat, maxlat, minlon, maxlon; incam->GroundRange(minlat, maxlat, minlon, maxlon, userMap); if(!ui.WasEntered("MINLAT")) { - userGrp.AddKeyword(PvlKeyword("MinimumLatitude", minlat), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(minlat)), Pvl::Replace); } if(!ui.WasEntered("MAXLAT")) { - userGrp.AddKeyword(PvlKeyword("MaximumLatitude", maxlat), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(maxlat)), Pvl::Replace); } if(!ui.WasEntered("MINLON")) { - userGrp.AddKeyword(PvlKeyword("MinimumLongitude", minlon), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(minlon)), Pvl::Replace); } if(!ui.WasEntered("MAXLON")) { - userGrp.AddKeyword(PvlKeyword("MaximumLongitude", maxlon), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(maxlon)), Pvl::Replace); } } else if(ui.GetString("LONSEAM") == "ERROR") { - string msg = "The image [" + ui.GetFileName("FROM") + "] crosses the " + - "longitude seam"; + QString msg = "The image [" + ui.GetFileName("FROM") + "] crosses the " + + "longitude seam"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -271,14 +271,14 @@ void IsisMain() { // Create an alpha cube group for the output cube if(!ocube->hasGroup("AlphaCube")) { PvlGroup alpha("AlphaCube"); - alpha += PvlKeyword("AlphaSamples", icube->getSampleCount()); - alpha += PvlKeyword("AlphaLines", icube->getLineCount()); - alpha += PvlKeyword("AlphaStartingSample", 0.5); - alpha += PvlKeyword("AlphaStartingLine", 0.5); - alpha += PvlKeyword("AlphaEndingSample", icube->getSampleCount() + 0.5); - alpha += PvlKeyword("AlphaEndingLine", icube->getLineCount() + 0.5); - alpha += PvlKeyword("BetaSamples", icube->getSampleCount()); - alpha += PvlKeyword("BetaLines", icube->getLineCount()); + alpha += PvlKeyword("AlphaSamples", toString(icube->getSampleCount())); + alpha += PvlKeyword("AlphaLines", toString(icube->getLineCount())); + alpha += PvlKeyword("AlphaStartingSample", toString(0.5)); + alpha += PvlKeyword("AlphaStartingLine", toString(0.5)); + alpha += PvlKeyword("AlphaEndingSample", toString(icube->getSampleCount() + 0.5)); + alpha += PvlKeyword("AlphaEndingLine", toString(icube->getLineCount() + 0.5)); + alpha += PvlKeyword("BetaSamples", toString(icube->getSampleCount())); + alpha += PvlKeyword("BetaLines", toString(icube->getLineCount())); ocube->putGroup(alpha); } @@ -378,7 +378,7 @@ void IsisMain() { startLine -= offset; } - if ((IString((string)instGrp["Framelets"])).UpCase() == "EVEN") { + if (((QString)instGrp["Framelets"]).toUpper() == "EVEN") { startLine += frameSize; } @@ -570,7 +570,7 @@ void LoadMapRes() { ui.PutAsString("PIXRES", "MPP"); } else { - string msg = "No resolution value found in [" + ui.GetFileName("MAP") + "]"; + QString msg = "No resolution value found in [" + ui.GetFileName("MAP") + "]"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -578,7 +578,7 @@ void LoadMapRes() { //Helper function to get camera resolution. void LoadCameraRes() { UserInterface &ui = Application::GetUserInterface(); - string file = ui.GetFileName("FROM"); + QString file = ui.GetFileName("FROM"); // Open the input cube, get the camera object, and the cam map projection Cube c; @@ -632,7 +632,7 @@ void LoadMapRange() { ui.PutAsString("DEFAULTRANGE", "MAP"); if(count < 4) { - string msg = "One or more of the values for the ground range was not found"; + QString msg = "One or more of the values for the ground range was not found"; msg += " in [" + ui.GetFileName("MAP") + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -641,7 +641,7 @@ void LoadMapRange() { //Helper function to load camera range. void LoadCameraRange() { UserInterface &ui = Application::GetUserInterface(); - string file = ui.GetFileName("FROM"); + QString file = ui.GetFileName("FROM"); // Get the map projection file provided by the user Pvl userMap; diff --git a/isis/src/base/apps/caminfo/CamTools.cpp b/isis/src/base/apps/caminfo/CamTools.cpp index 3eecd34f96..6e48ff9560 100644 --- a/isis/src/base/apps/caminfo/CamTools.cpp +++ b/isis/src/base/apps/caminfo/CamTools.cpp @@ -91,8 +91,8 @@ namespace Isis { * * @return string Converted value */ - template std::string ToString(const T &value) { - return (IString(value).Trim(" \r\t\n")); + template QString ToString(const T &value) { + return (toString(value).trimmed()); } @@ -345,16 +345,16 @@ namespace Isis { void BandGeometry::generateGeometryKeys(PvlObject &pband) { if(size() <= 0) { - std::string mess = "No Band geometry available!"; + QString mess = "No Band geometry available!"; throw IException(IException::Programmer, mess, _FILEINFO_); } GProperties g = getGeometrySummary(); //geometry keywords for band output - pband += PvlKeyword("BandsUsed", size()); - pband += PvlKeyword("ReferenceBand", g.band); - pband += PvlKeyword("OriginalBand", g.realBand); + pband += PvlKeyword("BandsUsed", toString(size())); + pband += PvlKeyword("ReferenceBand", toString(g.band)); + pband += PvlKeyword("OriginalBand", toString(g.realBand)); pband += PvlKeyword("Target", g.target); @@ -579,7 +579,7 @@ namespace Isis { } } - mapping += PvlKeyword("CenterLongitude", clon); + mapping += PvlKeyword("CenterLongitude", toString(clon)); Projection *sinu = ProjectionFactory::Create(sinuMap, true); geos::geom::MultiPolygon *sPoly = PolygonTools::LatLonToXY(*poly, sinu); @@ -605,7 +605,7 @@ namespace Isis { void BandGeometry::generatePolygonKeys(PvlObject &pband) { if(size() <= 0) { - std::string mess = "No Band geometry available!"; + QString mess = "No Band geometry available!"; throw IException(IException::Programmer, mess, _FILEINFO_); } @@ -626,19 +626,19 @@ namespace Isis { pband += ValidateKey("SurfaceArea", _summary.surfaceArea, "km^2"); pband += ValidateKey("GlobalCoverage", globalCoverage, "percent"); if(_combined != 0) { - pband += PvlKeyword("SampleIncrement", _sampleInc); - pband += PvlKeyword("LineIncrement", _lineInc); + pband += PvlKeyword("SampleIncrement", toString(_sampleInc)); + pband += PvlKeyword("LineIncrement", toString(_lineInc)); if(_combined->getGeometryTypeId() != geos::geom::GEOS_MULTIPOLYGON) { geos::geom::MultiPolygon *geom = makeMultiPolygon(_combined); - pband += PvlKeyword("GisFootprint", geom->toString()); + pband += PvlKeyword("GisFootprint", geom->toString().c_str()); delete geom; } else { - pband += PvlKeyword("GisFootprint", _combined->toString()); + pband += PvlKeyword("GisFootprint", _combined->toString().c_str()); } } else { - pband += PvlKeyword("GisFootprint", Null); + pband += PvlKeyword("GisFootprint", "Null"); } // Add the mapping group used to project polygon diff --git a/isis/src/base/apps/caminfo/CamTools.h b/isis/src/base/apps/caminfo/CamTools.h index 2f1cc95b93..2e96ecf924 100644 --- a/isis/src/base/apps/caminfo/CamTools.h +++ b/isis/src/base/apps/caminfo/CamTools.h @@ -49,14 +49,14 @@ namespace Isis { * * @return PvlKeyword Returns newly created keyword/value */ - inline PvlKeyword ValidateKey(const std::string keyname, + inline PvlKeyword ValidateKey(const QString keyname, const double &value, - const std::string &unit = "") { + const QString &unit = "") { if(IsSpecial(value)) { return (PvlKeyword(keyname, "NULL")); } else { - return (PvlKeyword(keyname, value, unit)); + return (PvlKeyword(keyname, toString(value), unit)); } } @@ -72,8 +72,8 @@ namespace Isis { * @return PvlKeyword Returns newly created keyword/value */ - inline PvlKeyword ValidateKey(const std::string keyname, PvlKeyword &key, - const std::string &unit = "") { + inline PvlKeyword ValidateKey(const QString keyname, PvlKeyword &key, + const QString &unit = "") { if(key.IsNull()) { return (PvlKeyword(keyname, "NULL")); } @@ -216,7 +216,7 @@ namespace Isis { int lines, samples, bands; int band, realBand; - std::string target; + QString target; double centerLine, centerSamp; double centerLatitude, centerLongitude; double radius; @@ -232,7 +232,7 @@ namespace Isis { double localSolartime, targetCenterDistance, slantDistance; double subSolarLatitude, subSolarLongitude; double subSpacecraftLatitude, subSpacecraftLongitude; - std::string startTime, endTime; + QString startTime, endTime; double parallaxx, parallaxy, shadowx, shadowy; double upperLeftLongitude, upperLeftLatitude; double lowerLeftLongitude, lowerLeftLatitude; diff --git a/isis/src/base/apps/caminfo/caminfo.cpp b/isis/src/base/apps/caminfo/caminfo.cpp index 55755bad72..6a2cf26c07 100644 --- a/isis/src/base/apps/caminfo/caminfo.cpp +++ b/isis/src/base/apps/caminfo/caminfo.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include #include "CameraStatistics.h" @@ -27,35 +27,35 @@ using namespace std; using namespace Isis; -QPair MakePair(IString key, IString val); +QPair MakePair(QString key, QString val); void GeneratePVLOutput(Cube *incube, - QList< QPair > *general, - QList< QPair > *camstats, - QList< QPair > *statistics, + QList< QPair > *general, + QList< QPair > *camstats, + QList< QPair > *statistics, BandGeometry *bandGeom); void GenerateCSVOutput(Cube *incube, - QList< QPair > *general, - QList< QPair > *camstats, - QList< QPair > *statistics, + QList< QPair > *general, + QList< QPair > *camstats, + QList< QPair > *statistics, BandGeometry *bandGeom); void IsisMain() { - const string caminfo_program = "caminfo"; + const QString caminfo_program = "caminfo"; UserInterface &ui = Application::GetUserInterface(); - QList< QPair > *general = NULL, *camstats = NULL, *statistics = NULL; + QList< QPair > *general = NULL, *camstats = NULL, *statistics = NULL; BandGeometry *bandGeom = NULL; // Get input filename FileName in = ui.GetFileName("FROM"); // Get the format - IString sFormat = ui.GetAsString("FORMAT"); + QString sFormat = ui.GetAsString("FORMAT"); // if true then run spiceinit, xml default is FALSE // spiceinit will use system kernels if(ui.GetBoolean("SPICE")) { - string parameters = "FROM=" + in.expanded(); + QString parameters = "FROM=" + in.expanded(); ProgramLauncher::RunIsisProgram("spiceinit", parameters); } @@ -63,23 +63,23 @@ void IsisMain() { Cube *incube = p.SetInputCube("FROM"); // General data gathering - general = new QList< QPair >; + general = new QList< QPair >; general->append(MakePair("Program", caminfo_program)); general->append(MakePair("IsisVersion", Application::Version())); general->append(MakePair("RunDate", iTime::CurrentGMT())); general->append(MakePair("IsisId", SerialNumber::Compose(*incube))); general->append(MakePair("From", in.baseName() + ".cub")); - general->append(MakePair("Lines", incube->getLineCount())); - general->append(MakePair("Samples", incube->getSampleCount())); - general->append(MakePair("Bands", incube->getBandCount())); + general->append(MakePair("Lines", toString(incube->getLineCount()))); + general->append(MakePair("Samples", toString(incube->getSampleCount()))); + general->append(MakePair("Bands", toString(incube->getBandCount()))); // Run camstats on the entire image (all bands) // another camstats will be run for each band and output // for each band. if(ui.GetBoolean("CAMSTATS")) { - camstats = new QList< QPair >; + camstats = new QList< QPair >; - string filename = ui.GetAsString("FROM"); + QString filename = ui.GetAsString("FROM"); int sinc = ui.GetInteger("SINC"); int linc = ui.GetInteger("LINC"); CameraStatistics stats(filename, sinc, linc); @@ -116,7 +116,7 @@ void IsisMain() { // Compute statistics for entire cube if(ui.GetBoolean("STATISTICS")) { - statistics = new QList< QPair >; + statistics = new QList< QPair >; LineManager iline(*incube); Statistics stats; @@ -140,16 +140,16 @@ void IsisMain() { double lrspercent = (stats.LrsPixels() / (nPixels)) * 100; // Statitics output for band - statistics->append(MakePair("MeanValue", stats.Average())); - statistics->append(MakePair("StandardDeviation", stats.StandardDeviation())); - statistics->append(MakePair("MinimumValue", stats.Minimum())); - statistics->append(MakePair("MaximumValue", stats.Maximum())); - statistics->append(MakePair("PercentHIS", hispercent)); - statistics->append(MakePair("PercentHRS", hrspercent)); - statistics->append(MakePair("PercentLIS", lispercent)); - statistics->append(MakePair("PercentLRS", lrspercent)); - statistics->append(MakePair("PercentNull", nullpercent)); - statistics->append(MakePair("TotalPixels", stats.TotalPixels())); + statistics->append(MakePair("MeanValue", toString(stats.Average()))); + statistics->append(MakePair("StandardDeviation", toString(stats.StandardDeviation()))); + statistics->append(MakePair("MinimumValue", toString(stats.Minimum()))); + statistics->append(MakePair("MaximumValue", toString(stats.Maximum()))); + statistics->append(MakePair("PercentHIS", toString(hispercent))); + statistics->append(MakePair("PercentHRS", toString(hrspercent))); + statistics->append(MakePair("PercentLIS", toString(lispercent))); + statistics->append(MakePair("PercentLRS", toString(lrspercent))); + statistics->append(MakePair("PercentNull", toString(nullpercent))); + statistics->append(MakePair("TotalPixels", toString(stats.TotalPixels()))); } bool doGeometry = ui.GetBoolean("GEOMETRY"); @@ -157,16 +157,16 @@ void IsisMain() { if(doGeometry || doPolygon) { Camera *cam = incube->getCamera(); - IString incType = ui.GetString("INCTYPE"); + QString incType = ui.GetString("INCTYPE"); int polySinc, polyLinc; - if(doPolygon && incType.UpCase() == "VERTICES") { + if(doPolygon && incType.toUpper() == "VERTICES") { ImagePolygon poly; poly.initCube(*incube); polySinc = polyLinc = (int)(0.5 + (((poly.validSampleDim() * 2) + (poly.validLineDim() * 2) - 3.0) / ui.GetInteger("NUMVERTICES"))); } - else if (incType.UpCase() == "LINCSINC"){ + else if (incType.toUpper() == "LINCSINC"){ if(ui.WasEntered("POLYSINC")) { polySinc = ui.GetInteger("POLYSINC"); } @@ -183,7 +183,7 @@ void IsisMain() { } } else { - string msg = "Invalid INCTYPE option[" + incType + "]"; + QString msg = "Invalid INCTYPE option[" + incType + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -198,12 +198,12 @@ void IsisMain() { // Check if the user requires valid image center geometry if(ui.GetBoolean("VCAMERA") && (!bandGeom->hasCenterGeometry())) { - string msg = "Image center does not project in camera model"; + QString msg = "Image center does not project in camera model"; throw IException(IException::Unknown, msg, _FILEINFO_); } } - if(sFormat.UpCase() == "PVL") + if(sFormat.toUpper() == "PVL") GeneratePVLOutput(incube, general, camstats, statistics, bandGeom); else GenerateCSVOutput(incube, general, camstats, statistics, bandGeom); @@ -230,8 +230,8 @@ void IsisMain() { /** * Convience method for gracefully staying in 80 characters */ -QPair MakePair(IString key, IString val) { - return QPair(key, val); +QPair MakePair(QString key, QString val) { + return QPair(key, val); } @@ -239,9 +239,9 @@ QPair MakePair(IString key, IString val) { * Get the output in PVL format */ void GeneratePVLOutput(Cube *incube, - QList< QPair > *general, - QList< QPair > *camstats, - QList< QPair > *statistics, + QList< QPair > *general, + QList< QPair > *camstats, + QList< QPair > *statistics, BandGeometry *bandGeom) { UserInterface &ui = Application::GetUserInterface(); @@ -256,7 +256,7 @@ void GeneratePVLOutput(Cube *incube, if(camstats) { PvlObject pcband("Camstats"); for(int i = 0; i < camstats->size(); i++) - pcband += ValidateKey((*camstats)[i].first, (*camstats)[i].second); + pcband += ValidateKey((*camstats)[i].first, toDouble((*camstats)[i].second)); params.AddObject(pcband); } @@ -280,7 +280,7 @@ void GeneratePVLOutput(Cube *incube, if(statistics) { PvlObject sgroup("Statistics"); for(int i = 0; i < statistics->size(); i++) - sgroup += ValidateKey((*statistics)[i].first, (*statistics)[i].second); + sgroup += ValidateKey((*statistics)[i].first, toDouble((*statistics)[i].second)); params.AddObject(sgroup); } @@ -301,7 +301,7 @@ void GeneratePVLOutput(Cube *incube, // Output the result Pvl pout; - string outFile = ui.GetFileName("TO"); + QString outFile = ui.GetFileName("TO"); pout.AddObject(params); if(ui.GetBoolean("APPEND")) @@ -316,25 +316,25 @@ void GeneratePVLOutput(Cube *incube, * CamStats, Stats, Geometry are info are recorded. */ void GenerateCSVOutput(Cube *incube, - QList< QPair > *general, - QList< QPair > *camstats, - QList< QPair > *statistics, + QList< QPair > *general, + QList< QPair > *camstats, + QList< QPair > *statistics, BandGeometry *bandGeom) { UserInterface &ui = Application::GetUserInterface(); // Create the vars for holding the info - IString keys; - IString values; - const IString delim = ","; + QString keys; + QString values; + const QString delim = ","; // Output the result fstream outFile; - string sOutFile = ui.GetAsString("TO"); + QString sOutFile = ui.GetAsString("TO"); bool appending = ui.GetBoolean("APPEND") && FileName(sOutFile).fileExists(); if(appending) - outFile.open(sOutFile.c_str(), std::ios::out | std::ios::app); + outFile.open(sOutFile.toAscii().data(), std::ios::out | std::ios::app); else - outFile.open(sOutFile.c_str(), std::ios::out); + outFile.open(sOutFile.toAscii().data(), std::ios::out); // Add some common/general things for(int i = 0; i < general->size(); i++) @@ -369,8 +369,8 @@ void GenerateCSVOutput(Cube *incube, } } - keys.TrimTail(delim); // Get rid of the extra delim char (",") - values.TrimTail(delim); // Get rid of the extra delim char (",") + keys.remove(QRegExp(delim + "$")); // Get rid of the extra delim char (",") + values.remove(QRegExp(delim + "$")); // Get rid of the extra delim char (",") outFile << keys << endl << values << endl; outFile.close(); } diff --git a/isis/src/base/apps/campt/campt.cpp b/isis/src/base/apps/campt/campt.cpp index 4076581ad5..8c431a8b7c 100644 --- a/isis/src/base/apps/campt/campt.cpp +++ b/isis/src/base/apps/campt/campt.cpp @@ -62,7 +62,7 @@ void IsisMain() { if(ui.WasEntered("TO")) { // Get user params from ui - string outFile = FileName(ui.GetFileName("TO")).expanded(); + QString outFile = FileName(ui.GetFileName("TO")).expanded(); bool exists = FileName(outFile).fileExists(); bool append = ui.GetBoolean("APPEND"); @@ -85,13 +85,13 @@ void IsisMain() { ofstream os; bool writeHeader = false; if(append) { - os.open(outFile.c_str(), ios::app); + os.open(outFile.toAscii().data(), ios::app); if(!exists) { writeHeader = true; } } else { - os.open(outFile.c_str(), ios::out); + os.open(outFile.toAscii().data(), ios::out); writeHeader = true; } @@ -115,12 +115,12 @@ void IsisMain() { for(int i = 0; i < (*point).Keywords(); i++) { if((*point)[i].Size() == 3) { - os << (string)(*point)[i][0] << "," - << (string)(*point)[i][1] << "," - << (string)(*point)[i][2]; + os << (QString)(*point)[i][0] << "," + << (QString)(*point)[i][1] << "," + << (QString)(*point)[i][2]; } else { - os << (string)(*point)[i]; + os << (QString)(*point)[i]; } if(i < (*point).Keywords() - 1) { diff --git a/isis/src/base/apps/camrange/camrange.cpp b/isis/src/base/apps/camrange/camrange.cpp index 6c4e3eca32..271137551d 100644 --- a/isis/src/base/apps/camrange/camrange.cpp +++ b/isis/src/base/apps/camrange/camrange.cpp @@ -29,16 +29,16 @@ void IsisMain() { PvlGroup target("Target"); target += PvlKeyword("From", ui.GetFileName("FROM")); target += PvlKeyword("TargetName", cam->target()->name()); - target += PvlKeyword("RadiusA", radii[0].meters(), "meters"); - target += PvlKeyword("RadiusB", radii[1].meters(), "meters"); - target += PvlKeyword("RadiusC", radii[2].meters(), "meters"); + target += PvlKeyword("RadiusA", toString(radii[0].meters()), "meters"); + target += PvlKeyword("RadiusB", toString(radii[1].meters()), "meters"); + target += PvlKeyword("RadiusC", toString(radii[2].meters()), "meters"); // Get resolution PvlGroup res("PixelResolution"); double lowres = cam->LowestImageResolution(); double hires = cam->HighestImageResolution(); - res += PvlKeyword("Lowest", lowres, "meters"); - res += PvlKeyword("Highest", hires, "meters"); + res += PvlKeyword("Lowest", toString(lowres), "meters"); + res += PvlKeyword("Highest", toString(hires), "meters"); // Get the universal ground range PvlGroup ugr("UniversalGroundRange"); @@ -46,11 +46,11 @@ void IsisMain() { cam->GroundRange(minlat, maxlat, minlon, maxlon, mapping); ugr += PvlKeyword("LatitudeType", "Planetocentric"); ugr += PvlKeyword("LongitudeDirection", "PositiveEast"); - ugr += PvlKeyword("LongitudeDomain", 360); - ugr += PvlKeyword("MinimumLatitude", minlat); - ugr += PvlKeyword("MaximumLatitude", maxlat); - ugr += PvlKeyword("MinimumLongitude", minlon); - ugr += PvlKeyword("MaximumLongitude", maxlon); + ugr += PvlKeyword("LongitudeDomain", "360"); + ugr += PvlKeyword("MinimumLatitude", toString(minlat)); + ugr += PvlKeyword("MaximumLatitude", toString(maxlat)); + ugr += PvlKeyword("MinimumLongitude", toString(minlon)); + ugr += PvlKeyword("MaximumLongitude", toString(maxlon)); // Get the ographic latitude range mapgrp.AddKeyword(PvlKeyword("LatitudeType", "Planetographic"), @@ -58,8 +58,8 @@ void IsisMain() { cam->GroundRange(minlat, maxlat, minlon, maxlon, mapping); PvlGroup ogr("LatitudeRange"); ogr += PvlKeyword("LatitudeType", "Planetographic"); - ogr += PvlKeyword("MinimumLatitude", minlat); - ogr += PvlKeyword("MaximumLatitude", maxlat); + ogr += PvlKeyword("MinimumLatitude", toString(minlat)); + ogr += PvlKeyword("MaximumLatitude", toString(maxlat)); // Get positive west longitude coordinates in 360 domain mapgrp.AddKeyword(PvlKeyword("LongitudeDirection", "PositiveWest"), @@ -67,9 +67,9 @@ void IsisMain() { cam->GroundRange(minlat, maxlat, minlon, maxlon, mapping); PvlGroup pos360("PositiveWest360"); pos360 += PvlKeyword("LongitudeDirection", "PositiveWest"); - pos360 += PvlKeyword("LongitudeDomain", 360); - pos360 += PvlKeyword("MinimumLongitude", minlon); - pos360 += PvlKeyword("MaximumLongitude", maxlon); + pos360 += PvlKeyword("LongitudeDomain", "360"); + pos360 += PvlKeyword("MinimumLongitude", toString(minlon)); + pos360 += PvlKeyword("MaximumLongitude", toString(maxlon)); // Get positive east longitude coordinates in 180 domain mapgrp.AddKeyword(PvlKeyword("LongitudeDirection", "PositiveEast"), @@ -79,9 +79,9 @@ void IsisMain() { cam->GroundRange(minlat, maxlat, minlon, maxlon, mapping); PvlGroup pos180("PositiveEast180"); pos180 += PvlKeyword("LongitudeDirection", "PositiveEast"); - pos180 += PvlKeyword("LongitudeDomain", 180); - pos180 += PvlKeyword("MinimumLongitude", minlon); - pos180 += PvlKeyword("MaximumLongitude", maxlon); + pos180 += PvlKeyword("LongitudeDomain", "180"); + pos180 += PvlKeyword("MinimumLongitude", toString(minlon)); + pos180 += PvlKeyword("MaximumLongitude", toString(maxlon)); // Get positive west longitude coordinates in 180 domain mapgrp.AddKeyword(PvlKeyword("LongitudeDirection", "PositiveWest"), @@ -89,9 +89,9 @@ void IsisMain() { cam->GroundRange(minlat, maxlat, minlon, maxlon, mapping); PvlGroup neg180("PositiveWest180"); neg180 += PvlKeyword("LongitudeDirection", "PositiveWest"); - neg180 += PvlKeyword("LongitudeDomain", 180); - neg180 += PvlKeyword("MinimumLongitude", minlon); - neg180 += PvlKeyword("MaximumLongitude", maxlon); + neg180 += PvlKeyword("LongitudeDomain", "180"); + neg180 += PvlKeyword("MinimumLongitude", toString(minlon)); + neg180 += PvlKeyword("MaximumLongitude", toString(maxlon)); // Write it to the log Application::Log(target); diff --git a/isis/src/base/apps/camstats/camstats.cpp b/isis/src/base/apps/camstats/camstats.cpp index 794e4d412a..632c325d1d 100644 --- a/isis/src/base/apps/camstats/camstats.cpp +++ b/isis/src/base/apps/camstats/camstats.cpp @@ -27,7 +27,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); - string from = ui.GetFileName("FROM"); + QString from = ui.GetFileName("FROM"); int sinc = ui.GetInteger("SINC"); int linc = ui.GetInteger("LINC"); CameraStatistics camStats(cam, sinc, linc, from); @@ -39,7 +39,7 @@ void IsisMain() { } if(ui.WasEntered("TO")) { - string outfile = FileName(ui.GetFileName("TO")).expanded(); + QString outfile = FileName(ui.GetFileName("TO")).expanded(); bool exists = FileName(outfile).fileExists(); bool append = ui.GetBoolean("APPEND"); @@ -53,13 +53,13 @@ void IsisMain() { ofstream os; bool writeHeader = true; if(append) { - os.open(outfile.c_str(), ios::app); + os.open(outfile.toAscii().data(), ios::app); if(exists) { writeHeader = false; } } else { - os.open(outfile.c_str(), ios::out); + os.open(outfile.toAscii().data(), ios::out); } // if new file or append and no file exists then write header @@ -134,7 +134,7 @@ void IsisMain() { if(ui.GetBoolean("ATTACH")) { - string cam_name = "CameraStatistics"; + QString cam_name = "CameraStatistics"; //Creates new CameraStatistics Table TableField fname("Name", Isis::TableField::Text, 20); @@ -161,7 +161,7 @@ void IsisMain() { record[entry] = group.Name(); entry++; for (int j = 0; j < group.Keywords(); j++) { - record[entry] = (double) group[j][0]; + record[entry] = toDouble(group[j][0]); entry++; } table += record; diff --git a/isis/src/base/apps/cathist/cathist.cpp b/isis/src/base/apps/cathist/cathist.cpp index 887f5c150c..0bad55d62a 100644 --- a/isis/src/base/apps/cathist/cathist.cpp +++ b/isis/src/base/apps/cathist/cathist.cpp @@ -16,7 +16,7 @@ void IsisMain() { // Get user entered file name & mode UserInterface &ui = Application::GetUserInterface(); FileName fromfile(ui.GetFileName("FROM")); - string mode = ui.GetString("MODE"); + QString mode = ui.GetString("MODE"); FileName tofile; bool append = false; @@ -59,16 +59,16 @@ void IsisMain() { } } for(int i = 0; i < pvl.Objects(); ++i) { - string all = pvl.Object(i).Name() + " "; + QString all = pvl.Object(i).Name() + " "; PvlGroup user = pvl.Object(i).FindGroup("UserParameters"); for(int j = 0; j < user.Keywords(); ++j) { ostringstream os; os << user[j]; - string temp = os.str(); - int index = temp.find("="); - IString temp1(temp.substr(0, index - 1)); - string temp2 = temp.substr(index + 2); - all += temp1.DownCase() + "=" + temp2 + " "; + QString temp = os.str().c_str(); + int index = temp.indexOf("="); + QString temp1(temp.mid(0, index - 1)); + QString temp2 = temp.mid(index + 2); + all += temp1.toLower() + "=" + temp2 + " "; } if(ui.IsInteractive()) { Application::GuiLog(all); diff --git a/isis/src/base/apps/catlab/catlab.cpp b/isis/src/base/apps/catlab/catlab.cpp index f77771e3ad..76471331d8 100644 --- a/isis/src/base/apps/catlab/catlab.cpp +++ b/isis/src/base/apps/catlab/catlab.cpp @@ -14,7 +14,7 @@ void IsisMain() { // Get filename provided by the user UserInterface &ui = Application::GetUserInterface(); - string file = ui.GetFileName("FROM"); + QString file = ui.GetFileName("FROM"); // Extract label from file Pvl label(file); diff --git a/isis/src/base/apps/catoriglab/catoriglab.cpp b/isis/src/base/apps/catoriglab/catoriglab.cpp index c3be8bc376..5461860292 100644 --- a/isis/src/base/apps/catoriglab/catoriglab.cpp +++ b/isis/src/base/apps/catoriglab/catoriglab.cpp @@ -9,7 +9,7 @@ void IsisMain() { // Get user entered file name & mode UserInterface &ui = Application::GetUserInterface(); - string file = ui.GetFileName("FROM"); + QString file = ui.GetFileName("FROM"); // Extract history from file OriginalLabel origLab(file); diff --git a/isis/src/base/apps/ckwriter/CkKernelWriter.cpp b/isis/src/base/apps/ckwriter/CkKernelWriter.cpp index 9db3189d96..318fece2aa 100644 --- a/isis/src/base/apps/ckwriter/CkKernelWriter.cpp +++ b/isis/src/base/apps/ckwriter/CkKernelWriter.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "CkKernelWriter.h" #include "SpiceSegment.h" #include "FileName.h" @@ -46,7 +48,7 @@ namespace Isis { init(); } - CkKernelWriter::CkKernelWriter(const std::string &kfile, const int &csize, + CkKernelWriter::CkKernelWriter(const QString &kfile, const int &csize, const int &cktype) { init(); setCommentSize(csize); @@ -72,13 +74,13 @@ namespace Isis { return; } - bool CkKernelWriter::addComment(const std::string &comment) { + bool CkKernelWriter::addComment(const QString &comment) { return (writeComment(comment)); } - bool CkKernelWriter::addCommentFile(const std::string &comfile) { + bool CkKernelWriter::addCommentFile(const QString &comfile) { TextFile t(comfile); - string comment; + QString comment; bool lastWrite(true); while ( t.GetLine(comment, false) ) { if ( comment.size() == 0 ) comment.push_back('\n'); @@ -87,15 +89,15 @@ namespace Isis { return (lastWrite); } - void CkKernelWriter::open(const std::string &kfile, - const std::string &intCkName) { + void CkKernelWriter::open(const QString &kfile, + const QString &intCkName) { FileName kf(kfile); if ( kf.fileExists() ) { - string full_kf = kf.expanded(); - remove(full_kf.c_str()); + QString full_kf = kf.expanded(); + QFile::remove(full_kf); } SpiceInt myHandle; - ckopn_c(kf.expanded().c_str(), intCkName.c_str(), _comSize, &myHandle); + ckopn_c(kf.expanded().toAscii().data(), intCkName.toAscii().data(), _comSize, &myHandle); _handle = myHandle; return; } @@ -121,7 +123,7 @@ namespace Isis { } /** Writes a comment to an opened NAIF kernel file */ - bool CkKernelWriter::writeComment(const std::string &comment) const { + bool CkKernelWriter::writeComment(const QString &comment) const { if ( _handle == 0 ) { string mess = "Comments cannot be written as the file is not open"; throw IException(IException::Programmer, mess, _FILEINFO_); @@ -130,12 +132,12 @@ namespace Isis { // Trap errors so they are not fatal if the comment section fills up. // Calling environments can decide how to handle it. try { - string commOut; + QString commOut; NaifStatus::CheckErrors(); - for ( unsigned int i = 0 ; i < comment.size() ; i++ ) { + for ( int i = 0 ; i < comment.size() ; i++ ) { if ( comment[i] == '\n' ) { while ( commOut.size() < 2 ) { commOut.append(" "); } - dafac_c(_handle, 1, commOut.size(), commOut.c_str()); + dafac_c(_handle, 1, commOut.size(), commOut.toAscii().data()); _comCharsWritten += commOut.size(); NaifStatus::CheckErrors(); commOut.clear(); @@ -148,7 +150,7 @@ namespace Isis { // See if there is residual to write if ( commOut.size() > 0 ) { while ( commOut.size() < 2 ) { commOut.append(" "); } - dafac_c(_handle, 1, commOut.size(), commOut.c_str()); + dafac_c(_handle, 1, commOut.size(), commOut.toAscii().data()); _comCharsWritten += commOut.size(); NaifStatus::CheckErrors(); } @@ -178,14 +180,14 @@ namespace Isis { avvs = segment.AngularVelocities()[0]; hasAvvs = SPICETRUE; } - string refFrame = segment.ReferenceFrame(); - string segId = segment.Id(); + QString refFrame = segment.ReferenceFrame(); + QString segId = segment.Id(); int nrecs = segment.size(); NaifStatus::CheckErrors(); ckw01_c(_handle, sclks[0], sclks[nrecs-1], segment.InstCode(), - refFrame.c_str(), hasAvvs, segId.c_str(), nrecs, &sclks[0], + refFrame.toAscii().data(), hasAvvs, segId.toAscii().data(), nrecs, &sclks[0], quats[0], avvs); NaifStatus::CheckErrors(); return; @@ -194,7 +196,7 @@ namespace Isis { void CkKernelWriter::writeCk2(const SpiceSegment &segment) const { if ( !segment.hasAngularVelocities() ) { - string mess = "Type 2 CK kernels require angular velocities"; + QString mess = "Type 2 CK kernels require angular velocities"; throw IException(IException::User, mess, _FILEINFO_); } @@ -202,8 +204,8 @@ namespace Isis { const SpiceSegment::SMatrix &quats = segment.Quaternions(); const SpiceSegment::SMatrix &avvs = segment.AngularVelocities(); - string refFrame = segment.ReferenceFrame(); - string segId = segment.Id(); + QString refFrame = segment.ReferenceFrame(); + QString segId = segment.Id(); int nrecs = segment.size(); @@ -215,7 +217,7 @@ namespace Isis { SpiceSegment::SVector rates(nrecs, segment.TickRate()); NaifStatus::CheckErrors(); ckw02_c(_handle, sclks[0], sclks[nrecs-1], segment.InstCode(), - refFrame.c_str(), segId.c_str(), nrecs, &sclks[0], + refFrame.toAscii().data(), segId.toAscii().data(), nrecs, &sclks[0], &stops[0], quats[0], avvs[0], &rates[0]); NaifStatus::CheckErrors(); return; @@ -232,15 +234,15 @@ namespace Isis { avvs = segment.AngularVelocities()[0]; hasAvvs = SPICETRUE; } - string refFrame = segment.ReferenceFrame(); - string segId = segment.Id(); + QString refFrame = segment.ReferenceFrame(); + QString segId = segment.Id(); int nrecs = segment.size(); segment.FurnshKernelType("FK"); NaifStatus::CheckErrors(); ckw03_c(_handle, sclks[0], sclks[nrecs-1], segment.InstCode(), - refFrame.c_str(), hasAvvs, segId.c_str(), nrecs, &sclks[0], + refFrame.toAscii().data(), hasAvvs, segId.toAscii().data(), nrecs, &sclks[0], quats[0], avvs, 1, &sclks[0]); segment.UnloadKernelType("FK"); diff --git a/isis/src/base/apps/ckwriter/CkKernelWriter.h b/isis/src/base/apps/ckwriter/CkKernelWriter.h index 0b0487f24f..da381365f6 100644 --- a/isis/src/base/apps/ckwriter/CkKernelWriter.h +++ b/isis/src/base/apps/ckwriter/CkKernelWriter.h @@ -1,4 +1,4 @@ -#if !defined(CkKernelWriter_h) +#ifndef CkKernelWriter_h #define CkKernelWriter_h /** * @file @@ -24,7 +24,7 @@ * * $Id$ */ -#include +#include namespace Isis { @@ -59,7 +59,7 @@ class SpiceSegment; class CkKernelWriter { public: CkKernelWriter(); - CkKernelWriter(const std::string &kfile, const int &csize = 0, + CkKernelWriter(const QString &kfile, const int &csize = 0, const int &cktype = 3); virtual ~CkKernelWriter() { close(); } @@ -69,11 +69,11 @@ class CkKernelWriter { int getCommentSize() const { return (_comSize); } int getCommentWrittenCount() const { return (_comCharsWritten); } - bool addComment(const std::string &comment); - bool addCommentFile(const std::string &comfile); + bool addComment(const QString &comment); + bool addCommentFile(const QString &comfile); - void open(const std::string &kfile, - const std::string &intCkName = "USGS_CK_File"); + void open(const QString &kfile, + const QString &intCkName = "USGS_CK_File"); void write(const SpiceSegment &segment) const; void close(); @@ -86,7 +86,7 @@ class CkKernelWriter { mutable unsigned int _comCharsWritten; void init(); - bool writeComment(const std::string &comment) const; + bool writeComment(const QString &comment) const; void writeCk1(const SpiceSegment &segment) const; void writeCk2(const SpiceSegment &segment) const; void writeCk3(const SpiceSegment &segment) const; diff --git a/isis/src/base/apps/ckwriter/SpiceKernel.cpp b/isis/src/base/apps/ckwriter/SpiceKernel.cpp index 44b1e51c8d..404b4e39d2 100644 --- a/isis/src/base/apps/ckwriter/SpiceKernel.cpp +++ b/isis/src/base/apps/ckwriter/SpiceKernel.cpp @@ -21,7 +21,7 @@ * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ -#include +#include #include #include #include @@ -50,7 +50,7 @@ namespace Isis { init(); } -void SpiceKernel::add(const std::string &cfile) { +void SpiceKernel::add(const QString &cfile) { Cube cube; cube.open(cfile); add(cube); @@ -70,7 +70,7 @@ bool CheckSegment(const SpiceSegment *s1, const SpiceSegment *s2) { return (s1->startTime() < s2->startTime()); } -std::string SpiceKernel::getSummary(const std::string &commfile) const { +QString SpiceKernel::getSummary(const QString &commfile) const { vector seglist; for ( int i = 0 ; i < size() ; i++) { seglist.push_back(&_segments[i]); @@ -79,7 +79,7 @@ std::string SpiceKernel::getSummary(const std::string &commfile) const { // Sorts the Segment pointers stable_sort(seglist.begin(), seglist.end(), CheckSegment); - string comment = getCkComment(commfile); + QString comment = getCkComment(commfile); // Collect comments from each segment for ( unsigned int i = 0 ; i < seglist.size() ; i++ ) { @@ -88,7 +88,7 @@ std::string SpiceKernel::getSummary(const std::string &commfile) const { return (comment); } - void SpiceKernel::write(const std::string &kname, const std::string &comfile, + void SpiceKernel::write(const QString &kname, const QString &comfile, const int cktype) const { vector seglist; int comChars(0); @@ -99,7 +99,7 @@ std::string SpiceKernel::getSummary(const std::string &commfile) const { stable_sort(seglist.begin(), seglist.end(), CheckSegment); - string comment = getCkComment(comfile); + QString comment = getCkComment(comfile); comChars += comment.size(); // Create the output file. @@ -136,11 +136,11 @@ std::string SpiceKernel::getSummary(const std::string &commfile) const { return; } - std::string SpiceKernel::getCkComment(const std::string &comFile) const { + QString SpiceKernel::getCkComment(const QString &comFile) const { ostringstream comment; - if ( !comFile.empty() ) { + if ( !comFile.isEmpty() ) { TextFile txt(comFile); - string cline; + QString cline; while ( txt.GetLineNoFilter(cline )) { comment << cline << "\n"; } @@ -222,7 +222,7 @@ Segment (by file) Summary\n\ \n"; } - return (string(comment.str())); + return (QString(comment.str().c_str())); } }; // namespace Isis diff --git a/isis/src/base/apps/ckwriter/SpiceKernel.h b/isis/src/base/apps/ckwriter/SpiceKernel.h index 5f837c6abd..ffed6b6113 100644 --- a/isis/src/base/apps/ckwriter/SpiceKernel.h +++ b/isis/src/base/apps/ckwriter/SpiceKernel.h @@ -1,4 +1,4 @@ -#if !defined(SpiceKernel_h) +#ifndef SpiceKernel_h #define SpiceKernel_h /** * @file @@ -74,12 +74,12 @@ class SpiceKernel { int size() const { return (_segments.size()); } const SpiceSegment &operator[](const int i) const; - void add(const std::string &fname); + void add(const QString &fname); void add(Cube &cube); - std::string getSummary(const std::string &commfile = "") const; + QString getSummary(const QString &commfile = "") const; - void write(const std::string &kname, const std::string &commfile = "", + void write(const QString &kname, const QString &commfile = "", const int ckType = 3) const; private: @@ -87,7 +87,7 @@ class SpiceKernel { Segments _segments; void init(); - std::string getCkComment(const std::string &comFile = "") const; + QString getCkComment(const QString &comFile = "") const; }; }; // namespace Isis diff --git a/isis/src/base/apps/ckwriter/SpiceSegment.cpp b/isis/src/base/apps/ckwriter/SpiceSegment.cpp index 7b0eed1a7f..d6f500be7f 100644 --- a/isis/src/base/apps/ckwriter/SpiceSegment.cpp +++ b/isis/src/base/apps/ckwriter/SpiceSegment.cpp @@ -21,7 +21,7 @@ * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ -#include +#include #include #include #include @@ -54,7 +54,7 @@ SpiceSegment::SpiceSegment() { } /** Construct with an ISIS cube file */ -SpiceSegment::SpiceSegment(const std::string &fname) { +SpiceSegment::SpiceSegment(const QString &fname) { init(); Cube cube; cube.open(fname); @@ -62,13 +62,13 @@ SpiceSegment::SpiceSegment(const std::string &fname) { } /** Construct with a Cube and optional naming of table */ -SpiceSegment::SpiceSegment(Cube &cube, const std::string &tblname) { +SpiceSegment::SpiceSegment(Cube &cube, const QString &tblname) { init(); import(cube, tblname); } /** Set the name of the CK SPICE segment */ -void SpiceSegment::setId(const std::string &name) { +void SpiceSegment::setId(const QString &name) { _name = name; return; } @@ -84,7 +84,7 @@ void SpiceSegment::setId(const std::string &name) { * * @return int Returns number of kernels loaded */ -int SpiceSegment::FurnshKernelType(const std::string &ktypes) const { +int SpiceSegment::FurnshKernelType(const QString &ktypes) const { return (_kernels.Load(ktypes)); } @@ -100,7 +100,7 @@ int SpiceSegment::FurnshKernelType(const std::string &ktypes) const { * * @return int Returns number of kernels unloaded */ -int SpiceSegment::UnloadKernelType(const std::string &ktypes) const { +int SpiceSegment::UnloadKernelType(const QString &ktypes) const { return (_kernels.UnLoad(ktypes)); } @@ -151,16 +151,16 @@ SpiceSegment::SVector SpiceSegment::TickRate() const { return (SVector(1, _tickRate)); } -std::string SpiceSegment::getKeyValue(PvlObject &label, - const std::string &keyword) { - string value(""); +QString SpiceSegment::getKeyValue(PvlObject &label, + const QString &keyword) { + QString value(""); if ( label.HasKeyword(keyword,Pvl::Traverse) ) { value = label.FindKeyword(keyword,Pvl::Traverse)[0]; } return (value); } -void SpiceSegment::import(Cube &cube, const std::string &tblname) { +void SpiceSegment::import(Cube &cube, const QString &tblname) { _fname = cube.getFileName(); @@ -193,18 +193,18 @@ void SpiceSegment::import(Cube &cube, const std::string &tblname) { } // Determine segment ID from product ID if it exists, otherwise basename - if ( _name.empty() ) { + if ( _name.isEmpty() ) { _name = getKeyValue(*label, "ProductId"); - if (_name.empty() ) { + if (_name.isEmpty() ) { _name = FileName(_fname).baseName(); } } - string value(""); + QString value(""); value = getKeyValue(*label, "InstrumentId"); - if (!value.empty()) { _instId = value; } + if (!value.isEmpty()) { _instId = value; } value = getKeyValue(*label, "TargetName"); - if (!value.empty()) { _target = value; } + if (!value.isEmpty()) { _target = value; } _camVersion = _kernels.CameraVersion(); // Get the SPICE data @@ -315,7 +315,7 @@ bool SpiceSegment::getTimeDependentFrameIds(Table &table, int &toId, int &fromId if ( table.Label().HasKeyword("TimeDependentFrames") ) { PvlKeyword labelTimeFrames = table.Label()["TimeDependentFrames"]; for (int i=0; i 0) ? "YES" : "NO"; + QString hasAV = (size(_avvs) > 0) ? "YES" : "NO"; comment << " HasAV: " << hasAV << endl; comment << " CamVersion: " << _camVersion << endl; - std::vector klist = _kernels.getKernelList(); + QStringList klist = _kernels.getKernelList(); if ( klist.size() > 0 ) { comment << " Kernels: \n"; - for ( unsigned int i = 0 ; i < klist.size() ; i++ ) { + for ( int i = 0 ; i < klist.size() ; i++ ) { comment << " " << klist[i] << endl; } } - return (string(comment.str())); + return (QString(comment.str().c_str())); } void SpiceSegment::init() { @@ -733,11 +733,11 @@ double SpiceSegment::ETtoSCLK(SpiceInt scCode, double et) const { return (sclk); } -std::string SpiceSegment::toUTC(const double &et) const { +QString SpiceSegment::toUTC(const double &et) const { const int UTCLEN = 80; char utcout[UTCLEN]; et2utc_c(et, "ISOC", 3, UTCLEN, utcout); - return (string(utcout)); + return (QString(utcout)); } }; // namespace Isis diff --git a/isis/src/base/apps/ckwriter/SpiceSegment.h b/isis/src/base/apps/ckwriter/SpiceSegment.h index 98ae30a1d6..5f2128c0c3 100644 --- a/isis/src/base/apps/ckwriter/SpiceSegment.h +++ b/isis/src/base/apps/ckwriter/SpiceSegment.h @@ -1,4 +1,4 @@ -#if !defined(SpiceSegment_h) +#ifndef SpiceSegment_h #define SpiceSegment_h /** * @file @@ -31,11 +31,13 @@ #include #include -#include "naif/SpiceZdf.h" -#include "tnt/tnt_array1d.h" -#include "tnt/tnt_array1d_utils.h" -#include "tnt/tnt_array2d.h" -#include "tnt/tnt_array2d_utils.h" +#include + +#include +#include +#include +#include +#include #include "Kernels.h" #include "IString.h" @@ -84,16 +86,16 @@ class SpiceSegment { typedef TNT::Array2D SMatrix; //!< 2-D buffer SpiceSegment(); - SpiceSegment(const std::string &fname); - SpiceSegment(Cube &cube, const std::string &tblname = "SpiceSegment"); + SpiceSegment(const QString &fname); + SpiceSegment(Cube &cube, const QString &tblname = "SpiceSegment"); virtual ~SpiceSegment() { } /** Returns the number of elements in the quaternions */ int size() const { return (size(_quats)); } /** Returns the name of the segment, typically the ProductId */ - std::string Id() const { return (_name); } - void setId(const std::string &id); + QString Id() const { return (_name); } + void setId(const QString &id); /** Start time of segment in ET */ double startTime() const { return (_startTime); } @@ -105,11 +107,11 @@ class SpiceSegment { } // Elements for writing NAIF SPICE kernels - int FurnshKernelType(const std::string &ktypes) const; - int UnloadKernelType(const std::string &ktypes = "") const; + int FurnshKernelType(const QString &ktypes) const; + int UnloadKernelType(const QString &ktypes = "") const; /** Returns CK segment reference frame */ - std::string ReferenceFrame() const { return (_refFrame); } + QString ReferenceFrame() const { return (_refFrame); } /** NAIF SPICE instrument code */ int InstCode() const { return (_instCode); } /** Returns instance of quaternions */ @@ -123,7 +125,7 @@ class SpiceSegment { const SVector &SCLKTimes() const { return (_times); } /** Returns a comment summarizing the segment */ - std::string getComment() const; + QString getComment() const; // Mostly type 2 needs but can be used for type 3 (start times anyway) virtual SVector SCLKStartIntervals() const; @@ -136,17 +138,17 @@ class SpiceSegment { // Mutable for full loading/unloading of kernels w/o restrictions mutable Kernels _kernels; int _camVersion; - std::string _name; - std::string _fname; + QString _name; + QString _fname; double _startTime; double _endTime; - std::string _utcStartTime; // Need to store these as conversion from ET - std::string _utcEndTime; // requires leap seconds kernel - std::string _instId; // Instrument ID - std::string _target; // Target name + QString _utcStartTime; // Need to store these as conversion from ET + QString _utcEndTime; // requires leap seconds kernel + QString _instId; // Instrument ID + QString _target; // Target name int _instCode; // NAIF instrument code of the SPICE segment - std::string _instFrame; // NAIF instrument frame - std::string _refFrame; // NAIF reference frame + QString _instFrame; // NAIF instrument frame + QString _refFrame; // NAIF reference frame SMatrix _quats; SMatrix _avvs; SVector _times; @@ -157,19 +159,19 @@ class SpiceSegment { void init(); template int size(const TNTSTORE &t) const { return (t.dim1()); } - std::string getKeyValue(PvlObject &label, const std::string &keyword); - void import(Cube &cube, const std::string &tblname = "SpiceSegment"); + QString getKeyValue(PvlObject &label, const QString &keyword); + void import(Cube &cube, const QString &tblname = "SpiceSegment"); SMatrix load(Table &cache); SMatrix getQuaternions(const SMatrix &spice) const; SMatrix getAngularVelocities(const SMatrix &spice) const; SVector getTimes(const SMatrix &spice) const; bool getTimeDependentFrameIds(Table &table, int &toId, int &fromId) const; - std::string getFrameName(int frameid) const; + QString getFrameName(int frameid) const; SMatrix getConstantRotation(Table &table) const; SMatrix getIdentityRotation(const int &nelements = 3) const; - SMatrix computeStateRotation(const std::string &frame1, - const std::string &frame2, + SMatrix computeStateRotation(const QString &frame1, + const QString &frame2, double etTime) const; void getRotationMatrices(Cube &cube, Camera &camera, Table &table, SMatSeq &lmats, SMatSeq &rmat, SVector &sclks); @@ -185,7 +187,7 @@ class SpiceSegment { double SCLKtoET(SpiceInt scCode, double sclk) const; double ETtoSCLK(SpiceInt scCode, double et) const; - std::string toUTC(const double &et) const; + QString toUTC(const double &et) const; }; diff --git a/isis/src/base/apps/ckwriter/ckwriter.cpp b/isis/src/base/apps/ckwriter/ckwriter.cpp index d78314801b..adde9bd483 100644 --- a/isis/src/base/apps/ckwriter/ckwriter.cpp +++ b/isis/src/base/apps/ckwriter/ckwriter.cpp @@ -20,7 +20,7 @@ void IsisMain() { if (ui.WasEntered("FROM")) flist.push_back(FileName(ui.GetFileName("FROM"))); if (ui.WasEntered("FROMLIST")) flist.read(FileName(ui.GetFileName("FROMLIST"))); if (flist.size() < 1) { - string msg = "Files must be specified in FROM and/or FROMLIST - none found!"; + QString msg = "Files must be specified in FROM and/or FROMLIST - none found!"; throw IException(IException::User,msg,_FILEINFO_); } @@ -36,7 +36,7 @@ void IsisMain() { } // Get comment file - string comfile(""); + QString comfile(""); if (ui.WasEntered("COMFILE")) comfile = ui.GetFileName("COMFILE"); // Write the output file if requested @@ -47,11 +47,11 @@ void IsisMain() { // Write a summary of the documentation if (ui.WasEntered("SUMMARY")) { - string fFile = FileName(ui.GetFileName("SUMMARY")).expanded(); + QString fFile = FileName(ui.GetFileName("SUMMARY")).expanded(); ofstream os; - os.open(fFile.c_str(),ios::out); + os.open(fFile.toAscii().data(),ios::out); if (!os) { - string mess = "Cannot create SUMMARY output file " + fFile; + QString mess = "Cannot create SUMMARY output file " + fFile; throw IException(IException::User, mess, _FILEINFO_); } os << kernel.getSummary(comfile); diff --git a/isis/src/base/apps/copylabel/copylabel.cpp b/isis/src/base/apps/copylabel/copylabel.cpp index d458797b05..d599a49b6b 100644 --- a/isis/src/base/apps/copylabel/copylabel.cpp +++ b/isis/src/base/apps/copylabel/copylabel.cpp @@ -15,8 +15,8 @@ using namespace std; using namespace Isis; -bool copyGroup(Pvl * source, Pvl * mergeTo, IString name); -bool copyBlob(Cube * from, Cube * to, IString type, IString name, IString fname); +bool copyGroup(Pvl * source, Pvl * mergeTo, QString name); +bool copyBlob(Cube * from, Cube * to, QString type, QString name, QString fname); void IsisMain() { UserInterface &ui = Application::GetUserInterface(); @@ -27,7 +27,7 @@ void IsisMain() { Pvl * mergeTo = NULL; Pvl * source = NULL; - IString sourceFileName = ui.GetFileName("Source"); + QString sourceFileName = ui.GetFileName("Source"); mergeTo = inOut.getLabel(); source = new Pvl(sourceFileName); @@ -121,7 +121,7 @@ void IsisMain() { results += PvlKeyword("Kernels", success ? "true" : "false"); if (isACube) { - IString fname = sourceFileName; + QString fname = sourceFileName; bool insPoint = copyBlob(&sourceCube, &inOut, "InstrumentPointing","Table", sourceFileName); bool insPos = copyBlob(&sourceCube, &inOut, "InstrumentPosition","Table", sourceFileName); bool bodyRot = copyBlob(&sourceCube, &inOut, "BodyRotation","Table", sourceFileName); @@ -182,13 +182,13 @@ void IsisMain() { // Any other requested groups if (ui.WasEntered("Groups")) { - QString grps = IString(ui.GetString("Groups")).Remove(" ").ToQt(); + QString grps = QString(ui.GetString("Groups")).remove(" "); QStringList list = grps.split(","); QString grp; foreach (grp, list) { if (grp.size() != 0) { - bool success = copyGroup(source, mergeTo, grp.toStdString()); - results += PvlKeyword(grp.toStdString(), success ? "true" : "false"); + bool success = copyGroup(source, mergeTo, grp); + results += PvlKeyword(grp, success ? "true" : "false"); } } } @@ -196,7 +196,7 @@ void IsisMain() { // Any other requested blobs // Expected format is: : if (ui.WasEntered("Blobs")) { - QString blobs = IString(ui.GetString("Blobs")).Remove(" ").ToQt(); + QString blobs = QString(ui.GetString("Blobs")).remove(" "); QStringList list = blobs.split(","); QString blob; foreach (blob, list) { @@ -207,12 +207,12 @@ void IsisMain() { " improperly formatted"; throw IException(IException::User, msg, _FILEINFO_); } - bool success = copyBlob(&sourceCube, &inOut, brk[1].toStdString(), - brk[0].toStdString(), sourceFileName); - results += PvlKeyword(blob.toStdString(), success ? "true" : "false"); + bool success = copyBlob(&sourceCube, &inOut, brk[1], + brk[0], sourceFileName); + results += PvlKeyword(blob, success ? "true" : "false"); } else { - results += PvlKeyword(blob.toStdString(), "false"); + results += PvlKeyword(blob, "false"); } } } @@ -231,7 +231,7 @@ void IsisMain() { bool found = false; for (int i = 0; i < mergeTo->Objects() && !found; i++) { if (mergeTo->Object(i).IsNamed("History")) { - History his((string)mergeTo->Object(i)["Name"]); + History his((QString)mergeTo->Object(i)["Name"]); inOut.read(his); his.AddEntry(); inOut.write(his); @@ -253,7 +253,7 @@ void IsisMain() { // Copy a group from the IsisCube object in one cube to the other // If it exists in the source, we'll copy it, if it exists in the // mergeTo Pvl, we'll overwrite it. -bool copyGroup(Pvl * source, Pvl * mergeTo, IString name) { +bool copyGroup(Pvl * source, Pvl * mergeTo, QString name) { try { // The call we're looking to get an exception on is the one just below. PvlGroup & toCopy = source->FindGroup(name, Pvl::Traverse); @@ -268,7 +268,7 @@ bool copyGroup(Pvl * source, Pvl * mergeTo, IString name) { } } -bool copyBlob(Cube * from, Cube * to, IString name, IString type, IString fname) { +bool copyBlob(Cube * from, Cube * to, QString name, QString type, QString fname) { try { Blob blob(name, type, fname); from->read(blob); diff --git a/isis/src/base/apps/crop/crop.cpp b/isis/src/base/apps/crop/crop.cpp index fceefec5e7..0990c87a4a 100644 --- a/isis/src/base/apps/crop/crop.cpp +++ b/isis/src/base/apps/crop/crop.cpp @@ -27,7 +27,7 @@ void IsisMain() { // Open the input cube UserInterface &ui = Application::GetUserInterface(); - string from = ui.GetAsString("FROM"); + QString from = ui.GetAsString("FROM"); CubeAttributeInput inAtt(from); cube.setVirtualBands(inAtt.bands()); from = ui.GetFileName("FROM"); @@ -52,27 +52,27 @@ void IsisMain() { // Make sure starting positions fall within the cube if(ss > cube.getSampleCount()) { cube.close(); - string msg = "[SAMPLE] exceeds number of samples in the [FROM] cube"; + QString msg = "[SAMPLE] exceeds number of samples in the [FROM] cube"; throw IException(IException::User, msg, _FILEINFO_); } if(sl > cube.getLineCount()) { cube.close(); - string msg = "[LINE] exceeds number of lines in the [FROM] cube"; + QString msg = "[LINE] exceeds number of lines in the [FROM] cube"; throw IException(IException::User, msg, _FILEINFO_); } // Make sure the number of elements do not fall outside the cube if(es > cube.getSampleCount()) { cube.close(); - string msg = "[SAMPLE+NSAMPLES-1] exceeds number of "; + QString msg = "[SAMPLE+NSAMPLES-1] exceeds number of "; msg += "samples in the [FROM] cube"; throw IException(IException::User, msg, _FILEINFO_); } if(el > cube.getLineCount()) { cube.close(); - string msg = "[LINE+NLINES-1] exceeds number of "; + QString msg = "[LINE+NLINES-1] exceeds number of "; msg += "lines in the [FROM] cube"; throw IException(IException::User, msg, _FILEINFO_); } @@ -150,7 +150,7 @@ void IsisMain() { if(!ui.GetBoolean("PROPSPICE") && outLabels.FindObject("IsisCube").HasGroup("Kernels")) { PvlGroup &kerns = outLabels.FindObject("IsisCube").FindGroup("Kernels"); - string tryKey = "NaifIkCode"; + QString tryKey = "NaifIkCode"; if(kerns.HasKeyword("NaifFrameCode")) { tryKey = "NaifFrameCode"; } @@ -173,16 +173,16 @@ void IsisMain() { // Construct a label with the results PvlGroup results("Results"); - results += PvlKeyword("InputLines", orignl); - results += PvlKeyword("InputSamples", origns); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", nl); - results += PvlKeyword("OutputSamples", ns); + results += PvlKeyword("InputLines", toString(orignl)); + results += PvlKeyword("InputSamples", toString(origns)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(nl)); + results += PvlKeyword("OutputSamples", toString(ns)); // Update the Mapping, Instrument, and AlphaCube groups in the output // cube label diff --git a/isis/src/base/apps/cropspecial/cropspecial.cpp b/isis/src/base/apps/cropspecial/cropspecial.cpp index 177b057b83..06f16a3110 100644 --- a/isis/src/base/apps/cropspecial/cropspecial.cpp +++ b/isis/src/base/apps/cropspecial/cropspecial.cpp @@ -30,7 +30,7 @@ void IsisMain() { // Open the input cube UserInterface &ui = Application::GetUserInterface(); - string from = ui.GetAsString("FROM"); + QString from = ui.GetAsString("FROM"); CubeAttributeInput inAtt(from); cube.setVirtualBands(inAtt.bands()); from = ui.GetFileName("FROM"); @@ -57,7 +57,7 @@ void IsisMain() { if(minSample == cube.getSampleCount() + 1) { cube.close(); - string msg = "There are no valid pixels in the [FROM] cube"; + QString msg = "There are no valid pixels in the [FROM] cube"; throw IException(IException::User, msg, _FILEINFO_); } @@ -89,14 +89,14 @@ void IsisMain() { // Construct a label with the results PvlGroup results("Results"); - results += PvlKeyword("InputLines", cube.getLineCount()); - results += PvlKeyword("InputSamples", cube.getSampleCount()); - results += PvlKeyword("StartingLine", minLine); - results += PvlKeyword("StartingSample", minSample); - results += PvlKeyword("EndingLine", maxLine); - results += PvlKeyword("EndingSample", maxSample); - results += PvlKeyword("OutputLines", numLines); - results += PvlKeyword("OutputSamples", numSamples); + results += PvlKeyword("InputLines", toString(cube.getLineCount())); + results += PvlKeyword("InputSamples", toString(cube.getSampleCount())); + results += PvlKeyword("StartingLine", toString(minLine)); + results += PvlKeyword("StartingSample", toString(minSample)); + results += PvlKeyword("EndingLine", toString(maxLine)); + results += PvlKeyword("EndingSample", toString(maxSample)); + results += PvlKeyword("OutputLines", toString(numLines)); + results += PvlKeyword("OutputSamples", toString(numSamples)); // Create a buffer for reading the input cube in = new LineManager(cube); diff --git a/isis/src/base/apps/cubeavg/cubeavg.cpp b/isis/src/base/apps/cubeavg/cubeavg.cpp index af200e1520..9dc25c0b1b 100644 --- a/isis/src/base/apps/cubeavg/cubeavg.cpp +++ b/isis/src/base/apps/cubeavg/cubeavg.cpp @@ -41,21 +41,21 @@ void IsisMain() { std::vector widths; widths.resize(icube->getBandCount()); for(int i = 0; i < pvlCenter.Size(); i++) { - centers[i] = pvlCenter[i]; + centers[i] = toDouble(pvlCenter[i]); if(hasWidth) - widths[i] = (*pvlWidth)[i]; + widths[i] = toDouble((*pvlWidth)[i]); else widths[i] = 0.0; } compute(centers, widths, ocube); } else { - string message = "The BandBin in your input cube does not have a Center value."; + QString message = "The BandBin in your input cube does not have a Center value."; throw IException(IException::User, message, _FILEINFO_); } } else { - string message = "There is not a BandBin Group in the input cube."; + QString message = "There is not a BandBin Group in the input cube."; throw IException(IException::User, message, _FILEINFO_); } } @@ -70,7 +70,7 @@ void IsisMain() { pvlg = ocube->getGroup("BandBin"); removekeywords(pvlg); } - string Units = ""; + QString Units = ""; PvlKeyword pvlCenter; if(pvlg.HasKeyword("Center")) { pvlCenter = pvlg.FindKeyword("Center"); @@ -134,7 +134,7 @@ void compute(vector centers, vector widths, Cube *ocube) { PvlGroup &pvlg = ocube->getGroup("BandBin"); PvlKeyword &pvlCenter = pvlg.FindKeyword("Center"); - string centerUnit = pvlCenter.Unit(); + QString centerUnit = pvlCenter.Unit(); bool hasWidth = pvlg.HasKeyword("Width"); double large = centers[0] + widths[0] / 2; double small = centers[0] - widths[0] / 2; @@ -146,14 +146,14 @@ void compute(vector centers, vector widths, small = (double)centers[i] - (double)widths[i] / 2.0; } } - pvlCenter.SetValue(IString((large - small) / 2 + small), centerUnit); + pvlCenter.SetValue(toString((large - small) / 2 + small), centerUnit); if(hasWidth) { PvlKeyword &pvlWidth = pvlg.FindKeyword("Width"); - pvlWidth.SetValue(large - small, pvlWidth.Unit()); + pvlWidth.SetValue(toString(large - small), pvlWidth.Unit()); } else { PvlKeyword pvlWidth = PvlKeyword("Width"); - pvlWidth.SetValue(large - small, centerUnit); + pvlWidth.SetValue(toString(large - small), centerUnit); pvlg.AddKeyword(pvlWidth); } diff --git a/isis/src/base/apps/cubediff/WriteTabular.cpp b/isis/src/base/apps/cubediff/WriteTabular.cpp index 7e70fe8c93..dd0173c9b4 100644 --- a/isis/src/base/apps/cubediff/WriteTabular.cpp +++ b/isis/src/base/apps/cubediff/WriteTabular.cpp @@ -31,6 +31,8 @@ #include "IException.h" #include "SpecialPixel.h" +using std::stringstream; + namespace Isis { /** @@ -64,16 +66,16 @@ namespace Isis { void WriteTabular::SetColumns(std::vector cols) { for(unsigned int index = 0; index < cols.size(); index++) { Column thisCol = cols[index]; - std::string thisTitle = thisCol.Name(); + QString thisTitle = thisCol.Name(); - if(thisTitle.length() > thisCol.Width()) { - std::string message = "Column header [" + thisTitle + "] is wider " + - "than the set width for column [" + IString((int)index) + "]"; + if((int)thisTitle.length() > (int)thisCol.Width()) { + QString message = "Column header [" + thisTitle + "] is wider " + + "than the set width for column [" + toString((int)index) + "]"; throw IException(IException::User, message, _FILEINFO_); } int iteration = 0; - while(thisTitle.length() < thisCol.Width()) { + while((int)thisTitle.length() < (int)thisCol.Width()) { if(thisCol.Alignment() == Column::Left) { thisTitle += " "; } @@ -82,7 +84,7 @@ namespace Isis { thisTitle = " " + thisTitle; } else { - std::string message = "Alignment is improperly set"; + QString message = "Alignment is improperly set"; throw IException(IException::User, message, _FILEINFO_); } iteration++; @@ -103,13 +105,13 @@ namespace Isis { void WriteTabular::Write() { Column thisCol = p_cols[p_curCol]; - std::string item = ""; + QString item = ""; - std::stringstream tempStream; + stringstream tempStream; tempStream.width(thisCol.Width()); tempStream.fill(' '); tempStream << item; - item = tempStream.str(); + item = tempStream.str().c_str(); if(p_curCol == 0) { p_rows++; @@ -140,17 +142,17 @@ namespace Isis { Write((double)item); return; } - std::string message = "Wrong data type for this Column"; + QString message = "Wrong data type for this Column"; throw IException(IException::User, message, _FILEINFO_); } - IString thisItem(item); - if(thisItem.length() > thisCol.Width()) { + QString thisItem(toString(item)); + if(thisItem.length() > (int)thisCol.Width()) { thisItem = "*"; - while(thisItem.length() < thisCol.Width()) { + while(thisItem.length() < (int)thisCol.Width()) { thisItem += "*"; } } - std::stringstream tempStream; + stringstream tempStream; tempStream.width(thisCol.Width()); tempStream.fill(' '); @@ -160,7 +162,7 @@ namespace Isis { else tempStream.setf(std::ios::right); tempStream << thisItem; - thisItem = tempStream.str(); + thisItem = tempStream.str().c_str(); if(p_curCol == 0) { p_rows++; @@ -174,7 +176,7 @@ namespace Isis { thisItem += "\n"; p_curCol = 0; } - p_outfile << thisItem.c_str(); + p_outfile << thisItem; } /** @@ -182,20 +184,22 @@ namespace Isis { * * @param item The string to write out */ - void WriteTabular::Write(std::string item) { + void WriteTabular::Write(const char *itemCStr) { Column thisCol = p_cols[p_curCol]; if(thisCol.DataType() != Column::String && thisCol.DataType() != Column::Pixel) { - std::string message = "Wrong data type for this Column"; + QString message = "Wrong data type for this Column"; throw IException(IException::User, message, _FILEINFO_); } - if(item.length() > thisCol.Width()) { + + QString item(itemCStr); + if(item.length() > (int)thisCol.Width()) { item = "*"; - while(item.length() < thisCol.Width()) { + while(item.length() < (int)thisCol.Width()) { item += "*"; } } - std::stringstream tempStream; + stringstream tempStream; tempStream.width(thisCol.Width()); tempStream.fill(' '); @@ -205,7 +209,7 @@ namespace Isis { else tempStream.setf(std::ios::right); tempStream << item; - item = tempStream.str(); + item = tempStream.str().c_str(); if(p_curCol == 0) { p_rows++; @@ -231,7 +235,7 @@ namespace Isis { Column thisCol = p_cols[p_curCol]; if(thisCol.DataType() != Column::Real && thisCol.DataType() != Column::Pixel) { - std::string message = "Wrong data type for this Column"; + QString message = "Wrong data type for this Column"; throw IException(IException::User, message, _FILEINFO_); } @@ -259,7 +263,7 @@ namespace Isis { } } - IString thisItem(item); + QString thisItem(toString(item)); if(thisCol.Alignment() == Column::Decimal) { @@ -267,40 +271,44 @@ namespace Isis { //Format and round the number //First, split the number at the decimal point - IString tempString = thisItem; - IString intPart = tempString.Token("."); + QStringList tempString = thisItem.split("."); + QString intPart = tempString.takeFirst(); + //Make the fractional portion appear as such, so the iomanipulators //handle it properly - if(tempString != "") { - tempString = "0." + tempString; + if(!tempString.isEmpty()) { + tempString.prepend("0"); + } + else { + tempString.append("0"); + tempString.append("0"); } - else tempString = "0.0"; //Put the fractional portion into a stringstream, and use //stream manipulators to round it properly - std::stringstream b; + stringstream b; b << std::showpoint << std::setprecision(thisCol.Precision()) - << tempString.ToDouble(); + << toDouble(tempString.join(".")); //if the rounding causes a rollover (i.e. the decimal portion is greater //than 0.95) increment the integer portion - if(IString(b.str()).ToDouble() >= 1) { - intPart = IString(intPart.ToInteger() + 1); + if(toDouble(QString(b.str().c_str())) >= 1) { + intPart = toString(toInt(intPart) + 1); } - //Put it back into an IString, for easier manipulation - tempString = b.str(); - tempString.Token("."); + //Put it back into an QString, for easier manipulation + QString tempString2 = b.str().c_str(); + tempString2.remove(QRegExp("[^.]*\\.")); //Add any zeros necessary to pad the number - while(tempString.size() < thisCol.Precision()) { - tempString += "0"; + while(tempString2.size() < (int)thisCol.Precision()) { + tempString2 += "0"; } //Put the number back together, adding the decimal point in the right location - thisItem = intPart + "." + tempString; + thisItem = intPart + "." + tempString2; } - std::stringstream tempStream; + stringstream tempStream; tempStream.width(thisCol.Width()); tempStream.fill(' '); @@ -310,16 +318,16 @@ namespace Isis { else tempStream.setf(std::ios::right); tempStream << thisItem; - thisItem = tempStream.str(); + thisItem = tempStream.str().c_str(); if(p_curCol == 0) { p_rows++; } //If the number is too wide for the column, replace with a string of stars - if(thisItem.length() > thisCol.Width()) { + if(thisItem.length() > (int)thisCol.Width()) { thisItem = "*"; - while(thisItem.length() < thisCol.Width()) { + while(thisItem.length() < (int)thisCol.Width()) { thisItem += "*"; } } @@ -341,7 +349,7 @@ namespace Isis { * * @param delim The string to separate columns */ - void WriteTabular::SetDelimiter(std::string delim) { + void WriteTabular::SetDelimiter(QString delim) { p_delimiter = delim; } diff --git a/isis/src/base/apps/cubediff/WriteTabular.h b/isis/src/base/apps/cubediff/WriteTabular.h index 5332d20288..b8db82aea4 100644 --- a/isis/src/base/apps/cubediff/WriteTabular.h +++ b/isis/src/base/apps/cubediff/WriteTabular.h @@ -1,4 +1,4 @@ -#if !defined(NewClass_h) +#ifndef NewClass_h #define NewClass_h /** * @file @@ -48,9 +48,9 @@ namespace Isis { void SetColumns(std::vector cols); void Write(); void Write(int item); - void Write(std::string item); + void Write(const char *item); void Write(double item); - void SetDelimiter(std::string delim); + void SetDelimiter(QString delim); int Columns() { return p_cols.size(); @@ -60,7 +60,7 @@ namespace Isis { }; private: - std::string p_delimiter; + QString p_delimiter; std::ostream &p_outfile; unsigned int p_rows; std::vector p_cols; diff --git a/isis/src/base/apps/cubediff/cubediff.cpp b/isis/src/base/apps/cubediff/cubediff.cpp index 6eaa982da6..17f5abdb22 100644 --- a/isis/src/base/apps/cubediff/cubediff.cpp +++ b/isis/src/base/apps/cubediff/cubediff.cpp @@ -85,32 +85,32 @@ void IsisMain() { } else { results += PvlKeyword("Compare", "Different"); - results += PvlKeyword("Sample", sample); - results += PvlKeyword("Line", line); - results += PvlKeyword("Band", band); + results += PvlKeyword("Sample", toString(sample)); + results += PvlKeyword("Line", toString(line)); + results += PvlKeyword("Band", toString(band)); if(stats.TotalPixels() < 1) { - results += PvlKeyword("AverageDifference", 0); - results += PvlKeyword("StandardDeviation", 0); - results += PvlKeyword("Variance", 0); - results += PvlKeyword("MinimumDifference", 0); - results += PvlKeyword("MaximumDifference", 0); + results += PvlKeyword("AverageDifference", "0"); + results += PvlKeyword("StandardDeviation", "0"); + results += PvlKeyword("Variance", "0"); + results += PvlKeyword("MinimumDifference", "0"); + results += PvlKeyword("MaximumDifference", "0"); } else { - results += PvlKeyword("AverageDifference", (double)stats.Average()); - results += PvlKeyword("StandardDeviation", (double)stats.StandardDeviation()); - results += PvlKeyword("Variance", (double)stats.Variance()); - results += PvlKeyword("MinimumDifference", (double)stats.Minimum()); - results += PvlKeyword("MaximumDifference", (double)stats.Maximum()); - results += PvlKeyword("MaxDifferenceSample", (int)gMaxDiffSample); - results += PvlKeyword("MaxDifferenceLine", (int)gMaxDiffLine); - results += PvlKeyword("MaxDifferenceBand", (int)gMaxDiffBand); + results += PvlKeyword("AverageDifference", toString(stats.Average())); + results += PvlKeyword("StandardDeviation", toString(stats.StandardDeviation())); + results += PvlKeyword("Variance", toString(stats.Variance())); + results += PvlKeyword("MinimumDifference", toString(stats.Minimum())); + results += PvlKeyword("MaximumDifference", toString(stats.Maximum())); + results += PvlKeyword("MaxDifferenceSample", toString(gMaxDiffSample)); + results += PvlKeyword("MaxDifferenceLine", toString(gMaxDiffLine)); + results += PvlKeyword("MaxDifferenceBand", toString(gMaxDiffBand)); } - results += PvlKeyword("ValidPixelDifferences", stats.TotalPixels()); - results += PvlKeyword("SpecialPixelDifferences", spCount); - results += PvlKeyword("SigFigAccuracy", (int)sigFigAccuracy); - results += PvlKeyword("SigFigMaxDifferenceSample", (int)sigFigSample); - results += PvlKeyword("SigFigMaxDifferenceLine", (int)sigFigLine); - results += PvlKeyword("SigFigMaxDifferenceBand", (int)sigFigBand); + results += PvlKeyword("ValidPixelDifferences", toString(stats.TotalPixels())); + results += PvlKeyword("SpecialPixelDifferences", toString(spCount)); + results += PvlKeyword("SigFigAccuracy", toString(sigFigAccuracy)); + results += PvlKeyword("SigFigMaxDifferenceSample", toString(sigFigSample)); + results += PvlKeyword("SigFigMaxDifferenceLine", toString(sigFigLine)); + results += PvlKeyword("SigFigMaxDifferenceBand", toString(sigFigBand)); } Application::Log(results); @@ -121,8 +121,8 @@ void IsisMain() { lab.Write(ui.GetFileName("TO", "txt")); } if(doTable) { - string filename = FileName(ui.GetFileName("TO", "txt")).expanded(); - ofstream ofile(filename.c_str(), ios_base::app); + QString filename = FileName(ui.GetFileName("TO", "txt")).expanded(); + ofstream ofile(filename.toAscii().data(), ios_base::app); diffTable(ofile, ui.GetInteger("PRECISION")); } @@ -278,7 +278,7 @@ void diffTable(ofstream &target, int precision) { for(unsigned int i = 0; i < samps.size(); i++) { Column currCol; //Prepare and add the first file's column - currCol.SetName(IString("File1_") + IString(samps[i])); + currCol.SetName(QString("File1_") + toString(samps[i])); if((unsigned int)(colWidth + precision + 1) < currCol.Name().length()) { currCol.SetWidth(currCol.Name().length() + 1); } @@ -290,7 +290,7 @@ void diffTable(ofstream &target, int precision) { cols.push_back(currCol); //Prepare and add the second file's column - currCol.SetName(IString("File2_") + IString(samps[i])); + currCol.SetName(QString("File2_") + toString(samps[i])); cols.push_back(currCol); } diff --git a/isis/src/base/apps/cubefunc/cubefunc.cpp b/isis/src/base/apps/cubefunc/cubefunc.cpp index e01915fc42..fffe7669d0 100644 --- a/isis/src/base/apps/cubefunc/cubefunc.cpp +++ b/isis/src/base/apps/cubefunc/cubefunc.cpp @@ -42,7 +42,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); // Which function is it to be? - string func = ui.GetString("FUNCTION"); + QString func = ui.GetString("FUNCTION"); if(func == "COS") Function = COS; if(func == "SIN") Function = SIN; if(func == "TAN") Function = TAN; @@ -73,9 +73,9 @@ void IsisMain() { if(bad != 0) { PvlGroup results("Results"); - string message = "Invalid input pixels converted to Isis NULL values"; + QString message = "Invalid input pixels converted to Isis NULL values"; results += PvlKeyword("Error", message); - results += PvlKeyword("Count", bad); + results += PvlKeyword("Count", toString(bad)); Application::Log(results); } p.EndProcess(); diff --git a/isis/src/base/apps/cubeit/cubeit.cpp b/isis/src/base/apps/cubeit/cubeit.cpp index b9bff72c8f..8fb836566f 100644 --- a/isis/src/base/apps/cubeit/cubeit.cpp +++ b/isis/src/base/apps/cubeit/cubeit.cpp @@ -16,8 +16,8 @@ void NullBand(Buffer &out); //helper button function in the code void helperButtonLog(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonLog"] = (void *) helperButtonLog; return helper; } @@ -35,7 +35,7 @@ void IsisMain() { for(int i = 0; i < cubeList.size(); i++) { Cube cube; CubeAttributeInput inatt(cubeList[i].toString()); - vector bands = inatt.bands(); + vector bands = inatt.bands(); cube.setVirtualBands(bands); cube.open(cubeList[i].toString()); if(i == 0) { @@ -46,8 +46,8 @@ void IsisMain() { else { // Make sure they are all the same size if((nsamps != cube.getSampleCount()) || (nlines != cube.getLineCount())) { - string msg = "Spatial dimensions of cube [" + - cubeList[i].toString() + "] does not match other cubes in list"; + QString msg = "Spatial dimensions of cube [" + + cubeList[i].toString() + "] does not match other cubes in list"; throw IException(IException::User, msg, _FILEINFO_); } // Get the total number of bands @@ -75,7 +75,7 @@ void IsisMain() { } } catch(IException &e) { - string msg = "Invalid cube in list file [" + ui.GetFileName("FROMLIST") + "]"; + QString msg = "Invalid cube in list file [" + ui.GetFileName("FROMLIST") + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -86,7 +86,7 @@ void IsisMain() { int index = 0; if(ui.WasEntered("PROPLAB")) { bool match = false; - string fname = (IString)ui.GetFileName("PROPLAB"); + QString fname = ui.GetFileName("PROPLAB"); for(int i = 0; i < cubeList.size(); i++) { if(fname == cubeList[i].toString()) { index = i; @@ -95,9 +95,9 @@ void IsisMain() { } } if(!match) { - string msg = "FileName [" + ui.GetFileName("PROPLAB") + - "] to propagate labels from is not in the list file [" + - ui.GetFileName("FROMLIST") + "]"; + QString msg = "FileName [" + ui.GetFileName("PROPLAB") + + "] to propagate labels from is not in the list file [" + + ui.GetFileName("FROMLIST") + "]"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -124,8 +124,8 @@ void IsisMain() { m.SetBandBinMatch(false); Progress *prog = m.Progress(); - prog->SetText("Adding band " + IString((int)i + 1) + - " of " + IString(nbands)); + prog->SetText("Adding band " + toString((int)i + 1) + + " of " + toString(nbands)); m.SetOutputCube("TO"); CubeAttributeInput attrib(cubeList[i].toString()); Cube *icube = m.SetInputCube(cubeList[i].toString(), attrib); @@ -146,9 +146,9 @@ void NullBand(Buffer &out) { //Helper function to output the input file to log. void helperButtonLog() { UserInterface &ui = Application::GetUserInterface(); - string file(ui.GetFileName("FROMLIST")); + QString file(ui.GetFileName("FROMLIST")); TextFile text(file); - string line; + QString line; for(int i = 0; i < text.LineCount(); i++) { text.GetLine(line); Application::GuiLog(line); diff --git a/isis/src/base/apps/cubenorm/cubenorm.cpp b/isis/src/base/apps/cubenorm/cubenorm.cpp index 1723af05a2..44303b6a68 100644 --- a/isis/src/base/apps/cubenorm/cubenorm.cpp +++ b/isis/src/base/apps/cubenorm/cubenorm.cpp @@ -1,7 +1,7 @@ #include "Isis.h" // system include files go first -#include +#include #include #include #include @@ -41,14 +41,14 @@ int totalLines; int totalSamples; int totalBands; -string direction; +QString direction; // function prototypes void getStats(Buffer &in); void multiply(Buffer &in, Buffer &out); void subtract(Buffer &in, Buffer &out); -void pvlOut(const string &pv); -void tableOut(const string &pv); +void pvlOut(const QString &pv); +void tableOut(const QString &pv); void PVLIn(const Isis::FileName &filename); void tableIn(const Isis::FileName &filename); void subSame(); @@ -60,7 +60,7 @@ void IsisMain() { // parameters. UserInterface &ui = Application::GetUserInterface(); if(!(ui.WasEntered("TO")) && !(ui.WasEntered("STATS"))) { - string msg = "User must specify a TO and/or STATS file."; + QString msg = "User must specify a TO and/or STATS file."; throw IException(IException::User, msg, _FILEINFO_); } @@ -104,14 +104,14 @@ void IsisMain() { // vector, and that there is a vector element for each row/col if((band.size() != (unsigned int)(rowcol * totalBands)) || (st.size() != (unsigned int)(rowcol * totalBands))) { - string message = "You have entered an invalid input file " + - ui.GetFileName("FROMSTATS"); + QString message = "You have entered an invalid input file " + + ui.GetFileName("FROMSTATS"); throw IException(IException::Io, message, _FILEINFO_); } //If a STATS file was specified then create statistics file if(ui.WasEntered("STATS")) { - string op = ui.GetString("FORMAT"); + QString op = ui.GetString("FORMAT"); if(op == "PVL") pvlOut(ui.GetFileName("STATS")); if(op == "TABLE") tableOut(ui.GetFileName("STATS")); } @@ -123,7 +123,7 @@ void IsisMain() { if(ui.GetString("MODE") == "MULTIPLY") { for(unsigned int i = 0; i < st.size(); i++) { if(IsValidPixel(normalizer[i]) && normalizer[i] <= 0.0) { - string msg = "Cube file can not be normalized with [MULTIPLY] "; + QString msg = "Cube file can not be normalized with [MULTIPLY] "; msg += "option, some column averages <= 0.0"; throw IException(IException::User, msg, _FILEINFO_); } @@ -216,25 +216,25 @@ void getStats(Buffer &in) { //******************************************************** // Create PVL output of statistics //******************************************************* -void pvlOut(const string &StatFile) { +void pvlOut(const QString &StatFile) { PvlGroup results("Results"); for(unsigned int i = 0; i < st.size(); i++) { - results += PvlKeyword("Band", band[i]); - results += PvlKeyword("RowCol", element[i]); - results += PvlKeyword("ValidPixels", st[i].ValidPixels()); + results += PvlKeyword("Band", toString(band[i])); + results += PvlKeyword("RowCol", toString(element[i])); + results += PvlKeyword("ValidPixels", toString(st[i].ValidPixels())); if(st[i].ValidPixels() > 0) { - results += PvlKeyword("Mean", st[i].Average()); - results += PvlKeyword("Median", median[i]); - results += PvlKeyword("Std", st[i].StandardDeviation()); - results += PvlKeyword("Minimum", st[i].Minimum()); - results += PvlKeyword("Maximum", st[i].Maximum()); + results += PvlKeyword("Mean", toString(st[i].Average())); + results += PvlKeyword("Median", toString(median[i])); + results += PvlKeyword("Std", toString(st[i].StandardDeviation())); + results += PvlKeyword("Minimum", toString(st[i].Minimum())); + results += PvlKeyword("Maximum", toString(st[i].Maximum())); } else { - results += PvlKeyword("Mean", 0.0); - results += PvlKeyword("Median", 0.0); - results += PvlKeyword("Std", 0.0); - results += PvlKeyword("Minimum", 0.0); - results += PvlKeyword("Maximum", 0.0); + results += PvlKeyword("Mean", "0.0"); + results += PvlKeyword("Median", "0.0"); + results += PvlKeyword("Std", "0.0"); + results += PvlKeyword("Minimum", "0.0"); + results += PvlKeyword("Maximum", "0.0"); } } @@ -246,11 +246,11 @@ void pvlOut(const string &StatFile) { //******************************************************** // Create Tabular output of statistics //******************************************************* -void tableOut(const string &StatFile) { +void tableOut(const QString &StatFile) { // Open output file // TODO check status and throw error ofstream out; - out.open(StatFile.c_str(), std::ios::out); + out.open(StatFile.toAscii().data(), std::ios::out); // Output a header out << std::setw(8) << "Band"; @@ -304,21 +304,21 @@ void PVLIn(const Isis::FileName &filename) { while(itr != results.End()) { StaticStats newStat; - band.push_back((*itr)[0]); + band.push_back(toInt((*itr)[0])); itr++; - element.push_back((*itr)[0]); + element.push_back(toInt((*itr)[0])); itr++; - newStat.setValidPixels((*itr)[0]); + newStat.setValidPixels(toInt((*itr)[0])); itr++; - newStat.setMean((*itr)[0]); + newStat.setMean(toDouble((*itr)[0])); itr++; - median.push_back((*itr)[0]); + median.push_back(toDouble((*itr)[0])); itr++; - newStat.setStandardDeviation((*itr)[0]); + newStat.setStandardDeviation(toDouble((*itr)[0])); itr++; - newStat.setMinimum((*itr)[0]); + newStat.setMinimum(toDouble((*itr)[0])); itr++; - newStat.setMaximum((*itr)[0]); + newStat.setMaximum(toDouble((*itr)[0])); itr++; st.push_back(newStat); @@ -337,12 +337,12 @@ void PVLIn(const Isis::FileName &filename) { //******************************************************* void tableIn(const Isis::FileName &filename) { ifstream in; - string expanded(filename.expanded()); - in.open(expanded.c_str(), std::ios::in); + QString expanded(filename.expanded()); + in.open(expanded.toAscii().data(), std::ios::in); if(!in) { - string message = "Error opening " + filename.expanded(); + QString message = "Error opening " + filename.expanded(); throw IException(IException::Io, message, _FILEINFO_); } diff --git a/isis/src/base/apps/decorstretch/decorstretch.cpp b/isis/src/base/apps/decorstretch/decorstretch.cpp index 9f049c1104..a426f2aed8 100644 --- a/isis/src/base/apps/decorstretch/decorstretch.cpp +++ b/isis/src/base/apps/decorstretch/decorstretch.cpp @@ -16,7 +16,7 @@ void NormalizeAndInvert(Buffer &in, Buffer &out); PrincipalComponentAnalysis pca(0); vector stretches; -string tmpFileName = "Temporary_DecorrelationStretch_Transform.cub"; +QString tmpFileName = "Temporary_DecorrelationStretch_Transform.cub"; void IsisMain() { ProcessByBrick p; @@ -61,7 +61,7 @@ void IsisMain() { p.EndProcess(); - remove(tmpFileName.c_str()); + remove(tmpFileName.toAscii().data()); } void GetData(Buffer &in) { diff --git a/isis/src/base/apps/demprep/demprep.cpp b/isis/src/base/apps/demprep/demprep.cpp index 4b3c8b1de5..511f912701 100644 --- a/isis/src/base/apps/demprep/demprep.cpp +++ b/isis/src/base/apps/demprep/demprep.cpp @@ -63,12 +63,12 @@ void IsisMain() { p.StartProcess(GetStats); PvlGroup demRange("Results"); - demRange += PvlKeyword("MinimumRadius", inCubeStats.Minimum(), "meters"); - demRange += PvlKeyword("MaximumRadius", inCubeStats.Maximum(), "meters"); + demRange += PvlKeyword("MinimumRadius", toString(inCubeStats.Minimum()), "meters"); + demRange += PvlKeyword("MaximumRadius", toString(inCubeStats.Maximum()), "meters"); Application::Log(demRange); // Store min/max radii values in new ShapeModelStatistics table - string shp_name = "ShapeModelStatistics"; + QString shp_name = "ShapeModelStatistics"; TableField fmin("MinimumRadius",Isis::TableField::Double); TableField fmax("MaximumRadius",Isis::TableField::Double); @@ -234,12 +234,12 @@ void IsisMain() { double upperLeftCorner = mapgrp["UpperLeftCornerX"]; upperLeftCorner -= leftPad * proj->Resolution(); - mapgrp.AddKeyword(PvlKeyword("UpperLeftCornerX", upperLeftCorner, "meters"), + mapgrp.AddKeyword(PvlKeyword("UpperLeftCornerX", toString(upperLeftCorner), "meters"), Pvl::Replace); upperLeftCorner = mapgrp["UpperLeftCornerY"]; upperLeftCorner += topPad * proj->Resolution(); - mapgrp.AddKeyword(PvlKeyword("UpperLeftCornerY", upperLeftCorner, "meters"), + mapgrp.AddKeyword(PvlKeyword("UpperLeftCornerY", toString(upperLeftCorner), "meters"), Pvl::Replace); @@ -260,12 +260,12 @@ void IsisMain() { ocube->putGroup(mapgrp); PvlGroup demRange("Results"); - demRange += PvlKeyword("MinimumRadius", outCubeStats.Minimum(), "meters"); - demRange += PvlKeyword("MaximumRadius", outCubeStats.Maximum(), "meters"); + demRange += PvlKeyword("MinimumRadius", toString(outCubeStats.Minimum()), "meters"); + demRange += PvlKeyword("MaximumRadius", toString(outCubeStats.Maximum()), "meters"); Application::Log(demRange); // Store min/max radii values in new ShapeModelStatistics table - string shp_name = "ShapeModelStatistics"; + QString shp_name = "ShapeModelStatistics"; TableField fmin("MinimumRadius",Isis::TableField::Double); TableField fmax("MaximumRadius",Isis::TableField::Double); diff --git a/isis/src/base/apps/deriv/deriv.cpp b/isis/src/base/apps/deriv/deriv.cpp index 8156cd54e1..b622dfad1b 100644 --- a/isis/src/base/apps/deriv/deriv.cpp +++ b/isis/src/base/apps/deriv/deriv.cpp @@ -20,7 +20,7 @@ void IsisMain() { p.SetOutputCube("TO"); // Which deriv (horizontal or vetical)? - string derivDir = ui.GetString("DIRECTION"); + QString derivDir = ui.GetString("DIRECTION"); // Set boxcar size depending on the derivative direction if(derivDir == "HORZ") { p.SetBoxcarSize(2, 1); diff --git a/isis/src/base/apps/dstripe/dstripe.cpp b/isis/src/base/apps/dstripe/dstripe.cpp index ed217eb41a..aab6150382 100644 --- a/isis/src/base/apps/dstripe/dstripe.cpp +++ b/isis/src/base/apps/dstripe/dstripe.cpp @@ -1,5 +1,7 @@ #include "Isis.h" +#include + #include "Application.h" #include "ProcessByLine.h" #include "ProgramLauncher.h" @@ -63,30 +65,30 @@ void IsisMain() { // Algorithm: lowpass(from, temp) -> hipass(temp, noise) -> to = from-noise // Run lowpass filter on input - string lowParams = ""; + QString lowParams = ""; lowParams += "from= " + ui.GetFileName("FROM"); lowParams += " to= dstripe.temporary.cub "; - lowParams += " samples= " + IString(lowSamples); - lowParams += " lines= " + IString(lowLines); + lowParams += " samples= " + toString(lowSamples); + lowParams += " lines= " + toString(lowLines); ProgramLauncher::RunIsisProgram("lowpass", lowParams); // Make a copy of the lowpass filter results if the user wants it if(!ui.GetBoolean("DELETENOISE")) { - string lowParams = ""; + QString lowParams = ""; lowParams += "from= " + ui.GetFileName("FROM"); lowParams += " to= " + ui.GetFileName("LPFNOISE"); - lowParams += " samples= " + IString(lowSamples); - lowParams += " lines= " + IString(lowLines); + lowParams += " samples= " + toString(lowSamples); + lowParams += " lines= " + toString(lowLines); ProgramLauncher::RunIsisProgram("lowpass", lowParams); } // Run highpass filter after lowpass is done, i.e. highpass(lowpass(input)) - string highParams = ""; + QString highParams = ""; highParams += "from= dstripe.temporary.cub "; highParams += " to= " + ui.GetFileName("NOISE") + " "; - highParams += " samples= " + IString(highSamples); - highParams += " lines= " + IString(highLines); + highParams += " samples= " + toString(highSamples); + highParams += " lines= " + toString(highLines); ProgramLauncher::RunIsisProgram("highpass", highParams); remove("dstripe.temporary.cub"); @@ -97,8 +99,8 @@ void IsisMain() { p.StartProcess(difference); p.EndProcess(); if(ui.GetBoolean("DELETENOISE")) { - string noiseFile(FileName(ui.GetFileName("NOISE")).expanded()); - remove(noiseFile.c_str()); + QString noiseFile(FileName(ui.GetFileName("NOISE")).expanded()); + QFile::remove(noiseFile); } } diff --git a/isis/src/base/apps/editlab/editlab.cpp b/isis/src/base/apps/editlab/editlab.cpp index d98f2d0c95..1bc648893e 100644 --- a/isis/src/base/apps/editlab/editlab.cpp +++ b/isis/src/base/apps/editlab/editlab.cpp @@ -19,7 +19,7 @@ void IsisMain() { // Extract label from file Pvl *label = new Pvl(ui.GetFileName("FROM")); PvlObject *pvl = label; - string option = ui.GetString("OPTION"); + QString option = ui.GetString("OPTION"); // Get user entered option & create IsisCube Object if needed Cube *cube = NULL; @@ -31,7 +31,7 @@ void IsisMain() { // Add Template File if(option == "ADDTEMP") { - string tempfile = ui.GetFileName("TEMPFILE"); + QString tempfile = ui.GetFileName("TEMPFILE"); Pvl tempobj(tempfile); for(int i = 0; i < tempobj.Groups(); ++i) { pvl->AddGroup(tempobj.Group(i)); @@ -39,7 +39,7 @@ void IsisMain() { } else { - string grpname = ui.GetString("GRPNAME"); + QString grpname = ui.GetString("GRPNAME"); // Add Group if(option == "ADDG") { @@ -55,7 +55,7 @@ void IsisMain() { } else { - string key = ui.GetString("KEYWORD"); + QString key = ui.GetString("KEYWORD"); PvlGroup &grp = pvl->FindGroup(grpname, PvlObject::Traverse); // Add Keyword diff --git a/isis/src/base/apps/edrget/edrget.cpp b/isis/src/base/apps/edrget/edrget.cpp index 768f9e127d..4b7f881973 100644 --- a/isis/src/base/apps/edrget/edrget.cpp +++ b/isis/src/base/apps/edrget/edrget.cpp @@ -1,8 +1,9 @@ #include "Isis.h" -#include #include +#include + #include "httpget.h" #include "ftpget.h" #include "UserInterface.h" @@ -17,18 +18,18 @@ void IsisMain() { // Get the file name from the GUI UserInterface &ui = Application::GetUserInterface(); - IString guiURL = ui.GetString("URL"); - IString guiPath; + QString guiURL = ui.GetString("URL"); + QString guiPath; if(ui.WasEntered("TOPATH")) { guiPath = ui.GetString("TOPATH"); } - QUrl qurl(guiURL.c_str()); + QUrl qurl(guiURL); //test if scheme is ftp and set port if(qurl.scheme().toLower() == "ftp") { qurl.setPort(21); if(ui.IsInteractive()) { - string parameters = "URL=" + guiURL; + QString parameters = "URL=" + guiURL; if(ui.WasEntered("TOPATH")) { parameters += " TOPATH=" + guiPath; } @@ -44,13 +45,13 @@ void IsisMain() { if(getter.error()) { QString localFileName; if(ui.WasEntered("TOPATH")) { - localFileName += guiPath.c_str(); + localFileName += guiPath; localFileName += "/"; } localFileName += QFileInfo(qurl.path()).fileName(); - string localFileNameStr(localFileName.toStdString()); - remove(localFileNameStr.c_str()); - IString msg = "Could not acquire [" + guiURL + "]"; + QString localFileNameStr(localFileName); + QFile::remove(localFileNameStr); + QString msg = "Could not acquire [" + guiURL + "]"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -60,7 +61,7 @@ void IsisMain() { qurl.setPort(80); if(ui.IsInteractive()) { - string parameters = "URL=" + guiURL; + QString parameters = "URL=" + guiURL; if(ui.WasEntered("TOPATH")) { parameters += " TOPATH=" + guiPath; } @@ -75,19 +76,19 @@ void IsisMain() { if(getter.error()) { QString localFileName; if(ui.WasEntered("TOPATH")) { - localFileName += guiPath.c_str(); + localFileName += guiPath; localFileName += "/"; } - string localFileNameStr(localFileName.toStdString()); - remove(localFileNameStr.c_str()); - IString msg = "Could not acquire [" + guiURL + "]"; + QString localFileNameStr(localFileName); + QFile::remove(localFileNameStr); + QString msg = "Could not acquire [" + guiURL + "]"; throw IException(IException::User, msg, _FILEINFO_); } } } //if scheme is not ftp or http throw error else { - IString msg = "Scheme [" + qurl.scheme().toStdString() + "] not found, must be 'ftp' or 'http'"; + QString msg = "Scheme [" + qurl.scheme() + "] not found, must be 'ftp' or 'http'"; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/base/apps/edrget/ftpget.cpp b/isis/src/base/apps/edrget/ftpget.cpp index d3683567fd..6dbe643abe 100644 --- a/isis/src/base/apps/edrget/ftpget.cpp +++ b/isis/src/base/apps/edrget/ftpget.cpp @@ -22,7 +22,7 @@ namespace Isis { //************************************** // getFile function will check URL, if URL is good function will connect, // login, and get the file. This function returns P_error. - bool FtpGet::getFile(const QUrl &url, string topath) { + bool FtpGet::getFile(const QUrl &url, QString topath) { //next four if check the URL and return true is there is error. if(!url.isValid()) { string msg = "invalid URL"; @@ -45,7 +45,7 @@ namespace Isis { QString localFileName; if(topath.size() != 0) { - localFileName += topath.c_str(); + localFileName += topath; localFileName += "/"; } localFileName += QFileInfo(url.path()).fileName(); @@ -75,8 +75,8 @@ namespace Isis { void FtpGet::ftpDone(bool error) { if(error) { p_error = true; - IString msg = p_ftp.errorString().toStdString(); - msg.Remove("\n"); + QString msg = p_ftp.errorString(); + msg.remove("\n"); // iException::Message(iException::User, msg, _FILEINFO_); } else { @@ -100,7 +100,7 @@ namespace Isis { if(total == -1) return; if(p_error) return; if(p_lastDone < 0) { - p_progress.SetText(string("Downloading File ") + p_file.fileName().toStdString()); + p_progress.SetText(QString("Downloading File ") + p_file.fileName()); p_progress.SetMaximumSteps(total); p_progress.CheckStatus(); p_lastDone = 1; diff --git a/isis/src/base/apps/edrget/ftpget.h b/isis/src/base/apps/edrget/ftpget.h index 567db4f232..a30656043e 100644 --- a/isis/src/base/apps/edrget/ftpget.h +++ b/isis/src/base/apps/edrget/ftpget.h @@ -18,7 +18,7 @@ namespace Isis { public: FtpGet(QObject *parent = 0); - bool getFile(const QUrl &url, std::string topath); + bool getFile(const QUrl &url, QString topath); bool error() const { return p_error; diff --git a/isis/src/base/apps/edrget/httpget.cpp b/isis/src/base/apps/edrget/httpget.cpp index 359cfd2821..ae9045ee2b 100644 --- a/isis/src/base/apps/edrget/httpget.cpp +++ b/isis/src/base/apps/edrget/httpget.cpp @@ -22,22 +22,22 @@ namespace Isis { //********************************************** // getFile function will check URL, if URL is good the function will connect, // login, and get the file. This function returns p_error - bool HttpGet::getFile(const QUrl &url, string topath) { + bool HttpGet::getFile(const QUrl &url, QString topath) { // The next four ifs will check the URL and return error is bad if(!url.isValid()) { - string msg = "invalid URL"; + QString msg = "invalid URL"; // iException::Message(iException::User, msg, _FILEINFO_); p_error = true; return p_error; } if(url.scheme().toLower() != "http") { - string msg = "URL must start with 'http:'"; + QString msg = "URL must start with 'http:'"; // iException::Message(iException::User, msg, _FILEINFO_); p_error = true; return p_error; } if(url.path().isEmpty()) { - string msg = "URL has no path"; + QString msg = "URL has no path"; // iException::Message(iException::User, msg, _FILEINFO_); p_error = true; return p_error; @@ -45,12 +45,12 @@ namespace Isis { QString localFileName; if(topath.size() != 0) { - localFileName += topath.c_str(); + localFileName += topath; localFileName += "/"; } localFileName += QFileInfo(url.path()).fileName(); if(localFileName.isEmpty()) { - string msg = "URL has no filename"; + QString msg = "URL has no filename"; // iException::Message(iException::User, msg, _FILEINFO_); p_error = true; return p_error; @@ -58,7 +58,7 @@ namespace Isis { // check the local file. p_file.setFileName(localFileName); if(!p_file.open(QIODevice::WriteOnly)) { - string msg = "Cannot open output file"; + QString msg = "Cannot open output file"; // iException::Message(iException::User, msg, _FILEINFO_); p_error = true; return p_error; @@ -72,7 +72,7 @@ namespace Isis { } void HttpGet::httpDone(bool error) { - map errLUT; + map errLUT; errLUT [204] = "No content"; errLUT [301] = "Moved Permanently"; errLUT [302] = "Moved Temporarily"; @@ -86,12 +86,12 @@ namespace Isis { if(error) { p_error = true; - string msg = p_http.errorString().toStdString(); + QString msg = p_http.errorString(); // iException::Message(iException::User, msg, _FILEINFO_); } else if(p_http.lastResponse().statusCode() != 200 && p_http.lastResponse().statusCode() != 0) { p_error = true; - string msg = "error code: [" + errLUT[p_http.lastResponse().statusCode()] + "]"; + QString msg = "error code: [" + errLUT[p_http.lastResponse().statusCode()] + "]"; // iException::Message(iException::User, msg, _FILEINFO_); } else { @@ -106,7 +106,7 @@ namespace Isis { if(total == 0) return; if(p_error) return; if(p_lastDone < 0) { - p_progress.SetText(string("Downloading File ") + p_file.fileName().toStdString()); + p_progress.SetText(QString("Downloading File ") + p_file.fileName()); p_progress.SetMaximumSteps(total); p_progress.CheckStatus(); p_lastDone = 1; diff --git a/isis/src/base/apps/edrget/httpget.h b/isis/src/base/apps/edrget/httpget.h index 4c9d22ff9d..582d1c16df 100644 --- a/isis/src/base/apps/edrget/httpget.h +++ b/isis/src/base/apps/edrget/httpget.h @@ -18,7 +18,7 @@ namespace Isis { public: HttpGet(QObject *parent = 0); - bool getFile(const QUrl &url, std::string topath); + bool getFile(const QUrl &url, QString topath); bool error() const { return p_error; diff --git a/isis/src/base/apps/enlarge/enlarge.cpp b/isis/src/base/apps/enlarge/enlarge.cpp index 91b826e421..7f7bc7b5b2 100644 --- a/isis/src/base/apps/enlarge/enlarge.cpp +++ b/isis/src/base/apps/enlarge/enlarge.cpp @@ -64,8 +64,8 @@ void IsisMain() { interp = new Interpolator(Interpolator::CubicConvolutionType); } else { - string msg = "Unknown value for INTERP [" + - ui.GetString("INTERP") + "]"; + QString msg = "Unknown value for INTERP [" + + ui.GetString("INTERP") + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/equalizer/equalizer.cpp b/isis/src/base/apps/equalizer/equalizer.cpp index a166584261..91eae5e6f4 100644 --- a/isis/src/base/apps/equalizer/equalizer.cpp +++ b/isis/src/base/apps/equalizer/equalizer.cpp @@ -26,10 +26,10 @@ void IsisMain() { // Make sure the user enters an "OUTSTATS" file if the CALCULATE option // is selected - std::string processOpt = ui.GetString("PROCESS"); + QString processOpt = ui.GetString("PROCESS"); if (processOpt == "CALCULATE") { if (!ui.WasEntered("OUTSTATS")) { - std::string msg = "If the CALCULATE option is selected, you must enter"; + QString msg = "If the CALCULATE option is selected, you must enter"; msg += " an OUTSTATS file"; throw IException(IException::User, msg, _FILEINFO_); } @@ -54,7 +54,7 @@ void IsisMain() { bool wtopt = ui.GetBoolean("WEIGHT"); // Determine whether to calculate gains or offsets - std::string adjust = ui.GetString("ADJUST"); + QString adjust = ui.GetString("ADJUST"); OverlapNormalization::SolutionType sType = OverlapNormalization::Both; if (adjust == "CONTRAST") { sType = OverlapNormalization::Gains; diff --git a/isis/src/base/apps/errors/errors.cpp b/isis/src/base/apps/errors/errors.cpp index fe21ae0bbd..082796cd60 100644 --- a/isis/src/base/apps/errors/errors.cpp +++ b/isis/src/base/apps/errors/errors.cpp @@ -1,6 +1,6 @@ #include "Isis.h" -#include +#include using namespace std; using namespace Isis; @@ -15,7 +15,7 @@ void IsisMain() { // Check to see if output file exists FileName outFile = ui.GetFileName("TO"); if(outFile.fileExists() && !append) { - string msg = "Output file [" + outFile.expanded() + "] already exists."; + QString msg = "Output file [" + outFile.expanded() + "] already exists."; msg += " Append option set to False."; throw IException(IException::User, msg, _FILEINFO_); } @@ -29,7 +29,7 @@ void IsisMain() { numErrors++; } } - PvlKeyword errors("TotalErrors", numErrors); + PvlKeyword errors("TotalErrors", toString(numErrors)); output.AddKeyword(errors); // write output to file if(!append) { diff --git a/isis/src/base/apps/explode/explode.cpp b/isis/src/base/apps/explode/explode.cpp index 6c7fde9191..fed035509a 100644 --- a/isis/src/base/apps/explode/explode.cpp +++ b/isis/src/base/apps/explode/explode.cpp @@ -15,17 +15,17 @@ void IsisMain() { int samps = icube->getSampleCount(); int lines = icube->getLineCount(); int bands = icube->getBandCount(); - string infile = icube->getFileName(); + QString infile = icube->getFileName(); // We the output filename so we can add attributes and extensions UserInterface &ui = Application::GetUserInterface(); - string outbase = ui.GetFileName("TO"); + QString outbase = ui.GetFileName("TO"); CubeAttributeOutput &outatt = ui.GetOutputAttribute("TO"); // Loop and extract each band for(int band = 1; band <= bands; band++) { int pband = icube->getPhysicalBand(band); - IString sband(pband); + QString sband(toString(pband)); ProcessByLine p2; Progress *prog = p2.Progress(); @@ -34,7 +34,7 @@ void IsisMain() { CubeAttributeInput inatt("+" + sband); p2.SetInputCube(infile, inatt); - string outfile = outbase + ".band"; + QString outfile = outbase + ".band"; if(pband / 1000 == 0) { outfile += "0"; if(pband / 100 == 0) { diff --git a/isis/src/base/apps/fakecube/fakecube.cpp b/isis/src/base/apps/fakecube/fakecube.cpp index c7242c2414..284906cacc 100644 --- a/isis/src/base/apps/fakecube/fakecube.cpp +++ b/isis/src/base/apps/fakecube/fakecube.cpp @@ -23,7 +23,7 @@ void IsisMain() { p.SetOutputCube("TO"); // Start the processing - string option = ui.GetString("OPTION"); + QString option = ui.GetString("OPTION"); if(option == "GRADIENT") { p.StartProcess(SumLineSample); } diff --git a/isis/src/base/apps/fft/fft.cpp b/isis/src/base/apps/fft/fft.cpp index 187c4a1aae..56a575e855 100644 --- a/isis/src/base/apps/fft/fft.cpp +++ b/isis/src/base/apps/fft/fft.cpp @@ -1,5 +1,9 @@ #include "Isis.h" + #include + +#include + #include "FourierTransform.h" #include "ProcessByTile.h" #include "Statistics.h" @@ -13,8 +17,8 @@ void FFT2(vector &in, vector &out); void getMinMax(Buffer &in); FourierTransform fft; -string tmpMagFileName = "Temporary_IFFT_Magnitude.cub"; -string tmpPhaseFileName = "Temporary_IFFT_Phase.cub"; +QString tmpMagFileName = "Temporary_IFFT_Magnitude.cub"; +QString tmpPhaseFileName = "Temporary_IFFT_Phase.cub"; double HPixel = 0.0, LPixel = 0.0, NPixel = 0.0; Statistics stats; @@ -38,7 +42,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); - string replacement = ui.GetString("REPLACEMENT"); + QString replacement = ui.GetString("REPLACEMENT"); if(replacement == "ZEROES") { HPixel = 0.0; LPixel = 0.0; @@ -88,8 +92,8 @@ void IsisMain() { // Stop the process and remove the temporary files lProc.Finalize(); - remove(tmpMagFileName.c_str()); - remove(tmpPhaseFileName.c_str()); + QFile::remove(tmpMagFileName); + QFile::remove(tmpPhaseFileName); } // Processing routine for the fft with one input cube diff --git a/isis/src/base/apps/fillgap/fillgap.cpp b/isis/src/base/apps/fillgap/fillgap.cpp index 797930cd79..527dc072c5 100644 --- a/isis/src/base/apps/fillgap/fillgap.cpp +++ b/isis/src/base/apps/fillgap/fillgap.cpp @@ -1,5 +1,5 @@ #include "Isis.h" -#include +#include #include "ProcessBySample.h" #include "ProcessByLine.h" #include "ProcessBySpectra.h" @@ -24,7 +24,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); // set spline interpolation to user requested type - string splineType = ui.GetString("INTERP"); + QString splineType = ui.GetString("INTERP"); if(splineType == "LINEAR") { iType = NumericalApproximation::Linear; } @@ -36,7 +36,7 @@ void IsisMain() { } //Set null direction to the user defined direction - string Dir = ui.GetString("DIRECTION"); + QString Dir = ui.GetString("DIRECTION"); if(Dir == "SAMPLE") { ProcessBySample p; p.SetInputCube("FROM"); @@ -63,7 +63,7 @@ void IsisMain() { if(numSpecPixKept > 0) { PvlGroup mLog("Messages"); mLog += PvlKeyword("Warning", - "Unable to fill " + IString(numSpecPixKept) + " special pixels."); + "Unable to fill " + toString(numSpecPixKept) + " special pixels."); Application::Log(mLog); } return; diff --git a/isis/src/base/apps/findgaps/FindGapsFunctor.cpp b/isis/src/base/apps/findgaps/FindGapsFunctor.cpp index d87ca259dc..063e9f7c87 100644 --- a/isis/src/base/apps/findgaps/FindGapsFunctor.cpp +++ b/isis/src/base/apps/findgaps/FindGapsFunctor.cpp @@ -114,8 +114,8 @@ namespace Isis { * * @return Pvl group of gaps to be displayed */ - void FindGapsFunctor::setModification(IString newModValue) { - m_gaps->FindKeyword("Modification").SetValue(newModValue.ToQt()); + void FindGapsFunctor::setModification(QString newModValue) { + m_gaps->FindKeyword("Modification").SetValue(newModValue); } @@ -151,18 +151,18 @@ namespace Isis { if( !(*m_inGap) ) { *m_inGap = true; - m_gap->AddKeyword(PvlKeyword("NewGapInBand", in.Band())); - m_gap->AddKeyword(PvlKeyword("StartLine", in.Line())); + m_gap->AddKeyword(PvlKeyword("NewGapInBand", toString(in.Band()))); + m_gap->AddKeyword(PvlKeyword("StartLine", toString(in.Line()))); if(correlation == Isis::Null) { correlation = 0.0; } - m_gap->AddKeyword(PvlKeyword("Correlation", correlation)); + m_gap->AddKeyword(PvlKeyword("Correlation", toString(correlation))); } if (in.Line() == m_lineCount) { - m_gap->AddKeyword(PvlKeyword("LastGapLine", in.Line())); - m_gap->AddKeyword(PvlKeyword("ToEndOfBand", m_lineCount)); + m_gap->AddKeyword(PvlKeyword("LastGapLine", toString(in.Line()))); + m_gap->AddKeyword(PvlKeyword("ToEndOfBand", toString(m_lineCount))); addGapToGroup(); } @@ -174,7 +174,7 @@ namespace Isis { * correlate. Or this line is the last line and it is in the gap. */ - m_gap->AddKeyword(PvlKeyword("LastGapLine", in.Line() - 2)); + m_gap->AddKeyword(PvlKeyword("LastGapLine", toString(in.Line() - 2))); addGapToGroup(); } @@ -195,9 +195,9 @@ namespace Isis { for (int i = 0; i < m_gaps->Groups(); i++) { - int gapBand = (*m_gaps).Group(i).FindKeyword(" NewGapInBand")[0].ToInteger(); - int gapStart = (*m_gaps).Group(i).FindKeyword("StartLine")[0].ToInteger(); - int gapEnd = (*m_gaps).Group(i).FindKeyword("LastGapLine")[0].ToInteger(); + int gapBand = toInt((*m_gaps).Group(i).FindKeyword(" NewGapInBand")[0]); + int gapStart = toInt((*m_gaps).Group(i).FindKeyword("StartLine")[0]); + int gapEnd = toInt((*m_gaps).Group(i).FindKeyword("LastGapLine")[0]); if ( (in.Line() >= gapStart - m_bufferSizeBeforeGap) && (in.Line() <= gapEnd + m_bufferSizeAfterGap) && @@ -239,8 +239,8 @@ namespace Isis { * In case the gap is a flase positive. The end of the gap will end up being the line * before the start of the gap. */ - if (m_gap->FindKeyword("StartLine")[0].ToInteger() < - m_gap->FindKeyword("LastGapLine")[0].ToInteger()) { + if (toInt(m_gap->FindKeyword("StartLine")[0]) < + toInt(m_gap->FindKeyword("LastGapLine")[0])) { m_gaps->AddGroup(*m_gap); } diff --git a/isis/src/base/apps/findgaps/FindGapsFunctor.h b/isis/src/base/apps/findgaps/FindGapsFunctor.h index ed288a36c7..15c18d1aa4 100644 --- a/isis/src/base/apps/findgaps/FindGapsFunctor.h +++ b/isis/src/base/apps/findgaps/FindGapsFunctor.h @@ -24,12 +24,12 @@ * http://www.usgs.gov/privacy.html. */ -namespace Isis { +class QString; +namespace Isis { class Brick; class Buffer; class Cube; - class IString; class Pvl; class PvlGroup; @@ -56,7 +56,7 @@ namespace Isis { PvlGroup gap(); Pvl gaps(); - void setModification(IString newModValue); + void setModification(QString newModValue); // Processors void operator() (Buffer &in) const; diff --git a/isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp b/isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp index 925b1956ed..06e4703154 100644 --- a/isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp +++ b/isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp @@ -13,20 +13,20 @@ void IsisMain() { FileList images(ui.GetFileName("FROMLIST")); // list of sns/filenames sorted by serial number - vector< pair > sortedList; + vector< pair > sortedList; // We want to sort the input data by serial number so that the same // results are produced every time this program is run with the same // images. This is a modified insertion sort. for(int image = 0; image < images.size(); image++) { unsigned int insertPos = 0; - string sn = SerialNumber::Compose(images[image].toString()); + QString sn = SerialNumber::Compose(images[image].toString()); for(insertPos = 0; insertPos < sortedList.size(); insertPos++) { if(sn.compare(sortedList[insertPos].first) < 0) break; } - pair newPair = pair(sn, images[image].toString()); + pair newPair = pair(sn, images[image].toString()); sortedList.insert(sortedList.begin() + insertPos, newPair); } @@ -74,6 +74,6 @@ void IsisMain() { } PvlGroup results("Results"); - results += PvlKeyword("ErrorCount", (BigInt)overlaps.Errors().size()); + results += PvlKeyword("ErrorCount", toString((BigInt)overlaps.Errors().size())); Application::Log(results); } diff --git a/isis/src/base/apps/findrx/findrx.cpp b/isis/src/base/apps/findrx/findrx.cpp index 2a5f512ebd..151a296327 100644 --- a/isis/src/base/apps/findrx/findrx.cpp +++ b/isis/src/base/apps/findrx/findrx.cpp @@ -30,21 +30,21 @@ void IsisMain() { // If the Keyword sizes don't match up, throw errors. int nres = reseaus["Line"].Size(); if(nres != reseaus["Sample"].Size()) { - string msg = "Sample size incorrect [Sample size " + - IString(reseaus["Sample"].Size()) + " != " + " Line size " + - IString(reseaus["Line"].Size()) + "]"; + QString msg = "Sample size incorrect [Sample size " + + toString(reseaus["Sample"].Size()) + " != " + " Line size " + + toString(reseaus["Line"].Size()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } if(nres != reseaus["Type"].Size()) { - string msg = "Type size incorrect [Type size " + - IString(reseaus["Type"].Size()) + " != " + " Line size " + - IString(reseaus["Line"].Size()) + "]"; + QString msg = "Type size incorrect [Type size " + + toString(reseaus["Type"].Size()) + " != " + " Line size " + + toString(reseaus["Line"].Size()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } if(nres != reseaus["Valid"].Size()) { - string msg = "Valid size incorrect [Valid size " + - IString(reseaus["Valid"].Size()) + " != " + " Line size " + - IString(reseaus["Line"].Size()) + "]"; + QString msg = "Valid size incorrect [Valid size " + + toString(reseaus["Valid"].Size()) + " != " + " Line size " + + toString(reseaus["Line"].Size()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -73,10 +73,10 @@ void IsisMain() { // And the loop... for(int res = 0; res < nres; ++res) { // Output chips - ar->SearchChip()->TackCube(reseaus["Sample"][res], reseaus["Line"][res]); + ar->SearchChip()->TackCube(toDouble(reseaus["Sample"][res]), toDouble(reseaus["Line"][res])); ar->SearchChip()->Load(cube); ar->PatternChip()->Load(pattern, 0, 1.0, res + 1); - int type = IString(reseaus["Type"][res]); + int type = toInt(reseaus["Type"][res]); // If the reseaus is in the center (type 5) use full percent value if(type == 5) { ar->SetPatternValidPercent(patternValidPercent); @@ -96,18 +96,18 @@ void IsisMain() { ar->Register(); if(ar->Success()) { - reseaus["Sample"][res] = ar->CubeSample(); - reseaus["Line"][res] = ar->CubeLine(); - reseaus["Valid"][res] = 1; + reseaus["Sample"][res] = toString(ar->CubeSample()); + reseaus["Line"][res] = toString(ar->CubeLine()); + reseaus["Valid"][res] = "1"; } else { - reseaus["Valid"][res] = 0; + reseaus["Valid"][res] = "0"; } // And if the reseaus are to be marked...mark em if(white != NULL) { - double line = reseaus["Line"][res]; - double sample = reseaus["Sample"][res]; + double line = toDouble(reseaus["Line"][res]); + double sample = toDouble(reseaus["Sample"][res]); white->SetBasePosition(int(sample), int(line), 1); cube.write(*white); } diff --git a/isis/src/base/apps/fits2isis/fits2isis.cpp b/isis/src/base/apps/fits2isis/fits2isis.cpp index fe1ee11594..e006432125 100644 --- a/isis/src/base/apps/fits2isis/fits2isis.cpp +++ b/isis/src/base/apps/fits2isis/fits2isis.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include using namespace std; using namespace Isis; @@ -21,15 +21,15 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); - string from = ui.GetFileName("FROM"); + QString from = ui.GetFileName("FROM"); // Setup to read headers/labels ifstream input; - input.open(from.c_str(), ios::in | ios::binary); + input.open(from.toAscii().data(), ios::in | ios::binary); // Check stream open status if(!input.is_open()) { - string msg = "Cannot open input file [" + from + "]"; + QString msg = "Cannot open input file [" + from + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -50,26 +50,26 @@ void IsisMain() { // Check for blank lines if(line.substr(0, 1) != " " && line.substr(0, 1) != "/") { // Name of keyword - PvlKeyword label(line.Token(" =")); + PvlKeyword label(line.Token(" =").ToQt()); // Remove up to beginning of data line.TrimHead(" ='"); line.TrimTail(" "); if(label.Name() == "COMMENT" || label.Name() == "HISTORY") { - label += line; + label += line.ToQt(); } else { // Access the data without the comment if there is one IString value = line.Token("/"); // Clear to end of data, including single quotes value.TrimTail(" '"); - label += value; + label += value.ToQt(); line.TrimHead(" "); - // If the remaining line string has anything, it is comments. + // If the remaining line QString has anything, it is comments. if(line.size() > 0) { - label.AddComment(line); + label.AddComment(line.ToQt()); // A possible format for units, other possiblites exist. if(line != line.Token("[")) { - label.SetUnits(line.Token("[").Token("]")); + label.SetUnits(line.Token("[").Token("]").ToQt()); } } } @@ -88,7 +88,7 @@ void IsisMain() { // Its possible they could have this instead of T, in which case we won't even try if(labels["SIMPLE"][0] == "F") { - string msg = "The file [" + ui.GetFileName("FROM") + "] does not conform to the FITS standards"; + QString msg = "The file [" + ui.GetFileName("FROM") + "] does not conform to the FITS standards"; throw IException(IException::User, msg, _FILEINFO_); } @@ -103,8 +103,8 @@ void IsisMain() { // Find pixel type, there are several unsupported possiblites Isis::PixelType type; - string msg = ""; - switch(labels["BITPIX"][0].ToInteger()) { + QString msg = ""; + switch(toInt(labels["BITPIX"][0])) { case 8: type = Isis::UnsignedByte; break; @@ -136,23 +136,24 @@ void IsisMain() { // It is possible to have a NAXIS value of 0 meaning no data, the file could include // xtensions with data, however, those aren't supported as of Oct '09 - if(labels["NAXIS"][0].ToInteger() == 2) { - pfits.SetDimensions(labels["NAXIS1"][0], labels["NAXIS2"][0], 1); + if(toInt(labels["NAXIS"][0]) == 2) { + pfits.SetDimensions(toInt(labels["NAXIS1"][0]), toInt(labels["NAXIS2"][0]), 1); } - else if(labels["NAXIS"][0].ToInteger() == 3) { - pfits.SetDimensions(labels["NAXIS1"][0], labels["NAXIS2"][0], labels["NAXIS3"][0]); + else if(toInt(labels["NAXIS"][0]) == 3) { + pfits.SetDimensions(toInt(labels["NAXIS1"][0]), toInt(labels["NAXIS2"][0]), + toInt(labels["NAXIS3"][0])); } else { - string msg = "NAXIS count of [" + labels["NAXIS"][0] + "] is not supported at this time"; + QString msg = "NAXIS count of [" + labels["NAXIS"][0] + "] is not supported at this time"; throw IException(IException::User, msg, _FILEINFO_); } // Base and multiplier if(labels.HasKeyword("BZERO")) { - pfits.SetBase(labels["BZERO"][0]); + pfits.SetBase(toDouble(labels["BZERO"][0])); } if(labels.HasKeyword("BSCALE")) { - pfits.SetMultiplier(labels["BSCALE"][0]); + pfits.SetMultiplier(toDouble(labels["BSCALE"][0])); } // Byte order diff --git a/isis/src/base/apps/footprintinit/footprintinit.cpp b/isis/src/base/apps/footprintinit/footprintinit.cpp index c97c9b90b2..7665725e8b 100644 --- a/isis/src/base/apps/footprintinit/footprintinit.cpp +++ b/isis/src/base/apps/footprintinit/footprintinit.cpp @@ -30,7 +30,7 @@ void IsisMain() { prog.SetMaximumSteps(1); prog.CheckStatus(); - std::string sn = SerialNumber::Compose(cube); + QString sn = SerialNumber::Compose(cube); ImagePolygon poly; if(ui.WasEntered("MAXEMISSION")) { @@ -68,14 +68,14 @@ void IsisMain() { poly.Create(cube, sinc, linc, 1, 1, 0, 0, 1, precision); } catch (IException &e) { - string msg = "Cannot generate polygon for [" + ui.GetFileName("FROM") + "]"; + QString msg = "Cannot generate polygon for [" + ui.GetFileName("FROM") + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } if(ui.GetBoolean("TESTXY")) { Pvl cubeLab(ui.GetFileName("FROM")); PvlGroup inst = cubeLab.FindGroup("Instrument", Pvl::Traverse); - string target = inst["TargetName"]; + QString target = inst["TargetName"]; PvlGroup radii = Projection::TargetRadii(target); Pvl map(ui.GetFileName("MAP")); @@ -84,19 +84,19 @@ void IsisMain() { if(!mapping.HasKeyword("TargetName")) mapping += Isis::PvlKeyword("TargetName", target); if(!mapping.HasKeyword("EquatorialRadius")) - mapping += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); + mapping += Isis::PvlKeyword("EquatorialRadius", (QString)radii["EquatorialRadius"]); if(!mapping.HasKeyword("PolarRadius")) - mapping += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapping += Isis::PvlKeyword("PolarRadius", (QString)radii["PolarRadius"]); if(!mapping.HasKeyword("LatitudeType")) mapping += Isis::PvlKeyword("LatitudeType", "Planetocentric"); if(!mapping.HasKeyword("LongitudeDirection")) mapping += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); if(!mapping.HasKeyword("LongitudeDomain")) - mapping += Isis::PvlKeyword("LongitudeDomain", 360); + mapping += Isis::PvlKeyword("LongitudeDomain", "360"); if(!mapping.HasKeyword("CenterLatitude")) - mapping += Isis::PvlKeyword("CenterLatitude", 0); + mapping += Isis::PvlKeyword("CenterLatitude", "0"); if(!mapping.HasKeyword("CenterLongitude")) - mapping += Isis::PvlKeyword("CenterLongitude", 0); + mapping += Isis::PvlKeyword("CenterLongitude", "0"); sinc = poly.getSinc(); linc = poly.getLinc(); @@ -121,7 +121,7 @@ void IsisMain() { delete proj; delete xyPoly; e.print(); // This should be a NAIF error - string msg = "Cannot calculate XY for ["; + QString msg = "Cannot calculate XY for ["; msg += ui.GetFileName("FROM") + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -137,8 +137,8 @@ void IsisMain() { if(precision) { PvlGroup results("Results"); - results.AddKeyword(PvlKeyword("SINC", sinc)); - results.AddKeyword(PvlKeyword("LINC", linc)); + results.AddKeyword(PvlKeyword("SINC", toString(sinc))); + results.AddKeyword(PvlKeyword("LINC", toString(linc))); Application::Log(results); } diff --git a/isis/src/base/apps/footprintmerge/footprintmerge.cpp b/isis/src/base/apps/footprintmerge/footprintmerge.cpp index f10eb1e4a8..2643cdf90c 100644 --- a/isis/src/base/apps/footprintmerge/footprintmerge.cpp +++ b/isis/src/base/apps/footprintmerge/footprintmerge.cpp @@ -22,7 +22,7 @@ void IsisMain() { FileList imageList; imageList.read(ui.GetFileName("FROMLIST")); if(imageList.size() < 1) { - std::string msg = "The list file [" + ui.GetFileName("FROMLIST") + + QString msg = "The list file [" + ui.GetFileName("FROMLIST") + "] does not contain any data"; throw IException(IException::User, msg, _FILEINFO_); } @@ -34,7 +34,7 @@ void IsisMain() { // For this first loop union all image polygons vector allPolys; - vector files; + vector files; bool conv360 = false; for(int img = 0; img < imageList.size(); img++) { @@ -47,7 +47,7 @@ void IsisMain() { cube.getCamera(); } catch(IException &e) { - string msg = "Spiceinit must be run prior to running footprintmerge"; + QString msg = "Spiceinit must be run prior to running footprintmerge"; msg += " for cube [" + imageList[img].toString() + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -59,7 +59,7 @@ void IsisMain() { cube.close(); } catch(IException &e) { - string msg = "Footprintinit must be run prior to running footprintmerge"; + QString msg = "Footprintinit must be run prior to running footprintmerge"; msg += " for cube [" + imageList[img].toString() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -118,7 +118,7 @@ void IsisMain() { prog.SetMaximumSteps(allPolys.size()); prog.CheckStatus(); - typedef std::vector islandFiles; + typedef std::vector islandFiles; std::vector< islandFiles > islands; islands.resize(islandPolys.size()); for(unsigned int i = 0; i < allPolys.size(); i++) { @@ -131,23 +131,23 @@ void IsisMain() { } - string mode = ui.GetString("MODE"); + QString mode = ui.GetString("MODE"); // print out island statistics // Brief if(mode == "BRIEF") { PvlGroup results("Results"); - results += PvlKeyword("NumberOfIslands", (int)islandPolys.size()); + results += PvlKeyword("NumberOfIslands", toString((int)islandPolys.size())); Application::Log(results); } else if(mode == "FULL") { - string out = ui.GetFileName("TO"); + QString out = ui.GetFileName("TO"); PvlObject results("Results"); for(unsigned int p = 0; p < islandPolys.size(); p++) { int numFiles = islands[p].size(); - string isle = "FootprintIsland_" + IString((int)p + 1); + QString isle = "FootprintIsland_" + toString((int)p + 1); PvlGroup island(isle); - island += PvlKeyword("NumberFiles", numFiles); + island += PvlKeyword("NumberFiles", toString(numFiles)); PvlKeyword files("Files"); for(int f = 0; f < numFiles; f++) { files.AddValue(islands[p][f]); diff --git a/isis/src/base/apps/getkey/getkey.cpp b/isis/src/base/apps/getkey/getkey.cpp index 863c18cc44..33cc483057 100644 --- a/isis/src/base/apps/getkey/getkey.cpp +++ b/isis/src/base/apps/getkey/getkey.cpp @@ -2,7 +2,7 @@ #include "Isis.h" -#include +#include #include #include "Process.h" #include "Pvl.h" @@ -14,11 +14,12 @@ using namespace Isis; //helper button functins in the code void helperButtonLog(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonLog"] = (void *) helperButtonLog; return helper; } + void IsisMain() { // Set Preferences to always turn off Terminal Output PvlGroup &grp = Isis::Preference::Preferences().FindGroup("SessionLog", Isis::Pvl::Traverse); @@ -29,7 +30,7 @@ void IsisMain() { // Get the input file from the user interface UserInterface &ui = Application::GetUserInterface(); - string labelFile = ui.GetFileName("FROM"); + QString labelFile = ui.GetFileName("FROM"); // Open the file ... it must be a label-type file Pvl lab; @@ -39,12 +40,12 @@ void IsisMain() { // Set up the requested object PvlKeyword key; if(ui.WasEntered("OBJNAME")) { - string obj = ui.GetString("OBJNAME"); + QString obj = ui.GetString("OBJNAME"); // Get the keyword from the entered group if(ui.WasEntered("GRPNAME")) { PvlObject object = lab.FindObject(obj, Pvl::Traverse); - string grp = ui.GetString("GRPNAME"); + QString grp = ui.GetString("GRPNAME"); key = object.FindGroup(grp, Pvl::Traverse)[ui.GetString("KEYWORD")]; } // Find the keyword in the object @@ -60,7 +61,7 @@ void IsisMain() { // Set up the requested group else if(ui.WasEntered("GRPNAME")) { - string grp = ui.GetString("GRPNAME"); + QString grp = ui.GetString("GRPNAME"); key = lab.FindGroup(grp, Pvl::Traverse)[ui.GetString("KEYWORD")]; } @@ -74,13 +75,13 @@ void IsisMain() { } } - IString value; + QString value; if(ui.WasEntered("KEYINDEX")) { int i = ui.GetInteger("KEYINDEX"); // Make sure they requested a value inside the range of the list if(key.Size() < i) { - string msg = "The value entered for [KEYINDEX] is out of the array "; + QString msg = "The value entered for [KEYINDEX] is out of the array "; msg += "bounds for the keyword [" + ui.GetString("KEYWORD") + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -92,17 +93,14 @@ void IsisMain() { if(key.Size() > 1) { ostringstream os; os << key; - IString temp = os.str(); - temp.Token("("); - value = temp.Token(")"); - value = value.ConvertWhiteSpace(); - value = value.Compress(); + QString temp = os.str().c_str(); + value = temp.mid(temp.indexOf("("), temp.indexOf(")" - temp.indexOf("("))).simplified(); } // Just get the keyword value since it isnt a list - else value = (string)key; + else value = (QString)key; } - if(ui.GetBoolean("UPPER")) value.UpCase(); + if(ui.GetBoolean("UPPER")) value = value.toUpper(); // Construct a label with the results PvlGroup results("Results"); @@ -121,7 +119,7 @@ void IsisMain() { //Helper function to output the input file to log. void helperButtonLog() { UserInterface &ui = Application::GetUserInterface(); - string file(ui.GetFileName("FROM")); + QString file(ui.GetFileName("FROM")); Pvl p; p.Read(file); Application::GuiLog(p); diff --git a/isis/src/base/apps/getsn/getsn.cpp b/isis/src/base/apps/getsn/getsn.cpp index fb0cc5e3c8..c4ef2681d1 100644 --- a/isis/src/base/apps/getsn/getsn.cpp +++ b/isis/src/base/apps/getsn/getsn.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include "Blob.h" #include "Cube.h" @@ -25,7 +25,7 @@ void IsisMain() { // Open the input cube UserInterface &ui = Application::GetUserInterface(); Cube cube; - string from = ui.GetFileName("FROM"); + QString from = ui.GetFileName("FROM"); cube.open(from, "r"); // Determine if output should be written base on parameters @@ -33,7 +33,7 @@ void IsisMain() { bool WriteSN = ui.GetBoolean("SN"); bool WriteObservation = ui.GetBoolean("OBSERVATION"); - string format = ui.GetString("FORMAT"); + QString format = ui.GetString("FORMAT"); bool pvl = true; if (format == "PVL") { pvl = true; @@ -42,7 +42,7 @@ void IsisMain() { pvl = false; } else { - string msg = "Invalid format string [" + format + "]"; + QString msg = "Invalid format QString [" + format + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -72,8 +72,8 @@ void IsisMain() { // Open in append or overwrite TextFile txt(ui.GetFileName("TO"), append ? "append" : "overwrite"); - // Build string - string line = ""; + // Build QString + QString line = ""; for (int i = 0; i < sn.Keywords(); i++) { if (i != 0) line += ","; diff --git a/isis/src/base/apps/gradient/gradient.cpp b/isis/src/base/apps/gradient/gradient.cpp index b41fa3dcfa..e1bc94720a 100644 --- a/isis/src/base/apps/gradient/gradient.cpp +++ b/isis/src/base/apps/gradient/gradient.cpp @@ -21,7 +21,7 @@ void IsisMain() { p.SetOutputCube("TO"); // Which gradient? - string gradType = ui.GetString("GRADTYPE"); + QString gradType = ui.GetString("GRADTYPE"); // Set boxcar size depending on the gradient type if(gradType == "SOBEL") { p.SetBoxcarSize(3, 3); diff --git a/isis/src/base/apps/grid/grid.cpp b/isis/src/base/apps/grid/grid.cpp index c0c0de1c55..d5aba087f1 100644 --- a/isis/src/base/apps/grid/grid.cpp +++ b/isis/src/base/apps/grid/grid.cpp @@ -40,7 +40,7 @@ void IsisMain() { Cube *icube = p.SetInputCube("FROM"); UserInterface &ui = Application::GetUserInterface(); - string mode = ui.GetString("MODE"); + QString mode = ui.GetString("MODE"); outline = ui.GetBoolean("OUTLINE"); ticks = ui.GetBoolean("TICKS"); @@ -52,7 +52,7 @@ void IsisMain() { lineWidth = ui.GetInteger("LINEWIDTH") / 2; - IString lval = IString::UpCase(ui.GetString("LINEVALUE")); + QString lval = ui.GetString("LINEVALUE").toUpper(); if (lval == "HRS") { lineValue = Isis::Hrs; } diff --git a/isis/src/base/apps/handmos/handmos.cpp b/isis/src/base/apps/handmos/handmos.cpp index cd26f2214c..084dc880c5 100644 --- a/isis/src/base/apps/handmos/handmos.cpp +++ b/isis/src/base/apps/handmos/handmos.cpp @@ -30,14 +30,14 @@ void IsisMain() { bool bTrack = ui.GetBoolean("TRACK"); p.SetTrackFlag(bTrack); - string inputFile = ui.GetAsString("FROM"); - string mosaicFile = ui.GetFileName("MOSAIC"); + QString inputFile = ui.GetAsString("FROM"); + QString mosaicFile = ui.GetFileName("MOSAIC"); // Set up the mosaic priority, either the input cube will be // placed ontop of the mosaic or beneath it ProcessMosaic::ImageOverlay overlay = ProcessMosaic::StringToOverlay( ui.GetString("PRIORITY")); - string sType; + QString sType; if (overlay == ProcessMosaic::UseBandPlacementCriteria) { if (ui.GetString("TYPE") == "BANDNUMBER") { diff --git a/isis/src/base/apps/hist/hist.cpp b/isis/src/base/apps/hist/hist.cpp index a70c2d9d6d..2745121e6b 100644 --- a/isis/src/base/apps/hist/hist.cpp +++ b/isis/src/base/apps/hist/hist.cpp @@ -1,6 +1,6 @@ #include "Isis.h" -#include +#include #include #include "Process.h" @@ -46,12 +46,12 @@ void IsisMain() { // Write the results if(!ui.WasEntered("TO")) { - string msg = "The [TO] parameter must be entered"; + QString msg = "The [TO] parameter must be entered"; throw IException(IException::User, msg, _FILEINFO_); } - string outfile = ui.GetFileName("TO"); + QString outfile = ui.GetFileName("TO"); ofstream fout; - fout.open(outfile.c_str()); + fout.open(outfile.toAscii().data()); fout << "Cube: " << ui.GetFileName("FROM") << endl; fout << "Band: " << icube->getBandCount() << endl; @@ -98,7 +98,7 @@ void IsisMain() { // If we are in gui mode, create a histogram plot if(ui.IsInteractive()) { // Set the title for the dialog - string title; + QString title; if(ui.WasEntered("TITLE")) { title = ui.GetString("TITLE"); } @@ -108,25 +108,25 @@ void IsisMain() { // Create the QHistogram, set the title & load the Isis::Histogram into it - HistogramPlotWindow *plot = new HistogramPlotWindow(title.c_str(), + HistogramPlotWindow *plot = new HistogramPlotWindow(title.toAscii().data(), ui.TheGui()); // Set the xaxis title if they entered one if(ui.WasEntered("XAXIS")) { - string xaxis(ui.GetString("XAXIS")); - plot->setAxisLabel(QwtPlot::xBottom, xaxis.c_str()); + QString xaxis(ui.GetString("XAXIS")); + plot->setAxisLabel(QwtPlot::xBottom, xaxis.toAscii().data()); } // Set the yLeft axis title if they entered one if(ui.WasEntered("FREQAXIS")) { - string yaxis(ui.GetString("FREQAXIS")); - plot->setAxisLabel(QwtPlot::yRight, yaxis.c_str()); + QString yaxis(ui.GetString("FREQAXIS")); + plot->setAxisLabel(QwtPlot::yRight, yaxis.toAscii().data()); } // Set the yRight axis title if they entered one if(ui.WasEntered("PERCENTAXIS")) { - string y2axis(ui.GetString("PERCENTAXIS")); - plot->setAxisLabel(QwtPlot::yLeft, y2axis.c_str()); + QString y2axis(ui.GetString("PERCENTAXIS")); + plot->setAxisLabel(QwtPlot::yLeft, y2axis.toAscii().data()); } //Transfer data from histogram to the plotcurve diff --git a/isis/src/base/apps/ifft/ifft.cpp b/isis/src/base/apps/ifft/ifft.cpp index c3e775cf29..4f74ad9b66 100644 --- a/isis/src/base/apps/ifft/ifft.cpp +++ b/isis/src/base/apps/ifft/ifft.cpp @@ -11,8 +11,8 @@ void IFFT1(vector &in, vector &out); void IFFT2(vector &in, vector &out); FourierTransform fft; -string tmpMagFileName = "Temporary_IFFT_Magnitude.cub"; -string tmpPhaseFileName = "Temporary_IFFT_Phase.cub"; +QString tmpMagFileName = "Temporary_IFFT_Magnitude.cub"; +QString tmpPhaseFileName = "Temporary_IFFT_Phase.cub"; void IsisMain() { // We will be processing by line first @@ -75,8 +75,8 @@ void IsisMain() { sProc.ProcessCubes(&IFFT1); sProc.Finalize(); - remove(tmpMagFileName.c_str()); - remove(tmpPhaseFileName.c_str()); + remove(tmpMagFileName.toAscii().data()); + remove(tmpPhaseFileName.toAscii().data()); } // Processing routine for the inverse fft diff --git a/isis/src/base/apps/interestcube/interestcube.cpp b/isis/src/base/apps/interestcube/interestcube.cpp index 80b2e6febd..04fc3f9d91 100644 --- a/isis/src/base/apps/interestcube/interestcube.cpp +++ b/isis/src/base/apps/interestcube/interestcube.cpp @@ -36,13 +36,13 @@ void IsisMain() { PvlGroup &op = pvl.FindGroup("Operator", Pvl::Traverse); boxcarSamples = op["Samples"]; boxcarLines = op["Lines"]; - op["DeltaLine"] = 0; - op["DeltaSamp"] = 0; - op["MinimumInterest"] = 0.0; + op["DeltaLine"] = "0"; + op["DeltaSamp"] = "0"; + op["MinimumInterest"] = "0.0"; Application::Log(op); } catch(IException &e) { - std::string msg = "Improper format for InterestOperator PVL [" + pvl.FileName() + "]"; + QString msg = "Improper format for InterestOperator PVL [" + pvl.FileName() + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/isis2ascii/isis2ascii.cpp b/isis/src/base/apps/isis2ascii/isis2ascii.cpp index 9e10e4dc1c..190b83cb73 100644 --- a/isis/src/base/apps/isis2ascii/isis2ascii.cpp +++ b/isis/src/base/apps/isis2ascii/isis2ascii.cpp @@ -19,8 +19,8 @@ void IsisMain() { // Open output text file UserInterface &ui = Application::GetUserInterface(); - string to = ui.GetFileName("TO", "txt"); - fout.open(to.c_str()); + QString to = ui.GetFileName("TO", "txt"); + fout.open(to.toAscii().data()); // Print header if needed if(ui.GetBoolean("HEADER")) { diff --git a/isis/src/base/apps/isis2fits/isis2fits.cpp b/isis/src/base/apps/isis2fits/isis2fits.cpp index d874097e3c..1732df591f 100644 --- a/isis/src/base/apps/isis2fits/isis2fits.cpp +++ b/isis/src/base/apps/isis2fits/isis2fits.cpp @@ -21,9 +21,9 @@ using namespace Isis; // Global variables int headerBytes = 0; -string FitsKeyword(string keyword, bool isVal, Isis::IString value, Isis::IString unit = ""); +QString FitsKeyword(QString keyword, bool isVal, QString value, QString unit = ""); -string WritePvl(string fitsKey, string group, IString key, Cube *icube, bool isString); +QString WritePvl(QString fitsKey, QString group, IString key, Cube *icube, bool isString); // Main program void IsisMain() { @@ -40,12 +40,12 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); // specify the bits per pixel - string bitpix; + QString bitpix; if(ui.GetString("BITTYPE") == "8BIT") bitpix = "8"; else if(ui.GetString("BITTYPE") == "16BIT") bitpix = "16"; else if(ui.GetString("BITTYPE") == "32BIT") bitpix = "-32"; else { - string msg = "Pixel type of [" + ui.GetString("BITTYPE") + "] is unsupported"; + QString msg = "Pixel type of [" + ui.GetString("BITTYPE") + "] is unsupported"; throw IException(IException::User, msg, _FILEINFO_); } @@ -57,8 +57,8 @@ void IsisMain() { // determine core base and multiplier, set up the stretch PvlGroup pix = icube->getLabel()->FindObject("IsisCube").FindObject("Core").FindGroup("Pixels"); - double scale = pix["Multiplier"][0].ToDouble(); - double base = pix["Base"][0].ToDouble(); + double scale = toDouble(pix["Multiplier"][0]); + double base = toDouble(pix["Base"][0]); if(ui.GetString("STRETCH") != "NONE" && bitpix != "-32") { if(ui.GetString("STRETCH") == "LINEAR") { @@ -85,7 +85,7 @@ void IsisMain() { ////////////////////////////////////////// // Write the minimal fits header // ////////////////////////////////////////// - string header; + QString header; // specify that this file conforms to simple fits standard header += FitsKeyword("SIMPLE", true, "T"); @@ -100,21 +100,21 @@ void IsisMain() { axes = 3; } - header += FitsKeyword("NAXIS", true, IString(axes)); + header += FitsKeyword("NAXIS", true, toString(axes)); // specify the limit on data axis 1 (number of samples) - header += FitsKeyword("NAXIS1", true, IString(icube->getSampleCount())); + header += FitsKeyword("NAXIS1", true, toString(icube->getSampleCount())); // specify the limit on data axis 2 (number of lines) - header += FitsKeyword("NAXIS2", true, IString(icube->getLineCount())); + header += FitsKeyword("NAXIS2", true, toString(icube->getLineCount())); if(axes == 3) { - header += FitsKeyword("NAXIS3", true, IString(icube->getBandCount())); + header += FitsKeyword("NAXIS3", true, toString(icube->getBandCount())); } - header += FitsKeyword("BZERO", true, base); + header += FitsKeyword("BZERO", true, toString(base)); - header += FitsKeyword("BSCALE", true, scale); + header += FitsKeyword("BSCALE", true, toString(scale)); // Sky and All cases if(ui.GetString("INFO") == "SKY" || ui.GetString("INFO") == "ALL") { @@ -123,7 +123,7 @@ void IsisMain() { if(icube->hasGroup("mapping")) { map = icube->getGroup("mapping"); - msg = (string)map["targetname"]; + msg = (QString)map["targetname"]; } // If we have sky we want it if(msg == "Sky") { @@ -135,10 +135,10 @@ void IsisMain() { midDec = ((double)map["MaximumLatitude"] + (double)map["MinimumLatitude"]) / 2; - header += FitsKeyword("OBJCTRA", true, IString(midRa)); + header += FitsKeyword("OBJCTRA", true, toString(midRa)); // Specify the Declination - header += FitsKeyword("OBJCTDEC", true, IString(midDec)); + header += FitsKeyword("OBJCTDEC", true, toString(midDec)); } @@ -174,16 +174,16 @@ void IsisMain() { for(int i = header.length() % 2880 ; i < 2880 ; i++) header += " "; // open the cube for writing - string to = ui.GetFileName("TO", "fits"); + QString to = ui.GetFileName("TO", "fits"); ofstream fout; - fout.open(to.c_str(), ios::out | ios::binary); + fout.open(to.toAscii().data(), ios::out | ios::binary); if(!fout.is_open()) { - string msg = "Cannot open fits output file"; + QString msg = "Cannot open fits output file"; throw IException(IException::Programmer, msg, _FILEINFO_); } fout.seekp(0); - fout.write(header.c_str(), header.length()); + fout.write(header.toAscii().data(), header.length()); // write the raw cube data p.StartProcess(fout); @@ -198,7 +198,7 @@ void IsisMain() { p.EndProcess(); } -string FitsKeyword(string key, bool isValue, Isis::IString value, Isis::IString unit) { +QString FitsKeyword(QString key, bool isValue, QString value, QString unit) { // pad the keyword with space for(int i = key.length() ; i < 8 ; i++) key += " "; @@ -234,14 +234,14 @@ string FitsKeyword(string key, bool isValue, Isis::IString value, Isis::IString return key; } -string WritePvl(string fitsKey, string group, IString key, Cube *icube, bool isString) { +QString WritePvl(QString fitsKey, QString group, IString key, Cube *icube, bool isString) { if(icube->hasGroup(group)) { PvlGroup theGroup = icube->getGroup(group); - IString name = (string)theGroup[key]; + QString name = (QString)theGroup[key]; if(isString) { name = "'" + name + "'"; } - IString unit = theGroup[key].Unit(); + QString unit = theGroup[key].Unit(); return FitsKeyword(fitsKey, true, name, unit); } return NULL; diff --git a/isis/src/base/apps/isis2gml/isis2gml.cpp b/isis/src/base/apps/isis2gml/isis2gml.cpp index 280cc375e2..a67250e4d6 100644 --- a/isis/src/base/apps/isis2gml/isis2gml.cpp +++ b/isis/src/base/apps/isis2gml/isis2gml.cpp @@ -24,17 +24,17 @@ void IsisMain() { geos::geom::MultiPolygon *mPolygon = poly.Polys(); - std::string polyString; + QString polyString; if(ui.WasEntered("LABEL")) { - string fid = ui.GetString("LABEL"); + QString fid = ui.GetString("LABEL"); polyString = PolygonTools::ToGML(mPolygon, fid); } else { polyString = PolygonTools::ToGML(mPolygon); } - string outfile; + QString outfile; ofstream fout; if(ui.WasEntered("TO")) { outfile = ui.GetFileName("TO"); @@ -45,7 +45,7 @@ void IsisMain() { inputFile.addExtension("gml"); outfile = inputFile.name(); } - fout.open(outfile.c_str()); + fout.open(outfile.toAscii().data()); fout << polyString << endl; diff --git a/isis/src/base/apps/isis2pds/isis2pds.cpp b/isis/src/base/apps/isis2pds/isis2pds.cpp index 15653ab392..c2a2a668c4 100644 --- a/isis/src/base/apps/isis2pds/isis2pds.cpp +++ b/isis/src/base/apps/isis2pds/isis2pds.cpp @@ -69,8 +69,8 @@ void IsisMain() { p.StandardPdsLabel(ProcessExportPds::Image); FileName outFile(ui.GetFileName("TO", "img")); - string outFileName(outFile.expanded()); - ofstream oCube(outFileName.c_str()); + QString outFileName(outFile.expanded()); + ofstream oCube(outFileName.toAscii().data()); p.OutputLabel(oCube); p.StartProcess(oCube); oCube.close(); @@ -78,13 +78,13 @@ void IsisMain() { //Records what it did to the print.prt file PvlGroup results("DNs Used"); - results += PvlKeyword("Null", p.OutputNull()); - results += PvlKeyword("LRS", p.OutputLrs()); - results += PvlKeyword("LIS", p.OutputLis()); - results += PvlKeyword("HIS", p.OutputHis()); - results += PvlKeyword("HRS", p.OutputHrs()); - results += PvlKeyword("ValidMin", min); - results += PvlKeyword("ValidMax", max); + results += PvlKeyword("Null", toString(p.OutputNull())); + results += PvlKeyword("LRS", toString(p.OutputLrs())); + results += PvlKeyword("LIS", toString(p.OutputLis())); + results += PvlKeyword("HIS", toString(p.OutputHis())); + results += PvlKeyword("HRS", toString(p.OutputHrs())); + results += PvlKeyword("ValidMin", toString(min)); + results += PvlKeyword("ValidMax", toString(max)); Application::Log(results); return; diff --git a/isis/src/base/apps/isis2raw/isis2raw.cpp b/isis/src/base/apps/isis2raw/isis2raw.cpp index 5d7f3e38ce..4a189aa382 100644 --- a/isis/src/base/apps/isis2raw/isis2raw.cpp +++ b/isis/src/base/apps/isis2raw/isis2raw.cpp @@ -75,9 +75,9 @@ void IsisMain() { else if(ui.GetString("ENDIAN") == "LSB") p.SetOutputEndian(Isis::Lsb); // Open the cube for writing - string to = ui.GetFileName("TO", "raw"); + QString to = ui.GetFileName("TO", "raw"); ofstream fout; - fout.open(to.c_str(), ios::out | ios::binary); + fout.open(to.toAscii().data(), ios::out | ios::binary); if(!fout.is_open()) { string msg = "Cannot open raw output file"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -100,13 +100,13 @@ void IsisMain() { // Records what output values were used, then sends it to the print.prt file // as well as the terminal. PvlGroup results("DNs Used"); - results += PvlKeyword("Null", p.OutputNull()); - results += PvlKeyword("LRS", p.OutputLrs()); - results += PvlKeyword("LIS", p.OutputLis()); - results += PvlKeyword("HIS", p.OutputHis()); - results += PvlKeyword("HRS", p.OutputHrs()); - results += PvlKeyword("ValidMin", min); - results += PvlKeyword("ValidMax", max); + results += PvlKeyword("Null", toString(p.OutputNull())); + results += PvlKeyword("LRS", toString(p.OutputLrs())); + results += PvlKeyword("LIS", toString(p.OutputLis())); + results += PvlKeyword("HIS", toString(p.OutputHis())); + results += PvlKeyword("HRS", toString(p.OutputHrs())); + results += PvlKeyword("ValidMin", toString(min)); + results += PvlKeyword("ValidMax", toString(max)); Application::Log(results); return; @@ -116,7 +116,7 @@ void IsisMain() { void checkRange(UserInterface &ui, double &min, double &max) { if(ui.WasEntered("OMIN")) { if(ui.GetDouble("OMIN") < min) { - string message = "OMIN [" + IString(min) + "] is too small for the provided BITTYPE ["; + QString message = "OMIN [" + toString(min) + "] is too small for the provided BITTYPE ["; message += ui.GetString("BITTYPE") + "]"; throw IException(IException::User, message, _FILEINFO_); } @@ -126,7 +126,7 @@ void checkRange(UserInterface &ui, double &min, double &max) { } if(ui.WasEntered("OMAX")) { if(ui.GetDouble("OMAX") > max) { - string message = "OMAX [" + IString(max) + "] is too large for the provided BITTYPE ["; + QString message = "OMAX [" + toString(max) + "] is too large for the provided BITTYPE ["; message += ui.GetString("BITTYPE") + "]"; throw IException(IException::User, message, _FILEINFO_); } diff --git a/isis/src/base/apps/isis2std/isis2std.cpp b/isis/src/base/apps/isis2std/isis2std.cpp index 513b803929..9fdf6059d3 100644 --- a/isis/src/base/apps/isis2std/isis2std.cpp +++ b/isis/src/base/apps/isis2std/isis2std.cpp @@ -8,15 +8,15 @@ using namespace Isis; -int addChannel(ExportDescription &desc, IString param, IString mode); +int addChannel(ExportDescription &desc, QString param, QString mode); void addResults(PvlGroup &results, ImageExporter *exporter, - IString channel, int index); + QString channel, int index); void IsisMain() { UserInterface &ui = Application::GetUserInterface(); - IString format = ui.GetString("FORMAT"); + QString format = ui.GetString("FORMAT"); ImageExporter *exporter = ImageExporter::fromFormat(format); ExportDescription desc; @@ -32,7 +32,7 @@ void IsisMain() { int blueIndex = -1; int alphaIndex = -1; - IString mode = ui.GetString("MODE"); + QString mode = ui.GetString("MODE"); if (mode == "GRAYSCALE") { addChannel(desc, "FROM", mode); exporter->setGrayscale(desc); @@ -93,14 +93,14 @@ void IsisMain() { } -int addChannel(ExportDescription &desc, IString param, IString mode) { +int addChannel(ExportDescription &desc, QString param, QString mode) { UserInterface &ui = Application::GetUserInterface(); FileName name = ui.GetFileName(param); CubeAttributeInput &att = ui.GetInputAttribute(param); int index = -1; if (mode != "GRAYSCALE" && ui.GetString("STRETCH") == "MANUAL") { - IString bandId = param.substr(0, 1); + QString bandId = param.mid(0, 1); double min = ui.GetDouble(bandId + "MIN"); double max = ui.GetDouble(bandId + "MAX"); @@ -115,11 +115,11 @@ int addChannel(ExportDescription &desc, IString param, IString mode) { void addResults(PvlGroup &results, ImageExporter *exporter, - IString channel, int index) { + QString channel, int index) { results += PvlKeyword( - channel + "InputMinimum", exporter->getInputMinimum(index)); + channel + "InputMinimum", toString(exporter->getInputMinimum(index))); results += PvlKeyword( - channel + "InputMaximum", exporter->getInputMaximum(index)); + channel + "InputMaximum", toString(exporter->getInputMaximum(index))); } diff --git a/isis/src/base/apps/kernfilter/kernfilter.cpp b/isis/src/base/apps/kernfilter/kernfilter.cpp index 7a149176f4..e7b62de993 100644 --- a/isis/src/base/apps/kernfilter/kernfilter.cpp +++ b/isis/src/base/apps/kernfilter/kernfilter.cpp @@ -56,7 +56,7 @@ void IsisMain() { // Iterate through the input kernel's data values to fill the coefs array for(int i = 0 ; i < kern["data"].Size() ; i ++) { - coefs.push_back(kern["data"][i]); + coefs.push_back(toDouble(kern["data"][i])); } // Weight for multiplication of resultant immidately before completion diff --git a/isis/src/base/apps/lineeq/lineeq.cpp b/isis/src/base/apps/lineeq/lineeq.cpp index 5dc820e15f..7cd9d6b034 100644 --- a/isis/src/base/apps/lineeq/lineeq.cpp +++ b/isis/src/base/apps/lineeq/lineeq.cpp @@ -45,8 +45,8 @@ void IsisMain() { } PvlGroup data("lineeq"); - data += PvlKeyword("BoxcarSize", boxcarSize, "lines"); - data += PvlKeyword("OutputCsv", ui.GetBoolean("AVERAGES")); + data += PvlKeyword("BoxcarSize", toString(boxcarSize), "lines"); + data += PvlKeyword("OutputCsv", toString((int)ui.GetBoolean("AVERAGES"))); TextFile *csvOutput = NULL; if(ui.GetBoolean("AVERAGES")) { @@ -84,7 +84,7 @@ void IsisMain() { double filteredLine = filter.Average(line); if(csvOutput != NULL) { - csvOutput->PutLine((IString)lineAverages[band][line] + (IString)"," + (IString)filteredLine); + csvOutput->PutLine(toString(lineAverages[band][line]) + (QString)"," + toString(filteredLine)); } lineAverages[band][line] = filteredLine; diff --git a/isis/src/base/apps/makecube/makecube.cpp b/isis/src/base/apps/makecube/makecube.cpp index a7133b23da..8722ceafa1 100644 --- a/isis/src/base/apps/makecube/makecube.cpp +++ b/isis/src/base/apps/makecube/makecube.cpp @@ -46,7 +46,7 @@ void IsisMain() { // Get the value to put in the cube UserInterface &ui = Application::GetUserInterface(); - string pixels = ui.GetString("PIXELS"); + QString pixels = ui.GetString("PIXELS"); double value = Null; if(pixels == "NULL") { diff --git a/isis/src/base/apps/makeflat/makeflat.cpp b/isis/src/base/apps/makeflat/makeflat.cpp index aa0e7520eb..634585778b 100644 --- a/isis/src/base/apps/makeflat/makeflat.cpp +++ b/isis/src/base/apps/makeflat/makeflat.cpp @@ -27,7 +27,7 @@ bool Excluded(int fileNum, int frameletNum, double &stdev); // This method populates the framelet exclusion list given // a cube. *Uses currImage. -bool CheckFramelets(string progress, Cube &theCube); +bool CheckFramelets(QString progress, Cube &theCube); // This method resets the global variables for another run void ResetGlobals(); @@ -303,8 +303,8 @@ void IsisMain() { // entire images, and push frame framelet exclusion stats can not be collected // during pass 2 cleanly if((cameraType == Framing || cameraType == PushFrame) && imageValid) { - string prog = "Calculating Standard Deviation " + IString((int)currImage + 1) + "/"; - prog += IString((int)inList.size()) + " (" + inList[currImage].name() + ")"; + QString prog = "Calculating Standard Deviation " + toString((int)currImage + 1) + "/"; + prog += toString((int)inList.size()) + " (" + inList[currImage].name() + ")"; if(cameraType == Framing) { Statistics *stats = tmp.getStatistics(1, prog); @@ -355,7 +355,7 @@ void IsisMain() { * found a legitimate cube. */ if(numOutputSamples <= 0) { - string msg = "No valid input cubes were found"; + QString msg = "No valid input cubes were found"; throw IException(IException::User, msg, _FILEINFO_); } @@ -364,7 +364,7 @@ void IsisMain() { * the input cubes, then we havent found any valid data. */ if(tempFileLength <= 0) { - string msg = "No valid input data was found"; + QString msg = "No valid input data was found"; throw IException(IException::User, msg, _FILEINFO_); } @@ -374,7 +374,7 @@ void IsisMain() { ocube = new Cube(); ocube->setDimensions(numOutputSamples, tempFileLength, 2); PvlGroup &prefs = Preference::Preferences().FindGroup("DataDirectory", Pvl::Traverse); - IString outTmpName = (string)prefs["Temporary"][0] + "/"; + QString outTmpName = (QString)prefs["Temporary"][0] + "/"; outTmpName += FileName(ui.GetFileName("TO")).baseName() + ".tmp.cub"; ocube->create(outTmpName); oLineMgr = new LineManager(*ocube); @@ -398,13 +398,13 @@ void IsisMain() { PvlObject currFile("Exclusions"); currFile += PvlKeyword("FileName", inList[currImage].toString()); - currFile += PvlKeyword("Tolerance", maxStdev); + currFile += PvlKeyword("Tolerance", toString(maxStdev)); if(cameraType == LineScan) { - currFile += PvlKeyword("FrameLines", numFrameLines); + currFile += PvlKeyword("FrameLines", toString(numFrameLines)); } else if(cameraType == PushFrame) { - currFile += PvlKeyword("FrameletLines", numFrameLines); + currFile += PvlKeyword("FrameletLines", toString(numFrameLines)); } excludedDetails.push_back(currFile); @@ -421,8 +421,8 @@ void IsisMain() { } p.SetInputCube(inList[currImage].toString(), inAtt); - IString progText = "Calculating Averages " + IString((int)currImage + 1); - progText += "/" + IString((int)inList.size()); + QString progText = "Calculating Averages " + toString((int)currImage + 1); + progText += "/" + toString((int)inList.size()); progText += " (" + inList[currImage].name() + ")"; p.Progress()->SetText(progText); @@ -518,7 +518,7 @@ void IsisMain() { excludeFile.Write(FileName(ui.GetFileName("EXCLUDE")).expanded()); } - remove(outTmpName.c_str()); + remove(outTmpName.toAscii().data()); // Clean up settings ResetGlobals(); @@ -565,7 +565,7 @@ void ResetGlobals() { * * @return bool True if the file contains a valid framelet */ -bool CheckFramelets(string progress, Cube &theCube) { +bool CheckFramelets(QString progress, Cube &theCube) { bool foundValidFramelet = false; LineManager mgr(theCube); Progress prog; @@ -665,11 +665,11 @@ void CreateTemporaryData(Buffer &in) { // Record the exclusion PvlGroup currExclusion("ExcludedLines"); - currExclusion += PvlKeyword("FrameStartLine", IString(in.Line())); - currExclusion += PvlKeyword("ValidPixels", IString(inputFrameStats.ValidPixels())); + currExclusion += PvlKeyword("FrameStartLine", toString(in.Line())); + currExclusion += PvlKeyword("ValidPixels", toString(inputFrameStats.ValidPixels())); if(!IsSpecial(inputFrameStats.StandardDeviation())) - currExclusion += PvlKeyword("StandardDeviation", inputFrameStats.StandardDeviation()); + currExclusion += PvlKeyword("StandardDeviation", toString(inputFrameStats.StandardDeviation())); else currExclusion += PvlKeyword("StandardDeviation", "N/A"); @@ -713,12 +713,12 @@ void CreateTemporaryData(Buffer &in) { if(excluded && ((in.Line() - 1) % numFrameLines == 0)) { PvlGroup currExclusion("ExcludedFramelet"); - currExclusion += PvlKeyword("FrameletStartLine", IString(in.Line())); - currExclusion += PvlKeyword("FrameletNumber", (in.Line() - 1) / numFrameLines); + currExclusion += PvlKeyword("FrameletStartLine", toString(in.Line())); + currExclusion += PvlKeyword("FrameletNumber", toString((in.Line() - 1) / numFrameLines)); if(!IsSpecial(stdev)) { currExclusion += PvlKeyword("StandardDeviation", - stdev); + toString(stdev)); } else { currExclusion += PvlKeyword("StandardDeviation", diff --git a/isis/src/base/apps/map2map/map2map.cpp b/isis/src/base/apps/map2map/map2map.cpp index f0662f04dd..237b95ca5b 100644 --- a/isis/src/base/apps/map2map/map2map.cpp +++ b/isis/src/base/apps/map2map/map2map.cpp @@ -12,8 +12,8 @@ using namespace Isis; void PrintMap(); void LoadMapRange(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["PrintMap"] = (void *) PrintMap; helper ["LoadMapRange"] = (void *) LoadMapRange; return helper; @@ -58,19 +58,19 @@ void IsisMain() { // Deal with user overrides entered in the GUI. Do this by changing the user's mapping group, which // will then overlay anything in the output mapping group. if(ui.WasEntered("MINLAT") && !ui.GetBoolean("MATCHMAP")) { - userMappingGrp.AddKeyword(PvlKeyword("MinimumLatitude", ui.GetDouble("MINLAT")), Pvl::Replace); + userMappingGrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(ui.GetDouble("MINLAT"))), Pvl::Replace); } if(ui.WasEntered("MAXLAT") && !ui.GetBoolean("MATCHMAP")) { - userMappingGrp.AddKeyword(PvlKeyword("MaximumLatitude", ui.GetDouble("MAXLAT")), Pvl::Replace); + userMappingGrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(ui.GetDouble("MAXLAT"))), Pvl::Replace); } if(ui.WasEntered("MINLON") && !ui.GetBoolean("MATCHMAP")) { - userMappingGrp.AddKeyword(PvlKeyword("MinimumLongitude", ui.GetDouble("MINLON")), Pvl::Replace); + userMappingGrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(ui.GetDouble("MINLON"))), Pvl::Replace); } if(ui.WasEntered("MAXLON") && !ui.GetBoolean("MATCHMAP")) { - userMappingGrp.AddKeyword(PvlKeyword("MaximumLongitude", ui.GetDouble("MAXLON")), Pvl::Replace); + userMappingGrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(ui.GetDouble("MAXLON"))), Pvl::Replace); } /** @@ -82,7 +82,7 @@ void IsisMain() { */ bool sameDirection = true; if(userMappingGrp.HasKeyword("LongitudeDirection")) { - if(((string)userMappingGrp["LongitudeDirection"]).compare(fromMappingGrp["LongitudeDirection"]) != 0) { + if(((QString)userMappingGrp["LongitudeDirection"]).compare(fromMappingGrp["LongitudeDirection"]) != 0) { sameDirection = false; } } @@ -93,8 +93,8 @@ void IsisMain() { double minLon = outMappingGrp["MinimumLongitude"]; double maxLon = outMappingGrp["MaximumLongitude"]; - outMappingGrp["MaximumLongitude"] = minLon; - outMappingGrp["MinimumLongitude"] = maxLon; + outMappingGrp["MaximumLongitude"] = toString(minLon); + outMappingGrp["MinimumLongitude"] = toString(maxLon); } if(ui.GetString("PIXRES").compare("FROM") == 0 && !ui.GetBoolean("MATCHMAP")) { @@ -153,7 +153,7 @@ void IsisMain() { userMappingGrp.DeleteKeyword("PixelResolution"); } - outMappingGrp.AddKeyword(PvlKeyword("PixelResolution", ui.GetDouble("RESOLUTION"), "meters/pixel"), Pvl::Replace); + outMappingGrp.AddKeyword(PvlKeyword("PixelResolution", toString(ui.GetDouble("RESOLUTION")), "meters/pixel"), Pvl::Replace); } else if(ui.GetString("PIXRES").compare("PPD") == 0) { // Resolution specified - delete all and add to outMappingGrp @@ -181,7 +181,7 @@ void IsisMain() { userMappingGrp.DeleteKeyword("PixelResolution"); } - outMappingGrp.AddKeyword(PvlKeyword("Scale", ui.GetDouble("RESOLUTION"), "pixels/degree"), Pvl::Replace); + outMappingGrp.AddKeyword(PvlKeyword("Scale", toString(ui.GetDouble("RESOLUTION")), "pixels/degree"), Pvl::Replace); } // Rotation will NOT Propagate @@ -218,13 +218,13 @@ void IsisMain() { for(int index = 0; index < longitudes.Keywords(); index ++) { if(!userMappingGrp.HasKeyword(longitudes[index].Name())) { // use the from domain because that's where our values are coming from - if(((string)userMappingGrp["LongitudeDirection"]).compare("PositiveEast") == 0) { - outMappingGrp[longitudes[index].Name()] = - Projection::ToPositiveEast(outMappingGrp[longitudes[index].Name()], outMappingGrp["LongitudeDomain"]); + if(((QString)userMappingGrp["LongitudeDirection"]).compare("PositiveEast") == 0) { + outMappingGrp[longitudes[index].Name()] = toString( + Projection::ToPositiveEast(outMappingGrp[longitudes[index].Name()], outMappingGrp["LongitudeDomain"])); } else { - outMappingGrp[longitudes[index].Name()] = - Projection::ToPositiveWest(outMappingGrp[longitudes[index].Name()], outMappingGrp["LongitudeDomain"]); + outMappingGrp[longitudes[index].Name()] = toString( + Projection::ToPositiveWest(outMappingGrp[longitudes[index].Name()], outMappingGrp["LongitudeDomain"])); } } } @@ -238,10 +238,10 @@ void IsisMain() { for(int index = 0; index < longitudes.Keywords(); index ++) { if(!userMappingGrp.HasKeyword(longitudes[index].Name())) { if((int)userMappingGrp["LongitudeDomain"] == 180) { - outMappingGrp[longitudes[index].Name()] = Projection::To180Domain(outMappingGrp[longitudes[index].Name()]); + outMappingGrp[longitudes[index].Name()] = toString(Projection::To180Domain(outMappingGrp[longitudes[index].Name()])); } else { - outMappingGrp[longitudes[index].Name()] = Projection::To360Domain(outMappingGrp[longitudes[index].Name()]); + outMappingGrp[longitudes[index].Name()] = toString(Projection::To360Domain(outMappingGrp[longitudes[index].Name()])); } } } @@ -251,23 +251,23 @@ void IsisMain() { // Third, planetographic/planetocentric if(userMappingGrp.HasKeyword("LatitudeType")) { // user set a new domain? - if(((string)userMappingGrp["LatitudeType"]).compare(fromMappingGrp["LatitudeType"]) != 0) { // new lat type different? + if(((QString)userMappingGrp["LatitudeType"]).compare(fromMappingGrp["LatitudeType"]) != 0) { // new lat type different? PvlGroup latitudes = inproj->MappingLatitudes(); for(int index = 0; index < latitudes.Keywords(); index ++) { if(!userMappingGrp.HasKeyword(latitudes[index].Name())) { - if(((string)userMappingGrp["LatitudeType"]).compare("Planetographic") == 0) { - outMappingGrp[latitudes[index].Name()] = Projection::ToPlanetographic( + if(((QString)userMappingGrp["LatitudeType"]).compare("Planetographic") == 0) { + outMappingGrp[latitudes[index].Name()] = toString(Projection::ToPlanetographic( (double)fromMappingGrp[latitudes[index].Name()], (double)fromMappingGrp["EquatorialRadius"], - (double)fromMappingGrp["PolarRadius"]); + (double)fromMappingGrp["PolarRadius"])); } else { - outMappingGrp[latitudes[index].Name()] = Projection::ToPlanetocentric( + outMappingGrp[latitudes[index].Name()] = toString(Projection::ToPlanetocentric( (double)fromMappingGrp[latitudes[index].Name()], (double)fromMappingGrp["EquatorialRadius"], - (double)fromMappingGrp["PolarRadius"]); + (double)fromMappingGrp["PolarRadius"])); } } } @@ -279,19 +279,19 @@ void IsisMain() { if ((double)outMappingGrp["MinimumLongitude"] >= (double)outMappingGrp["MaximumLongitude"]) { - if ((string)outMappingGrp["MinimumLongitude"] == "180.0" && + if ((QString)outMappingGrp["MinimumLongitude"] == "180.0" && (int)userMappingGrp["LongitudeDomain"] == 180) outMappingGrp["MinimumLongitude"] = "-180"; - if ((string)outMappingGrp["MaximumLongitude"] == "-180.0" && + if ((QString)outMappingGrp["MaximumLongitude"] == "-180.0" && (int)userMappingGrp["LongitudeDomain"] == 180) outMappingGrp["MaximumLongitude"] = "180"; - if ((string)outMappingGrp["MinimumLongitude"] == "360.0" && + if ((QString)outMappingGrp["MinimumLongitude"] == "360.0" && (int)userMappingGrp["LongitudeDomain"] == 360) outMappingGrp["MinimumLongitude"] = "0"; - if ((string)outMappingGrp["MaximumLongitude"] == "0.0" && + if ((QString)outMappingGrp["MaximumLongitude"] == "0.0" && (int)userMappingGrp["LongitudeDomain"] == 360) outMappingGrp["MaximumLongitude"] = "360"; } @@ -299,7 +299,7 @@ void IsisMain() { // If MinLon/MaxLon out of order, we weren't able to calculate the correct values if((double)outMappingGrp["MinimumLongitude"] >= (double)outMappingGrp["MaximumLongitude"]) { if(!ui.WasEntered("MINLON") || !ui.WasEntered("MAXLON")) { - string msg = "Unable to determine the correct [MinimumLongitude,MaximumLongitude]."; + QString msg = "Unable to determine the correct [MinimumLongitude,MaximumLongitude]."; msg += " Please specify these values in the [MINLON,MAXLON] parameters"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -361,7 +361,7 @@ void IsisMain() { interp = new Interpolator(Interpolator::CubicConvolutionType); } else { - string msg = "Unknow value for INTERP [" + ui.GetString("INTERP") + "]"; + QString msg = "Unknow value for INTERP [" + ui.GetString("INTERP") + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -514,7 +514,7 @@ void LoadMapRange() { // Longitude conversions first if(userMapping.HasKeyword("LongitudeDirection")) { - if(((string)userMapping["LongitudeDirection"]).compare(fromMapping["LongitudeDirection"]) != 0) { + if(((QString)userMapping["LongitudeDirection"]).compare(fromMapping["LongitudeDirection"]) != 0) { double minLon = fromMapping["MinimumLongitude"]; double maxLon = fromMapping["MaximumLongitude"]; int domain = fromMapping["LongitudeDomain"]; @@ -523,39 +523,39 @@ void LoadMapRange() { domain = userMapping["LongitudeDomain"]; } - if((string)userMapping["LongitudeDirection"] == "PositiveEast") { - fromMapping["MaximumLongitude"] = Projection::ToPositiveEast(minLon, domain); - fromMapping["MinimumLongitude"] = Projection::ToPositiveEast(maxLon, domain); + if((QString)userMapping["LongitudeDirection"] == "PositiveEast") { + fromMapping["MaximumLongitude"] = toString(Projection::ToPositiveEast(minLon, domain)); + fromMapping["MinimumLongitude"] = toString(Projection::ToPositiveEast(maxLon, domain)); } - else if((string)userMapping["LongitudeDirection"] == "PositiveWest") { - fromMapping["MaximumLongitude"] = Projection::ToPositiveWest(minLon, domain); - fromMapping["MinimumLongitude"] = Projection::ToPositiveWest(maxLon, domain); + else if((QString)userMapping["LongitudeDirection"] == "PositiveWest") { + fromMapping["MaximumLongitude"] = toString(Projection::ToPositiveWest(minLon, domain)); + fromMapping["MinimumLongitude"] = toString(Projection::ToPositiveWest(maxLon, domain)); } } } // Latitude conversions now if(userMapping.HasKeyword("LatitudeType")) { // user set a new domain? - if(((string)userMapping["LatitudeType"]).compare(fromMapping["LatitudeType"]) != 0) { // new lat type different? - if(((string)userMapping["LatitudeType"]).compare("Planetographic") == 0) { - fromMapping["MinimumLatitude"] = Projection::ToPlanetographic( + if(((QString)userMapping["LatitudeType"]).compare(fromMapping["LatitudeType"]) != 0) { // new lat type different? + if(((QString)userMapping["LatitudeType"]).compare("Planetographic") == 0) { + fromMapping["MinimumLatitude"] = toString(Projection::ToPlanetographic( (double)fromMapping["MinimumLatitude"], (double)fromMapping["EquatorialRadius"], - (double)fromMapping["PolarRadius"]); - fromMapping["MaximumLatitude"] = Projection::ToPlanetographic( + (double)fromMapping["PolarRadius"])); + fromMapping["MaximumLatitude"] = toString(Projection::ToPlanetographic( (double)fromMapping["MaximumLatitude"], (double)fromMapping["EquatorialRadius"], - (double)fromMapping["PolarRadius"]); + (double)fromMapping["PolarRadius"])); } else { - fromMapping["MinimumLatitude"] = Projection::ToPlanetocentric( + fromMapping["MinimumLatitude"] = toString(Projection::ToPlanetocentric( (double)fromMapping["MinimumLatitude"], (double)fromMapping["EquatorialRadius"], - (double)fromMapping["PolarRadius"]); - fromMapping["MaximumLatitude"] = Projection::ToPlanetocentric( + (double)fromMapping["PolarRadius"])); + fromMapping["MaximumLatitude"] = toString(Projection::ToPlanetocentric( (double)fromMapping["MaximumLatitude"], (double)fromMapping["EquatorialRadius"], - (double)fromMapping["PolarRadius"]); + (double)fromMapping["PolarRadius"])); } } } diff --git a/isis/src/base/apps/mapgrid/mapgrid.cpp b/isis/src/base/apps/mapgrid/mapgrid.cpp index dd76b7e1a3..f0ba611832 100644 --- a/isis/src/base/apps/mapgrid/mapgrid.cpp +++ b/isis/src/base/apps/mapgrid/mapgrid.cpp @@ -32,7 +32,7 @@ void IsisMain() { double lonInc = ui.GetDouble("LONINCREMENT"); // Get mapfile, add values for range and create projection - string mapFile = ui.GetFileName("MAPFILE"); + QString mapFile = ui.GetFileName("MAPFILE"); Pvl p(mapFile); PvlGroup &mapping = p.FindGroup("Mapping", Pvl::Traverse); @@ -52,26 +52,26 @@ void IsisMain() { mapping.DeleteKeyword("MaximumLongitude"); } - mapping += PvlKeyword("MinimumLatitude", latStart); - mapping += PvlKeyword("MaximumLatitude", latEnd); - mapping += PvlKeyword("MinimumLongitude", lonStart); - mapping += PvlKeyword("MaximumLongitude", lonEnd); + mapping += PvlKeyword("MinimumLatitude", toString(latStart)); + mapping += PvlKeyword("MaximumLatitude", toString(latEnd)); + mapping += PvlKeyword("MinimumLongitude", toString(lonStart)); + mapping += PvlKeyword("MaximumLongitude", toString(lonEnd)); Projection *proj; try { proj = ProjectionFactory::Create(p); } catch(IException &e) { - string msg = "Cannot create grid - MapFile [" + mapFile + - "] does not contain necessary information to create a projection"; + QString msg = "Cannot create grid - MapFile [" + mapFile + + "] does not contain necessary information to create a projection"; throw IException(e, IException::User, msg, _FILEINFO_); } // Write grid to well known text output - string out = FileName(ui.GetFileName("TO")).expanded(); + QString out = FileName(ui.GetFileName("TO")).expanded(); std::ofstream os; - os.open(out.c_str(), std::ios::out); + os.open(out.toAscii().data(), std::ios::out); // Display the progress...10% 20% etc. Progress prog; diff --git a/isis/src/base/apps/maplab/maplab.cpp b/isis/src/base/apps/maplab/maplab.cpp index 29a9b8a268..a1592d074f 100644 --- a/isis/src/base/apps/maplab/maplab.cpp +++ b/isis/src/base/apps/maplab/maplab.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include #include -#include +#include #include "Pvl.h" #include "Cube.h" #include "History.h" @@ -27,25 +27,25 @@ void IsisMain() { // Error checking to ensure the map projection file provided contains // information pertaining to a target, body radius, and longitude direction if(!mapGrp.HasKeyword("TargetName")) { - string msg = "The given MAP [" + userMap.Name() + - "] does not have the TargetName keyword."; + QString msg = "The given MAP [" + userMap.Name() + + "] does not have the TargetName keyword."; throw IException(IException::User, msg, _FILEINFO_); } else if(!mapGrp.HasKeyword("EquatorialRadius") || !mapGrp.HasKeyword("PolarRadius")) { - string msg = "The given MAP [" + userMap.Name() + - "] does not have the EquatorialRadius and PolarRadius keywords."; + QString msg = "The given MAP [" + userMap.Name() + + "] does not have the EquatorialRadius and PolarRadius keywords."; throw IException(IException::User, msg, _FILEINFO_); } else if(!mapGrp.HasKeyword("LongitudeDomain")) { - string msg = "The given MAP [" + userMap.Name() + - "] does not have the LongitudeDomain keyword."; + QString msg = "The given MAP [" + userMap.Name() + + "] does not have the LongitudeDomain keyword."; throw IException(IException::User, msg, _FILEINFO_); } // Get user entered option - string option = ui.GetString("COORDINATES"); + QString option = ui.GetString("COORDINATES"); double x = 0.0; double y = 0.0; @@ -60,7 +60,7 @@ void IsisMain() { y = proj->YCoord(); } else { - string message = "Invalid option [" + option + "] for parameter COORDINATES"; + QString message = "Invalid option [" + option + "] for parameter COORDINATES"; throw IException(IException::User, message, _FILEINFO_); } @@ -78,7 +78,7 @@ void IsisMain() { res = (2.0 * Isis::PI * localRadius) / (360.0 * scale); } else { - string msg = "The given MAP[" + userMap.Name() + + QString msg = "The given MAP[" + userMap.Name() + "] does not have the PixelResolution or Scale keywords."; throw IException(IException::User, msg, _FILEINFO_); } @@ -90,14 +90,14 @@ void IsisMain() { y = y + res * (line - 0.5); //add origen values to Mapping Group - mapGrp.AddKeyword(PvlKeyword("UpperLeftCornerX", x, "meters"), Pvl::Replace); - mapGrp.AddKeyword(PvlKeyword("UpperLeftCornerY", y, "meters"), Pvl::Replace); + mapGrp.AddKeyword(PvlKeyword("UpperLeftCornerX", toString(x), "meters"), Pvl::Replace); + mapGrp.AddKeyword(PvlKeyword("UpperLeftCornerY", toString(y), "meters"), Pvl::Replace); if(!mapGrp.HasKeyword("PixelResolution")) { - mapGrp.AddKeyword(PvlKeyword("PixelResolution", res, "meters")); + mapGrp.AddKeyword(PvlKeyword("PixelResolution", toString(res), "meters")); } if(!mapGrp.HasKeyword("Scale")) { - mapGrp.AddKeyword(PvlKeyword("Scale", scale, "pixels/degree")); + mapGrp.AddKeyword(PvlKeyword("Scale", toString(scale), "pixels/degree")); } diff --git a/isis/src/base/apps/mapmos/mapmos.cpp b/isis/src/base/apps/mapmos/mapmos.cpp index 39b8afe676..cbdfacf12b 100644 --- a/isis/src/base/apps/mapmos/mapmos.cpp +++ b/isis/src/base/apps/mapmos/mapmos.cpp @@ -22,7 +22,7 @@ void IsisMain() { m.SetTrackFlag(bTrack); // Gets the input file along with attributes - string sInputFile = ui.GetAsString("FROM"); + QString sInputFile = ui.GetAsString("FROM"); ProcessMosaic::ImageOverlay overlay = ProcessMosaic::StringToOverlay( ui.GetString("PRIORITY")); @@ -54,10 +54,10 @@ void IsisMain() { PvlGroup mapGroup = inCube.getLabel()->FindGroup("Mapping", Pvl::Traverse); inCube.close(); - mapGroup.AddKeyword(PvlKeyword("MinimumLatitude", ui.GetDouble("MINLAT")), Pvl::Replace); - mapGroup.AddKeyword(PvlKeyword("MaximumLatitude", ui.GetDouble("MAXLAT")), Pvl::Replace); - mapGroup.AddKeyword(PvlKeyword("MinimumLongitude", ui.GetDouble("MINLON")), Pvl::Replace); - mapGroup.AddKeyword(PvlKeyword("MaximumLongitude", ui.GetDouble("MAXLON")), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("MinimumLatitude", toString(ui.GetDouble("MINLAT"))), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("MaximumLatitude", toString(ui.GetDouble("MAXLAT"))), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("MinimumLongitude", toString(ui.GetDouble("MINLON"))), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("MaximumLongitude", toString(ui.GetDouble("MAXLON"))), Pvl::Replace); CubeAttributeOutput oAtt = ui.GetOutputAttribute("MOSAIC"); diff --git a/isis/src/base/apps/mappt/mappt.cpp b/isis/src/base/apps/mappt/mappt.cpp index c61d10230c..a014d2656b 100644 --- a/isis/src/base/apps/mappt/mappt.cpp +++ b/isis/src/base/apps/mappt/mappt.cpp @@ -2,7 +2,7 @@ #include "Isis.h" -#include +#include #include #include "Brick.h" @@ -19,8 +19,8 @@ using namespace Isis; void PrintMap(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["PrintMap"] = (void *) PrintMap; return helper; } @@ -50,8 +50,8 @@ void IsisMain() { // Make sure we have a valid latitude value if(fabs(lat) > 90.0) { - string msg = "Invalid value for LATITUDE [" - + IString(lat) + "] outside range of "; + QString msg = "Invalid value for LATITUDE [" + + toString(lat) + "] outside range of "; msg += "[-90,90]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -79,7 +79,7 @@ void IsisMain() { // Does it exist? if(!mapFile.fileExists()) { - string msg = "Filename [" + ui.GetFileName("MAP") + "] does not exist"; + QString msg = "Filename [" + ui.GetFileName("MAP") + "] does not exist"; throw IException(IException::User, msg, _FILEINFO_); } @@ -144,35 +144,35 @@ void IsisMain() { PvlGroup results("Results"); results += PvlKeyword("Filename", FileName(ui.GetFileName("FROM")).expanded()); - results += PvlKeyword("Sample", proj->WorldX()); - results += PvlKeyword("Line", proj->WorldY()); + results += PvlKeyword("Sample", toString(proj->WorldX())); + results += PvlKeyword("Line", toString(proj->WorldY())); results += PvlKeyword("PixelValue", PixelToString(b[0])); - results += PvlKeyword("X", proj->XCoord()); - results += PvlKeyword("Y", proj->YCoord()); + results += PvlKeyword("X", toString(proj->XCoord())); + results += PvlKeyword("Y", toString(proj->YCoord())); // Put together all the keywords for different coordinate systems. PvlKeyword centLat = - PvlKeyword("PlanetocentricLatitude", proj->UniversalLatitude()); + PvlKeyword("PlanetocentricLatitude", toString(proj->UniversalLatitude())); PvlKeyword graphLat = PvlKeyword("PlanetographicLatitude", - proj->ToPlanetographic(proj->UniversalLatitude())); + toString(proj->ToPlanetographic(proj->UniversalLatitude()))); PvlKeyword pE360 = - PvlKeyword("PositiveEast360Longitude", proj->UniversalLongitude()); + PvlKeyword("PositiveEast360Longitude", toString(proj->UniversalLongitude())); PvlKeyword pW360 = PvlKeyword("PositiveWest360Longitude", - proj->ToPositiveWest(proj->UniversalLongitude(), 360)); + toString(proj->ToPositiveWest(proj->UniversalLongitude(), 360))); PvlKeyword pE180 = PvlKeyword("PositiveEast180Longitude", - proj->To180Domain(proj->UniversalLongitude())); + toString(proj->To180Domain(proj->UniversalLongitude()))); PvlKeyword pW180 = PvlKeyword("PositiveWest180Longitude", - proj->To180Domain(proj->ToPositiveEast( - proj->UniversalLongitude(), 360))); + toString(proj->To180Domain(proj->ToPositiveEast( + proj->UniversalLongitude(), 360)))); // Input map coordinate system location // Latitude @@ -245,7 +245,7 @@ void IsisMain() { // Write an output label file if necessary if(ui.WasEntered("TO")) { // Get user params from ui - string outFile = FileName(ui.GetFileName("TO")).expanded(); + QString outFile = FileName(ui.GetFileName("TO")).expanded(); bool exists = FileName(outFile).fileExists(); bool append = ui.GetBoolean("APPEND"); @@ -267,13 +267,13 @@ void IsisMain() { ofstream os; bool writeHeader = false; if(append) { - os.open(outFile.c_str(), ios::app); + os.open(outFile.toAscii().data(), ios::app); if(!exists) { writeHeader = true; } } else { - os.open(outFile.c_str(), ios::out); + os.open(outFile.toAscii().data(), ios::out); writeHeader = true; } @@ -289,7 +289,7 @@ void IsisMain() { } for(int i = 0; i < results.Keywords(); i++) { - os << (string)results[i]; + os << (QString)results[i]; if(i < results.Keywords() - 1) { os << ","; @@ -299,12 +299,12 @@ void IsisMain() { } } else if(ui.GetString("FORMAT") == "FLAT") { - string msg = "Flat file must have a name."; + QString msg = "Flat file must have a name."; throw IException(IException::User, msg, _FILEINFO_); } } else { - string msg = "Could not project requested position"; + QString msg = "Could not project requested position"; throw IException(IException::Unknown, msg, _FILEINFO_); } } diff --git a/isis/src/base/apps/mapsize/mapsize.cpp b/isis/src/base/apps/mapsize/mapsize.cpp index 089e11a1ff..5d1121df2f 100644 --- a/isis/src/base/apps/mapsize/mapsize.cpp +++ b/isis/src/base/apps/mapsize/mapsize.cpp @@ -45,14 +45,14 @@ void IsisMain() { // Create a label and log it PvlGroup results("Results"); results += PvlKeyword("Map", ui.GetFileName("MAP")); - results += PvlKeyword("Scale", scale); - results += PvlKeyword("Width", width, "inches"); - results += PvlKeyword("Height", height, "inches"); - results += PvlKeyword("Samples", samples); - results += PvlKeyword("Lines", lines); - results += PvlKeyword("RealSize", ((Isis::BigInt)lines * samples * 4) / 1024.0, "KB"); - results += PvlKeyword("SignedWordSize", ((Isis::BigInt)lines * samples * 2) / 1024.0, "KB"); - results += PvlKeyword("UnsignedByteSize", ((Isis::BigInt)lines * samples) / 1024.0, "KB"); + results += PvlKeyword("Scale", toString(scale)); + results += PvlKeyword("Width", toString(width), "inches"); + results += PvlKeyword("Height", toString(height), "inches"); + results += PvlKeyword("Samples", toString(samples)); + results += PvlKeyword("Lines", toString(lines)); + results += PvlKeyword("RealSize", toString(((Isis::BigInt)lines * samples * 4) / 1024.0), "KB"); + results += PvlKeyword("SignedWordSize", toString(((Isis::BigInt)lines * samples * 2) / 1024.0), "KB"); + results += PvlKeyword("UnsignedByteSize", toString(((Isis::BigInt)lines * samples) / 1024.0), "KB"); Application::Log(results); // Write the output file if requested diff --git a/isis/src/base/apps/maptemplate/maptemplate.cpp b/isis/src/base/apps/maptemplate/maptemplate.cpp index 2a75668b07..6df7a7047f 100644 --- a/isis/src/base/apps/maptemplate/maptemplate.cpp +++ b/isis/src/base/apps/maptemplate/maptemplate.cpp @@ -39,8 +39,8 @@ void helperButtonLogRadius(); void helperButtonCalcRange(); double helperButtonCalcResolution(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonLogMap"] = (void *) helperButtonLogMap; helper ["helperButtonLoadMap"] = (void *) helperButtonLoadMap; helper ["helperButtonLogTargDef"] = (void *) helperButtonLogTargDef; @@ -64,7 +64,7 @@ void IsisMain() { // user didnt enter an extension UserInterface &ui = Application::GetUserInterface(); FileName out = ui.GetFileName("MAP"); - string output = ui.GetFileName("MAP"); + QString output = ui.GetFileName("MAP"); if(out.extension() == "") { output += ".map"; } @@ -76,12 +76,12 @@ void IsisMain() { //Helper function to output map file to log. void helperButtonLogMap() { UserInterface &ui = Application::GetUserInterface(); - string mapFile(ui.GetFileName("MAP")); + QString mapFile(ui.GetFileName("MAP")); Pvl p; p.Read(mapFile); PvlGroup t = p.FindGroup("mapping", Pvl::Traverse); - string Ostring = "***** Output of [" + mapFile + "] *****"; - Application::GuiLog(Ostring); + QString OQString = "***** Output of [" + mapFile + "] *****"; + Application::GuiLog(OQString); Application::GuiLog(t); } //...........end of helper function LogMap ........ @@ -89,7 +89,7 @@ void helperButtonLogMap() { //Helper 2 function to update GUI with map file values. void helperButtonLoadMap() { UserInterface &ui = Application::GetUserInterface(); - string mapFile(ui.GetFileName("MAP")); + QString mapFile(ui.GetFileName("MAP")); Pvl p; p.Read(mapFile); PvlGroup t = p.FindGroup("mapping", Pvl::Traverse); @@ -104,8 +104,8 @@ void helperButtonLoadMap() { ui.Clear("PROT"); if(t.HasKeyword("ProjectionName")) { - IString projIn = (string)t["ProjectionName"]; - projIn.UpCase(); + QString projIn = (QString)t["ProjectionName"]; + projIn = projIn.toUpper(); ui.Clear("PROJECTION"); ui.PutAsString("PROJECTION", projIn); } @@ -151,7 +151,7 @@ void helperButtonLoadMap() { } //Target Parameters stuff - string use = "IMAGE"; + QString use = "IMAGE"; ui.Clear("TARGOPT"); ui.PutAsString("TARGOPT", use); ui.Clear("TARGDEF"); @@ -162,31 +162,31 @@ void helperButtonLoadMap() { ui.Clear("POLRADIUS"); if(t.HasKeyword("TargetName")) { - string use = "USER"; + QString use = "USER"; ui.Clear("TARGOPT"); ui.PutAsString("TARGOPT", use); - string tNameIn = t["TargetName"]; + QString tNameIn = t["TargetName"]; ui.Clear("TARGETNAME"); ui.PutAsString("TARGETNAME", tNameIn); - IString LTIn = (string)t["LatitudeType"]; - LTIn.UpCase(); + QString LTIn = (QString)t["LatitudeType"]; + LTIn = LTIn.toUpper(); ui.Clear("LATTYPE"); ui.PutAsString("LATTYPE", LTIn); - IString LDIn = (string)t["LongitudeDirection"]; - LDIn.UpCase(); + QString LDIn = (QString)t["LongitudeDirection"]; + LDIn = LDIn.toUpper(); ui.Clear("LONDIR"); ui.PutAsString("LONDIR", LDIn); - string LDomIn = t["LongitudeDomain"]; + QString LDomIn = t["LongitudeDomain"]; ui.Clear("LONDOM"); ui.PutAsString("LONDOM", LDomIn); - string EQIn = t["EquatorialRadius"]; + QString EQIn = t["EquatorialRadius"]; ui.Clear("EQRADIUS"); ui.PutAsString("EQRADIUS", EQIn); - string PRIn = t["PolarRadius"]; + QString PRIn = t["PolarRadius"]; ui.Clear("POLRADIUS"); ui.PutAsString("POLRADIUS", PRIn); } @@ -195,13 +195,13 @@ void helperButtonLoadMap() { ui.Clear("MAXLAT"); ui.Clear("MINLON"); ui.Clear("MAXLON"); - string useR = "IMAGE"; + QString useR = "IMAGE"; ui.Clear("RNGOPT"); ui.PutAsString("RNGOPT", useR); if(t.HasKeyword("MinimumLatitude")) { double minlatIn = t["MinimumLatitude"]; - string useR = "USER"; + QString useR = "USER"; ui.Clear("RNGOPT"); ui.PutAsString("RNGOPT", useR); ui.Clear("MINLAT"); @@ -218,7 +218,7 @@ void helperButtonLoadMap() { } //Resolution Parameter stuff if(t.HasKeyword("PixelResolution")) { - string useM = "MPP"; + QString useM = "MPP"; ui.Clear("RESOPT"); ui.PutAsString("RESOPT", useM); double pixresIn = t["PixelResolution"]; @@ -226,7 +226,7 @@ void helperButtonLoadMap() { ui.PutDouble("RESOLUTION", pixresIn); } if(t.HasKeyword("Scale")) { - string useM = "PPD"; + QString useM = "PPD"; ui.Clear("RESOPT"); ui.PutAsString("RESOPT", useM); double Mscale = t["Scale"]; @@ -239,12 +239,12 @@ void helperButtonLoadMap() { //helper function to output targdef to log void helperButtonLogTargDef() { UserInterface &ui = Application::GetUserInterface(); - string targetFile(ui.GetFileName("TARGDEF")); + QString targetFile(ui.GetFileName("TARGDEF")); Pvl p; p.Read(targetFile); PvlGroup t = p.FindGroup("mapping", Pvl::Traverse); - string Ostring = "***** Output of [" + targetFile + "] *****"; - Application::GuiLog(Ostring); + QString OQString = "***** Output of [" + targetFile + "] *****"; + Application::GuiLog(OQString); Application::GuiLog(t); } //------------End Helper function to display targdef info to log ----- @@ -252,45 +252,45 @@ void helperButtonLogTargDef() { //helper function to load target def. to GUI void helperButtonLoadTargDef() { UserInterface &ui = Application::GetUserInterface(); - string targetFile(ui.GetFileName("TARGDEF")); + QString targetFile(ui.GetFileName("TARGDEF")); // test if targdef was entered Pvl p; p.Read(targetFile); PvlGroup t = p.FindGroup("mapping", Pvl::Traverse); //Load the targdef values into the GUI - string tOpt = "USER"; + QString tOpt = "USER"; ui.Clear("TARGOPT"); ui.PutAsString("TARGOPT", tOpt); if(t.HasKeyword("TargetName")) { - string tNameIn = t["TargetName"]; + QString tNameIn = t["TargetName"]; ui.Clear("TARGETNAME"); ui.PutAsString("TARGETNAME", tNameIn); } if(t.HasKeyword("LatitudeType")) { - IString LTIn = (string)t["LatitudeType"]; - LTIn.UpCase(); + QString LTIn = (QString)t["LatitudeType"]; + LTIn = LTIn.toUpper(); ui.Clear("LATTYPE"); ui.PutAsString("LATTYPE", LTIn); } if(t.HasKeyword("LongitudeDirection")) { - IString LDIn = (string)t["LongitudeDirection"]; - LDIn.UpCase(); + QString LDIn = (QString)t["LongitudeDirection"]; + LDIn = LDIn.toUpper(); ui.Clear("LONDIR"); ui.PutAsString("LONDIR", LDIn); } if(t.HasKeyword("LongitudeDomain")) { - string LDomIn = t["LongitudeDomain"]; + QString LDomIn = t["LongitudeDomain"]; ui.Clear("LONDOM"); ui.PutAsString("LONDOM", LDomIn); } if(t.HasKeyword("EquatorialRadius")) { - string EQIn = t["EquatorialRadius"]; + QString EQIn = t["EquatorialRadius"]; ui.Clear("EQRADIUS"); ui.PutAsString("EQRADIUS", EQIn); } if(t.HasKeyword("PolarRadius")) { - string PRIn = t["PolarRadius"]; + QString PRIn = t["PolarRadius"]; ui.Clear("POLRADIUS"); ui.PutAsString("POLRADIUS", PRIn); } @@ -300,14 +300,14 @@ void helperButtonLoadTargDef() { //Helper function to show system radius in log. void helperButtonLogRadius() { UserInterface &ui = Application::GetUserInterface(); - IString targetName = ui.GetString("TARGETNAME"); + QString targetName = ui.GetString("TARGETNAME"); Pvl tMap; //call function to get system radius PvlGroup tGrp = Projection::TargetRadii(targetName); tMap.AddGroup(tGrp); - string Ostring = "***** System radii for " + targetName + "*****"; -//writh to log string(Ostring and mapping group - Application::GuiLog(Ostring); + QString OQString = "***** System radii for " + targetName + "*****"; +//writh to log QString(OQString and mapping group + Application::GuiLog(OQString); Application::GuiLog(tMap); } //-----------end ot log radius helper function--------- @@ -322,7 +322,7 @@ void helperButtonCalcRange() { // Run the function calcRange of calculate range info calcRange(minLat, maxLat, minLon, maxLon); // Write ranges to the GUI - string use = "USER"; + QString use = "USER"; ui.Clear("RNGOPT"); ui.PutAsString("RNGOPT", use); ui.Clear("MINLAT"); @@ -342,7 +342,7 @@ double helperButtonCalcResolution() { // Call calcResolution which will return a double double Res = calcResolution(); //update the GUI with the new resolution - string resUse = "MPP"; + QString resUse = "MPP"; ui.Clear("RESOPT"); ui.PutAsString("RESOPT", resUse); ui.Clear("RESOLUTION"); @@ -354,9 +354,9 @@ double helperButtonCalcResolution() { // Function to Add the projection information to the Mapping PVL void addProject(PvlGroup &mapping) { UserInterface &ui = Application::GetUserInterface(); - IString projName = ui.GetString("PROJECTION"); + QString projName = ui.GetString("PROJECTION"); //setup a look up table for projection names - map projLUT; + map projLUT; projLUT ["SINUSOIDAL"] = "Sinusoidal"; projLUT ["MERCATOR"] = "Mercator"; projLUT ["TRANSVERSEMERCATOR"] = "TransverseMercator"; @@ -371,35 +371,35 @@ void addProject(PvlGroup &mapping) { mapping += PvlKeyword("ProjectionName", projLUT[projName]); if(ui.WasEntered("CLON")) { double clonOut = ui.GetDouble("CLON"); - mapping += PvlKeyword("CenterLongitude", clonOut); + mapping += PvlKeyword("CenterLongitude", toString(clonOut)); } if(ui.WasEntered("CLAT")) { double clatOut = ui.GetDouble("CLAT"); - mapping += PvlKeyword("CenterLatitude", clatOut); + mapping += PvlKeyword("CenterLatitude", toString(clatOut)); } if(ui.WasEntered("SCALEFACTOR")) { double scaleFactorOut = ui.GetDouble("SCALEFACTOR"); - mapping += PvlKeyword("ScaleFactor", scaleFactorOut); + mapping += PvlKeyword("ScaleFactor", toString(scaleFactorOut)); } if(ui.WasEntered("PAR1")) { double par1 = ui.GetDouble("PAR1"); - mapping += PvlKeyword("FirstStandardParallel", par1); + mapping += PvlKeyword("FirstStandardParallel", toString(par1)); } if(ui.WasEntered("PAR2")) { double par2 = ui.GetDouble("PAR2"); - mapping += PvlKeyword("SecondStandardParallel", par2); + mapping += PvlKeyword("SecondStandardParallel", toString(par2)); } if(ui.WasEntered("PLAT")) { double plat = ui.GetDouble("PLAT"); - mapping += PvlKeyword("PoleLatitude", plat); + mapping += PvlKeyword("PoleLatitude", toString(plat)); } if(ui.WasEntered("PLON")) { double plon = ui.GetDouble("PLON"); - mapping += PvlKeyword("PoleLongitude", plon); + mapping += PvlKeyword("PoleLongitude", toString(plon)); } if(ui.WasEntered("PROT")) { double prot = ui.GetDouble("PROT"); - mapping += PvlKeyword("PoleRotation", prot); + mapping += PvlKeyword("PoleRotation", toString(prot)); } } @@ -407,7 +407,7 @@ void addProject(PvlGroup &mapping) { void addTarget(PvlGroup &mapping) { UserInterface &ui = Application::GetUserInterface(); if(ui.GetString("TARGOPT") == "SYSTEM") { - string targetFile(ui.GetFileName("TARGDEF")); + QString targetFile(ui.GetFileName("TARGDEF")); Pvl p; p.Read(targetFile); PvlGroup t = p.FindGroup("mapping"); @@ -430,7 +430,7 @@ void addTarget(PvlGroup &mapping) { // if TARGOPT is user and no radii enter the run TargetRadii to get // the system radii for target name. else if(ui.GetString("TARGOPT") == "USER") { - IString targetName = ui.GetString("TARGETNAME"); + QString targetName = ui.GetString("TARGETNAME"); PvlGroup grp = Projection::TargetRadii(targetName); double equatorialRad = grp["EquatorialRadius"]; double polarRad = grp["PolarRadius"]; @@ -441,25 +441,25 @@ void addTarget(PvlGroup &mapping) { if(ui.WasEntered("POLRADIUS")) { polarRad = ui.GetDouble("POLRADIUS"); } - IString latType = ui.GetString("LATTYPE"); + QString latType = ui.GetString("LATTYPE"); if(latType == "PLANETOCENTRIC") { latType = "Planetocentric"; } else if(latType == "PLANETOGRAPHIC") { latType = "Planetographic"; } - IString lonDir = ui.GetString("LONDIR"); + QString lonDir = ui.GetString("LONDIR"); if(lonDir == "POSITIVEEAST") { lonDir = "PositiveEast"; } else if(lonDir == "POSITIVEWEST") { lonDir = "PositiveWest"; } - IString lonDom = ui.GetString("LONDOM"); + QString lonDom = ui.GetString("LONDOM"); //Add targdef values to the mapping pvl mapping += PvlKeyword("TargetName", targetName); - mapping += PvlKeyword("EquatorialRadius", equatorialRad, "meters"); - mapping += PvlKeyword("PolarRadius", polarRad, "meters"); + mapping += PvlKeyword("EquatorialRadius", toString(equatorialRad), "meters"); + mapping += PvlKeyword("PolarRadius", toString(polarRad), "meters"); mapping += PvlKeyword("LatitudeType", latType); mapping += PvlKeyword("LongitudeDirection", lonDir); mapping += PvlKeyword("LongitudeDomain", lonDom); @@ -472,13 +472,13 @@ void addRange(PvlGroup &mapping) { //Use the values that have been entered in the GUI if(ui.GetString("RNGOPT") == "USER") { double minLat = ui.GetDouble("MINLAT"); - mapping += PvlKeyword("MinimumLatitude", minLat); + mapping += PvlKeyword("MinimumLatitude", toString(minLat)); double maxLat = ui.GetDouble("MAXLAT"); - mapping += PvlKeyword("MaximumLatitude", maxLat); + mapping += PvlKeyword("MaximumLatitude", toString(maxLat)); double minLon = ui.GetDouble("MINLON"); - mapping += PvlKeyword("MinimumLongitude", minLon); + mapping += PvlKeyword("MinimumLongitude", toString(minLon)); double maxLon = ui.GetDouble("MAXLON"); - mapping += PvlKeyword("MaximumLongitude", maxLon); + mapping += PvlKeyword("MaximumLongitude", toString(maxLon)); } else if(ui.GetString("RNGOPT") == "CALC") { // calculate range values using function calcRange and fromlist @@ -488,10 +488,10 @@ void addRange(PvlGroup &mapping) { double maxLon; //Call calcRange to calculate min and max ground range values calcRange(minLat, maxLat, minLon, maxLon); - mapping += PvlKeyword("MinimumLatitude", minLat); - mapping += PvlKeyword("MaximumLatitude", maxLat); - mapping += PvlKeyword("MinimumLongitude", minLon); - mapping += PvlKeyword("MaximumLongitude", maxLon); + mapping += PvlKeyword("MinimumLatitude", toString(minLat)); + mapping += PvlKeyword("MaximumLatitude", toString(maxLat)); + mapping += PvlKeyword("MinimumLongitude", toString(minLon)); + mapping += PvlKeyword("MaximumLongitude", toString(maxLon)); } } @@ -501,16 +501,16 @@ void addResolution(PvlGroup &mapping) { UserInterface &ui = Application::GetUserInterface(); if(ui.GetString("RESOPT") == "PPD") { double res = ui.GetDouble("RESOLUTION"); - mapping += PvlKeyword("Scale", IString(res), "pixels/degree"); + mapping += PvlKeyword("Scale", toString(res), "pixels/degree"); } else if(ui.GetString("RESOPT") == "MPP") { double res = ui.GetDouble("RESOLUTION"); - mapping += PvlKeyword("PixelResolution", IString(res), "meters/pixel"); + mapping += PvlKeyword("PixelResolution", toString(res), "meters/pixel"); } else if(ui.GetString("RESOPT") == "CALC") { // run the function to calculate the resolution double Res = calcResolution(); - mapping += PvlKeyword("PixelResolution", Res, "meters/pixel"); + mapping += PvlKeyword("PixelResolution", toString(Res), "meters/pixel"); } } @@ -532,7 +532,7 @@ void calcRange(double &minLat, double &maxLat, } else if(ui.GetString("TARGOPT") == "USER") { userGrp += PvlKeyword("TargetName", ui.GetString("TARGETNAME")); - IString targetName = ui.GetString("TARGETNAME"); + QString targetName = ui.GetString("TARGETNAME"); PvlGroup grp = Projection::TargetRadii(targetName); double equatorialRad = grp["EquatorialRadius"]; double polarRad = grp["PolarRadius"]; @@ -545,24 +545,24 @@ void calcRange(double &minLat, double &maxLat, polarRad = ui.GetDouble("POLRADIUS"); } if(ui.GetString("LATTYPE") == "PLANETOCENTRIC") { - string latType = "Planetocentric"; + QString latType = "Planetocentric"; userGrp += PvlKeyword("LatitudeType", latType); } else if(ui.GetString("LATTYPE") == "PLANETOGRAPHIC") { - string latType = "Planetographic"; + QString latType = "Planetographic"; userGrp += PvlKeyword("LatitudeType", latType); } if(ui.GetString("LONDIR") == "POSITIVEEAST") { - string lonD = "PositiveEast"; + QString lonD = "PositiveEast"; userGrp += PvlKeyword("LongitudeDirection", lonD); } else if(ui.GetString("LONDIR") == "POSITIVEWEST") { - string lonD = "PositiveWest"; + QString lonD = "PositiveWest"; userGrp += PvlKeyword("LongitudeDirection", lonD); } userGrp += PvlKeyword("LongitudeDomain", ui.GetString("LONDOM")); - userGrp += PvlKeyword("EquatorialRadius", equatorialRad); - userGrp += PvlKeyword("PolarRadius", polarRad); + userGrp += PvlKeyword("EquatorialRadius", toString(equatorialRad)); + userGrp += PvlKeyword("PolarRadius", toString(polarRad)); userMap.AddGroup(userGrp); } diff --git a/isis/src/base/apps/maptrim/maptrim.cpp b/isis/src/base/apps/maptrim/maptrim.cpp index f741f50ef8..b03600b910 100644 --- a/isis/src/base/apps/maptrim/maptrim.cpp +++ b/isis/src/base/apps/maptrim/maptrim.cpp @@ -43,7 +43,7 @@ void IsisMain() { throw IException(IException::User, msg, _FILEINFO_); } - string mode = ui.GetString("MODE"); + QString mode = ui.GetString("MODE"); if(mode != "TRIM") { smallestLine = smallestSample = INT_MAX; @@ -58,7 +58,7 @@ void IsisMain() { int lines = biggestLine - smallestLine + 1; // Run external crop - string cropParams = ""; + QString cropParams = ""; cropParams += "from=\"" + ui.GetFileName("FROM") + "\""; if(mode == "CROP") { cropParams += " to=\"" + ui.GetAsString("TO") + "\""; @@ -67,16 +67,16 @@ void IsisMain() { cropParams += " to=TEMPORARYcropped.cub "; } - cropParams += " sample= " + IString(smallestSample); - cropParams += " nsamples= " + IString(samples); - cropParams += " line= " + IString(smallestLine); - cropParams += " nlines= " + IString(lines); + cropParams += " sample= " + toString(smallestSample); + cropParams += " nsamples= " + toString(samples); + cropParams += " line= " + toString(smallestLine); + cropParams += " nlines= " + toString(lines); try { ProgramLauncher::RunIsisProgram("crop", cropParams); } catch(IException &e) { - string msg = "Could not execute crop with params: [" + cropParams + "]"; + QString msg = "Could not execute crop with params: [" + cropParams + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } if(mode == "BOTH") { diff --git a/isis/src/base/apps/mask/mask.cpp b/isis/src/base/apps/mask/mask.cpp index 1ea34db31d..0d3f561c37 100644 --- a/isis/src/base/apps/mask/mask.cpp +++ b/isis/src/base/apps/mask/mask.cpp @@ -39,13 +39,13 @@ void IsisMain() { // Will we preserve inside or outside of min/max range preserve = INSIDE; - string Preserve; + QString Preserve; if(ui.WasEntered("PRESERVE")) Preserve = ui.GetString("PRESERVE"); if(Preserve == "OUTSIDE") preserve = OUTSIDE; // How are special pixels handled? spixels = NULLP; - string Spixels; + QString Spixels; if(ui.WasEntered("SPIXELS")) Spixels = ui.GetString("SPIXELS"); if(Spixels == "NONE") spixels = NONE; if(Spixels == "ALL") spixels = ALL; @@ -56,7 +56,7 @@ void IsisMain() { // Report if no masking occurred if(!masked) { - string message = "No mask was performed-the output file is the same as "; + QString message = "No mask was performed-the output file is the same as "; message += "the input file."; throw IException(IException::User, message, _FILEINFO_); } diff --git a/isis/src/base/apps/minmax/minmax.cpp b/isis/src/base/apps/minmax/minmax.cpp index 297c7d1a4b..eac92b9cd1 100644 --- a/isis/src/base/apps/minmax/minmax.cpp +++ b/isis/src/base/apps/minmax/minmax.cpp @@ -31,7 +31,7 @@ void IsisMain() { p.SetBoxcarSize(nSamples, nLines); // Set which filter is being used - string filterType = ui.GetString("FILTER"); + QString filterType = ui.GetString("FILTER"); if(filterType == "MIN") { p.StartProcess(minimumFilter); diff --git a/isis/src/base/apps/mosrange/mosrange.cpp b/isis/src/base/apps/mosrange/mosrange.cpp index e0cdc0756e..b70cb3f5c8 100644 --- a/isis/src/base/apps/mosrange/mosrange.cpp +++ b/isis/src/base/apps/mosrange/mosrange.cpp @@ -67,15 +67,15 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); flist.read(ui.GetFileName("FROMLIST")); if(flist.size() < 1) { - string msg = "The list file[" + ui.GetFileName("FROMLIST") + - " does not contain any filenames"; + QString msg = "The list file[" + ui.GetFileName("FROMLIST") + + " does not contain any filenames"; throw IException(IException::User, msg, _FILEINFO_); } - string projection("Equirectangular"); + QString projection("Equirectangular"); if(ui.WasEntered("MAP")) { Pvl mapfile(ui.GetFileName("MAP")); - projection = (string) mapfile.FindGroup("Mapping")["ProjectionName"]; + projection = (QString) mapfile.FindGroup("Mapping")["ProjectionName"]; } if(ui.WasEntered("PROJECTION")) { @@ -83,9 +83,9 @@ void IsisMain() { } // Gather other user inputs to projection - string lattype = ui.GetString("LATTYPE"); - string londir = ui.GetString("LONDIR"); - string londom = ui.GetString("LONDOM"); + QString lattype = ui.GetString("LATTYPE"); + QString londir = ui.GetString("LONDIR"); + QString londom = ui.GetString("LONDOM"); int digits = ui.GetInteger("PRECISION"); // Fix them for mapping group @@ -107,7 +107,7 @@ void IsisMain() { double eqRad; double poleRad; - string target("Unknown"); + QString target("Unknown"); for(int i = 0 ; i < flist.size() ; i++) { try { // Set the input image, get the camera model, and a basic mapping @@ -121,8 +121,8 @@ void IsisMain() { PvlObject fmap("File"); fmap += PvlKeyword("Name", flist[i].toString()); - fmap += PvlKeyword("Lines", lines); - fmap += PvlKeyword("Samples", samples); + fmap += PvlKeyword("Lines", toString(lines)); + fmap += PvlKeyword("Samples", toString(samples)); Camera *cam = cube.getCamera(); Pvl mapping; @@ -152,18 +152,18 @@ void IsisMain() { double pixres = (lowres + hires) / 2.0; double scale = Scale(pixres, poleRad, eqRad); - mapgrp.AddKeyword(PvlKeyword("PixelResolution", pixres), Pvl::Replace); - mapgrp.AddKeyword(PvlKeyword("Scale", scale, "pixels/degree"), Pvl::Replace); - mapgrp += PvlKeyword("MinPixelResolution", lowres, "meters"); - mapgrp += PvlKeyword("MaxPixelResolution", hires, "meters"); + mapgrp.AddKeyword(PvlKeyword("PixelResolution", toString(pixres)), Pvl::Replace); + mapgrp.AddKeyword(PvlKeyword("Scale", toString(scale), "pixels/degree"), Pvl::Replace); + mapgrp += PvlKeyword("MinPixelResolution", toString(lowres), "meters"); + mapgrp += PvlKeyword("MaxPixelResolution", toString(hires), "meters"); // Get the universal ground range double minlat, maxlat, minlon, maxlon; cam->GroundRange(minlat, maxlat, minlon, maxlon, mapping); - mapgrp.AddKeyword(PvlKeyword("MinimumLatitude", minlat), Pvl::Replace); - mapgrp.AddKeyword(PvlKeyword("MaximumLatitude", maxlat), Pvl::Replace); - mapgrp.AddKeyword(PvlKeyword("MinimumLongitude", minlon), Pvl::Replace); - mapgrp.AddKeyword(PvlKeyword("MaximumLongitude", maxlon), Pvl::Replace); + mapgrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(minlat)), Pvl::Replace); + mapgrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(maxlat)), Pvl::Replace); + mapgrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(minlon)), Pvl::Replace); + mapgrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(maxlon)), Pvl::Replace); fmap.AddGroup(mapgrp); fileset.AddObject(fmap); @@ -174,7 +174,7 @@ void IsisMain() { latitudeStat.AddData(&maxlat, 1); } catch(IException &ie) { - string mess = "Problems with file " + flist[i].toString() + "\n" + + QString mess = "Problems with file " + flist[i].toString() + "\n" + ie.what(); throw IException(IException::User, mess, _FILEINFO_); } @@ -194,30 +194,30 @@ void IsisMain() { mapping += PvlKeyword("ProjectionName", projection); mapping += PvlKeyword("TargetName", target); - mapping += PvlKeyword("EquatorialRadius", eqRad, "meters"); - mapping += PvlKeyword("PolarRadius", poleRad, "meters"); + mapping += PvlKeyword("EquatorialRadius", toString(eqRad), "meters"); + mapping += PvlKeyword("PolarRadius", toString(poleRad), "meters"); mapping += PvlKeyword("LatitudeType", lattype); mapping += PvlKeyword("LongitudeDirection", londir); mapping += PvlKeyword("LongitudeDomain", londom); - mapping += PvlKeyword("PixelResolution", SetRound(avgPixRes, digits), "meters/pixel"); - mapping += PvlKeyword("Scale", SetRound(scale, digits), "pixels/degree"); - mapping += PvlKeyword("MinPixelResolution", scaleStat.Minimum(), "meters"); - mapping += PvlKeyword("MaxPixelResolution", scaleStat.Maximum(), "meters"); - mapping += PvlKeyword("CenterLongitude", SetRound(avgLon, digits)); - mapping += PvlKeyword("CenterLatitude", SetRound(avgLat, digits)); - mapping += PvlKeyword("MinimumLatitude", MAX(SetFloor(latitudeStat.Minimum(), digits), -90.0)); - mapping += PvlKeyword("MaximumLatitude", MIN(SetCeil(latitudeStat.Maximum(), digits), 90.0)); - mapping += PvlKeyword("MinimumLongitude", MAX(SetFloor(longitudeStat.Minimum(), digits), -180.0)); - mapping += PvlKeyword("MaximumLongitude", MIN(SetCeil(longitudeStat.Maximum(), digits), 360.0)); - - PvlKeyword clat("PreciseCenterLongitude", avgLon); + mapping += PvlKeyword("PixelResolution", toString(SetRound(avgPixRes, digits)), "meters/pixel"); + mapping += PvlKeyword("Scale", toString(SetRound(scale, digits)), "pixels/degree"); + mapping += PvlKeyword("MinPixelResolution", toString(scaleStat.Minimum()), "meters"); + mapping += PvlKeyword("MaxPixelResolution", toString(scaleStat.Maximum()), "meters"); + mapping += PvlKeyword("CenterLongitude", toString(SetRound(avgLon, digits))); + mapping += PvlKeyword("CenterLatitude", toString(SetRound(avgLat, digits))); + mapping += PvlKeyword("MinimumLatitude", toString(MAX(SetFloor(latitudeStat.Minimum(), digits), -90.0))); + mapping += PvlKeyword("MaximumLatitude", toString(MIN(SetCeil(latitudeStat.Maximum(), digits), 90.0))); + mapping += PvlKeyword("MinimumLongitude", toString(MAX(SetFloor(longitudeStat.Minimum(), digits), -180.0))); + mapping += PvlKeyword("MaximumLongitude", toString(MIN(SetCeil(longitudeStat.Maximum(), digits), 360.0))); + + PvlKeyword clat("PreciseCenterLongitude", toString(avgLon)); clat.AddComment("Actual Parameters without precision applied"); mapping += clat; - mapping += PvlKeyword("PreciseCenterLatitude", avgLat); - mapping += PvlKeyword("PreciseMinimumLatitude", latitudeStat.Minimum()); - mapping += PvlKeyword("PreciseMaximumLatitude", latitudeStat.Maximum()); - mapping += PvlKeyword("PreciseMinimumLongitude", longitudeStat.Minimum()); - mapping += PvlKeyword("PreciseMaximumLongitude", longitudeStat.Maximum()); + mapping += PvlKeyword("PreciseCenterLatitude", toString(avgLat)); + mapping += PvlKeyword("PreciseMinimumLatitude", toString(latitudeStat.Minimum())); + mapping += PvlKeyword("PreciseMaximumLatitude", toString(latitudeStat.Maximum())); + mapping += PvlKeyword("PreciseMinimumLongitude", toString(longitudeStat.Minimum())); + mapping += PvlKeyword("PreciseMaximumLongitude", toString(longitudeStat.Maximum())); Application::Log(mapping); diff --git a/isis/src/base/apps/mvstats/mvstats.cpp b/isis/src/base/apps/mvstats/mvstats.cpp index 7c864dac67..6d9a815291 100644 --- a/isis/src/base/apps/mvstats/mvstats.cpp +++ b/isis/src/base/apps/mvstats/mvstats.cpp @@ -1,6 +1,6 @@ #include "Isis.h" -#include +#include #include #include "ProcessByLine.h" @@ -16,7 +16,7 @@ std::vector< vector > correlation; MultivariateStatistics stats; void MakeStats(vector &in, vector &out); -void WriteText(int size, string filename); +void WriteText(int size, QString filename); void WriteCube(Buffer &inout); void IsisMain() { @@ -24,11 +24,11 @@ void IsisMain() { //Check to see if an output file was specified UserInterface &ui = Application::GetUserInterface(); if(!ui.WasEntered("CUBE") && !ui.WasEntered("FLATFILE")) { - string message = "At least one output file must be entered"; + QString message = "At least one output file must be entered"; throw IException(IException::User, message, _FILEINFO_); } - string file = ui.GetFileName("FROM"); + QString file = ui.GetFileName("FROM"); //Use a Process to get the number of bands in the input cube Process q; @@ -37,7 +37,7 @@ void IsisMain() { //Check to see if the input cube has enough bands if(bands < 2) { - string message = "Input band must have at least two bands!"; + QString message = "Input band must have at least two bands!"; throw IException(IException::User, message, _FILEINFO_); } @@ -55,17 +55,17 @@ void IsisMain() { for(int j = i ; j <= bands ; j++) { //Reset Stat accumulators and set the Progress Display Text stats.Reset(); - string progText = "Band " + IString(i) + + QString progText = "Band " + toString(i) + " vs. " + - "Band " + IString(j); + "Band " + toString(j); //Cube will be processed by line ProcessByLine p; //Set CubeAttributeInputs to tell the ProcessByLine which //bands to compare - CubeAttributeInput band_a("d+" + IString(icube->getPhysicalBand(i))); - CubeAttributeInput band_b("d+" + IString(icube->getPhysicalBand(j))); + CubeAttributeInput band_a("d+" + toString(icube->getPhysicalBand(i))); + CubeAttributeInput band_b("d+" + toString(icube->getPhysicalBand(j))); //Set Input files and process, to accumulate the statistics p.SetInputCube(file, band_a); @@ -130,14 +130,14 @@ void MakeStats(vector &in, vector &out) { } //Function to generate a flatfile to represent the matrices -void WriteText(int size, string filename) { +void WriteText(int size, QString filename) { ofstream outputFile; - outputFile.open(filename.c_str()); - string line = " "; + outputFile.open(filename.toAscii().data()); + QString line = " "; outputFile << "Correlation:" << endl << endl; for(int i = 0; i < size; ++i) { for(int j = 0; j < size; ++j) { - line += " " + IString(correlation[i][j]) + " "; + line += " " + toString(correlation[i][j]) + " "; } outputFile << line << endl; line = " "; @@ -146,7 +146,7 @@ void WriteText(int size, string filename) { outputFile << endl << endl << "Covariance:" << endl << endl; for(int i = 0; i < size; ++i) { for(int j = 0; j < size; ++j) { - line += " " + IString(covariance[i][j]) + " "; + line += " " + toString(covariance[i][j]) + " "; } outputFile << line << endl; line = " "; diff --git a/isis/src/base/apps/nocam2map/nocam2map.cpp b/isis/src/base/apps/nocam2map/nocam2map.cpp index 419188c92e..aa04b93996 100644 --- a/isis/src/base/apps/nocam2map/nocam2map.cpp +++ b/isis/src/base/apps/nocam2map/nocam2map.cpp @@ -23,8 +23,8 @@ void LoadMapRes(); void ComputeInputRange(); void LoadMapRange(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["PrintMap"] = (void *) PrintMap; helper ["ComputePixRes"] = (void *) ComputePixRes; helper ["LoadMapRes"] = (void *) LoadMapRes; @@ -147,18 +147,18 @@ void IsisMain() { if(ui.WasEntered("RESIDUALS")) { for(int i = 0; i < sampSol.Rows(); i++) { vector data = sampSol.GetInput(i); - IString tmp = ""; - tmp += IString(sampSol.GetExpected(i)); + QString tmp = ""; + tmp += toString(sampSol.GetExpected(i)); tmp += ",\t"; - tmp += IString(lineSol.GetExpected(i)); + tmp += toString(lineSol.GetExpected(i)); tmp += ",\t"; - tmp += IString(data[0]); + tmp += toString(data[0]); tmp += ",\t"; - tmp += IString(data[1]); + tmp += toString(data[1]); tmp += ",\t"; - tmp += IString(sampResiduals[i]); + tmp += toString(sampResiduals[i]); tmp += ",\t"; - tmp += IString(lineResiduals[i]); + tmp += toString(lineResiduals[i]); oFile.PutLine(tmp + "\n"); } } @@ -166,16 +166,16 @@ void IsisMain() { //Records the error to the log PvlGroup error("Error"); - error += PvlKeyword("Degree", degree); - error += PvlKeyword("NumberOfPoints", (int)sampResiduals.size()); - error += PvlKeyword("SampleMinimumError", sampErr.Minimum()); - error += PvlKeyword("SampleAverageError", sampErr.Average()); - error += PvlKeyword("SampleMaximumError", sampErr.Maximum()); - error += PvlKeyword("SampleStdDeviationError", sampErr.StandardDeviation()); - error += PvlKeyword("LineMinimumError", lineErr.Minimum()); - error += PvlKeyword("LineAverageError", lineErr.Average()); - error += PvlKeyword("LineMaximumError", lineErr.Maximum()); - error += PvlKeyword("LineStdDeviationError", lineErr.StandardDeviation()); + error += PvlKeyword("Degree", toString(degree)); + error += PvlKeyword("NumberOfPoints", toString((int)sampResiduals.size())); + error += PvlKeyword("SampleMinimumError", toString(sampErr.Minimum())); + error += PvlKeyword("SampleAverageError", toString(sampErr.Average())); + error += PvlKeyword("SampleMaximumError", toString(sampErr.Maximum())); + error += PvlKeyword("SampleStdDeviationError", toString(sampErr.StandardDeviation())); + error += PvlKeyword("LineMinimumError", toString(lineErr.Minimum())); + error += PvlKeyword("LineAverageError", toString(lineErr.Average())); + error += PvlKeyword("LineMaximumError", toString(lineErr.Maximum())); + error += PvlKeyword("LineStdDeviationError", toString(lineErr.StandardDeviation())); Application::Log(error); //Close the input cubes for cleanup @@ -218,26 +218,26 @@ void IsisMain() { //If the user entered the equatorial and polar radii if(ui.WasEntered("EQURADIUS") && ui.WasEntered("POLRADIUS")) { - equRadius = PvlKeyword("EquatorialRadius", ui.GetDouble("EQURADIUS")); - polRadius = PvlKeyword("PolarRadius", ui.GetDouble("POLRADIUS")); + equRadius = PvlKeyword("EquatorialRadius", toString(ui.GetDouble("EQURADIUS"))); + polRadius = PvlKeyword("PolarRadius", toString(ui.GetDouble("POLRADIUS"))); } //Else read them from the pck else { FileName pckFile("$base/kernels/pck/pck?????.tpc"); pckFile = pckFile.highestVersion(); - string pckFileName = pckFile.expanded(); + QString pckFileName = pckFile.expanded(); - furnsh_c(pckFileName.c_str()); + furnsh_c(pckFileName.toAscii().data()); - string target = targetName[0]; + QString target = targetName[0]; SpiceInt code; SpiceBoolean found; - bodn2c_c(target.c_str(), &code, &found); + bodn2c_c(target.toAscii().data(), &code, &found); if(!found) { - string msg = "Could not convert Target [" + target + + QString msg = "Could not convert Target [" + target + "] to NAIF code"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -247,8 +247,8 @@ void IsisMain() { bodvar_c(code, "RADII", &n, radii); - equRadius = PvlKeyword("EquatorialRadius", radii[0] * 1000); - polRadius = PvlKeyword("PolarRadius", radii[2] * 1000); + equRadius = PvlKeyword("EquatorialRadius", toString(radii[0] * 1000)); + polRadius = PvlKeyword("PolarRadius", toString(radii[2] * 1000)); } mapGrp.AddKeyword(equRadius, Pvl::Replace); @@ -293,7 +293,7 @@ void IsisMain() { double minLat = latStats->Minimum(); double maxLat = latStats->Maximum(); - bool isOcentric = ((std::string)mapGrp.FindKeyword("LatitudeType")) == "Planetocentric"; + bool isOcentric = ((QString)mapGrp.FindKeyword("LatitudeType")) == "Planetocentric"; if(isOcentric) { if(ui.GetString("LATTYPE") != "PLANETOCENTRIC") { @@ -312,7 +312,7 @@ void IsisMain() { double minLon = lonDomain == 360 ? Projection::To360Domain(lonStats->Minimum()) : Projection::To180Domain(lonStats->Minimum()); double maxLon = lonDomain == 360 ? Projection::To360Domain(lonStats->Maximum()) : Projection::To180Domain(lonStats->Maximum()); - bool isPosEast = ((std::string)mapGrp.FindKeyword("LongitudeDirection")) == "PositiveEast"; + bool isPosEast = ((QString)mapGrp.FindKeyword("LongitudeDirection")) == "PositiveEast"; if(isPosEast) { if(ui.GetString("LONDIR") != "POSITIVEEAST") { @@ -333,31 +333,31 @@ void IsisMain() { maxLon = temp; } - mapGrp.AddKeyword(PvlKeyword("MinimumLatitude", minLat), Pvl::Replace); - mapGrp.AddKeyword(PvlKeyword("MaximumLatitude", maxLat), Pvl::Replace); - mapGrp.AddKeyword(PvlKeyword("MinimumLongitude", minLon), Pvl::Replace); - mapGrp.AddKeyword(PvlKeyword("MaximumLongitude", maxLon), Pvl::Replace); + mapGrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(minLat)), Pvl::Replace); + mapGrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(maxLat)), Pvl::Replace); + mapGrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(minLon)), Pvl::Replace); + mapGrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(maxLon)), Pvl::Replace); } //If the user decided to enter a ground range then override if(ui.WasEntered("MINLAT")) { mapGrp.AddKeyword(PvlKeyword("MinimumLatitude", - ui.GetDouble("MINLAT")), Pvl::Replace); + toString(ui.GetDouble("MINLAT"))), Pvl::Replace); } if(ui.WasEntered("MAXLAT")) { mapGrp.AddKeyword(PvlKeyword("MaximumLatitude", - ui.GetDouble("MAXLAT")), Pvl::Replace); + toString(ui.GetDouble("MAXLAT"))), Pvl::Replace); } if(ui.WasEntered("MINLON")) { mapGrp.AddKeyword(PvlKeyword("MinimumLongitude", - ui.GetDouble("MINLON")), Pvl::Replace); + toString(ui.GetDouble("MINLON"))), Pvl::Replace); } if(ui.WasEntered("MAXLON")) { mapGrp.AddKeyword(PvlKeyword("MaximumLongitude", - ui.GetDouble("MAXLON")), Pvl::Replace); + toString(ui.GetDouble("MAXLON"))), Pvl::Replace); } //If the pixel resolution is to be computed, compute the pixels/degree from the input @@ -392,7 +392,7 @@ void IsisMain() { //Add the scale in pixels/degree to the mapping group mapGrp.AddKeyword(PvlKeyword("Scale", - pixels / angle, "pixels/degree"), + toString(pixels / angle), "pixels/degree"), Pvl::Replace); if(mapGrp.HasKeyword("PixelResolution")) { mapGrp.DeleteKeyword("PixelResolution"); @@ -403,7 +403,7 @@ void IsisMain() { // If the user decided to enter a resolution then override if(ui.GetString("PIXRES") == "MPP") { mapGrp.AddKeyword(PvlKeyword("PixelResolution", - ui.GetDouble("RESOLUTION"), "meters/pixel"), + toString(ui.GetDouble("RESOLUTION")), "meters/pixel"), Pvl::Replace); if(mapGrp.HasKeyword("Scale")) { mapGrp.DeleteKeyword("Scale"); @@ -411,7 +411,7 @@ void IsisMain() { } else if(ui.GetString("PIXRES") == "PPD") { mapGrp.AddKeyword(PvlKeyword("Scale", - ui.GetDouble("RESOLUTION"), "pixels/degree"), + toString(ui.GetDouble("RESOLUTION")), "pixels/degree"), Pvl::Replace); if(mapGrp.HasKeyword("PixelResolution")) { mapGrp.DeleteKeyword("PixelResolution"); @@ -774,7 +774,7 @@ void LoadMapRes() { ui.PutAsString("PIXRES", "MPP"); } else { - string msg = "No resolution value found in [" + ui.GetFileName("MAP") + "]"; + QString msg = "No resolution value found in [" + ui.GetFileName("MAP") + "]"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -801,7 +801,7 @@ void ComputeInputRange() { double maxLon = lonDomain == 360 ? Projection::To360Domain(lonStats->Maximum()) : Projection::To180Domain(lonStats->Maximum()); if(userGrp.HasKeyword("LatitudeType")) { - bool isOcentric = ((std::string)userGrp.FindKeyword("LatitudeType")) == "Planetocentric"; + bool isOcentric = ((QString)userGrp.FindKeyword("LatitudeType")) == "Planetocentric"; double equRadius; double polRadius; @@ -816,11 +816,11 @@ void ComputeInputRange() { FileName pckFile("$base/kernels/pck/pck?????.tpc"); pckFile = pckFile.highestVersion(); - string pckFileName = pckFile.expanded(); + QString pckFileName = pckFile.expanded(); - furnsh_c(pckFileName.c_str()); + furnsh_c(pckFileName.toAscii().data()); - string target; + QString target; //If user entered target if(ui.WasEntered("TARGET")) { @@ -830,16 +830,16 @@ void ComputeInputRange() { else { Pvl fromFile; fromFile.Read(ui.GetFileName("FROM")); - target = (string)fromFile.FindKeyword("TargetName", Pvl::Traverse); + target = (QString)fromFile.FindKeyword("TargetName", Pvl::Traverse); } SpiceInt code; SpiceBoolean found; - bodn2c_c(target.c_str(), &code, &found); + bodn2c_c(target.toAscii().data(), &code, &found); if(!found) { - string msg = "Could not convert Target [" + target + + QString msg = "Could not convert Target [" + target + "] to NAIF code"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -868,7 +868,7 @@ void ComputeInputRange() { } if(userGrp.HasKeyword("LongitudeDirection")) { - bool isPosEast = ((std::string)userGrp.FindKeyword("LongitudeDirection")) == "PositiveEast"; + bool isPosEast = ((QString)userGrp.FindKeyword("LongitudeDirection")) == "PositiveEast"; if(isPosEast) { if(ui.GetString("LONDIR") != "POSITIVEEAST") { @@ -950,7 +950,7 @@ void LoadMapRange() { ui.PutAsString("DEFAULTRANGE", "MAP"); if(count < 4) { - string msg = "One or more of the values for the ground range was not found"; + QString msg = "One or more of the values for the ground range was not found"; msg += " in [" + ui.GetFileName("MAP") + "]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/noisefilter/noisefilter.cpp b/isis/src/base/apps/noisefilter/noisefilter.cpp index 83edad87ac..8c847c1f15 100644 --- a/isis/src/base/apps/noisefilter/noisefilter.cpp +++ b/isis/src/base/apps/noisefilter/noisefilter.cpp @@ -63,15 +63,15 @@ void IsisMain() { // Generate a results group and log it PvlGroup results("Results"); - results += PvlKeyword("DarkPixelsReplaced", darkPixelsReplaced); - results += PvlKeyword("BrightPixelsReplaced", brightPixelsReplaced); - results += PvlKeyword("SpecialPixelsReplaced", specialPixelsReplaced); + results += PvlKeyword("DarkPixelsReplaced", toString(darkPixelsReplaced)); + results += PvlKeyword("BrightPixelsReplaced", toString(brightPixelsReplaced)); + results += PvlKeyword("SpecialPixelsReplaced", toString(specialPixelsReplaced)); int pixelsReplaced = darkPixelsReplaced + brightPixelsReplaced + specialPixelsReplaced; - results += PvlKeyword("TotalPixelsReplaced", pixelsReplaced); + results += PvlKeyword("TotalPixelsReplaced", toString(pixelsReplaced)); double pct = ((double)pixelsReplaced / ((double)icube->getSampleCount() * (double)icube->getLineCount())) * 100.; pct = (int)(pct * 10.0) / 10.0; - results += PvlKeyword("PercentChanged", pct); + results += PvlKeyword("PercentChanged", toString(pct)); Application::Log(results); p.EndProcess(); } diff --git a/isis/src/base/apps/noproj/noproj.cpp b/isis/src/base/apps/noproj/noproj.cpp index ee051c82e8..76acf9c13c 100644 --- a/isis/src/base/apps/noproj/noproj.cpp +++ b/isis/src/base/apps/noproj/noproj.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include "AlphaCube.h" #include "Application.h" @@ -24,15 +24,15 @@ using namespace std; void LoadMatchSummingMode(); void LoadInputSummingMode(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["LoadMatchSummingMode"] = (void *) LoadMatchSummingMode; helper ["LoadInputSummingMode"] = (void *) LoadInputSummingMode; return helper; } void storeSpice(PvlGroup *instrumentGroup, PvlObject *naifKeywordsObject, - IString oldName, IString spiceName, + QString oldName, QString spiceName, double constantCoeff, double multiplierCoeff, bool putMultiplierInX); void IsisMain() { @@ -63,8 +63,8 @@ void IsisMain() { // Extract Instrument groups from input labels for the output match and noproj'd cubes PvlGroup inst = mcube->getGroup("Instrument"); PvlGroup fromInst = icube->getGroup("Instrument"); - std::string groupName = (string) inst["SpacecraftName"] + "/"; - groupName += (string) inst.FindKeyword("InstrumentId"); + QString groupName = (QString) inst["SpacecraftName"] + "/"; + groupName += (QString) inst.FindKeyword("InstrumentId"); // Get Ideal camera specifications FileName specs; @@ -107,7 +107,7 @@ void IsisMain() { // Get the user options int sampleExpansion = int((ui.GetDouble("SAMPEXP") / 100.) * detectorSamples + .5); int lineExpansion = int((ui.GetDouble("LINEEXP") / 100.) * numberLines + .5); - string instType; + QString instType; // Adjust translations for summing mode transl /= ui.GetDouble("SUMMINGMODE"); @@ -167,11 +167,11 @@ void IsisMain() { Cube *ocube = p.SetOutputCube("match.cub", cao, 1, 1, 1); // Extract the times and the target from the instrument group - string startTime = inst["StartTime"]; - string stopTime; - if(inst.HasKeyword("StopTime")) stopTime = (string) inst["StopTime"]; + QString startTime = inst["StartTime"]; + QString stopTime; + if(inst.HasKeyword("StopTime")) stopTime = (QString) inst["StopTime"]; - string target = inst["TargetName"]; + QString target = inst["TargetName"]; // rename the instrument groups inst.SetName("OriginalInstrument"); @@ -200,11 +200,11 @@ void IsisMain() { inst.AddKeyword(key); key.SetName("SampleDetectors"); - key.SetValue(Isis::IString(detectorSamples)); + key.SetValue(Isis::toString(detectorSamples)); inst.AddKeyword(key); key.SetName("LineDetectors"); - key.SetValue(Isis::IString(detectorLines)); + key.SetValue(Isis::toString(detectorLines)); inst.AddKeyword(key); key.SetName("InstrumentType"); @@ -219,8 +219,7 @@ void IsisMain() { // Clean up the naif keywords object... delete everything that isn't a radii for (int keyIndex = naifKeywordsObject->Keywords() - 1; keyIndex >= 0; keyIndex--) { - QString keyName = QString::fromStdString( - (*naifKeywordsObject)[keyIndex].Name()); + QString keyName = (*naifKeywordsObject)[keyIndex].Name(); if (!keyName.contains("RADII")) { naifKeywordsObject->DeleteKeyword(keyIndex); @@ -251,24 +250,24 @@ void IsisMain() { } if (naifKeywordsObject) { - naifKeywordsObject->AddKeyword(PvlKeyword("IDEAL_FOCAL_LENGTH", incam->FocalLength()), + naifKeywordsObject->AddKeyword(PvlKeyword("IDEAL_FOCAL_LENGTH", toString(incam->FocalLength())), Pvl::Replace); } else { - inst.AddKeyword(PvlKeyword("FocalLength", incam->FocalLength(), "millimeters")); + inst.AddKeyword(PvlKeyword("FocalLength", toString(incam->FocalLength()), "millimeters")); } double newPixelPitch = incam->PixelPitch() * ui.GetDouble("SUMMINGMODE"); if (naifKeywordsObject) { - naifKeywordsObject->AddKeyword(PvlKeyword("IDEAL_PIXEL_PITCH", newPixelPitch), + naifKeywordsObject->AddKeyword(PvlKeyword("IDEAL_PIXEL_PITCH", toString(newPixelPitch)), Pvl::Replace); } else { - inst.AddKeyword(PvlKeyword("PixelPitch", newPixelPitch, "millimeters")); + inst.AddKeyword(PvlKeyword("PixelPitch", toString(newPixelPitch), "millimeters")); } key.SetName("EphemerisTime"); - key.SetValue(Isis::IString(et), "seconds"); + key.SetValue(Isis::toString(et), "seconds"); inst.AddKeyword(key); key.SetName("StartTime"); @@ -282,16 +281,16 @@ void IsisMain() { } key.SetName("FocalPlaneXDependency"); - key.SetValue(incam->FocalPlaneMap()->FocalPlaneXDependency()); + key.SetValue(toString((int)incam->FocalPlaneMap()->FocalPlaneXDependency())); inst.AddKeyword(key); int xDependency = incam->FocalPlaneMap()->FocalPlaneXDependency(); double newInstrumentTransX = incam->FocalPlaneMap()->SignMostSigX(); - inst.AddKeyword(PvlKeyword("TransX", newInstrumentTransX)); + inst.AddKeyword(PvlKeyword("TransX", toString(newInstrumentTransX))); double newInstrumentTransY = incam->FocalPlaneMap()->SignMostSigY(); - inst.AddKeyword(PvlKeyword("TransY", newInstrumentTransY)); + inst.AddKeyword(PvlKeyword("TransY", toString(newInstrumentTransY))); storeSpice(&inst, naifKeywordsObject, "TransX0", "IDEAL_TRANSX", transx, newPixelPitch * newInstrumentTransX, (xDependency == CameraFocalPlaneMap::Sample)); @@ -313,7 +312,7 @@ void IsisMain() { if(instType == "LINESCAN") { key.SetName("ExposureDuration"); - key.SetValue(Isis::IString(incam->DetectorMap()->LineRate() * 1000.), "milliseconds"); + key.SetValue(Isis::toString(incam->DetectorMap()->LineRate() * 1000.), "milliseconds"); inst.AddKeyword(key); } @@ -330,15 +329,15 @@ void IsisMain() { Pvl label; label.Read("match.lbl"); PvlGroup &dims = label.FindGroup("Dimensions", Pvl::Traverse); - dims["Lines"] = numberLines; - dims["Samples"] = detectorSamples; - dims["Bands"] = numberBands; + dims["Lines"] = toString(numberLines); + dims["Samples"] = toString(detectorSamples); + dims["Bands"] = toString(numberBands); label.Write("match.lbl"); // And run cam2cam to apply the transformation - string parameters; + QString parameters; parameters += " FROM= " + ui.GetFileName("FROM"); - parameters += " MATCH= " + string("match.cub"); + parameters += " MATCH= " + QString("match.cub"); parameters += " TO= " + ui.GetFileName("TO"); parameters += " INTERP=" + ui.GetString("INTERP"); ProgramLauncher::RunIsisProgram("cam2cam", parameters); @@ -369,7 +368,7 @@ void IsisMain() { // Helper function to get output summing mode from cube to MATCH void LoadMatchSummingMode() { - string file; + QString file; UserInterface &ui = Application::GetUserInterface(); // Get camera from cube to match @@ -394,22 +393,22 @@ void LoadMatchSummingMode() { void storeSpice(PvlGroup *instrumentGroup, PvlObject *naifKeywordsObject, - IString oldName, IString spiceName, + QString oldName, QString spiceName, double constantCoeff, double multiplierCoeff, bool putMultiplierInX) { if(constantCoeff != 0 && !naifKeywordsObject && instrumentGroup) { - instrumentGroup->AddKeyword(PvlKeyword(oldName, constantCoeff)); + instrumentGroup->AddKeyword(PvlKeyword(oldName, toString(constantCoeff))); } else if (naifKeywordsObject) { PvlKeyword spiceKeyword(spiceName); - spiceKeyword += constantCoeff; + spiceKeyword += toString(constantCoeff); if (putMultiplierInX) { - spiceKeyword += multiplierCoeff; - spiceKeyword += 0.0; + spiceKeyword += toString(multiplierCoeff); + spiceKeyword += toString(0.0); } else { - spiceKeyword += 0.0; - spiceKeyword += multiplierCoeff; + spiceKeyword += toString(0.0); + spiceKeyword += toString(multiplierCoeff); } naifKeywordsObject->AddKeyword(spiceKeyword, Pvl::Replace); @@ -422,7 +421,7 @@ void LoadInputSummingMode() { UserInterface &ui = Application::GetUserInterface(); // Get camera from cube to match - string file = ui.GetFileName("FROM"); + QString file = ui.GetFileName("FROM"); // Open the input cube and get the camera object Cube c; c.open(file); diff --git a/isis/src/base/apps/noseam/noseam.cpp b/isis/src/base/apps/noseam/noseam.cpp index 6d601daf69..5d7e44b2f7 100644 --- a/isis/src/base/apps/noseam/noseam.cpp +++ b/isis/src/base/apps/noseam/noseam.cpp @@ -22,20 +22,20 @@ void IsisMain() { int hnl = ui.GetInteger("HNL"); int lns = ui.GetInteger("LNS"); int lnl = ui.GetInteger("LNL"); - string match = ui.GetAsString("MATCHBANDBIN"); + QString match = ui.GetAsString("MATCHBANDBIN"); //Sets upt the pathName to be used for most application calls FileName inFile = cubes[0]; Pvl &pref = Preference::Preferences(); - string pathName = (string)pref.FindGroup("DataDirectory")["Temporary"] + "/"; + QString pathName = (QString)pref.FindGroup("DataDirectory")["Temporary"] + "/"; /** * Creates a mosaic from the original images. It is placed here * so that the failure MATCHBANDBIN causes does not leave * highpasses cubes lying around! */ - string parameters = "FROMLIST=" + ui.GetFileName("FROMLIST") + + QString parameters = "FROMLIST=" + ui.GetFileName("FROMLIST") + " MOSAIC=" + pathName + "OriginalMosaic.cub" + " MATCHBANDBIN=" + match; ProgramLauncher::RunIsisProgram("automos", parameters); @@ -45,10 +45,10 @@ void IsisMain() { highPassList.open("HighPassList.lis"); for(int i = 0; i < cubes.size(); i++) { inFile = cubes[i]; - string outParam = pathName + inFile.baseName() + "_highpass.cub"; + QString outParam = pathName + inFile.baseName() + "_highpass.cub"; parameters = "FROM=" + inFile.expanded() + " TO=" + outParam - + " SAMPLES=" + IString(hns) + " LINES=" + IString(hnl); + + " SAMPLES=" + toString(hns) + " LINES=" + toString(hnl); ProgramLauncher::RunIsisProgram("highpass", parameters); //Reads the just created highpass cube into a list file for automos highPassList << outParam << endl; @@ -63,7 +63,7 @@ void IsisMain() { //Does a lowpass on the original mosaic parameters = "FROM=" + pathName + "OriginalMosaic.cub" + " TO=" + pathName + "LowpassMosaic.cub" - + " SAMPLES=" + IString(lns) + " LINES=" + IString(lnl); + + " SAMPLES=" + toString(lns) + " LINES=" + toString(lnl); ProgramLauncher::RunIsisProgram("lowpass", parameters); //Finally combines the highpass and lowpass mosaics @@ -75,19 +75,19 @@ void IsisMain() { //Will remove all of the temp files by default if(ui.GetBoolean("REMOVETEMP")) { - string file("HighPassList.lis"); - remove(file.c_str()); + QString file("HighPassList.lis"); + remove(file.toAscii().data()); file = pathName + "HighpassMosaic.cub"; - remove(file.c_str()); + remove(file.toAscii().data()); file = pathName + "LowpassMosaic.cub"; - remove(file.c_str()); + remove(file.toAscii().data()); file = pathName + "OriginalMosaic.cub"; - remove(file.c_str()); + remove(file.toAscii().data()); for(int i = 0; i < cubes.size(); i++) { inFile = cubes[i]; file = pathName + inFile.baseName() + "_highpass.cub"; - remove(file.c_str()); + remove(file.toAscii().data()); } } diff --git a/isis/src/base/apps/overlapstats/overlapstats.cpp b/isis/src/base/apps/overlapstats/overlapstats.cpp index e7504b472a..b0c662a567 100644 --- a/isis/src/base/apps/overlapstats/overlapstats.cpp +++ b/isis/src/base/apps/overlapstats/overlapstats.cpp @@ -20,7 +20,7 @@ using namespace Isis; bool full = false; bool tab = false; -std::string FormatString(double input, int head, int tail); +QString FormatString(double input, int head, int tail); void IsisMain() { @@ -44,7 +44,7 @@ void IsisMain() { for (int i = 0; i < overlaps.Size(); i++) { ImageOverlap const * currOverlap = overlaps[i]; for (int j = 0; j < currOverlap->Size(); j++) { - string currSerialNum = (*currOverlap)[j]; + QString currSerialNum = (*currOverlap)[j]; if (!serialNumbers.HasSerialNumber(currSerialNum)) { IString msg = "Found serial number [" + currSerialNum + "] in overlap " "list that was not in the provided cube list. Please ensure that " @@ -56,7 +56,7 @@ void IsisMain() { } // Sets up the no overlap list - set nooverlap; + set nooverlap; for(int i = 0; i < serialNumbers.Size(); i ++) { nooverlap.insert(serialNumbers.SerialNumber(i)); } @@ -66,8 +66,8 @@ void IsisMain() { output.precision(16); output.setf(ios::showpoint); - string delim = ""; - string pretty = ""; // Makes tab tables look pretty, ignored in CSV + QString delim = ""; + QString pretty = ""; // Makes tab tables look pretty, ignored in CSV bool singleLine = false; if(ui.WasEntered("DETAIL")) { if(ui.GetString("TABLETYPE") == "CSV") { @@ -115,18 +115,18 @@ void IsisMain() { // Construct a Projection for converting between Lon/Lat and X/Y Pvl cubeLab(serialNumbers.FileName(0)); PvlGroup inst = cubeLab.FindGroup("Instrument", Pvl::Traverse); - string target = inst["TargetName"]; + QString target = inst["TargetName"]; PvlGroup radii = Projection::TargetRadii(target); Isis::Pvl maplab; maplab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = maplab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); - mapGroup += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapGroup += Isis::PvlKeyword("EquatorialRadius", (QString)radii["EquatorialRadius"]); + mapGroup += Isis::PvlKeyword("PolarRadius", (QString)radii["PolarRadius"]); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", toString(360)); + mapGroup += Isis::PvlKeyword("CenterLatitude", toString(0)); + mapGroup += Isis::PvlKeyword("CenterLongitude", toString(0)); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); Projection *proj = Isis::ProjectionFactory::Create(maplab); @@ -206,7 +206,7 @@ void IsisMain() { // Checks if there were overlaps to output results from if(overlapnum == 0) { - std::string msg = "The overlap file ["; + QString msg = "The overlap file ["; msg += FileName(ui.GetFileName("OVERLAPLIST")).name(); msg += "] does not contain any overlaps across the provided cubes ["; msg += FileName(ui.GetFileName("FROMLIST")).name() + "]"; @@ -217,29 +217,29 @@ void IsisMain() { //Create and Log the BRIEF description PvlGroup brief("Results"); - brief += PvlKeyword("ThicknessMinimum", thickness.Minimum()); - brief += PvlKeyword("ThicknessMaximum", thickness.Maximum()); - brief += PvlKeyword("ThicknessAverage", thickness.Average()); - brief += PvlKeyword("ThicknessStandardDeviation", thickness.StandardDeviation()); - brief += PvlKeyword("ThicknessVariance", thickness.Variance()); + brief += PvlKeyword("ThicknessMinimum", toString(thickness.Minimum())); + brief += PvlKeyword("ThicknessMaximum", toString(thickness.Maximum())); + brief += PvlKeyword("ThicknessAverage", toString(thickness.Average())); + brief += PvlKeyword("ThicknessStandardDeviation", toString(thickness.StandardDeviation())); + brief += PvlKeyword("ThicknessVariance", toString(thickness.Variance())); - brief += PvlKeyword("AreaMinimum", area.Minimum()); - brief += PvlKeyword("AreaMaximum", area.Maximum()); - brief += PvlKeyword("AreaAverage", area.Average()); - brief += PvlKeyword("AreaStandardDeviation", area.StandardDeviation()); - brief += PvlKeyword("AreaVariance", area.Variance()); + brief += PvlKeyword("AreaMinimum", toString(area.Minimum())); + brief += PvlKeyword("AreaMaximum", toString(area.Maximum())); + brief += PvlKeyword("AreaAverage", toString(area.Average())); + brief += PvlKeyword("AreaStandardDeviation", toString(area.StandardDeviation())); + brief += PvlKeyword("AreaVariance", toString(area.Variance())); - brief += PvlKeyword("ImageStackMinimum", sncount.Minimum()); - brief += PvlKeyword("ImageStackMaximum", sncount.Maximum()); - brief += PvlKeyword("ImageStackAverage", sncount.Average()); - brief += PvlKeyword("ImageStackStandardDeviation", sncount.StandardDeviation()); - brief += PvlKeyword("ImageStackVariance", sncount.Variance()); + brief += PvlKeyword("ImageStackMinimum", toString(sncount.Minimum())); + brief += PvlKeyword("ImageStackMaximum", toString(sncount.Maximum())); + brief += PvlKeyword("ImageStackAverage", toString(sncount.Average())); + brief += PvlKeyword("ImageStackStandardDeviation", toString(sncount.StandardDeviation())); + brief += PvlKeyword("ImageStackVariance", toString(sncount.Variance())); - brief += PvlKeyword("PolygonCount", overlaps.Size()); + brief += PvlKeyword("PolygonCount", toString(overlaps.Size())); // Add non-overlapping cubes to the output if(!nooverlap.empty()) { - for(set::iterator itt = nooverlap.begin(); itt != nooverlap.end(); itt ++) { + for(set::iterator itt = nooverlap.begin(); itt != nooverlap.end(); itt ++) { brief += PvlKeyword("NoOverlap", serialNumbers.FileName(*itt)); } } @@ -249,9 +249,9 @@ void IsisMain() { //Log the ERRORS file if(ui.WasEntered("ERRORS")) { - string errorname = ui.GetFileName("ERRORS"); + QString errorname = ui.GetFileName("ERRORS"); std::ofstream errorsfile; - errorsfile.open(errorname.c_str()); + errorsfile.open(errorname.toAscii().data()); errorsfile << errors.str(); errorsfile.close(); } @@ -259,16 +259,16 @@ void IsisMain() { //Log error num in print.prt if there were errors if(errorNum > 0) { PvlGroup grp("OverlapStats"); - PvlKeyword key("ErrorNumber", IString(errorNum)); + PvlKeyword key("ErrorNumber", toString(errorNum)); grp.AddKeyword(key); Application::Log(grp); } // Display FULL output if(full) { - string outname = ui.GetFileName("TO"); + QString outname = ui.GetFileName("TO"); std::ofstream outfile; - outfile.open(outname.c_str()); + outfile.open(outname.toAscii().data()); outfile << output.str(); outfile.close(); if(outfile.fail()) { @@ -281,7 +281,7 @@ void IsisMain() { /** - * Takes a string and formats the length of that string around the decimal + * Takes a QString and formats the length of that QString around the decimal * point. * * @param input The input double to be formatted @@ -290,15 +290,15 @@ void IsisMain() { * @param tail The desired character length for the double after the decimal * point. It will be filled with "0". * - * @return std::string The formatted double for display + * @return QString The formatted double for display */ -std::string FormatString(double input, int head, int tail) { +QString FormatString(double input, int head, int tail) { - IString result(input); + QString result(toString(input)); - int point = result.find_first_of("."); - IString resultHead(result.substr(0, point)); - IString resultTail(result.substr(point + 1, result.size() - point - 1)); + int point = result.indexOf("."); + QString resultHead(result.mid(0, point)); + QString resultTail(result.mid(point + 1, result.size() - point - 1)); for(int place = resultHead.size(); place < head; place ++) { resultHead = " " + resultHead; diff --git a/isis/src/base/apps/pad/pad.cpp b/isis/src/base/apps/pad/pad.cpp index 6660b563a9..c51639f2c3 100644 --- a/isis/src/base/apps/pad/pad.cpp +++ b/isis/src/base/apps/pad/pad.cpp @@ -49,14 +49,14 @@ void IsisMain() { // Construct a label with the results PvlGroup results("Results"); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("LeftPad", leftPad); - results += PvlKeyword("RightPad", rightPad); - results += PvlKeyword("TopPad", topPad); - results += PvlKeyword("BottomPad", bottomPad); - results += PvlKeyword("OutputLines", nl); - results += PvlKeyword("OutputSamples", ns); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("LeftPad", toString(leftPad)); + results += PvlKeyword("RightPad", toString(rightPad)); + results += PvlKeyword("TopPad", toString(topPad)); + results += PvlKeyword("BottomPad", toString(bottomPad)); + results += PvlKeyword("OutputLines", toString(nl)); + results += PvlKeyword("OutputSamples", toString(ns)); // Update the Mapping, Instrument, and AlphaCube groups in the // output cube label diff --git a/isis/src/base/apps/pca/pca.cpp b/isis/src/base/apps/pca/pca.cpp index 88fe83b1d1..77efb0a17c 100644 --- a/isis/src/base/apps/pca/pca.cpp +++ b/isis/src/base/apps/pca/pca.cpp @@ -65,7 +65,7 @@ void IsisMain() { } else if(ui.GetString("MODE") == "INVERSE") { if(!(icube->hasTable("Transform Matrix"))) { - std::string m = "The input cube has not been transformed into its principal components"; + QString m = "The input cube has not been transformed into its principal components"; throw IException(IException::Programmer, m, _FILEINFO_); } Isis::Table table("Transform Matrix"); @@ -92,7 +92,7 @@ void IsisMain() { p.EndProcess(); } else { - std::string m = "Invalid option for MODE [" + ui.GetString("MODE") + "]"; + QString m = "Invalid option for MODE [" + ui.GetString("MODE") + "]"; throw IException(IException::Programmer, m, _FILEINFO_); } } diff --git a/isis/src/base/apps/pds2isis/pds2isis.cpp b/isis/src/base/apps/pds2isis/pds2isis.cpp index f6f4aac0cf..68c7ad7397 100644 --- a/isis/src/base/apps/pds2isis/pds2isis.cpp +++ b/isis/src/base/apps/pds2isis/pds2isis.cpp @@ -12,8 +12,8 @@ void IsisMain() { Pvl label; UserInterface &ui = Application::GetUserInterface(); - string labelFile = ui.GetFileName("FROM"); - string imageFile(""); + QString labelFile = ui.GetFileName("FROM"); + QString imageFile(""); if(ui.WasEntered("IMAGE")) { imageFile = ui.GetFileName("IMAGE"); } diff --git a/isis/src/base/apps/percent/percent.cpp b/isis/src/base/apps/percent/percent.cpp index 884d4cf321..905891d878 100644 --- a/isis/src/base/apps/percent/percent.cpp +++ b/isis/src/base/apps/percent/percent.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "Process.h" #include "Pvl.h" @@ -22,21 +22,20 @@ void IsisMain() { // Get the desired percentage(s) UserInterface &ui = Application::GetUserInterface(); - string sPercentage; + QString sPercentage; sPercentage = ui.GetString("PERCENTAGE"); - vector tokens; - IString::Split(',', sPercentage, tokens, true); + QStringList tokens = sPercentage.split(","); PvlGroup results("Results"); PvlKeyword kwPercent("Percentage"); PvlKeyword kwValue("Value"); - for(unsigned int i = 0; i < tokens.size(); i++) { - double percentage = IString::ToDouble(tokens[i]); + for(int i = 0; i < tokens.size(); i++) { + double percentage = toDouble(tokens[i]); // Obtain the Histogram and the value at the percentage Histogram *hist = icube->getHistogram(); double value = hist->Percent(percentage); - kwPercent += percentage; - kwValue += value; + kwPercent += toString(percentage); + kwValue += toString(value); } results += kwPercent; results += kwValue; diff --git a/isis/src/base/apps/phocube/phocube.cpp b/isis/src/base/apps/phocube/phocube.cpp index 72741dc45c..d06522ad04 100644 --- a/isis/src/base/apps/phocube/phocube.cpp +++ b/isis/src/base/apps/phocube/phocube.cpp @@ -46,7 +46,7 @@ void phocube(Buffer &out); // Function to create a keyword with same values of a specified count -template PvlKeyword makeKey(const std::string &name, +template PvlKeyword makeKey(const QString &name, const int &nvals, const T &value); @@ -60,8 +60,8 @@ struct MosData { // Computes the special MORPHOLOGY and ALBEDO planes MosData *getMosaicIndicies(Camera &camera, MosData &md); // Updates BandBin keyword -void UpdateBandKey(const std::string &keyname, PvlGroup &bb, const int &nvals, - const std::string &default_value = "Null"); +void UpdateBandKey(const QString &keyname, PvlGroup &bb, const int &nvals, + const QString &default_value = "Null"); @@ -84,7 +84,7 @@ void IsisMain() { proj = icube->getProjection(); } catch(IException &e) { - string msg = "Mosaic files must contain mapping labels"; + QString msg = "Mosaic files must contain mapping labels"; throw IException(e, IException::User, msg, _FILEINFO_); } } @@ -93,7 +93,7 @@ void IsisMain() { cam = icube->getCamera(); } catch(IException &e) { - string msg = "Input file needs to have spiceinit run on it - if this file "; + QString msg = "Input file needs to have spiceinit run on it - if this file "; msg += "is a mosaic, then check the MOSAICONLY box"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -144,14 +144,14 @@ void IsisMain() { if((pixelResolution = ui.GetBoolean("PIXELRESOLUTION"))) nbands++; if(nbands < 1) { - string message = "At least one photometry parameter must be entered" + QString message = "At least one photometry parameter must be entered" "[PHASE, EMISSION, INCIDENCE, LATITUDE, LONGITUDE...]"; throw IException(IException::User, message, _FILEINFO_); } // Retrieve the orignal values from the input cube band PvlGroup &mybb = icube->getGroup("BandBin"); - string bname("DN"); + QString bname("DN"); if ( mybb.HasKeyword("Name") ) { bname = mybb["Name"][0]; } @@ -407,7 +407,7 @@ void phocube(Buffer &out) { // Function to create a keyword with same values of a specified count template - PvlKeyword makeKey(const std::string &name, const int &nvals, + PvlKeyword makeKey(const QString &name, const int &nvals, const T &value) { PvlKeyword key(name); for (int i = 0 ; i < nvals ; i++) { @@ -458,10 +458,10 @@ MosData *getMosaicIndicies(Camera &camera, MosData &md) { // existance of the keyword and uses its (assumed) first value to set nvals // values to a constant. If the keyword doesn't exist, it uses the default // value. -void UpdateBandKey(const std::string &keyname, PvlGroup &bb, const int &nvals, - const std::string &default_value) { +void UpdateBandKey(const QString &keyname, PvlGroup &bb, const int &nvals, + const QString &default_value) { - string defVal(default_value); + QString defVal(default_value); if ( bb.HasKeyword(keyname) ) { defVal = bb[keyname][0]; } diff --git a/isis/src/base/apps/phoempglobal/phoempglobal.cpp b/isis/src/base/apps/phoempglobal/phoempglobal.cpp index fad6774fad..1998359478 100644 --- a/isis/src/base/apps/phoempglobal/phoempglobal.cpp +++ b/isis/src/base/apps/phoempglobal/phoempglobal.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -35,7 +35,7 @@ const int NL(NLP); // Linear Fit params designed to fit the parameter for data type gsl_function // of the Gnu Scientific Library struct linearFitParams { - string empirical; + QString empirical; double **hapke_img; PhotoModel *pmodel; double phase; @@ -66,11 +66,11 @@ void IsisMain() { } // Get Hapke function and parameters - IString sHapkeFunc = ui.GetAsString("PHTNAME"); - sHapkeFunc = sHapkeFunc.UpCase(); + QString sHapkeFunc = ui.GetAsString("PHTNAME"); + sHapkeFunc = sHapkeFunc.toUpper(); // Should contains parameter names matching GUI to be included in the Pvl defFile - vector inclusion; + vector inclusion; inclusion.push_back("PHTNAME"); inclusion.push_back("WH"); inclusion.push_back("HH"); @@ -86,7 +86,7 @@ void IsisMain() { inclusion.push_back("CH"); } else { - string sErrMsg = "Invalid Hapke Function\n"; + QString sErrMsg = "Invalid Hapke Function\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } @@ -100,8 +100,8 @@ void IsisMain() { PhotoModel *hapkeModel = PhotoModelFactory::Create(hapkePvl); // Type of photometric function to fit (lunar-lambert, Minnaert) to the Hapke Model - IString sEmpirical = ui.GetAsString("MODEL"); - sEmpirical = sEmpirical.UpCase(); + QString sEmpirical = ui.GetAsString("MODEL"); + sEmpirical = sEmpirical.toUpper(); PvlKeyword limbValue; if (sEmpirical == "MINNAERT") { @@ -109,7 +109,7 @@ void IsisMain() { } else if (sEmpirical == "LUNARLAMBERT") { limbValue.SetName("LList"); } else { - string sErrMsg = "Invalid Photometric Model\n"; + QString sErrMsg = "Invalid Photometric Model\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } @@ -122,8 +122,8 @@ void IsisMain() { // Order of approximation in atmospheric scatter model bool doAsm = false; - IString sAsmType = ui.GetAsString("ATMNAME"); - sAsmType = sAsmType.UpCase(); + QString sAsmType = ui.GetAsString("ATMNAME"); + sAsmType = sAsmType.toUpper(); if (sAsmType != "NONE") { doAsm = true; } @@ -247,21 +247,21 @@ void IsisMain() { if (!iord) { // Fit with no additive offset: output multiplier normalized to // zero phase, which is the desired phase curve B, and unnormalized - phaseAngle.AddValue(lFitParams.phase); - limbValue.AddValue(rmsmin); - phaseCurve.AddValue(c1/c1_0); + phaseAngle.AddValue(toString(lFitParams.phase)); + limbValue.AddValue(toString(rmsmin)); + phaseCurve.AddValue(toString(c1/c1_0)); } else { // Fit with additive offset: normalizing would make no sense, just // output additive offset and multiplier from fit - phaseAngle.AddValue(lFitParams.phase); - limbValue.AddValue(rmsmin); - phaseCurve.AddValue(c1); + phaseAngle.AddValue(toString(lFitParams.phase)); + limbValue.AddValue(toString(rmsmin)); + phaseCurve.AddValue(toString(c1)); } } if (ui.WasEntered("TO")) { - string sOutfile = ui.GetFileName("TO"); + QString sOutfile = ui.GetFileName("TO"); Pvl mainPvl; PvlObject photoObj("PhotometricModel"); PvlGroup photoGrp("Algorithm"); @@ -347,7 +347,7 @@ double LinearFitPhotometricToHapkeGlobal(double pPar, void* pParams){ double lfit_pho_global; // Output: RMS error of fit struct linearFitParams * lFitParams = (struct linearFitParams *)pParams; - const string pEmpirical = lFitParams->empirical; + const QString pEmpirical = lFitParams->empirical; double ** hapke_img = lFitParams->hapke_img; const bool iord = lFitParams->iord; PhotoModel *pmodel = lFitParams->pmodel; diff --git a/isis/src/base/apps/phoemplocal/phoemplocal.cpp b/isis/src/base/apps/phoemplocal/phoemplocal.cpp index 14562e9e24..44f768c8e8 100644 --- a/isis/src/base/apps/phoemplocal/phoemplocal.cpp +++ b/isis/src/base/apps/phoemplocal/phoemplocal.cpp @@ -50,7 +50,7 @@ typedef struct { // Linear Fit params designed to fit the parameter for data type gsl_function // of the Gnu Scientific Library struct linearFitParams { - string empirical; + QString empirical; HapkeArrs hapkeArrs; Datum datum; Pvl pvl; @@ -94,7 +94,7 @@ void IsisMain() { // Should contains parameter names matching GUI not to be included // in the Pvl defFile - vector inclusion; + vector inclusion; inclusion.clear(); inclusion.push_back("PHTNAME"); inclusion.push_back("WH"); @@ -111,7 +111,7 @@ void IsisMain() { inclusion.push_back("CH"); } else { - string sErrMsg = "Invalid Hapke Function\n"; + QString sErrMsg = "Invalid Hapke Function\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } @@ -125,8 +125,8 @@ void IsisMain() { PhotoModel *hapkeModel = PhotoModelFactory::Create(hapkePvl); // Type of photometric function to fit (lunar-lambert, Minnaert) to the Hapke Model - IString sEmpirical = ui.GetAsString("MODEL"); - sEmpirical = sEmpirical.UpCase(); + QString sEmpirical = ui.GetAsString("MODEL"); + sEmpirical = sEmpirical.toUpper(); Pvl empPvl; empPvl.AddObject(PvlObject("PhotometricModel")); @@ -144,7 +144,7 @@ void IsisMain() { datum.m_rmsSlope = ui.GetDouble("RMS_SLOPE"); // Save output to the Results group - std::stringstream os; + stringstream os; os << "Group = Results" << endl; os << "# EMPIRICAL PHOTOMETRIC PARAMETER AND PHASE CURVES CREATED BY PHO_EMP_LOCAL" << endl; os << "# HAPKE PARAMETERS:" << endl; @@ -164,7 +164,7 @@ void IsisMain() { os << "CH = " << ui.GetDouble("CH") << endl; } else { - string errMsg = "Undefined Hapke Model\n"; + QString errMsg = "Undefined Hapke Model\n"; throw IException(IException::User, errMsg, _FILEINFO_); } @@ -214,7 +214,7 @@ void IsisMain() { os << "# SECOND ORDER HAPKE ATMOSPHERIC SCATTERING MODEL" << endl; } else { - string errMsg = "Undefined Atmospheric Scattering Model\n"; + QString errMsg = "Undefined Atmospheric Scattering Model\n"; throw IException(IException::User, errMsg, _FILEINFO_); } @@ -251,7 +251,7 @@ void IsisMain() { } if (datum.m_phase > (datum.m_emission + datum.m_incidence)) { - string sErrMsg = "No valid fit points\n"; + QString sErrMsg = "No valid fit points\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } else { @@ -293,10 +293,10 @@ void IsisMain() { os << "BEST_FIT_MULTIPLIER = " << lFitParams.c1 << endl; os << "RMS_ERROR_OF_FIT = " << parmin << endl; PvlGroup fitParams("Results"); - fitParams += PvlKeyword("PhaseAngle", datum.m_phase, "degrees"); - fitParams += PvlKeyword("LimbDarkeningParameter", xb); - fitParams += PvlKeyword("BestFitMultiplier", lFitParams.c1); - fitParams += PvlKeyword("RMSErrorOfFit", parmin); + fitParams += PvlKeyword("PhaseAngle", toString(datum.m_phase), "degrees"); + fitParams += PvlKeyword("LimbDarkeningParameter", toString(xb)); + fitParams += PvlKeyword("BestFitMultiplier", toString(lFitParams.c1)); + fitParams += PvlKeyword("RMSErrorOfFit", toString(parmin)); Application::Log(fitParams); } else { @@ -305,11 +305,11 @@ void IsisMain() { os << "BEST_FIT_MULTIPLIER = " << lFitParams.c1 << endl; os << "RMS_ERROR_OF_FIT = " << parmin << endl; PvlGroup fitParams("Results"); - fitParams += PvlKeyword("PhaseAngle", datum.m_phase, "degrees"); - fitParams += PvlKeyword("LimbDarkeningParameter", xb); - fitParams += PvlKeyword("BestFitAdditiveTerm", lFitParams.c0); - fitParams += PvlKeyword("BestFitMultiplier", lFitParams.c1); - fitParams += PvlKeyword("RMSErrorOfFit", parmin); + fitParams += PvlKeyword("PhaseAngle", toString(datum.m_phase), "degrees"); + fitParams += PvlKeyword("LimbDarkeningParameter", toString(xb)); + fitParams += PvlKeyword("BestFitAdditiveTerm", toString(lFitParams.c0)); + fitParams += PvlKeyword("BestFitMultiplier", toString(lFitParams.c1)); + fitParams += PvlKeyword("RMSErrorOfFit", toString(parmin)); Application::Log(fitParams); } @@ -328,7 +328,7 @@ void IsisMain() { mainpvl.AddGroup(note); } mainpvl.AddGroup(results); - string sOutFile = ui.GetFileName("TO"); + QString sOutFile = ui.GetFileName("TO"); bool append = ui.GetBoolean("APPEND"); ofstream os; if (append) { @@ -392,7 +392,7 @@ double LinearFitPhotometricToHapke(double pPar, void* pParams){ // fit of empirical fn to Hapke @ fixed PAR struct linearFitParams * lFitParams = (struct linearFitParams *)pParams; - const string pEmpirical = lFitParams->empirical; + const QString pEmpirical = lFitParams->empirical; const HapkeArrs pHapkeArrs = lFitParams->hapkeArrs; const Datum pDatum = lFitParams->datum; const bool iord = lFitParams->iord; @@ -482,7 +482,7 @@ double LinearFitPhotometricToHapke(double pPar, void* pParams){ */ void GetHapkeImgLocation(PhotoModel *pHapke, AtmosModel *pAsmModel, HapkeArrs & pHapkeArrs, Datum & pDatum) { if (NS != (NL * 2 - 1)) { - string errMsg = "Bad Buffer Dimensions\n"; + QString errMsg = "Bad Buffer Dimensions\n"; throw IException(IException::User, errMsg, _FILEINFO_); } diff --git a/isis/src/base/apps/phohillier/Hillier.cpp b/isis/src/base/apps/phohillier/Hillier.cpp index b3731e7144..f2713c870a 100644 --- a/isis/src/base/apps/phohillier/Hillier.cpp +++ b/isis/src/base/apps/phohillier/Hillier.cpp @@ -107,7 +107,7 @@ namespace Isis { double Hillier::photometry(double i, double e, double g, int band) const { // Test for valid band if((band <= 0) || (band > (int) _bandpho.size())) { - std::string mess = "Provided band " + IString(band) + " out of range."; + QString mess = "Provided band " + toString(band) + " out of range."; throw IException(IException::Programmer, mess, _FILEINFO_); } double ph = photometry(_bandpho[band-1], i, e, g); @@ -170,9 +170,9 @@ namespace Isis { */ void Hillier::Report(PvlContainer &pvl) { pvl += PvlKeyword("Algorithm", "Hillier"); - pvl += PvlKeyword("IncRef", _iRef, "degrees"); - pvl += PvlKeyword("EmaRef", _eRef, "degrees"); - pvl += PvlKeyword("PhaRef", _gRef, "degrees"); + pvl += PvlKeyword("IncRef", toString(_iRef), "degrees"); + pvl += PvlKeyword("EmaRef", toString(_eRef), "degrees"); + pvl += PvlKeyword("PhaRef", toString(_gRef), "degrees"); PvlKeyword units("HillierUnits"); PvlKeyword phostd("PhotometricStandard"); PvlKeyword bbc("BandBinCenter"); @@ -188,17 +188,17 @@ namespace Isis { for(unsigned int i = 0 ; i < _bandpho.size() ; i++) { Parameters &p = _bandpho[i]; units.AddValue(p.units); - phostd.AddValue(p.phoStd); - bbc.AddValue(p.wavelength); - bbct.AddValue(p.tolerance); - bbn.AddValue(p.band); - b0.AddValue(p.b0); - b1.AddValue(p.b1); - a0.AddValue(p.a0); - a1.AddValue(p.a1); - a2.AddValue(p.a2); - a3.AddValue(p.a3); - a4.AddValue(p.a4); + phostd.AddValue(toString(p.phoStd)); + bbc.AddValue(toString(p.wavelength)); + bbct.AddValue(toString(p.tolerance)); + bbn.AddValue(toString(p.band)); + b0.AddValue(toString(p.b0)); + b1.AddValue(toString(p.b1)); + a0.AddValue(toString(p.a0)); + a1.AddValue(toString(p.a1)); + a2.AddValue(toString(p.a2)); + a3.AddValue(toString(p.a3)); + a4.AddValue(toString(p.a4)); } pvl += units; pvl += phostd; @@ -239,8 +239,8 @@ namespace Isis { for(unsigned int i = 0 ; i < _profiles.size() ; i++) { const DbProfile &p = _profiles[i]; if(p.exists("BandBinCenter")) { - double p_center = ConfKey(p, "BandBinCenter", Null); - double tolerance = ConfKey(p, "BandBinCenterTolerance", 1.0E-6); + double p_center = toDouble(ConfKey(p, "BandBinCenter", toString(Null))); + double tolerance = toDouble(ConfKey(p, "BandBinCenterTolerance", toString(1.0E-6))); if(fabs(wavelength - p_center) <= fabs(tolerance)) { Parameters pars = extract(p); pars.iProfile = i; @@ -270,18 +270,18 @@ namespace Isis { */ Hillier::Parameters Hillier::extract(const DbProfile &p) const { Parameters pars; - pars.b0 = ConfKey(p, "B0", 0.0); - pars.b1 = ConfKey(p, "B1", 0.0); - pars.a0 = ConfKey(p, "A0", 0.0); - pars.a1 = ConfKey(p, "A1", 0.0); - pars.a2 = ConfKey(p, "A2", 0.0); - pars.a3 = ConfKey(p, "A3", 0.0); - pars.a4 = ConfKey(p, "A4", 0.0); - pars.wavelength = ConfKey(p, "BandBinCenter", Null); - pars.tolerance = ConfKey(p, "BandBinCenterTolerance", Null); + pars.b0 = toDouble(ConfKey(p, "B0", toString(0.0))); + pars.b1 = toDouble(ConfKey(p, "B1", toString(0.0))); + pars.a0 = toDouble(ConfKey(p, "A0", toString(0.0))); + pars.a1 = toDouble(ConfKey(p, "A1", toString(0.0))); + pars.a2 = toDouble(ConfKey(p, "A2", toString(0.0))); + pars.a3 = toDouble(ConfKey(p, "A3", toString(0.0))); + pars.a4 = toDouble(ConfKey(p, "A4", toString(0.0))); + pars.wavelength = toDouble(ConfKey(p, "BandBinCenter", toString(Null))); + pars.tolerance = toDouble(ConfKey(p, "BandBinCenterTolerance", toString(Null))); // Determine equation units - defaults to Radians - pars.units = ConfKey(p, "HillierUnits", IString("Radians")); - pars.phaUnit = (IString::Equal(pars.units, "Degrees")) ? 1.0 : rpd_c(); + pars.units = ConfKey(p, "HillierUnits", QString("Radians")); + pars.phaUnit = (pars.units.toLower() == "degrees") ? 1.0 : rpd_c(); return (pars); } @@ -308,9 +308,9 @@ namespace Isis { // Interate over all Photometric groups _normProf = DbProfile(pvl.FindObject("NormalizationModel").FindGroup("Algorithm", Pvl::Traverse)); - _iRef = ConfKey(_normProf, "IncRef", 30.0); - _eRef = ConfKey(_normProf, "EmaRef", 0.0); - _gRef = ConfKey(_normProf, "PhaRef", _iRef); + _iRef = toDouble(ConfKey(_normProf, "IncRef", toString(30.0))); + _eRef = toDouble(ConfKey(_normProf, "EmaRef", toString(0.0))); + _gRef = toDouble(ConfKey(_normProf, "PhaRef", toString(_iRef))); // Check for valid incidence angle if(_iRef > fabs(90.0)) { @@ -325,7 +325,7 @@ namespace Isis { DbProfile phoProf = DbProfile(phoObj); PvlObject::PvlGroupIterator algo = phoObj.BeginGroup(); while(algo != phoObj.EndGroup()) { - if(IString::Equal(algo->Name(), "Algorithm")) { + if(algo->Name().toLower() == "algorithm") { _profiles.push_back(DbProfile(phoProf, DbProfile(*algo))); } ++algo; @@ -333,9 +333,9 @@ namespace Isis { Pvl *label = cube.getLabel(); PvlKeyword center = label->FindGroup("BandBin", Pvl::Traverse)["Center"]; - string errs(""); + QString errs(""); for(int i = 0; i < cube.getBandCount() ; i++) { - Parameters parms = findParameters(center[i]); + Parameters parms = findParameters(toDouble(center[i])); if(parms.IsValid()) { parms.band = i + 1; _camera->SetBand(i + 1); @@ -352,7 +352,7 @@ namespace Isis { } // Check for errors and throw them all at the same time - if(!errs.empty()) { + if(!errs.isEmpty()) { errs += " --> Errors in the input PVL file \"" + pvl.FileName() + "\""; throw IException(IException::User, errs, _FILEINFO_); } diff --git a/isis/src/base/apps/phohillier/Hillier.h b/isis/src/base/apps/phohillier/Hillier.h index ffd1ba877d..1ee106d635 100644 --- a/isis/src/base/apps/phohillier/Hillier.h +++ b/isis/src/base/apps/phohillier/Hillier.h @@ -1,4 +1,4 @@ -#if !defined(Hillier_h) +#ifndef Hillier_h #define Hillier_h /** * @file @@ -109,7 +109,7 @@ namespace Isis { double b0, b1, a0, a1, a2, a3, a4; // - T ConfKey(const DbProfile &conf, const std::string &keyname, + T ConfKey(const DbProfile &conf, const QString &keyname, const T &defval, int index = 0) const { if(!conf.exists(keyname)) { return (defval); @@ -155,7 +155,7 @@ namespace Isis { if(conf.count(keyname) < index) { return (defval); } - IString iValue(conf.value(keyname, index)); + QString iValue(conf.value(keyname, index)); T value = iValue; // This makes it work with a string? return (value); } diff --git a/isis/src/base/apps/photemplate/photemplate.cpp b/isis/src/base/apps/photemplate/photemplate.cpp index 721c15d95c..ae57c15b81 100644 --- a/isis/src/base/apps/photemplate/photemplate.cpp +++ b/isis/src/base/apps/photemplate/photemplate.cpp @@ -13,8 +13,8 @@ using namespace Isis; void PrintPvl(); void LoadPvl(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["PrintPvl"] = (void *) PrintPvl; helper ["LoadPvl"] = (void *) LoadPvl; return helper; @@ -29,17 +29,17 @@ void PrintPvl() { UserInterface &ui = Application::GetUserInterface(); // Write file out to log - string inFile(ui.GetFileName("FROMPVL")); + QString inFile(ui.GetFileName("FROMPVL")); Pvl inPvl; inPvl.Read(ui.GetFileName("FROMPVL")); - string Ostring = "***** Output of [" + inFile + "] *****"; - Application::GuiLog(Ostring); + QString OQString = "***** Output of [" + inFile + "] *****"; + Application::GuiLog(OQString); Application::GuiLog(inPvl); } -// Load the values from the input PVL to a string to be displayed +// Load the values from the input PVL to a QString to be displayed // onto the UI. -void LoadKeyValue(const PvlKeyword & key, string & val){ +void LoadKeyValue(const PvlKeyword & key, QString & val){ int size = key.Size(); val = ""; for (int i=0; iHasKeyword("PHTNAME")) { - phtVal = (string)phtGrp->FindKeyword("PHTNAME"); + phtVal = (QString)phtGrp->FindKeyword("PHTNAME"); } else if (phtGrp->HasKeyword("NAME")) { - phtVal = (string)phtGrp->FindKeyword("NAME"); + phtVal = (QString)phtGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid photometric model so you must specify one "; + QString message = "The input PVL does not contain a valid photometric model so you must specify one "; message += "- the [Phtname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - phtVal = phtVal.UpCase(); + phtVal = phtVal.toUpper(); if (phtName == phtVal || phtName == "NONE" || phtName == "FROMPVL") { wasFound = true; } @@ -104,15 +104,15 @@ void LoadPvl() { while (phtGrp != phtObj.EndGroup()) { if (phtGrp->HasKeyword("PHTNAME") || phtGrp->HasKeyword("NAME")) { if (phtGrp->HasKeyword("PHTNAME")) { - phtVal = (string)phtGrp->FindKeyword("PHTNAME"); + phtVal = (QString)phtGrp->FindKeyword("PHTNAME"); } else if (phtGrp->HasKeyword("NAME")) { - phtVal = (string)phtGrp->FindKeyword("NAME"); + phtVal = (QString)phtGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid photometric model so you must specify one "; + QString message = "The input PVL does not contain a valid photometric model so you must specify one "; message += "- the [Phtname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - phtVal = phtVal.UpCase(); + phtVal = phtVal.toUpper(); if (phtName == phtVal) { wasFound = true; break; @@ -160,15 +160,15 @@ void LoadPvl() { ui.PutAsString("B0", keyVal); } if (phtGrp->HasKeyword("ZEROB0STANDARD")) { - string zerob0 = (string)phtGrp->FindKeyword("ZEROB0STANDARD"); - IString izerob0 = zerob0; - izerob0 = izerob0.UpCase(); + QString zerob0 = (QString)phtGrp->FindKeyword("ZEROB0STANDARD"); + QString izerob0 = zerob0; + izerob0 = izerob0.toUpper(); if (izerob0 == "TRUE") { ui.PutString("ZEROB0STANDARD", "TRUE"); } else if (izerob0 == "FALSE") { ui.PutString("ZEROB0STANDARD", "FALSE"); } else { - string message = "The ZEROB0STANDARD value is invalid - must be set to TRUE or FALSE"; + QString message = "The ZEROB0STANDARD value is invalid - must be set to TRUE or FALSE"; throw IException(IException::User, message, _FILEINFO_); } } @@ -235,7 +235,7 @@ void LoadPvl() { } } else if (phtVal != "LAMBERT" && phtVal != "LOMMELSEELIGER" && phtVal != "LUNARLAMBERTMCEWEN") { - string message = "Unsupported photometric model [" + phtVal + "]."; + QString message = "Unsupported photometric model [" + phtVal + "]."; throw IException(IException::User, message, _FILEINFO_); } ui.PutAsString("PHTNAME", phtVal); @@ -243,11 +243,11 @@ void LoadPvl() { } } - IString atmVal; + QString atmVal; if (inPvl.HasObject("AtmosphericModel")) { PvlObject atmObj = inPvl.FindObject("AtmosphericModel"); if (!atmObj.HasGroup("Algorithm")) { - string message = "The input PVL does not contain a valid atmospheric model so you must specify one "; + QString message = "The input PVL does not contain a valid atmospheric model so you must specify one "; message += "- the [Algorithm] group is missing in your [AtmosphericModel]"; throw IException(IException::User, message, _FILEINFO_); } @@ -255,15 +255,15 @@ void LoadPvl() { PvlObject::PvlGroupIterator atmGrp = atmObj.BeginGroup(); bool wasFound = false; if (atmGrp->HasKeyword("ATMNAME")) { - atmVal = (string)atmGrp->FindKeyword("ATMNAME"); + atmVal = (QString)atmGrp->FindKeyword("ATMNAME"); } else if (atmGrp->HasKeyword("NAME")) { - atmVal = (string)atmGrp->FindKeyword("NAME"); + atmVal = (QString)atmGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid atmospheric model so you must specify one "; + QString message = "The input PVL does not contain a valid atmospheric model so you must specify one "; message += "- the [Atmname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - atmVal = atmVal.UpCase(); + atmVal = atmVal.toUpper(); if (atmName == atmVal || atmName == "NONE" || atmName == "FROMPVL") { wasFound = true; } @@ -271,15 +271,15 @@ void LoadPvl() { while (atmGrp != atmObj.EndGroup()) { if (atmGrp->HasKeyword("ATMNAME") || atmGrp->HasKeyword("NAME")) { if (atmGrp->HasKeyword("ATMNAME")) { - atmVal = (string)atmGrp->FindKeyword("ATMNAME"); + atmVal = (QString)atmGrp->FindKeyword("ATMNAME"); } else if (atmGrp->HasKeyword("NAME")) { - atmVal = (string)atmGrp->FindKeyword("NAME"); + atmVal = (QString)atmGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid atmospheric model so you must specify one "; + QString message = "The input PVL does not contain a valid atmospheric model so you must specify one "; message += "- the [Atmname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - atmVal = atmVal.UpCase(); + atmVal = atmVal.toUpper(); if (atmName == atmVal) { wasFound = true; break; @@ -303,34 +303,34 @@ void LoadPvl() { double hnorm = atmGrp->FindKeyword("HNORM"); os.str(""); os << hnorm; - ui.PutAsString("HNORM", os.str()); + ui.PutAsString("HNORM", os.str().c_str()); } if (atmGrp->HasKeyword("TAU")) { double tau = atmGrp->FindKeyword("TAU"); os.str(""); os << tau; - ui.PutAsString("TAU", os.str()); + ui.PutAsString("TAU", os.str().c_str()); } if (atmGrp->HasKeyword("TAUREF")) { double tauref = atmGrp->FindKeyword("TAUREF"); os.str(""); os << tauref; - ui.PutAsString("TAUREF", os.str()); + ui.PutAsString("TAUREF", os.str().c_str()); } if (atmGrp->HasKeyword("WHA")) { double wha = atmGrp->FindKeyword("WHA"); os.str(""); os << wha; - ui.PutAsString("WHA", os.str()); + ui.PutAsString("WHA", os.str().c_str()); } if (atmGrp->HasKeyword("NULNEG")) { - string nulneg = (string)atmGrp->FindKeyword("NULNEG"); + QString nulneg = (QString)atmGrp->FindKeyword("NULNEG"); if (nulneg.compare("YES")) { ui.PutString("NULNEG", "YES"); } else if (nulneg.compare("NO")) { ui.PutString("NULNEG", "NO"); } else { - string message = "The NULNEG value is invalid - must be set to YES or NO"; + QString message = "The NULNEG value is invalid - must be set to YES or NO"; throw IException(IException::User, message, _FILEINFO_); } } @@ -340,7 +340,7 @@ void LoadPvl() { double bha = atmGrp->FindKeyword("BHA"); os.str(""); os << bha; - ui.PutAsString("BHA", os.str()); + ui.PutAsString("BHA", os.str().c_str()); } } if (atmVal == "HAPKEATM1" || atmVal == "HAPKEATM2") { @@ -348,14 +348,14 @@ void LoadPvl() { double hga = atmGrp->FindKeyword("HGA"); os.str(""); os << hga; - ui.PutAsString("HGA", os.str()); + ui.PutAsString("HGA", os.str().c_str()); } } if (atmVal != "ANISOTROPIC1" && atmVal != "ANISOTROPIC2" && atmVal != "HAPKEATM1" && atmVal != "HAPKEATM2" && atmVal != "ISOTROPIC1" && atmVal != "ISOTROPIC2") { - string message = "Unsupported atmospheric model [" + atmVal + "]."; + QString message = "Unsupported atmospheric model [" + atmVal + "]."; throw IException(IException::User, message, _FILEINFO_); } ui.PutAsString("ATMNAME", atmVal); @@ -369,7 +369,7 @@ void IsisMain() { // to the file. If no extension is given, '.pvl' will be used. UserInterface &ui = Application::GetUserInterface(); FileName out = ui.GetFileName("TOPVL"); - string output = ui.GetFileName("TOPVL"); + QString output = ui.GetFileName("TOPVL"); if(out.extension() == "") { output += ".pvl"; } @@ -379,13 +379,13 @@ void IsisMain() { Pvl op; if (ui.WasEntered("FROMPVL")) { - string input = ui.GetFileName("FROMPVL"); + QString input = ui.GetFileName("FROMPVL"); p.Read(input); } //Check to make sure that a model was specified if (ui.GetAsString("PHTNAME") == "NONE" && ui.GetAsString("ATMNAME") == "NONE") { - string message = "A photometric model or an atmospheric model must be specified before running this program"; + QString message = "A photometric model or an atmospheric model must be specified before running this program"; throw IException(IException::User, message, _FILEINFO_); } @@ -406,9 +406,9 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { UserInterface &ui = Application::GetUserInterface(); bool wasFound = false; - IString phtName = ui.GetAsString("PHTNAME"); - phtName = phtName.UpCase(); - IString phtVal; + QString phtName = ui.GetAsString("PHTNAME"); + phtName = phtName.toUpper(); + QString phtVal; PvlObject pvlObj; PvlGroup pvlGrp; if (pvl.HasObject("PhotometricModel")) { @@ -416,13 +416,13 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { if (pvlObj.HasGroup("Algorithm")) { PvlObject::PvlGroupIterator pvlGrp = pvlObj.BeginGroup(); if (pvlGrp->HasKeyword("PHTNAME")) { - phtVal = (string)pvlGrp->FindKeyword("PHTNAME"); + phtVal = (QString)pvlGrp->FindKeyword("PHTNAME"); } else if (pvlGrp->HasKeyword("NAME")) { - phtVal = (string)pvlGrp->FindKeyword("NAME"); + phtVal = (QString)pvlGrp->FindKeyword("NAME"); } else { phtVal = "NONE"; } - phtVal = phtVal.UpCase(); + phtVal = phtVal.toUpper(); if (phtName == phtVal) { wasFound = true; } @@ -430,13 +430,13 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { while (pvlGrp != pvlObj.EndGroup()) { if (pvlGrp->HasKeyword("PHTNAME") || pvlGrp->HasKeyword("NAME")) { if (pvlGrp->HasKeyword("PHTNAME")) { - phtVal = (string)pvlGrp->FindKeyword("PHTNAME"); + phtVal = (QString)pvlGrp->FindKeyword("PHTNAME"); } else if (pvlGrp->HasKeyword("NAME")) { - phtVal = (string)pvlGrp->FindKeyword("NAME"); + phtVal = (QString)pvlGrp->FindKeyword("NAME"); } else { phtVal = "NONE"; } - phtVal = phtVal.UpCase(); + phtVal = phtVal.toUpper(); if (phtName == phtVal) { wasFound = true; break; @@ -474,7 +474,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("THETA")) { - string message = "The " + phtName + " Photometric model requires a value for the THETA parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the THETA parameter."; message += "The normal range for THETA is: 0 <= THETA <= 90"; throw IException(IException::User, message, _FILEINFO_); } @@ -487,7 +487,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("WH")) { - string message = "The " + phtName + " Photometric model requires a value for the WH parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the WH parameter."; message += "The normal range for WH is: 0 < WH <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -500,7 +500,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("HH")) { - string message = "The " + phtName + " Photometric model requires a value for the HH parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the HH parameter."; message += "The normal range for HH is: 0 <= HH"; throw IException(IException::User, message, _FILEINFO_); } @@ -513,7 +513,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("B0")) { - string message = "The " + phtName + " Photometric model requires a value for the B0 parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the B0 parameter."; message += "The normal range for B0 is: 0 <= B0"; throw IException(IException::User, message, _FILEINFO_); } @@ -547,7 +547,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("HG1")) { - string message = "The " + phtName + " Photometric model requires a value for the HG1 parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the HG1 parameter."; message += "The normal range for HG1 is: -1 < HG1 < 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -560,7 +560,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("HG2")) { - string message = "The " + phtName + " Photometric model requires a value for the HG2 parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the HG2 parameter."; message += "The normal range for HG2 is: 0 <= HG2 <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -574,7 +574,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("BH")) { - string message = "The " + phtName + " Photometric model requires a value for the BH parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the BH parameter."; message += "The normal range for BH is: -1 <= BH <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -587,7 +587,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("CH")) { - string message = "The " + phtName + " Photometric model requires a value for the CH parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the CH parameter."; message += "The normal range for CH is: -1 <= CH <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -610,7 +610,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("PHASELIST")) { - string message = "The " + phtName + " Photometric model requires a value for the PHASELIST parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the PHASELIST parameter."; throw IException(IException::User, message, _FILEINFO_); } phaselistsize = outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). @@ -625,7 +625,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("PHASECURVELIST")) { - string message = "The " + phtName + " Photometric model requires a value for the PHASECURVELIST parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the PHASECURVELIST parameter."; throw IException(IException::User, message, _FILEINFO_); } phasecurvelistsize = outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). @@ -641,14 +641,14 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("LLIST")) { - string message = "The " + phtName + " Photometric model requires a value for the LLIST parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the LLIST parameter."; throw IException(IException::User, message, _FILEINFO_); } llistsize = outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). FindKeyword("LLIST").Size(); } if (llistsize != phaselistsize || llistsize != phasecurvelistsize) { - string message = "The " + phtName + " Photometric model requires that the LLIST, "; + QString message = "The " + phtName + " Photometric model requires that the LLIST, "; message += "PHASELIST, and PHASECURVELIST parameters all have the same number of "; message += "entries."; throw IException(IException::User, message, _FILEINFO_); @@ -663,14 +663,14 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("KLIST")) { - string message = "The " + phtName + " Photometric model requires a value for the KLIST parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the KLIST parameter."; throw IException(IException::User, message, _FILEINFO_); } klistsize = outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). FindKeyword("KLIST").Size(); } if (klistsize != phaselistsize || klistsize != phasecurvelistsize) { - string message = "The " + phtName + " Photometric model requires that the KLIST, "; + QString message = "The " + phtName + " Photometric model requires that the KLIST, "; message += "PHASELIST, and PHASECURVELIST parameters all have the same number of "; message += "entries."; throw IException(IException::User, message, _FILEINFO_); @@ -687,7 +687,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("L")) { - string message = "The " + phtName + " Photometric model requires a value for the L parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the L parameter."; message += "The L parameter has no limited range"; throw IException(IException::User, message, _FILEINFO_); } @@ -703,7 +703,7 @@ void addPhoModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("K")) { - string message = "The " + phtName + " Photometric model requires a value for the K parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the K parameter."; message += "The normal range for K is: 0 <= K"; throw IException(IException::User, message, _FILEINFO_); } @@ -716,9 +716,9 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { UserInterface &ui = Application::GetUserInterface(); bool wasFound = false; - IString atmName = ui.GetAsString("ATMNAME"); - atmName = atmName.UpCase(); - IString atmVal; + QString atmName = ui.GetAsString("ATMNAME"); + atmName = atmName.toUpper(); + QString atmVal; PvlObject pvlObj; PvlGroup pvlGrp; if (pvl.HasObject("AtmosphericModel")) { @@ -726,13 +726,13 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { if (pvlObj.HasGroup("Algorithm")) { PvlObject::PvlGroupIterator pvlGrp = pvlObj.BeginGroup(); if (pvlGrp->HasKeyword("ATMNAME")) { - atmVal = (string)pvlGrp->FindKeyword("ATMNAME"); + atmVal = (QString)pvlGrp->FindKeyword("ATMNAME"); } else if (pvlGrp->HasKeyword("NAME")) { - atmVal = (string)pvlGrp->FindKeyword("NAME"); + atmVal = (QString)pvlGrp->FindKeyword("NAME"); } else { atmVal = "NONE"; } - atmVal = atmVal.UpCase(); + atmVal = atmVal.toUpper(); if (atmName == atmVal) { wasFound = true; } @@ -740,13 +740,13 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { while (pvlGrp != pvlObj.EndGroup()) { if (pvlGrp->HasKeyword("ATMNAME") || pvlGrp->HasKeyword("NAME")) { if (pvlGrp->HasKeyword("ATMNAME")) { - atmVal = (string)pvlGrp->FindKeyword("ATMNAME"); + atmVal = (QString)pvlGrp->FindKeyword("ATMNAME"); } else if (pvlGrp->HasKeyword("NAME")) { - atmVal = (string)pvlGrp->FindKeyword("NAME"); + atmVal = (QString)pvlGrp->FindKeyword("NAME"); } else { atmVal = "NONE"; } - atmVal = atmVal.UpCase(); + atmVal = atmVal.toUpper(); if (atmName == atmVal) { wasFound = true; break; @@ -785,7 +785,7 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("HNORM")) { - string message = "The " + atmName + " Atmospheric model requires a value for the HNORM parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the HNORM parameter."; message += "The normal range for HNORM is: 0 <= HNORM"; throw IException(IException::User, message, _FILEINFO_); } @@ -798,7 +798,7 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("TAU")) { - string message = "The " + atmName + " Atmospheric model requires a value for the TAU parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the TAU parameter."; message += "The normal range for TAU is: 0 <= TAU"; throw IException(IException::User, message, _FILEINFO_); } @@ -811,7 +811,7 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("TAUREF")) { - string message = "The " + atmName + " Atmospheric model requires a value for the TAUREF parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the TAUREF parameter."; message += "The normal range for TAUREF is: 0 <= TAUREF"; throw IException(IException::User, message, _FILEINFO_); } @@ -824,7 +824,7 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("WHA")) { - string message = "The " + atmName + " Atmospheric model requires a value for the WHA parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the WHA parameter."; message += "The normal range for WHA is: 0 < WHA < 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -838,7 +838,7 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { AddKeyword(PvlKeyword("NULNEG","NO"),Pvl::Replace); } else if (!outPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("NULNEG")) { - string message = "The " + atmName + " Atmospheric model requires a value for the NULNEG parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the NULNEG parameter."; message += "The valid values for NULNEG are: YES, NO"; throw IException(IException::User, message, _FILEINFO_); } @@ -853,7 +853,7 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("BHA")) { - string message = "The " + atmName + " Atmospheric model requires a value for the BHA parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the BHA parameter."; message += "The normal range for BHA is: -1 <= BHA <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -868,7 +868,7 @@ void addAtmosModel(Pvl &pvl, Pvl &outPvl) { } else { if (!outPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("HGA")) { - string message = "The " + atmName + " Atmospheric model requires a value for the HGA parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the HGA parameter."; message += "The normal range for HGA is: -1 < HGA < 1"; throw IException(IException::User, message, _FILEINFO_); } diff --git a/isis/src/base/apps/photomet/photomet.cpp b/isis/src/base/apps/photomet/photomet.cpp index cecf942a72..55383928cb 100644 --- a/isis/src/base/apps/photomet/photomet.cpp +++ b/isis/src/base/apps/photomet/photomet.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include "Angle.h" #include "Camera.h" @@ -24,8 +24,8 @@ using namespace Isis; void PrintPvl(); void LoadPvl(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["PrintPvl"] = (void *) PrintPvl; helper ["LoadPvl"] = (void *) LoadPvl; return helper; @@ -38,7 +38,7 @@ Photometry *pho; double maxema; double maxinc; bool usedem; -string angleSource; +QString angleSource; double centerPhase; double centerIncidence; double centerEmission; @@ -58,11 +58,11 @@ void PrintPvl() { UserInterface &ui = Application::GetUserInterface(); // Write file out to log - string inFile(ui.GetFileName("FROMPVL")); + QString inFile(ui.GetFileName("FROMPVL")); Pvl inPvl; inPvl.Read(ui.GetFileName("FROMPVL")); - string Ostring = "***** Output of [" + inFile + "] *****"; - Application::GuiLog(Ostring); + QString OQString = "***** Output of [" + inFile + "] *****"; + Application::GuiLog(OQString); Application::GuiLog(inPvl); } @@ -70,21 +70,21 @@ void PrintPvl() { void LoadPvl() { std::stringstream os; UserInterface &ui = Application::GetUserInterface(); - string inFile(ui.GetFileName("FROMPVL")); + QString inFile(ui.GetFileName("FROMPVL")); Pvl inPvl; inPvl.Read(inFile); - IString phtName = ui.GetAsString("PHTNAME"); - phtName = phtName.UpCase(); - IString atmName = ui.GetAsString("ATMNAME"); - atmName = atmName.UpCase(); - IString nrmName = ui.GetAsString("NORMNAME"); - nrmName = nrmName.UpCase(); + QString phtName = ui.GetAsString("PHTNAME"); + phtName = phtName.toUpper(); + QString atmName = ui.GetAsString("ATMNAME"); + atmName = atmName.toUpper(); + QString nrmName = ui.GetAsString("NORMNAME"); + nrmName = nrmName.toUpper(); - IString phtVal; + QString phtVal; if (inPvl.HasObject("PhotometricModel")) { PvlObject phtObj = inPvl.FindObject("PhotometricModel"); if (!phtObj.HasGroup("Algorithm")) { - string message = "The input PVL does not contain a valid photometric model so you must specify one "; + QString message = "The input PVL does not contain a valid photometric model so you must specify one "; message += "- the [Algorithm] group is missing in your [PhotometricModel]"; throw IException(IException::User, message, _FILEINFO_); } @@ -92,15 +92,15 @@ void LoadPvl() { PvlObject::PvlGroupIterator phtGrp = phtObj.BeginGroup(); bool wasFound = false; if (phtGrp->HasKeyword("PHTNAME")) { - phtVal = (string)phtGrp->FindKeyword("PHTNAME"); + phtVal = (QString)phtGrp->FindKeyword("PHTNAME"); } else if (phtGrp->HasKeyword("NAME")) { - phtVal = (string)phtGrp->FindKeyword("NAME"); + phtVal = (QString)phtGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid photometric model so you must specify one "; + QString message = "The input PVL does not contain a valid photometric model so you must specify one "; message += "- the [Phtname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - phtVal = phtVal.UpCase(); + phtVal = phtVal.toUpper(); if (phtName == phtVal || phtName == "NONE" || phtName == "FROMPVL") { wasFound = true; } @@ -108,15 +108,15 @@ void LoadPvl() { while (phtGrp != phtObj.EndGroup()) { if (phtGrp->HasKeyword("PHTNAME") || phtGrp->HasKeyword("NAME")) { if (phtGrp->HasKeyword("PHTNAME")) { - phtVal = (string)phtGrp->FindKeyword("PHTNAME"); + phtVal = (QString)phtGrp->FindKeyword("PHTNAME"); } else if (phtGrp->HasKeyword("NAME")) { - phtVal = (string)phtGrp->FindKeyword("NAME"); + phtVal = (QString)phtGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid photometric model so you must specify one "; + QString message = "The input PVL does not contain a valid photometric model so you must specify one "; message += "- the [Phtname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - phtVal = phtVal.UpCase(); + phtVal = phtVal.toUpper(); if (phtName == phtVal) { wasFound = true; break; @@ -147,36 +147,36 @@ void LoadPvl() { double theta = phtGrp->FindKeyword("THETA"); os.str(""); os << theta; - ui.PutAsString("THETA", os.str()); + ui.PutAsString("THETA", os.str().c_str()); } if (phtGrp->HasKeyword("WH")) { double wh = phtGrp->FindKeyword("WH"); os.str(""); os << wh; - ui.PutAsString("WH", os.str()); + ui.PutAsString("WH", os.str().c_str()); } if (phtGrp->HasKeyword("HH")) { double hh = phtGrp->FindKeyword("HH"); os.str(""); os << hh; - ui.PutAsString("HH", os.str()); + ui.PutAsString("HH", os.str().c_str()); } if (phtGrp->HasKeyword("B0")) { double b0 = phtGrp->FindKeyword("B0"); os.str(""); os << b0; - ui.PutAsString("B0", os.str()); + ui.PutAsString("B0", os.str().c_str()); } if (phtGrp->HasKeyword("ZEROB0STANDARD")) { - string zerob0 = (string)phtGrp->FindKeyword("ZEROB0STANDARD"); - IString izerob0 = zerob0; - izerob0 = izerob0.UpCase(); + QString zerob0 = (QString)phtGrp->FindKeyword("ZEROB0STANDARD"); + QString izerob0 = zerob0; + izerob0 = izerob0.toUpper(); if (izerob0 == "TRUE") { ui.PutString("ZEROB0STANDARD", "TRUE"); } else if (izerob0 == "FALSE") { ui.PutString("ZEROB0STANDARD", "FALSE"); } else { - string message = "The ZEROB0STANDARD value is invalid - must be set to TRUE or FALSE"; + QString message = "The ZEROB0STANDARD value is invalid - must be set to TRUE or FALSE"; throw IException(IException::User, message, _FILEINFO_); } } @@ -185,13 +185,13 @@ void LoadPvl() { double hg1 = phtGrp->FindKeyword("HG1"); os.str(""); os << hg1; - ui.PutAsString("HG1", os.str()); + ui.PutAsString("HG1", os.str().c_str()); } if (phtGrp->HasKeyword("HG2")) { double hg2 = phtGrp->FindKeyword("HG2"); os.str(""); os << hg2; - ui.PutAsString("HG2", os.str()); + ui.PutAsString("HG2", os.str().c_str()); } } if (phtVal == "HAPKELEG") { @@ -199,33 +199,33 @@ void LoadPvl() { double bh = phtGrp->FindKeyword("BH"); os.str(""); os << bh; - ui.PutAsString("BH", os.str()); + ui.PutAsString("BH", os.str().c_str()); } if (phtGrp->HasKeyword("CH")) { double ch = phtGrp->FindKeyword("CH"); os.str(""); os << ch; - ui.PutAsString("CH", os.str()); + ui.PutAsString("CH", os.str().c_str()); } } } else if (phtVal == "LUNARLAMBERTEMPIRICAL" || phtVal == "MINNAERTEMPIRICAL") { if (phtGrp->HasKeyword("PHASELIST")) { - string phaselist = (string)phtGrp->FindKeyword("PHASELIST"); + QString phaselist = (QString)phtGrp->FindKeyword("PHASELIST"); ui.PutAsString("PHASELIST", phaselist); } if (phtGrp->HasKeyword("PHASECURVELIST")) { - string phasecurvelist = (string)phtGrp->FindKeyword("PHASECURVELIST"); + QString phasecurvelist = (QString)phtGrp->FindKeyword("PHASECURVELIST"); ui.PutAsString("PHASECURVELIST", phasecurvelist); } if (phtVal == "LUNARLAMBERTEMPIRICAL") { if (phtGrp->HasKeyword("LLIST")) { - string llist = (string)phtGrp->FindKeyword("LLIST"); + QString llist = (QString)phtGrp->FindKeyword("LLIST"); ui.PutAsString("LLIST", llist); } } if (phtVal == "MINNAERTEMPIRICAL") { if (phtGrp->HasKeyword("KLIST")) { - string klist = (string)phtGrp->FindKeyword("KLIST"); + QString klist = (QString)phtGrp->FindKeyword("KLIST"); ui.PutAsString("KLIST", klist); } } @@ -234,18 +234,18 @@ void LoadPvl() { double l = phtGrp->FindKeyword("L"); os.str(""); os << l; - ui.PutAsString("L", os.str()); + ui.PutAsString("L", os.str().c_str()); } } else if (phtVal == "MINNAERT") { if (phtGrp->HasKeyword("K")) { double k = phtGrp->FindKeyword("K"); os.str(""); os << k; - ui.PutAsString("K", os.str()); + ui.PutAsString("K", os.str().c_str()); } } else if (phtVal != "LAMBERT" && phtVal != "LOMMELSEELIGER" && phtVal != "LUNARLAMBERTMCEWEN") { - string message = "Unsupported photometric model [" + phtVal + "]."; + QString message = "Unsupported photometric model [" + phtVal + "]."; throw IException(IException::User, message, _FILEINFO_); } ui.PutAsString("PHTNAME", phtVal); @@ -253,11 +253,11 @@ void LoadPvl() { } } - IString nrmVal; + QString nrmVal; if (inPvl.HasObject("NormalizationModel")) { PvlObject nrmObj = inPvl.FindObject("NormalizationModel"); if (!nrmObj.HasGroup("Algorithm")) { - string message = "The input PVL does not contain a valid normalization model so you must specify one "; + QString message = "The input PVL does not contain a valid normalization model so you must specify one "; message += "- the [Algorithm] group is missing in your [NormalizationModel]"; throw IException(IException::User, message, _FILEINFO_); } @@ -265,15 +265,15 @@ void LoadPvl() { PvlObject::PvlGroupIterator nrmGrp = nrmObj.BeginGroup(); bool wasFound = false; if (nrmGrp->HasKeyword("NORMNAME")) { - nrmVal = (string)nrmGrp->FindKeyword("NORMNAME"); + nrmVal = (QString)nrmGrp->FindKeyword("NORMNAME"); } else if (nrmGrp->HasKeyword("NAME")) { - nrmVal = (string)nrmGrp->FindKeyword("NAME"); + nrmVal = (QString)nrmGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid normalization model so you must specify one "; + QString message = "The input PVL does not contain a valid normalization model so you must specify one "; message += "- the [Normname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - nrmVal = nrmVal.UpCase(); + nrmVal = nrmVal.toUpper(); if (nrmName == nrmVal || nrmName == "NONE" || nrmName == "FROMPVL") { wasFound = true; } @@ -281,15 +281,15 @@ void LoadPvl() { while (nrmGrp != nrmObj.EndGroup()) { if (nrmGrp->HasKeyword("NORMNAME") || nrmGrp->HasKeyword("NAME")) { if (nrmGrp->HasKeyword("NORMNAME")) { - nrmVal = (string)nrmGrp->FindKeyword("NORMNAME"); + nrmVal = (QString)nrmGrp->FindKeyword("NORMNAME"); } else if (nrmGrp->HasKeyword("NAME")) { - nrmVal = (string)nrmGrp->FindKeyword("NAME"); + nrmVal = (QString)nrmGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid normalization model so you must specify one "; + QString message = "The input PVL does not contain a valid normalization model so you must specify one "; message += "- the [Normname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - nrmVal = nrmVal.UpCase(); + nrmVal = nrmVal.toUpper(); if (nrmName == nrmVal) { wasFound = true; break; @@ -323,93 +323,93 @@ void LoadPvl() { double incref = nrmGrp->FindKeyword("INCREF"); os.str(""); os << incref; - ui.PutAsString("INCREF", os.str()); + ui.PutAsString("INCREF", os.str().c_str()); } if (nrmGrp->HasKeyword("INCMAT") && nrmVal == "MIXED") { double incmat = nrmGrp->FindKeyword("INCMAT"); os.str(""); os << incmat; - ui.PutAsString("INCMAT", os.str()); + ui.PutAsString("INCMAT", os.str().c_str()); } if (nrmGrp->HasKeyword("THRESH")) { double thresh = nrmGrp->FindKeyword("THRESH"); os.str(""); os << thresh; - ui.PutAsString("THRESH", os.str()); + ui.PutAsString("THRESH", os.str().c_str()); } if (nrmGrp->HasKeyword("ALBEDO")) { double albedo = nrmGrp->FindKeyword("ALBEDO"); os.str(""); os << albedo; - ui.PutAsString("ALBEDO", os.str()); + ui.PutAsString("ALBEDO", os.str().c_str()); } } else if (nrmVal == "SHADE") { if (nrmGrp->HasKeyword("INCREF")) { double incref = nrmGrp->FindKeyword("INCREF"); os.str(""); os << incref; - ui.PutAsString("INCREF", os.str()); + ui.PutAsString("INCREF", os.str().c_str()); } if (nrmGrp->HasKeyword("ALBEDO")) { double albedo = nrmGrp->FindKeyword("ALBEDO"); os.str(""); os << albedo; - ui.PutAsString("ALBEDO", os.str()); + ui.PutAsString("ALBEDO", os.str().c_str()); } } else if (nrmVal == "TOPO") { if (nrmGrp->HasKeyword("INCREF")) { double incref = nrmGrp->FindKeyword("INCREF"); os.str(""); os << incref; - ui.PutAsString("INCREF", os.str()); + ui.PutAsString("INCREF", os.str().c_str()); } if (nrmGrp->HasKeyword("ALBEDO")) { double albedo = nrmGrp->FindKeyword("ALBEDO"); os.str(""); os << albedo; - ui.PutAsString("ALBEDO", os.str()); + ui.PutAsString("ALBEDO", os.str().c_str()); } if (nrmGrp->HasKeyword("THRESH")) { double thresh = nrmGrp->FindKeyword("THRESH"); os.str(""); os << thresh; - ui.PutAsString("THRESH", os.str()); + ui.PutAsString("THRESH", os.str().c_str()); } } else if (nrmVal == "ALBEDOATM") { if (nrmGrp->HasKeyword("INCREF")) { double incref = nrmGrp->FindKeyword("INCREF"); os.str(""); os << incref; - ui.PutAsString("INCREF", os.str()); + ui.PutAsString("INCREF", os.str().c_str()); } } else if (nrmVal == "SHADEATM") { if (nrmGrp->HasKeyword("INCREF")) { double incref = nrmGrp->FindKeyword("INCREF"); os.str(""); os << incref; - ui.PutAsString("INCREF", os.str()); + ui.PutAsString("INCREF", os.str().c_str()); } if (nrmGrp->HasKeyword("ALBEDO")) { double albedo = nrmGrp->FindKeyword("ALBEDO"); os.str(""); os << albedo; - ui.PutAsString("ALBEDO", os.str()); + ui.PutAsString("ALBEDO", os.str().c_str()); } } else if (nrmVal == "TOPOATM") { if (nrmGrp->HasKeyword("INCREF")) { double incref = nrmGrp->FindKeyword("INCREF"); os.str(""); os << incref; - ui.PutAsString("INCREF", os.str()); + ui.PutAsString("INCREF", os.str().c_str()); } if (nrmGrp->HasKeyword("ALBEDO")) { double albedo = nrmGrp->FindKeyword("ALBEDO"); os.str(""); os << albedo; - ui.PutAsString("ALBEDO", os.str()); + ui.PutAsString("ALBEDO", os.str().c_str()); } } else { - string message = "Unsupported normalization model [" + nrmVal + "]."; + QString message = "Unsupported normalization model [" + nrmVal + "]."; throw IException(IException::User, message, _FILEINFO_); } } else { @@ -417,61 +417,61 @@ void LoadPvl() { double d = nrmGrp->FindKeyword("D"); os.str(""); os << d; - ui.PutAsString("D", os.str()); + ui.PutAsString("D", os.str().c_str()); } if (nrmGrp->HasKeyword("E")) { double e = nrmGrp->FindKeyword("E"); os.str(""); os << e; - ui.PutAsString("E", os.str()); + ui.PutAsString("E", os.str().c_str()); } if (nrmGrp->HasKeyword("F")) { double f = nrmGrp->FindKeyword("F"); os.str(""); os << f; - ui.PutAsString("F", os.str()); + ui.PutAsString("F", os.str().c_str()); } if (nrmGrp->HasKeyword("G2")) { double g2 = nrmGrp->FindKeyword("G2"); os.str(""); os << g2; - ui.PutAsString("G2", os.str()); + ui.PutAsString("G2", os.str().c_str()); } if (nrmGrp->HasKeyword("XMUL")) { double xmul = nrmGrp->FindKeyword("XMUL"); os.str(""); os << xmul; - ui.PutAsString("XMUL", os.str()); + ui.PutAsString("XMUL", os.str().c_str()); } if (nrmGrp->HasKeyword("WL")) { double wl = nrmGrp->FindKeyword("WL"); os.str(""); os << wl; - ui.PutAsString("WL", os.str()); + ui.PutAsString("WL", os.str().c_str()); } if (nrmGrp->HasKeyword("H")) { double h = nrmGrp->FindKeyword("H"); os.str(""); os << h; - ui.PutAsString("H", os.str()); + ui.PutAsString("H", os.str().c_str()); } if (nrmGrp->HasKeyword("BSH1")) { double bsh1 = nrmGrp->FindKeyword("BSH1"); os.str(""); os << bsh1; - ui.PutAsString("BSH1", os.str()); + ui.PutAsString("BSH1", os.str().c_str()); } if (nrmGrp->HasKeyword("XB1")) { double xb1 = nrmGrp->FindKeyword("XB1"); os.str(""); os << xb1; - ui.PutAsString("XB1", os.str()); + ui.PutAsString("XB1", os.str().c_str()); } if (nrmGrp->HasKeyword("XB2")) { double xb2 = nrmGrp->FindKeyword("XB2"); os.str(""); os << xb2; - ui.PutAsString("XB2", os.str()); + ui.PutAsString("XB2", os.str().c_str()); } } ui.PutAsString("NORMNAME", nrmVal); @@ -487,11 +487,11 @@ void LoadPvl() { else if (nrmName != "ALBEDOATM" && nrmName != "SHADEATM" && nrmName != "TOPOATM") { return; } - IString atmVal; + QString atmVal; if (inPvl.HasObject("AtmosphericModel")) { PvlObject atmObj = inPvl.FindObject("AtmosphericModel"); if (!atmObj.HasGroup("Algorithm")) { - string message = "The input PVL does not contain a valid atmospheric model so you must specify one "; + QString message = "The input PVL does not contain a valid atmospheric model so you must specify one "; message += "- the [Algorithm] group is missing in your [AtmosphericModel]"; throw IException(IException::User, message, _FILEINFO_); } @@ -499,15 +499,15 @@ void LoadPvl() { PvlObject::PvlGroupIterator atmGrp = atmObj.BeginGroup(); bool wasFound = false; if (atmGrp->HasKeyword("ATMNAME")) { - atmVal = (string)atmGrp->FindKeyword("ATMNAME"); + atmVal = (QString)atmGrp->FindKeyword("ATMNAME"); } else if (atmGrp->HasKeyword("NAME")) { - atmVal = (string)atmGrp->FindKeyword("NAME"); + atmVal = (QString)atmGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid atmospheric model so you must specify one "; + QString message = "The input PVL does not contain a valid atmospheric model so you must specify one "; message += "- the [Atmname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - atmVal = atmVal.UpCase(); + atmVal = atmVal.toUpper(); if (atmName == atmVal || atmName == "NONE" || atmName == "FROMPVL") { wasFound = true; } @@ -515,15 +515,15 @@ void LoadPvl() { while (atmGrp != atmObj.EndGroup()) { if (atmGrp->HasKeyword("ATMNAME") || atmGrp->HasKeyword("NAME")) { if (atmGrp->HasKeyword("ATMNAME")) { - atmVal = (string)atmGrp->FindKeyword("ATMNAME"); + atmVal = (QString)atmGrp->FindKeyword("ATMNAME"); } else if (atmGrp->HasKeyword("NAME")) { - atmVal = (string)atmGrp->FindKeyword("NAME"); + atmVal = (QString)atmGrp->FindKeyword("NAME"); } else { - string message = "The input PVL does not contain a valid atmospheric model so you must specify one "; + QString message = "The input PVL does not contain a valid atmospheric model so you must specify one "; message += "- the [Atmname] keyword is missing in your [Algorithm] group"; throw IException(IException::User, message, _FILEINFO_); } - atmVal = atmVal.UpCase(); + atmVal = atmVal.toUpper(); if (atmName == atmVal) { wasFound = true; break; @@ -548,36 +548,36 @@ void LoadPvl() { double hnorm = atmGrp->FindKeyword("HNORM"); os.str(""); os << hnorm; - ui.PutAsString("HNORM", os.str()); + ui.PutAsString("HNORM", os.str().c_str()); } if (atmGrp->HasKeyword("TAU")) { double tau = atmGrp->FindKeyword("TAU"); os.str(""); os << tau; - ui.PutAsString("TAU", os.str()); + ui.PutAsString("TAU", os.str().c_str()); } if (atmGrp->HasKeyword("TAUREF")) { double tauref = atmGrp->FindKeyword("TAUREF"); os.str(""); os << tauref; - ui.PutAsString("TAUREF", os.str()); + ui.PutAsString("TAUREF", os.str().c_str()); } if (atmGrp->HasKeyword("WHA")) { double wha = atmGrp->FindKeyword("WHA"); os.str(""); os << wha; - ui.PutAsString("WHA", os.str()); + ui.PutAsString("WHA", os.str().c_str()); } if (atmGrp->HasKeyword("NULNEG")) { - string nulneg = (string)atmGrp->FindKeyword("NULNEG"); - IString inulneg = nulneg; - inulneg = inulneg.UpCase(); + QString nulneg = (QString)atmGrp->FindKeyword("NULNEG"); + QString inulneg = nulneg; + inulneg = inulneg.toUpper(); if (inulneg == "YES") { ui.PutString("NULNEG", "YES"); } else if (inulneg == "NO") { ui.PutString("NULNEG", "NO"); } else { - string message = "The NULNEG value is invalid - must be set to YES or NO"; + QString message = "The NULNEG value is invalid - must be set to YES or NO"; throw IException(IException::User, message, _FILEINFO_); } } @@ -587,7 +587,7 @@ void LoadPvl() { double bha = atmGrp->FindKeyword("BHA"); os.str(""); os << bha; - ui.PutAsString("BHA", os.str()); + ui.PutAsString("BHA", os.str().c_str()); } } if (atmVal == "HAPKEATM1" || atmVal == "HAPKEATM2") { @@ -595,14 +595,14 @@ void LoadPvl() { double hga = atmGrp->FindKeyword("HGA"); os.str(""); os << hga; - ui.PutAsString("HGA", os.str()); + ui.PutAsString("HGA", os.str().c_str()); } } if (atmVal != "ANISOTROPIC1" && atmVal != "ANISOTROPIC2" && atmVal != "HAPKEATM1" && atmVal != "HAPKEATM2" && atmVal != "ISOTROPIC1" && atmVal != "ISOTROPIC2") { - string message = "Unsupported atmospheric model [" + atmVal + "]."; + QString message = "Unsupported atmospheric model [" + atmVal + "]."; throw IException(IException::User, message, _FILEINFO_); } ui.PutAsString("ATMNAME", atmVal); @@ -618,8 +618,8 @@ void IsisMain() { // Set up the user interface UserInterface &ui = Application::GetUserInterface(); - // get string of parameter changes to make - QString changePar = (IString)ui.GetString("CHNGPAR"); + // get QString of parameter changes to make + QString changePar = (QString)ui.GetString("CHNGPAR"); changePar = changePar.toUpper(); changePar.simplified(); changePar.replace(" =","="); @@ -637,7 +637,7 @@ void IsisMain() { parPair = parPair.toUpper(); QStringList parvalList = parPair.split("="); if (parvalList.size() != 2) { - string message = "The value you entered for CHNGPAR is invalid. You must enter pairs of "; + QString message = "The value you entered for CHNGPAR is invalid. You must enter pairs of "; message += "data that are formatted as parname=value and each pair is separated by spaces."; throw IException(IException::User, message, _FILEINFO_); } @@ -647,28 +647,28 @@ void IsisMain() { Pvl toNormPvl; PvlGroup normLog("NormalizationModelParametersUsed"); - IString normName = ui.GetAsString("NORMNAME"); - normName = normName.UpCase(); + QString normName = ui.GetAsString("NORMNAME"); + normName = normName.toUpper(); bool wasFound = false; if (ui.WasEntered("FROMPVL")) { - IString normVal; + QString normVal; Pvl fromNormPvl; PvlObject fromNormObj; PvlGroup fromNormGrp; - string input = ui.GetFileName("FROMPVL"); + QString input = ui.GetFileName("FROMPVL"); fromNormPvl.Read(input); if (fromNormPvl.HasObject("NormalizationModel")) { fromNormObj = fromNormPvl.FindObject("NormalizationModel"); if (fromNormObj.HasGroup("Algorithm")) { PvlObject::PvlGroupIterator fromNormGrp = fromNormObj.BeginGroup(); if (fromNormGrp->HasKeyword("NORMNAME")) { - normVal = (string)fromNormGrp->FindKeyword("NORMNAME"); + normVal = (QString)fromNormGrp->FindKeyword("NORMNAME"); } else if (fromNormGrp->HasKeyword("NAME")) { - normVal = (string)fromNormGrp->FindKeyword("NAME"); + normVal = (QString)fromNormGrp->FindKeyword("NAME"); } else { normVal = "NONE"; } - normVal = normVal.UpCase(); + normVal = normVal.toUpper(); if (normName == normVal && normVal != "NONE") { wasFound = true; } @@ -680,13 +680,13 @@ void IsisMain() { while (fromNormGrp != fromNormObj.EndGroup()) { if (fromNormGrp->HasKeyword("NORMNAME") || fromNormGrp->HasKeyword("NAME")) { if (fromNormGrp->HasKeyword("NORMNAME")) { - normVal = (string)fromNormGrp->FindKeyword("NORMNAME"); + normVal = (QString)fromNormGrp->FindKeyword("NORMNAME"); } else if (fromNormGrp->HasKeyword("NAME")) { - normVal = (string)fromNormGrp->FindKeyword("NAME"); + normVal = (QString)fromNormGrp->FindKeyword("NAME"); } else { normVal = "NONE"; } - normVal = normVal.UpCase(); + normVal = normVal.toUpper(); if (normName == normVal && normVal != "NONE") { wasFound = true; break; @@ -704,7 +704,7 @@ void IsisMain() { } // Check to make sure that a normalization model was specified if (normName == "NONE" || normName == "FROMPVL") { - string message = "A Normalization model must be specified before running this program. "; + QString message = "A Normalization model must be specified before running this program. "; message += "You need to provide a Normalization model through an input PVL (FROMPVL) or "; message += "you need to specify a Normalization model through the program interface."; throw IException(IException::User, message, _FILEINFO_); @@ -720,7 +720,7 @@ void IsisMain() { } else { // Check to make sure that a normalization model was specified if (normName == "NONE" || normName == "FROMPVL") { - string message = "A Normalization model must be specified before running this program. "; + QString message = "A Normalization model must be specified before running this program. "; message += "You need to provide a Normalization model through an input PVL (FROMPVL) or "; message += "you need to specify a Normalization model through the program interface."; throw IException(IException::User, message, _FILEINFO_); @@ -735,16 +735,16 @@ void IsisMain() { if (normName == "ALBEDO" || normName == "MIXED") { if (parMap.contains("INCREF")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",parMap["INCREF"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(toDouble(parMap["INCREF"]))),Pvl::Replace); } else if (ui.WasEntered("INCREF")) { - IString keyval = ui.GetString("INCREF"); - double incref = keyval.ToDouble(); + QString keyval = ui.GetString("INCREF"); + double incref = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",incref),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(incref)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("INCREF")) { - string message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; + QString message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -752,16 +752,16 @@ void IsisMain() { if (normName == "MIXED") { if (parMap.contains("INCMAT")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCMAT",parMap["INCMAT"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("INCMAT",toString(toDouble(parMap["INCMAT"]))),Pvl::Replace); } else if (ui.WasEntered("INCMAT")) { - IString keyval = ui.GetString("INCMAT"); - double incmat = keyval.ToDouble(); + QString keyval = ui.GetString("INCMAT"); + double incmat = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCMAT",incmat),Pvl::Replace); + AddKeyword(PvlKeyword("INCMAT",toString(incmat)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("INCMAT")) { - string message = "The " + normName + " Normalization model requires a value for the INCMAT parameter."; + QString message = "The " + normName + " Normalization model requires a value for the INCMAT parameter."; message += "The normal range for INCMAT is: 0 <= INCMAT < 90"; throw IException(IException::User, message, _FILEINFO_); } @@ -770,32 +770,32 @@ void IsisMain() { } if (parMap.contains("THRESH")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("THRESH",parMap["THRESH"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("THRESH",toString(toDouble(parMap["THRESH"]))),Pvl::Replace); } else if (ui.WasEntered("THRESH")) { - IString keyval = ui.GetString("THRESH"); - double thresh = keyval.ToDouble(); + QString keyval = ui.GetString("THRESH"); + double thresh = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("THRESH",thresh),Pvl::Replace); + AddKeyword(PvlKeyword("THRESH",toString(thresh)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("THRESH")) { - string message = "The " + normName + " Normalization model requires a value for the THRESH parameter."; + QString message = "The " + normName + " Normalization model requires a value for the THRESH parameter."; throw IException(IException::User, message, _FILEINFO_); } } normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("THRESH"); if (parMap.contains("ALBEDO")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",parMap["ALBEDO"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(toDouble(parMap["ALBEDO"]))),Pvl::Replace); } else if (ui.WasEntered("ALBEDO")) { - IString keyval = ui.GetString("ALBEDO"); - double albedo = keyval.ToDouble(); + QString keyval = ui.GetString("ALBEDO"); + double albedo = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",albedo),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(albedo)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("ALBEDO")) { - string message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; + QString message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; message += "The ALBEDO parameter has no limited range"; throw IException(IException::User, message, _FILEINFO_); } @@ -804,16 +804,16 @@ void IsisMain() { } else if (normName == "MOONALBEDO") { if (parMap.contains("D")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("D",parMap["D"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("D",toString(toDouble(parMap["D"]))),Pvl::Replace); } else if (ui.WasEntered("D")) { - IString keyval = ui.GetString("D"); - double d = keyval.ToDouble(); + QString keyval = ui.GetString("D"); + double d = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("D",d),Pvl::Replace); + AddKeyword(PvlKeyword("D",toString(d)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("D")) { - string message = "The " + normName + " Normalization model requires a value for the D parameter."; + QString message = "The " + normName + " Normalization model requires a value for the D parameter."; message += "The D parameter has no limited range"; throw IException(IException::User, message, _FILEINFO_); } @@ -821,16 +821,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("D"); if (parMap.contains("E")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("E",parMap["E"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("E",toString(toDouble(parMap["E"]))),Pvl::Replace); } else if (ui.WasEntered("E")) { - IString keyval = ui.GetString("E"); - double e = keyval.ToDouble(); + QString keyval = ui.GetString("E"); + double e = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("E",e),Pvl::Replace); + AddKeyword(PvlKeyword("E",toString(e)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("E")) { - string message = "The " + normName + " Normalization model requires a value for the E parameter."; + QString message = "The " + normName + " Normalization model requires a value for the E parameter."; message += "The E parameter has no limited range"; throw IException(IException::User, message, _FILEINFO_); } @@ -838,16 +838,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("E"); if (parMap.contains("F")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("F",parMap["F"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("F",toString(toDouble(parMap["F"]))),Pvl::Replace); } else if (ui.WasEntered("F")) { - IString keyval = ui.GetString("F"); - double f = keyval.ToDouble(); + QString keyval = ui.GetString("F"); + double f = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("F",f),Pvl::Replace); + AddKeyword(PvlKeyword("F",toString(f)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("F")) { - string message = "The " + normName + " Normalization model requires a value for the F parameter."; + QString message = "The " + normName + " Normalization model requires a value for the F parameter."; message += "The F parameter has no limited range"; throw IException(IException::User, message, _FILEINFO_); } @@ -855,16 +855,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("F"); if (parMap.contains("G2")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("G2",parMap["G2"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("G2",toString(toDouble(parMap["G2"]))),Pvl::Replace); } else if (ui.WasEntered("G2")) { - IString keyval = ui.GetString("G2"); - double g2 = keyval.ToDouble(); + QString keyval = ui.GetString("G2"); + double g2 = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("G2",g2),Pvl::Replace); + AddKeyword(PvlKeyword("G2",toString(g2)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("G2")) { - string message = "The " + normName + " Normalization model requires a value for the G2 parameter."; + QString message = "The " + normName + " Normalization model requires a value for the G2 parameter."; message += "The G2 parameter has no limited range"; throw IException(IException::User, message, _FILEINFO_); } @@ -872,16 +872,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("G2"); if (parMap.contains("XMUL")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("XMUL",parMap["XMUL"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("XMUL",toString(toDouble(parMap["XMUL"]))),Pvl::Replace); } else if (ui.WasEntered("XMUL")) { - IString keyval = ui.GetString("XMUL"); - double xmul = keyval.ToDouble(); + QString keyval = ui.GetString("XMUL"); + double xmul = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("XMUL",xmul),Pvl::Replace); + AddKeyword(PvlKeyword("XMUL",toString(xmul)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("XMUL")) { - string message = "The " + normName + " Normalization model requires a value for the XMUL parameter."; + QString message = "The " + normName + " Normalization model requires a value for the XMUL parameter."; message += "The XMUL parameter has no range limit"; throw IException(IException::User, message, _FILEINFO_); } @@ -889,16 +889,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("XMUL"); if (parMap.contains("WL")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("WL",parMap["WL"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("WL",toString(toDouble(parMap["WL"]))),Pvl::Replace); } else if (ui.WasEntered("WL")) { - IString keyval = ui.GetString("WL"); - double wl = keyval.ToDouble(); + QString keyval = ui.GetString("WL"); + double wl = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("WL",wl),Pvl::Replace); + AddKeyword(PvlKeyword("WL",toString(wl)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("WL")) { - string message = "The " + normName + " Normalization model requires a value for the WL parameter."; + QString message = "The " + normName + " Normalization model requires a value for the WL parameter."; message += "The WL parameter has no range limit"; throw IException(IException::User, message, _FILEINFO_); } @@ -906,16 +906,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("WL"); if (parMap.contains("H")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("H",parMap["H"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("H",toString(toDouble(parMap["H"]))),Pvl::Replace); } else if (ui.WasEntered("H")) { - IString keyval = ui.GetString("H"); - double h = keyval.ToDouble(); + QString keyval = ui.GetString("H"); + double h = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("H",h),Pvl::Replace); + AddKeyword(PvlKeyword("H",toString(h)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("H")) { - string message = "The " + normName + " Normalization model requires a value for the H parameter."; + QString message = "The " + normName + " Normalization model requires a value for the H parameter."; message += "The H parameter has no limited range"; throw IException(IException::User, message, _FILEINFO_); } @@ -923,16 +923,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("H"); if (parMap.contains("BSH1")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("BSH1",parMap["BSH1"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("BSH1",toString(toDouble(parMap["BSH1"]))),Pvl::Replace); } else if (ui.WasEntered("BSH1")) { - IString keyval = ui.GetString("BSH1"); - double bsh1 = keyval.ToDouble(); + QString keyval = ui.GetString("BSH1"); + double bsh1 = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("BSH1",bsh1),Pvl::Replace); + AddKeyword(PvlKeyword("BSH1",toString(bsh1)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("BSH1")) { - string message = "The " + normName + " Normalization model requires a value for the BSH1 parameter."; + QString message = "The " + normName + " Normalization model requires a value for the BSH1 parameter."; message += "The normal range for BSH1 is: 0 <= BSH1"; throw IException(IException::User, message, _FILEINFO_); } @@ -940,16 +940,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("BSH1"); if (parMap.contains("XB1")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("XB1",parMap["XB1"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("XB1",toString(toDouble(parMap["XB1"]))),Pvl::Replace); } else if (ui.WasEntered("XB1")) { - IString keyval = ui.GetString("XB1"); - double xb1 = keyval.ToDouble(); + QString keyval = ui.GetString("XB1"); + double xb1 = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("XB1",xb1),Pvl::Replace); + AddKeyword(PvlKeyword("XB1",toString(xb1)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("XB1")) { - string message = "The " + normName + " Normalization model requires a value for the XB1 parameter."; + QString message = "The " + normName + " Normalization model requires a value for the XB1 parameter."; message += "The XB1 parameter has no range limit"; throw IException(IException::User, message, _FILEINFO_); } @@ -957,16 +957,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("XB1"); if (parMap.contains("XB2")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("XB2",parMap["XB2"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("XB2",toString(toDouble(parMap["XB2"]))),Pvl::Replace); } else if (ui.WasEntered("XB2")) { - IString keyval = ui.GetString("XB2"); - double xb2 = keyval.ToDouble(); + QString keyval = ui.GetString("XB2"); + double xb2 = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("XB2",xb2),Pvl::Replace); + AddKeyword(PvlKeyword("XB2",toString(xb2)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("XB2")) { - string message = "The " + normName + " Normalization model requires a value for the XB2 parameter."; + QString message = "The " + normName + " Normalization model requires a value for the XB2 parameter."; message += "The XB2 parameter has no range limit"; throw IException(IException::User, message, _FILEINFO_); } @@ -975,16 +975,16 @@ void IsisMain() { } else if (normName == "SHADE") { if (parMap.contains("INCREF")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",parMap["INCREF"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(toDouble(parMap["INCREF"]))),Pvl::Replace); } else if (ui.WasEntered("INCREF")) { - IString keyval = ui.GetString("INCREF"); - double incref = keyval.ToDouble(); + QString keyval = ui.GetString("INCREF"); + double incref = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",incref),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(incref)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("INCREF")) { - string message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; + QString message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; message += "The normal range for INCREF is: 0 <= INCREF < 90"; throw IException(IException::User, message, _FILEINFO_); } @@ -992,16 +992,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("INCREF"); if (parMap.contains("ALBEDO")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",parMap["ALBEDO"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(toDouble(parMap["ALBEDO"]))),Pvl::Replace); } else if (ui.WasEntered("ALBEDO")) { - IString keyval = ui.GetString("ALBEDO"); - double albedo = keyval.ToDouble(); + QString keyval = ui.GetString("ALBEDO"); + double albedo = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",albedo),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(albedo)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("ALBEDO")) { - string message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; + QString message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -1009,32 +1009,32 @@ void IsisMain() { } else if (normName == "TOPO") { if (parMap.contains("INCREF")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",parMap["INCREF"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(toDouble(parMap["INCREF"]))),Pvl::Replace); } else if (ui.WasEntered("INCREF")) { - IString keyval = ui.GetString("INCREF"); - double incref = keyval.ToDouble(); + QString keyval = ui.GetString("INCREF"); + double incref = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",incref),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(incref)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("INCREF")) { - string message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; + QString message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; throw IException(IException::User, message, _FILEINFO_); } } normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("INCREF"); if (parMap.contains("THRESH")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("THRESH",parMap["THRESH"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("THRESH",toString(toDouble(parMap["THRESH"]))),Pvl::Replace); } else if (ui.WasEntered("THRESH")) { - IString keyval = ui.GetString("THRESH"); - double thresh = keyval.ToDouble(); + QString keyval = ui.GetString("THRESH"); + double thresh = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("THRESH",thresh),Pvl::Replace); + AddKeyword(PvlKeyword("THRESH",toString(thresh)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("THRESH")) { - string message = "The " + normName + " Normalization model requires a value for the THRESH parameter."; + QString message = "The " + normName + " Normalization model requires a value for the THRESH parameter."; message += "The THRESH parameter has no range limit"; throw IException(IException::User, message, _FILEINFO_); } @@ -1042,16 +1042,16 @@ void IsisMain() { normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("THRESH"); if (parMap.contains("ALBEDO")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",parMap["ALBEDO"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(toDouble(parMap["ALBEDO"]))),Pvl::Replace); } else if (ui.WasEntered("ALBEDO")) { - IString keyval = ui.GetString("ALBEDO"); - double albedo = keyval.ToDouble(); + QString keyval = ui.GetString("ALBEDO"); + double albedo = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",albedo),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(albedo)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("ALBEDO")) { - string message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; + QString message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -1059,16 +1059,16 @@ void IsisMain() { } else if (normName == "ALBEDOATM") { if (parMap.contains("INCREF")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",parMap["INCREF"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(toDouble(parMap["INCREF"]))),Pvl::Replace); } else if (ui.WasEntered("INCREF")) { - IString keyval = ui.GetString("INCREF"); - double incref = keyval.ToDouble(); + QString keyval = ui.GetString("INCREF"); + double incref = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",incref),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(incref)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("INCREF")) { - string message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; + QString message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -1076,32 +1076,32 @@ void IsisMain() { } else if (normName == "SHADEATM") { if (parMap.contains("INCREF")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",parMap["INCREF"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(toDouble(parMap["INCREF"]))),Pvl::Replace); } else if (ui.WasEntered("INCREF")) { - IString keyval = ui.GetString("INCREF"); - double incref = keyval.ToDouble(); + QString keyval = ui.GetString("INCREF"); + double incref = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",incref),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(incref)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("INCREF")) { - string message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; + QString message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; throw IException(IException::User, message, _FILEINFO_); } } normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("INCREF"); if (parMap.contains("ALBEDO")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",parMap["ALBEDO"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(toDouble(parMap["ALBEDO"]))),Pvl::Replace); } else if (ui.WasEntered("ALBEDO")) { - IString keyval = ui.GetString("ALBEDO"); - double albedo = keyval.ToDouble(); + QString keyval = ui.GetString("ALBEDO"); + double albedo = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",albedo),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(albedo)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("ALBEDO")) { - string message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; + QString message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -1109,32 +1109,32 @@ void IsisMain() { } else if (normName == "TOPOATM") { if (parMap.contains("INCREF")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",parMap["INCREF"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(toDouble(parMap["INCREF"]))),Pvl::Replace); } else if (ui.WasEntered("INCREF")) { - IString keyval = ui.GetString("INCREF"); - double incref = keyval.ToDouble(); + QString keyval = ui.GetString("INCREF"); + double incref = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("INCREF",incref),Pvl::Replace); + AddKeyword(PvlKeyword("INCREF",toString(incref)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("INCREF")) { - string message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; + QString message = "The " + normName + " Normalization model requires a value for the INCREF parameter."; throw IException(IException::User, message, _FILEINFO_); } } normLog += toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm").FindKeyword("INCREF"); if (parMap.contains("ALBEDO")) { toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",parMap["ALBEDO"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(toDouble(parMap["ALBEDO"]))),Pvl::Replace); } else if (ui.WasEntered("ALBEDO")) { - IString keyval = ui.GetString("ALBEDO"); - double albedo = keyval.ToDouble(); + QString keyval = ui.GetString("ALBEDO"); + double albedo = toDouble(keyval); toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("ALBEDO",albedo),Pvl::Replace); + AddKeyword(PvlKeyword("ALBEDO",toString(albedo)),Pvl::Replace); } else { if (!toNormPvl.FindObject("NormalizationModel").FindGroup("Algorithm"). HasKeyword("ALBEDO")) { - string message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; + QString message = "The " + normName + " Normalization model requires a value for the ALBEDO parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -1144,31 +1144,31 @@ void IsisMain() { Pvl toAtmPvl; PvlGroup atmLog("AtmosphericModelParametersUsed"); - IString atmName = ui.GetAsString("ATMNAME"); - atmName = atmName.UpCase(); + QString atmName = ui.GetAsString("ATMNAME"); + atmName = atmName.toUpper(); // Check to make sure that an atmospheric model was specified (if the // normalization model requires it) if (normName == "ALBEDOATM" || normName == "SHADEATM" || normName == "TOPOATM") { wasFound = false; if (ui.WasEntered("FROMPVL")) { - IString atmVal; + QString atmVal; Pvl fromAtmPvl; PvlObject fromAtmObj; PvlGroup fromAtmGrp; - string input = ui.GetFileName("FROMPVL"); + QString input = ui.GetFileName("FROMPVL"); fromAtmPvl.Read(input); if (fromAtmPvl.HasObject("AtmosphericModel")) { fromAtmObj = fromAtmPvl.FindObject("AtmosphericModel"); if (fromAtmObj.HasGroup("Algorithm")) { PvlObject::PvlGroupIterator fromAtmGrp = fromAtmObj.BeginGroup(); if (fromAtmGrp->HasKeyword("ATMNAME")) { - atmVal = (string)fromAtmGrp->FindKeyword("ATMNAME"); + atmVal = (QString)fromAtmGrp->FindKeyword("ATMNAME"); } else if (fromAtmGrp->HasKeyword("NAME")) { - atmVal = (string)fromAtmGrp->FindKeyword("NAME"); + atmVal = (QString)fromAtmGrp->FindKeyword("NAME"); } else { atmVal = "NONE"; } - atmVal = atmVal.UpCase(); + atmVal = atmVal.toUpper(); if (atmName == atmVal && atmVal != "NONE") { wasFound = true; } @@ -1180,13 +1180,13 @@ void IsisMain() { while (fromAtmGrp != fromAtmObj.EndGroup()) { if (fromAtmGrp->HasKeyword("ATMNAME") || fromAtmGrp->HasKeyword("NAME")) { if (fromAtmGrp->HasKeyword("ATMNAME")) { - atmVal = (string)fromAtmGrp->FindKeyword("ATMNAME"); + atmVal = (QString)fromAtmGrp->FindKeyword("ATMNAME"); } else if (fromAtmGrp->HasKeyword("NAME")) { - atmVal = (string)fromAtmGrp->FindKeyword("NAME"); + atmVal = (QString)fromAtmGrp->FindKeyword("NAME"); } else { atmVal = "NONE"; } - atmVal = atmVal.UpCase(); + atmVal = atmVal.toUpper(); if (atmName == atmVal && atmVal != "NONE") { wasFound = true; break; @@ -1203,7 +1203,7 @@ void IsisMain() { } } if (atmName == "NONE" || atmName == "FROMPVL") { - string message = "An Atmospheric model must be specified when doing normalization with atmosphere."; + QString message = "An Atmospheric model must be specified when doing normalization with atmosphere."; message += "You need to provide an Atmospheric model through an input PVL (FROMPVL) or "; message += "you need to specify an Atmospheric model through the program interface."; throw IException(IException::User, message, _FILEINFO_); @@ -1218,7 +1218,7 @@ void IsisMain() { } } else { if (atmName == "NONE" || atmName == "FROMPVL") { - string message = "An Atmospheric model must be specified when doing normalization with atmosphere."; + QString message = "An Atmospheric model must be specified when doing normalization with atmosphere."; message += "You need to provide an Atmospheric model through an input PVL (FROMPVL) or "; message += "you need to specify an Atmospheric model through the program interface."; throw IException(IException::User, message, _FILEINFO_); @@ -1235,16 +1235,16 @@ void IsisMain() { atmName == "ISOTROPIC1" || atmName == "ISOTROPIC2") { if (parMap.contains("HNORM")) { toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HNORM",parMap["HNORM"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("HNORM",toString(toDouble(parMap["HNORM"]))),Pvl::Replace); } else if (ui.WasEntered("HNORM")) { - IString keyval = ui.GetString("HNORM"); - double hnorm = keyval.ToDouble(); + QString keyval = ui.GetString("HNORM"); + double hnorm = toDouble(keyval); toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HNORM",hnorm),Pvl::Replace); + AddKeyword(PvlKeyword("HNORM",toString(hnorm)),Pvl::Replace); } else { if (!toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("HNORM")) { - string message = "The " + atmName + " Atmospheric model requires a value for the HNORM parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the HNORM parameter."; message += "The normal range for HNORM is: 0 <= HNORM"; throw IException(IException::User, message, _FILEINFO_); } @@ -1252,16 +1252,16 @@ void IsisMain() { atmLog += toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm").FindKeyword("HNORM"); if (parMap.contains("TAU")) { toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("TAU",parMap["TAU"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("TAU",toString(toDouble(parMap["TAU"]))),Pvl::Replace); } else if (ui.WasEntered("TAU")) { - IString keyval = ui.GetString("TAU"); - double tau = keyval.ToDouble(); + QString keyval = ui.GetString("TAU"); + double tau = toDouble(keyval); toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("TAU",tau),Pvl::Replace); + AddKeyword(PvlKeyword("TAU",toString(tau)),Pvl::Replace); } else { if (!toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("TAU")) { - string message = "The " + atmName + " Atmospheric model requires a value for the TAU parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the TAU parameter."; message += "The normal range for TAU is: 0 <= TAU"; throw IException(IException::User, message, _FILEINFO_); } @@ -1269,16 +1269,16 @@ void IsisMain() { atmLog += toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm").FindKeyword("TAU"); if (parMap.contains("TAUREF")) { toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("TAUREF",parMap["TAUREF"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("TAUREF",toString(toDouble(parMap["TAUREF"]))),Pvl::Replace); } else if (ui.WasEntered("TAUREF")) { - IString keyval = ui.GetString("TAUREF"); - double tauref = keyval.ToDouble(); + QString keyval = ui.GetString("TAUREF"); + double tauref = toDouble(keyval); toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("TAUREF",tauref),Pvl::Replace); + AddKeyword(PvlKeyword("TAUREF",toString(tauref)),Pvl::Replace); } else { if (!toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("TAUREF")) { - string message = "The " + atmName + " Atmospheric model requires a value for the TAUREF parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the TAUREF parameter."; message += "The normal range for TAUREF is: 0 <= TAUREF"; throw IException(IException::User, message, _FILEINFO_); } @@ -1286,16 +1286,16 @@ void IsisMain() { atmLog += toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm").FindKeyword("TAUREF"); if (parMap.contains("WHA")) { toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("WHA",parMap["WHA"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("WHA",toString(toDouble(parMap["WHA"]))),Pvl::Replace); } else if (ui.WasEntered("WHA")) { - IString keyval = ui.GetString("WHA"); - double wha = keyval.ToDouble(); + QString keyval = ui.GetString("WHA"); + double wha = toDouble(keyval); toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("WHA",wha),Pvl::Replace); + AddKeyword(PvlKeyword("WHA",toString(wha)),Pvl::Replace); } else { if (!toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("WHA")) { - string message = "The " + atmName + " Atmospheric model requires a value for the WHA parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the WHA parameter."; message += "The normal range for WHA is: 0 < WHA < 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -1309,7 +1309,7 @@ void IsisMain() { toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("NULNEG","NO"),Pvl::Replace); } else { - string message = "The " + atmName + " Atmospheric model requires a value for the NULNEG parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the NULNEG parameter."; message += "The valid values for NULNEG are: YES, NO"; throw IException(IException::User, message, _FILEINFO_); } @@ -1322,7 +1322,7 @@ void IsisMain() { toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("NULNEG","NO"),Pvl::Replace); } else { - string message = "The " + atmName + " Atmospheric model requires a value for the NULNEG parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the NULNEG parameter."; message += "The valid values for NULNEG are: YES, NO"; throw IException(IException::User, message, _FILEINFO_); } @@ -1333,16 +1333,16 @@ void IsisMain() { if (atmName == "ANISOTROPIC1" || atmName == "ANISOTROPIC2") { if (parMap.contains("BHA")) { toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("BHA",parMap["BHA"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("BHA",toString(toDouble(parMap["BHA"]))),Pvl::Replace); } else if (ui.WasEntered("BHA")) { - IString keyval = ui.GetString("BHA"); - double bha = keyval.ToDouble(); + QString keyval = ui.GetString("BHA"); + double bha = toDouble(keyval); toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("BHA",bha),Pvl::Replace); + AddKeyword(PvlKeyword("BHA",toString(bha)),Pvl::Replace); } else { if (!toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("BHA")) { - string message = "The " + atmName + " Atmospheric model requires a value for the BHA parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the BHA parameter."; message += "The normal range for BHA is: -1 <= BHA <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -1352,16 +1352,16 @@ void IsisMain() { if (atmName == "HAPKEATM1" || atmName == "HAPKEATM2") { if (parMap.contains("HGA")) { toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HGA",parMap["HGA"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("HGA",toString(toDouble(parMap["HGA"]))),Pvl::Replace); } else if (ui.WasEntered("HGA")) { - IString keyval = ui.GetString("HGA"); - double hga = keyval.ToDouble(); + QString keyval = ui.GetString("HGA"); + double hga = toDouble(keyval); toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HGA",hga),Pvl::Replace); + AddKeyword(PvlKeyword("HGA",toString(hga)),Pvl::Replace); } else { if (!toAtmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). HasKeyword("HGA")) { - string message = "The " + atmName + " Atmospheric model requires a value for the HGA parameter."; + QString message = "The " + atmName + " Atmospheric model requires a value for the HGA parameter."; message += "The normal range for HGA is: -1 < HGA < 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -1374,28 +1374,28 @@ void IsisMain() { Pvl toPhtPvl; PvlGroup phtLog("PhotometricModelParametersUsed"); - IString phtName = ui.GetAsString("PHTNAME"); - phtName = phtName.UpCase(); + QString phtName = ui.GetAsString("PHTNAME"); + phtName = phtName.toUpper(); wasFound = false; if (ui.WasEntered("FROMPVL")) { - IString phtVal; + QString phtVal; Pvl fromPhtPvl; PvlObject fromPhtObj; PvlGroup fromPhtGrp; - string input = ui.GetFileName("FROMPVL"); + QString input = ui.GetFileName("FROMPVL"); fromPhtPvl.Read(input); if (fromPhtPvl.HasObject("PhotometricModel")) { fromPhtObj = fromPhtPvl.FindObject("PhotometricModel"); if (fromPhtObj.HasGroup("Algorithm")) { PvlObject::PvlGroupIterator fromPhtGrp = fromPhtObj.BeginGroup(); if (fromPhtGrp->HasKeyword("PHTNAME")) { - phtVal = (string)fromPhtGrp->FindKeyword("PHTNAME"); + phtVal = (QString)fromPhtGrp->FindKeyword("PHTNAME"); } else if (fromPhtGrp->HasKeyword("NAME")) { - phtVal = (string)fromPhtGrp->FindKeyword("NAME"); + phtVal = (QString)fromPhtGrp->FindKeyword("NAME"); } else { phtVal = "NONE"; } - phtVal = phtVal.UpCase(); + phtVal = phtVal.toUpper(); if (phtName == phtVal && phtVal != "NONE") { wasFound = true; } @@ -1407,13 +1407,13 @@ void IsisMain() { while (fromPhtGrp != fromPhtObj.EndGroup()) { if (fromPhtGrp->HasKeyword("PHTNAME") || fromPhtGrp->HasKeyword("NAME")) { if (fromPhtGrp->HasKeyword("PHTNAME")) { - phtVal = (string)fromPhtGrp->FindKeyword("PHTNAME"); + phtVal = (QString)fromPhtGrp->FindKeyword("PHTNAME"); } else if (fromPhtGrp->HasKeyword("NAME")) { - phtVal = (string)fromPhtGrp->FindKeyword("NAME"); + phtVal = (QString)fromPhtGrp->FindKeyword("NAME"); } else { phtVal = "NONE"; } - phtVal = phtVal.UpCase(); + phtVal = phtVal.toUpper(); if (phtName == phtVal && phtVal != "NONE") { wasFound = true; break; @@ -1431,7 +1431,7 @@ void IsisMain() { } // Check to make sure that a photometric model was specified if (phtName == "NONE" || phtName == "FROMPVL") { - string message = "A Photometric model must be specified before running this program."; + QString message = "A Photometric model must be specified before running this program."; message += "You need to provide a Photometric model through an input PVL (FROMPVL) or "; message += "you need to specify a Photometric model through the program interface."; throw IException(IException::User, message, _FILEINFO_); @@ -1447,7 +1447,7 @@ void IsisMain() { } else { // Check to make sure that a photometric model was specified if (phtName == "NONE" || phtName == "FROMPVL") { - string message = "A Photometric model must be specified before running this program."; + QString message = "A Photometric model must be specified before running this program."; message += "You need to provide a Photometric model through an input PVL (FROMPVL) or "; message += "you need to specify a Photometric model through the program interface."; throw IException(IException::User, message, _FILEINFO_); @@ -1462,16 +1462,16 @@ void IsisMain() { if (phtName == "HAPKEHEN" || phtName == "HAPKELEG") { if (parMap.contains("THETA")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("THETA",parMap["THETA"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("THETA",toString(toDouble(parMap["THETA"]))),Pvl::Replace); } else if (ui.WasEntered("THETA")) { - IString keyval = ui.GetString("THETA"); - double theta = keyval.ToDouble(); + QString keyval = ui.GetString("THETA"); + double theta = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("THETA",theta),Pvl::Replace); + AddKeyword(PvlKeyword("THETA",toString(theta)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("THETA")) { - string message = "The " + phtName + " Photometric model requires a value for the THETA parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the THETA parameter."; message += "The normal range for THETA is: 0 <= THETA <= 90"; throw IException(IException::User, message, _FILEINFO_); } @@ -1479,16 +1479,16 @@ void IsisMain() { phtLog += toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm").FindKeyword("THETA"); if (parMap.contains("WH")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("WH",parMap["WH"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("WH",toString(toDouble(parMap["WH"]))),Pvl::Replace); } else if (ui.WasEntered("WH")) { - IString keyval = ui.GetString("WH"); - double wh = keyval.ToDouble(); + QString keyval = ui.GetString("WH"); + double wh = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("WH",wh),Pvl::Replace); + AddKeyword(PvlKeyword("WH",toString(wh)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("WH")) { - string message = "The " + phtName + " Photometric model requires a value for the WH parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the WH parameter."; message += "The normal range for WH is: 0 < WH <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -1496,16 +1496,16 @@ void IsisMain() { phtLog += toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm").FindKeyword("WH"); if (parMap.contains("HH")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HH",parMap["HH"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("HH",toString(toDouble(parMap["HH"]))),Pvl::Replace); } else if (ui.WasEntered("HH")) { - IString keyval = ui.GetString("HH"); - double hh = keyval.ToDouble(); + QString keyval = ui.GetString("HH"); + double hh = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HH",hh),Pvl::Replace); + AddKeyword(PvlKeyword("HH",toString(hh)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("HH")) { - string message = "The " + phtName + " Photometric model requires a value for the HH parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the HH parameter."; message += "The normal range for HH is: 0 <= HH"; throw IException(IException::User, message, _FILEINFO_); } @@ -1513,16 +1513,16 @@ void IsisMain() { phtLog += toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm").FindKeyword("HH"); if (parMap.contains("B0")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("B0",parMap["B0"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("B0",toString(toDouble(parMap["B0"]))),Pvl::Replace); } else if (ui.WasEntered("B0")) { - IString keyval = ui.GetString("B0"); - double b0 = keyval.ToDouble(); + QString keyval = ui.GetString("B0"); + double b0 = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("B0",b0),Pvl::Replace); + AddKeyword(PvlKeyword("B0",toString(b0)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("B0")) { - string message = "The " + phtName + " Photometric model requires a value for the B0 parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the B0 parameter."; message += "The normal range for B0 is: 0 <= B0"; throw IException(IException::User, message, _FILEINFO_); } @@ -1536,7 +1536,7 @@ void IsisMain() { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("ZEROB0STANDARD","FALSE"),Pvl::Replace); } else { - string message = "The " + phtName + " Photometric model requires a value for the ZEROB0STANDARD parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the ZEROB0STANDARD parameter."; message += "The valid values for ZEROB0STANDARD are: TRUE, FALSE"; throw IException(IException::User, message, _FILEINFO_); } @@ -1553,11 +1553,11 @@ void IsisMain() { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("ZEROB0STANDARD","TRUE"),Pvl::Replace); } - string zerob0 = (string)toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm").FindKeyword("ZEROB0STANDARD"); - IString izerob0 = zerob0; - izerob0 = izerob0.UpCase(); + QString zerob0 = (QString)toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm").FindKeyword("ZEROB0STANDARD"); + QString izerob0 = zerob0; + izerob0 = izerob0.toUpper(); if (izerob0 != "TRUE" && izerob0 != "FALSE") { - string message = "The " + phtName + " Photometric model requires a value for the ZEROB0STANDARD parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the ZEROB0STANDARD parameter."; message += "The valid values for ZEROB0STANDARD are: TRUE, FALSE"; throw IException(IException::User, message, _FILEINFO_); } @@ -1565,16 +1565,16 @@ void IsisMain() { if (phtName == "HAPKEHEN") { if (parMap.contains("HG1")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HG1",parMap["HG1"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("HG1",toString(toDouble(parMap["HG1"]))),Pvl::Replace); } else if (ui.WasEntered("HG1")) { - IString keyval = ui.GetString("HG1"); - double hg1 = keyval.ToDouble(); + QString keyval = ui.GetString("HG1"); + double hg1 = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HG1",hg1),Pvl::Replace); + AddKeyword(PvlKeyword("HG1",toString(hg1)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("HG1")) { - string message = "The " + phtName + " Photometric model requires a value for the HG1 parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the HG1 parameter."; message += "The normal range for HG1 is: -1 < HG1 < 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -1582,16 +1582,16 @@ void IsisMain() { phtLog += toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm").FindKeyword("HG1"); if (parMap.contains("HG2")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HG2",parMap["HG2"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("HG2",toString(toDouble(parMap["HG2"]))),Pvl::Replace); } else if (ui.WasEntered("HG2")) { - IString keyval = ui.GetString("HG2"); - double hg2 = keyval.ToDouble(); + QString keyval = ui.GetString("HG2"); + double hg2 = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HG2",hg2),Pvl::Replace); + AddKeyword(PvlKeyword("HG2",toString(hg2)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("HG2")) { - string message = "The " + phtName + " Photometric model requires a value for the HG2 parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the HG2 parameter."; message += "The normal range for HG2 is: 0 <= HG2 <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -1600,16 +1600,16 @@ void IsisMain() { } else { if (parMap.contains("BH")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("BH",parMap["BH"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("BH",toString(toDouble(parMap["BH"]))),Pvl::Replace); } else if (ui.WasEntered("BH")) { - IString keyval = ui.GetString("BH"); - double bh = keyval.ToDouble(); + QString keyval = ui.GetString("BH"); + double bh = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("BH",bh),Pvl::Replace); + AddKeyword(PvlKeyword("BH",toString(bh)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("BH")) { - string message = "The " + phtName + " Photometric model requires a value for the BH parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the BH parameter."; message += "The normal range for BH is: -1 <= BH <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -1617,16 +1617,16 @@ void IsisMain() { phtLog += toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm").FindKeyword("BH"); if (parMap.contains("CH")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("CH",parMap["CH"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("CH",toString(toDouble(parMap["CH"]))),Pvl::Replace); } else if (ui.WasEntered("CH")) { - IString keyval = ui.GetString("CH"); - double ch = keyval.ToDouble(); + QString keyval = ui.GetString("CH"); + double ch = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("CH",ch),Pvl::Replace); + AddKeyword(PvlKeyword("CH",toString(ch)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("CH")) { - string message = "The " + phtName + " Photometric model requires a value for the CH parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the CH parameter."; message += "The normal range for CH is: -1 <= CH <= 1"; throw IException(IException::User, message, _FILEINFO_); } @@ -1636,30 +1636,30 @@ void IsisMain() { } else if (phtName == "LUNARLAMBERTEMPIRICAL" || phtName == "MINNAERTEMPIRICAL") { if (parMap.contains("PHASELIST")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("PHASELIST",parMap["PHASELIST"].toStdString()),Pvl::Replace); + AddKeyword(PvlKeyword("PHASELIST",parMap["PHASELIST"]),Pvl::Replace); } else if (ui.WasEntered("PHASELIST")) { - IString keyval = ui.GetString("PHASELIST"); + QString keyval = ui.GetString("PHASELIST"); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("PHASELIST",keyval),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("PHASELIST")) { - string message = "The " + phtName + " Photometric model requires a value for the PHASELIST parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the PHASELIST parameter."; throw IException(IException::User, message, _FILEINFO_); } } phtLog += toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm").FindKeyword("PHASELIST"); if (parMap.contains("PHASECURVELIST")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("PHASECURVELIST",parMap["PHASECURVELIST"].toStdString()),Pvl::Replace); + AddKeyword(PvlKeyword("PHASECURVELIST",parMap["PHASECURVELIST"]),Pvl::Replace); } else if (ui.WasEntered("PHASECURVELIST")) { - IString keyval = ui.GetString("PHASECURVELIST"); + QString keyval = ui.GetString("PHASECURVELIST"); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("PHASECURVELIST",keyval),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("PHASECURVELIST")) { - string message = "The " + phtName + " Photometric model requires a value for the PHASECURVELIST parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the PHASECURVELIST parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -1667,15 +1667,15 @@ void IsisMain() { if (phtName == "LUNARLAMBERTEMPIRICAL") { if (parMap.contains("LLIST")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("LLIST",parMap["LLIST"].toStdString()),Pvl::Replace); + AddKeyword(PvlKeyword("LLIST",parMap["LLIST"]),Pvl::Replace); } else if (ui.WasEntered("LLIST")) { - IString keyval = ui.GetString("LLIST"); + QString keyval = ui.GetString("LLIST"); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("LLIST",keyval),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("LLIST")) { - string message = "The " + phtName + " Photometric model requires a value for the LLIST parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the LLIST parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -1683,15 +1683,15 @@ void IsisMain() { } else { if (parMap.contains("KLIST")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("KLIST",parMap["KLIST"].toStdString()),Pvl::Replace); + AddKeyword(PvlKeyword("KLIST",parMap["KLIST"]),Pvl::Replace); } else if (ui.WasEntered("KLIST")) { - IString keyval = ui.GetString("KLIST"); + QString keyval = ui.GetString("KLIST"); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("KLIST",keyval),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("KLIST")) { - string message = "The " + phtName + " Photometric model requires a value for the KLIST parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the KLIST parameter."; throw IException(IException::User, message, _FILEINFO_); } } @@ -1700,16 +1700,16 @@ void IsisMain() { } else if (phtName == "LUNARLAMBERT") { if (parMap.contains("L")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("L",parMap["L"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("L",toString(toDouble(parMap["L"]))),Pvl::Replace); } else if (ui.WasEntered("L")) { - IString keyval = ui.GetString("L"); - double l = keyval.ToDouble(); + QString keyval = ui.GetString("L"); + double l = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("L",l),Pvl::Replace); + AddKeyword(PvlKeyword("L",toString(l)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("L")) { - string message = "The " + phtName + " Photometric model requires a value for the L parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the L parameter."; message += "The L parameter has no limited range"; throw IException(IException::User, message, _FILEINFO_); } @@ -1718,16 +1718,16 @@ void IsisMain() { } else if (phtName == "MINNAERT") { if (parMap.contains("K")) { toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("K",parMap["K"].toDouble()),Pvl::Replace); + AddKeyword(PvlKeyword("K",toString(toDouble(parMap["K"]))),Pvl::Replace); } else if (ui.WasEntered("K")) { - IString keyval = ui.GetString("K"); - double k = keyval.ToDouble(); + QString keyval = ui.GetString("K"); + double k = toDouble(keyval); toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("K",k),Pvl::Replace); + AddKeyword(PvlKeyword("K",toString(k)),Pvl::Replace); } else { if (!toPhtPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). HasKeyword("K")) { - string message = "The " + phtName + " Photometric model requires a value for the K parameter."; + QString message = "The " + phtName + " Photometric model requires a value for the K parameter."; message += "The normal range for K is: 0 <= K"; throw IException(IException::User, message, _FILEINFO_); } @@ -1830,7 +1830,7 @@ void IsisMain() { double wl; if(pvlg.HasKeyword("Center")) { PvlKeyword &wavelength = pvlg.FindKeyword("Center"); - wl = wavelength[0]; + wl = toDouble(wavelength[0]); } else { wl = 1.0; @@ -1839,7 +1839,7 @@ void IsisMain() { // Create the photometry object and set the wavelength PvlGroup &algo = par.FindObject("NormalizationModel").FindGroup("Algorithm", Pvl::Traverse); if(!algo.HasKeyword("Wl")) { - algo.AddKeyword(Isis::PvlKeyword("Wl", wl)); + algo.AddKeyword(Isis::PvlKeyword("Wl", toString(wl))); } pho = new Photometry(par); pho->SetPhotomWl(wl); diff --git a/isis/src/base/apps/pvldiff/pvldiff.cpp b/isis/src/base/apps/pvldiff/pvldiff.cpp index cd334941a0..e4a773abc8 100644 --- a/isis/src/base/apps/pvldiff/pvldiff.cpp +++ b/isis/src/base/apps/pvldiff/pvldiff.cpp @@ -12,7 +12,7 @@ using namespace std; using namespace Isis; bool filesMatch; -IString differenceReason; +QString differenceReason; PvlGroup tolerances; PvlGroup ignorekeys; @@ -80,7 +80,7 @@ void CompareKeywords(const PvlKeyword &pvl1, const PvlKeyword &pvl2) { if(tolerances.HasKeyword(pvl1.Name()) && tolerances[pvl1.Name()].Size() > 1 && pvl1.Size() != tolerances[pvl1.Name()].Size()) { - string msg = "Size of keyword '" + pvl1.Name() + "' does not match with "; + QString msg = "Size of keyword '" + pvl1.Name() + "' does not match with "; msg += "its number of tolerances in the DIFF file."; throw IException(IException::User, msg, _FILEINFO_); } @@ -88,16 +88,16 @@ void CompareKeywords(const PvlKeyword &pvl1, const PvlKeyword &pvl2) { if(ignorekeys.HasKeyword(pvl1.Name()) && ignorekeys[pvl1.Name()].Size() > 1 && pvl1.Size() != ignorekeys[pvl1.Name()].Size()) { - string msg = "Size of keyword '" + pvl1.Name() + "' does not match with "; + QString msg = "Size of keyword '" + pvl1.Name() + "' does not match with "; msg += "its number of ignore keys in the DIFF file."; throw IException(IException::User, msg, _FILEINFO_); } for(int i = 0; i < pvl1.Size() && filesMatch; i++) { - IString val1 = pvl1[i]; - IString val2 = pvl2[i]; - IString unit1 = pvl1.Unit(i); - IString unit2 = pvl2.Unit(i); + QString val1 = pvl1[i]; + QString val2 = pvl2[i]; + QString unit1 = pvl1.Unit(i); + QString unit2 = pvl2.Unit(i); int ignoreIndex = 0; if(ignorekeys.HasKeyword(pvl1.Name()) && ignorekeys[pvl1.Name()].Size() > 1) { @@ -108,36 +108,37 @@ void CompareKeywords(const PvlKeyword &pvl1, const PvlKeyword &pvl2) { if(!ignorekeys.HasKeyword(pvl1.Name()) || ignorekeys[pvl1.Name()][ignoreIndex] == "false") { - if(!unit1.Equal(unit2)) { + if(unit1.toLower() != unit2.toLower()) { filesMatch = false; differenceReason = "Keyword '" + pvl1.Name() + "': units do not match."; return; } double tolerance = 0.0; - double difference = abs((double)val1 - (double)val2); + double difference = abs(toDouble(val1) - toDouble(val2)); if(tolerances.HasKeyword(pvl1.Name())) { - tolerance = (tolerances[pvl1.Name()].Size() == 1) ? - tolerances[pvl1.Name()][0] : tolerances[pvl1.Name()][i]; + tolerance = toDouble( + (tolerances[pvl1.Name()].Size() == 1) ? + tolerances[pvl1.Name()][0] : tolerances[pvl1.Name()][i]); } if(difference > tolerance) { filesMatch = false; if(pvl1.Size() == 1) { differenceReason = "Keyword '" + pvl1.Name() + "': difference is " + - IString(difference); + toString(difference); } else { differenceReason = "Keyword '" + pvl1.Name() + "' at index " + - IString(i) + ": difference is " + IString(difference); + toString(i) + ": difference is " + toString(difference); } - differenceReason += " (tolerance is " + IString(tolerance) + ")"; + differenceReason += " (tolerance is " + toString(tolerance) + ")"; } } } catch(IException &) { - if(!val1.Equal(val2)) { + if(val1.toLower() != val2.toLower()) { filesMatch = false; differenceReason = "Keyword '" + pvl1.Name() + "': values do not " "match."; diff --git a/isis/src/base/apps/reduce/reduce.cpp b/isis/src/base/apps/reduce/reduce.cpp index 27aa8bf976..a8a41e41b9 100644 --- a/isis/src/base/apps/reduce/reduce.cpp +++ b/isis/src/base/apps/reduce/reduce.cpp @@ -16,7 +16,7 @@ void IsisMain() { double sscale, lscale; int ins, inl, inb; int ons, onl; - vector bands; + vector bands; Cube inCube; // To propogate labels, set input cube, @@ -25,20 +25,20 @@ void IsisMain() { // Setup the input and output cubes UserInterface &ui = Application::GetUserInterface(); - string replaceMode = ui.GetAsString("VPER_REPLACE"); + QString replaceMode = ui.GetAsString("VPER_REPLACE"); CubeAttributeInput cai(ui.GetAsString("FROM")); bands = cai.bands(); inCube.setVirtualBands(bands); - string from = ui.GetFileName("FROM"); + QString from = ui.GetFileName("FROM"); inCube.open(from); ins = inCube.getSampleCount(); inl = inCube.getLineCount(); inb = inCube.getBandCount(); - string alg = ui.GetString("ALGORITHM"); + QString alg = ui.GetString("ALGORITHM"); double vper = ui.GetDouble("VALIDPER") / 100.; if(ui.GetString("MODE") == "TOTAL") { @@ -55,7 +55,7 @@ void IsisMain() { } if(ons > ins || onl > inl) { - string msg = "Number of output samples/lines must be less than or equal"; + QString msg = "Number of output samples/lines must be less than or equal"; msg = msg + " to the input samples/lines."; throw IException(IException::User, msg, _FILEINFO_); } @@ -90,11 +90,11 @@ void IsisMain() { throw; } catch (std::exception const &se) { - string message = "std::exception: " + (IString)se.what(); + QString message = "std::exception: " + (QString)se.what(); throw IException(IException::User, message, _FILEINFO_); } catch (...) { - string message = "Other Error"; + QString message = "Other Error"; throw IException(IException::User, message, _FILEINFO_); } } diff --git a/isis/src/base/apps/remrx/remrx.cpp b/isis/src/base/apps/remrx/remrx.cpp index d9f8e2476b..b1d21697fc 100644 --- a/isis/src/base/apps/remrx/remrx.cpp +++ b/isis/src/base/apps/remrx/remrx.cpp @@ -17,7 +17,7 @@ void cpy(Buffer &in, Buffer &out); void remrx(Buffer &in, Buffer &out); static int sdim, ldim; static bool resvalid; -static string action; +static QString action; void IsisMain() { // We will be processing by line @@ -27,16 +27,16 @@ void IsisMain() { Cube *icube = p.SetInputCube("FROM"); PvlKeyword &status = icube->getGroup("RESEAUS")["STATUS"]; UserInterface &ui = Application::GetUserInterface(); - string in = ui.GetFileName("FROM"); + QString in = ui.GetFileName("FROM"); // Check reseau status and make sure it is not nominal or removed - if((string)status == "Nominal") { - string msg = "Input file [" + in + + if((QString)status == "Nominal") { + QString msg = "Input file [" + in + "] appears to have nominal reseau status. You must run findrx first."; throw IException(IException::User, msg, _FILEINFO_); } - if((string)status == "Removed") { - string msg = "Input file [" + in + + if((QString)status == "Removed") { + QString msg = "Input file [" + in + "] appears to already have reseaus removed."; throw IException(IException::User, msg, _FILEINFO_); } @@ -54,7 +54,7 @@ void IsisMain() { ldim = ui.GetInteger("LDIM"); // Get other user entered options - string out = ui.GetFileName("TO"); + QString out = ui.GetFileName("TO"); resvalid = ui.GetBoolean("RESVALID"); action = ui.GetString("ACTION"); @@ -73,9 +73,9 @@ void IsisMain() { Brick brick(sdim, ldim, 1, cube.getPixelType()); for(int res = 0; res < numres; res++) { - if((resvalid == 0 || (int)valid[res] == 1) && (int)type[res] != 0) { - int baseSamp = (int)((double)samps[res] + 0.5) - (sdim / 2); - int baseLine = (int)((double)lines[res] + 0.5) - (ldim / 2); + if((resvalid == 0 || toInt(valid[res]) == 1) && toInt(type[res]) != 0) { + int baseSamp = (int)(toDouble(samps[res]) + 0.5) - (sdim / 2); + int baseLine = (int)(toDouble(lines[res]) + 0.5) - (ldim / 2); brick.SetBasePosition(baseSamp, baseLine, 1); cube.read(brick); if(action == "NULL") { @@ -99,7 +99,7 @@ void IsisMain() { double sdev = stats.StandardDeviation(); // Top Edge Reseau - if((int)type[res] == 2) { + if(toInt(type[res]) == 2) { int l1 = 0; int l2 = ldim - 1; for(int s = 0; s < sdim; s++) { @@ -107,7 +107,7 @@ void IsisMain() { } } // Left Edge Reseau - else if((int)type[res] == 4) { + else if(toInt(type[res]) == 4) { int s1 = 0; int s2 = sdim - 1; for(int l = 0; l < ldim; l++) { @@ -115,7 +115,7 @@ void IsisMain() { } } // Right Edge Reseau - else if((int)type[res] == 6) { + else if(toInt(type[res]) == 6) { int s1 = 0; int s2 = sdim - 1; for(int l = 0; l < ldim; l++) { @@ -123,7 +123,7 @@ void IsisMain() { } } // Bottom Edge Reseau - else if((int)type[res] == 8) { + else if(toInt(type[res]) == 8) { int l1 = 0; int l2 = ldim - 1; for(int s = 0; s < sdim; s++) { @@ -159,14 +159,14 @@ void IsisMain() { for(int l = 0; l < ldim; l++) { int c = l * sdim; //count // Top Edge Reseau - if((int)type[res] == 2 && l < (ldim / 2)) continue; + if(toInt(type[res]) == 2 && l < (ldim / 2)) continue; // Bottom Edge Reseau - if((int)type[res] == 8 && l > (ldim / 2 + 1)) continue; + if(toInt(type[res]) == 8 && l > (ldim / 2 + 1)) continue; for(int s = 0; s < sdim; s++, c++) { // Left Edge Reseau - if((int)type[res] == 4 && s < (sdim / 2)) continue; + if(toInt(type[res]) == 4 && s < (sdim / 2)) continue; // Right Edge Reseau - if((int)type[res] == 6 && s > (sdim / 2 + 1)) continue; + if(toInt(type[res]) == 6 && s > (sdim / 2 + 1)) continue; double sum = 0.0; int gline1 = 0; int gline2 = ldim - 1; diff --git a/isis/src/base/apps/rotate/rotate.cpp b/isis/src/base/apps/rotate/rotate.cpp index 746c182c4c..0520f06878 100644 --- a/isis/src/base/apps/rotate/rotate.cpp +++ b/isis/src/base/apps/rotate/rotate.cpp @@ -36,8 +36,8 @@ void IsisMain() { interp = new Interpolator(Interpolator::CubicConvolutionType); } else { - string msg = "Unknow value for INTERP [" + - ui.GetString("INTERP") + "]"; + QString msg = "Unknow value for INTERP [" + + ui.GetString("INTERP") + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/segment/segment.cpp b/isis/src/base/apps/segment/segment.cpp index ebaf18fcee..736d326f68 100644 --- a/isis/src/base/apps/segment/segment.cpp +++ b/isis/src/base/apps/segment/segment.cpp @@ -30,16 +30,16 @@ void IsisMain() { bool hasReachedEndOfCube = false; while(startLine <= cube.getLineCount() && not hasReachedEndOfCube) { //! Sets up the proper paramaters for running the crop program - string parameters = "FROM=" + inFile.expanded() + - " TO=" + inFile.path() + "/" + inFile.baseName() + ".segment" + IString(cropNum) + ".cub" - + " LINE=" + IString(startLine) + " NLINES="; + QString parameters = "FROM=" + inFile.expanded() + + " TO=" + inFile.path() + "/" + inFile.baseName() + ".segment" + toString(cropNum) + ".cub" + + " LINE=" + toString(startLine) + " NLINES="; if(startLine + numberOfLines > cube.getLineCount()) { - parameters += IString(cube.getLineCount() - (startLine - 1)); + parameters += toString(cube.getLineCount() - (startLine - 1)); hasReachedEndOfCube = true; } else { - parameters += IString(numberOfLines); + parameters += toString(numberOfLines); } ProgramLauncher::RunIsisProgram("crop", parameters); //The starting line for next crop diff --git a/isis/src/base/apps/shade/shade.cpp b/isis/src/base/apps/shade/shade.cpp index 784c480e20..d9abb7c12f 100644 --- a/isis/src/base/apps/shade/shade.cpp +++ b/isis/src/base/apps/shade/shade.cpp @@ -51,8 +51,8 @@ void IsisMain() { pixelResolution = inCube->getLabel()->FindObject("IsisCube").FindGroup("Mapping")["PixelResolution"]; } else { - string msg = "The file [" + ui.GetFileName("FROM") + "] does not have a mapping group," - + " you must enter a Pixel Resolution"; + QString msg = "The file [" + ui.GetFileName("FROM") + "] does not have a mapping group," + + " you must enter a Pixel Resolution"; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/base/apps/shadowtau/shadowtau.cpp b/isis/src/base/apps/shadowtau/shadowtau.cpp index 7956674a1c..8392a2be13 100644 --- a/isis/src/base/apps/shadowtau/shadowtau.cpp +++ b/isis/src/base/apps/shadowtau/shadowtau.cpp @@ -70,16 +70,16 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); // Input datafile - string sInFile = ui.GetFileName("FROM"); + QString sInFile = ui.GetFileName("FROM"); // Output datafile - string sOutFile = ui.GetFileName("TO"); + QString sOutFile = ui.GetFileName("TO"); ofstream outfile; - outfile.open (sOutFile.c_str()); + outfile.open (sOutFile.toAscii().data()); // Get Hapke function and parameters - IString sPhotoFunc = ui.GetAsString("PHTNAME"); - sPhotoFunc = sPhotoFunc.UpCase(); + QString sPhotoFunc = ui.GetAsString("PHTNAME"); + sPhotoFunc = sPhotoFunc.toUpper(); // Should contains parameter names matching GUI not to be inclusiond // in the Pvl defFile @@ -91,78 +91,78 @@ void IsisMain() { if (sPhotoFunc == "HAPKEHEN" || sPhotoFunc == "HAPKELEG") { // Single Particle Phase Function HENYEY-GREENSTEIN if (ui.WasEntered("WH")) { - IString keyval = ui.GetString("WH"); - double wh = keyval.ToDouble(); + QString keyval = ui.GetString("WH"); + double wh = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("WH",wh),Pvl::Replace); + AddKeyword(PvlKeyword("WH",toString(wh)),Pvl::Replace); } if (ui.WasEntered("HH")) { - IString keyval = ui.GetString("HH"); - double hh = keyval.ToDouble(); + QString keyval = ui.GetString("HH"); + double hh = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HH",hh),Pvl::Replace); + AddKeyword(PvlKeyword("HH",toString(hh)),Pvl::Replace); } if (ui.WasEntered("B0")) { - IString keyval = ui.GetString("B0"); - double b0 = keyval.ToDouble(); + QString keyval = ui.GetString("B0"); + double b0 = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("B0",b0),Pvl::Replace); + AddKeyword(PvlKeyword("B0",toString(b0)),Pvl::Replace); } if (ui.WasEntered("THETA")) { - IString keyval = ui.GetString("THETA"); - double theta = keyval.ToDouble(); + QString keyval = ui.GetString("THETA"); + double theta = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("THETA",theta),Pvl::Replace); + AddKeyword(PvlKeyword("THETA",toString(theta)),Pvl::Replace); } if (ui.WasEntered("ZEROB0STANDARD")) { - IString keyval = ui.GetString("ZEROB0STANDARD"); - keyval = keyval.UpCase(); + QString keyval = ui.GetString("ZEROB0STANDARD"); + keyval = keyval.toUpper(); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). AddKeyword(PvlKeyword("ZEROB0STANDARD",keyval),Pvl::Replace); } if (sPhotoFunc == "HAPKEHEN") { if (ui.WasEntered("HG1")) { - IString keyval = ui.GetString("HG1"); - double hg1 = keyval.ToDouble(); + QString keyval = ui.GetString("HG1"); + double hg1 = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HG1",hg1),Pvl::Replace); + AddKeyword(PvlKeyword("HG1",toString(hg1)),Pvl::Replace); } if (ui.WasEntered("HG2")) { - IString keyval = ui.GetString("HG2"); - double hg2 = keyval.ToDouble(); + QString keyval = ui.GetString("HG2"); + double hg2 = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HG2",hg2),Pvl::Replace); + AddKeyword(PvlKeyword("HG2",toString(hg2)),Pvl::Replace); } } else { if (ui.WasEntered("BH")) { - IString keyval = ui.GetString("BH"); - double bh = keyval.ToDouble(); + QString keyval = ui.GetString("BH"); + double bh = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("BH",bh),Pvl::Replace); + AddKeyword(PvlKeyword("BH",toString(bh)),Pvl::Replace); } if (ui.WasEntered("CH")) { - IString keyval = ui.GetString("CH"); - double ch = keyval.ToDouble(); + QString keyval = ui.GetString("CH"); + double ch = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("CH",ch),Pvl::Replace); + AddKeyword(PvlKeyword("CH",toString(ch)),Pvl::Replace); } } } else if (sPhotoFunc == "LUNARLAMBERT") { // Single Particle Phase Function LEGENDRE if (ui.WasEntered("L")) { - IString keyval = ui.GetString("L"); - double l = keyval.ToDouble(); + QString keyval = ui.GetString("L"); + double l = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("L",l),Pvl::Replace); + AddKeyword(PvlKeyword("L",toString(l)),Pvl::Replace); } } else if (sPhotoFunc == "MINNAERT") { if (ui.WasEntered("K")) { - IString keyval = ui.GetString("K"); - double k = keyval.ToDouble(); + QString keyval = ui.GetString("K"); + double k = toDouble(keyval); photoPvl.FindObject("PhotometricModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("K",k),Pvl::Replace); + AddKeyword(PvlKeyword("K",toString(k)),Pvl::Replace); } } @@ -175,13 +175,13 @@ void IsisMain() { //datafile':get data file only for photometric functions that need it if (sPhotoFunc == "LUNARLAMBERTEMPIRICAL" || sPhotoFunc == "MINNAERTEMPIRICAL") { - string sDataFile = ui.GetFileName("DATAFILE"); + QString sDataFile = ui.GetFileName("DATAFILE"); } // Get Atmospheric Model // Order of approximation in atmospheric scatter model - IString sAsmType = ui.GetAsString("ATMNAME"); - sAsmType = sAsmType.UpCase(); + QString sAsmType = ui.GetAsString("ATMNAME"); + sAsmType = sAsmType.toUpper(); Pvl asmPvl; asmPvl.AddObject(PvlObject("AtmosphericModel")); @@ -190,32 +190,32 @@ void IsisMain() { AddKeyword(PvlKeyword("ATMNAME",sAsmType),Pvl::Replace); if (ui.WasEntered("WHA")) { - IString keyval = ui.GetString("WHA"); - double wha = keyval.ToDouble(); + QString keyval = ui.GetString("WHA"); + double wha = toDouble(keyval); asmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("WHA",wha),Pvl::Replace); + AddKeyword(PvlKeyword("WHA",toString(wha)),Pvl::Replace); } if (ui.WasEntered("HNORM")) { - IString keyval = ui.GetString("HNORM"); - double hnorm = keyval.ToDouble(); + QString keyval = ui.GetString("HNORM"); + double hnorm = toDouble(keyval); asmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HNORM",hnorm),Pvl::Replace); + AddKeyword(PvlKeyword("HNORM",toString(hnorm)),Pvl::Replace); } if (sAsmType=="ANISOTROPIC1" || sAsmType=="ANISOTROPIC2" ){ if (ui.WasEntered("BHA")) { - IString keyval = ui.GetString("BHA"); - double bha = keyval.ToDouble(); + QString keyval = ui.GetString("BHA"); + double bha = toDouble(keyval); asmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("BHA",bha),Pvl::Replace); + AddKeyword(PvlKeyword("BHA",toString(bha)),Pvl::Replace); } } else if (sAsmType=="HAPKEATM1" || sAsmType=="HAPKEATM2" ) { if (ui.WasEntered("HGA")) { - IString keyval = ui.GetString("HGA"); - double hga = keyval.ToDouble(); + QString keyval = ui.GetString("HGA"); + double hga = toDouble(keyval); asmPvl.FindObject("AtmosphericModel").FindGroup("Algorithm"). - AddKeyword(PvlKeyword("HGA",hga),Pvl::Replace); + AddKeyword(PvlKeyword("HGA",toString(hga)),Pvl::Replace); } } @@ -230,7 +230,7 @@ void IsisMain() { asmModel = AtmosModelFactory::Create(asmPvl, *photoModel); if (asmModel == NULL) { - string errMsg = "Unable create an Atmospheric Model\n"; + QString errMsg = "Unable create an Atmospheric Model\n"; throw IException(IException::User, errMsg, _FILEINFO_); } @@ -251,14 +251,16 @@ void IsisMain() { // sense as the corresponding parameter. FileName sInFileName(sInFile); TextFile infile(sInFileName.expanded()); - IString infileString; + QString infileString; while (infile.GetLine(infileString)) { - IString imgId = infileString.Token(" ,"); - double inc = infileString.Token(" ,").ToDouble(); - double ema = infileString.Token(" ,").ToDouble(); - double phase = infileString.Token(" ,").ToDouble(); - double pflat = infileString.Token(" ,").ToDouble(); - double pshad = infileString.Token(" ,").ToDouble(); + QStringList tokens = infileString.split(QRegExp("[ ,]")); + + QString imgId = tokens.takeFirst(); + double inc = toDouble(tokens.takeFirst()); + double ema = toDouble(tokens.takeFirst()); + double phase = toDouble(tokens.takeFirst()); + double pflat = toDouble(tokens.takeFirst()); + double pshad = toDouble(tokens.takeFirst()); // checking validity if (!imgId.length() || (inc < 0 || inc >= 89.9) || (ema < 0 || ema >= 89.9) || diff --git a/isis/src/base/apps/skymap/skymap.cpp b/isis/src/base/apps/skymap/skymap.cpp index 3f3e83a723..d1065d4f74 100644 --- a/isis/src/base/apps/skymap/skymap.cpp +++ b/isis/src/base/apps/skymap/skymap.cpp @@ -18,8 +18,8 @@ void LoadCameraRes(); void LoadMapRange(); void LoadCameraRange(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["PrintMap"] = (void *) PrintMap; helper ["LoadMapRes"] = (void *) LoadMapRes; helper ["LoadCameraRes"] = (void *) LoadCameraRes; @@ -85,8 +85,8 @@ void IsisMain() { // Add the default mapping info to the user entered mapping group userGrp.AddKeyword(PvlKeyword("TargetName", "Sky"), Pvl::Replace); - userGrp.AddKeyword(PvlKeyword("EquatorialRadius", 1.0), Pvl::Replace); - userGrp.AddKeyword(PvlKeyword("PolarRadius", 1.0), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("EquatorialRadius", toString(1.0)), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("PolarRadius", toString(1.0)), Pvl::Replace); userGrp.AddKeyword(PvlKeyword("LatitudeType", "Planetocentric"), Pvl::Replace); userGrp.AddKeyword(PvlKeyword("LongitudeDirection", "PositiveWest"), Pvl::Replace); userGrp.AddKeyword(PvlKeyword("LongitudeDomain", "360"), Pvl::Replace); @@ -98,33 +98,33 @@ void IsisMain() { // Get the default ra/dec range double minRa, maxRa, minDec, maxDec; incam->RaDecRange(minRa, maxRa, minDec, maxDec); - userGrp.AddKeyword(PvlKeyword("MinimumLongitude", minRa), Pvl::Replace); - userGrp.AddKeyword(PvlKeyword("MaximumLongitude", maxRa), Pvl::Replace); - userGrp.AddKeyword(PvlKeyword("MinimumLatitude", minDec), Pvl::Replace); - userGrp.AddKeyword(PvlKeyword("MaximumLatitude", maxDec), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(minRa)), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(maxRa)), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(minDec)), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(maxDec)), Pvl::Replace); } if(ui.GetString("DEFAULTSCALE") == "CAMERA") { double res = incam->RaDecResolution(); - userGrp.AddKeyword(PvlKeyword("Scale", 1.0 / res), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("Scale", toString(1.0 / res)), Pvl::Replace); } // Override computed range with the users request if(ui.WasEntered("SRA")) { - userGrp.AddKeyword(PvlKeyword("MinimumLongitude", ui.GetDouble("SRA")), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(ui.GetDouble("SRA"))), Pvl::Replace); } if(ui.WasEntered("ERA")) { - userGrp.AddKeyword(PvlKeyword("MaximumLongitude", ui.GetDouble("ERA")), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(ui.GetDouble("ERA"))), Pvl::Replace); } if(ui.WasEntered("SDEC")) { - userGrp.AddKeyword(PvlKeyword("MinimumLatitude", ui.GetDouble("SDEC")), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(ui.GetDouble("SDEC"))), Pvl::Replace); } if(ui.WasEntered("EDEC")) { - userGrp.AddKeyword(PvlKeyword("MaximumLatitude", ui.GetDouble("EDEC")), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(ui.GetDouble("EDEC"))), Pvl::Replace); } // Get the resolution from the user if they decided to enter it if(ui.GetString("DEFAULTSCALE") == "USER") { - userGrp.AddKeyword(PvlKeyword("Scale", ui.GetDouble("SCALE")), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("Scale", toString(ui.GetDouble("SCALE"))), Pvl::Replace); } // Create the projection @@ -178,14 +178,14 @@ void IsisMain() { // Create an alpha cube group for the output cube if(!ocube->hasGroup("AlphaCube")) { PvlGroup alpha("AlphaCube"); - alpha += PvlKeyword("AlphaSamples", icube->getSampleCount()); - alpha += PvlKeyword("AlphaLines", icube->getLineCount()); - alpha += PvlKeyword("AlphaStartingSample", 0.5); - alpha += PvlKeyword("AlphaStartingLine", 0.5); - alpha += PvlKeyword("AlphaEndingSample", icube->getSampleCount() + 0.5); - alpha += PvlKeyword("AlphaEndingLine", icube->getLineCount() + 0.5); - alpha += PvlKeyword("BetaSamples", icube->getSampleCount()); - alpha += PvlKeyword("BetaLines", icube->getLineCount()); + alpha += PvlKeyword("AlphaSamples", toString(icube->getSampleCount())); + alpha += PvlKeyword("AlphaLines", toString(icube->getLineCount())); + alpha += PvlKeyword("AlphaStartingSample", toString(0.5)); + alpha += PvlKeyword("AlphaStartingLine", toString(0.5)); + alpha += PvlKeyword("AlphaEndingSample", toString(icube->getSampleCount() + 0.5)); + alpha += PvlKeyword("AlphaEndingLine", toString(icube->getLineCount() + 0.5)); + alpha += PvlKeyword("BetaSamples", toString(icube->getSampleCount())); + alpha += PvlKeyword("BetaLines", toString(icube->getLineCount())); ocube->putGroup(alpha); } @@ -289,7 +289,7 @@ void LoadMapRes() { ui.PutDouble("SCALE", userGrp["Scale"]); } else { - string msg = "Mapfile [" + ui.GetFileName("MAP") + + QString msg = "Mapfile [" + ui.GetFileName("MAP") + "] does not have [SCALE] keyword to load"; throw IException(IException::User, msg, _FILEINFO_); } @@ -347,7 +347,7 @@ void LoadMapRange() { ui.PutAsString("DEFAULTRANGE", "MAP"); if(count < 4) { - string msg = "One or more of the values for the sky range was not found"; + QString msg = "One or more of the values for the sky range was not found"; msg += " in [" + ui.GetFileName("MAP") + "]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/skypt/skypt.cpp b/isis/src/base/apps/skypt/skypt.cpp index 1ad256d52c..4164608597 100644 --- a/isis/src/base/apps/skypt/skypt.cpp +++ b/isis/src/base/apps/skypt/skypt.cpp @@ -13,13 +13,13 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); // Get input cube and get camera model for it - string channel = ui.GetFileName("FROM"); + QString channel = ui.GetFileName("FROM"); Cube cube; cube.open(channel); Camera *cam = cube.getCamera(); // Get the type of conversion that we are doing - string type = ui.GetString("TYPE"); + QString type = ui.GetString("TYPE"); double samp, line; // Do conversion from samp/line to ra/dec @@ -34,7 +34,7 @@ void IsisMain() { double ra = ui.GetDouble("RA"); double dec = ui.GetDouble("DEC"); if(!cam->SetRightAscensionDeclination(ra, dec)) { - string msg = "Invalid Ra/Dec coordinate"; + QString msg = "Invalid Ra/Dec coordinate"; throw IException(IException::User, msg, _FILEINFO_); } samp = cam->Sample(); @@ -52,11 +52,11 @@ void IsisMain() { PvlGroup sp("SkyPoint"); { sp += PvlKeyword("Filename", FileName(channel).expanded()); - sp += PvlKeyword("Sample", cam->Sample()); - sp += PvlKeyword("Line", cam->Line()); - sp += PvlKeyword("RightAscension", cam->RightAscension()); - sp += PvlKeyword("Declination", cam->Declination()); - sp += PvlKeyword("EphemerisTime", cam->time().Et()); + sp += PvlKeyword("Sample", toString(cam->Sample())); + sp += PvlKeyword("Line", toString(cam->Line())); + sp += PvlKeyword("RightAscension", toString(cam->RightAscension())); + sp += PvlKeyword("Declination", toString(cam->Declination())); + sp += PvlKeyword("EphemerisTime", toString(cam->time().Et())); sp += PvlKeyword("PixelValue", PixelToString(b[0])); } //Write the group to the screen @@ -65,7 +65,7 @@ void IsisMain() { // Write an output label file if necessary if(ui.WasEntered("TO")) { // Get user params from ui - string outFile = FileName(ui.GetFileName("TO")).expanded(); + QString outFile = FileName(ui.GetFileName("TO")).expanded(); bool exists = FileName(outFile).fileExists(); bool append = ui.GetBoolean("APPEND"); @@ -87,13 +87,13 @@ void IsisMain() { ofstream os; bool writeHeader = false; if(append) { - os.open(outFile.c_str(), ios::app); + os.open(outFile.toAscii().data(), ios::app); if(!exists) { writeHeader = true; } } else { - os.open(outFile.c_str(), ios::out); + os.open(outFile.toAscii().data(), ios::out); writeHeader = true; } @@ -109,7 +109,7 @@ void IsisMain() { } for(int i = 0; i < sp.Keywords(); i++) { - os << (string)sp[i]; + os << (QString)sp[i]; if(i < sp.Keywords() - 1) { os << ","; @@ -119,7 +119,7 @@ void IsisMain() { } } else if(ui.GetString("FORMAT") == "FLAT") { - string msg = "Flat file must have a name."; + QString msg = "Flat file must have a name."; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/base/apps/skyrange/skyrange.cpp b/isis/src/base/apps/skyrange/skyrange.cpp index 7a858483ca..cfd048c7e2 100644 --- a/isis/src/base/apps/skyrange/skyrange.cpp +++ b/isis/src/base/apps/skyrange/skyrange.cpp @@ -34,25 +34,25 @@ void IsisMain() { // Setup and log results PvlGroup results("Range"); - results += PvlKeyword("MinimumRightAscension", minRa, "degrees"); - results += PvlKeyword("MaximumRightAscension", maxRa, "degrees"); - results += PvlKeyword("MinimumDeclination", minDec, "degrees"); - results += PvlKeyword("MaximumDeclination", maxDec, "degrees"); + results += PvlKeyword("MinimumRightAscension", toString(minRa), "degrees"); + results += PvlKeyword("MaximumRightAscension", toString(maxRa), "degrees"); + results += PvlKeyword("MinimumDeclination", toString(minDec), "degrees"); + results += PvlKeyword("MaximumDeclination", toString(maxDec), "degrees"); results += PvlKeyword("MinimumRightAscension", Projection::ToHMS(minRa), "hms"); results += PvlKeyword("MaximumRightAscension", Projection::ToHMS(maxRa), "hms"); results += PvlKeyword("MinimumDeclination", Projection::ToDMS(minDec), "dms"); results += PvlKeyword("MaximumDeclination", Projection::ToDMS(maxDec), "dms"); - results += PvlKeyword("Resolution", res, "degrees/pixel"); + results += PvlKeyword("Resolution", toString(res), "degrees/pixel"); Application::Log(results); // Setup and log orientation PvlGroup orient("Orientation"); - orient += PvlKeyword("CenterSample", icube->getSampleCount() / 2.0); - orient += PvlKeyword("CenterLine", icube->getLineCount() / 2.0); - orient += PvlKeyword("CenterRightAscension", centerRa, "degrees"); - orient += PvlKeyword("CenterDeclination", centerDec, "degrees"); - orient += PvlKeyword("CelestialNorthClockAngle", rot, "degrees"); - orient += PvlKeyword("Resolution", res, "degrees/pixel"); + orient += PvlKeyword("CenterSample", toString(icube->getSampleCount() / 2.0)); + orient += PvlKeyword("CenterLine", toString(icube->getLineCount() / 2.0)); + orient += PvlKeyword("CenterRightAscension", toString(centerRa), "degrees"); + orient += PvlKeyword("CenterDeclination", toString(centerDec), "degrees"); + orient += PvlKeyword("CelestialNorthClockAngle", toString(rot), "degrees"); + orient += PvlKeyword("Resolution", toString(res), "degrees/pixel"); Application::Log(orient); // Write the output file if requested diff --git a/isis/src/base/apps/smtk/PointPlot.h b/isis/src/base/apps/smtk/PointPlot.h index 9c5d180327..c8760792bf 100644 --- a/isis/src/base/apps/smtk/PointPlot.h +++ b/isis/src/base/apps/smtk/PointPlot.h @@ -1,4 +1,4 @@ -#if !defined(PointPlot_h) +#ifndef PointPlot_h #define PointPlot_h /** diff --git a/isis/src/base/apps/smtk/smtk.cpp b/isis/src/base/apps/smtk/smtk.cpp index 8935f1545e..0565a2548c 100644 --- a/isis/src/base/apps/smtk/smtk.cpp +++ b/isis/src/base/apps/smtk/smtk.cpp @@ -32,15 +32,15 @@ using namespace Isis; //helper button functins in the code void helperButtonLog(); -map GuiHelpers(){ - map helper; +map GuiHelpers(){ + map helper; helper ["helperButtonLog"] = (void*) helperButtonLog; return helper; } /** Function to create a Control point from an SmtkPoint */ -ControlPoint CreatePoint(const SmtkPoint &spnt, const std::string &pid, - const std::string &lcn, const std::string &rcn) { +ControlPoint CreatePoint(const SmtkPoint &spnt, const QString &pid, + const QString &lcn, const QString &rcn) { ControlPoint pnt(pid); Coordinate geom = spnt.getGeometry().getLeft(); SurfacePoint surpnt(Latitude(geom.getLatitude(), Angle::Degrees), @@ -71,9 +71,9 @@ ControlPoint CreatePoint(const SmtkPoint &spnt, const std::string &pid, } /** Function that creates and writes a control network from a SmtkQStack */ -void WriteCnet(const std::string &netfile, SmtkQStack &points, - const std::string &target, const std::string &lcn, - const std::string &rcn) { +void WriteCnet(const QString &netfile, SmtkQStack &points, + const QString &target, const QString &lcn, + const QString &rcn) { // Initialize control point network ControlNet cn; // cn.SetType(ControlNet::ImageToImage); @@ -82,7 +82,7 @@ void WriteCnet(const std::string &netfile, SmtkQStack &points, cn.SetCreatedDate(iTime::CurrentLocalTime()); SmtkQStackIter pnt = points.begin(); for (int i = 0 ; pnt != points.end() ; i++, ++pnt) { - string pntid = "Point_" + IString(i); + QString pntid = "Point_" + toString(i); cn.AddPoint(new ControlPoint(CreatePoint(pnt.value(), pntid, lcn, rcn))); } @@ -98,7 +98,7 @@ void IsisMain() { // Open the first cube. It is the left hand image. Cube lhImage; CubeAttributeInput &attLeft = ui.GetInputAttribute("FROM"); - vector bandLeft = attLeft.bands(); + vector bandLeft = attLeft.bands(); lhImage.setVirtualBands(bandLeft); lhImage.open(ui.GetFileName("FROM"),"r"); @@ -106,13 +106,13 @@ void IsisMain() { // first to this one by attempting to compute a sample/line offsets Cube rhImage; CubeAttributeInput &attRight = ui.GetInputAttribute("MATCH"); - vector bandRight = attRight.bands(); + vector bandRight = attRight.bands(); rhImage.setVirtualBands(bandRight); rhImage.open(ui.GetFileName("MATCH"),"r"); // Ensure only single bands if (lhImage.getBandCount() != 1 || rhImage.getBandCount() != 1) { - string msg = "Input Cubes must have only one band!"; + QString msg = "Input Cubes must have only one band!"; throw IException(IException::User,msg,_FILEINFO_); } @@ -126,7 +126,7 @@ void IsisMain() { rhCamera = rhImage.getCamera(); } catch (IException &ie) { - string msg = "Both input images must have a camera"; + QString msg = "Both input images must have a camera"; throw IException(ie, IException::User, msg, _FILEINFO_); } @@ -136,15 +136,15 @@ void IsisMain() { rhCamera->IgnoreElevationModel(true); // Get serial number - string serialLeft = SerialNumber::Compose(lhImage, true); - string serialRight = SerialNumber::Compose(rhImage, true); + QString serialLeft = SerialNumber::Compose(lhImage, true); + QString serialRight = SerialNumber::Compose(rhImage, true); // This still precludes band to band registrations. if (serialLeft == serialRight) { - string sLeft = FileName(lhImage.getFileName()).name(); - string sRight = FileName(rhImage.getFileName()).name(); + QString sLeft = FileName(lhImage.getFileName()).name(); + QString sRight = FileName(rhImage.getFileName()).name(); if (sLeft == sRight) { - string msg = "Cube Serial Numbers must be unique - FROM=" + serialLeft + + QString msg = "Cube Serial Numbers must be unique - FROM=" + serialLeft + ", MATCH=" + serialRight; throw IException(IException::User,msg,_FILEINFO_); } @@ -292,7 +292,7 @@ void IsisMain() { // some. /////////////////////////////////////////////////////////////////////// if (gstack.size() <= 0) { - string msg = "No seed points found - may need to check Gruen parameters."; + QString msg = "No seed points found - may need to check Gruen parameters."; throw IException(IException::User, msg, _FILEINFO_); } @@ -449,10 +449,10 @@ void IsisMain() { // Report Stereo separation angles PvlGroup stresultsPvl("StereoSeparationAngle"); - stresultsPvl += PvlKeyword("Minimum", stAng.Minimum(), "deg"); - stresultsPvl += PvlKeyword("Average", stAng.Average(), "deg"); - stresultsPvl += PvlKeyword("Maximum", stAng.Maximum(), "deg"); - stresultsPvl += PvlKeyword("StandardDeviation", stAng.StandardDeviation(), "deg"); + stresultsPvl += PvlKeyword("Minimum", toString(stAng.Minimum()), "deg"); + stresultsPvl += PvlKeyword("Average", toString(stAng.Average()), "deg"); + stresultsPvl += PvlKeyword("Maximum", toString(stAng.Maximum()), "deg"); + stresultsPvl += PvlKeyword("StandardDeviation", toString(stAng.StandardDeviation()), "deg"); Application::Log(stresultsPvl); // Update the label with BandBin keywords @@ -481,17 +481,17 @@ void IsisMain() { // Create output data PvlGroup totalPointsPvl("Totals"); - totalPointsPvl += PvlKeyword("AttemptedPoints", numAttemptedInitialPoints); - totalPointsPvl += PvlKeyword("InitialSuccesses", numOrigPoints); - totalPointsPvl += PvlKeyword("GrowSuccesses", passpix2); - totalPointsPvl += PvlKeyword("ResultingPoints", bmf.size()); + totalPointsPvl += PvlKeyword("AttemptedPoints", toString(numAttemptedInitialPoints)); + totalPointsPvl += PvlKeyword("InitialSuccesses", toString(numOrigPoints)); + totalPointsPvl += PvlKeyword("GrowSuccesses", toString(passpix2)); + totalPointsPvl += PvlKeyword("ResultingPoints", toString(bmf.size())); Application::Log(totalPointsPvl); Pvl arPvl = matcher.RegistrationStatistics(); PvlGroup smtkresultsPvl("SmtkResults"); - smtkresultsPvl += PvlKeyword("SpiceOffImage", matcher.OffImageErrorCount()); - smtkresultsPvl += PvlKeyword("SpiceDistanceError", matcher.SpiceErrorCount()); + smtkresultsPvl += PvlKeyword("SpiceOffImage", toString(matcher.OffImageErrorCount())); + smtkresultsPvl += PvlKeyword("SpiceDistanceError", toString(matcher.SpiceErrorCount())); arPvl.AddGroup(smtkresultsPvl); for(int i = 0; i < arPvl.Groups(); i++) { @@ -511,7 +511,7 @@ void IsisMain() { //Helper function to output the regdeft file to log. void helperButtonLog () { UserInterface &ui = Application::GetUserInterface(); - string file(ui.GetFileName("REGDEF")); + QString file(ui.GetFileName("REGDEF")); Pvl p; p.Read(file); Application::GuiLog(p); diff --git a/isis/src/base/apps/specdivfilter/specdivfilter.cpp b/isis/src/base/apps/specdivfilter/specdivfilter.cpp index 33db68de1f..d8887f00db 100644 --- a/isis/src/base/apps/specdivfilter/specdivfilter.cpp +++ b/isis/src/base/apps/specdivfilter/specdivfilter.cpp @@ -27,8 +27,8 @@ void IsisMain() { //Check for cases of too many bands if(bands > maxBands) { - IString msg = "Parameter bands [" + IString(bands) + "] exceeds maximum allowable size " - + "of [" + IString(maxBands) + "] for cube [" + icube->getFileName() + "]"; + QString msg = "Parameter bands [" + toString(bands) + "] exceeds maximum allowable size " + + "of [" + toString(maxBands) + "] for cube [" + icube->getFileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/spechighpass/spechighpass.cpp b/isis/src/base/apps/spechighpass/spechighpass.cpp index 7bcdb00300..14a71b2bac 100644 --- a/isis/src/base/apps/spechighpass/spechighpass.cpp +++ b/isis/src/base/apps/spechighpass/spechighpass.cpp @@ -28,9 +28,9 @@ void IsisMain() { //Check for cases of too many bands if(bands >= (2 * cubeBands)) { - IString msg = "Parameter bands [" + IString(bands) + "] " + QString msg = "Parameter bands [" + QString(bands) + "] " "exceeds maximum allowable size of [" - + IString((cubeBands * 2) - 1) + "] for cube [" + + QString((cubeBands * 2) - 1) + "] for cube [" + icube->getFileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/speclowpass/speclowpass.cpp b/isis/src/base/apps/speclowpass/speclowpass.cpp index 85f64b1128..8ebde9ce7c 100644 --- a/isis/src/base/apps/speclowpass/speclowpass.cpp +++ b/isis/src/base/apps/speclowpass/speclowpass.cpp @@ -26,8 +26,8 @@ void IsisMain() { // Check for cases of too many bands if(bands > maxBands) { - IString msg = "Parameter bands [" + IString(bands) + "] exceeds maximum allowable size " - + "of [" + IString(maxBands) + "] for cube [" + icube->getFileName() + "]"; + QString msg = "Parameter bands [" + toString(bands) + "] exceeds maximum allowable size " + + "of [" + toString(maxBands) + "] for cube [" + icube->getFileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/specpix/specpix.cpp b/isis/src/base/apps/specpix/specpix.cpp index 8bb85135fd..e8833f6dac 100644 --- a/isis/src/base/apps/specpix/specpix.cpp +++ b/isis/src/base/apps/specpix/specpix.cpp @@ -32,7 +32,7 @@ struct spRange { void specpix(Buffer &in, Buffer &out); bool descending(const spRange &r1, const spRange &r2); -void addRange(string minName, string maxName, SpecPix pixel); +void addRange(QString minName, QString maxName, SpecPix pixel); vector rangeList; @@ -91,13 +91,13 @@ void IsisMain() { // Print out number of values changed PvlGroup results("Results"); results.AddComment("The number and type of pixels created"); - results += PvlKeyword("Null", nnull); - results += PvlKeyword("Lrs", nlrs); - results += PvlKeyword("Lis", nlis); - results += PvlKeyword("Hrs", nhrs); - results += PvlKeyword("His", nhis); + results += PvlKeyword("Null", toString(nnull)); + results += PvlKeyword("Lrs", toString(nlrs)); + results += PvlKeyword("Lis", toString(nlis)); + results += PvlKeyword("Hrs", toString(nhrs)); + results += PvlKeyword("His", toString(nhis)); int total = nnull + nlrs + nhrs + nlis + nhis; - results += PvlKeyword("Total", total); + results += PvlKeyword("Total", toString(total)); Application::Log(results); @@ -159,7 +159,7 @@ bool descending(const spRange &r1, const spRange &r2) { } -void addRange(string minName, string maxName, SpecPix pixel) { +void addRange(QString minName, QString maxName, SpecPix pixel) { UserInterface &ui = Application::GetUserInterface(); if (ui.WasEntered(minName) && ui.WasEntered(maxName)) { diff --git a/isis/src/base/apps/spicefit/spicefit.cpp b/isis/src/base/apps/spicefit/spicefit.cpp index 38029edf69..9c017be2af 100644 --- a/isis/src/base/apps/spicefit/spicefit.cpp +++ b/isis/src/base/apps/spicefit/spicefit.cpp @@ -23,7 +23,7 @@ void IsisMain() { // Get the camera, interpolate to a parabola Camera *cam = cube.getCamera(); if(cam->DetectorMap()->LineRate() == 0.0) { - string msg = "[" + ui.GetFileName("FROM") + "] is not a line scan camera"; + QString msg = "[" + ui.GetFileName("FROM") + "] is not a line scan camera"; throw IException(IException::User, msg, _FILEINFO_); } cam->instrumentRotation()->SetPolynomial(); @@ -53,7 +53,7 @@ void IsisMain() { cube.close(); } catch(IException &e) { - string msg = "Unable to fit pointing for [" + ui.GetFileName("FROM") + "]"; + QString msg = "Unable to fit pointing for [" + ui.GetFileName("FROM") + "]"; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/base/apps/spiceinit/SpiceClient.cpp b/isis/src/base/apps/spiceinit/SpiceClient.cpp index 7cf18f78c2..00f2a39be9 100644 --- a/isis/src/base/apps/spiceinit/SpiceClient.cpp +++ b/isis/src/base/apps/spiceinit/SpiceClient.cpp @@ -38,10 +38,10 @@ namespace Isis { * @param startPad * @param endPad */ - SpiceClient::SpiceClient(IString url, int port, Pvl &cubeLabel, + SpiceClient::SpiceClient(QString url, int port, Pvl &cubeLabel, bool ckSmithed, bool ckRecon, bool ckNadir, bool ckPredicted, bool spkSmithed, bool spkRecon, bool spkPredicted, - IString shape, double startPad, double endPad) : QThread() { + QString shape, double startPad, double endPad) : QThread() { p_xml = NULL; p_networkMgr = NULL; p_request = NULL; @@ -49,41 +49,41 @@ namespace Isis { p_rawResponse = NULL; p_error = NULL; - IString raw; - p_xml = new IString(); + QString raw; + p_xml = new QString(); raw = "\n"; raw += " \n"; - IString version = Application::Version(); - QByteArray isisVersionRaw(version.c_str()); - raw += IString(isisVersionRaw.toHex().constData()) + "\n"; + QString version = Application::Version(); + QByteArray isisVersionRaw(version.toAscii()); + raw += QString(isisVersionRaw.toHex().constData()) + "\n"; raw += " \n"; raw += " \n"; - raw += " \n"; - raw += " \n"; - raw += " \n"; - raw += " \n"; - raw += " \n"; - raw += " \n"; - raw += " \n"; + raw += " \n"; + raw += " \n"; + raw += " \n"; + raw += " \n"; + raw += " \n"; + raw += " \n"; + raw += " \n"; raw += " \n"; - raw += " \n"; - raw += " \n"; + raw += " \n"; + raw += " \n"; raw += " \n"; raw += " \n"; raw += ""; - *p_xml = IString(QByteArray(raw.c_str()).toHex().constData()); + *p_xml = QString(QByteArray(raw.toAscii()).toHex().constData()); int contentLength = p_xml->length(); - IString contentLengthStr = IString((BigInt)contentLength); + QString contentLengthStr = toString((BigInt)contentLength); p_request = new QNetworkRequest(); p_request->setUrl(QUrl(url)); @@ -141,7 +141,7 @@ namespace Isis { QByteArray data; QUrl params; - params.addQueryItem("name", p_xml->c_str()); + params.addQueryItem("name", *p_xml); data.append(params.encodedQuery()); p_networkMgr->post(*p_request, data); @@ -155,20 +155,20 @@ namespace Isis { * @param reply */ void SpiceClient::replyFinished(QNetworkReply *reply) { - p_rawResponse = new IString(QString(reply->readAll()).toStdString()); + p_rawResponse = new QString(QString(reply->readAll())); // Decode the response - p_response = new IString(); + p_response = new QString(); try { - *p_response = IString( - QByteArray::fromHex(QByteArray(p_rawResponse->c_str())).constData()); + *p_response = QString( + QByteArray::fromHex(QByteArray(p_rawResponse->toAscii())).constData()); // Make sure we can get the log out of it before continuing applicationLog(); } catch(IException &) { - p_error = new IString(); + p_error = new QString(); // Well, the XML is bad, maybe it's PVL try { @@ -312,8 +312,8 @@ namespace Isis { */ void SpiceClient::authenticationRequired(QNetworkReply *, QAuthenticator *) { if(!p_response) { - p_rawResponse = new IString(); - p_response = new IString(); + p_rawResponse = new QString(); + p_response = new QString(); } *p_error = "Server expects authentication which is not currently "; @@ -327,8 +327,8 @@ namespace Isis { */ void SpiceClient::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *) { if(!p_response) { - p_rawResponse = new IString(); - p_response = new IString(); + p_rawResponse = new QString(); + p_response = new QString(); } *p_error = "Server expects authentication which is not currently "; @@ -344,8 +344,8 @@ namespace Isis { void SpiceClient::sslErrors(QNetworkReply *reply, const QList & err) { if(!p_response) { - p_rawResponse = new IString(); - p_response = new IString(); + p_rawResponse = new QString(); + p_response = new QString(); } *p_error = "Server expects authentication which is not currently "; @@ -363,7 +363,7 @@ namespace Isis { */ QDomElement SpiceClient::rootXMLElement() { if(!p_response || !p_rawResponse) { - IString error = "No server response available"; + QString error = "No server response available"; throw IException(IException::Io, error, _FILEINFO_); } @@ -371,13 +371,13 @@ namespace Isis { QString errorMsg; int errorLine, errorCol; - if(!p_response->empty() && - document.setContent(QString(p_response->c_str()), + if(!p_response->isEmpty() && + document.setContent(QString(p_response->toAscii()), &errorMsg, &errorLine, &errorCol)) { return document.firstChild().toElement(); } else { - IString msg = "Unexpected response from spice server ["; + QString msg = "Unexpected response from spice server ["; msg += *p_rawResponse; msg += "]"; throw IException(IException::Io, msg, _FILEINFO_); @@ -394,8 +394,8 @@ namespace Isis { * * @return QDomElement */ - QDomElement SpiceClient::findTag(QDomElement currentElement, IString name) { - QString qtName = name.ToQt(); + QDomElement SpiceClient::findTag(QDomElement currentElement, QString name) { + QString qtName = name; for(QDomNode node = currentElement.firstChild(); !node .isNull(); node = node.nextSibling()) { @@ -406,7 +406,7 @@ namespace Isis { } } - IString msg = "Server response missing XML Tag [" + name + "]"; + QString msg = "Server response missing XML Tag [" + name + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -423,7 +423,7 @@ namespace Isis { QDomElement kernelsLabel = findTag(root, "kernels_label"); QString kernelsLabels = elementContents(kernelsLabel); - IString unencoded(QByteArray::fromHex(kernelsLabels.toAscii()).constData()); + QString unencoded(QByteArray::fromHex(kernelsLabels.toAscii()).constData()); stringstream pvlStream; pvlStream << unencoded; @@ -447,7 +447,7 @@ namespace Isis { QDomElement logLabel = findTag(root, "application_log"); QString logLabels = elementContents(logLabel); - IString unencoded(QByteArray::fromHex(logLabels.toAscii()).constData()); + QString unencoded(QByteArray::fromHex(logLabels.toAscii()).constData()); stringstream pvlStream; pvlStream << unencoded; @@ -543,7 +543,7 @@ namespace Isis { QDomElement kernelsLabel = findTag(root, "kernels_label"); QString kernelsLabels = elementContents(kernelsLabel); - IString unencoded(QByteArray::fromHex(kernelsLabels.toAscii()).constData()); + QString unencoded(QByteArray::fromHex(kernelsLabels.toAscii()).constData()); stringstream pvlStream; pvlStream << unencoded; @@ -560,9 +560,9 @@ namespace Isis { * * @param boolVal * - * @return IString + * @return QString */ - IString SpiceClient::yesNo(bool boolVal) { + QString SpiceClient::yesNo(bool boolVal) { if(boolVal) return "yes"; else @@ -570,7 +570,7 @@ namespace Isis { } - Table *SpiceClient::readTable(IString xmlName, IString tableName) { + Table *SpiceClient::readTable(QString xmlName, QString tableName) { checkErrors(); QDomElement root = rootXMLElement(); diff --git a/isis/src/base/apps/spiceinit/SpiceClient.h b/isis/src/base/apps/spiceinit/SpiceClient.h index 64615c056f..73920d3a66 100644 --- a/isis/src/base/apps/spiceinit/SpiceClient.h +++ b/isis/src/base/apps/spiceinit/SpiceClient.h @@ -10,11 +10,11 @@ class QNetworkReply; class QNetworkRequest; class QNetworkProxy; class QSslError; +class QString; template class QList; namespace Isis { - class IString; class Pvl; class PvlGroup; class PvlObject; @@ -29,10 +29,10 @@ namespace Isis { Q_OBJECT public: - SpiceClient(IString url, int port, Pvl &cubeLabel, + SpiceClient(QString url, int port, Pvl &cubeLabel, bool ckSmithed, bool ckRecon, bool ckPredicted, bool ckNadir, bool spkSmithed, bool spkRecon, bool spkPredicted, - IString shape, double startPad, double endPad); + QString shape, double startPad, double endPad); virtual ~SpiceClient(); void blockUntilComplete(); @@ -55,18 +55,18 @@ namespace Isis { void sslErrors(QNetworkReply *, const QList &); private: - static IString yesNo(bool boolVal); - Table *readTable(IString xmlName, IString tableName); + static QString yesNo(bool boolVal); + Table *readTable(QString xmlName, QString tableName); QDomElement rootXMLElement(); - QDomElement findTag(QDomElement currentElement, IString name); + QDomElement findTag(QDomElement currentElement, QString name); QString elementContents(QDomElement element); void checkErrors(); private: - IString *p_error; - IString *p_xml; //!< XML Sent to server - IString *p_rawResponse; //!< Server raw response - IString *p_response; //!< Server decoded response + QString *p_error; + QString *p_xml; //!< XML Sent to server + QString *p_rawResponse; //!< Server raw response + QString *p_response; //!< Server decoded response QNetworkAccessManager *p_networkMgr; //!< Network manager does request QNetworkRequest *p_request; //!< Network request sent }; diff --git a/isis/src/base/apps/spiceinit/spiceinit.cpp b/isis/src/base/apps/spiceinit/spiceinit.cpp index b7dec7b12d..5603f302de 100644 --- a/isis/src/base/apps/spiceinit/spiceinit.cpp +++ b/isis/src/base/apps/spiceinit/spiceinit.cpp @@ -25,8 +25,8 @@ bool TryKernels(Cube *icube, Process &p, Kernel iak, Kernel dem, Kernel exk); -void RequestSpice(Cube *icube, Pvl &labels, IString missionName); -void GetUserEnteredKernel(const string ¶m, Kernel &kernel); +void RequestSpice(Cube *icube, Pvl &labels, QString missionName); +void GetUserEnteredKernel(const QString ¶m, Kernel &kernel); void IsisMain() { // Open the input cube @@ -70,14 +70,14 @@ void IsisMain() { // Set up for getting the mission name // Get the directory where the system missions translation table is. - string transFile = p.MissionData("base", - "translations/MissionName2DataDir.trn"); + QString transFile = p.MissionData("base", + "translations/MissionName2DataDir.trn"); // Get the mission translation manager ready PvlTranslationManager missionXlater(lab, transFile); // Get the mission name so we can search the correct DB's for kernels - string mission = missionXlater.Translate("MissionName"); + QString mission = missionXlater.Translate("MissionName"); if (ui.GetBoolean("WEB")) { RequestSpice(icube, *icube->getLabel(), mission); @@ -125,7 +125,7 @@ void IsisMain() { if (ui.GetBoolean("CKNADIR")) { // Only add nadir if no spacecraft pointing found - vector kernels; + vector kernels; kernels.push_back("Nadir"); ck.push(Kernel((spiceInit::kernelTypes)0, kernels)); } @@ -193,7 +193,7 @@ void IsisMain() { * @param param * @param kernel */ -void GetUserEnteredKernel(const string ¶m, Kernel &kernel) { +void GetUserEnteredKernel(const QString ¶m, Kernel &kernel) { UserInterface &ui = Application::GetUserInterface(); if (ui.WasEntered(param)) { @@ -305,16 +305,16 @@ bool TryKernels(Cube *icube, Process &p, // Add any time padding the user specified to the spice group if (ui.GetDouble("STARTPAD") > DBL_EPSILON) { currentKernels.AddKeyword(PvlKeyword("StartPadding", - ui.GetDouble("STARTPAD"), "seconds")); + toString(ui.GetDouble("STARTPAD")), "seconds")); } if (ui.GetDouble("ENDPAD") > DBL_EPSILON) { currentKernels.AddKeyword(PvlKeyword("EndPadding", - ui.GetDouble("ENDPAD"), "seconds")); + toString(ui.GetDouble("ENDPAD")), "seconds")); } currentKernels.AddKeyword( - PvlKeyword("CameraVersion", CameraFactory::CameraVersion(lab)), + PvlKeyword("CameraVersion", toString(CameraFactory::CameraVersion(lab))), Pvl::Replace); // Add the modified Kernels group to the input cube labels @@ -367,7 +367,7 @@ bool TryKernels(Cube *icube, Process &p, bodyTable.Label()["Kernels"].AddValue(pckKeyword[i]); bodyTable.Label() += PvlKeyword("SolarLongitude", - cam->solarLongitude().degrees()); + toString(cam->solarLongitude().degrees())); icube->write(bodyTable); Table sunTable = cam->sunPosition()->Cache("SunPosition"); @@ -418,10 +418,10 @@ bool TryKernels(Cube *icube, Process &p, while (i < label->Objects()) { PvlObject currObj = label->Object(i); if (currObj.IsNamed("Table")) { - if (currObj["Name"][0] == IString("InstrumentPointing") || - currObj["Name"][0] == IString("InstrumentPosition") || - currObj["Name"][0] == IString("BodyRotation") || - currObj["Name"][0] == IString("SunPosition")) { + if (currObj["Name"][0] == QString("InstrumentPointing") || + currObj["Name"][0] == QString("InstrumentPosition") || + currObj["Name"][0] == QString("BodyRotation") || + currObj["Name"][0] == QString("SunPosition")) { label->DeleteObject(i); } else { @@ -447,13 +447,13 @@ bool TryKernels(Cube *icube, Process &p, return true; } -void RequestSpice(Cube *icube, Pvl &labels, IString missionName) { +void RequestSpice(Cube *icube, Pvl &labels, QString missionName) { UserInterface &ui = Application::GetUserInterface(); - IString instrumentId = + QString instrumentId = labels.FindGroup("Instrument", Pvl::Traverse)["InstrumentId"][0]; - IString url = ui.GetString("URL") + "?mission=" + missionName + + QString url = ui.GetString("URL") + "?mission=" + missionName + "&instrument=" + instrumentId; int port = ui.GetInteger("PORT"); bool ckSmithed = ui.GetBoolean("CKSMITHED"); @@ -463,10 +463,10 @@ void RequestSpice(Cube *icube, Pvl &labels, IString missionName) { bool spkSmithed = ui.GetBoolean("SPKSMITHED"); bool spkRecon = ui.GetBoolean("SPKRECON"); bool spkPredicted = ui.GetBoolean("SPKPREDICTED"); - IString shape = IString(ui.GetString("SHAPE")).DownCase(); + QString shape = QString(ui.GetString("SHAPE")).toLower(); if (shape == "user") { - shape = IString(ui.GetAsString("MODEL")); + shape = QString(ui.GetAsString("MODEL")); // Test for valid labels with mapping group at least Pvl shapeTest(shape); diff --git a/isis/src/base/apps/spiceserver/spiceserver.cpp b/isis/src/base/apps/spiceserver/spiceserver.cpp index 59b077ab1b..4b24469d05 100644 --- a/isis/src/base/apps/spiceserver/spiceserver.cpp +++ b/isis/src/base/apps/spiceserver/spiceserver.cpp @@ -32,7 +32,7 @@ bool spkRecon = false; bool spkPredicted = false; double startPad = 0.0; double endPad = 0.0; -IString shapeKernelStr; +QString shapeKernelStr; bool TryKernels(Pvl &labels, Process &p, Kernel lk, Kernel pck, @@ -43,13 +43,13 @@ bool TryKernels(Pvl &labels, Process &p, Kernel exk); //! Combines all the temp files into one final output file -void PackageKernels(IString toFile); +void PackageKernels(QString toFile); //! Read the spiceinit parameters void ParseParameters(QDomElement parametersElement); //! Convert a table into an xml tag -IString TableToXml(IString tableName, IString file); +QString TableToXml(QString tableName, QString file); void IsisMain() { UserInterface &ui = Application::GetUserInterface(); @@ -71,24 +71,24 @@ void IsisMain() { // Get the single line of encoded XML from the input file that the client, // spiceinit, sent us. TextFile inFile(ui.GetFileName("FROM")); - IString hexCode; + QString hexCode; // GetLine returns false if it was the last line... so we can't check for // problems really inFile.GetLine(hexCode); Pvl label; - IString otherVersion; + QString otherVersion; - if (!hexCode.empty()) { + if (!hexCode.isEmpty()) { // Convert HEX to XML - IString xml(QByteArray::fromHex(QByteArray(hexCode.c_str())).constData()); + QString xml(QByteArray::fromHex(hexCode.toAscii()).constData()); // Parse the XML with Qt's XML parser... kindof convoluted, I'm sorry QDomDocument document; QString error; int errorLine, errorCol; - if (document.setContent(QString(xml.c_str()), &error, + if (document.setContent(QString(xml), &error, &errorLine, &errorCol)) { QDomElement rootElement = document.firstChild().toElement(); @@ -101,7 +101,7 @@ void IsisMain() { if (element.tagName() == "isis_version") { QString encoded = element.firstChild().toText().data(); otherVersion = - IString(QByteArray::fromHex(encoded.toAscii()).constData()); + QString(QByteArray::fromHex(encoded.toAscii()).constData()); } else if (element.tagName() == "parameters") { // Read the spiceinit parameters @@ -112,26 +112,26 @@ void IsisMain() { QString encoded = element.firstChild().toText().data(); stringstream labStream; labStream << - IString(QByteArray::fromHex(encoded.toAscii()).constData()); + QString(QByteArray::fromHex(encoded.toAscii()).constData()); labStream >> label; } } } else { - IString err = "Unable to read XML. The reason given was ["; - err += error.toStdString(); - err += "] on line [" + IString(errorLine) + "] column ["; - err += IString(errorCol) + "]"; + QString err = "Unable to read XML. The reason given was ["; + err += error; + err += "] on line [" + toString(errorLine) + "] column ["; + err += toString(errorCol) + "]"; throw IException(IException::Io, err, _FILEINFO_); } } else { - IString msg = "Unable to read input file"; + QString msg = "Unable to read input file"; throw IException(IException::User, msg, _FILEINFO_); } if (otherVersion != Application::Version()) { - IString msg = "The SPICE server only supports the latest Isis version [" + + QString msg = "The SPICE server only supports the latest Isis version [" + Application::Version() + "], version [" + otherVersion + "] is not compatible"; throw IException(IException::User, msg, _FILEINFO_); @@ -143,14 +143,14 @@ void IsisMain() { // Set up for getting the mission name // Get the directory where the system missions translation table is. - string transFile = p.MissionData("base", - "translations/MissionName2DataDir.trn"); + QString transFile = p.MissionData("base", + "translations/MissionName2DataDir.trn"); // Get the mission translation manager ready PvlTranslationManager missionXlater(label, transFile); // Get the mission name so we can search the correct DB's for kernels - string mission = missionXlater.Translate("MissionName"); + QString mission = missionXlater.Translate("MissionName"); // Get system base kernels unsigned int allowed = 0; @@ -186,7 +186,7 @@ void IsisMain() { if (ckNadir) { // Only add nadir if no spacecraft pointing found - std::vector kernels; + std::vector kernels; kernels.push_back("Nadir"); ck.push(Kernel((spiceInit::kernelTypes)0, kernels)); } @@ -242,17 +242,17 @@ void IsisMain() { } catch (...) { // We failed at something, delete the temp files... - IString outFile = ui.GetFileName("TO"); - QFile pointingFile(QString::fromStdString(outFile + ".pointing")); + QString outFile = ui.GetFileName("TO"); + QFile pointingFile(outFile + ".pointing"); if (pointingFile.exists()) pointingFile.remove(); - QFile positionFile(QString::fromStdString(outFile + ".position")); + QFile positionFile(outFile + ".position"); if (positionFile.exists()) positionFile.remove(); - QFile bodyRotFile(QString::fromStdString(outFile + ".bodyrot")); + QFile bodyRotFile(outFile + ".bodyrot"); if (bodyRotFile.exists()) bodyRotFile.remove(); - QFile sunFile(QString::fromStdString(outFile + ".sun")); + QFile sunFile(outFile + ".sun"); if (sunFile.exists()) sunFile.remove(); throw; @@ -361,13 +361,13 @@ bool TryKernels(Pvl &label, Process &p, // Add any time padding the user specified to the spice group if (startPad > DBL_EPSILON) - currentKernels.AddKeyword(PvlKeyword("StartPadding", startPad, "seconds")); + currentKernels.AddKeyword(PvlKeyword("StartPadding", toString(startPad), "seconds")); if (endPad > DBL_EPSILON) - currentKernels.AddKeyword(PvlKeyword("EndPadding", endPad, "seconds")); + currentKernels.AddKeyword(PvlKeyword("EndPadding", toString(endPad), "seconds")); currentKernels.AddKeyword( - PvlKeyword("CameraVersion", CameraFactory::CameraVersion(lab)), + PvlKeyword("CameraVersion", toString(CameraFactory::CameraVersion(lab))), Pvl::Replace); // Create the camera so we can get blobs if necessary @@ -421,7 +421,7 @@ bool TryKernels(Pvl &label, Process &p, bodyTable.Label()["Kernels"].AddValue(pckKeyword[i]); bodyTable.Label() += PvlKeyword("SolarLongitude", - cam->solarLongitude().degrees()); + toString(cam->solarLongitude().degrees())); bodyTable.Write(ui.GetFileName("TO") + ".bodyrot"); Table sunTable = cam->sunPosition()->Cache("SunPosition"); @@ -462,18 +462,18 @@ bool TryKernels(Pvl &label, Process &p, } -IString TableToXml(IString tableName, IString file) { - IString xml; +QString TableToXml(QString tableName, QString file) { + QString xml; xml += " <" + tableName + ">\n"; QFile tableFile(file); if (!tableFile.open(QIODevice::ReadOnly)) { - IString msg = "Unable to read temporary file [" + file + "]"; + QString msg = "Unable to read temporary file [" + file + "]"; throw IException(IException::Io, msg, _FILEINFO_); } QByteArray data = tableFile.readAll(); - xml += IString(data.toHex().constData()) + "\n"; + xml += QString(data.toHex().constData()) + "\n"; tableFile.close(); // we should now be completely done with this temp file tableFile.remove(); @@ -543,31 +543,31 @@ void ParseParameters(QDomElement parametersElement) { } -void PackageKernels(IString toFile) { - IString xml; +void PackageKernels(QString toFile) { + QString xml; xml += "\n"; xml += " \n"; - IString logFile(toFile + ".print"); + QString logFile(toFile + ".print"); Pvl logMessage(logFile); - remove(logFile.c_str()); + remove(logFile.toAscii().data()); stringstream logStream; logStream << logMessage; xml += - IString(QByteArray(logStream.str().c_str()).toHex().constData()) + "\n"; + QString(QByteArray(logStream.str().c_str()).toHex().constData()) + "\n"; xml += " \n"; xml += " \n"; - IString kernLabelsFile(toFile + ".lab"); + QString kernLabelsFile(toFile + ".lab"); Pvl kernLabels(kernLabelsFile); - remove(kernLabelsFile.c_str()); + remove(kernLabelsFile.toAscii().data()); stringstream labelStream; labelStream << kernLabels; xml += - IString(QByteArray(labelStream.str().c_str()).toHex().constData()) + "\n"; + QString(QByteArray(labelStream.str().c_str()).toHex().constData()) + "\n"; xml += " \n"; @@ -579,10 +579,10 @@ void PackageKernels(IString toFile) { xml += " \n"; xml += "\n"; - IString encodedXml(QByteArray(xml.c_str()).toHex().constData()); + QString encodedXml(xml.toAscii().toHex().constData()); QFile finalOutput(toFile); finalOutput.open(QIODevice::WriteOnly); - finalOutput.write(encodedXml.c_str()); + finalOutput.write(encodedXml.toAscii()); finalOutput.close(); } diff --git a/isis/src/base/apps/spkwriter/Commentor.h b/isis/src/base/apps/spkwriter/Commentor.h index 1a2ca5f0b0..9517562704 100644 --- a/isis/src/base/apps/spkwriter/Commentor.h +++ b/isis/src/base/apps/spkwriter/Commentor.h @@ -1,4 +1,4 @@ -#if !defined(Commentor_h) +#ifndef Commentor_h #define Commentor_h /** * @file @@ -49,9 +49,9 @@ template /** Constructor w/initialization */ Commentor() { init(); } /** Constructor w/caller provided file containing comments */ - Commentor(const std::string &comfile) { + Commentor(const QString &comfile) { init(); - if ( !comfile.empty() ) { + if ( !comfile.isEmpty() ) { loadCommentFile(comfile); } } @@ -83,7 +83,7 @@ template * @history Debbie A. Cook - Added spkwriter signature keyword to user's * comment */ - void loadCommentFile(const std::string &comFile) { + void loadCommentFile(const QString &comFile) { _comComment = readCommentFile(comFile); // The following line was added to ensure that a // user's entered comment file includes the @@ -94,13 +94,13 @@ template } /** Allows user to set comment header string */ - void setCommentHeader(const std::string &comment) { + void setCommentHeader(const QString &comment) { _comComment = comment; return; } /** Returns the current contents of the collected comments */ - std::string Comments() const { + QString Comments() const { return (_comComment + _comSetComments); } @@ -111,9 +111,9 @@ template } private: - std::string _comFile; - std::string _comComment; - std::string _comSetComments; + QString _comFile; + QString _comComment; + QString _comSetComments; /** * @brief Read comments from a file @@ -121,12 +121,12 @@ template * This method reads a text file containing comments that will be written * to the SPICE kernel written. * - * @return std::string Returns contents of of comment file + * @return QString Returns contents of of comment file */ - std::string readCommentFile(const std::string comfile) { + QString readCommentFile(const QString comfile) { TextFile t(comfile); - std::string comment; - std::string cline; + QString comment; + QString cline; while ( t.GetLine(cline, false) ) { cline.push_back('\n'); comment += cline; diff --git a/isis/src/base/apps/spkwriter/KernelWriter.h b/isis/src/base/apps/spkwriter/KernelWriter.h index 46c9e65e3a..984ba8eb6b 100644 --- a/isis/src/base/apps/spkwriter/KernelWriter.h +++ b/isis/src/base/apps/spkwriter/KernelWriter.h @@ -1,4 +1,4 @@ -#if !defined(KernelWriter_h) +#ifndef KernelWriter_h #define KernelWriter_h /** * @file @@ -50,13 +50,13 @@ namespace Isis { * writing of all CK/SPK types directly in this class. The template class K * must provide some internal virtual methods. These methods are: * @code - * int k_open(const std::string &fname, const int commnt_size); + * int k_open(const QString &fname, const int commnt_size); * void k_write(int _handle, const K kernels); * void k_close(int handle); * @endcode * * The class K may also provide a WriteComment(const int handle, const - * std::string &comment) method that will write comments to the output kernel + * QString &comment) method that will write comments to the output kernel * file if the provided one is not adequate. * * @author 2010-11-10 Kris Becker @@ -74,13 +74,13 @@ class KernelWriter { virtual ~KernelWriter() { } /** Open a kernel file using virtual method provided in K */ - void open(const std::string &kfile, const int &commnt_size = 5120) { + void open(const QString &kfile, const int &commnt_size = 5120) { _handle = k_open(kfile, commnt_size); } /** Write header with comments provided */ - void header(const std::string &comment) { + void header(const QString &comment) { WriteComment(_handle, comment); } @@ -97,12 +97,12 @@ class KernelWriter { * list of kernels. * * @param K Kernel container with segments to write - * @param std::string Name of file to write kernel to - * @param std::string Name + * @param QString Name of file to write kernel to + * @param QString Name */ - void write(const K &kernels, const std::string &kfile, - const std::string &comfile = "") { - std::string comments = getComment(kernels, comfile); + void write(const K &kernels, const QString &kfile, + const QString &comfile = "") { + QString comments = getComment(kernels, comfile); open(kfile, comments.size() + 512); header(comments); // Writes header write(kernels); @@ -117,19 +117,19 @@ class KernelWriter { } /** Accumulate comment from K object and individed set */ - std::string getComment(const K &kernels, const std::string &comfile) { + QString getComment(const K &kernels, const QString &comfile) { Commentor commentor(comfile); - if (comfile.empty()) { commentor.setCommentHeader(k_header()); } + if (comfile.isEmpty()) { commentor.setCommentHeader(k_header()); } kernels.Accept(commentor); return (commentor.Comments()); } protected: /** These virtual methods must be provided by the K class */ - virtual int k_open(const std::string &kfile, const int &comsize = 512) = 0; + virtual int k_open(const QString &kfile, const int &comsize = 512) = 0; virtual void k_write(const SpiceInt &handle, const K &kernels) = 0; virtual void k_close(SpiceInt &handle) = 0; - virtual std::string k_header() const = 0; + virtual QString k_header() const = 0; private: SpiceInt _handle; ///< SPICE file handle @@ -140,22 +140,22 @@ class KernelWriter { * * @return bool Returns success if so. */ - virtual bool WriteComment(SpiceInt handle, const std::string &comment) + virtual bool WriteComment(SpiceInt handle, const QString &comment) const { if ( handle == 0 ) { - std::string mess = "Comments cannot be written as the file is not open"; + QString mess = "Comments cannot be written as the file is not open"; throw IException(IException::Programmer, mess, _FILEINFO_); } // Trap errors so they are not fatal if the comment section fills up. // Calling environments can decide how to handle it. try { - std::string commOut; + QString commOut; NaifStatus::CheckErrors(); - for ( unsigned int i = 0 ; i < comment.size() ; i++ ) { + for ( int i = 0 ; i < comment.size() ; i++ ) { if ( comment[i] == '\n' ) { while ( commOut.size() < 2 ) { commOut.append(" "); } - dafac_c(handle, 1, commOut.size(), commOut.c_str()); + dafac_c(handle, 1, commOut.size(), commOut.toAscii().data()); NaifStatus::CheckErrors(); commOut.clear(); } @@ -167,7 +167,7 @@ class KernelWriter { // See if there is residual to write if ( commOut.size() > 0 ) { while ( commOut.size() < 2 ) { commOut.append(" "); } - dafac_c(handle, 1, commOut.size(), commOut.c_str()); + dafac_c(handle, 1, commOut.size(), commOut.toAscii().data()); NaifStatus::CheckErrors(); } } diff --git a/isis/src/base/apps/spkwriter/SpiceKernel.h b/isis/src/base/apps/spkwriter/SpiceKernel.h index 86237531a2..4035fdd271 100644 --- a/isis/src/base/apps/spkwriter/SpiceKernel.h +++ b/isis/src/base/apps/spkwriter/SpiceKernel.h @@ -1,4 +1,4 @@ -#if !defined(SpiceKernel_h) +#ifndef SpiceKernel_h #define SpiceKernel_h /** * @file diff --git a/isis/src/base/apps/spkwriter/SpiceSegment.cpp b/isis/src/base/apps/spkwriter/SpiceSegment.cpp index c657545d48..2d7ce93f55 100644 --- a/isis/src/base/apps/spkwriter/SpiceSegment.cpp +++ b/isis/src/base/apps/spkwriter/SpiceSegment.cpp @@ -55,7 +55,7 @@ SpiceSegment::SpiceSegment(Cube &cube) { } /** Set the segment Id that will be written to the kernel */ -void SpiceSegment::setId(const std::string &name) { +void SpiceSegment::setId(const QString &name) { _name = name; return; } @@ -75,7 +75,7 @@ void SpiceSegment::setId(const std::string &name) { * * @return int Number of kernels loaded for the requested type */ -int SpiceSegment::LoadKernelType(const std::string &ktypes) const { +int SpiceSegment::LoadKernelType(const QString &ktypes) const { return (_kernels.Load(ktypes)); } @@ -89,7 +89,7 @@ int SpiceSegment::LoadKernelType(const std::string &ktypes) const { * * @return int Number kernels unloaded */ -int SpiceSegment::UnloadKernelType(const std::string &ktypes) const { +int SpiceSegment::UnloadKernelType(const QString &ktypes) const { return (_kernels.UnLoad(ktypes)); } @@ -123,19 +123,19 @@ void SpiceSegment::init(Cube &cube) { Camera *camera = cube.getCamera(); // Determine segment ID from product ID if it exists, otherwise basename - if ( _name.empty() ) { + if ( _name.isEmpty() ) { _name = getKeyValue(*label, "ProductId"); - if (_name.empty() ) { + if (_name.isEmpty() ) { _name = FileName(_fname).baseName(); } } // Get instrument and target ids - string value(""); + QString value(""); value = getKeyValue(*label, "InstrumentId"); - if (!value.empty()) { _instId = value; } + if (!value.isEmpty()) { _instId = value; } value = getKeyValue(*label, "TargetName"); - if (!value.empty()) { _target = value; } + if (!value.isEmpty()) { _target = value; } // Get default times for sorting purposes setStartTime(camera->cacheStartTime().Et()); @@ -161,12 +161,12 @@ void SpiceSegment::init(Cube &cube) { * @param label Label to search the keyword * @param keyword Nanme of keyword to find * - * @return std::string Returns first value in the found keyword. If the keyword + * @return QString Returns first value in the found keyword. If the keyword * does not exist, an empty string is returned. */ -std::string SpiceSegment::getKeyValue(PvlObject &label, - const std::string &keyword) { - string value(""); +QString SpiceSegment::getKeyValue(PvlObject &label, + const QString &keyword) { + QString value(""); if ( label.HasKeyword(keyword,Pvl::Traverse) ) { value = label.FindKeyword(keyword,Pvl::Traverse)[0]; } @@ -208,9 +208,9 @@ bool SpiceSegment::getImageTimes(Pvl &lab, double &start, double &end) const { _kernels.Load("LSK,SCLK"); PvlObject &cube = lab.FindObject("IsisCube"); // Get the start and end time for the cube - start = UTCtoET((string) cube.FindGroup("Instrument")["StartTime"]); + start = UTCtoET((QString) cube.FindGroup("Instrument")["StartTime"]); if(cube.FindGroup("Instrument").HasKeyword("StopTime")) { - end = UTCtoET((string) cube.FindGroup("Instrument")["StopTime"]); + end = UTCtoET((QString) cube.FindGroup("Instrument")["StopTime"]); } else { end = UTCtoET (cube.FindGroup("Instrument")["StartTime"]); @@ -350,9 +350,9 @@ void SpiceSegment::setEndTime(double et) { * * @param naifid NAIF integer code to convert to a name * - * @return std::string Returns the frame or body name. + * @return QString Returns the frame or body name. */ -std::string SpiceSegment::getNaifName(int naifid) const { +QString SpiceSegment::getNaifName(int naifid) const { SpiceChar naifBuf[40]; frmnam_c ( (SpiceInt) naifid, sizeof(naifBuf), naifBuf); string cframe(naifBuf); @@ -373,21 +373,21 @@ std::string SpiceSegment::getNaifName(int naifid) const { } - return (cframe); + return (cframe.c_str()); } /** Converts and ET time to UTC string */ -std::string SpiceSegment::toUTC(const double &et) const { +QString SpiceSegment::toUTC(const double &et) const { const int UTCLEN = 80; char utcout[UTCLEN]; et2utc_c(et, "ISOC", 3, UTCLEN, utcout); - return (string(utcout)); + return (QString(utcout)); } /** Converts a UTC time string to ET */ -double SpiceSegment::UTCtoET(const std::string &utc) const { +double SpiceSegment::UTCtoET(const QString &utc) const { SpiceDouble et; - utc2et_c(utc.c_str(), &et); + utc2et_c(utc.toAscii().data(), &et); return (et); } diff --git a/isis/src/base/apps/spkwriter/SpiceSegment.h b/isis/src/base/apps/spkwriter/SpiceSegment.h index f99fb7ab25..8fdf2c7a54 100644 --- a/isis/src/base/apps/spkwriter/SpiceSegment.h +++ b/isis/src/base/apps/spkwriter/SpiceSegment.h @@ -1,4 +1,4 @@ -#if !defined(SpiceSegment_h) +#ifndef SpiceSegment_h #define SpiceSegment_h /** * @file @@ -73,24 +73,24 @@ class SpiceSegment { virtual int size() const = 0; /** Return name of cube file associated with segment */ - std::string Source() const { return (_fname); } + QString Source() const { return (_fname); } /** Returns the name of the segment, typically the ProductId */ - std::string Id() const { return (_name); } - void setId(const std::string &id); + QString Id() const { return (_name); } + void setId(const QString &id); /** Return name of instrument */ - std::string Instrument() const { return (_instId); } + QString Instrument() const { return (_instId); } /** Return name of target */ - std::string target() const { return (_target); } + QString target() const { return (_target); } /** Start time of segment in ET */ double startTime() const { return (_startTime); } /** End time of segment in ET */ double endTime() const { return (_endTime); } - std::string utcStartTime() const { return (_utcStartTime); } - std::string utcEndTime() const { return (_utcEndTime); } + QString utcStartTime() const { return (_utcStartTime); } + QString utcEndTime() const { return (_utcEndTime); } inline bool operator<(const SpiceSegment &segment) const { return (startTime() < segment.startTime()); @@ -99,16 +99,16 @@ class SpiceSegment { virtual bool HasVelocityVectors() const { return (false); } // Elements for writing NAIF SPICE kernels - int LoadKernelType(const std::string &ktypes) const; - int UnloadKernelType(const std::string &ktypes = "") const; + int LoadKernelType(const QString &ktypes) const; + int UnloadKernelType(const QString &ktypes = "") const; int CameraVersion() const { return (_kernels.CameraVersion()); } /** Returns a comment summarizing the segment */ - virtual std::string getComment() const = 0; + virtual QString getComment() const = 0; protected: void init(Cube &cube); - std::string getKeyValue(PvlObject &label, const std::string &keyword); + QString getKeyValue(PvlObject &label, const QString &keyword); const Kernels &getKernels() const { return (_kernels); } bool getImageTimes(Pvl &lab, double &start, double &end) const; SMatrix expand(int ntop, int nbot, const SMatrix &matrix) const; @@ -117,20 +117,20 @@ class SpiceSegment { void setStartTime(double et); void setEndTime(double et); - std::string getNaifName(int naifid) const; - std::string toUTC(const double &et) const; - double UTCtoET(const std::string &utc) const; + QString getNaifName(int naifid) const; + QString toUTC(const double &et) const; + double UTCtoET(const QString &utc) const; private: - std::string _name; - std::string _fname; - std::string _instId; - std::string _target; + QString _name; + QString _fname; + QString _instId; + QString _target; double _startTime; double _endTime; - std::string _utcStartTime; // Need to store these as conversion from ET - std::string _utcEndTime; // requires leap seconds kernel + QString _utcStartTime; // Need to store these as conversion from ET + QString _utcEndTime; // requires leap seconds kernel mutable Kernels _kernels; // Kernel manager void init(); diff --git a/isis/src/base/apps/spkwriter/SpkKernelWriter.cpp b/isis/src/base/apps/spkwriter/SpkKernelWriter.cpp index e1dc626e03..a38032a086 100644 --- a/isis/src/base/apps/spkwriter/SpkKernelWriter.cpp +++ b/isis/src/base/apps/spkwriter/SpkKernelWriter.cpp @@ -43,14 +43,14 @@ namespace Isis { * @brief Provide general comments for an SPK kernel header * * - * @return std::string Comment generated for SPK SPICE kernel header + * @return QString Comment generated for SPK SPICE kernel header * * @internal * @history 2012-05-23 Kris Becker Added creation of special tag to ID the * kernel as needing special light time and * stellar aberration correction in spiceinit */ - std::string SpkKernelWriter::k_header() const { + QString SpkKernelWriter::k_header() const { ostringstream comment; comment << "\ ****************************************************************************\n\ @@ -131,7 +131,7 @@ namespace Isis { geometry can be reproduced accurately.\n\ \n"; - return (string(comment.str())); + return (QString(comment.str().c_str())); } diff --git a/isis/src/base/apps/spkwriter/SpkKernelWriter.h b/isis/src/base/apps/spkwriter/SpkKernelWriter.h index 0bac80eb6b..4539628ab4 100644 --- a/isis/src/base/apps/spkwriter/SpkKernelWriter.h +++ b/isis/src/base/apps/spkwriter/SpkKernelWriter.h @@ -1,4 +1,4 @@ -#if !defined(SpkKernelWriter_h) +#ifndef SpkKernelWriter_h #define SpkKernelWriter_h /** * @file @@ -81,7 +81,7 @@ class SpkKernelWriter : public KernelWriter { */ void setType(const int spktype) { if ( (spktype != 9) && (spktype != 13) ) { - std::string mess = "SPK kernel type " + IString(spktype) + + QString mess = "SPK kernel type " + QString(spktype) + " not valid/supported - must 9 or 13"; throw IException(IException::User, mess, _FILEINFO_); } @@ -90,21 +90,21 @@ class SpkKernelWriter : public KernelWriter { protected: - int k_open(const std::string &kfile, const int &comsize = 512) { + int k_open(const QString &kfile, const int &comsize = 512) { FileName kf(kfile); if ( kf.fileExists() ) { - std::string full_kf = kf.expanded(); - std::remove(full_kf.c_str()); + QString full_kf = kf.expanded(); + std::remove(full_kf.toAscii().data()); } SpiceInt myHandle; NaifStatus::CheckErrors(); - spkopn_c(kf.expanded().c_str(), "USGS_SPK_FILE", comsize, &myHandle); + spkopn_c(kf.expanded().toAscii().data(), "USGS_SPK_FILE", comsize, &myHandle); NaifStatus::CheckErrors(); return (myHandle); } - std::string k_header() const; + QString k_header() const; void k_write(const SpiceInt &handle, const SpkKernel &kernels) { if ( _spkType == 9 ) { @@ -137,8 +137,8 @@ class SpkKernelWriter : public KernelWriter { void operator()(const K &segment) const { SpiceInt body = segment.BodyCode(); SpiceInt center = segment.CenterCode(); - std::string frame = segment.ReferenceFrame(); - std::string segId = segment.Id(); + QString frame = segment.ReferenceFrame(); + QString segId = segment.Id(); const SVector &epochs = segment.Epochs(); const SMatrix &states = segment.States(); @@ -148,8 +148,8 @@ class SpkKernelWriter : public KernelWriter { segment.LoadKernelType("FK"); NaifStatus::CheckErrors(); - spkw09_c(_handle, body, center, frame.c_str(), epochs[0], epochs[nrecs-1], - segId.c_str(), degree, nrecs, states[0], &epochs[0]); + spkw09_c(_handle, body, center, frame.toAscii().data(), epochs[0], epochs[nrecs-1], + segId.toAscii().data(), degree, nrecs, states[0], &epochs[0]); NaifStatus::CheckErrors(); segment.UnloadKernelType("FK"); @@ -170,8 +170,8 @@ class SpkKernelWriter : public KernelWriter { // Collect frames SpiceInt body = segment.BodyCode(); SpiceInt center = segment.CenterCode(); - std::string frame = segment.ReferenceFrame(); - std::string segId = segment.Id(); + QString frame = segment.ReferenceFrame(); + QString segId = segment.Id(); // Collect data const SVector &epochs = segment.Epochs(); @@ -182,8 +182,8 @@ class SpkKernelWriter : public KernelWriter { // Ensure the FK is loaded segment.LoadKernelType("FK"); NaifStatus::CheckErrors(); - spkw13_c(_handle, body, center, frame.c_str(), epochs[0], epochs[nrecs-1], - segId.c_str(), degree, nrecs, states[0], &epochs[0]); + spkw13_c(_handle, body, center, frame.toAscii().data(), epochs[0], epochs[nrecs-1], + segId.toAscii().data(), degree, nrecs, states[0], &epochs[0]); NaifStatus::CheckErrors(); segment.UnloadKernelType("FK"); return; diff --git a/isis/src/base/apps/spkwriter/SpkSegment.cpp b/isis/src/base/apps/spkwriter/SpkSegment.cpp index 4066e8832f..a579e0bd31 100644 --- a/isis/src/base/apps/spkwriter/SpkSegment.cpp +++ b/isis/src/base/apps/spkwriter/SpkSegment.cpp @@ -53,7 +53,7 @@ SpkSegment::SpkSegment() : SpiceSegment() { } /** Constructor from ISIS cube file by name of the cube */ -SpkSegment::SpkSegment(const std::string &fname) : SpiceSegment() { +SpkSegment::SpkSegment(const QString &fname) : SpiceSegment() { init(); Cube cube; cube.open(fname); @@ -89,7 +89,7 @@ SpkSegment::SpkSegment(Cube &cube) : SpiceSegment(cube) { * This will need to be an option in the future. */ void SpkSegment::import(Cube &cube) { - typedef std::vector StrList; + typedef std::vector StrList; // Extract ISIS SPK blob and transform to CK 3 content NaifStatus::CheckErrors(); @@ -235,11 +235,11 @@ void SpkSegment::getStates(Camera &camera, const SMatrix &spice, } // Compute state rotations relative to the reference frame - string j2000 = getNaifName(1); // ISIS stores in J2000 + QString j2000 = getNaifName(1); // ISIS stores in J2000 if (j2000 != _refFrame) { for (int n = 0 ; n < nrecs ; n++) { SpiceDouble xform[6][6]; - sxform_c(j2000.c_str(), _refFrame.c_str(), epochs[n], xform); + sxform_c(j2000.toAscii().data(), _refFrame.toAscii().data(), epochs[n], xform); mxvg_c(xform, states[n], 6, 6, states[n]); } } @@ -292,9 +292,9 @@ SpkSegment::SVector SpkSegment::makeState(SpicePosition *position, const double * * @author kbecker (5/2/2011) * - * @return std::string Comment string for the segment + * @return QString Comment string for the segment */ -std::string SpkSegment::getComment() const { +QString SpkSegment::getComment() const { ostringstream comment; comment << @@ -315,17 +315,17 @@ std::string SpkSegment::getComment() const { comment << " PolyDegree: " << _degree << endl << " CamVersion: " << CameraVersion() << endl; - std::vector klist = getKernels().getKernelList(); + QStringList klist = getKernels().getKernelList(); if ( klist.size() > 0 ) { comment << " Kernels: \n"; - for ( unsigned int i = 0 ; i < klist.size() ; i++ ) { + for ( int i = 0 ; i < klist.size() ; i++ ) { comment << " " << klist[i] << endl; } } - return (string(comment.str())); + return ((comment.str().c_str())); } /** @@ -420,7 +420,7 @@ SpkSegment::SVector SpkSegment::adjustTimes(Camera &camera, for ( int i = 0 ; i < epochs.dim1() ; i++ ) { SpiceDouble lt; SpiceDouble state[6]; - spkez_c(observer, epochs[i], _refFrame.c_str(), "LT+S", target, state, <); + spkez_c(observer, epochs[i], _refFrame.toAscii().data(), "LT+S", target, state, <); ltEpochs[i] = epochs[i] - lt; } return (ltEpochs); diff --git a/isis/src/base/apps/spkwriter/SpkSegment.h b/isis/src/base/apps/spkwriter/SpkSegment.h index b5ca1bc736..ec1e8f8df9 100644 --- a/isis/src/base/apps/spkwriter/SpkSegment.h +++ b/isis/src/base/apps/spkwriter/SpkSegment.h @@ -1,4 +1,4 @@ -#if !defined(SpkSegment_h) +#ifndef SpkSegment_h #define SpkSegment_h /** * @file @@ -62,7 +62,7 @@ class SpkSegment : public SpiceSegment { typedef SpiceSegment::SMatrix SMatrix; SpkSegment(); - SpkSegment(const std::string &fname); + SpkSegment(const QString &fname); SpkSegment(Cube &cube); virtual ~SpkSegment() { } @@ -76,7 +76,7 @@ class SpkSegment : public SpiceSegment { /** NAIF SPICE instrument code */ int CenterCode() const { return (_center); } /** Returns CK segment reference frame */ - std::string ReferenceFrame() const { return (_refFrame); } + QString ReferenceFrame() const { return (_refFrame); } /** Get times of each entry */ SVector Epochs() const { return (_epochs); } /** Returns instance of quaternions */ @@ -87,16 +87,16 @@ class SpkSegment : public SpiceSegment { bool HasVelocityVectors() const { return (_hasVV); } /** Returns a comment summarizing the segment */ - std::string getComment() const; + QString getComment() const; private: enum { MinimumStates = 3, MaximumDegree = 7}; // Sensible? NAIF extremes int _body; // NAIF body code of the SPICE segment - std::string _bodyFrame; // NAIF body frame + QString _bodyFrame; // NAIF body frame int _center; // NAIF center code of the SPICE segment - std::string _centerFrame; // NAIF center frame - std::string _refFrame; // NAIF reference frame + QString _centerFrame; // NAIF center frame + QString _refFrame; // NAIF reference frame SMatrix _states; // Position states SVector _epochs; // ET times of records bool _hasVV; // Has velocity vectors? diff --git a/isis/src/base/apps/spkwriter/spkwriter.cpp b/isis/src/base/apps/spkwriter/spkwriter.cpp index 81fd6c3175..1c0deab690 100644 --- a/isis/src/base/apps/spkwriter/spkwriter.cpp +++ b/isis/src/base/apps/spkwriter/spkwriter.cpp @@ -22,7 +22,7 @@ void IsisMain() { if (ui.WasEntered("FROM")) flist.push_back(ui.GetFileName("FROM")); if (ui.WasEntered("FROMLIST")) flist.read(ui.GetFileName("FROMLIST")); if (flist.size() < 1) { - string msg = "Files must be specified in FROM and/or FROMLIST - none found!"; + QString msg = "Files must be specified in FROM and/or FROMLIST - none found!"; throw IException(IException::User,msg,_FILEINFO_); } @@ -38,7 +38,7 @@ void IsisMain() { } // Process CK kernel requests - string comfile(""); + QString comfile(""); if (ui.WasEntered("COMFILE")) comfile = ui.GetFileName("COMFILE"); SpkKernelWriter kwriter(ui.GetInteger("TYPE")); @@ -50,11 +50,11 @@ void IsisMain() { // Write a summary of the documentation if (ui.WasEntered("SUMMARY")) { - string fFile = FileName(ui.GetFileName("SUMMARY")).expanded(); + QString fFile = FileName(ui.GetFileName("SUMMARY")).expanded(); ofstream os; - os.open(fFile.c_str(),ios::out); + os.open(fFile.toAscii().data(),ios::out); if (!os) { - string mess = "Cannot create SPK SUMMARY output file " + fFile; + QString mess = "Cannot create SPK SUMMARY output file " + fFile; throw IException(IException::User, mess, _FILEINFO_); } os << kwriter.getComment(kernel, comfile) << endl; diff --git a/isis/src/base/apps/stats/stats.cpp b/isis/src/base/apps/stats/stats.cpp index a760733819..d50059a21a 100644 --- a/isis/src/base/apps/stats/stats.cpp +++ b/isis/src/base/apps/stats/stats.cpp @@ -42,28 +42,28 @@ void IsisMain() { // Construct a label with the results PvlGroup results("Results"); results += PvlKeyword("From", icube->getFileName()); - results += PvlKeyword("Band", icube->getPhysicalBand(i)); + results += PvlKeyword("Band", toString(icube->getPhysicalBand(i))); if(stats->ValidPixels() != 0) { - results += PvlKeyword("Average", stats->Average()); - results += PvlKeyword("StandardDeviation", stats->StandardDeviation()); - results += PvlKeyword("Variance", stats->Variance()); + results += PvlKeyword("Average", toString(stats->Average())); + results += PvlKeyword("StandardDeviation", toString(stats->StandardDeviation())); + results += PvlKeyword("Variance", toString(stats->Variance())); // These statistics only worked on a histogram - results += PvlKeyword("Median", stats->Median()); - results += PvlKeyword("Mode", stats->Mode()); - results += PvlKeyword("Skew", stats->Skew()); - results += PvlKeyword("Minimum", stats->Minimum()); - results += PvlKeyword("Maximum", stats->Maximum()); - results += PvlKeyword("Sum", stats->Sum()); + results += PvlKeyword("Median", toString(stats->Median())); + results += PvlKeyword("Mode", toString(stats->Mode())); + results += PvlKeyword("Skew", toString(stats->Skew())); + results += PvlKeyword("Minimum", toString(stats->Minimum())); + results += PvlKeyword("Maximum", toString(stats->Maximum())); + results += PvlKeyword("Sum", toString(stats->Sum())); } - results += PvlKeyword("TotalPixels", stats->TotalPixels()); - results += PvlKeyword("ValidPixels", stats->ValidPixels()); - results += PvlKeyword("OverValidMaximumPixels", stats->OverRangePixels()); - results += PvlKeyword("UnderValidMinimumPixels", stats->UnderRangePixels()); - results += PvlKeyword("NullPixels", stats->NullPixels()); - results += PvlKeyword("LisPixels", stats->LisPixels()); - results += PvlKeyword("LrsPixels", stats->LrsPixels()); - results += PvlKeyword("HisPixels", stats->HisPixels()); - results += PvlKeyword("HrsPixels", stats->HrsPixels()); + results += PvlKeyword("TotalPixels", toString(stats->TotalPixels())); + results += PvlKeyword("ValidPixels", toString(stats->ValidPixels())); + results += PvlKeyword("OverValidMaximumPixels", toString(stats->OverRangePixels())); + results += PvlKeyword("UnderValidMinimumPixels", toString(stats->UnderRangePixels())); + results += PvlKeyword("NullPixels", toString(stats->NullPixels())); + results += PvlKeyword("LisPixels", toString(stats->LisPixels())); + results += PvlKeyword("LrsPixels", toString(stats->LrsPixels())); + results += PvlKeyword("HisPixels", toString(stats->HisPixels())); + results += PvlKeyword("HrsPixels", toString(stats->HrsPixels())); mainpvl.AddGroup(results); @@ -74,7 +74,7 @@ void IsisMain() { // Write the results to the output file if the user specified one if(ui.WasEntered("TO")) { - string outFile = FileName(ui.GetFileName("TO")).expanded(); + QString outFile = FileName(ui.GetFileName("TO")).expanded(); bool exists = FileName(outFile).fileExists(); bool append = ui.GetBoolean("APPEND"); ofstream os; @@ -91,13 +91,13 @@ void IsisMain() { else { //if the format was not PVL, write out a flat file. if(append) { - os.open(outFile.c_str(), ios::app); + os.open(outFile.toAscii().data(), ios::app); if(!exists) { writeHeader = true; } } else { - os.open(outFile.c_str(), ios::out); + os.open(outFile.toAscii().data(), ios::out); writeHeader = true; } @@ -113,7 +113,7 @@ void IsisMain() { for(int i = 0; i < mainpvl.Groups(); i++) { for (int j = 0; j < mainpvl.Group(i).Keywords(); j++) { - os << (string)mainpvl.Group(i)[j]; + os << (QString)mainpvl.Group(i)[j]; if(j < mainpvl.Group(i).Keywords() - 1) { os << ","; } diff --git a/isis/src/base/apps/stretch/stretch.cpp b/isis/src/base/apps/stretch/stretch.cpp index de198ff2b7..6f9bd4d240 100644 --- a/isis/src/base/apps/stretch/stretch.cpp +++ b/isis/src/base/apps/stretch/stretch.cpp @@ -20,7 +20,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); - string pairs; + QString pairs; // first just get the pairs from where ever and worry about // whether they are dn values or %'s later @@ -31,7 +31,7 @@ void IsisMain() { pairsFile.Open(pairsFileName.expanded()); // concat all non-comment lines into one string (pairs) - string line = ""; + QString line = ""; while(pairsFile.GetLine(line, true)) { pairs += " " + line; } diff --git a/isis/src/base/apps/svfilter/svfilter.cpp b/isis/src/base/apps/svfilter/svfilter.cpp index 58890653ec..f81ff7423e 100644 --- a/isis/src/base/apps/svfilter/svfilter.cpp +++ b/isis/src/base/apps/svfilter/svfilter.cpp @@ -23,7 +23,7 @@ void IsisMain() { // Find out how to handle special pixels UserInterface &ui = Application::GetUserInterface(); propagate = ui.GetBoolean("PROPAGATE"); - string filt = ui.GetString("FILTER"); + QString filt = ui.GetString("FILTER"); stdDev = false; if(filt == "STDDEV") stdDev = true; diff --git a/isis/src/base/apps/table2cube/table2cube.cpp b/isis/src/base/apps/table2cube/table2cube.cpp index 1e0f28b8fc..ef67433096 100644 --- a/isis/src/base/apps/table2cube/table2cube.cpp +++ b/isis/src/base/apps/table2cube/table2cube.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace Isis; Table *g_table; -IString g_field; +QString g_field; int g_startRecord; int g_numRecords; int g_startElement; diff --git a/isis/src/base/apps/tabledump/tabledump.cpp b/isis/src/base/apps/tabledump/tabledump.cpp index ae868adfef..f74d403a18 100644 --- a/isis/src/base/apps/tabledump/tabledump.cpp +++ b/isis/src/base/apps/tabledump/tabledump.cpp @@ -12,12 +12,12 @@ using namespace Isis; using namespace std; int g_pos = 0; -string g_previousFile = ""; +QString g_previousFile = ""; void helperButtonGetTableList(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonGetTableList"] = (void *) helperButtonGetTableList; return helper; } @@ -26,11 +26,11 @@ void IsisMain() { // Gather parameters from the UserInterface UserInterface &ui = Application::GetUserInterface(); FileName file = ui.GetFileName("FROM"); - string tableName = ui.GetString("NAME"); + QString tableName = ui.GetString("NAME"); Table table(tableName, file.expanded()); // Set the character to separate the entries - string delimit; + QString delimit; if (ui.GetString("DELIMIT") == "COMMA") { delimit = ","; } @@ -46,12 +46,12 @@ void IsisMain() { for (int i = 0; i < table[0].Fields(); i++) { for (int j = 0; j < table[0][i].size(); j++) { - string title = table[0][i].name(); + QString title = table[0][i].name(); if (table[0][i].isText()) { j += table[0][i].bytes(); } else if (table[0][i].size() > 1) { - title += "(" + IString(j) + ")"; + title += "(" + toString(j) + ")"; } if (i == table[0].Fields() - 1 && j == table[0][i].size() - 1) { // We've reached the last field, omit the delimiter @@ -79,7 +79,7 @@ void IsisMain() { ss << IString((double)table[i][j]); } else if (table[i][j].isText()) { - ss << (string)table[i][j]; + ss << (QString)table[i][j]; } if (j < table[i].Fields() - 1) { ss << delimit; @@ -89,7 +89,7 @@ void IsisMain() { // and output them with the delimiter character between else { if (table[i][j].isText()) { - ss << (string)table[i][j] << delimit; + ss << (QString)table[i][j] << delimit; } else if (table[i][j].isInteger()) { vector currField = table[i][j]; @@ -126,13 +126,13 @@ void IsisMain() { if (ui.WasEntered("TO")) { - string outfile(FileName(ui.GetFileName("TO")).expanded()); - ofstream outFile(outfile.c_str()); + QString outfile(FileName(ui.GetFileName("TO")).expanded()); + ofstream outFile(outfile.toAscii().data()); outFile << ss.str(); outFile.close(); } else if (ui.IsInteractive()) { - std::string log = ss.str(); + QString log = ss.str().c_str(); Application::GuiLog(log); } else { @@ -142,11 +142,11 @@ void IsisMain() { // Function to find the available table names and put them into the GUI void helperButtonGetTableList() { - string list; + QString list; bool match = false; UserInterface &ui = Application::GetUserInterface(); - string currentFile = ui.GetFileName("FROM"); + QString currentFile = ui.GetFileName("FROM"); const Pvl label(FileName(currentFile).expanded()); // Check to see if the "FILE" parameter has changed since last press @@ -162,7 +162,7 @@ void helperButtonGetTableList() { // If we've gone through all objects and found nothing, throw an exception if (cnt >= label.Objects()) { g_pos = 0; - string msg = "Parameter [FROM] has no tables."; + QString msg = "Parameter [FROM] has no tables."; throw IException(IException::User, msg, _FILEINFO_); } // When the end of the objects is hit, display "NAME" parameter as blank @@ -173,7 +173,7 @@ void helperButtonGetTableList() { } // When we find a table, fetch its name to stick in the "NAME" parameter else if (label.Object(g_pos).Name() == "Table") { - list = label.Object(g_pos)["Name"][0].c_str(); + list = label.Object(g_pos)["Name"][0]; match = true; g_pos++; } diff --git a/isis/src/base/apps/tabledump/tabledump.xml b/isis/src/base/apps/tabledump/tabledump.xml index 84705ed3e2..a7373639f2 100644 --- a/isis/src/base/apps/tabledump/tabledump.xml +++ b/isis/src/base/apps/tabledump/tabledump.xml @@ -49,10 +49,16 @@ Added a newline to the last line of the output TO file. - PROG: Changed references to TableField methods to lower camel case. + Changed references to TableField methods to lower camel case. Ordered includes. Added g_ prefix to global variables. Added padding to control statements. References #1169. + + Text field outputs are no longer padded with NULL (ASCII 0) characters; these + characters were not intended to be part of the output. This was fixed because + preserving this behavior would have been much more difficult than fixing it. + References #1312. + diff --git a/isis/src/base/apps/translate/translate.cpp b/isis/src/base/apps/translate/translate.cpp index 65ec1b91c9..afeb35bf84 100644 --- a/isis/src/base/apps/translate/translate.cpp +++ b/isis/src/base/apps/translate/translate.cpp @@ -33,8 +33,8 @@ void IsisMain() { interp = new Interpolator(Interpolator::CubicConvolutionType); } else { - string msg = "Unknow value for INTERP [" + - ui.GetString("INTERP") + "]"; + QString msg = "Unknow value for INTERP [" + + ui.GetString("INTERP") + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/apps/uncrop/uncrop.cpp b/isis/src/base/apps/uncrop/uncrop.cpp index 8581c7d5e8..df025506e5 100644 --- a/isis/src/base/apps/uncrop/uncrop.cpp +++ b/isis/src/base/apps/uncrop/uncrop.cpp @@ -14,7 +14,7 @@ void IsisMain() { // Set up the mosaic priority UserInterface &ui = Application::GetUserInterface(); - string combineMethod = ui.GetString("COMBINE"); + QString combineMethod = ui.GetString("COMBINE"); ProcessMosaic::ImageOverlay priority; if(combineMethod == "PARENT") { priority = ProcessMosaic::PlaceImagesBeneath; diff --git a/isis/src/base/objs/AdaptiveGruen/AdaptiveGruen.h b/isis/src/base/objs/AdaptiveGruen/AdaptiveGruen.h index f8812c73bd..bf647a83b9 100644 --- a/isis/src/base/objs/AdaptiveGruen/AdaptiveGruen.h +++ b/isis/src/base/objs/AdaptiveGruen/AdaptiveGruen.h @@ -1,4 +1,4 @@ -#if !defined(AdaptiveGruen_h) +#ifndef AdaptiveGruen_h #define AdaptiveGruen_h /** * @file @@ -71,7 +71,7 @@ namespace Isis { protected: /** Return name of Algorithm */ - virtual IString AlgorithmName() const { + virtual QString AlgorithmName() const { return ("AdaptiveGruen"); } diff --git a/isis/src/base/objs/AdaptiveGruen/unitTest.cpp b/isis/src/base/objs/AdaptiveGruen/unitTest.cpp index 68511c9d35..fe56fe6593 100644 --- a/isis/src/base/objs/AdaptiveGruen/unitTest.cpp +++ b/isis/src/base/objs/AdaptiveGruen/unitTest.cpp @@ -18,18 +18,18 @@ int main() { try { PvlGroup alg("Algorithm"); alg += PvlKeyword("Name", "AdaptiveGruen"); - alg += PvlKeyword("Tolerance", 0.01); - alg += PvlKeyword("AffineTranslationTolerance", 0.15); - alg += PvlKeyword("AffineScaleTolerance", 0.15); - alg += PvlKeyword("MaximumIterations", 30); + alg += PvlKeyword("Tolerance", "0.01"); + alg += PvlKeyword("AffineTranslationTolerance", "0.15"); + alg += PvlKeyword("AffineScaleTolerance", "0.15"); + alg += PvlKeyword("MaximumIterations", "30"); PvlGroup pchip("PatternChip"); - pchip += PvlKeyword("Samples", 15); - pchip += PvlKeyword("Lines", 15); + pchip += PvlKeyword("Samples", "15"); + pchip += PvlKeyword("Lines", "15"); PvlGroup schip("SearchChip"); - schip += PvlKeyword("Samples", 30); - schip += PvlKeyword("Lines", 30); + schip += PvlKeyword("Samples", "30"); + schip += PvlKeyword("Lines", "30"); PvlObject o("AutoRegistration"); o.AddGroup(alg); diff --git a/isis/src/base/objs/Affine/Affine.cpp b/isis/src/base/objs/Affine/Affine.cpp index e5b939f490..3277de28d6 100644 --- a/isis/src/base/objs/Affine/Affine.cpp +++ b/isis/src/base/objs/Affine/Affine.cpp @@ -24,7 +24,8 @@ #include #include #include -#include "jama/jama_svd.h" + +#include #include "Constants.h" #include "IException.h" diff --git a/isis/src/base/objs/Albedo/Albedo.cpp b/isis/src/base/objs/Albedo/Albedo.cpp index f4d1318d08..93b1405481 100644 --- a/isis/src/base/objs/Albedo/Albedo.cpp +++ b/isis/src/base/objs/Albedo/Albedo.cpp @@ -1,6 +1,7 @@ #include "Albedo.h" #include "SpecialPixel.h" #include "IException.h" +#include "IString.h" #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define MAX(x,y) (((x) > (y)) ? (x) : (y)) @@ -67,7 +68,7 @@ namespace Isis { } else { if(psurf == 0.0) { - std::string msg = "Albedo math divide by zero error"; + QString msg = "Albedo math divide by zero error"; throw IException(IException::Unknown, msg, _FILEINFO_); } else { @@ -90,8 +91,8 @@ namespace Isis { */ void Albedo::SetNormPharef(const double pharef) { if(pharef < 0.0 || pharef >= 180.0) { - std::string msg = "Invalid value of normalization pharef [" + - IString(pharef) + "]"; + QString msg = "Invalid value of normalization pharef [" + + toString(pharef) + "]"; throw IException(IException::User, msg, _FILEINFO_); } p_normPharef = pharef; @@ -108,8 +109,8 @@ namespace Isis { */ void Albedo::SetNormIncref(const double incref) { if(incref < 0.0 || incref >= 90.0) { - std::string msg = "Invalid value of normalization incref [" + - IString(incref) + "]"; + QString msg = "Invalid value of normalization incref [" + + toString(incref) + "]"; throw IException(IException::User, msg, _FILEINFO_); } p_normIncref = incref; @@ -126,8 +127,8 @@ namespace Isis { */ void Albedo::SetNormEmaref(const double emaref) { if(emaref < 0.0 || emaref >= 90.0) { - std::string msg = "Invalid value of normalization emaref [" + - IString(emaref) + "]"; + QString msg = "Invalid value of normalization emaref [" + + toString(emaref) + "]"; throw IException(IException::User, msg, _FILEINFO_); } p_normEmaref = emaref; @@ -141,8 +142,8 @@ namespace Isis { */ void Albedo::SetNormIncmat(const double incmat) { if(incmat < 0.0 || incmat >= 90.0) { - std::string msg = "Invalid value of normalization incmat [" + - IString(incmat) + "]"; + QString msg = "Invalid value of normalization incmat [" + + toString(incmat) + "]"; throw IException(IException::User, msg, _FILEINFO_); } p_normIncmat = incmat; diff --git a/isis/src/base/objs/Albedo/Albedo.h b/isis/src/base/objs/Albedo/Albedo.h index 592577c20c..a841d7dd91 100644 --- a/isis/src/base/objs/Albedo/Albedo.h +++ b/isis/src/base/objs/Albedo/Albedo.h @@ -1,4 +1,4 @@ -#if !defined(Albedo_h) +#ifndef Albedo_h #define Albedo_h /** * @file diff --git a/isis/src/base/objs/AlbedoAtm/AlbedoAtm.cpp b/isis/src/base/objs/AlbedoAtm/AlbedoAtm.cpp index d1d624a481..dfe090fb71 100644 --- a/isis/src/base/objs/AlbedoAtm/AlbedoAtm.cpp +++ b/isis/src/base/objs/AlbedoAtm/AlbedoAtm.cpp @@ -140,7 +140,7 @@ namespace Isis { fourthterm = pow(q, 2.0) - 4.0 * thirdterm; if(fourthterm < 0.0) { - std::string msg = "Square root of negative (math) encountered"; + QString msg = "Square root of negative (math) encountered"; throw IException(IException::Unknown, msg, _FILEINFO_); } else { @@ -152,7 +152,7 @@ namespace Isis { // Now use rho and reference geometry to calculate output dnout if((1.0 - rho * GetAtmosModel()->AtmosAb()*p_normSbar) <= 0.0) { - std::string msg = "Divide by zero (math) encountered"; + QString msg = "Divide by zero (math) encountered"; throw IException(IException::Unknown, msg, _FILEINFO_); } else { @@ -174,8 +174,8 @@ namespace Isis { */ void AlbedoAtm::SetNormPharef(const double pharef) { if(pharef < 0.0 || pharef >= 180.0) { - std::string msg = "Invalid value of normalization pharef [" + - IString(pharef) + "]"; + QString msg = "Invalid value of normalization pharef [" + + toString(pharef) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -193,8 +193,8 @@ namespace Isis { */ void AlbedoAtm::SetNormIncref(const double incref) { if(incref < 0.0 || incref >= 90.0) { - std::string msg = "Invalid value of normalization incref [" + - IString(incref) + "]"; + QString msg = "Invalid value of normalization incref [" + + toString(incref) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -212,8 +212,8 @@ namespace Isis { */ void AlbedoAtm::SetNormEmaref(const double emaref) { if(emaref < 0.0 || emaref >= 90.0) { - std::string msg = "Invalid value of normalization emaref [" + - IString(emaref) + "]"; + QString msg = "Invalid value of normalization emaref [" + + toString(emaref) + "]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/AlphaCube/AlphaCube.cpp b/isis/src/base/objs/AlphaCube/AlphaCube.cpp index d4096455d0..445c17facf 100644 --- a/isis/src/base/objs/AlphaCube/AlphaCube.cpp +++ b/isis/src/base/objs/AlphaCube/AlphaCube.cpp @@ -22,6 +22,8 @@ */ #include "AlphaCube.h" +#include "IString.h" + using namespace std; namespace Isis { //! Constructs an AlphaCube object using a PVL object. @@ -138,25 +140,25 @@ namespace Isis { *this = temp; Isis::PvlGroup &alpha = cube.FindGroup("AlphaCube"); - alpha["AlphaSamples"] = p_alphaSamples; - alpha["AlphaLines"] = p_alphaLines; - alpha["AlphaStartingSample"] = p_alphaStartingSample; - alpha["AlphaStartingLine"] = p_alphaStartingLine; - alpha["AlphaEndingSample"] = p_alphaEndingSample; - alpha["AlphaEndingLine"] = p_alphaEndingLine; - alpha["BetaSamples"] = p_betaSamples; - alpha["BetaLines"] = p_betaLines; + alpha["AlphaSamples"] = toString(p_alphaSamples); + alpha["AlphaLines"] = toString(p_alphaLines); + alpha["AlphaStartingSample"] = toString(p_alphaStartingSample); + alpha["AlphaStartingLine"] = toString(p_alphaStartingLine); + alpha["AlphaEndingSample"] = toString(p_alphaEndingSample); + alpha["AlphaEndingLine"] = toString(p_alphaEndingLine); + alpha["BetaSamples"] = toString(p_betaSamples); + alpha["BetaLines"] = toString(p_betaLines); } else { Isis::PvlGroup alpha("AlphaCube"); - alpha += Isis::PvlKeyword("AlphaSamples", p_alphaSamples); - alpha += Isis::PvlKeyword("AlphaLines", p_alphaLines); - alpha += Isis::PvlKeyword("AlphaStartingSample", p_alphaStartingSample); - alpha += Isis::PvlKeyword("AlphaStartingLine", p_alphaStartingLine); - alpha += Isis::PvlKeyword("AlphaEndingSample", p_alphaEndingSample); - alpha += Isis::PvlKeyword("AlphaEndingLine", p_alphaEndingLine); - alpha += Isis::PvlKeyword("BetaSamples", p_betaSamples); - alpha += Isis::PvlKeyword("BetaLines", p_betaLines); + alpha += Isis::PvlKeyword("AlphaSamples", toString(p_alphaSamples)); + alpha += Isis::PvlKeyword("AlphaLines", toString(p_alphaLines)); + alpha += Isis::PvlKeyword("AlphaStartingSample", toString(p_alphaStartingSample)); + alpha += Isis::PvlKeyword("AlphaStartingLine", toString(p_alphaStartingLine)); + alpha += Isis::PvlKeyword("AlphaEndingSample", toString(p_alphaEndingSample)); + alpha += Isis::PvlKeyword("AlphaEndingLine", toString(p_alphaEndingLine)); + alpha += Isis::PvlKeyword("BetaSamples", toString(p_betaSamples)); + alpha += Isis::PvlKeyword("BetaLines", toString(p_betaLines)); cube.AddGroup(alpha); } } diff --git a/isis/src/base/objs/AlphaCube/AlphaCube.h b/isis/src/base/objs/AlphaCube/AlphaCube.h index 3801771ef9..31a08dd6ad 100644 --- a/isis/src/base/objs/AlphaCube/AlphaCube.h +++ b/isis/src/base/objs/AlphaCube/AlphaCube.h @@ -20,7 +20,7 @@ * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ -#if !defined(AlphaCube_h) +#ifndef AlphaCube_h #define AlphaCube_h #include "Pvl.h" diff --git a/isis/src/base/objs/AlphaCube/unitTest.cpp b/isis/src/base/objs/AlphaCube/unitTest.cpp index 0142a42b90..8619bff964 100644 --- a/isis/src/base/objs/AlphaCube/unitTest.cpp +++ b/isis/src/base/objs/AlphaCube/unitTest.cpp @@ -82,8 +82,8 @@ int main() { Isis::PvlObject &isiscube = lab.FindObject("IsisCube"); isiscube.AddGroup(Isis::PvlGroup("Dimensions")); Isis::PvlGroup &dims = isiscube.FindGroup("Dimensions"); - dims += Isis::PvlKeyword("Samples", 4); - dims += Isis::PvlKeyword("Lines", 8); + dims += Isis::PvlKeyword("Samples", "4"); + dims += Isis::PvlKeyword("Lines", "8"); c.UpdateGroup(lab); cout << lab << endl; } diff --git a/isis/src/base/objs/Angle/Angle.cpp b/isis/src/base/objs/Angle/Angle.cpp index 5294e39f3f..55e25ae7d3 100644 --- a/isis/src/base/objs/Angle/Angle.cpp +++ b/isis/src/base/objs/Angle/Angle.cpp @@ -219,11 +219,11 @@ namespace Isis { * @param includeUnits Include the angle's units in the text. * @return A user-displayable angle string. */ - IString Angle::toString(bool includeUnits) const { - IString textResult = ""; + QString Angle::toString(bool includeUnits) const { + QString textResult = ""; if (isValid()) { - textResult = IString(degrees()); + textResult = Isis::toString(degrees()); if (includeUnits) textResult += " degrees"; diff --git a/isis/src/base/objs/Angle/Angle.h b/isis/src/base/objs/Angle/Angle.h index f8f536537d..bc646ff197 100644 --- a/isis/src/base/objs/Angle/Angle.h +++ b/isis/src/base/objs/Angle/Angle.h @@ -24,8 +24,9 @@ #include +class QString; + namespace Isis { - class IString; /** * @brief Defines an angle and provides unit conversions @@ -249,7 +250,7 @@ namespace Isis { */ void setDegrees(double degrees) { setAngle(degrees, Degrees); } - virtual IString toString(bool includeUnits = true) const; + virtual QString toString(bool includeUnits = true) const; protected: double unitWrapValue(const Units& unit) const; diff --git a/isis/src/base/objs/Angle/unitTest.cpp b/isis/src/base/objs/Angle/unitTest.cpp index 93c4aa124f..268347e33b 100644 --- a/isis/src/base/objs/Angle/unitTest.cpp +++ b/isis/src/base/objs/Angle/unitTest.cpp @@ -8,9 +8,8 @@ #include "Preference.h" #include "SpecialPixel.h" +using namespace Isis; using namespace std; -using Isis::Angle; -using Isis::PI; class MyAngle : public Isis::Angle { public: diff --git a/isis/src/base/objs/Anisotropic1/Anisotropic1.cpp b/isis/src/base/objs/Anisotropic1/Anisotropic1.cpp index b297359d2f..3f55abc7d2 100644 --- a/isis/src/base/objs/Anisotropic1/Anisotropic1.cpp +++ b/isis/src/base/objs/Anisotropic1/Anisotropic1.cpp @@ -94,7 +94,7 @@ namespace Isis { } if(p_atmosWha == 1.0) { - std::string msg = "Anisotropic conservative case not implemented yet - WHA parameter cannot be set to 1.0"; + QString msg = "Anisotropic conservative case not implemented yet - WHA parameter cannot be set to 1.0"; msg += "This will cause negative planetary curvature to occur."; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Anisotropic1/unitTest.cpp b/isis/src/base/objs/Anisotropic1/unitTest.cpp index 7f58c2f2e3..ca46b769b7 100644 --- a/isis/src/base/objs/Anisotropic1/unitTest.cpp +++ b/isis/src/base/objs/Anisotropic1/unitTest.cpp @@ -30,9 +30,9 @@ int main() { PvlGroup alga("Algorithm"); alga += PvlKeyword("Name", "Anisotropic1"); - alga += PvlKeyword("Tau", 0.28); - alga += PvlKeyword("Bha", 0.85); - alga += PvlKeyword("Hnorm", 0.003); + alga += PvlKeyword("Tau", "0.28"); + alga += PvlKeyword("Bha", "0.85"); + alga += PvlKeyword("Hnorm", "0.003"); PvlObject oa("AtmosphericModel"); oa.AddGroup(alga); diff --git a/isis/src/base/objs/Anisotropic2/Anisotropic2.cpp b/isis/src/base/objs/Anisotropic2/Anisotropic2.cpp index fabcc30562..2d8009c024 100644 --- a/isis/src/base/objs/Anisotropic2/Anisotropic2.cpp +++ b/isis/src/base/objs/Anisotropic2/Anisotropic2.cpp @@ -78,7 +78,7 @@ namespace Isis { } if(p_atmosWha == 1.0) { - std::string msg = "Anisotropic conservative case not implemented yet - WHA parameter cannot be set to 1.0."; + QString msg = "Anisotropic conservative case not implemented yet - WHA parameter cannot be set to 1.0."; msg += "This will cause negative planetary curvature to occur."; throw IException(IException::User, msg, _FILEINFO_); } @@ -255,7 +255,7 @@ namespace Isis { AtmosModel::En(1, p_atmosTau * (1.0 + 1.0 / xx))); } else { - std::string msg = "Negative length of planetary curvature encountered"; + QString msg = "Negative length of planetary curvature encountered"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -274,7 +274,7 @@ namespace Isis { f1mmu = xx * (log(1.0 + 1.0 / xx) - p_e1 * emu + AtmosModel::En(1, p_atmosTau * (1.0 + 1.0 / xx))); } else { - std::string msg = "Negative length of planetary curvature encountered"; + QString msg = "Negative length of planetary curvature encountered"; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Anisotropic2/unitTest.cpp b/isis/src/base/objs/Anisotropic2/unitTest.cpp index 894149c5fb..b19bd505b6 100644 --- a/isis/src/base/objs/Anisotropic2/unitTest.cpp +++ b/isis/src/base/objs/Anisotropic2/unitTest.cpp @@ -30,7 +30,7 @@ int main() { PvlGroup alga("Algorithm"); alga += PvlKeyword("Name", "Anisotropic2"); - alga += PvlKeyword("Tau", 0.28); + alga += PvlKeyword("Tau", "0.28"); PvlObject oa("AtmosphericModel"); oa.AddGroup(alga); diff --git a/isis/src/base/objs/Application/Application.cpp b/isis/src/base/objs/Application/Application.cpp index 1dc4b32d0a..b1e77fcdf2 100644 --- a/isis/src/base/objs/Application/Application.cpp +++ b/isis/src/base/objs/Application/Application.cpp @@ -32,7 +32,7 @@ extern int errno; #include //#include -//#include +//#include #include #include @@ -100,8 +100,8 @@ namespace Isis { putenv(env); // Verify ISISROOT was set - if (getenv("ISISROOT") == NULL || IString(getenv("ISISROOT")) == "") { - string message = "Please set ISISROOT before running any Isis " + if (getenv("ISISROOT") == NULL || QString(getenv("ISISROOT")) == "") { + QString message = "Please set ISISROOT before running any Isis " "applications"; cerr << message << endl; abort(); @@ -115,7 +115,7 @@ namespace Isis { // Create user interface and log try { - FileName f(string(argv[0]) + ".xml"); + FileName f(QString(argv[0]) + ".xml"); // Create preferences Preference::Preferences(f.name() == "unitTest.xml"); @@ -123,11 +123,11 @@ namespace Isis { if (!f.fileExists()) { f = "$ISISROOT/bin/xml/" + f.name(); if (!f.fileExists()) { - string message = Message::FileOpen(f.expanded()); + QString message = Message::FileOpen(f.expanded()); throw IException(IException::Io, message, _FILEINFO_); } } - string xmlfile = f.expanded(); + QString xmlfile = f.expanded(); p_ui = new UserInterface(xmlfile, argc, argv); if (!p_ui->IsInteractive()) { @@ -150,8 +150,8 @@ namespace Isis { if (GetUserInterface().ParentId()) { p_connectionToParent = new QLocalSocket; - IString serverName = "isis_" + UserName() + - "_" + IString(iApp->GetUserInterface().ParentId()); + QString serverName = "isis_" + UserName() + + "_" + toString(iApp->GetUserInterface().ParentId()); p_connectionToParent->connectToServer(serverName); if (!p_connectionToParent->waitForConnected()) { @@ -229,12 +229,12 @@ namespace Isis { #if 0 catch (exception &e) { - string message = e.what(); + QString message = e.what(); Isis::iExceptionSystem i(message, _FILEINFO_); status = i.Report(); } catch (...) { - string message = "Unknown error expection"; + QString message = "Unknown error expection"; Isis::iExceptionSystem i(message, _FILEINFO_); status = i.Report(); } @@ -287,7 +287,7 @@ namespace Isis { minutes = minutes - hours * 60; char temp[80]; sprintf(temp, "%02d:%02d:%04.1f", hours, minutes, seconds); - string conTime = temp; + QString conTime = temp; //cerr << "Accounting GUI end time=" << endTime << " start time=" << p_startTime << " total=" << seconds << endl; @@ -299,7 +299,7 @@ namespace Isis { hours = minutes / 60; minutes = minutes - hours * 60; sprintf(temp, "%02d:%02d:%04.1f", hours, minutes, seconds); - string cpuTime = temp; + QString cpuTime = temp; // Add this information to the log PvlGroup acct("Accounting"); @@ -365,8 +365,8 @@ namespace Isis { ostringstream ostr; if (blankLine) ostr << endl; ostr << results << endl; - string data = ostr.str(); - iApp->SendParentData(string("LOG"), data); + QString data = ostr.str().c_str(); + iApp->SendParentData("LOG", data); } // Otherwise see if we need to write to our gui @@ -374,7 +374,7 @@ namespace Isis { ostringstream ostr; if (blankLine) ostr << endl; ostr << results << endl; - iApp->GetUserInterface().TheGui()->Log(ostr.str()); + iApp->GetUserInterface().TheGui()->Log(ostr.str().c_str()); iApp->GetUserInterface().TheGui()->ShowLog(); } @@ -391,20 +391,22 @@ namespace Isis { * * @param results Pvl containing the results to add to the session log */ - void Application::GuiLog(Pvl &results) { + void Application::GuiLog(const Pvl &results) { // See if we should write the info to our parents gui + Pvl copy(results); + if (HasParent()) { ostringstream ostr; - ostr << results << endl; - string data = ostr.str(); - iApp->SendParentData(string("GUILOG"), data); + ostr << copy << endl; + QString data = ostr.str().c_str(); + iApp->SendParentData("GUILOG", data); } // Otherwise see if we need to write to our gui else if (iApp->GetUserInterface().IsInteractive()) { ostringstream ostr; - ostr << results << endl; - iApp->GetUserInterface().TheGui()->Log(ostr.str()); + ostr << copy << endl; + iApp->GetUserInterface().TheGui()->Log(ostr.str().c_str()); iApp->GetUserInterface().TheGui()->ShowLog(); } } @@ -414,20 +416,22 @@ namespace Isis { * * @param results PvlGroup containing the results to add to the session log */ - void Application::GuiLog(PvlGroup &results) { + void Application::GuiLog(const PvlGroup &results) { // See if we should write the info to our parents gui + PvlGroup copy(results); + if (HasParent()) { ostringstream ostr; - ostr << results << endl; - string data = ostr.str(); - iApp->SendParentData(string("GUILOG"), data); + ostr << copy << endl; + QString data = ostr.str().c_str(); + iApp->SendParentData("GUILOG", data); } // Otherwise see if we need to write to our gui else if (iApp->GetUserInterface().IsInteractive()) { ostringstream ostr; - ostr << results << endl; - iApp->GetUserInterface().TheGui()->Log(ostr.str()); + ostr << copy << endl; + iApp->GetUserInterface().TheGui()->Log(ostr.str().c_str()); iApp->GetUserInterface().TheGui()->ShowLog(); } } @@ -435,12 +439,12 @@ namespace Isis { /** * Writes the results to the sessionlog, but not to the printfile * - * @param results string containing the results to add to the session log + * @param results QString containing the results to add to the session log */ - void Application::GuiLog(string &results) { + void Application::GuiLog(const QString &results) { // See if we should write the info to our parents gui if (HasParent()) { - iApp->SendParentData(string("GUILOG"), results); + iApp->SendParentData("GUILOG", results); } // Otherwise see if we need to write to our gui @@ -482,8 +486,8 @@ namespace Isis { for (int i = 0; i < errors.Groups(); i++) { ostringstream ostr; ostr << errors.Group(i) << endl; - string data = ostr.str(); - iApp->SendParentData(string("ERROR"), data); + QString data = ostr.str().c_str(); + iApp->SendParentData("ERROR", data); } } @@ -492,30 +496,30 @@ namespace Isis { * @param code * @param message */ - void Application::SendParentData(const string code, - const string &message) { + void Application::SendParentData(const QString code, + const QString &message) { // See if we need to connect to the parent if (p_connectionToParent == NULL) { - IString msg = "This process (program) was executed by an existing Isis 3 " + QString msg = "This process (program) was executed by an existing Isis 3 " "process. However, we failed to establish a communication channel " "with the parent (launcher) process. The parent process has a PID of " - "[" + IString(iApp->GetUserInterface().ParentId()) + "]"; + "[" + toString(iApp->GetUserInterface().ParentId()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } - // Have connection so build data string and send it - string data = code; + // Have connection so build data QString and send it + QString data = code; data += char(27); data += message; data += char(27); data += '\n'; - if (p_connectionToParent->write(data.c_str(), data.size()) == -1) { - IString msg = "This process (program) was executed by an exiting Isis 3 " + if (p_connectionToParent->write(data.toAscii().data(), data.toAscii().size()) == -1) { + QString msg = "This process (program) was executed by an exiting Isis 3 " "process. A communication channel was established with the parent " "(launcher) process, but when we tried to send data to the parent " "process an error occurred. The parent process has a PID of [" + - IString(iApp->GetUserInterface().ParentId()) + "]"; + QString(iApp->GetUserInterface().ParentId()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -537,13 +541,13 @@ namespace Isis { if (HasParent()) { ostringstream ostr; ostr << SessionLog::TheLog() << endl; - string data = ostr.str(); - iApp->SendParentData(string("LOG"), data); + QString data = ostr.str().c_str(); + iApp->SendParentData("LOG", data); } else if (p_ui->IsInteractive()) { ostringstream ostr; ostr << SessionLog::TheLog() << endl; - p_ui->TheGui()->Log(ostr.str()); + p_ui->TheGui()->Log(ostr.str().c_str()); p_ui->TheGui()->ShowLog(); } else { @@ -553,9 +557,9 @@ namespace Isis { // If debugging flag on write debugging log if (p_ui->GetInfoFlag()) { - string filename = p_ui->GetInfoFileName(); + QString filename = p_ui->GetInfoFileName(); Pvl log; - IString app = (IString)QCoreApplication::applicationDirPath() + "/" + p_appName; + QString app = (QString)QCoreApplication::applicationDirPath() + "/" + p_appName; if (p_BatchlistPass == 0) { stringstream ss ; ss << SessionLog::TheLog(); @@ -571,9 +575,9 @@ namespace Isis { if (filename.compare("") != 0) { if (p_BatchlistPass == 0) { - ofstream debugingLog(filename.c_str()); + ofstream debugingLog(filename.toAscii().data()); if (!debugingLog.good()) { - string msg = "Error opening debugging log file [" + filename + "]"; + QString msg = "Error opening debugging log file [" + filename + "]"; throw IException(IException::Io, msg, _FILEINFO_); } debugingLog << log << endl; @@ -586,7 +590,7 @@ namespace Isis { debugingLog.close(); } else { - ofstream debugingLog(filename.c_str(), ios_base::app); + ofstream debugingLog(filename.toAscii().data(), ios_base::app); debugingLog << SessionLog::TheLog() << endl; debugingLog.close(); } @@ -639,9 +643,9 @@ namespace Isis { // If debugging flag on write debugging log if (p_ui->GetInfoFlag()) { - string filename = p_ui->GetInfoFileName(); + QString filename = p_ui->GetInfoFileName(); Pvl log; - IString app = (IString)QCoreApplication::applicationDirPath() + "/" + p_appName; + QString app = (QString)QCoreApplication::applicationDirPath() + "/" + p_appName; if (p_BatchlistPass == 0) { stringstream ss ; ss << SessionLog::TheLog(); @@ -656,9 +660,9 @@ namespace Isis { // Write to file if (filename.compare("") != 0) { if (p_BatchlistPass == 0) { - ofstream debugingLog(filename.c_str()); + ofstream debugingLog(filename.toAscii().data()); if (!debugingLog.good()) { - string msg = "Error opening debugging log file [" + filename + "]"; + QString msg = "Error opening debugging log file [" + filename + "]"; throw IException(IException::Io, msg, _FILEINFO_); } debugingLog << log << endl; @@ -671,7 +675,7 @@ namespace Isis { debugingLog.close(); } else { - ofstream debugingLog(filename.c_str(), ios_base::app); + ofstream debugingLog(filename.toAscii().data(), ios_base::app); debugingLog << SessionLog::TheLog() << endl; debugingLog.close(); } @@ -702,7 +706,7 @@ namespace Isis { * @param e The Isis::iException */ void Application::GuiReportError(IException &e) { - IString errorMessage = e.toString(); + QString errorMessage = e.toString(); if (errorMessage == "") { p_ui->TheGui()->ProgressText("Stopped"); } @@ -715,14 +719,14 @@ namespace Isis { exit(0); } - IString Application::p_appName("Unknown"); //!< + QString Application::p_appName("Unknown"); //!< /** * Returns the name of the application. Returns 'Unknown' if the application * or gui equal NULL * - * @return string The application name + * @return QString The application name */ - IString Application::Name() { + QString Application::Name() { return p_appName; } @@ -733,15 +737,15 @@ namespace Isis { * * @param print */ - void Application::UpdateProgress(const string &text, bool print) { + void Application::UpdateProgress(const QString &text, bool print) { if (HasParent() && print) { - iApp->SendParentData(string("PROGRESSTEXT"), text); + iApp->SendParentData(QString("PROGRESSTEXT"), text); } else if (p_ui->IsInteractive()) { p_ui->TheGui()->ProgressText(text); } else if (print) { - string msg = p_ui->ProgramName() + ": " + text; + QString msg = p_ui->ProgramName() + ": " + text; cout << msg << endl; } @@ -757,8 +761,8 @@ namespace Isis { */ void Application::UpdateProgress(int percent, bool print) { if (HasParent() && print) { - string data = IString(percent); - iApp->SendParentData(string("PROGRESS"), data); + QString data = toString(percent); + iApp->SendParentData(QString("PROGRESS"), data); } else if (p_ui->IsInteractive()) { p_ui->TheGui()->Progress(percent); @@ -789,45 +793,45 @@ namespace Isis { /** - * Returns the date and time as a string. + * Returns the date and time as a QString. * * @param *curtime * - * @return string The date and time + * @return QString The date and time */ - IString Application::DateTime(time_t *curtime) { + QString Application::DateTime(time_t *curtime) { time_t startTime = time(NULL); if (curtime != 0) *curtime = startTime; struct tm *tmbuf = localtime(&startTime); char timestr[80]; strftime(timestr, 80, "%Y-%m-%dT%H:%M:%S", tmbuf); - return(string) timestr; + return(QString) timestr; } /** * Returns the user name. Returns 'Unknown' if it cannot find the user name. * - * @return string User Name + * @return QString User Name */ - IString Application::UserName() { + QString Application::UserName() { return userName(); } /** * Returns the host name. Returns 'Unknown' if it cannot find the host name. * - * @return string Host Name + * @return QString Host Name */ - IString Application::HostName() { + QString Application::HostName() { return hostName(); } /** * The Isis Version for this application. - * @return @b IString + * @return @b QString * */ - IString Application::Version() { + QString Application::Version() { return isisVersion(); } @@ -840,7 +844,7 @@ namespace Isis { PvlGroup Application::GetUnameInfo() { // Create a temporary file to store console output to FileName temp = FileName::createTempFile("$temporary/UnameConsoleInfo.txt"); - IString tempFile = temp.expanded(); + QString tempFile = temp.expanded(); // Uname commands output to temp file with each of the following // values on its own line in this order: @@ -861,7 +865,7 @@ namespace Isis { ProgramLauncher::RunSystemCommand("uname -a > " + tempFile); // Read data from temp file char value[256]; - readTemp.open(tempFile.c_str(), ifstream::in); + readTemp.open(tempFile.toAscii().data(), ifstream::in); readTemp.getline(value, 256); unameGroup.AddKeyword(PvlKeyword("MachineHardware", value)); readTemp.getline(value, 256); @@ -906,7 +910,7 @@ namespace Isis { #endif // remove temp file and return - remove(tempFile.c_str()); + remove(tempFile.toAscii().data()); return unameGroup; } @@ -920,15 +924,15 @@ namespace Isis { PvlGroup Application::GetEnviromentInfo() { // Create a temporary file to store console output to FileName temp = FileName::createTempFile("$temporary/EnviromentInfo.txt"); - IString tempFile = temp.expanded(); + QString tempFile = temp.expanded(); PvlGroup envGroup("EnviromentVariables"); ifstream readTemp; - string env1 = "printenv SHELL >| " + tempFile; - string env2 = "printenv HOME >> " + tempFile; - string env3 = "printenv PWD >> " + tempFile; - string env5 = "printenv ISISROOT >> " + tempFile; - string env6 = "printenv ISIS3DATA >> " + tempFile; + QString env1 = "printenv SHELL >| " + tempFile; + QString env2 = "printenv HOME >> " + tempFile; + QString env3 = "printenv PWD >> " + tempFile; + QString env5 = "printenv ISISROOT >> " + tempFile; + QString env6 = "printenv ISIS3DATA >> " + tempFile; ProgramLauncher::RunSystemCommand(env1); ProgramLauncher::RunSystemCommand(env2); ProgramLauncher::RunSystemCommand(env3); @@ -936,7 +940,7 @@ namespace Isis { ProgramLauncher::RunSystemCommand(env6); // Read data from temp file char value[511]; - readTemp.open(tempFile.c_str(), ifstream::in); + readTemp.open(tempFile.toAscii().data(), ifstream::in); readTemp.getline(value, 255); envGroup.AddKeyword(PvlKeyword("Shell", value)); readTemp.getline(value, 255); @@ -949,7 +953,7 @@ namespace Isis { envGroup.AddKeyword(PvlKeyword("ISIS3DATA", value)); // remove temp file and return - IString cleanup = "rm -f " + tempFile; + QString cleanup = "rm -f " + tempFile; ProgramLauncher::RunSystemCommand(cleanup); return envGroup; } @@ -957,17 +961,17 @@ namespace Isis { /** * Runs df to see the disk space availability * - * @return IString containing df results + * @return QString containing df results */ - IString Application::GetSystemDiskSpace() { + QString Application::GetSystemDiskSpace() { FileName temp = FileName::createTempFile("$temporary/SystemDiskSpace.txt"); - IString tempFile = temp.expanded(); + QString tempFile = temp.expanded(); ifstream readTemp; - string diskspace = "df >| " + tempFile; + QString diskspace = "df >| " + tempFile; ProgramLauncher::RunSystemCommand(diskspace); - readTemp.open(tempFile.c_str(), ifstream::in); + readTemp.open(tempFile.toAscii().data(), ifstream::in); - IString results = ""; + QString results = ""; char tmp[512]; while (!readTemp.eof()) { readTemp.getline(tmp, 512); @@ -976,7 +980,7 @@ namespace Isis { } // remove temp file and return - IString cleanup = "rm -f " + tempFile; + QString cleanup = "rm -f " + tempFile; ProgramLauncher::RunSystemCommand(cleanup); return results; } @@ -984,13 +988,13 @@ namespace Isis { /** * Runs ldd on linux and sun and otool on macs to get information about the applicaiton run * - * @return IString containing application information + * @return QString containing application information */ - IString Application::GetLibraryDependencies(IString file) { + QString Application::GetLibraryDependencies(QString file) { FileName temp = FileName::createTempFile("$temporary/LibraryDependencies.txt"); - IString tempFile = temp.expanded(); + QString tempFile = temp.expanded(); ifstream readTemp; - string dependencies = ""; + QString dependencies = ""; #if defined(__linux__) dependencies = "ldd -v " + file + " >| " + tempFile; #elif defined(__APPLE__) @@ -999,9 +1003,9 @@ namespace Isis { dependencies = "ldd -v " + file + " >| " + tempFile; #endif ProgramLauncher::RunSystemCommand(dependencies); - readTemp.open(tempFile.c_str(), ifstream::in); + readTemp.open(tempFile.toAscii().data(), ifstream::in); - IString results = ""; + QString results = ""; char tmp[512]; while (!readTemp.eof()) { readTemp.getline(tmp, 512); @@ -1010,7 +1014,7 @@ namespace Isis { } // remove temp file and return - IString cleanup = "rm -f " + tempFile; + QString cleanup = "rm -f " + tempFile; ProgramLauncher::RunSystemCommand(cleanup); return results; } diff --git a/isis/src/base/objs/Application/Application.h b/isis/src/base/objs/Application/Application.h index a45a7de59a..420dec9662 100644 --- a/isis/src/base/objs/Application/Application.h +++ b/isis/src/base/objs/Application/Application.h @@ -1,4 +1,4 @@ -#if !defined(Application_h) +#ifndef Application_h #define Application_h /** @@ -114,31 +114,31 @@ namespace Isis { static UserInterface &GetUserInterface(); static void Log(PvlGroup &results); - static void GuiLog(Pvl &results); - static void GuiLog(PvlGroup &results); - static void GuiLog(std::string &results); - static IString Name(); + static void GuiLog(const Pvl &results); + static void GuiLog(const PvlGroup &results); + static void GuiLog(const QString &results); + static QString Name(); /** * @param helpers */ - void RegisterGuiHelpers(std::map helpers) { + void RegisterGuiHelpers(std::map helpers) { p_guiHelpers = helpers; }; /** * @param helper */ - void *GetGuiHelper(std::string helper) { + void *GetGuiHelper(QString helper) { return p_guiHelpers[helper]; }; void GuiReportError(IException &e); - static IString UserName(); - static IString HostName(); - static IString DateTime(time_t *curtime = 0); - static IString Version(); + static QString UserName(); + static QString HostName(); + static QString DateTime(time_t *curtime = 0); + static QString Version(); static bool HasParent(); @@ -151,7 +151,7 @@ namespace Isis { QLocalSocket *p_connectionToParent; //!< time_t p_startTime; //!< clock_t p_startClock; //!< - std::string p_datetime; //!< + QString p_datetime; //!< int p_startDirectIO; //!< int p_startPageFaults; //!< int p_startProcessSwaps; //!< @@ -160,13 +160,13 @@ namespace Isis { UserInterface *p_ui; //!< Pointer to a User Interface object - void SendParentData(std::string, const std::string &); - void SendParentErrors(Isis::PvlObject &errors); + void SendParentData(QString, const QString &); + void SendParentErrors(PvlObject &errors); - static Isis::PvlGroup GetUnameInfo(); - static Isis::PvlGroup GetEnviromentInfo(); - static Isis::IString GetSystemDiskSpace(); - static Isis::IString GetLibraryDependencies(IString file); + static PvlGroup GetUnameInfo(); + static PvlGroup GetEnviromentInfo(); + static QString GetSystemDiskSpace(); + static QString GetLibraryDependencies(QString file); friend class Gui; void FunctionCleanup(); @@ -174,7 +174,7 @@ namespace Isis { friend class Progress; friend class ProgramLauncher; - void UpdateProgress(const std::string &text, bool print); + void UpdateProgress(const QString &text, bool print); void UpdateProgress(int percent, bool print); void ProcessGuiEvents(); @@ -188,8 +188,8 @@ namespace Isis { void WaitForCommand(int childSocket); pid_t p_pid; //!< - std::map p_guiHelpers; //!< - static IString p_appName; //!< + std::map p_guiHelpers; //!< + static QString p_appName; //!< }; extern Application *iApp; diff --git a/isis/src/base/objs/Application/Application.truth b/isis/src/base/objs/Application/Application.truth index bc36ccaa5e..4e0c40a760 100644 --- a/isis/src/base/objs/Application/Application.truth +++ b/isis/src/base/objs/Application/Application.truth @@ -27,7 +27,7 @@ End_Object Can't test Gui methods GuiLog(Pvl &results) GuiLog(PvlGroup &results) - GuiLog(std::string &results) + GuiLog(QString &results) GuiReportErrorLog(iException &e) GuiHelpers ok diff --git a/isis/src/base/objs/Application/unitTest.cpp b/isis/src/base/objs/Application/unitTest.cpp index 3ad426aa9f..6d75b8ea91 100644 --- a/isis/src/base/objs/Application/unitTest.cpp +++ b/isis/src/base/objs/Application/unitTest.cpp @@ -12,7 +12,7 @@ void myFunct() { } void myError() { - std::string msg = "testing an error"; + QString msg = "testing an error"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } @@ -35,11 +35,11 @@ int main(int argc, char *argv[]) { std::cout << "Can't test Gui methods" << std::endl; std::cout << " GuiLog(Pvl &results)" << std::endl; std::cout << " GuiLog(PvlGroup &results)" << std::endl; - std::cout << " GuiLog(std::string &results)" << std::endl; + std::cout << " GuiLog(QString &results)" << std::endl; std::cout << " GuiReportErrorLog(iException &e)" << std::endl; std::cout << std::endl; - std::map helpers; + std::map helpers; helpers["helper"] = (void *) myFunct; a.RegisterGuiHelpers(helpers); if (a.GetGuiHelper("helper") == (void *) myFunct) { diff --git a/isis/src/base/objs/Area3D/Area3D.cpp b/isis/src/base/objs/Area3D/Area3D.cpp index 587e39640a..0b438e70ba 100644 --- a/isis/src/base/objs/Area3D/Area3D.cpp +++ b/isis/src/base/objs/Area3D/Area3D.cpp @@ -25,6 +25,8 @@ #include +#include + #include "Displacement.h" #include "Distance.h" #include "IException.h" @@ -608,23 +610,23 @@ namespace Isis { } else { if(startXValid && endXValid && startX > endX) { - IString msg = "Cannot have a 3D area with inverted X coordinates of [" - + IString(startX.meters()) + " meters] to [" - + IString(endX.meters()) + " meters]"; + QString msg = QObject::tr("Cannot have a 3D area with inverted X coordinates of " + "[%1 meters] to [%2 meters]") + .arg(startX.meters()).arg(endX.meters()); throw IException(IException::Programmer, msg, _FILEINFO_); } if(startYValid && endYValid && startY > endY) { - IString msg = "Cannot have a 3D area with inverted Y coordinates of [" - + IString(startY.meters()) + " meters] to [" - + IString(endY.meters()) + " meters]"; + QString msg = QObject::tr("Cannot have a 3D area with inverted Y coordinates of " + "[%1 meters] to [%2 meters]") + .arg(startY.meters()).arg(endY.meters()); throw IException(IException::Programmer, msg, _FILEINFO_); } if(startZValid && endZValid && startZ > endZ) { - IString msg = "Cannot have a 3D area with inverted Z coordinates of [" - + IString(startZ.meters()) + " meters] to [" - + IString(endZ.meters()) + " meters]"; + QString msg = QObject::tr("Cannot have a 3D area with inverted Z coordinates of " + "[%1 meters] to [%2 meters]") + .arg(startZ.meters()).arg(endZ.meters()); throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Area3D/Area3D.truth b/isis/src/base/objs/Area3D/Area3D.truth index c7b5f4e6c5..a8c198f6e9 100644 --- a/isis/src/base/objs/Area3D/Area3D.truth +++ b/isis/src/base/objs/Area3D/Area3D.truth @@ -76,6 +76,6 @@ Area3D 1 = Area3D 2... Area3D 1 = -1.7976931348623e+308,0,-1.7976931348623e+308 ----- Testing Error Checking ----- -**PROGRAMMER ERROR** Cannot have a 3D area with inverted X coordinates of [1.0 meters] to [0.0 meters]. -**PROGRAMMER ERROR** Cannot have a 3D area with inverted Y coordinates of [1.0 meters] to [0.0 meters]. -**PROGRAMMER ERROR** Cannot have a 3D area with inverted Z coordinates of [1.0 meters] to [0.0 meters]. +**PROGRAMMER ERROR** Cannot have a 3D area with inverted X coordinates of [1 meters] to [0 meters]. +**PROGRAMMER ERROR** Cannot have a 3D area with inverted Y coordinates of [1 meters] to [0 meters]. +**PROGRAMMER ERROR** Cannot have a 3D area with inverted Z coordinates of [1 meters] to [0 meters]. diff --git a/isis/src/base/objs/AtmosModel/AtmosModel.cpp b/isis/src/base/objs/AtmosModel/AtmosModel.cpp index a2fab0f838..e14185b534 100644 --- a/isis/src/base/objs/AtmosModel/AtmosModel.cpp +++ b/isis/src/base/objs/AtmosModel/AtmosModel.cpp @@ -68,7 +68,7 @@ namespace Isis { PvlGroup &algorithm = pvl.FindObject("AtmosphericModel").FindGroup("Algorithm", Pvl::Traverse); if(algorithm.HasKeyword("Nulneg")) { - SetAtmosNulneg(((string)algorithm["Nulneg"]).compare("YES") == 0); + SetAtmosNulneg(algorithm["Nulneg"][0] == "YES"); } else { p_atmosNulneg = false; @@ -111,14 +111,14 @@ namespace Isis { } if(algorithm.HasKeyword("Iord")) { - SetAtmosIord(((string)algorithm["Iord"]).compare("YES") == 0); + SetAtmosIord(algorithm["Iord"][0] == "YES"); } else { p_atmosAddOffset = false; } if(algorithm.HasKeyword("EstTau")) { - SetAtmosEstTau(((string)algorithm["EstTau"]).compare("YES") == 0); + SetAtmosEstTau(algorithm["EstTau"][0] == "YES"); } else { p_atmosEstTau = false; @@ -961,7 +961,7 @@ namespace Isis { */ void AtmosModel::SetAtmosHnorm(const double hnorm) { if(hnorm < 0.0) { - std::string msg = "Invalid value of Atmospheric hnorm [" + IString(hnorm) + "]"; + QString msg = "Invalid value of Atmospheric hnorm [" + toString(hnorm) + "]"; throw IException(IException::User, msg, _FILEINFO_); } p_atmosHnorm = hnorm; diff --git a/isis/src/base/objs/AtmosModelFactory/AtmosModelFactory.cpp b/isis/src/base/objs/AtmosModelFactory/AtmosModelFactory.cpp index 9e4d755195..5a36a0945d 100644 --- a/isis/src/base/objs/AtmosModelFactory/AtmosModelFactory.cpp +++ b/isis/src/base/objs/AtmosModelFactory/AtmosModelFactory.cpp @@ -63,15 +63,15 @@ namespace Isis { PvlGroup &algo = pvl.FindObject("AtmosphericModel") .FindGroup("Algorithm", Pvl::Traverse); - std::string algorithm = ""; + QString algorithm = ""; if(algo.HasKeyword("AtmName")) { - algorithm = std::string(algo["AtmName"]); + algorithm = QString(algo["AtmName"]); } else if(algo.HasKeyword("Name")) { - algorithm = std::string(algo["Name"]); + algorithm = QString(algo["Name"]); } else { - IString msg = "Keyword [Name] or keyword [AtmName] must "; + QString msg = "Keyword [Name] or keyword [AtmName] must "; msg += "exist in [Group = Algorithm]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/AutoReg/AutoReg.cpp b/isis/src/base/objs/AutoReg/AutoReg.cpp index 63e0cb3bf6..4e8f1cfe4d 100644 --- a/isis/src/base/objs/AutoReg/AutoReg.cpp +++ b/isis/src/base/objs/AutoReg/AutoReg.cpp @@ -210,11 +210,11 @@ namespace Isis { PvlGroup &algo = pvl.FindGroup("Algorithm", Pvl::Traverse); SetTolerance(algo["Tolerance"]); if(algo.HasKeyword("ChipInterpolator")) { - SetChipInterpolator((string)algo["ChipInterpolator"]); + SetChipInterpolator((QString)algo["ChipInterpolator"]); } if(algo.HasKeyword("SubpixelAccuracy")) { - SetSubPixelAccuracy((string)algo["SubpixelAccuracy"] == "True"); + SetSubPixelAccuracy((QString)algo["SubpixelAccuracy"] == "True"); } if(algo.HasKeyword("ReductionFactor")) { @@ -222,7 +222,7 @@ namespace Isis { } if (algo.HasKeyword("Gradient")) { - SetGradientFilterType((string)algo["Gradient"]); + SetGradientFilterType((QString)algo["Gradient"]); } // Setup the pattern chip @@ -270,7 +270,7 @@ namespace Isis { } catch(IException &e) { - string msg = "Improper format for AutoReg PVL [" + pvl.FileName() + "]"; + QString msg = "Improper format for AutoReg PVL [" + pvl.FileName() + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } return; @@ -283,7 +283,7 @@ namespace Isis { * @param gradientFilterType the gradient filter type to use * @throw iException::User - "Invalid Gradient type." */ - void AutoReg::SetGradientFilterType(const IString& gradientFilterType) { + void AutoReg::SetGradientFilterType(const QString &gradientFilterType) { if (gradientFilterType == "None") { p_gradientFilterType = None; } @@ -299,7 +299,7 @@ namespace Isis { } - IString AutoReg::GradientFilterString() const { + QString AutoReg::GradientFilterString() const { switch (p_gradientFilterType) { case None: return "None"; case Sobel: return "Sobel"; @@ -450,7 +450,7 @@ namespace Isis { * @internal * @history 2010-06-15 Jeannie Walldren - Original version. */ - void AutoReg::SetChipInterpolator(const IString& interpolator) { + void AutoReg::SetChipInterpolator(const QString &interpolator) { Isis::Interpolator::interpType itype; if(interpolator == "NearestNeighborType") { @@ -1180,30 +1180,30 @@ namespace Isis { Pvl AutoReg::RegistrationStatistics() { Pvl pvl; PvlGroup stats("AutoRegStatistics"); - stats += Isis::PvlKeyword("Total", p_totalRegistrations); - stats += Isis::PvlKeyword("Successful", p_pixelSuccesses + p_subpixelSuccesses); - stats += Isis::PvlKeyword("Failure", p_totalRegistrations - (p_pixelSuccesses + p_subpixelSuccesses)); + stats += Isis::PvlKeyword("Total", toString(p_totalRegistrations)); + stats += Isis::PvlKeyword("Successful", toString(p_pixelSuccesses + p_subpixelSuccesses)); + stats += Isis::PvlKeyword("Failure", toString(p_totalRegistrations - (p_pixelSuccesses + p_subpixelSuccesses))); pvl.AddGroup(stats); PvlGroup successes("Successes"); - successes += PvlKeyword("SuccessPixel", p_pixelSuccesses); - successes += PvlKeyword("SuccessSubPixel", p_subpixelSuccesses); + successes += PvlKeyword("SuccessPixel", toString(p_pixelSuccesses)); + successes += PvlKeyword("SuccessSubPixel", toString(p_subpixelSuccesses)); pvl.AddGroup(successes); PvlGroup grp("PatternChipFailures"); - grp += PvlKeyword("PatternNotEnoughValidData", p_patternChipNotEnoughValidDataCount); - grp += PvlKeyword("PatternZScoreNotMet", p_patternZScoreNotMetCount); + grp += PvlKeyword("PatternNotEnoughValidData", toString(p_patternChipNotEnoughValidDataCount)); + grp += PvlKeyword("PatternZScoreNotMet", toString(p_patternZScoreNotMetCount)); pvl.AddGroup(grp); PvlGroup fit("FitChipFailures"); - fit += PvlKeyword("FitChipNoData", p_fitChipNoDataCount); - fit += PvlKeyword("FitChipToleranceNotMet", p_fitChipToleranceNotMetCount); + fit += PvlKeyword("FitChipNoData", toString(p_fitChipNoDataCount)); + fit += PvlKeyword("FitChipToleranceNotMet", toString(p_fitChipToleranceNotMetCount)); pvl.AddGroup(fit); PvlGroup model("SurfaceModelFailures"); - model += PvlKeyword("SurfaceModelNotEnoughValidData", p_surfaceModelNotEnoughValidDataCount); - model += PvlKeyword("SurfaceModelSolutionInvalid", p_surfaceModelSolutionInvalidCount); - model += PvlKeyword("SurfaceModelDistanceInvalid", p_surfaceModelDistanceInvalidCount); + model += PvlKeyword("SurfaceModelNotEnoughValidData", toString(p_surfaceModelNotEnoughValidDataCount)); + model += PvlKeyword("SurfaceModelSolutionInvalid", toString(p_surfaceModelSolutionInvalidCount)); + model += PvlKeyword("SurfaceModelDistanceInvalid", toString(p_surfaceModelDistanceInvalidCount)); pvl.AddGroup(model); return (AlgorithmStatistics(pvl)); @@ -1293,28 +1293,28 @@ namespace Isis { PvlGroup reg("AutoRegistration"); reg += PvlKeyword("Algorithm", AlgorithmName()); - reg += PvlKeyword("Tolerance", Tolerance()); + reg += PvlKeyword("Tolerance", toString(Tolerance())); reg += PvlKeyword("SubpixelAccuracy", SubPixelAccuracy() ? "True" : "False"); - reg += PvlKeyword("ReductionFactor", ReductionFactor()); + reg += PvlKeyword("ReductionFactor", toString(ReductionFactor())); reg += PvlKeyword("Gradient", GradientFilterString()); Chip *pattern = PatternChip(); - reg += PvlKeyword("PatternSamples", pattern->Samples()); - reg += PvlKeyword("PatternLines", pattern->Lines()); - reg += PvlKeyword("MinimumZScore", MinimumZScore()); - reg += PvlKeyword("ValidPercent", PatternValidPercent()); + reg += PvlKeyword("PatternSamples", toString(pattern->Samples())); + reg += PvlKeyword("PatternLines", toString(pattern->Lines())); + reg += PvlKeyword("MinimumZScore", toString(MinimumZScore())); + reg += PvlKeyword("ValidPercent", toString(PatternValidPercent())); // TODO Chip needs accessors to valid minimum and maximum Chip *search = SearchChip(); - reg += PvlKeyword("SearchSamples", search->Samples()); - reg += PvlKeyword("SearchLines", search->Lines()); - reg += PvlKeyword("SubchipValidPercent", SubsearchValidPercent()); + reg += PvlKeyword("SearchSamples", toString(search->Samples())); + reg += PvlKeyword("SearchLines", toString(search->Lines())); + reg += PvlKeyword("SubchipValidPercent", toString(SubsearchValidPercent())); // TODO Chip needs accessors to valid minimum and maximum if (SubPixelAccuracy()) { - reg += PvlKeyword("DistanceTolerance", DistanceTolerance()); - reg += PvlKeyword("WindowSize", WindowSize()); + reg += PvlKeyword("DistanceTolerance", toString(DistanceTolerance())); + reg += PvlKeyword("WindowSize", toString(WindowSize())); } return reg; diff --git a/isis/src/base/objs/AutoReg/AutoReg.h b/isis/src/base/objs/AutoReg/AutoReg.h index 0e9b5426b0..bbe392371a 100644 --- a/isis/src/base/objs/AutoReg/AutoReg.h +++ b/isis/src/base/objs/AutoReg/AutoReg.h @@ -28,11 +28,12 @@ #include "Chip.h" #include "Statistics.h" + +class QString; namespace Isis { class AutoRegItem; class Buffer; - class IString; class Pvl; /** @@ -261,14 +262,14 @@ namespace Isis { void SetPatternValidPercent(const double percent); void SetSubsearchValidPercent(const double percent); void SetTolerance(double tolerance); - void SetChipInterpolator(const IString& interpolator); + void SetChipInterpolator(const QString &interpolator); void SetSurfaceModelWindowSize(int size); void SetSurfaceModelDistanceTolerance(double distance); void SetReductionFactor(int reductionFactor); void SetPatternZScoreMinimum(double minimum); - void SetGradientFilterType(const IString& gradientFilterType); + void SetGradientFilterType(const QString &gradientFilterType); - IString GradientFilterString() const; + QString GradientFilterString() const; /** * Return whether this object will attempt to register to whole or @@ -384,9 +385,9 @@ namespace Isis { * Returns the name of the algorithm. * * - * @return IString + * @return QString */ - virtual IString AlgorithmName() const = 0; + virtual QString AlgorithmName() const = 0; PvlGroup RegTemplate(); diff --git a/isis/src/base/objs/AutoReg/unitTest.cpp b/isis/src/base/objs/AutoReg/unitTest.cpp index 6815952a56..7d5a861bd0 100644 --- a/isis/src/base/objs/AutoReg/unitTest.cpp +++ b/isis/src/base/objs/AutoReg/unitTest.cpp @@ -52,7 +52,7 @@ int main() { cout << "-----------------------------------" << endl; cout << "Test for missing PatternChip Group" << endl; cout << "-----------------------------------" << endl; - mg += Isis::PvlKeyword("Tolerance", 0.3); + mg += Isis::PvlKeyword("Tolerance", "0.3"); Doit(obj); cout << endl; @@ -74,8 +74,8 @@ int main() { obj.AddGroup(Isis::PvlGroup("PatternChip")); Isis::PvlGroup &pc = obj.FindGroup("PatternChip"); - pc += Isis::PvlKeyword("Lines", 90); - pc += Isis::PvlKeyword("Samples", 90); + pc += Isis::PvlKeyword("Lines", "90"); + pc += Isis::PvlKeyword("Samples", "90"); cout << "-------------------------------" << endl; cout << "Test for missing Lines Keyword" << endl; @@ -87,7 +87,7 @@ int main() { cout << "---------------------------------" << endl; cout << "Test for missing Samples Keyword" << endl; cout << "---------------------------------" << endl; - pc += Isis::PvlKeyword("Lines", 90); + pc += Isis::PvlKeyword("Lines", "90"); pc.DeleteKeyword("Samples"); Doit(obj); cout << endl; @@ -95,30 +95,30 @@ int main() { cout << "---------------------------------" << endl; cout << "Test for invalid Lines Keyword" << endl; cout << "---------------------------------" << endl; - pc += Isis::PvlKeyword("Samples", 90); - pc["Lines"] = -90; + pc += Isis::PvlKeyword("Samples", "90"); + pc["Lines"] = "-90"; Doit(obj); cout << endl; cout << "---------------------------------" << endl; cout << "Test for invalid Samples Keyword" << endl; cout << "---------------------------------" << endl; - pc["Lines"] = 90; - pc["Samples"] = -90; + pc["Lines"] = "90"; + pc["Samples"] = "-90"; Doit(obj); cout << endl; cout << "----------------------------------" << endl; cout << "Test for missing SearchChip group" << endl; cout << "----------------------------------" << endl; - pc["Samples"] = 90; + pc["Samples"] = "90"; Doit(obj); cout << endl; obj.AddGroup(Isis::PvlGroup("SearchChip")); Isis::PvlGroup &sc = obj.FindGroup("SearchChip"); - sc += Isis::PvlKeyword("Lines", 150); - sc += Isis::PvlKeyword("Samples", 150); + sc += Isis::PvlKeyword("Lines", "150"); + sc += Isis::PvlKeyword("Samples", "150"); cout << "-------------------------------" << endl; cout << "Test for missing Lines Keyword" << endl; @@ -130,12 +130,12 @@ int main() { cout << "---------------------------------" << endl; cout << "Test for missing Samples Keyword" << endl; cout << "---------------------------------" << endl; - sc += Isis::PvlKeyword("Lines", 150); + sc += Isis::PvlKeyword("Lines", "150"); sc.DeleteKeyword("Samples"); Doit(obj); cout << endl; - sc += Isis::PvlKeyword("Samples", 150); + sc += Isis::PvlKeyword("Samples", "150"); Doit(obj); cout << endl; diff --git a/isis/src/base/objs/AutoRegFactory/AutoRegFactory.cpp b/isis/src/base/objs/AutoRegFactory/AutoRegFactory.cpp index d278ec5ae8..bbb52b8386 100644 --- a/isis/src/base/objs/AutoRegFactory/AutoRegFactory.cpp +++ b/isis/src/base/objs/AutoRegFactory/AutoRegFactory.cpp @@ -61,7 +61,7 @@ namespace Isis { AutoReg *AutoRegFactory::Create(Pvl &pvl) { // Get the algorithm name to create PvlGroup &algo = pvl.FindGroup("Algorithm", Pvl::Traverse); - std::string algorithm = algo["Name"]; + QString algorithm = algo["Name"]; // Open the factory plugin file Plugin p; diff --git a/isis/src/base/objs/BandManager/unitTest.cpp b/isis/src/base/objs/BandManager/unitTest.cpp index fd19af4721..e8bda85a07 100644 --- a/isis/src/base/objs/BandManager/unitTest.cpp +++ b/isis/src/base/objs/BandManager/unitTest.cpp @@ -1,19 +1,20 @@ - #include #include #include -#include "Preference.h" -#include "IException.h" -#include "Cube.h" #include "BandManager.h" +#include "Cube.h" +#include "IException.h" +#include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); - string fname = "$base/testData/isisTruth.cub"; + QString fname = "$base/testData/isisTruth.cub"; Isis::Cube cube; cube.open(fname); diff --git a/isis/src/base/objs/Basis1VariableFunction/Basis1VariableFunction.cpp b/isis/src/base/objs/Basis1VariableFunction/Basis1VariableFunction.cpp index d675197396..c5759fefd4 100644 --- a/isis/src/base/objs/Basis1VariableFunction/Basis1VariableFunction.cpp +++ b/isis/src/base/objs/Basis1VariableFunction/Basis1VariableFunction.cpp @@ -38,7 +38,7 @@ namespace Isis { * @f] * has three coefficients: C1, C2 & C3. */ - Basis1VariableFunction::Basis1VariableFunction(const std::string &name, int numCoefs) : + Basis1VariableFunction::Basis1VariableFunction(const QString &name, int numCoefs) : Isis::BasisFunction(name, 1, numCoefs) { } diff --git a/isis/src/base/objs/Basis1VariableFunction/Basis1VariableFunction.h b/isis/src/base/objs/Basis1VariableFunction/Basis1VariableFunction.h index a026c618b3..92a5e5f6e0 100644 --- a/isis/src/base/objs/Basis1VariableFunction/Basis1VariableFunction.h +++ b/isis/src/base/objs/Basis1VariableFunction/Basis1VariableFunction.h @@ -26,6 +26,8 @@ #include #include +#include + #include "BasisFunction.h" namespace Isis { @@ -62,7 +64,7 @@ namespace Isis { */ class Basis1VariableFunction : public Isis::BasisFunction { public: - Basis1VariableFunction(const std::string &name, int numCoefs); + Basis1VariableFunction(const QString &name, int numCoefs); //! Destroys the Basis1VariableFunction object. virtual ~Basis1VariableFunction() {}; diff --git a/isis/src/base/objs/BasisFunction/BasisFunction.cpp b/isis/src/base/objs/BasisFunction/BasisFunction.cpp index 23da324f3c..121064a9d4 100644 --- a/isis/src/base/objs/BasisFunction/BasisFunction.cpp +++ b/isis/src/base/objs/BasisFunction/BasisFunction.cpp @@ -42,7 +42,7 @@ namespace Isis { * @f] * has three coefficients: C1, C2 & C3. */ - BasisFunction::BasisFunction(const std::string &name, int numVars, int numCoefs) { + BasisFunction::BasisFunction(const QString &name, int numVars, int numCoefs) { p_name = name; p_numVars = numVars; p_numCoefs = numCoefs; @@ -55,7 +55,7 @@ namespace Isis { */ void BasisFunction::SetCoefficients(const std::vector &coefs) { if((int)coefs.size() != p_numCoefs) { - IString msg = "[coefs] does not match number of coefficients "; + QString msg = "[coefs] does not match number of coefficients "; msg += "in the basis equation"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -73,14 +73,14 @@ namespace Isis { */ double BasisFunction::Evaluate(const std::vector &vars) { if((int)vars.size() != p_numVars) { - std::string msg = "[vars] does not match the number of variables "; + QString msg = "[vars] does not match the number of variables "; msg += "in the basis equation"; throw IException(IException::Programmer, msg, _FILEINFO_); } Expand(vars); if((int)p_terms.size() != p_numCoefs) { - std::string msg = "Expansion of [terms] does not match number of "; + QString msg = "Expansion of [terms] does not match number of "; msg += "coefficients in the basis equation"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/BasisFunction/BasisFunction.h b/isis/src/base/objs/BasisFunction/BasisFunction.h index d62d934589..8ed79828d1 100644 --- a/isis/src/base/objs/BasisFunction/BasisFunction.h +++ b/isis/src/base/objs/BasisFunction/BasisFunction.h @@ -26,6 +26,8 @@ #include #include +#include + namespace Isis { /** * @brief Generic linear equation class @@ -58,7 +60,7 @@ namespace Isis { */ class BasisFunction { public: - BasisFunction(const std::string &name, int numVars, int numCoefs); + BasisFunction(const QString &name, int numVars, int numCoefs); //! Destroys the BasisFunction object. virtual ~BasisFunction() {}; @@ -87,7 +89,7 @@ namespace Isis { * * @return The name of the equation. */ - std::string Name() const { + QString Name() const { return p_name; }; /** @@ -120,7 +122,7 @@ namespace Isis { protected: //! The name of the equation. Call it by using Name() - std::string p_name; + QString p_name; //! The number of variables in the equation. Call it by using Variables() int p_numVars; /** The number of coefficients in the equation. Call it by using diff --git a/isis/src/base/objs/BasisFunction/unitTest.cpp b/isis/src/base/objs/BasisFunction/unitTest.cpp index d8766b0007..024baa231d 100644 --- a/isis/src/base/objs/BasisFunction/unitTest.cpp +++ b/isis/src/base/objs/BasisFunction/unitTest.cpp @@ -2,11 +2,12 @@ #include "Preference.h" #include +using namespace Isis; using namespace std; int main() { - Isis::Preference::Preferences(true); - Isis::BasisFunction b("Basis", 2, 2); + Preference::Preferences(true); + BasisFunction b("Basis", 2, 2); vector coefs; coefs.push_back(0.5); coefs.push_back(-0.5); diff --git a/isis/src/base/objs/Blob/Blob.cpp b/isis/src/base/objs/Blob/Blob.cpp index 3f43e59e73..d07002420d 100644 --- a/isis/src/base/objs/Blob/Blob.cpp +++ b/isis/src/base/objs/Blob/Blob.cpp @@ -26,6 +26,8 @@ #include #include +#include + #include "FileName.h" #include "IException.h" #include "Message.h" @@ -39,7 +41,7 @@ namespace Isis { * @param name The blob name * @param type The blob type */ - Blob::Blob(const std::string &name, const std::string &type) { + Blob::Blob(const QString &name, const QString &type) { p_blobName = name; p_buffer = NULL; p_labelFile = ""; @@ -48,8 +50,8 @@ namespace Isis { p_blobPvl.SetName(p_type); p_blobPvl += PvlKeyword("Name", p_blobName); - p_blobPvl += PvlKeyword("StartByte", 0); - p_blobPvl += PvlKeyword("Bytes", 0); + p_blobPvl += PvlKeyword("StartByte", "0"); + p_blobPvl += PvlKeyword("Bytes", "0"); } /** @@ -60,8 +62,8 @@ namespace Isis { * @param type The blob type * @param file The filename to read from. */ - Blob::Blob(const std::string &name, const std::string &type, - const std::string &file) { + Blob::Blob(const QString &name, const QString &type, + const QString &file) { p_blobName = name; p_buffer = NULL; p_nbytes = 0; @@ -135,7 +137,7 @@ namespace Isis { * * @return @b string Type of blob. */ - std::string Blob::Type() const { + QString Blob::Type() const { return p_type; } @@ -144,7 +146,7 @@ namespace Isis { * * @return @b string The name of the blob. */ - std::string Blob::Name() const { + QString Blob::Name() const { return p_blobName; } @@ -178,13 +180,12 @@ namespace Isis { bool found = false; try { // Search for the blob name - IString blobName = p_blobName; - blobName.UpCase(); + QString blobName = p_blobName.toUpper(); for (int o = 0; o < pvl.Objects(); o++) { const PvlObject &obj = pvl.Object(o); if (obj.IsNamed(p_type)) { - IString curName = (string) obj["Name"]; - curName.UpCase(); + QString curName = obj["Name"]; + curName = curName.toUpper(); if (blobName == curName) { p_blobPvl = obj; found = true; @@ -201,13 +202,13 @@ namespace Isis { } } catch (IException &e) { - string msg = "Invalid " + p_type + " label format"; + QString msg = "Invalid " + p_type + " label format"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } // Did we find it? if (!found) { - string msg = "Unable to find " + p_type + " [" + p_blobName + "]"; + QString msg = "Unable to find " + p_type + " [" + p_blobName + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -217,16 +218,16 @@ namespace Isis { p_nbytes = p_blobPvl["Bytes"]; p_detached = ""; if (p_blobPvl.HasKeyword("^" + p_type)) { - string path = ""; + QString path = ""; if (p_labelFile != "") { path = FileName(p_labelFile).path() + "/"; } - p_detached = path + (std::string) p_blobPvl["^"+p_type]; + p_detached = path + (QString) p_blobPvl["^"+p_type]; p_blobPvl.DeleteKeyword("^" + p_type); } } catch (IException &e) { - string msg = "Invalid " + p_type + " label format"; + QString msg = "Invalid " + p_type + " label format"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } } @@ -239,9 +240,9 @@ namespace Isis { * @throws iException::Io - Unable to open file * @throws iException::Pvl - Invalid label format */ - void Blob::Read(const std::string &file) { + void Blob::Read(const QString &file) { // Expand the filename - string temp(FileName(file).expanded()); + QString temp(FileName(file).expanded()); // Get the pvl Pvl pvl; @@ -249,7 +250,7 @@ namespace Isis { pvl.Read(temp); } catch (IException &e) { - string msg = "Invalid " + p_type + " label format"; + QString msg = "Invalid " + p_type + " label format"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } @@ -264,16 +265,16 @@ namespace Isis { * * @throws iException::Io - Unable to open file */ - void Blob::Read(const std::string &file, const Pvl &pvlLabels) { + void Blob::Read(const QString &file, const Pvl &pvlLabels) { // Expand the filename - string temp(FileName(file).expanded()); + QString temp(FileName(file).expanded()); // Open the file fstream istm; - istm.open(temp.c_str(), std::ios::in); + istm.open(temp.toAscii().data(), std::ios::in); if (!istm) { - string message = Message::FileOpen(temp); + QString message = Message::FileOpen(temp); throw IException(IException::Io, message, _FILEINFO_); } @@ -283,7 +284,7 @@ namespace Isis { } catch (IException &e) { istm.close(); - string msg = "Unable to open " + p_type + " [" + p_blobName + + QString msg = "Unable to open " + p_type + " [" + p_blobName + "] in file [" + temp + "]"; throw IException(e, IException::Io, msg, _FILEINFO_); } @@ -305,9 +306,9 @@ namespace Isis { ReadInit(); if (p_detached != "") { fstream dstm; - dstm.open(p_detached.c_str(), std::ios::in); + dstm.open(p_detached.toAscii().data(), std::ios::in); if (!dstm) { - string message = Message::FileOpen(p_detached); + QString message = Message::FileOpen(p_detached); throw IException(IException::Io, message, _FILEINFO_); } ReadData(dstm); @@ -317,7 +318,7 @@ namespace Isis { } } catch (IException &e) { - string msg = "Unable to read " + p_type + " [" + p_blobName + "]"; + QString msg = "Unable to read " + p_type + " [" + p_blobName + "]"; throw IException(e, IException::Io, msg, _FILEINFO_); } } @@ -344,14 +345,14 @@ namespace Isis { streampos sbyte = p_startByte - 1; stream.seekg(sbyte, std::ios::beg); if (!stream.good()) { - string msg = "Error preparing to read data from " + p_type + + QString msg = "Error preparing to read data from " + p_type + " [" + p_blobName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } stream.read(p_buffer, p_nbytes); if (!stream.good()) { - string msg = "Error reading data from " + p_type + " [" + p_blobName + "]"; + QString msg = "Error reading data from " + p_type + " [" + p_blobName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } } @@ -365,7 +366,7 @@ namespace Isis { * @throws IException::Io - Error preparing to write data to file * @throws IException::Io - Error creating file */ - void Blob::Write(const std::string &file) { + void Blob::Write(const QString &file) { // Determine the size of the label and write it out try { WriteInit(); @@ -376,16 +377,16 @@ namespace Isis { os.seekp(0, std::ios::end); BigInt nbytes = (BigInt) os.tellp() + (BigInt) 64; p_startByte = nbytes + 1 + 1; // 1-based; - pvl.FindObject(p_type)["StartByte"] = p_startByte; - pvl.FindObject(p_type)["Bytes"] = p_nbytes; + pvl.FindObject(p_type)["StartByte"] = toString(p_startByte); + pvl.FindObject(p_type)["Bytes"] = toString(p_nbytes); pvl.Write(file); // Prepare and write the binary data fstream stream; ios::openmode flags = std::ios::in | std::ios::binary | std::ios::out; - stream.open(file.c_str(), flags); + stream.open(file.toAscii().data(), flags); if (!stream) { - string message = "Unable to open [" + file + "]"; + QString message = "Unable to open [" + file + "]"; throw IException(IException::Io, message, _FILEINFO_); } @@ -393,7 +394,7 @@ namespace Isis { stream.seekp(sbyte, std::ios::beg); if (!stream.good()) { stream.close(); - string msg = "Error preparing to write data to " + + QString msg = "Error preparing to write data to " + p_type + " [" + p_blobName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -402,7 +403,7 @@ namespace Isis { stream.close(); } catch (IException &e) { - string msg = "Unable to create " + p_type + " file [" + file + "]"; + QString msg = "Unable to create " + p_type + " file [" + file + "]"; throw IException(e, IException::Io, msg, _FILEINFO_); } } @@ -415,7 +416,7 @@ namespace Isis { * the name of the file */ void Blob::Write(Pvl &pvl, std::fstream &stm, - const std::string &detachedFileName) { + const QString &detachedFileName) { // Handle 64-bit I/O WriteInit(); @@ -434,14 +435,14 @@ namespace Isis { } // See if the blob is already in the file - p_blobPvl["StartByte"] = (BigInt) sbyte; - p_blobPvl["Bytes"] = p_nbytes; + p_blobPvl["StartByte"] = toString(sbyte); + p_blobPvl["Bytes"] = toString(p_nbytes); bool found = false; for (int i = 0; i < pvl.Objects(); i++) { if (pvl.Object(i).Name() == p_blobPvl.Name()) { PvlObject &obj = pvl.Object(i); - if ((string) obj["Name"] == (string) p_blobPvl["Name"]) { + if ((QString)obj["Name"] == (QString)p_blobPvl["Name"]) { found = true; BigInt oldSbyte = obj["StartByte"]; @@ -501,7 +502,7 @@ namespace Isis { void Blob::WriteData(std::fstream &stream) { stream.write(p_buffer, p_nbytes); if (!stream.good()) { - string msg = "Error writing data to " + p_type + " [" + p_blobName + "]"; + QString msg = "Error writing data to " + p_type + " [" + p_blobName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } } diff --git a/isis/src/base/objs/Blob/Blob.h b/isis/src/base/objs/Blob/Blob.h index 048164cbd6..95537edd40 100644 --- a/isis/src/base/objs/Blob/Blob.h +++ b/isis/src/base/objs/Blob/Blob.h @@ -59,26 +59,26 @@ namespace Isis { */ class Blob { public: - Blob(const std::string &name, const std::string &type); - Blob(const std::string &name, const std::string &type, - const std::string &file); + Blob(const QString &name, const QString &type); + Blob(const QString &name, const QString &type, + const QString &file); Blob(const Blob &other); Blob &operator=(const Blob &other); virtual ~Blob(); - std::string Type() const; - std::string Name() const; + QString Type() const; + QString Name() const; int Size() const; PvlObject &Label(); - void Read(const std::string &file); - void Read(const std::string &file, const Pvl &pvlLabels); + void Read(const QString &file); + void Read(const QString &file, const Pvl &pvlLabels); virtual void Read(const Pvl &pvl, std::istream &is); - void Write(const std::string &file); + void Write(const QString &file); void Write(Pvl &pvl, std::fstream &stm, - const std::string &detachedFileName = ""); + const QString &detachedFileName = ""); protected: void Find(const Pvl &pvl); @@ -88,14 +88,14 @@ namespace Isis { virtual void WriteData(std::fstream &os); PvlObject p_blobPvl; //!< Pvl Blob object - std::string p_blobName; //!< Name of the Blob object + QString p_blobName; //!< Name of the Blob object char *p_buffer; //!< Buffer blob data is stored in BigInt p_startByte; //!< Byte blob data starts at in buffer int p_nbytes; //!< Size of blob data (in bytes) - std::string p_type; //!< Type of data stored in the buffer - std::string p_detached; //!< Used for reading detached blobs - std::string p_labelFile; //!< The file containing the labels + QString p_type; //!< Type of data stored in the buffer + QString p_detached; //!< Used for reading detached blobs + QString p_labelFile; //!< The file containing the labels }; }; diff --git a/isis/src/base/objs/Blob/unitTest.cpp b/isis/src/base/objs/Blob/unitTest.cpp index e87f20799d..2f2bbf4a98 100644 --- a/isis/src/base/objs/Blob/unitTest.cpp +++ b/isis/src/base/objs/Blob/unitTest.cpp @@ -1,14 +1,16 @@ #include #include "Blob.h" #include "IException.h" +#include "IString.h" #include "Preference.h" +using namespace Isis; using namespace std; class MyBlob : public Isis::Blob { public: - MyBlob(const string &name) : Isis::Blob(name, "Blob") {}; - MyBlob(const string &name, const string &file) : Isis::Blob(name, "Blob", file) {}; + MyBlob(const QString &name) : Isis::Blob(name, "Blob") {}; + MyBlob(const QString &name, const QString &file) : Isis::Blob(name, "Blob", file) {}; void MyBuf(char *buf, int size) { p_buffer = new char[size]; p_nbytes = size; diff --git a/isis/src/base/objs/Blobber/Blobber.cpp b/isis/src/base/objs/Blobber/Blobber.cpp index fdc769b9d9..690d4bda0a 100644 --- a/isis/src/base/objs/Blobber/Blobber.cpp +++ b/isis/src/base/objs/Blobber/Blobber.cpp @@ -31,7 +31,6 @@ #include "Table.h" #include "TableField.h" -using std::string; using std::vector; namespace Isis { @@ -50,19 +49,19 @@ namespace Isis { * user to simply define the Table object and field names to establish these * for multiple reads from different cubes. * - * @param [in] blobname (const std::string&) specifies the name of the ISIS + * @param [in] blobname (const QString&) specifies the name of the ISIS * BLOB that contains the field * to read the data from - * @param [in] fieldname (const std::string&) specifies the name of the field + * @param [in] fieldname (const QString&) specifies the name of the field * in blobname to read and convert * to double precision floating point * data - * @param [in] name (const std::string&) Associates a name of the implementors + * @param [in] name (const QString&) Associates a name of the implementors * choosing that identifies an * instantiation of this class */ - Blobber::Blobber(const std::string &blobname, const std::string &fieldname, - const std::string &name) : _blobname(blobname), + Blobber::Blobber(const QString &blobname, const QString &fieldname, + const QString &name) : _blobname(blobname), _fieldname(fieldname), _name(name) { } @@ -79,20 +78,20 @@ namespace Isis { * is expected to contain a Table object that is * named blobname and must contain a field called * fieldname. - * @param [in] blobname (const std::string&) specifies the name of the ISIS + * @param [in] blobname (const QString&) specifies the name of the ISIS * BLOB that contains the field * to read the data from - * @param [in] fieldname (const std::string&) specifies the name of the field + * @param [in] fieldname (const QString&) specifies the name of the field * in blobname to read and convert * to double precision floating point * data - * @param [in] name (const std::string&) Associates a name of the implementors + * @param [in] name (const QString&) Associates a name of the implementors * choosing that identifies an * instantiation of this class */ - Blobber::Blobber(Cube &cube, const std::string &blobname, - const std::string &fieldname, - const std::string &name) : + Blobber::Blobber(Cube &cube, const QString &blobname, + const QString &fieldname, + const QString &name) : _blobname(blobname), _fieldname(fieldname), _name(name) { @@ -134,7 +133,7 @@ namespace Isis { * * @param [in] filename (string&) Name of ISIS cube file to read */ - void Blobber::load(const std::string &filename) { + void Blobber::load(const QString &filename) { Cube cube; cube.open(filename); load(cube); @@ -165,7 +164,7 @@ namespace Isis { loadInteger(tbl); } else { - string msg = "Field type for " + getFieldName() + + QString msg = "Field type for " + getFieldName() + " is not double or integer"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Blobber/Blobber.h b/isis/src/base/objs/Blobber/Blobber.h index 9c1a19f1e5..bed060ad27 100644 --- a/isis/src/base/objs/Blobber/Blobber.h +++ b/isis/src/base/objs/Blobber/Blobber.h @@ -23,7 +23,8 @@ * http://www.usgs.gov/privacy.html. */ -#include +#include + #include namespace Isis { @@ -110,10 +111,10 @@ namespace Isis { class Blobber { public: Blobber(); - Blobber(const std::string &blobname, const std::string &fieldname, - const std::string &name = "Blob"); - Blobber(Cube &cube, const std::string &blobname, - const std::string &fieldname, const std::string &name = "Blob"); + Blobber(const QString &blobname, const QString &fieldname, + const QString &name = "Blob"); + Blobber(Cube &cube, const QString &blobname, + const QString &fieldname, const QString &name = "Blob"); /** Destructor of this object */ virtual ~Blobber() { } @@ -128,7 +129,7 @@ namespace Isis { * * @param name Unique name */ - void setName(const std::string &name) { + void setName(const QString &name) { _name = name; } @@ -141,7 +142,7 @@ namespace Isis { * * @param bname Blobber name */ - void setBlobName(const std::string &bname) { + void setBlobName(const QString &bname) { _blobname = bname; } @@ -153,7 +154,7 @@ namespace Isis { * * @param fname Field name */ - void setFieldName(const std::string &fname) { + void setFieldName(const QString &fname) { _fieldname = fname; } @@ -184,7 +185,7 @@ namespace Isis { * Returns the name of the BLOB given to refer to this instantiation * @return Name of BLOB instance */ - std::string getName() const { + QString getName() const { return (_name); } @@ -192,7 +193,7 @@ namespace Isis { * @brief Retrieves the name of the Table object * @return (string) Name of the Table */ - std::string getBlobName() const { + QString getBlobName() const { return (_blobname); } @@ -200,7 +201,7 @@ namespace Isis { * @brief Retreive the name of the field in the Tabel object BLOB * @return (string) Name of the BLOB field */ - std::string getFieldName() const { + QString getFieldName() const { return (_fieldname); } @@ -235,7 +236,7 @@ namespace Isis { } // Load options for reading the BLOB from ISIS files - void load(const std::string &filename); + void load(const QString &filename); void load(Cube &cube); @@ -252,9 +253,9 @@ namespace Isis { } private: - std::string _blobname; //!< Name of BLOB to read - std::string _fieldname; //!< Name of field in BLOB to read - std::string _name; //!< Name of this data set + QString _blobname; //!< Name of BLOB to read + QString _fieldname; //!< Name of field in BLOB to read + QString _name; //!< Name of this data set BlobBuf _buf; //!< Buffer holding data // Low/level I/O and conversion methods diff --git a/isis/src/base/objs/Blobber/unitTest.cpp b/isis/src/base/objs/Blobber/unitTest.cpp index c1d7ec5763..b81114bc77 100644 --- a/isis/src/base/objs/Blobber/unitTest.cpp +++ b/isis/src/base/objs/Blobber/unitTest.cpp @@ -14,13 +14,13 @@ int main(int argc, char *argv[]) { cout << "*** Blobber unitTest ***\n"; Preference::Preferences(true); - string fname = "$base/testData/blobTruth.cub"; + QString fname = "$base/testData/blobTruth.cub"; cout << "\nFile Source: " << fname << endl; // This is assumed to be Hirise cube source - string blobName = "HiRISE Calibration Ancillary"; - string fieldName = "DarkPixels"; - string name = "Blobber"; + QString blobName = "HiRISE Calibration Ancillary"; + QString fieldName = "DarkPixels"; + QString name = "Blobber"; // Test access from Cube object class cout << "\n** Test Cube Class access...\n"; diff --git a/isis/src/base/objs/BoxcarManager/BoxcarManager.h b/isis/src/base/objs/BoxcarManager/BoxcarManager.h index 27a036c16d..95249c96ad 100644 --- a/isis/src/base/objs/BoxcarManager/BoxcarManager.h +++ b/isis/src/base/objs/BoxcarManager/BoxcarManager.h @@ -1,4 +1,4 @@ -#if !defined(BoxcarManager_h) +#ifndef BoxcarManager_h #define BoxcarManager_h /** * @file diff --git a/isis/src/base/objs/BoxcarManager/unitTest.cpp b/isis/src/base/objs/BoxcarManager/unitTest.cpp index 131bdfa911..54934927a1 100644 --- a/isis/src/base/objs/BoxcarManager/unitTest.cpp +++ b/isis/src/base/objs/BoxcarManager/unitTest.cpp @@ -6,18 +6,19 @@ #include "Cube.h" #include "BoxcarManager.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - string fname = "$base/testData/isisTruth.cub"; - Isis::Cube cube; + QString fname = "$base/testData/isisTruth.cub"; + Cube cube; cube.open(fname); // Test 5x5 boxcar - Isis::BoxcarManager box5x5(cube, 5, 5); + BoxcarManager box5x5(cube, 5, 5); cout << "Buffer (Boxcar) Size: " << box5x5.SampleDimension() << " " << box5x5.LineDimension() << " " << @@ -35,7 +36,7 @@ int main(int argc, char *argv[]) { cout << endl; // Test 4x4 boxcar - Isis::BoxcarManager box4x4(cube, 4, 4); + BoxcarManager box4x4(cube, 4, 4); cout << "Buffer (Boxcar) Size: " << box4x4.SampleDimension() << " " << box4x4.LineDimension() << " " << diff --git a/isis/src/base/objs/Brick/Brick.cpp b/isis/src/base/objs/Brick/Brick.cpp index 92a9a1127d..940cb1a744 100644 --- a/isis/src/base/objs/Brick/Brick.cpp +++ b/isis/src/base/objs/Brick/Brick.cpp @@ -58,7 +58,7 @@ namespace Isis { */ bool Brick::SetBrick(const int brick) { if(brick < 1) { - std::string message = "Invalid value for argument [brick]"; + QString message = "Invalid value for argument [brick]"; throw IException(IException::Programmer, message, _FILEINFO_); } diff --git a/isis/src/base/objs/Brick/Brick.h b/isis/src/base/objs/Brick/Brick.h index 3d0b2ae7fc..eb4642003d 100644 --- a/isis/src/base/objs/Brick/Brick.h +++ b/isis/src/base/objs/Brick/Brick.h @@ -1,4 +1,4 @@ -#if !defined(Brick_h) +#ifndef Brick_h #define Brick_h /** * @file diff --git a/isis/src/base/objs/Buffer/Buffer.cpp b/isis/src/base/objs/Buffer/Buffer.cpp index a38c2a7788..71006a6eac 100644 --- a/isis/src/base/objs/Buffer/Buffer.cpp +++ b/isis/src/base/objs/Buffer/Buffer.cpp @@ -205,17 +205,17 @@ namespace Isis { int Buffer::Index(const int i_samp, const int i_line, const int i_band) const { if((i_samp < p_sample) || (i_samp > (p_sample + p_nsamps - 1))) { - string message = Message::ArraySubscriptNotInRange(i_samp); + QString message = Message::ArraySubscriptNotInRange(i_samp); throw IException(IException::Programmer, message, _FILEINFO_); } if((i_line < p_line) || (i_line > (p_line + p_nlines - 1))) { - string message = Message::ArraySubscriptNotInRange(i_line); + QString message = Message::ArraySubscriptNotInRange(i_line); throw IException(IException::Programmer, message, _FILEINFO_); } if((i_band < p_band) || (i_band > (p_band + p_nbands - 1))) { - string message = Message::ArraySubscriptNotInRange(i_band); + QString message = Message::ArraySubscriptNotInRange(i_band); throw IException(IException::Programmer, message, _FILEINFO_); } @@ -237,11 +237,11 @@ namespace Isis { */ double Buffer::at(const int index) const { if(index < 0) { - string message = Message::ArraySubscriptNotInRange(index); + QString message = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, message, _FILEINFO_); } else if(index >= p_npixels) { - string message = Message::ArraySubscriptNotInRange(index); + QString message = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, message, _FILEINFO_); } @@ -327,7 +327,7 @@ namespace Isis { p_buf = NULL; p_rawbuf = NULL; } - string message = Message::MemoryAllocationFailed(); + QString message = Message::MemoryAllocationFailed(); throw IException(IException::Unknown, message, _FILEINFO_); } } diff --git a/isis/src/base/objs/CSVReader/CSVReader.cpp b/isis/src/base/objs/CSVReader/CSVReader.cpp index a30d207451..db6e8827e9 100644 --- a/isis/src/base/objs/CSVReader/CSVReader.cpp +++ b/isis/src/base/objs/CSVReader/CSVReader.cpp @@ -78,7 +78,7 @@ namespace Isis { * empty tokens (true) or collapsed into one token * (false) */ - CSVReader::CSVReader(const std::string &csvfile, bool header, int skip, + CSVReader::CSVReader(const QString &csvfile, bool header, int skip, const char &delimiter, const bool keepEmptyParts, const bool ignoreComments) : _header(header), _skip(skip), _delimiter(delimiter), @@ -153,10 +153,10 @@ namespace Isis { * * @param csvfile Name of file to read */ - void CSVReader::read(const std::string &csvfile) { - ifstream ifile(csvfile.c_str(), ios::in); + void CSVReader::read(const QString &csvfile) { + ifstream ifile(csvfile.toAscii().data(), ios::in); if(!ifile) { - string mess = "Unable to open file " + csvfile; + QString mess = "Unable to open file " + csvfile; throw IException(IException::User, mess, _FILEINFO_); } @@ -276,12 +276,12 @@ namespace Isis { * * @return CSVReader::CSVAxis Column array parsed from each row */ - CSVReader::CSVAxis CSVReader::getColumn(const std::string &hname) const { + CSVReader::CSVAxis CSVReader::getColumn(const QString &hname) const { // Get the header CSVAxis header(getHeader()); - std::string head = IString(hname).Trim(" "); + QString head = hname.trimmed(); for(int i = 0 ; i < header.dim() ; i++) { - if(IString::Equal(head, IString(header[i]).Trim(" "))) { + if(head.toLower() == header[i].trimmed().toLower()) { return (getColumn(i)); } } @@ -417,12 +417,12 @@ namespace Isis { */ std::istream &CSVReader::load(std::istream &ifile) { - string iline; + std::string iline; int nlines(0); while(getline(ifile, iline)) { if(!iline.empty()) { if(!(_ignoreComments && (iline[0] == '#'))) { - _lines.push_back(iline); + _lines.push_back(iline.c_str()); nlines++; } } diff --git a/isis/src/base/objs/CSVReader/CSVReader.h b/isis/src/base/objs/CSVReader/CSVReader.h index aa5fd5e7f7..0030732dfc 100644 --- a/isis/src/base/objs/CSVReader/CSVReader.h +++ b/isis/src/base/objs/CSVReader/CSVReader.h @@ -23,13 +23,13 @@ * http://www.usgs.gov/privacy.html. */ -#include +#include #include #include -#include "tnt/tnt_array1d.h" -#include "IString.h" +#include #include "CollectorMap.h" #include "IException.h" +#include "IString.h" namespace Isis { @@ -51,7 +51,7 @@ namespace Isis { * own list. * * This is a templated class that allows the user to select the token storage - * type. This type, which defaults to the Isis::IString class (I will explain + * type. This type, which defaults to the QString class (I will explain * the reason for this shortly), must provide a few features that are * explicitly used in providing support for tokenization. * @@ -74,10 +74,10 @@ namespace Isis { * * @internal * @history 2007-06-05 Brendan George - Modified to work with - * IString/StringTools merge + * QString/StringTools merge * @history 2008-06-18 Christopher Austin - Fixed documentation */ - template + template class CSVParser { public: typedef TokenStore TokenType; //!< Token storage type @@ -95,13 +95,13 @@ namespace Isis { * words and indicate whether successive occurances of the delimiter * translates into a single value or they are taken as empty tokens. * - * @param str IString to parse + * @param str QString to parse * @param delimiter Character that separates individual tokens in the string * @param keepEmptyParts Specifies the occurance of successive tokens is to * treated as one token (false) or each delimiter * indicates an empty token (true) */ - CSVParser(const std::string &str, const char &delimiter = ',', + CSVParser(const QString &str, const char &delimiter = ',', bool keepEmptyParts = true) { parse(str, delimiter, keepEmptyParts); } @@ -135,7 +135,7 @@ namespace Isis { * construction of this lightweight class, but this allows the same instance * to be resued. * - * @param str IString to parse into tokens separated by the delimiter + * @param str QString to parse into tokens separated by the delimiter * @param delimiter Character that separates each token in str * @param keepEmptyParts Specifies the occurance of successive tokens is to * treated as one token (false) or each delimiter @@ -143,12 +143,12 @@ namespace Isis { * * @return int Number of tokens found/parsed in the input string */ - int parse(const std::string &str, const char &delimiter = ',', + int parse(const QString &str, const char &delimiter = ',', bool keepEmptyParts = true) { - std::vector tokens; - IString::Split(delimiter, str, tokens, keepEmptyParts); + QStringList tokens = + str.split(delimiter, keepEmptyParts? QString::KeepEmptyParts : QString::SkipEmptyParts); TokenList slist(tokens.size()); - for(unsigned int i = 0 ; i < tokens.size() ; i++) { + for(int i = 0 ; i < tokens.size() ; i++) { slist[i] = TokenType(tokens[i]); } _elements = slist; @@ -218,7 +218,7 @@ namespace Isis { * well: * @code * cout << "\n\nProcessing comma table...\n"; - * std::string csvfile("comma.csv"); + * QString csvfile("comma.csv"); * CSVReader csv(csvfile,true,2,','true); * @endcode * @@ -226,7 +226,7 @@ namespace Isis { * as follows: * @code * cout << "\n\nProcessing comma table using methods...\n"; - * std::string csvfile("comma.csv"); + * QString csvfile("comma.csv"); * CSVReader csv; * csv.setSkip(2); * csv.setHeader(true); @@ -248,7 +248,7 @@ namespace Isis { class CSVReader { private: - typedef CSVParser Parser; //!< Defines single line parser + typedef CSVParser Parser; //!< Defines single line parser public: friend std::istream &operator>>(std::istream &is, CSVReader &csv); @@ -262,7 +262,7 @@ namespace Isis { // Constructors and Destructor CSVReader(); - CSVReader(const std::string &csvfile, bool header = false, int skip = 0, + CSVReader(const QString &csvfile, bool header = false, int skip = 0, const char &delimiter = ',', const bool keepEmptyParts = true, const bool ignoreComments = true); @@ -449,12 +449,12 @@ namespace Isis { return (_keepParts); } - void read(const std::string &fname); + void read(const QString &fname); CSVAxis getHeader() const; CSVAxis getRow(int index) const; CSVAxis getColumn(int index) const; - CSVAxis getColumn(const std::string &hname) const; + CSVAxis getColumn(const QString &hname) const; CSVTable getTable() const; bool isTableValid(const CSVTable &table) const; @@ -473,7 +473,7 @@ namespace Isis { } private: - typedef std::vector CSVList; //!< Input source line container + typedef std::vector CSVList; //!< Input source line container bool _header; //!< Indicates presences of header int _skip; //!< Number of lines to skip char _delimiter; //!< Separator of values @@ -511,9 +511,9 @@ namespace Isis { * CSVReader::CSVDblVector dcol = csv.convert(scol); * @endcode * - * At present, this class uses the Isis IString class as its token storage type + * At present, this class uses the Isis QString class as its token storage type * (TokenType). All that is required is that it have a cast operator for a - * given type. If the Isis IString class has the operator, it can be invoked + * given type. If the Isis QString class has the operator, it can be invoked * for that type. The precise statement used to convert the token to the * explict type is: * @code @@ -536,7 +536,7 @@ namespace Isis { TNT::Array1D out(data.dim()); for(int i = 0 ; i < data.dim() ; i++) { Parser::TokenType s = data[i]; - out[i] = (T) s; + out[i] = toDouble(s); } return (out); } diff --git a/isis/src/base/objs/CSVReader/unitTest.cpp b/isis/src/base/objs/CSVReader/unitTest.cpp index c51f4822f8..86ce1207f1 100644 --- a/isis/src/base/objs/CSVReader/unitTest.cpp +++ b/isis/src/base/objs/CSVReader/unitTest.cpp @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) { try { cout << "\n\nProcessing comma table...\n"; - std::string csvfile("comma.csv"); + QString csvfile("comma.csv"); CSVReader csv(csvfile, true, 2); CSVReader::CSVTable table = summarize(csv); diff --git a/isis/src/base/objs/Camera/Camera.cpp b/isis/src/base/objs/Camera/Camera.cpp index 5ce6c44812..4dab906317 100644 --- a/isis/src/base/objs/Camera/Camera.cpp +++ b/isis/src/base/objs/Camera/Camera.cpp @@ -701,17 +701,17 @@ namespace Isis { PvlGroup map = pvl.FindGroup("Mapping", Pvl::Traverse); if (map.HasKeyword("EquatorialRadius")) - a = Distance(map["EquatorialRadius"][0], Distance::Meters); + a = Distance(toDouble(map["EquatorialRadius"][0]), Distance::Meters); if (map.HasKeyword("PolarRadius")) - b = Distance(map["PolarRadius"][0], Distance::Meters); + b = Distance(toDouble(map["PolarRadius"][0]), Distance::Meters); // Convert to planetographic if necessary minlat = p_minlat; maxlat = p_maxlat; if (map.HasKeyword("LatitudeType")) { - IString latType = (string) map["LatitudeType"]; - if (latType.UpCase() == "PLANETOGRAPHIC") { + QString latType = (QString) map["LatitudeType"]; + if (latType.toUpper() == "PLANETOGRAPHIC") { if (abs(minlat) < 90.0) { // So tan doesn't fail minlat *= PI / 180.0; minlat = atan(tan(minlat) * (a / b) * (a / b)); @@ -731,8 +731,8 @@ namespace Isis { maxlon = p_maxlon; bool domain360 = true; if (map.HasKeyword("LongitudeDomain")) { - IString lonDomain = (string) map["LongitudeDomain"]; - if (lonDomain.UpCase() == "180") { + QString lonDomain = (QString) map["LongitudeDomain"]; + if (lonDomain == "180") { minlon = p_minlon180; maxlon = p_maxlon180; domain360 = false; @@ -741,8 +741,8 @@ namespace Isis { // Convert to the proper longitude direction if (map.HasKeyword("LongitudeDirection")) { - IString lonDirection = (string) map["LongitudeDirection"]; - if (lonDirection.UpCase() == "POSITIVEWEST") { + QString lonDirection = (QString) map["LongitudeDirection"]; + if (lonDirection.toUpper() == "POSITIVEWEST") { double swap = minlon; minlon = -maxlon; maxlon = -swap; @@ -786,19 +786,19 @@ namespace Isis { map += PvlKeyword("TargetName", target()->name()); std::vector radii = target()->radii(); - map += PvlKeyword("EquatorialRadius", radii[0].meters(), "meters"); - map += PvlKeyword("PolarRadius", radii[2].meters(), "meters"); + map += PvlKeyword("EquatorialRadius", toString(radii[0].meters()), "meters"); + map += PvlKeyword("PolarRadius", toString(radii[2].meters()), "meters"); map += PvlKeyword("LatitudeType", "Planetocentric"); map += PvlKeyword("LongitudeDirection", "PositiveEast"); map += PvlKeyword("LongitudeDomain", "360"); GroundRangeResolution(); - map += PvlKeyword("MinimumLatitude", p_minlat); - map += PvlKeyword("MaximumLatitude", p_maxlat); - map += PvlKeyword("MinimumLongitude", p_minlon); - map += PvlKeyword("MaximumLongitude", p_maxlon); - map += PvlKeyword("PixelResolution", p_minres); + map += PvlKeyword("MinimumLatitude", toString(p_minlat)); + map += PvlKeyword("MaximumLatitude", toString(p_maxlat)); + map += PvlKeyword("MinimumLongitude", toString(p_minlon)); + map += PvlKeyword("MaximumLongitude", toString(p_maxlon)); + map += PvlKeyword("PixelResolution", toString(p_minres)); map += PvlKeyword("ProjectionName", "Sinusoidal"); pvl.AddGroup(map); @@ -807,14 +807,14 @@ namespace Isis { //! Reads the focal length from the instrument kernel void Camera::SetFocalLength() { int code = naifIkCode(); - string key = "INS" + IString(code) + "_FOCAL_LENGTH"; + QString key = "INS" + toString(code) + "_FOCAL_LENGTH"; SetFocalLength(Spice::getDouble(key)); } //! Reads the Pixel Pitch from the instrument kernel void Camera::SetPixelPitch() { int code = naifIkCode(); - string key = "INS" + IString(code) + "_PIXEL_PITCH"; + QString key = "INS" + toString(code) + "_PIXEL_PITCH"; SetPixelPitch(Spice::getDouble(key)); } diff --git a/isis/src/base/objs/Camera/unitTest.cpp b/isis/src/base/objs/Camera/unitTest.cpp index f7d06c03ba..bbda428169 100644 --- a/isis/src/base/objs/Camera/unitTest.cpp +++ b/isis/src/base/objs/Camera/unitTest.cpp @@ -58,7 +58,7 @@ class MyCamera : public Camera { int main() { Preference::Preferences(true); - string inputFile = "$mgs/testData/ab102401.lev2.cub"; + QString inputFile = "$mgs/testData/ab102401.lev2.cub"; Cube cube; cube.open(inputFile); Camera *c = NULL; @@ -136,7 +136,7 @@ int main() { pixRes2 *= 10000000; pixRes2 = round(pixRes2); pixRes2 /= 10000000; - pvl.FindGroup("Mapping")["PixelResolution"] = pixRes2; + pvl.FindGroup("Mapping")["PixelResolution"] = toString(pixRes2); cout << "BasicMapping PVL: " << endl << pvl << endl << endl; cout << "FocalLength: " << c->FocalLength() << endl; @@ -227,19 +227,19 @@ int main() { minLat *= 100; minLat = round(minLat); minLat /= 100; - camMap.FindGroup("Mapping")["MinimumLatitude"] = minLat; + camMap.FindGroup("Mapping")["MinimumLatitude"] = toString(minLat); double pixRes = camMap.FindGroup("Mapping")["PixelResolution"]; pixRes *= 100; pixRes = round(pixRes); pixRes /= 100; - camMap.FindGroup("Mapping")["PixelResolution"] = pixRes; + camMap.FindGroup("Mapping")["PixelResolution"] = toString(pixRes); double minLon = camMap.FindGroup("Mapping")["MinimumLongitude"]; minLon *= 100000000000.0; minLon = round(minLon); minLon /= 100000000000.0; - camMap.FindGroup("Mapping")["MinimumLongitude"] = minLon; + camMap.FindGroup("Mapping")["MinimumLongitude"] = toString(minLon); cout << camMap << endl; diff --git a/isis/src/base/objs/CameraDistortionMap/CameraDistortionMap.cpp b/isis/src/base/objs/CameraDistortionMap/CameraDistortionMap.cpp index 62989b2a51..282b743de6 100644 --- a/isis/src/base/objs/CameraDistortionMap/CameraDistortionMap.cpp +++ b/isis/src/base/objs/CameraDistortionMap/CameraDistortionMap.cpp @@ -61,8 +61,8 @@ namespace Isis { * @todo Generalize to read variable number of coefficients * @todo Add latex equation to the documentation */ - void CameraDistortionMap::SetDistortion(const int naifIkCode) { - std::string odkkey = "INS" + Isis::IString(naifIkCode) + "_OD_K"; + void CameraDistortionMap::SetDistortion(int naifIkCode) { + QString odkkey = "INS" + toString(naifIkCode) + "_OD_K"; for(int i = 0; i < 3; ++i) { p_odk.push_back(p_camera->Spice::getDouble(odkkey, i)); } @@ -84,7 +84,7 @@ namespace Isis { * @see SetDistortion * @todo Generalize polynomial equation */ - bool CameraDistortionMap::SetFocalPlane(const double dx, const double dy) { + bool CameraDistortionMap::SetFocalPlane(double dx, double dy) { p_focalPlaneX = dx; p_focalPlaneY = dy; diff --git a/isis/src/base/objs/CameraDistortionMap/CameraDistortionMap.h b/isis/src/base/objs/CameraDistortionMap/CameraDistortionMap.h index c0920ccc20..6fb5f3f314 100644 --- a/isis/src/base/objs/CameraDistortionMap/CameraDistortionMap.h +++ b/isis/src/base/objs/CameraDistortionMap/CameraDistortionMap.h @@ -51,14 +51,14 @@ namespace Isis { public: CameraDistortionMap(Camera *parent, double zDirection = 1.0); - void SetDistortion(const int naifIkCode); + void SetDistortion(int naifIkCode); //! Destructor virtual ~CameraDistortionMap() {}; - virtual bool SetFocalPlane(const double dx, const double dy); + virtual bool SetFocalPlane(double dx, double dy); - virtual bool SetUndistortedFocalPlane(const double ux, const double uy); + virtual bool SetUndistortedFocalPlane(double ux, double uy); //! Return distorted focal plane x inline double FocalPlaneX() const { diff --git a/isis/src/base/objs/CameraFactory/CameraFactory.cpp b/isis/src/base/objs/CameraFactory/CameraFactory.cpp index 0734d81272..8c89336cf4 100644 --- a/isis/src/base/objs/CameraFactory/CameraFactory.cpp +++ b/isis/src/base/objs/CameraFactory/CameraFactory.cpp @@ -51,12 +51,12 @@ namespace Isis { try { // First get the spacecraft and instrument and combine them PvlGroup &inst = lab.FindGroup("Instrument", Isis::Pvl::Traverse); - IString spacecraft = (string) inst["SpacecraftName"]; - IString name = (string) inst["InstrumentId"]; - spacecraft.UpCase(); - name.UpCase(); - IString group = spacecraft + "/" + name; - group.Remove(" "); + QString spacecraft = (QString) inst["SpacecraftName"]; + QString name = (QString) inst["InstrumentId"]; + spacecraft = spacecraft.toUpper(); + name = name.toUpper(); + QString group = spacecraft + "/" + name; + group = group.remove(" "); PvlGroup &kerns = lab.FindGroup("Kernels", Isis::Pvl::Traverse); // Default version 1 for backwards compatibility (spiceinit'd cubes before camera model versioning) @@ -81,7 +81,7 @@ namespace Isis { ptr = m_cameraPlugin.GetPlugin(group); } catch(IException &e) { - string msg = "Unsupported camera model, unable to find plugin for "; + QString msg = "Unsupported camera model, unable to find plugin for "; msg += "SpacecraftName [" + spacecraft + "] with InstrumentId ["; msg += name + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); @@ -129,26 +129,26 @@ namespace Isis { try { // First get the spacecraft and instrument and combine them PvlGroup &inst = lab.FindGroup("Instrument", Isis::Pvl::Traverse); - IString spacecraft = (string) inst["SpacecraftName"]; - IString name = (string) inst["InstrumentId"]; - spacecraft.UpCase(); - name.UpCase(); - IString group = spacecraft + "/" + name; - group.Remove(" "); + QString spacecraft = (QString) inst["SpacecraftName"]; + QString name = (QString) inst["InstrumentId"]; + spacecraft = spacecraft.toUpper(); + name = name.toUpper(); + QString group = spacecraft + "/" + name; + group = group.remove(" "); PvlGroup plugin; try { plugin = m_cameraPlugin.FindGroup(group); } catch(IException &e) { - string msg = "Unsupported camera model, unable to find plugin for "; + QString msg = "Unsupported camera model, unable to find plugin for "; msg += "SpacecraftName [" + spacecraft + "] with InstrumentId ["; msg += name + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } if(!plugin.HasKeyword("Version")) { - string msg = "Camera model identified by [" + group + "] does not have a version number"; + QString msg = "Camera model identified by [" + group + "] does not have a version number"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/CameraFactory/CameraFactory.h b/isis/src/base/objs/CameraFactory/CameraFactory.h index 6318dae006..7b236822aa 100644 --- a/isis/src/base/objs/CameraFactory/CameraFactory.h +++ b/isis/src/base/objs/CameraFactory/CameraFactory.h @@ -1,4 +1,4 @@ -#if !defined(CameraFactory_h) +#ifndef CameraFactory_h #define CameraFactory_h /** * @file diff --git a/isis/src/base/objs/CameraFocalPlaneMap/CameraFocalPlaneMap.cpp b/isis/src/base/objs/CameraFocalPlaneMap/CameraFocalPlaneMap.cpp index 93e31d3578..26f5f1ea91 100644 --- a/isis/src/base/objs/CameraFocalPlaneMap/CameraFocalPlaneMap.cpp +++ b/isis/src/base/objs/CameraFocalPlaneMap/CameraFocalPlaneMap.cpp @@ -57,10 +57,10 @@ namespace Isis { p_camera = parent; if (naifIkCode != 0) { - std::string xkey = "INS" + Isis::IString(naifIkCode) + "_TRANSX"; - std::string ykey = "INS" + Isis::IString(naifIkCode) + "_TRANSY"; - std::string ixkey = "INS" + Isis::IString(naifIkCode) + "_ITRANSS"; - std::string iykey = "INS" + Isis::IString(naifIkCode) + "_ITRANSL"; + QString xkey = "INS" + toString(naifIkCode) + "_TRANSX"; + QString ykey = "INS" + toString(naifIkCode) + "_TRANSY"; + QString ixkey = "INS" + toString(naifIkCode) + "_ITRANSS"; + QString iykey = "INS" + toString(naifIkCode) + "_ITRANSL"; for (int i = 0; i < 3; ++i) { p_transx[i] = parent->getDouble(xkey, i); p_transy[i] = parent->getDouble(ykey, i); @@ -69,10 +69,10 @@ namespace Isis { } } else { - std::string xkey = "IDEAL_TRANSX"; - std::string ykey = "IDEAL_TRANSY"; - std::string ixkey = "IDEAL_TRANSS"; - std::string iykey = "IDEAL_TRANSL"; + QString xkey = "IDEAL_TRANSX"; + QString ykey = "IDEAL_TRANSY"; + QString ixkey = "IDEAL_TRANSS"; + QString iykey = "IDEAL_TRANSL"; for (int i = 0; i < 3; ++i) { p_transx[i] = parent->getDouble(xkey, i); p_transy[i] = parent->getDouble(ykey, i); diff --git a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.cpp b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.cpp index 31b628f2df..18a9ad9fbf 100644 --- a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.cpp +++ b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.cpp @@ -69,7 +69,7 @@ namespace Isis { * * @param cubeFileName A cube filename */ - void CameraPointInfo::SetCube(const std::string &cubeFileName) { + void CameraPointInfo::SetCube(const QString &cubeFileName) { currentCube = usedCubes->OpenCube(cubeFileName); camera = currentCube->getCamera(); } @@ -238,7 +238,7 @@ namespace Isis { } bool noErrors = passed; - string error = ""; + QString error = ""; if(!camera->HasSurfaceIntersection()) { error = "Requested position does not project in camera model; no surface intersection"; noErrors = false; @@ -252,7 +252,7 @@ namespace Isis { if(!noErrors) { for(int i = 0; i < gp->Keywords(); i++) { - string name = (*gp)[i].Name(); + QString name = (*gp)[i].Name(); // These three keywords have 3 values, so they must have 3 N/As if(name == "BodyFixedCoordinate" || name == "SpacecraftPosition" || name == "SunPosition") { @@ -267,11 +267,11 @@ namespace Isis { // Set all keywords that still have valid information gp->FindKeyword("Error").SetValue(error); gp->FindKeyword("FileName").SetValue(currentCube->getFileName()); - gp->FindKeyword("Sample").SetValue(camera->Sample()); - gp->FindKeyword("Line").SetValue(camera->Line()); - gp->FindKeyword("EphemerisTime").SetValue(camera->time().Et(), "seconds"); + gp->FindKeyword("Sample").SetValue(toString(camera->Sample())); + gp->FindKeyword("Line").SetValue(toString(camera->Line())); + gp->FindKeyword("EphemerisTime").SetValue(toString(camera->time().Et()), "seconds"); gp->FindKeyword("EphemerisTime").AddComment("Time"); - string utc = camera->time().UTC(); + QString utc = camera->time().UTC(); gp->FindKeyword("UTC").SetValue(utc); gp->FindKeyword("SpacecraftPosition").AddComment("Spacecraft Information"); gp->FindKeyword("SunPosition").AddComment("Sun Information"); @@ -288,98 +288,98 @@ namespace Isis { currentCube->read(b); double pB[3], spB[3], sB[3]; - string utc; + QString utc; double ssplat, ssplon, sslat, sslon, pwlon, oglat; { gp->FindKeyword("FileName").SetValue(currentCube->getFileName()); - gp->FindKeyword("Sample").SetValue(camera->Sample()); - gp->FindKeyword("Line").SetValue(camera->Line()); + gp->FindKeyword("Sample").SetValue(toString(camera->Sample())); + gp->FindKeyword("Line").SetValue(toString(camera->Line())); gp->FindKeyword("PixelValue").SetValue(PixelToString(b[0])); - gp->FindKeyword("RightAscension").SetValue(camera->RightAscension()); - gp->FindKeyword("Declination").SetValue(camera->Declination()); - gp->FindKeyword("PlanetocentricLatitude").SetValue(camera->UniversalLatitude()); + gp->FindKeyword("RightAscension").SetValue(toString(camera->RightAscension())); + gp->FindKeyword("Declination").SetValue(toString(camera->Declination())); + gp->FindKeyword("PlanetocentricLatitude").SetValue(toString(camera->UniversalLatitude())); // Convert lat to planetographic Distance radii[3]; camera->radii(radii); oglat = Isis::Projection::ToPlanetographic(camera->UniversalLatitude(), radii[0].kilometers(), radii[2].kilometers()); - gp->FindKeyword("PlanetographicLatitude").SetValue(oglat); + gp->FindKeyword("PlanetographicLatitude").SetValue(toString(oglat)); - gp->FindKeyword("PositiveEast360Longitude").SetValue( - camera->UniversalLongitude()); + gp->FindKeyword("PositiveEast360Longitude").SetValue(toString( + camera->UniversalLongitude())); //Convert lon to -180 - 180 range - gp->FindKeyword("PositiveEast180Longitude").SetValue( + gp->FindKeyword("PositiveEast180Longitude").SetValue(toString( Isis::Projection::To180Domain( - camera->UniversalLongitude())); + camera->UniversalLongitude()))); //Convert lon to positive west pwlon = Isis::Projection::ToPositiveWest(camera->UniversalLongitude(), 360); - gp->FindKeyword("PositiveWest360Longitude").SetValue(pwlon); + gp->FindKeyword("PositiveWest360Longitude").SetValue(toString(pwlon)); //Convert pwlon to -180 - 180 range - gp->FindKeyword("PositiveWest180Longitude").SetValue( - Isis::Projection::To180Domain(pwlon)); + gp->FindKeyword("PositiveWest180Longitude").SetValue(toString( + Isis::Projection::To180Domain(pwlon))); camera->Coordinate(pB); - gp->FindKeyword("BodyFixedCoordinate").AddValue(pB[0], "km"); - gp->FindKeyword("BodyFixedCoordinate").AddValue(pB[1], "km"); - gp->FindKeyword("BodyFixedCoordinate").AddValue(pB[2], "km"); + gp->FindKeyword("BodyFixedCoordinate").AddValue(toString(pB[0]), "km"); + gp->FindKeyword("BodyFixedCoordinate").AddValue(toString(pB[1]), "km"); + gp->FindKeyword("BodyFixedCoordinate").AddValue(toString(pB[2]), "km"); - gp->FindKeyword("LocalRadius").SetValue(camera->LocalRadius().meters(), "meters"); - gp->FindKeyword("SampleResolution").SetValue(camera->SampleResolution(), "meters/pixel"); - gp->FindKeyword("LineResolution").SetValue(camera->LineResolution(), "meters/pixel"); + gp->FindKeyword("LocalRadius").SetValue(toString(camera->LocalRadius().meters()), "meters"); + gp->FindKeyword("SampleResolution").SetValue(toString(camera->SampleResolution()), "meters/pixel"); + gp->FindKeyword("LineResolution").SetValue(toString(camera->LineResolution()), "meters/pixel"); camera->instrumentPosition(spB); - gp->FindKeyword("SpacecraftPosition").AddValue(spB[0], "km"); - gp->FindKeyword("SpacecraftPosition").AddValue(spB[1], "km"); - gp->FindKeyword("SpacecraftPosition").AddValue(spB[2], "km"); + gp->FindKeyword("SpacecraftPosition").AddValue(toString(spB[0]), "km"); + gp->FindKeyword("SpacecraftPosition").AddValue(toString(spB[1]), "km"); + gp->FindKeyword("SpacecraftPosition").AddValue(toString(spB[2]), "km"); gp->FindKeyword("SpacecraftPosition").AddComment("Spacecraft Information"); - gp->FindKeyword("SpacecraftAzimuth").SetValue(camera->SpacecraftAzimuth()); - gp->FindKeyword("SlantDistance").SetValue(camera->SlantDistance(), "km"); - gp->FindKeyword("TargetCenterDistance").SetValue(camera->targetCenterDistance(), "km"); + gp->FindKeyword("SpacecraftAzimuth").SetValue(toString(camera->SpacecraftAzimuth())); + gp->FindKeyword("SlantDistance").SetValue(toString(camera->SlantDistance()), "km"); + gp->FindKeyword("TargetCenterDistance").SetValue(toString(camera->targetCenterDistance()), "km"); camera->subSpacecraftPoint(ssplat, ssplon); - gp->FindKeyword("SubSpacecraftLatitude").SetValue(ssplat); - gp->FindKeyword("SubSpacecraftLongitude").SetValue(ssplon); - gp->FindKeyword("SpacecraftAltitude").SetValue(camera->SpacecraftAltitude(), "km"); - gp->FindKeyword("OffNadirAngle").SetValue(camera->OffNadirAngle()); + gp->FindKeyword("SubSpacecraftLatitude").SetValue(toString(ssplat)); + gp->FindKeyword("SubSpacecraftLongitude").SetValue(toString(ssplon)); + gp->FindKeyword("SpacecraftAltitude").SetValue(toString(camera->SpacecraftAltitude()), "km"); + gp->FindKeyword("OffNadirAngle").SetValue(toString(camera->OffNadirAngle())); double subspcgrdaz; subspcgrdaz = camera->GroundAzimuth(camera->UniversalLatitude(), camera->UniversalLongitude(), ssplat, ssplon); - gp->FindKeyword("SubSpacecraftGroundAzimuth").SetValue(subspcgrdaz); + gp->FindKeyword("SubSpacecraftGroundAzimuth").SetValue(toString(subspcgrdaz)); camera->sunPosition(sB); - gp->FindKeyword("SunPosition").AddValue(sB[0], "km"); - gp->FindKeyword("SunPosition").AddValue(sB[1], "km"); - gp->FindKeyword("SunPosition").AddValue(sB[2], "km"); + gp->FindKeyword("SunPosition").AddValue(toString(sB[0]), "km"); + gp->FindKeyword("SunPosition").AddValue(toString(sB[1]), "km"); + gp->FindKeyword("SunPosition").AddValue(toString(sB[2]), "km"); gp->FindKeyword("SunPosition").AddComment("Sun Information"); - gp->FindKeyword("SubSolarAzimuth").SetValue(camera->SunAzimuth()); - gp->FindKeyword("SolarDistance").SetValue(camera->SolarDistance(), "AU"); + gp->FindKeyword("SubSolarAzimuth").SetValue(toString(camera->SunAzimuth())); + gp->FindKeyword("SolarDistance").SetValue(toString(camera->SolarDistance()), "AU"); camera->subSolarPoint(sslat, sslon); - gp->FindKeyword("SubSolarLatitude").SetValue(sslat); - gp->FindKeyword("SubSolarLongitude").SetValue(sslon); + gp->FindKeyword("SubSolarLatitude").SetValue(toString(sslat)); + gp->FindKeyword("SubSolarLongitude").SetValue(toString(sslon)); double subsolgrdaz; subsolgrdaz = camera->GroundAzimuth(camera->UniversalLatitude(), camera->UniversalLongitude(), sslat, sslon); - gp->FindKeyword("SubSolarGroundAzimuth").SetValue(subsolgrdaz); + gp->FindKeyword("SubSolarGroundAzimuth").SetValue(toString(subsolgrdaz)); - gp->FindKeyword("Phase").SetValue(camera->PhaseAngle()); + gp->FindKeyword("Phase").SetValue(toString(camera->PhaseAngle())); gp->FindKeyword("Phase").AddComment("Illumination and Other"); - gp->FindKeyword("Incidence").SetValue(camera->IncidenceAngle()); - gp->FindKeyword("Emission").SetValue(camera->EmissionAngle()); - gp->FindKeyword("NorthAzimuth").SetValue(camera->NorthAzimuth()); + gp->FindKeyword("Incidence").SetValue(toString(camera->IncidenceAngle())); + gp->FindKeyword("Emission").SetValue(toString(camera->EmissionAngle())); + gp->FindKeyword("NorthAzimuth").SetValue(toString(camera->NorthAzimuth())); - gp->FindKeyword("EphemerisTime").SetValue(camera->time().Et(), "seconds"); + gp->FindKeyword("EphemerisTime").SetValue(toString(camera->time().Et()), "seconds"); gp->FindKeyword("EphemerisTime").AddComment("Time"); utc = camera->time().UTC(); gp->FindKeyword("UTC").SetValue(utc); - gp->FindKeyword("LocalSolarTime").SetValue(camera->LocalSolarTime(), "hour"); - gp->FindKeyword("SolarLongitude").SetValue(camera->solarLongitude().degrees()); + gp->FindKeyword("LocalSolarTime").SetValue(toString(camera->LocalSolarTime()), "hour"); + gp->FindKeyword("SolarLongitude").SetValue(toString(camera->solarLongitude().degrees())); if(allowErrors) gp->FindKeyword("Error").SetValue("N/A"); } } diff --git a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.h b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.h index 1edd99be02..65c503ab2b 100644 --- a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.h +++ b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.h @@ -23,7 +23,7 @@ #ifndef CameraPointInfo_h #define CameraPointInfo_h -#include +#include namespace Isis { class CubeManager; @@ -91,7 +91,7 @@ namespace Isis { CameraPointInfo(); virtual ~CameraPointInfo(); - void SetCube(const std::string &cubeFileName); + void SetCube(const QString &cubeFileName); PvlGroup *SetImage(const double sample, const double line, const bool outside = false, const bool error = false); PvlGroup *SetCenter(const bool outside = false, const bool error = false); diff --git a/isis/src/base/objs/CameraPointInfo/unitTest.cpp b/isis/src/base/objs/CameraPointInfo/unitTest.cpp index 459235734e..7ed1c1ea16 100644 --- a/isis/src/base/objs/CameraPointInfo/unitTest.cpp +++ b/isis/src/base/objs/CameraPointInfo/unitTest.cpp @@ -38,9 +38,9 @@ int main() { } void LowerPrecision(PvlKeyword &keyword) { - double value = keyword[0]; + double value = toDouble(keyword[0]); value = round(value * 1000) / 1000.0; - keyword[0] = value; + keyword[0] = toString(value); } void PrintResults(PvlGroup &grp) { diff --git a/isis/src/base/objs/CameraStatistics/CameraStatistics.cpp b/isis/src/base/objs/CameraStatistics/CameraStatistics.cpp index 4a2426ffbf..af48aabc88 100644 --- a/isis/src/base/objs/CameraStatistics/CameraStatistics.cpp +++ b/isis/src/base/objs/CameraStatistics/CameraStatistics.cpp @@ -24,7 +24,7 @@ namespace Isis { * @param sinc Sample increment for gathering statistics * @param linc Line increment for gathering statistics */ - CameraStatistics::CameraStatistics(std::string filename, int sinc, int linc) { + CameraStatistics::CameraStatistics(QString filename, int sinc, int linc) { Cube cube; cube.open(filename); Camera *cam = cube.getCamera(); @@ -66,7 +66,7 @@ namespace Isis { * @param filename String filename of the Cube whose Camera is being used */ CameraStatistics::CameraStatistics(Camera *cam, int sinc, int linc, - std::string filename) { + QString filename) { init(cam, sinc, linc, filename); } @@ -84,7 +84,7 @@ namespace Isis { * @param filename String filename of the Cube whose Camera is being used */ void CameraStatistics::init(Camera *cam, int sinc, int linc, - std::string filename) { + QString filename) { m_filename = filename; m_sinc = sinc; @@ -236,14 +236,14 @@ namespace Isis { * * @return PvlKeyword Keyword constructed from input parameters */ - PvlKeyword CameraStatistics::constructKeyword(std::string keyname, - double value, std::string unit="") const { + PvlKeyword CameraStatistics::constructKeyword(QString keyname, + double value, QString unit="") const { if(IsSpecial(value)) { return (PvlKeyword(keyname, "NULL")); } else { - return (PvlKeyword(keyname, value, unit)); + return (PvlKeyword(keyname, toString(value), unit)); } } @@ -327,8 +327,8 @@ namespace Isis { // object PvlGroup pUser("User Parameters"); if (m_filename != "") pUser += PvlKeyword("Filename", m_filename); - pUser += PvlKeyword("Linc", m_linc); - pUser += PvlKeyword("Sinc", m_sinc); + pUser += PvlKeyword("Linc", toString(m_linc)); + pUser += PvlKeyword("Sinc", toString(m_sinc)); PvlGroup pLat("Latitude"); pLat += constructKeyword("LatitudeMinimum", m_latStat->Minimum()); diff --git a/isis/src/base/objs/CameraStatistics/CameraStatistics.h b/isis/src/base/objs/CameraStatistics/CameraStatistics.h index b757b88ae6..fb540d2d1a 100644 --- a/isis/src/base/objs/CameraStatistics/CameraStatistics.h +++ b/isis/src/base/objs/CameraStatistics/CameraStatistics.h @@ -24,7 +24,7 @@ * http://www.usgs.gov/privacy.html. */ -#include +#include namespace Isis { class Camera; @@ -54,14 +54,14 @@ namespace Isis { class CameraStatistics { public: - CameraStatistics(std::string filename, int sinc, int linc); + CameraStatistics(QString filename, int sinc, int linc); CameraStatistics(Camera *cam, int sinc, int linc); - CameraStatistics(Camera *cam, int sinc, int linc, std::string filename); + CameraStatistics(Camera *cam, int sinc, int linc, QString filename); virtual ~CameraStatistics(); void addStats(Camera *cam, int &sample, int &line); - PvlKeyword constructKeyword(std::string keyname, double value, - std::string unit) const; + PvlKeyword constructKeyword(QString keyname, double value, + QString unit) const; Pvl toPvl() const; @@ -197,10 +197,10 @@ namespace Isis { }; private: - void init(Camera *cam, int sinc, int linc, std::string filename); + void init(Camera *cam, int sinc, int linc, QString filename); //!< FileName of the Cube the Camera was derived from. - std::string m_filename; + QString m_filename; int m_sinc; //!< Sample increment for composing statistics. int m_linc; //!< Line increment for composing statistics. diff --git a/isis/src/base/objs/CameraStatistics/unitTest.cpp b/isis/src/base/objs/CameraStatistics/unitTest.cpp index 78bb49754d..8f7d762179 100644 --- a/isis/src/base/objs/CameraStatistics/unitTest.cpp +++ b/isis/src/base/objs/CameraStatistics/unitTest.cpp @@ -8,35 +8,36 @@ #include "Preference.h" #include "Statistics.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); try { cout << "UnitTest for Camera Statistics" << endl; - Isis::Cube cube; + Cube cube; cube.open("$Clementine1/testData/lna1391h.cub"); - Isis::Camera *cam = cube.getCamera(); + Camera *cam = cube.getCamera(); cout << setprecision(6); - Isis::CameraStatistics camStats(cam, 1, 1); - Isis::Pvl statsPvl = camStats.toPvl(); + CameraStatistics camStats(cam, 1, 1); + Pvl statsPvl = camStats.toPvl(); cout << endl; for (int i = 0; i < statsPvl.Groups(); i++) { - Isis::PvlGroup &group = statsPvl.Group(i); + PvlGroup &group = statsPvl.Group(i); cout << group.Name() << ":" << endl; for (int j = 0; j < group.Keywords(); j++) { - Isis::PvlKeyword &keyword = group[j]; - cout << " " << keyword.Name() << " = " << (double) keyword[0] << endl; + PvlKeyword &keyword = group[j]; + cout << " " << keyword.Name() << " = " << toDouble(keyword[0]) << endl; } cout << endl; } } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/Chip/Chip.cpp b/isis/src/base/objs/Chip/Chip.cpp index 47f91b5947..81fddba5a4 100644 --- a/isis/src/base/objs/Chip/Chip.cpp +++ b/isis/src/base/objs/Chip/Chip.cpp @@ -328,7 +328,7 @@ namespace Isis { matchProj = matchChipCube.getProjection(); } catch(IException &error2) { - string msg = "Can not geom chip. "; + QString msg = "Can not geom chip. "; msg += "Match chip cube [" + matchChipCube.getFileName(); msg += "] is not a camera or map projection"; @@ -351,7 +351,7 @@ namespace Isis { proj = cube.getProjection(); } catch(IException &error2) { - string msg = "Can not geom chip. "; + QString msg = "Can not geom chip. "; msg += "Chip cube [" + cube.getFileName(); msg += "] is not a camera or map projection"; @@ -515,7 +515,7 @@ namespace Isis { } if(xp.size() < 3) { - string msg = "Cannot find enough points to perform Affine transformation. "; + QString msg = "Cannot find enough points to perform Affine transformation. "; msg += "Unable to load chip from [" + cube.getFileName(); msg += "] to match chip from [" + matchChipCube.getFileName() + "]."; throw IException(IException::User, msg, _FILEINFO_); @@ -1033,7 +1033,7 @@ namespace Isis { * * @param filename Name of the cube to create */ - void Chip::Write(const string &filename) { + void Chip::Write(const QString &filename) { Cube c; c.setDimensions(Samples(), Lines(), 1); c.create(filename); diff --git a/isis/src/base/objs/Chip/Chip.h b/isis/src/base/objs/Chip/Chip.h index ca2fce7079..0aac51904a 100644 --- a/isis/src/base/objs/Chip/Chip.h +++ b/isis/src/base/objs/Chip/Chip.h @@ -26,13 +26,13 @@ #include +#include + #include "Affine.h" #include "Interpolator.h" #include "Pvl.h" #include "SpecialPixel.h" -#include "geos/geom/MultiPolygon.h" -using namespace std; namespace Isis { class Cube; class Statistics; @@ -134,7 +134,7 @@ namespace Isis { //! Returns the expanded filename of the cube from //! which this chip was chipped. - inline string FileName() const { + inline QString FileName() const { return p_filename; }; @@ -253,7 +253,7 @@ namespace Isis { void Extract(int samp, int line, Chip &output); Isis::Statistics *Statistics(); void Extract(Chip &output, Affine &affine); - void Write(const string &filename); + void Write(const QString &filename); void SetClipPolygon(const geos::geom::MultiPolygon &clipPolygon); @@ -330,25 +330,25 @@ namespace Isis { return; } // Interpolator::None is not valid type - string msg = "Invalid Interpolator type. Cannot use ["; - msg += IString(type) + "] to read cube into chip."; + QString msg = "Invalid Interpolator type. Cannot use ["; + msg += toString(type) + "] to read cube into chip."; throw IException(IException::Programmer, msg, _FILEINFO_); } private: void Init(const int samples, const int lines); void Read(Cube &cube, const int band); - vector MovePoints(const int startSamp, const int startLine, - const int endSamp, const int endLine); - bool PointsColinear(const double x0, const double y0, - const double x1, const double y1, - const double x2, const double y2, - const double tol); + std::vector MovePoints(int startSamp, int startLine, + int endSamp, int endLine); + bool PointsColinear(double x0, double y0, + double x1, double y1, + double x2, double y2, + double tol); int p_chipSamples; //!< Number of samples in the chip int p_chipLines; //!< Number of lines in the chip - vector > p_buf; //!< Chip buffer + std::vector< std::vector > p_buf; //!< Chip buffer int p_tackSample; //!< Middle sample of the chip int p_tackLine; //!< Middle line of the chip @@ -366,7 +366,7 @@ namespace Isis { Affine p_affine; //!< Transform set by SetTransform. Used to load cubes into chip Interpolator::interpType p_readInterpolator; //!< Interpolator type set by SetReadInterpolator. Used to read cubes into chip. - string p_filename; //!< FileName of loaded cube + QString p_filename; //!< FileName of loaded cube }; }; diff --git a/isis/src/base/objs/Chip/Chip.truth b/isis/src/base/objs/Chip/Chip.truth index bfb6bb3062..5987e9e05b 100644 --- a/isis/src/base/objs/Chip/Chip.truth +++ b/isis/src/base/objs/Chip/Chip.truth @@ -176,21 +176,21 @@ Try to set chip size with input parameter equal to 0: **USER ERROR** Unable to set chip size to [0, 1]. Samples and lines must be greater than zero. Try to load a cube that is not camera or map projection: -**USER ERROR** Can not geom chip. Chip cube [junk.cub] is not a camera or map projection. -**ERROR** Unable to initialize cube projection from file [junk.cub]. -**ERROR** Unable to find PVL group [Mapping] in file [junk.cub]. +**USER ERROR** Can not geom chip. Chip cube [] is not a camera or map projection. +**ERROR** Unable to initialize cube projection from file []. +**ERROR** Unable to find PVL group [Mapping] in file []. **ERROR** Unable to initialize camera model from group [Instrument]. -**ERROR** Unable to find PVL group [Instrument] in file [junk.cub]. +**ERROR** Unable to find PVL group [Instrument] in file []. Try to load a cube with a match cube that is not camera or map projection: -**USER ERROR** Can not geom chip. Match chip cube [junk.cub] is not a camera or map projection. -**ERROR** Unable to initialize cube projection from file [junk.cub]. -**ERROR** Unable to find PVL group [Mapping] in file [junk.cub]. +**USER ERROR** Can not geom chip. Match chip cube [] is not a camera or map projection. +**ERROR** Unable to initialize cube projection from file []. +**ERROR** Unable to find PVL group [Mapping] in file []. **ERROR** Unable to initialize camera model from group [Instrument]. -**ERROR** Unable to find PVL group [Instrument] in file [junk.cub]. +**ERROR** Unable to find PVL group [Instrument] in file []. Try to load a cube with match chip and cube that can not find at least 3 points for Affine Transformation: -**USER ERROR** Cannot find enough points to perform Affine transformation. Unable to load chip from [ab102401_ideal.cub] to match chip from [f319b18_ideal.cub]. +**USER ERROR** Cannot find enough points to perform Affine transformation. Unable to load chip from [] to match chip from []. Try to set valid range with larger number passed in as first parameter: **PROGRAMMER ERROR** Unable to set valid chip range to [4.0, 3.0]. First parameter must be smaller than the second. diff --git a/isis/src/base/objs/Chip/unitTest.cpp b/isis/src/base/objs/Chip/unitTest.cpp index ade0d5cfa1..e88a6388cf 100644 --- a/isis/src/base/objs/Chip/unitTest.cpp +++ b/isis/src/base/objs/Chip/unitTest.cpp @@ -20,9 +20,10 @@ using namespace std; using namespace Isis; +void ReportError(QString err); + int main() { Preference::Preferences(true); - void ReportError(IString err); Chip chip(51, 50); cout << "Test basics" << endl; cout << chip.Samples() << endl; @@ -379,41 +380,7 @@ int main() { * @internal * @history 2010-06-15 Jeannie Walldren - Original version. */ -void ReportError(IString err) { - IString report = ""; // report will be modified error message - IString errorLine = ""; // read message one line at a time - FileName expandedfile; - while(err != "") { - // pull off first line - errorLine = err.Token("\n"); - while(errorLine != "") { - size_t openBrace = errorLine.find('['); - if(openBrace != string::npos) { - // if open brace is found, look to see if a filename is inside (indicated by '/') - if(errorLine.at(openBrace + 1) == '/') { - // add message up to and including [ - report += errorLine.Token("["); - report += "["; - // read entire path into FileName object - expandedfile = errorLine.Token("]"); - report += expandedfile.name(); // only report base name, rather than fully expanded path - report += "]"; - } - else { - // not a filename inside braces, add message up to and including ] - report += errorLine.Token("]"); - report += "]"; - continue; - } - } - else { - // no more braces are found, add rest of error message - report += errorLine; - break; - } - } - report += "\n"; - } - cout << report << endl; +void ReportError(QString err) { + cout << err.replace(QRegExp("\\[[^\\]]*\\.cub\\]"), "[]") << endl << endl; } diff --git a/isis/src/base/objs/CollectorMap/CollectorMap.h b/isis/src/base/objs/CollectorMap/CollectorMap.h index 1ec052e1c3..10742f35b4 100644 --- a/isis/src/base/objs/CollectorMap/CollectorMap.h +++ b/isis/src/base/objs/CollectorMap/CollectorMap.h @@ -23,15 +23,15 @@ * http://www.usgs.gov/privacy.html. */ #include -#include +#include #include #include #include #include #include #include -#include "IString.h" #include "IException.h" +#include "IString.h" #include @@ -294,7 +294,7 @@ namespace Isis { * // keys without regard to case via the NoCaseStringCompare. * #include "CollectorMap.h" * - * CollectorMap dmap; + * CollectorMap dmap; * cout << "\nSize of double map = " << dmap.size() << endl; * dmap.add("one", 1.0); * dmap.add("two", 2.0); @@ -351,7 +351,7 @@ namespace Isis { * @code * #include "CollectorMap.h" * - * typedef CollectorMap IntStr; + * typedef CollectorMap IntStr; * IntStr dupstr(IntStr::DuplicateKeys); * dupstr.add(1,"One"); * dupstr.add(1, "One #2"); @@ -568,7 +568,7 @@ namespace Isis { T &get(const K &key) { CollectorIter cItr = _list.find(key); if(cItr == _list.end()) { - std::string mess = "Requested value does not exist!"; + QString mess = "Requested value does not exist!"; throw IException(IException::Programmer, mess, _FILEINFO_); } return (cItr->second); @@ -582,7 +582,7 @@ namespace Isis { const T &get(const K &key) const { CollectorConstIter cItr = _list.find(key); if(cItr == _list.end()) { - std::string mess = "Requested value does not exist!"; + QString mess = "Requested value does not exist!"; throw IException(IException::Programmer, mess, _FILEINFO_); } return (cItr->second); diff --git a/isis/src/base/objs/CollectorMap/unitTest.cpp b/isis/src/base/objs/CollectorMap/unitTest.cpp index caa311fd45..8b50ba027c 100644 --- a/isis/src/base/objs/CollectorMap/unitTest.cpp +++ b/isis/src/base/objs/CollectorMap/unitTest.cpp @@ -109,14 +109,14 @@ class TestCollector { private: CollectorMap _list; CollectorMap _flist; - CollectorMap _slist; + CollectorMap _slist; }; int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); - typedef CollectorMap NoCaseStrings; + typedef CollectorMap NoCaseStrings; NoCaseStrings dmap; cout << "\nSize of double map = " << dmap.size() << endl; @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) { cout << "\n\nCreate array of 10 doubles...\n"; - typedef CollectorMap < std::string, double *, + typedef CollectorMap < IString, double *, NoCaseStringCompare, NoopRemoval, DefaultCopy > ArrayMap; @@ -232,7 +232,7 @@ int main(int argc, char *argv[]) { // Test duplicate keys cout << "\n\nTesting Duplicate Keys...\n"; - typedef CollectorMap IntStr; + typedef CollectorMap IntStr; IntStr dupstr(IntStr::DuplicateKeys); dupstr.add(1, "One"); dupstr.add(1, "One #2"); diff --git a/isis/src/base/objs/Column/Column.cpp b/isis/src/base/objs/Column/Column.cpp index 7f17fc484d..3a151434f4 100644 --- a/isis/src/base/objs/Column/Column.cpp +++ b/isis/src/base/objs/Column/Column.cpp @@ -48,7 +48,7 @@ namespace Isis { * @param type The type of information the column is to represent * @param align The alignment, within the column, the data is to conform to */ - Column::Column(std::string name, int width, Column::Type type, Column::Align align) { + Column::Column(QString name, int width, Column::Type type, Column::Align align) { p_precision = 4; p_width = 0; p_name = ""; @@ -67,9 +67,9 @@ namespace Isis { * * @param name The name of the Column */ - void Column::SetName(std::string name) { - if (p_width != 0 && name.length() > p_width) { - IString message = "Name[" + name + "] is wider than width"; + void Column::SetName(QString name) { + if (p_width != 0 && name.length() > (int)p_width) { + QString message = "Name [" + name + "] is wider than width"; throw IException(IException::User, message, _FILEINFO_); } p_name = name; @@ -81,8 +81,8 @@ namespace Isis { * @param width The number of text columns the Column will hold */ void Column::SetWidth(unsigned int width) { - if (p_name.size() > 0 && p_name.size() > width) { - std::string message = "Width is insufficient to contain name["; + if (p_name.size() > 0 && p_name.size() > (int)width) { + QString message = "Width is insufficient to contain name["; message += p_name + "]"; throw IException(IException::User, message, _FILEINFO_); } @@ -97,7 +97,7 @@ namespace Isis { void Column::SetType(Column::Type type) { if (p_align == Column::Decimal && (type == Column::Integer || type == Column::String)) { - std::string message = "Integer or string type is not sensible if "; + QString message = "Integer or string type is not sensible if "; message += "alignment is Decimal."; throw IException(IException::User, message, _FILEINFO_); } @@ -116,7 +116,7 @@ namespace Isis { void Column::SetAlignment(Column::Align alignment) { if (alignment == Column::Decimal && (p_type == Column::Integer || p_type == Column::String)) { - std::string message = "Decimal alignment does not make sense for "; + QString message = "Decimal alignment does not make sense for "; message += "integer or string values."; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -134,14 +134,14 @@ namespace Isis { void Column::SetPrecision(unsigned int precision) { if (DataType() != Column::Real && DataType() != Column::Pixel) { - std::string message = "Setting precision only makes sense for Decimal Alignment"; + QString message = "Setting precision only makes sense for Decimal Alignment"; throw IException(IException::User, message, _FILEINFO_); } p_precision = precision; } //! get the Column's name - std::string Column::Name() const { + QString Column::Name() const { return p_name; } diff --git a/isis/src/base/objs/Column/Column.h b/isis/src/base/objs/Column/Column.h index a4f79b2aa4..bea2a965a1 100644 --- a/isis/src/base/objs/Column/Column.h +++ b/isis/src/base/objs/Column/Column.h @@ -24,7 +24,8 @@ */ #include -#include + +#include namespace Isis { /** @@ -74,14 +75,14 @@ namespace Isis { }; Column(); - Column(std::string name, int width, Column::Type type, Column::Align align = Right); - void SetName(std::string name); + Column(QString name, int width, Column::Type type, Column::Align align = Right); + void SetName(QString name); void SetWidth(unsigned int width); void SetType(Column::Type type); void SetAlignment(Column::Align alignment); void SetPrecision(unsigned int precision); - std::string Name() const; + QString Name() const; unsigned int Width() const; Column::Type DataType() const; Column::Align Alignment() const; @@ -90,7 +91,7 @@ namespace Isis { private: //! Name of the Column - std::string p_name; + QString p_name; //! Width of the Column unsigned int p_width; diff --git a/isis/src/base/objs/Column/Column.truth b/isis/src/base/objs/Column/Column.truth index 077723ad3b..e95c6757b4 100644 --- a/isis/src/base/objs/Column/Column.truth +++ b/isis/src/base/objs/Column/Column.truth @@ -7,7 +7,7 @@ Column "" Alignment() = 0 Precision() = 4 -**USER ERROR** Name[test column] is wider than width. +**USER ERROR** Name [test column] is wider than width. **USER ERROR** Setting precision only makes sense for Decimal Alignment. **USER ERROR** Width is insufficient to contain name[test column]. Column "" diff --git a/isis/src/base/objs/Cube/Cube.cpp b/isis/src/base/objs/Cube/Cube.cpp index 1c6c764936..585cd82aba 100644 --- a/isis/src/base/objs/Cube/Cube.cpp +++ b/isis/src/base/objs/Cube/Cube.cpp @@ -135,7 +135,7 @@ namespace Isis { bool readOnly = false; if (!isOpen()) { - IString msg = "No cube opened"; + QString msg = "No cube opened"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -220,9 +220,9 @@ namespace Isis { result->setBaseMultiplier(getBase(), getMultiplier()); } else { - IString msg = + QString msg = QObject::tr("Cannot reduce the output PixelType for [%1] from [%2] without output " - "pixel range").arg(newFile.original().ToQt()).arg(getFileName().ToQt()); + "pixel range").arg(newFile.original()).arg(getFileName()); throw IException(IException::User, msg, _FILEINFO_); } } @@ -255,7 +255,7 @@ namespace Isis { PvlObject &obj = m_label->Object(i); if (obj.IsNamed("Table") || obj.IsNamed("Polygon") || obj.IsNamed("OriginalLabel") || obj.IsNamed("History")) { - Isis::Blob t((string)obj["Name"], obj.Name()); + Isis::Blob t((QString)obj["Name"], obj.Name()); read(t); result->write(t); } @@ -319,7 +319,7 @@ namespace Isis { * is forced). Environment variables in the filename will be * automatically expanded as well. */ - void Cube::create(const IString &cubeFileName) { + void Cube::create(const QString &cubeFileName) { // Already opened? if (isOpen()) { string msg = "You already have a cube opened"; @@ -327,8 +327,8 @@ namespace Isis { } if (m_samples < 1 || m_lines < 1 || m_bands < 1) { - IString msg = "Number of samples [" + IString(m_samples) + - "], lines [" + IString(m_lines) + "], or bands [" + IString(m_bands) + + QString msg = "Number of samples [" + toString(m_samples) + + "], lines [" + toString(m_lines) + "], or bands [" + toString(m_bands) + "] cannot be less than 1"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -336,7 +336,7 @@ namespace Isis { if (m_pixelType == None) { throw IException(IException::Unknown, QString("Cannot create the cube [%1] with a pixel type set to None") - .arg(cubeFileName.ToQt()), + .arg(cubeFileName), _FILEINFO_); } @@ -355,13 +355,13 @@ namespace Isis { Preference::Preferences().FindGroup("CubeCustomization")["MaximumSize"]; if (size > maxSizePreference) { - string msg; + QString msg; msg += "The cube you are attempting to create [" + cubeFileName + "] is [" - + IString(size) + "GB]. This is larger than the current allowed " - "size of [" + IString(maxSizePreference) + "GB]. The cube " - "dimensions were (S,L,B) [" + IString(m_samples) + ", " + - IString(m_lines) + ", " + IString(m_bands) + "] with [" + - IString(SizeOf(m_pixelType)) + "] bytes per pixel. If you still " + + toString(size) + "GB]. This is larger than the current allowed " + "size of [" + toString(maxSizePreference) + "GB]. The cube " + "dimensions were (S,L,B) [" + toString(m_samples) + ", " + + toString(m_lines) + ", " + toString(m_bands) + "] with [" + + toString(SizeOf(m_pixelType)) + "] bytes per pixel. If you still " "wish to create this cube, the maximum value can be changed in the" " file [~/.Isis/IsisPreferences] within the group " "CubeCustomization, keyword MaximumSize."; @@ -380,13 +380,13 @@ namespace Isis { // See if we have attached or detached labels if (m_attached) { // StartByte is 1-based (why!!) so we need to do + 1 - core += PvlKeyword("StartByte", m_labelBytes + 1); + core += PvlKeyword("StartByte", toString(m_labelBytes + 1)); m_labelFileName = new FileName(cubFile); m_dataFileName = new FileName(cubFile); m_labelFile = new QFile(m_labelFileName->expanded()); } else { - core += PvlKeyword("StartByte", 1); + core += PvlKeyword("StartByte", toString(1)); core += PvlKeyword("^Core", cubFile.name()); m_dataFileName = new FileName(cubFile); m_dataFile = new QFile(getRealDataFileName().expanded()); @@ -399,9 +399,9 @@ namespace Isis { // Create the size of the core PvlGroup dims("Dimensions"); - dims += PvlKeyword("Samples", m_samples); - dims += PvlKeyword("Lines", m_lines); - dims += PvlKeyword("Bands", m_bands); + dims += PvlKeyword("Samples", toString(m_samples)); + dims += PvlKeyword("Lines", toString(m_lines)); + dims += PvlKeyword("Bands", toString(m_bands)); core.AddGroup(dims); // Create the pixel type @@ -410,8 +410,8 @@ namespace Isis { // And the byte ordering ptype += PvlKeyword("ByteOrder", ByteOrderName(m_byteOrder)); - ptype += PvlKeyword("Base", m_base); - ptype += PvlKeyword("Multiplier", m_multiplier); + ptype += PvlKeyword("Base", toString(m_base)); + ptype += PvlKeyword("Multiplier", toString(m_multiplier)); core.AddGroup(ptype); } else { @@ -434,32 +434,32 @@ namespace Isis { // Setup storage reserved for the label PvlObject lbl("Label"); - lbl += PvlKeyword("Bytes", m_labelBytes); + lbl += PvlKeyword("Bytes", toString(m_labelBytes)); m_label->AddObject(lbl); const PvlGroup &pref = Preference::Preferences().FindGroup("CubeCustomization"); - bool overwrite = pref["Overwrite"][0].UpCase() == "ALLOW"; + bool overwrite = pref["Overwrite"][0].toUpper() == "ALLOW"; if (!overwrite && m_labelFile->exists() && m_labelFile->size()) { - string msg = "Cube file [" + m_labelFileName->original() + "] exists, " + + QString msg = "Cube file [" + m_labelFileName->original() + "] exists, " + "user preference does not allow overwrite"; throw IException(IException::User, msg, _FILEINFO_); } if (!m_labelFile->open(QIODevice::Truncate | QIODevice::ReadWrite)) { - IString msg = "Failed to create [" + m_labelFile->fileName() + "]"; + QString msg = "Failed to create [" + m_labelFile->fileName() + "]"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); } if (m_dataFile) { if (m_storesDnData && !m_dataFile->open(QIODevice::Truncate | QIODevice::ReadWrite)) { - IString msg = "Failed to create [" + m_dataFile->fileName() + "]"; + QString msg = "Failed to create [" + m_dataFile->fileName() + "]"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); } else if (!m_storesDnData && !m_dataFile->open(QIODevice::ReadOnly)) { - IString msg = "Failed to open [" + m_dataFile->fileName() + "] for reading"; + QString msg = "Failed to open [" + m_dataFile->fileName() + "] for reading"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); } @@ -485,7 +485,7 @@ namespace Isis { void Cube::create( - const IString &cubeFileName, const CubeAttributeOutput &att) { + const QString &cubeFileName, const CubeAttributeOutput &att) { setByteOrder(att.byteOrder()); setFormat(att.fileFormat()); @@ -507,7 +507,7 @@ namespace Isis { * @param[in] access (Default value of "r") Defines how the cube will be * accessed. Either read-only "r" or read-write "rw". */ - void Cube::open(const IString &cubeFileName, IString access) { + void Cube::open(const QString &cubeFileName, QString access) { // Already opened? if (isOpen()) { string msg = "You already have a cube opened"; @@ -562,7 +562,7 @@ namespace Isis { if (access == "r") { if (!m_labelFile->open(QIODevice::ReadOnly)) { - IString msg = "Failed to open [" + m_labelFile->fileName() + "] with " + QString msg = "Failed to open [" + m_labelFile->fileName() + "] with " "read only access"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); @@ -570,7 +570,7 @@ namespace Isis { if (m_dataFile) { if (!m_dataFile->open(QIODevice::ReadOnly)) { - IString msg = "Failed to open [" + m_dataFile->fileName() + "] with " + QString msg = "Failed to open [" + m_dataFile->fileName() + "] with " "read only access"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); @@ -579,7 +579,7 @@ namespace Isis { } else if (access == "rw") { if (!m_labelFile->open(QIODevice::ReadWrite)) { - IString msg = "Failed to open [" + m_labelFile->fileName() + "] with " + QString msg = "Failed to open [" + m_labelFile->fileName() + "] with " "read/write access"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); @@ -587,13 +587,13 @@ namespace Isis { if (m_dataFile) { if (m_storesDnData && !m_dataFile->open(QIODevice::ReadWrite)) { - IString msg = "Failed to open [" + m_dataFile->fileName() + "] with " + QString msg = "Failed to open [" + m_dataFile->fileName() + "] with " "read/write access"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); } else if (!m_storesDnData && !m_dataFile->open(QIODevice::ReadOnly)) { - IString msg = "Failed to open [" + m_dataFile->fileName() + "] with " + QString msg = "Failed to open [" + m_dataFile->fileName() + "] with " "read access"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); @@ -601,7 +601,7 @@ namespace Isis { } } else { - IString msg = "Unknown value for access [" + access + "]. Expected 'r' " + QString msg = "Unknown value for access [" + access + "]. Expected 'r' " " or 'rw'"; cleanUp(false); throw IException(IException::Programmer, msg, _FILEINFO_); @@ -646,12 +646,12 @@ namespace Isis { * If access requested is read/write and the open fails, open as read only * and throw error. * - * @param[in] access (std::string) Type of access needed (read or read/write + * @param[in] access (QString) Type of access needed (read or read/write * */ - void Cube::reopen(IString access) { + void Cube::reopen(QString access) { if (!m_labelFile) { - IString msg = "Cube has not been opened yet. The filename to re-open is " + QString msg = "Cube has not been opened yet. The filename to re-open is " "unknown"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -739,7 +739,7 @@ namespace Isis { // Compute the number of bytes in the cube + label bytes and if the // endpos of the file // is not greater than this then seek to that position. - fstream stream(m_labelFileName->expanded().c_str(), + fstream stream(m_labelFileName->expanded().toAscii().data(), ios::in | ios::out | ios::binary); stream.seekp(0, ios::end); streampos endByte = stream.tellp(); @@ -755,13 +755,13 @@ namespace Isis { blobFileName = blobFileName.removeExtension(); blobFileName = blobFileName.addExtension(blob.Type()); blobFileName = blobFileName.addExtension(blob.Name()); - string blobFile(blobFileName.expanded()); + QString blobFile(blobFileName.expanded()); ios::openmode flags = ios::in | ios::binary | ios::out | ios::trunc; fstream detachedStream; - detachedStream.open(blobFile.c_str(), flags); + detachedStream.open(blobFile.toAscii().data(), flags); if (!detachedStream) { - string message = "Unable to open data file [" + - blobFileName.expanded() + "]"; + QString message = "Unable to open data file [" + + blobFileName.expanded() + "]"; throw IException(IException::Io, message, _FILEINFO_); } @@ -787,13 +787,13 @@ namespace Isis { } if (isReadOnly()) { - string msg = "Cannot write to the cube [" + (IString)QFileInfo(getFileName()).fileName() + + QString msg = "Cannot write to the cube [" + (QString)QFileInfo(getFileName()).fileName() + "] because it is opened read-only"; throw IException(IException::Programmer, msg, _FILEINFO_); } if (!m_storesDnData) { - string msg = "The cube [" + (IString)QFileInfo(getFileName()).fileName() + + QString msg = "The cube [" + QFileInfo(getFileName()).fileName() + "] does not support storing DN data because it is using an external file for DNs"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -966,7 +966,7 @@ namespace Isis { * @param[in] vbands A vector of strings containing the virtual bands. The * vector must contain integers in string form (e.g., "5", "10", "1"). */ - void Cube::setVirtualBands(const QList &vbands) { + void Cube::setVirtualBands(const QList &vbands) { openCheck(); if (m_virtualBandList) m_virtualBandList->clear(); @@ -974,9 +974,9 @@ namespace Isis { m_virtualBandList = new QList; if (vbands.size() > 0) { - QListIterator it(vbands); + QListIterator it(vbands); while (it.hasNext()) { - m_virtualBandList->append(it.next()); + m_virtualBandList->append(toInt(it.next())); } } else { @@ -991,13 +991,13 @@ namespace Isis { /** - * This is a deprecated version of setVirtualBands(const QList &). + * This is a deprecated version of setVirtualBands(const QList &). * * @param[in] vbands A vector of strings containing the virtual bands. The * vector must contain integers in string form (e.g., "5", "10", "1"). */ - void Cube::setVirtualBands(const std::vector &vbands) { - QList realVBands; + void Cube::setVirtualBands(const std::vector &vbands) { + QList realVBands; for(unsigned int i = 0; i < vbands.size(); i++) realVBands << vbands[i]; @@ -1066,7 +1066,7 @@ namespace Isis { * * @returns The opened cube's filename */ - IString Cube::getFileName() const { + QString Cube::getFileName() const { if (isOpen()) return m_labelFileName->expanded(); else @@ -1102,7 +1102,7 @@ namespace Isis { * @throws IsisProgrammerError Band was less than zero or more than the number * of bands in the cube. */ - Histogram *Cube::getHistogram(const int &band, IString msg) { + Histogram *Cube::getHistogram(const int &band, QString msg) { return getHistogram(band, ValidMinimum, ValidMaximum, msg); } @@ -1133,10 +1133,10 @@ namespace Isis { * of bands in the cube. */ Histogram *Cube::getHistogram(const int &band, const double &validMin, - const double &validMax, IString msg) { + const double &validMax, QString msg) { // Make sure band is valid if ((band < 0) || (band > getBandCount())) { - string msg = "Invalid band in [CubeInfo::Histogram]"; + QString msg = "Invalid band in [CubeInfo::Histogram]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1275,7 +1275,7 @@ namespace Isis { if (m_virtualBandList) { if ((virtualBand < 1) || (virtualBand > m_virtualBandList->size())) { - string msg = "Out of array bounds [" + IString(virtualBand) + "]"; + QString msg = "Out of array bounds [" + toString(virtualBand) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } physicalBand = m_virtualBandList->at(virtualBand - 1); @@ -1326,7 +1326,7 @@ namespace Isis { * such as the minimum and maximum pixel values for the input cube on the * band specified, or all bands as the case may be. */ - Statistics *Cube::getStatistics(const int &band, IString msg) { + Statistics *Cube::getStatistics(const int &band, QString msg) { return getStatistics(band, ValidMinimum, ValidMaximum, msg); } @@ -1348,7 +1348,7 @@ namespace Isis { * @return Statistics* */ Statistics *Cube::getStatistics(const int &band, const double &validMin, - const double &validMax, IString msg) { + const double &validMax, QString msg) { // Make sure band is valid if ((band < 0) || (band > getBandCount())) { string msg = "Invalid band in [CubeInfo::Statistics]"; @@ -1408,7 +1408,7 @@ namespace Isis { m_ioHandler->addCachingAlgorithm(algorithm); } else if (!isOpen()) { - IString msg = "Cannot add a caching algorithm until the cube is open"; + QString msg = "Cannot add a caching algorithm until the cube is open"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -1435,7 +1435,7 @@ namespace Isis { * @param BlobName blob to be deleted * @return boolean if it found the blob and deleted it. */ - bool Cube::deleteBlob(IString BlobType, IString BlobName) { + bool Cube::deleteBlob(QString BlobType, QString BlobName) { for(int i = 0; i < m_label->Objects(); i++) { PvlObject obj = m_label->Object(i); if (obj.Name().compare(BlobType) == 0) { @@ -1457,7 +1457,7 @@ namespace Isis { * * @param[out] group Name of the group to delete. */ - void Cube::deleteGroup(const IString &group) { + void Cube::deleteGroup(const QString &group) { PvlObject &isiscube = getLabel()->FindObject("IsisCube"); if (!isiscube.HasGroup(group)) return; isiscube.DeleteGroup(group); @@ -1471,7 +1471,7 @@ namespace Isis { * @param[out] group Name of the group to get * @return (PvlGroup) Label which will contain the requested group. */ - PvlGroup &Cube::getGroup(const IString &group) const { + PvlGroup &Cube::getGroup(const QString &group) const { PvlObject &isiscube = getLabel()->FindObject("IsisCube"); return isiscube.FindGroup(group); } @@ -1484,7 +1484,7 @@ namespace Isis { * * @return (bool) True if the cube has the specified group, false if not. */ - bool Cube::hasGroup(const IString &group) const { + bool Cube::hasGroup(const QString &group) const { const PvlObject &isiscube = getLabel()->FindObject("IsisCube"); if (isiscube.HasGroup(group)) return true; return false; @@ -1498,15 +1498,15 @@ namespace Isis { * * @return bool True if the pvl table was found */ - bool Cube::hasTable(const IString &name) { + bool Cube::hasTable(const QString &name) { for(int o = 0; o < getLabel()->Objects(); o++) { PvlObject &obj = getLabel()->Object(o); if (obj.IsNamed("Table")) { if (obj.HasKeyword("Name")) { - IString temp = (string) obj["Name"]; - temp.UpCase(); - IString temp2 = name; - temp2.UpCase(); + QString temp = (QString) obj["Name"]; + temp = temp.toUpper(); + QString temp2 = name; + temp2 = temp2.toUpper(); if (temp == temp2) return true; } } @@ -1554,7 +1554,7 @@ namespace Isis { // Change the number of bands in the labels of the cube if (m_virtualBandList && core.HasGroup("Dimensions")) - core.FindGroup("Dimensions")["Bands"] = m_virtualBandList->size(); + core.FindGroup("Dimensions")["Bands"] = toString(m_virtualBandList->size()); } @@ -1716,7 +1716,7 @@ namespace Isis { m_pixelType = PixelTypeEnumeration(pixelsGroup["Type"]); // Now examine the format to see which type of handler to create - if ((string) core["Format"] == "BandSequential") { + if ((QString) core["Format"] == "BandSequential") { m_format = Bsq; } else { @@ -1808,7 +1808,7 @@ namespace Isis { } if (!m_label) { - string msg = Message::FileOpen(labelFileName.original()); + QString msg = Message::FileOpen(labelFileName.original()); throw IException(IException::Io, msg, _FILEINFO_); } @@ -1822,7 +1822,7 @@ namespace Isis { } else { cleanUp(false); - string msg = "Can not open old cube file format with write access [" + + QString msg = "Can not open old cube file format with write access [" + m_labelFileName->original() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1867,18 +1867,18 @@ namespace Isis { * * @param oldCube The filename of the Isis 2 cube */ - void Cube::reformatOldIsisLabel(const IString &oldCube) { - string parameters = "from=" + oldCube; + void Cube::reformatOldIsisLabel(const QString &oldCube) { + QString parameters = "from=" + oldCube; FileName oldName(oldCube); FileName tempCube = FileName::createTempFile("Temporary_" + oldName.name() + ".cub"); parameters += " to=" + tempCube.expanded(); if (iApp == NULL) { - IString command = "$ISISROOT/bin/pds2isis " + parameters; + QString command = "$ISISROOT/bin/pds2isis " + parameters; ProgramLauncher::RunSystemCommand(command); } else { - IString prog = "pds2isis"; + QString prog = "pds2isis"; ProgramLauncher::RunIsisProgram(prog, parameters); } @@ -1919,8 +1919,8 @@ namespace Isis { } else { locker2.unlock(); - string msg = "Label space is full in [" + - (IString)FileName(*m_labelFileName).name() + + QString msg = "Label space is full in [" + + (QString)FileName(*m_labelFileName).name() + "] unable to write labels"; cleanUp(false); throw IException(IException::Io, msg, _FILEINFO_); diff --git a/isis/src/base/objs/Cube/Cube.h b/isis/src/base/objs/Cube/Cube.h index acd9f5fc21..615750c405 100644 --- a/isis/src/base/objs/Cube/Cube.h +++ b/isis/src/base/objs/Cube/Cube.h @@ -23,6 +23,8 @@ * http://www.usgs.gov/privacy.html. */ +#include + // This is needed for the QVariant macro #include @@ -31,6 +33,7 @@ class QFile; class QMutex; +class QString; namespace Isis { class Blob; @@ -40,7 +43,6 @@ namespace Isis { class CubeCachingAlgorithm; class CubeIoHandler; class FileName; - class IString; class Projection; class Pvl; class PvlGroup; @@ -215,10 +217,10 @@ namespace Isis { void close(bool remove = false); Cube *copy(FileName newFile, const CubeAttributeOutput &newFileAttributes) const; - void create(const IString &cfile); - void create(const IString &cfile, const CubeAttributeOutput &att); - void open(const IString &cfile, IString access = "r"); - void reopen(IString access = "r"); + void create(const QString &cfile); + void create(const QString &cfile, const CubeAttributeOutput &att); + void open(const QString &cfile, QString access = "r"); + void reopen(QString access = "r"); void read(Blob &blob) const; void read(Buffer &rbuf) const; @@ -234,20 +236,20 @@ namespace Isis { void setLabelsAttached(bool attached); void setLabelSize(int labelBytes); void setPixelType(PixelType pixelType); - void setVirtualBands(const QList &vbands); - void setVirtualBands(const std::vector &vbands); + void setVirtualBands(const QList &vbands); + void setVirtualBands(const std::vector &vbands); int getBandCount() const; double getBase() const; ByteOrder getByteOrder() const; Camera *getCamera(); - IString getFileName() const; + QString getFileName() const; Format getFormat() const; Histogram *getHistogram(const int &band = 1, - IString msg = "Gathering histogram"); + QString msg = "Gathering histogram"); Histogram *getHistogram(const int &band, const double &validMin, const double &validMax, - IString msg = "Gathering histogram"); + QString msg = "Gathering histogram"); Pvl *getLabel() const; int getLabelSize(bool actual = false) const; int getLineCount() const; @@ -257,19 +259,19 @@ namespace Isis { Projection *getProjection(); int getSampleCount() const; Statistics *getStatistics(const int &band = 1, - IString msg = "Gathering statistics"); + QString msg = "Gathering statistics"); Statistics *getStatistics(const int &band, const double &validMin, const double &validMax, - IString msg = "Gathering statistics"); + QString msg = "Gathering statistics"); bool getStoresDnData() const; void addCachingAlgorithm(CubeCachingAlgorithm *); void clearIoCache(); - bool deleteBlob(IString BlobType, IString BlobName); - void deleteGroup(const IString &group); - PvlGroup &getGroup(const IString &group) const; - bool hasGroup(const IString &group) const; - bool hasTable(const IString &name); + bool deleteBlob(QString BlobType, QString BlobName); + void deleteGroup(const QString &group); + PvlGroup &getGroup(const QString &group) const; + bool hasGroup(const QString &group) const; + bool hasTable(const QString &name); void putGroup(const PvlGroup &group); private: @@ -282,7 +284,7 @@ namespace Isis { void initLabelFromFile(FileName labelFileName, bool readWrite); void openCheck(); Pvl realDataFileLabel() const; - void reformatOldIsisLabel(const IString &oldCube); + void reformatOldIsisLabel(const QString &oldCube); void writeLabels(); private: diff --git a/isis/src/base/objs/Cube/CubeIoHandler.cpp b/isis/src/base/objs/Cube/CubeIoHandler.cpp index 87ac9544dc..f190e9e89f 100644 --- a/isis/src/base/objs/Cube/CubeIoHandler.cpp +++ b/isis/src/base/objs/Cube/CubeIoHandler.cpp @@ -122,9 +122,9 @@ namespace Isis { const PvlObject &core = label.FindObject("IsisCube").FindObject("Core"); const PvlGroup &pixelGroup = core.FindGroup("Pixels"); - IString byteOrderStr = pixelGroup.FindKeyword("ByteOrder")[0]; + QString byteOrderStr = pixelGroup.FindKeyword("ByteOrder")[0]; m_byteSwapper = new EndianSwapper( - byteOrderStr.UpCase()); + byteOrderStr.toUpper()); m_base = pixelGroup.FindKeyword("Base"); m_multiplier = pixelGroup.FindKeyword("Multiplier"); m_pixelType = PixelTypeEnumeration(pixelGroup.FindKeyword("Type")); diff --git a/isis/src/base/objs/Cube/CubeIoHandler.h b/isis/src/base/objs/Cube/CubeIoHandler.h index 187e9af352..e585dfa05c 100644 --- a/isis/src/base/objs/Cube/CubeIoHandler.h +++ b/isis/src/base/objs/Cube/CubeIoHandler.h @@ -35,6 +35,7 @@ class QFile; class QMutex; class QTime; template class QList; +template class QMap; template class QPair; namespace Isis { diff --git a/isis/src/base/objs/Cube/CubeTileHandler.cpp b/isis/src/base/objs/Cube/CubeTileHandler.cpp index 335b6a5c75..0f3029383c 100644 --- a/isis/src/base/objs/Cube/CubeTileHandler.cpp +++ b/isis/src/base/objs/Cube/CubeTileHandler.cpp @@ -83,9 +83,9 @@ namespace Isis { PvlObject &core = labels.FindObject("IsisCube").FindObject("Core"); core.AddKeyword(PvlKeyword("Format", "Tile"), PvlContainer::Replace); - core.AddKeyword(PvlKeyword("TileSamples", getSampleCountInChunk()), + core.AddKeyword(PvlKeyword("TileSamples", toString(getSampleCountInChunk())), PvlContainer::Replace); - core.AddKeyword(PvlKeyword("TileLines", getLineCountInChunk()), + core.AddKeyword(PvlKeyword("TileLines", toString(getLineCountInChunk())), PvlContainer::Replace); } diff --git a/isis/src/base/objs/Cube/unitTest.cpp b/isis/src/base/objs/Cube/unitTest.cpp index 5ac5d6599e..87558ff439 100644 --- a/isis/src/base/objs/Cube/unitTest.cpp +++ b/isis/src/base/objs/Cube/unitTest.cpp @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) { in.close(); cerr << endl; - QList vbands; + QList vbands; vbands.push_back("2"); in.setVirtualBands(vbands); in.open("IsisCube_01"); @@ -347,7 +347,7 @@ int main(int argc, char *argv[]) { // Test reading outside a cube with virtual bands. cerr << "Testing reading past cube boundaries with virtual bands ... \n"; - QList virtualBands; + QList virtualBands; virtualBands.push_back("2"); boundaryTestCube.setVirtualBands(virtualBands); boundaryTestCube.open("IsisCube_boundary"); @@ -561,7 +561,7 @@ int main(int argc, char *argv[]) { in4.reopen("rw"); } catch (IException &e) { - QString error = QString::fromStdString(e.toString()); + QString error = e.toString(); error = error.replace(QRegExp("\\[[^\\]]*\\]"), "[...]"); cerr << error.toStdString() << endl; } diff --git a/isis/src/base/objs/CubeAttribute/CubeAttribute.cpp b/isis/src/base/objs/CubeAttribute/CubeAttribute.cpp index d019b6ad1a..369518ad2c 100644 --- a/isis/src/base/objs/CubeAttribute/CubeAttribute.cpp +++ b/isis/src/base/objs/CubeAttribute/CubeAttribute.cpp @@ -63,7 +63,7 @@ namespace Isis { // void CubeAttributeInput::Set(const FileName &fileName) { // Reset(); // -// IString str(fileName.attributes()); +// QString str(fileName.attributes()); // // // Get rid of any white space // str.ConvertWhiteSpace(); @@ -72,20 +72,20 @@ namespace Isis { // str.UpCase(); // // // Look at each comma delimited token -// IString commaTok; +// QString commaTok; // while((commaTok = str.Token(",")).length() > 0) { // // Is this token a range of bands // if(commaTok.find('-') != string::npos) { -// IString dashTok; +// QString dashTok; // int start = commaTok.Token("-").ToInteger(); // int end = commaTok.Token("-").ToInteger(); // int direction; // direction = (start <= end) ? 1 : -1; // // Save the entire range of bands // for(int band = start; band != end; band += direction) { -// m_bands.push_back(Isis::IString(band)); +// m_bands.push_back(Isis::QString(band)); // } -// m_bands.push_back(Isis::IString(end)); +// m_bands.push_back(Isis::QString(end)); // } // // This token is a single band specification // else { @@ -95,33 +95,25 @@ namespace Isis { // } - vector CubeAttributeInput::bands() const { - vector result; + vector CubeAttributeInput::bands() const { + vector result; - IString str = toString(); + QString str = toString().remove(QRegExp("^\\+")); - // Get rid of any white space - str.ConvertWhiteSpace(); - str.Compress(); - str.Remove(" "); - str.UpCase(); - str.TrimHead("+"); - - // Look at each comma delimited token - IString commaTok; - while((commaTok = str.Token(",")).length() > 0) { + QStringList strSplit = str.split(",", QString::SkipEmptyParts); + foreach (QString commaTok, strSplit) { // Is this token a range of bands - if(commaTok.find('-') != string::npos) { - IString dashTok; - int start = commaTok.Token("-").ToInteger(); - int end = commaTok.Token("-").ToInteger(); + if(commaTok.contains('-')) { + QString dashTok; + int start = toInt(commaTok.mid(0, commaTok.indexOf("-"))); + int end = toInt(commaTok.mid(commaTok.indexOf("-") + 1)); int direction; direction = (start <= end) ? 1 : -1; // Save the entire range of bands for(int band = start; band != end; band += direction) { - result.push_back(Isis::IString(band)); + result.push_back(Isis::toString(band)); } - result.push_back(Isis::IString(end)); + result.push_back(Isis::toString(end)); } // This token is a single band specification else { @@ -133,23 +125,23 @@ namespace Isis { } - IString CubeAttributeInput::bandsString() const { + QString CubeAttributeInput::bandsString() const { return toString(bands()); } - void CubeAttributeInput::setBands(const vector &bands) { + void CubeAttributeInput::setBands(const vector &bands) { setAttributes(toString(bands)); } - bool CubeAttributeInput::isBandRange(IString attribute) const { + bool CubeAttributeInput::isBandRange(QString attribute) const { return QRegExp("[0-9,\\-]+").exactMatch(attribute); } - IString CubeAttributeInput::toString(const vector &bands) { - IString result; + QString CubeAttributeInput::toString(const vector &bands) { + QString result; for(unsigned int i = 0; i < bands.size(); i++) { if(i > 0) result += ","; @@ -161,8 +153,8 @@ namespace Isis { } - QList CubeAttributeInput::testers() { - QList result; + QList CubeAttributeInput::testers() { + QList result; result.append(&CubeAttributeInput::isBandRange); @@ -206,7 +198,7 @@ namespace Isis { // void CubeAttributeOutput::Set(const FileName &fileName) { // Reset(); // -// Isis::IString str(fileName.attributes()); +// Isis::QString str(fileName.attributes()); // // // Remove any white space // str.ConvertWhiteSpace(); @@ -216,15 +208,15 @@ namespace Isis { // str.TrimHead("+"); // // // Look at each "+" separate attribute -// Isis::IString tok; +// Isis::QString tok; // while((tok = str.Token("+")).length() > 0) { // // // If there is a ":" in this token then it is assumed to be a min:max // if(tok.find(":") != string::npos) { // // // Pull out the minimum -// Isis::IString colonTok = tok; -// Isis::IString min = colonTok.Token(":"); +// Isis::QString colonTok = tok; +// Isis::QString min = colonTok.Token(":"); // if(min.length() > 0) { // m_minimum = min.ToDouble(); // } @@ -233,7 +225,7 @@ namespace Isis { // } // // // Pull out the maximum -// Isis::IString max = colonTok.Token(":"); +// Isis::QString max = colonTok.Token(":"); // if(max.length() > 0) { // m_maximum = max.ToDouble(); // } @@ -304,7 +296,7 @@ namespace Isis { } - IString CubeAttributeOutput::fileFormatString() const { + QString CubeAttributeOutput::fileFormatString() const { return toString(fileFormat()); } @@ -323,7 +315,7 @@ namespace Isis { QStringList rangeList = range.split(":"); if (rangeList.count() == 2 && rangeList.first() != "") - result = IString(rangeList.first()).ToDouble(); + result = toDouble(rangeList.first()); } return result; @@ -338,7 +330,7 @@ namespace Isis { QStringList rangeList = range.split(":"); if (rangeList.count() == 2 && rangeList.last() != "") - result = IString(rangeList.last()).ToDouble(); + result = toDouble(rangeList.last()); } return result; @@ -347,15 +339,15 @@ namespace Isis { void CubeAttributeOutput::setMinimum(double min) { if (!IsSpecial(min)) { - IString newRange = IString(min) + ":"; + QString newRange = Isis::toString(min) + ":"; if (!IsSpecial(maximum())) - newRange += IString(maximum()); + newRange += Isis::toString(maximum()); setAttribute(newRange, &CubeAttributeOutput::isRange); } else if (!IsSpecial(maximum())) { - setAttribute(":" + IString(maximum()), &CubeAttributeOutput::isRange); + setAttribute(":" + Isis::toString(maximum()), &CubeAttributeOutput::isRange); } else { setAttribute("", &CubeAttributeOutput::isRange); @@ -365,15 +357,15 @@ namespace Isis { void CubeAttributeOutput::setMaximum(double max) { if (!IsSpecial(max)) { - IString newRange = ":" + IString(max); + QString newRange = ":" + Isis::toString(max); if (!IsSpecial(minimum())) - newRange = IString(minimum()) + newRange; + newRange = Isis::toString(minimum()) + newRange; setAttribute(newRange, &CubeAttributeOutput::isRange); } else if (!IsSpecial(minimum())) { - setAttribute(IString(minimum()) + ":", &CubeAttributeOutput::isRange); + setAttribute(Isis::toString(minimum()) + ":", &CubeAttributeOutput::isRange); } else { setAttribute("", &CubeAttributeOutput::isRange); @@ -429,34 +421,34 @@ namespace Isis { } - bool CubeAttributeOutput::isByteOrder(IString attribute) const { + bool CubeAttributeOutput::isByteOrder(QString attribute) const { return QRegExp("(M|L)SB").exactMatch(attribute); } - bool CubeAttributeOutput::isFileFormat(IString attribute) const { + bool CubeAttributeOutput::isFileFormat(QString attribute) const { return QRegExp("(BANDSEQUENTIAL|BSQ|TILE)").exactMatch(attribute); } - bool CubeAttributeOutput::isLabelAttachment(IString attribute) const { + bool CubeAttributeOutput::isLabelAttachment(QString attribute) const { return QRegExp("(ATTACHED|DETACHED|EXTERNAL)").exactMatch(attribute); } - bool CubeAttributeOutput::isPixelType(IString attribute) const { + bool CubeAttributeOutput::isPixelType(QString attribute) const { return QRegExp("(8-?BIT|16-?BIT|32-?BIT|UNSIGNEDBYTE|SIGNEDWORD|REAL)").exactMatch(attribute); } - bool CubeAttributeOutput::isRange(IString attribute) const { + bool CubeAttributeOutput::isRange(QString attribute) const { return QRegExp("[\\-+E0-9.]*:[\\-+E0-9.]*").exactMatch(attribute); } - IString CubeAttributeOutput::toString(Cube::Format format) { - IString result = "Tile"; + QString CubeAttributeOutput::toString(Cube::Format format) { + QString result = "Tile"; if (format == Cube::Bsq) result = "BandSequential"; @@ -479,7 +471,7 @@ namespace Isis { } - IString CubeAttributeOutput::byteOrderString() const { + QString CubeAttributeOutput::byteOrderString() const { return ByteOrderName(byteOrder()); } @@ -490,8 +482,8 @@ namespace Isis { } - QList CubeAttributeOutput::testers() { - QList result; + QList CubeAttributeOutput::testers() { + QList result; result.append(&CubeAttributeOutput::isByteOrder); result.append(&CubeAttributeOutput::isFileFormat); diff --git a/isis/src/base/objs/CubeAttribute/CubeAttribute.h b/isis/src/base/objs/CubeAttribute/CubeAttribute.h index e5d493a186..06e35855f2 100644 --- a/isis/src/base/objs/CubeAttribute/CubeAttribute.h +++ b/isis/src/base/objs/CubeAttribute/CubeAttribute.h @@ -23,19 +23,17 @@ * http://www.usgs.gov/privacy.html. */ -#include #include #include +#include #include "Cube.h" #include "Endian.h" #include "FileName.h" #include "IException.h" -#include "IString.h" #include "PixelType.h" -class QStringList; namespace Isis { /** @@ -67,12 +65,12 @@ namespace Isis { * * @return A string representation of the parameter */ - inline std::string LabelAttachmentName(LabelAttachment labelType) { + inline QString LabelAttachmentName(LabelAttachment labelType) { if(labelType == AttachedLabel) return "Attached"; if(labelType == DetachedLabel) return "Detached"; if(labelType == ExternalLabel) return "External"; - std::string msg = "Invalid label attachment type [" + IString(labelType) + "]"; + QString msg = "Invalid label attachment type [" + QString(labelType) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -85,14 +83,13 @@ namespace Isis { * * @return The RangeType enum corresponding to the string parameter */ - inline LabelAttachment LabelAttachmentEnumeration(const std::string &labelType) { - IString temp(labelType); - temp = temp.UpCase(); + inline LabelAttachment LabelAttachmentEnumeration(const QString &labelType) { + QString temp = labelType.toUpper(); if(temp == "ATTACHED") return AttachedLabel; if(temp == "DETACHED") return DetachedLabel; if(temp == "External") return ExternalLabel; - std::string msg = "Invalid label attachment type string [" + labelType + "]"; + QString msg = "Invalid label attachment type string [" + labelType + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -137,7 +134,7 @@ namespace Isis { public: //! Constructs an empty CubeAttribute - CubeAttribute(QList< bool (ChildClass::*)(IString) const > testers) { + CubeAttribute(QList< bool (ChildClass::*)(QString) const > testers) { m_attributeTypeTesters = testers; } @@ -153,7 +150,7 @@ namespace Isis { * before the first "+" are assumed to be the filename * and are ignored. */ - CubeAttribute(QList< bool (ChildClass::*)(IString) const > testers, + CubeAttribute(QList< bool (ChildClass::*)(QString) const > testers, const FileName &fileName) { m_attributeTypeTesters = testers; setAttributes(fileName); @@ -173,8 +170,8 @@ namespace Isis { * * @return The cube attributes in string form */ - IString toString() const { - IString result; + QString toString() const { + QString result; if (!m_attributes.isEmpty()) result = "+" + m_attributes.join("+"); @@ -193,10 +190,10 @@ namespace Isis { * * @param attribute The attribute we're adding to the current cube attributes */ - void addAttribute(IString attribute) { - IString upcaseAtt = IString(attribute).UpCase(); + void addAttribute(QString attribute) { + QString upcaseAtt = attribute.toUpper(); - if (attribute.ToQt().contains("+")) { + if (attribute.contains("+")) { throw IException(IException::Unknown, "Individual attributes (for example, BSQ) cannot contain the '+' " "character because that is used to denote the separation of individual " @@ -206,12 +203,12 @@ namespace Isis { // Verify this attribute is legal bool legal = false; - bool (ChildClass::*tester)(IString) const; + bool (ChildClass::*tester)(QString) const; foreach (tester, m_attributeTypeTesters) { if ( (static_cast(this)->*tester)(upcaseAtt) ) { if (legal) { throw IException(IException::Unknown, - QObject::tr("Attribute [%1] is ambiguous").arg(attribute.ToQt()), + QObject::tr("Attribute [%1] is ambiguous").arg(attribute), _FILEINFO_); } @@ -221,11 +218,11 @@ namespace Isis { if (!legal) { throw IException(IException::Unknown, - QObject::tr("Attribute [%1] is not recognized").arg(attribute.ToQt()), + QObject::tr("Attribute [%1] is not recognized").arg(attribute), _FILEINFO_); } - m_attributes.append(attribute.ToQt()); + m_attributes.append(attribute); } @@ -251,7 +248,7 @@ namespace Isis { * "+Bsq+Real" or "Bsq+Real" */ void addAttributes(const char *attributesString) { - addAttributes(IString(attributesString)); + addAttributes(QString(attributesString)); } @@ -263,7 +260,7 @@ namespace Isis { * @param attributesString A string of recognizable attributes, for example * "+Bsq+Real" or "Bsq+Real" */ - void addAttributes(const IString &attributesString) { + void addAttributes(const QString &attributesString) { setAttributes(toString() + "+" + attributesString); } @@ -278,7 +275,7 @@ namespace Isis { * FileName("out.cub+Bsq") */ void setAttributes(const FileName &fileName) { - QStringList attributes = fileName.attributes().ToQt().split("+", QString::SkipEmptyParts); + QStringList attributes = fileName.attributes().split("+", QString::SkipEmptyParts); m_attributes.clear(); foreach (QString attribute, attributes) @@ -295,11 +292,11 @@ namespace Isis { * @param tester A method that determines whether the attribute should be returned/is relevant * @return A list of attributes for which the tester returns true on. */ - QStringList attributeList(bool (ChildClass::*tester)(IString) const) const { + QStringList attributeList(bool (ChildClass::*tester)(QString) const) const { QStringList relevantAttributes; foreach (QString attribute, m_attributes) { - IString upcaseAtt = IString(attribute).UpCase(); + QString upcaseAtt = attribute.toUpper(); if ( (static_cast(this)->*tester)(upcaseAtt) ) { relevantAttributes.append(upcaseAtt); } @@ -320,14 +317,14 @@ namespace Isis { * @param tester A method that determines if an attribute is of the same type of newValue, so * that existing attributes can be overwritten. */ - void setAttribute(IString newValue, bool (ChildClass::*tester)(IString) const) { + void setAttribute(QString newValue, bool (ChildClass::*tester)(QString) const) { QMutableListIterator it(m_attributes); bool found = false; while (it.hasNext()) { QString &attribute = it.next(); - IString upcaseAtt = IString(attribute).UpCase(); + QString upcaseAtt = attribute.toUpper(); if ( (static_cast(this)->*tester)(upcaseAtt) ) { if (found || newValue == "") { // already found one (remove the duplicate) or just deleting it @@ -335,7 +332,7 @@ namespace Isis { } else { // modify existing attribute value - attribute = newValue.ToQt(); + attribute = newValue; } found = true; @@ -363,7 +360,7 @@ namespace Isis { * and only one data type (is unambiguous and is known). This list will not change after * this class is instantiated. */ - QList< bool (ChildClass::*)(IString) const > m_attributeTypeTesters; + QList< bool (ChildClass::*)(QString) const > m_attributeTypeTesters; }; @@ -419,7 +416,7 @@ namespace Isis { //! Return a vector of the input bands specified - std::vector bands() const; + std::vector bands() const; /** * @brief Return a string representation of all the bands @@ -432,21 +429,21 @@ namespace Isis { * * @return A comma delimited string of all bands from the input attribute */ - IString bandsString() const; + QString bandsString() const; //! Set the band attribute according to the list of bands - void setBands(const std::vector &bands); + void setBands(const std::vector &bands); using CubeAttribute::toString; private: - bool isBandRange(IString attribute) const; + bool isBandRange(QString attribute) const; - static IString toString(const std::vector &bands); - static QList testers(); + static QString toString(const std::vector &bands); + static QList testers(); private: - std::vector m_bands; //!< A list of the specified bands + std::vector m_bands; //!< A list of the specified bands }; @@ -520,7 +517,7 @@ namespace Isis { Cube::Format fileFormat() const; //! Return the file format as a string - IString fileFormatString() const; + QString fileFormatString() const; //! Set the format to the fmt parameter void setFileFormat(Cube::Format fmt); @@ -529,7 +526,7 @@ namespace Isis { ByteOrder byteOrder() const; //! Return the byte order as a string - IString byteOrderString() const; + QString byteOrderString() const; //! Set the order according to the parameter order void setByteOrder(ByteOrder order); @@ -561,13 +558,13 @@ namespace Isis { private: - bool isByteOrder(IString attribute) const; - bool isFileFormat(IString attribute) const; - bool isLabelAttachment(IString attribute) const; - bool isPixelType(IString attribute) const; - bool isRange(IString attribute) const; + bool isByteOrder(QString attribute) const; + bool isFileFormat(QString attribute) const; + bool isLabelAttachment(QString attribute) const; + bool isPixelType(QString attribute) const; + bool isRange(QString attribute) const; - static IString toString(Cube::Format); + static QString toString(Cube::Format); /** * @brief Output cube range tracker @@ -580,7 +577,7 @@ namespace Isis { RangeSet, //!< The range has been set }; - static QList testers(); + static QList testers(); }; }; diff --git a/isis/src/base/objs/CubeAttribute/unitTest.cpp b/isis/src/base/objs/CubeAttribute/unitTest.cpp index 8ad1dccdd5..c5ae8060d0 100644 --- a/isis/src/base/objs/CubeAttribute/unitTest.cpp +++ b/isis/src/base/objs/CubeAttribute/unitTest.cpp @@ -33,7 +33,7 @@ using namespace std; using namespace Isis; -void reportOutput(const CubeAttributeOutput &att, IString oh); +void reportOutput(const CubeAttributeOutput &att, QString oh); int main(int argc, char *argv[]) { Preference::Preferences(true); @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) { CubeAttributeInput att("+3"); cout << att.toString() << endl; - vector bands = att.bands(); + vector bands = att.bands(); cout << "vector[" << bands.size() << "]:" << endl; for (unsigned int i = 0; i < bands.size(); i++) @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) { CubeAttributeInput att("+3,5-9,99"); cout << att.toString() << endl; - vector bands = att.bands(); + vector bands = att.bands(); cout << "vector[" << bands.size() << "]:" << endl; for (unsigned int i = 0; i < bands.size(); i++) @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) { CubeAttributeInput att("+7-10"); cout << att.toString() << endl; - vector bands = att.bands(); + vector bands = att.bands(); cout << "vector[" << bands.size() << "]:" << endl; for (unsigned int i = 0; i < bands.size(); i++) @@ -195,7 +195,7 @@ int main(int argc, char *argv[]) { try { CubeAttributeOutput att; att.setFileFormat(Cube::Bsq); - att.addAttributes(IString("8bit")); + att.addAttributes(QString("8bit")); att.addAttributes("msb"); att.setByteOrder(Msb); att.addAttributes(FileName("+dETacHEd")); @@ -224,7 +224,7 @@ int main(int argc, char *argv[]) { cout << "Testing CubeAttributeInput mutators" << endl; try { CubeAttributeInput att("+1-3,4,5,6,99-32"); - vector bandsVector(1, "+1-99"); + vector bandsVector(1, "+1-99"); att.setBands(bandsVector); cout << att.toString() << endl; } @@ -261,7 +261,7 @@ int main(int argc, char *argv[]) { // Function to report everything about an output cube attribute -void reportOutput(const CubeAttributeOutput &att, IString orderHint) { +void reportOutput(const CubeAttributeOutput &att, QString orderHint) { cout << att.toString() << endl; // Pvl pvl; @@ -270,7 +270,7 @@ void reportOutput(const CubeAttributeOutput &att, IString orderHint) { // cout << endl; cout << "Propagate Pixel Type = " << att.propagatePixelType() << endl; try { - string tmp = PixelTypeName(att.pixelType()); + QString tmp = PixelTypeName(att.pixelType()); cout << "PixelType = " << tmp << endl; } catch(IException &e) { diff --git a/isis/src/base/objs/CubeCalculator/CubeCalculator.cpp b/isis/src/base/objs/CubeCalculator/CubeCalculator.cpp index 50e0f21237..1165830b98 100644 --- a/isis/src/base/objs/CubeCalculator/CubeCalculator.cpp +++ b/isis/src/base/objs/CubeCalculator/CubeCalculator.cpp @@ -191,7 +191,7 @@ namespace Isis { * @param inCubes The input cubes * @param outCube The output cube */ - void CubeCalculator::prepareCalculations(IString equation, + void CubeCalculator::prepareCalculations(QString equation, QVector &inCubes, Cube *outCube) { Clear(); @@ -218,7 +218,7 @@ namespace Isis { IString tok(token.substr(1)); int file = tok.ToInteger() - 1; if (file < 0 || file >= (int)inCubes.size()) { - std::string msg = "Invalid file number [" + tok + "]"; + QString msg = "Invalid file number [" + tok.ToQt() + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/CubeCalculator/CubeCalculator.h b/isis/src/base/objs/CubeCalculator/CubeCalculator.h index a8186a489f..62620f0409 100644 --- a/isis/src/base/objs/CubeCalculator/CubeCalculator.h +++ b/isis/src/base/objs/CubeCalculator/CubeCalculator.h @@ -71,7 +71,7 @@ namespace Isis { */ void Clear(); - void prepareCalculations(IString equation, + void prepareCalculations(QString equation, QVector &inCubes, Cube *outCube); diff --git a/isis/src/base/objs/CubeCalculator/unitTest.cpp b/isis/src/base/objs/CubeCalculator/unitTest.cpp index 5b25ce43b8..4fc2af9db6 100644 --- a/isis/src/base/objs/CubeCalculator/unitTest.cpp +++ b/isis/src/base/objs/CubeCalculator/unitTest.cpp @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) { std::cout << "CubeCalculator unit test" << std::endl; std::cout << "------------------------" << std::endl << std::endl; - std::string postfix = "sample line + -- band *"; + QString postfix = "sample line + -- band *"; QVector iCubes; iCubes.push_back(icube); c.prepareCalculations(postfix, iCubes, icube); diff --git a/isis/src/base/objs/CubeInfixToPostfix/CubeInfixToPostfix.cpp b/isis/src/base/objs/CubeInfixToPostfix/CubeInfixToPostfix.cpp index 33cf2da822..13ee742a57 100644 --- a/isis/src/base/objs/CubeInfixToPostfix/CubeInfixToPostfix.cpp +++ b/isis/src/base/objs/CubeInfixToPostfix/CubeInfixToPostfix.cpp @@ -76,7 +76,7 @@ namespace Isis { * * @return bool True if it looks valid, false if it's not known */ - bool CubeInfixToPostfix::isKnownSymbol(IString representation) { + bool CubeInfixToPostfix::isKnownSymbol(QString representation) { for(int i = 0; i < p_operators.size(); i++) { if(representation.compare(p_operators[i]->inputString()) == 0) { return true; @@ -85,7 +85,7 @@ namespace Isis { bool isFunction = (representation.size() > 1); if(representation[0] == 'f') { - for(unsigned int i = 1; isFunction && i < representation.size(); i++) { + for(int i = 1; isFunction && i < representation.size(); i++) { isFunction &= (representation[i] >= '0' && representation[i] <= '9'); } } @@ -96,7 +96,7 @@ namespace Isis { return isFunction; } - InfixOperator *CubeInfixToPostfix::findOperator(IString representation) { + InfixOperator *CubeInfixToPostfix::findOperator(QString representation) { try { return InfixToPostfix::findOperator(representation); } @@ -105,7 +105,7 @@ namespace Isis { bool isFunction = (representation.size() > 1); if(representation[0] == 'f') { - for(unsigned int i = 1; i < representation.size(); i++) { + for(int i = 1; i < representation.size(); i++) { isFunction &= (representation[i] >= '0' && representation[i] <= '9'); } } diff --git a/isis/src/base/objs/CubeInfixToPostfix/CubeInfixToPostfix.h b/isis/src/base/objs/CubeInfixToPostfix/CubeInfixToPostfix.h index b35affc5d7..e4ba19940b 100644 --- a/isis/src/base/objs/CubeInfixToPostfix/CubeInfixToPostfix.h +++ b/isis/src/base/objs/CubeInfixToPostfix/CubeInfixToPostfix.h @@ -23,7 +23,6 @@ #ifndef CUBEINFIXTOPOSTFIX_H_ #define CUBEINFIXTOPOSTFIX_H_ -#include "IString.h" #include "InfixToPostfix.h" #include #include @@ -56,8 +55,8 @@ namespace Isis { ~CubeInfixToPostfix() {}; protected: - bool isKnownSymbol(IString representation); - InfixOperator *findOperator(IString representation); + bool isKnownSymbol(QString representation); + InfixOperator *findOperator(QString representation); private: void initialize(); diff --git a/isis/src/base/objs/CubeInfixToPostfix/unitTest.cpp b/isis/src/base/objs/CubeInfixToPostfix/unitTest.cpp index 11d96da504..1d930a60bd 100644 --- a/isis/src/base/objs/CubeInfixToPostfix/unitTest.cpp +++ b/isis/src/base/objs/CubeInfixToPostfix/unitTest.cpp @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) { cout << "Test CubeInfixToPostfix" << endl; const int NUM_EQUATIONS = 25; - IString equations[NUM_EQUATIONS] = { + QString equations[NUM_EQUATIONS] = { "-4", "1*2", "((1)+(1))", diff --git a/isis/src/base/objs/CubeManager/CubeManager.cpp b/isis/src/base/objs/CubeManager/CubeManager.cpp index 81ec347ff2..746ad2552f 100644 --- a/isis/src/base/objs/CubeManager/CubeManager.cpp +++ b/isis/src/base/objs/CubeManager/CubeManager.cpp @@ -38,7 +38,7 @@ namespace Isis { * @return Cube* A pointer to the cube object that CubeManager retains ownership * to and may delete at any time */ - Cube *CubeManager::OpenCube(const std::string &cubeFileName) { + Cube *CubeManager::OpenCube(const QString &cubeFileName) { CubeAttributeInput attIn(cubeFileName); IString attri = attIn.toString(); IString expName = FileName(cubeFileName).expanded(); @@ -49,7 +49,7 @@ namespace Isis { } IString fullName = expName + attri; - QString fileName(fullName); + QString fileName(fullName.ToQt()); QMap::iterator searchResult = p_cubes.find(fileName); if(searchResult == p_cubes.end()) { @@ -59,10 +59,10 @@ namespace Isis { (*searchResult)->setVirtualBands(attIn.bands()); try { - (*searchResult)->open(fileName.toStdString()); + (*searchResult)->open(fileName); } catch(IException &e) { - CleanCubes(fileName.toStdString()); + CleanCubes(fileName); throw; } } @@ -75,7 +75,7 @@ namespace Isis { if(p_minimumCubes != 0) { while(p_opened.size() > (int)(p_minimumCubes)) { QString needsCleaned = p_opened.dequeue(); - CleanCubes(needsCleaned.toStdString()); + CleanCubes(needsCleaned); } } @@ -89,8 +89,8 @@ namespace Isis { * * @param cubeFileName The filename of the cube to remove from memory */ - void CubeManager::CleanCubes(const std::string &cubeFileName) { - QString fileName((IString)FileName(cubeFileName).expanded()); + void CubeManager::CleanCubes(const QString &cubeFileName) { + QString fileName(FileName(cubeFileName).expanded()); QMap::iterator searchResult = p_cubes.find(fileName); if(searchResult == p_cubes.end()) { diff --git a/isis/src/base/objs/CubeManager/CubeManager.h b/isis/src/base/objs/CubeManager/CubeManager.h index ba5dc1b541..cb854b8c2d 100644 --- a/isis/src/base/objs/CubeManager/CubeManager.h +++ b/isis/src/base/objs/CubeManager/CubeManager.h @@ -62,19 +62,19 @@ namespace Isis { * * @return Cube* Pointer to the cube (guaranteed not null) */ - static Cube *Open(const std::string &cubeFileName) { + static Cube *Open(const QString &cubeFileName) { return p_instance.OpenCube(cubeFileName); } /** - * This method calls CleanCubes(const std::string &cubeFileName) on the static + * This method calls CleanCubes(const QString &cubeFileName) on the static * instance * - * @see CleanCubes(const std::string &cubeFileName) + * @see CleanCubes(const QString &cubeFileName) * * @param cubeFileName The filename of the cube to destroy from memory */ - static void CleanUp(const std::string &cubeFileName) { + static void CleanUp(const QString &cubeFileName) { p_instance.CleanCubes(cubeFileName); } @@ -87,10 +87,10 @@ namespace Isis { p_instance.CleanCubes(); }; - void CleanCubes(const std::string &cubeFileName); + void CleanCubes(const QString &cubeFileName); void CleanCubes(); - Cube *OpenCube(const std::string &cubeFileName); + Cube *OpenCube(const QString &cubeFileName); /** * This sets the maximum number of opened cubes for this instance of diff --git a/isis/src/base/objs/DemShape/DemShape.cpp b/isis/src/base/objs/DemShape/DemShape.cpp index 45bfa34d47..d73f52dad6 100644 --- a/isis/src/base/objs/DemShape/DemShape.cpp +++ b/isis/src/base/objs/DemShape/DemShape.cpp @@ -49,12 +49,12 @@ namespace Isis { PvlGroup &kernels = pvl.FindGroup("Kernels", Pvl::Traverse); - IString demCubeFile; + QString demCubeFile; if (kernels.HasKeyword("ElevationModel")) { - demCubeFile = (std::string) kernels["ElevationModel"]; + demCubeFile = (QString) kernels["ElevationModel"]; } else if(kernels.HasKeyword("ShapeModel")) { - demCubeFile = (std::string) kernels["ShapeModel"]; + demCubeFile = (QString) kernels["ShapeModel"]; } m_demCube = CubeManager::Open(demCubeFile); diff --git a/isis/src/base/objs/DemShape/unitTest.cpp b/isis/src/base/objs/DemShape/unitTest.cpp index d010f75c46..5f1df2df9b 100644 --- a/isis/src/base/objs/DemShape/unitTest.cpp +++ b/isis/src/base/objs/DemShape/unitTest.cpp @@ -65,7 +65,7 @@ class MyShape : public DemShape { int main() { Preference::Preferences(true); - string inputFile = "$mgs/testData/ab102401.cub"; + QString inputFile = "$mgs/testData/ab102401.cub"; Cube cube; cube.open(inputFile); Camera *c = cube.getCamera(); @@ -183,8 +183,8 @@ Local normal = -0.581842, -0.703663, 0.407823 try { Pvl elPvl; PvlGroup kernels = pvl.FindGroup("Kernels", Pvl::Traverse); - IString demCubeFile; - demCubeFile = (std::string) kernels["ShapeModel"]; + QString demCubeFile; + demCubeFile = (QString) kernels["ShapeModel"]; kernels.DeleteKeyword("ShapeModel"); PvlKeyword shapeKey("ElevationModel", demCubeFile); kernels.AddKeyword(shapeKey); diff --git a/isis/src/base/objs/Distance/Distance.cpp b/isis/src/base/objs/Distance/Distance.cpp index 22f93e2b9d..e287e54fe2 100644 --- a/isis/src/base/objs/Distance/Distance.cpp +++ b/isis/src/base/objs/Distance/Distance.cpp @@ -164,11 +164,11 @@ namespace Isis { * * @return XXX meters (or empty string if not valid). */ - IString Distance::toString() const { - IString string; + QString Distance::toString() const { + QString string; if (isValid()) - string = IString(meters()) + " meters"; + string = Isis::toString(meters()) + " meters"; return string; } diff --git a/isis/src/base/objs/Distance/Distance.h b/isis/src/base/objs/Distance/Distance.h index ced9df056b..317dd3da9c 100644 --- a/isis/src/base/objs/Distance/Distance.h +++ b/isis/src/base/objs/Distance/Distance.h @@ -20,9 +20,10 @@ * http://www.usgs.gov/privacy.html. */ +class QString; + namespace Isis { class Displacement; - class IString; /** * @brief Distance measurement, usually in meters @@ -72,7 +73,7 @@ namespace Isis { double pixels(double pixelsPerMeter = 1.0) const; void setPixels(double distanceInPixels, double pixelsPerMeter = 1.0); - IString toString() const; + QString toString() const; bool isValid() const; bool operator >(const Distance &otherDistance) const; diff --git a/isis/src/base/objs/EllipsoidShape/unitTest.cpp b/isis/src/base/objs/EllipsoidShape/unitTest.cpp index 33ae04a40f..f5628a605c 100644 --- a/isis/src/base/objs/EllipsoidShape/unitTest.cpp +++ b/isis/src/base/objs/EllipsoidShape/unitTest.cpp @@ -42,7 +42,7 @@ using namespace Isis; int main() { Preference::Preferences(true); - string inputFile = "$mgs/testData/ab102401.cub"; + QString inputFile = "$mgs/testData/ab102401.cub"; Cube cube; cube.open(inputFile); Camera *c = cube.getCamera(); diff --git a/isis/src/base/objs/Endian/Endian.h b/isis/src/base/objs/Endian/Endian.h index b03e4d0d72..adbf2c6bfa 100644 --- a/isis/src/base/objs/Endian/Endian.h +++ b/isis/src/base/objs/Endian/Endian.h @@ -21,10 +21,10 @@ * http://www.usgs.gov/privacy.html. */ -#if !defined(Endian_h) +#ifndef Endian_h #define Endian_h -#include "IString.h" +#include namespace Isis { /** @@ -62,16 +62,15 @@ namespace Isis { Msb }; - inline std::string ByteOrderName(Isis::ByteOrder byteOrder) { + inline QString ByteOrderName(Isis::ByteOrder byteOrder) { if(byteOrder == Isis::NoByteOrder) return "None"; if(byteOrder == Isis::Lsb) return "Lsb"; if(byteOrder == Isis::Msb) return "Msb"; return "Error"; } - inline Isis::ByteOrder ByteOrderEnumeration(const std::string &order) { - Isis::IString temp(order); - temp = temp.UpCase(); + inline Isis::ByteOrder ByteOrderEnumeration(const QString &order) { + QString temp = order.toUpper(); if(temp == "LSB") return Isis::Lsb; if(temp == "MSB") return Isis::Msb; return Isis::NoByteOrder; diff --git a/isis/src/base/objs/Endian/unitTest.cpp b/isis/src/base/objs/Endian/unitTest.cpp index 991c9f4738..5927d4af3b 100644 --- a/isis/src/base/objs/Endian/unitTest.cpp +++ b/isis/src/base/objs/Endian/unitTest.cpp @@ -1,32 +1,34 @@ #include #include "Endian.h" +#include "IString.h" #include "Preference.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "Unit test for IsisEndian" << endl; - if(Isis::IsLittleEndian() == true) { - cout << Isis::IsLittleEndian() << endl; - cout << Isis::IsBigEndian() << endl; + if(IsLittleEndian() == true) { + cout << IsLittleEndian() << endl; + cout << IsBigEndian() << endl; } else { - cout << Isis::IsBigEndian() << endl; - cout << Isis::IsLittleEndian() << endl; + cout << IsBigEndian() << endl; + cout << IsLittleEndian() << endl; } - if(Isis::IsLsb() == true) { - cout << Isis::IsLsb() << endl; - cout << Isis::IsMsb() << endl; + if(IsLsb() == true) { + cout << IsLsb() << endl; + cout << IsMsb() << endl; } else { - cout << Isis::IsMsb() << endl; - cout << Isis::IsLsb() << endl; + cout << IsMsb() << endl; + cout << IsLsb() << endl; } - cout << Isis::ByteOrderName(Isis::ByteOrderEnumeration("msb")) << endl; - cout << Isis::ByteOrderName(Isis::ByteOrderEnumeration("lsb")) << endl; + cout << ByteOrderName(ByteOrderEnumeration("msb")) << endl; + cout << ByteOrderName(ByteOrderEnumeration("lsb")) << endl; } diff --git a/isis/src/base/objs/EndianSwapper/EndianSwapper.cpp b/isis/src/base/objs/EndianSwapper/EndianSwapper.cpp index 8613e96458..27e8669d1d 100644 --- a/isis/src/base/objs/EndianSwapper/EndianSwapper.cpp +++ b/isis/src/base/objs/EndianSwapper/EndianSwapper.cpp @@ -36,7 +36,7 @@ namespace Isis { * * @param inputEndian Byte order of input value (MSB or LSB). */ - EndianSwapper::EndianSwapper(std::string inputEndian) { + EndianSwapper::EndianSwapper(QString inputEndian) { if(inputEndian != "LSB" && inputEndian != "MSB") { string message = "Invalid parameter-InputEndian must be LSB or MSB"; diff --git a/isis/src/base/objs/EndianSwapper/EndianSwapper.h b/isis/src/base/objs/EndianSwapper/EndianSwapper.h index 522df07a06..73a90eafce 100644 --- a/isis/src/base/objs/EndianSwapper/EndianSwapper.h +++ b/isis/src/base/objs/EndianSwapper/EndianSwapper.h @@ -86,7 +86,7 @@ namespace Isis { } p_swapper; public: - EndianSwapper(std::string inputEndian); + EndianSwapper(QString inputEndian); ~EndianSwapper(); double Double(void *buf); float Float(void *buf); diff --git a/isis/src/base/objs/Enlarge/Enlarge.cpp b/isis/src/base/objs/Enlarge/Enlarge.cpp index b0097b7e8b..b3e911872e 100644 --- a/isis/src/base/objs/Enlarge/Enlarge.cpp +++ b/isis/src/base/objs/Enlarge/Enlarge.cpp @@ -133,16 +133,16 @@ namespace Isis { // Information will be added to it if the Mapping or Instrument // groups are deleted from the output image label PvlGroup resultsGrp("Results"); - resultsGrp += PvlKeyword("InputLines", iNumLines); - resultsGrp += PvlKeyword("InputSamples", iNumSamples); - resultsGrp += PvlKeyword("StartingLine", (int)mdStartLine); - resultsGrp += PvlKeyword("StartingSample", (int)mdStartSample); - resultsGrp += PvlKeyword("EndingLine", (int)mdEndLine); - resultsGrp += PvlKeyword("EndingSample", (int)mdEndSample); - resultsGrp += PvlKeyword("LineIncrement", 1. / mdLineScale); - resultsGrp += PvlKeyword("SampleIncrement", 1. / mdSampleScale); - resultsGrp += PvlKeyword("OutputLines", miOutputSamples); - resultsGrp += PvlKeyword("OutputSamples", miOutputLines); + resultsGrp += PvlKeyword("InputLines", toString(iNumLines)); + resultsGrp += PvlKeyword("InputSamples", toString(iNumSamples)); + resultsGrp += PvlKeyword("StartingLine", toString((int)mdStartLine)); + resultsGrp += PvlKeyword("StartingSample", toString((int)mdStartSample)); + resultsGrp += PvlKeyword("EndingLine", toString((int)mdEndLine)); + resultsGrp += PvlKeyword("EndingSample", toString((int)mdEndSample)); + resultsGrp += PvlKeyword("LineIncrement", toString(1. / mdLineScale)); + resultsGrp += PvlKeyword("SampleIncrement", toString(1. / mdSampleScale)); + resultsGrp += PvlKeyword("OutputLines", toString(miOutputSamples)); + resultsGrp += PvlKeyword("OutputSamples", toString(miOutputLines)); SubArea subArea; subArea.SetSubArea(mInCube->getLineCount(), mInCube->getSampleCount(), (int)mdStartLine, (int)mdStartSample, diff --git a/isis/src/base/objs/Enlarge/unitTest.cpp b/isis/src/base/objs/Enlarge/unitTest.cpp index 95d040bc90..2acc6aaba7 100644 --- a/isis/src/base/objs/Enlarge/unitTest.cpp +++ b/isis/src/base/objs/Enlarge/unitTest.cpp @@ -41,7 +41,7 @@ void IsisMain() { delete interp; UserInterface &ui = Application::GetUserInterface(); - QFile::remove(ui.GetFileName("TO").c_str()); + QFile::remove(ui.GetFileName("TO")); } diff --git a/isis/src/base/objs/Environment/Environment.cpp b/isis/src/base/objs/Environment/Environment.cpp index d341d88de5..d468e8abbc 100644 --- a/isis/src/base/objs/Environment/Environment.cpp +++ b/isis/src/base/objs/Environment/Environment.cpp @@ -60,7 +60,7 @@ namespace Isis { /** * @Returns the user name. Returns 'Unknown' if it cannot find the user name. */ - IString Environment::userName() { + QString Environment::userName() { return getEnvironmentValue("USER", "Unknown"); } @@ -68,7 +68,7 @@ namespace Isis { /** * @returns the host name. Returns 'Unknown' if it cannot find the host name. */ - IString Environment::hostName() { + QString Environment::hostName() { return getEnvironmentValue("HOST", "Unknown"); } @@ -80,12 +80,12 @@ namespace Isis { * * @returns The value for the environment variable requested. */ - IString Environment::getEnvironmentValue(IString variable, - IString defaultValue) { + QString Environment::getEnvironmentValue(QString variable, + QString defaultValue) { - IString value = defaultValue; + QString value = defaultValue; - char *envValue = getenv(variable.c_str()); + char *envValue = getenv(variable.toAscii().data()); if (envValue) value = envValue; @@ -96,9 +96,9 @@ namespace Isis { /** * @returns the Isis version in the format isis?.?.?.?qualifier | date */ - IString Environment::isisVersion() { + QString Environment::isisVersion() { TextFile versionFile("$ISISROOT/version"); - IString line1, line2, line3, line4; + QString line1, line2, line3, line4; versionFile.GetLine(line1); versionFile.GetLine(line2); versionFile.GetLine(line3); diff --git a/isis/src/base/objs/Environment/Environment.h b/isis/src/base/objs/Environment/Environment.h index 5f8d055c02..450f9150b2 100644 --- a/isis/src/base/objs/Environment/Environment.h +++ b/isis/src/base/objs/Environment/Environment.h @@ -24,9 +24,9 @@ * http://www.usgs.gov/privacy.html. */ +class QString; namespace Isis { - class IString; /** * @author 2011-04-01 Eric Hyer & Steven Lambright @@ -51,9 +51,9 @@ namespace Isis { public: ~Environment() {} - static IString userName(); - static IString hostName(); - static IString isisVersion(); + static QString userName(); + static QString hostName(); + static QString isisVersion(); protected: @@ -61,7 +61,7 @@ namespace Isis { private: - static IString getEnvironmentValue(IString, IString); + static QString getEnvironmentValue(QString, QString); /** * Construct an environment in static space to initialize some * global Isis 3 environment options. This initialization diff --git a/isis/src/base/objs/Environment/unitTest.cpp b/isis/src/base/objs/Environment/unitTest.cpp index 36572eeec4..9d97d3c710 100644 --- a/isis/src/base/objs/Environment/unitTest.cpp +++ b/isis/src/base/objs/Environment/unitTest.cpp @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) { cerr << "userName: " << Environment::userName() << "\n"; cerr << "hostName: " << Environment::hostName() << "\n"; - IString cmd = "echo 'version: isis" + Environment::isisVersion() + "' | cut -d . -f1"; + QString cmd = "echo 'version: isis" + Environment::isisVersion() + "' | cut -d . -f1"; ProgramLauncher::RunSystemCommand(cmd); return 0; diff --git a/isis/src/base/objs/Equalization/Equalization.cpp b/isis/src/base/objs/Equalization/Equalization.cpp index 880117aeab..e26d8f36fe 100644 --- a/isis/src/base/objs/Equalization/Equalization.cpp +++ b/isis/src/base/objs/Equalization/Equalization.cpp @@ -16,7 +16,6 @@ #include "PvlGroup.h" #include "Statistics.h" -using std::string; using std::vector; @@ -28,7 +27,7 @@ namespace Isis { } - Equalization::Equalization(string fromListName) { + Equalization::Equalization(QString fromListName) { init(); loadInputs(fromListName); } @@ -45,12 +44,12 @@ namespace Isis { } - void Equalization::addHolds(string holdListName) { + void Equalization::addHolds(QString holdListName) { FileList holdList; holdList.read(FileName(holdListName)); if (holdList.size() > m_imageList.size()) { - string msg = "The list of identifiers to be held must be less than or "; + QString msg = "The list of identifiers to be held must be less than or "; msg += "equal to the total number of identitifers."; throw IException(IException::User, msg, _FILEINFO_); } @@ -66,7 +65,7 @@ namespace Isis { } } if (!matched) { - string msg = "The hold list file [" + holdList[i].toString() + + QString msg = "The hold list file [" + holdList[i].toString() + "] does not match a file in the from list"; throw IException(IException::User, msg, _FILEINFO_); } @@ -89,13 +88,13 @@ namespace Isis { vector statsList; for (int img = 0; img < (int) m_imageList.size(); img++) { ProcessByLine p; - IString bandStr(band); - string statMsg = "Calculating Statistics for Band " + bandStr + - " of " + IString(m_maxBand) + " in Cube " + IString(img + 1) + - " of " + IString(m_maxCube); + QString bandStr(toString(band)); + QString statMsg = "Calculating Statistics for Band " + bandStr + + " of " + toString(m_maxBand) + " in Cube " + toString(img + 1) + + " of " + toString(m_maxCube); p.Progress()->SetText(statMsg); CubeAttributeInput att("+" + bandStr); - const string inp = m_imageList[img].toString(); + QString inp = m_imageList[img].toString(); p.SetInputCube(inp, att); Statistics *stats = new Statistics(); @@ -131,11 +130,11 @@ namespace Isis { for (int j = (i + 1); j < m_imageList.size(); j++) { Cube cube2; cube2.open(m_imageList[j].toString()); - IString cubeStr1((int)(i + 1)); - IString cubeStr2((int)(j + 1)); - string statMsg = "Gathering Overlap Statisitcs for Cube " + + QString cubeStr1 = toString((int)(i + 1)); + QString cubeStr2 = toString((int)(j + 1)); + QString statMsg = "Gathering Overlap Statisitcs for Cube " + cubeStr1 + " vs " + cubeStr2 + " of " + - IString(m_maxCube); + toString(m_maxCube); // Get overlap statistics for cubes OverlapStatistics oStats(cube1, cube2, statMsg, percent); @@ -166,7 +165,7 @@ namespace Isis { // Print an error if one or more of the images does not overlap another { - string badFiles = ""; + QString badFiles = ""; for (int img = 0; img < m_imageList.size(); img++) { // Print the name of each input cube without an overlap if (!doesOverlapList[img]) { @@ -174,7 +173,7 @@ namespace Isis { } } if (badFiles != "") { - string msg = "File(s) " + badFiles; + QString msg = "File(s) " + badFiles; msg += " do(es) not overlap any other input images with enough valid pixels"; throw IException(IException::User, msg, _FILEINFO_); } @@ -222,11 +221,11 @@ namespace Isis { PvlObject equ("EqualizationInformation"); PvlGroup gen("General"); - gen += PvlKeyword("TotalOverlaps", m_validCnt + m_invalidCnt); - gen += PvlKeyword("ValidOverlaps", m_validCnt); - gen += PvlKeyword("InvalidOverlaps", m_invalidCnt); + gen += PvlKeyword("TotalOverlaps", toString(m_validCnt + m_invalidCnt)); + gen += PvlKeyword("ValidOverlaps", toString(m_validCnt)); + gen += PvlKeyword("InvalidOverlaps", toString(m_invalidCnt)); gen += PvlKeyword("Weighted", (m_wtopt) ? "true" : "false"); - gen += PvlKeyword("MinCount", m_mincnt); + gen += PvlKeyword("MinCount", toString(m_mincnt)); equ.AddGroup(gen); for (int img = 0; img < m_imageList.size(); img++) { // Format and name information @@ -237,11 +236,11 @@ namespace Isis { // Band by band statistics for (int band = 1; band <= m_maxBand; band++) { - IString mult(m_adjustments[img]->getGain(band - 1)); - IString base(m_adjustments[img]->getOffset(band - 1)); - IString avg(m_adjustments[img]->getAverage(band - 1)); - IString bandNum(band); - string bandStr = "Band" + bandNum; + QString mult = toString(m_adjustments[img]->getGain(band - 1)); + QString base = toString(m_adjustments[img]->getOffset(band - 1)); + QString avg = toString(m_adjustments[img]->getAverage(band - 1)); + QString bandNum = toString(band); + QString bandStr = "Band" + bandNum; PvlKeyword bandStats(bandStr); bandStats += mult; bandStats += base; @@ -255,7 +254,7 @@ namespace Isis { } - void Equalization::importStatistics(string instatsFileName) { + void Equalization::importStatistics(QString instatsFileName) { // Check for errors with the input statistics vector normIndices = validateInputStatistics(instatsFileName); @@ -272,9 +271,9 @@ namespace Isis { // Get and store the modifiers for each band for (int band = 1; band < normalization.Keywords(); band++) { - adjustment->addGain(normalization[band][0]); - adjustment->addOffset(normalization[band][1]); - adjustment->addAverage(normalization[band][2]); + adjustment->addGain(toDouble(normalization[band][0])); + adjustment->addOffset(toDouble(normalization[band][1])); + adjustment->addAverage(toDouble(normalization[band][2])); } addAdjustment(adjustment); @@ -282,24 +281,24 @@ namespace Isis { } - void Equalization::applyCorrection(string toListName="") { + void Equalization::applyCorrection(QString toListName="") { FileList outList; fillOutList(outList, toListName); - IString maxCubeStr((int) m_imageList.size()); + QString maxCubeStr = toString((int) m_imageList.size()); for (int img = 0; img < m_imageList.size(); img++) { // Set up for progress bar ProcessByLine p; - p.Progress()->SetText("Equalizing Cube " + IString((int) img + 1) + + p.Progress()->SetText("Equalizing Cube " + toString((int) img + 1) + " of " + maxCubeStr); // Open input cube CubeAttributeInput att; - const string inp = m_imageList[img].toString(); + const QString inp = m_imageList[img].toString(); Cube *icube = p.SetInputCube(inp, att); // Allocate output cube - string out = outList[img].toString(); + QString out = outList[img].toString(); CubeAttributeOutput outAtt; p.SetOutputCube(out, outAtt, icube->getSampleCount(), icube->getLineCount(), icube->getBandCount()); @@ -315,11 +314,11 @@ namespace Isis { PvlGroup Equalization::getResults() { // TODO combine summary info into getSummary method and use with write PvlGroup results("Results"); - results += PvlKeyword("TotalOverlaps", m_validCnt + m_invalidCnt); - results += PvlKeyword("ValidOverlaps", m_validCnt); - results += PvlKeyword("InvalidOverlaps", m_invalidCnt); + results += PvlKeyword("TotalOverlaps", toString(m_validCnt + m_invalidCnt)); + results += PvlKeyword("ValidOverlaps", toString(m_validCnt)); + results += PvlKeyword("InvalidOverlaps", toString(m_invalidCnt)); results += PvlKeyword("Weighted", (m_wtopt) ? "true" : "false"); - results += PvlKeyword("MinCount", m_mincnt); + results += PvlKeyword("MinCount", toString(m_mincnt)); // Name and band modifiers for each image for (int img = 0; img < m_imageList.size(); img++) { @@ -327,11 +326,11 @@ namespace Isis { // Band by band statistics for (int band = 1; band <= m_maxBand; band++) { - IString mult(m_adjustments[img]->getGain(band - 1)); - IString base(m_adjustments[img]->getOffset(band - 1)); - IString avg(m_adjustments[img]->getAverage(band - 1)); - IString bandNum(band); - string bandStr = "Band" + bandNum; + QString mult = toString(m_adjustments[img]->getGain(band - 1)); + QString base = toString(m_adjustments[img]->getOffset(band - 1)); + QString avg = toString(m_adjustments[img]->getAverage(band - 1)); + QString bandNum = toString(band); + QString bandStr = "Band" + bandNum; PvlKeyword bandStats(bandStr); bandStats += mult; bandStats += base; @@ -344,7 +343,7 @@ namespace Isis { } - void Equalization::write(string outstatsFileName) { + void Equalization::write(QString outstatsFileName) { // Write the equalization and overlap statistics to the file m_results->Write(outstatsFileName); } @@ -356,13 +355,13 @@ namespace Isis { } - void Equalization::loadInputs(string fromListName) { + void Equalization::loadInputs(QString fromListName) { // Get the list of cubes to mosaic m_imageList.read(fromListName); m_maxCube = m_imageList.size(); if (m_imageList.size() < 2) { - string msg = "The input file [" + fromListName + + QString msg = "The input file [" + fromListName + "] must contain at least 2 file names"; throw IException(IException::User, msg, _FILEINFO_); } @@ -375,7 +374,7 @@ namespace Isis { } - void Equalization::setInput(int index, string value) { + void Equalization::setInput(int index, QString value) { m_imageList[index] = value; } @@ -385,13 +384,17 @@ namespace Isis { } - void Equalization::fillOutList(FileList &outList, string toListName) { - (toListName.empty()) ? generateOutputs(outList) : - loadOutputs(outList, toListName); + void Equalization::fillOutList(FileList &outList, QString toListName) { + if (toListName.isEmpty()) { + generateOutputs(outList); + } + else { + loadOutputs(outList, toListName); + } } - void Equalization::errorCheck(string fromListName) { + void Equalization::errorCheck(QString fromListName) { for (int i = 0; i < m_imageList.size(); i++) { Cube cube1; cube1.open(m_imageList[i].toString()); @@ -402,7 +405,7 @@ namespace Isis { // Make sure number of bands match if (m_maxBand != cube2.getBandCount()) { - string msg = "Number of bands do not match between cubes [" + + QString msg = "Number of bands do not match between cubes [" + m_imageList[i].toString() + "] and [" + m_imageList[j].toString() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -413,7 +416,7 @@ namespace Isis { // Test to make sure projection parameters match if (*proj1 != *proj2) { - string msg = "Mapping groups do not match between cubes [" + + QString msg = "Mapping groups do not match between cubes [" + m_imageList[i].toString() + "] and [" + m_imageList[j].toString() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -425,19 +428,19 @@ namespace Isis { void Equalization::generateOutputs(FileList &outList) { for (int img = 0; img < m_imageList.size(); img++) { FileName file(m_imageList[img]); - string filename = file.path() + "/" + file.baseName() + + QString filename = file.path() + "/" + file.baseName() + ".equ." + file.extension(); outList.push_back(FileName(filename)); } } - void Equalization::loadOutputs(FileList &outList, string toListName) { + void Equalization::loadOutputs(FileList &outList, QString toListName) { outList.read(FileName(toListName)); // Make sure each file in the tolist matches a file in the fromlist if (outList.size() != m_imageList.size()) { - string msg = "Each input file in the FROM LIST must have a "; + QString msg = "Each input file in the FROM LIST must have a "; msg += "corresponding output file in the TO LIST."; throw IException(IException::User, msg, _FILEINFO_); } @@ -446,7 +449,7 @@ namespace Isis { // corresponding input files for (int i = 0; i < outList.size(); i++) { if (outList[i].toString().compare(m_imageList[i].toString()) == 0) { - string msg = "The to list file [" + outList[i].toString() + + QString msg = "The to list file [" + outList[i].toString() + "] has the same name as its corresponding from list file."; throw IException(IException::User, msg, _FILEINFO_); } @@ -494,13 +497,13 @@ namespace Isis { } - vector Equalization::validateInputStatistics(string instatsFileName) { + vector Equalization::validateInputStatistics(QString instatsFileName) { Pvl inStats(instatsFileName); PvlObject &equalInfo = inStats.FindObject("EqualizationInformation"); // Make sure each file in the instats matches a file in the fromlist if (m_imageList.size() > equalInfo.Groups() - 1) { - string msg = "Each input file in the FROM LIST must have a "; + QString msg = "Each input file in the FROM LIST must have a "; msg += "corresponding input file in the INPUT STATISTICS."; throw IException(IException::User, msg, _FILEINFO_); } @@ -509,11 +512,11 @@ namespace Isis { // Check that each file in the FROM LIST is present in the INPUT STATISTICS for (int i = 0; i < m_imageList.size(); i++) { - string fromFile = m_imageList[i].original(); + QString fromFile = m_imageList[i].original(); bool foundFile = false; for (int j = 1; j < equalInfo.Groups(); j++) { PvlGroup &normalization = equalInfo.Group(j); - string normFile = normalization["FileName"][0]; + QString normFile = normalization["FileName"][0]; if (fromFile == normFile) { // Store the index in INPUT STATISTICS file corresponding to the @@ -523,7 +526,7 @@ namespace Isis { } } if (!foundFile) { - string msg = "The from list file [" + fromFile + + QString msg = "The from list file [" + fromFile + "] does not have any corresponding file in the stats list."; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Equalization/Equalization.h b/isis/src/base/objs/Equalization/Equalization.h index 9c2b0199b3..47c088a57d 100644 --- a/isis/src/base/objs/Equalization/Equalization.h +++ b/isis/src/base/objs/Equalization/Equalization.h @@ -143,31 +143,31 @@ namespace Isis { Equalization(); public: - Equalization(std::string fromListName); + Equalization(QString fromListName); virtual ~Equalization(); - void addHolds(std::string holdListName); + void addHolds(QString holdListName); void calculateStatistics(double sampPercent, int mincnt, bool wtopt, int sType); - void importStatistics(std::string instatsFileName); - void applyCorrection(std::string toListName); + void importStatistics(QString instatsFileName); + void applyCorrection(QString toListName); PvlGroup getResults(); - void write(std::string outstatsFileName); + void write(QString outstatsFileName); double evaluate(double dn, int imageIndex, int bandIndex) const; protected: - void loadInputs(std::string fromListName); - void setInput(int index, std::string value); + void loadInputs(QString fromListName); + void setInput(int index, QString value); const FileList & getInputs() const; - virtual void fillOutList(FileList &outList, std::string toListName); - virtual void errorCheck(std::string fromListName); + virtual void fillOutList(FileList &outList, QString toListName); + virtual void errorCheck(QString fromListName); void generateOutputs(FileList &outList); - void loadOutputs(FileList &outList, std::string toListName); + void loadOutputs(FileList &outList, QString toListName); void loadHolds(OverlapNormalization *oNorm); void setResults(std::vector &overlapStats); @@ -181,7 +181,7 @@ namespace Isis { private: void init(); - std::vector validateInputStatistics(std::string instatsFileName); + std::vector validateInputStatistics(QString instatsFileName); FileList m_imageList; std::vector m_adjustments; diff --git a/isis/src/base/objs/Equalization/unitTest.cpp b/isis/src/base/objs/Equalization/unitTest.cpp index 359d5e28c2..ece3b96164 100644 --- a/isis/src/base/objs/Equalization/unitTest.cpp +++ b/isis/src/base/objs/Equalization/unitTest.cpp @@ -49,8 +49,8 @@ int main(int argc, char *argv[]) { cout << setprecision(9); try { - string fromList = "FromList.lst"; - string holdList = "HoldList.lst"; + QString fromList = "FromList.lst"; + QString holdList = "HoldList.lst"; cout << "UnitTest for Equalization" << endl; Equalization equalizer(fromList); @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) { for (int i = 0; i < imageList.size(); i++) { ProcessByLine p; CubeAttributeInput att; - const string inp = imageList[i].toString(); + const QString inp = imageList[i].toString(); Cube *inputCube = p.SetInputCube(inp, att); TestFunctor func(&equalizer, inputCube->getLineCount(), i); p.ProcessCubeInPlace(func, false); diff --git a/isis/src/base/objs/EquatorialCylindricalShape/EquatorialCylindricalShape.cpp b/isis/src/base/objs/EquatorialCylindricalShape/EquatorialCylindricalShape.cpp index 76964779e7..b285777970 100644 --- a/isis/src/base/objs/EquatorialCylindricalShape/EquatorialCylindricalShape.cpp +++ b/isis/src/base/objs/EquatorialCylindricalShape/EquatorialCylindricalShape.cpp @@ -38,7 +38,7 @@ namespace Isis { // Read in the min/max radius of the DEM file and the Scale of the DEM // file in pixels/degree if (!demCube()->hasTable("ShapeModelStatistics")) { - std::string msg = "The input cube references a ShapeModel that has " + QString msg = "The input cube references a ShapeModel that has " "not been updated for the new ray tracing algorithm. All DEM " "files must now be padded at the poles and contain a " "ShapeModelStatistics table defining their minimum and maximum " diff --git a/isis/src/base/objs/EquatorialCylindricalShape/unitTest.cpp b/isis/src/base/objs/EquatorialCylindricalShape/unitTest.cpp index c5054f5402..d995bafcec 100644 --- a/isis/src/base/objs/EquatorialCylindricalShape/unitTest.cpp +++ b/isis/src/base/objs/EquatorialCylindricalShape/unitTest.cpp @@ -41,7 +41,7 @@ using namespace Isis; int main() { Preference::Preferences(true); - string inputFile = "$mgs/testData/ab102401.cub"; + QString inputFile = "$mgs/testData/ab102401.cub"; // string inputFile = "/work/projects/isis/latest/m00775/test/M123149061RE.lev1.cub"; Cube cube; cube.open(inputFile); diff --git a/isis/src/base/objs/Equirectangular/Equirectangular.cpp b/isis/src/base/objs/Equirectangular/Equirectangular.cpp index 3ea12ce430..0d4931598a 100644 --- a/isis/src/base/objs/Equirectangular/Equirectangular.cpp +++ b/isis/src/base/objs/Equirectangular/Equirectangular.cpp @@ -61,7 +61,7 @@ namespace Isis { // Compute the default value if allowed and needed if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = 0.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLatitude"))) { @@ -75,7 +75,7 @@ namespace Isis { else { lat = 0.0; } - mapGroup += PvlKeyword("CenterLatitude", lat); + mapGroup += PvlKeyword("CenterLatitude", toString(lat)); } // Get the center longitude, convert to radians, adjust for longitude @@ -94,19 +94,19 @@ namespace Isis { mapGroup += PvlKeyword("CenterLatitudeRadius"); } - mapGroup["CenterLatitudeRadius"] = m_clatRadius; + mapGroup["CenterLatitudeRadius"] = toString(m_clatRadius); // Compute cos of the center latitude and make sure it is valid as // we will be dividing with it later on m_cosCenterLatitude = cos(m_centerLatitude); if (fabs(m_cosCenterLatitude) < DBL_EPSILON) { - string message = "Keyword value for CenterLatitude is " + QString message = "Keyword value for CenterLatitude is " "too close to the pole"; throw IException(IException::Io, message, _FILEINFO_); } } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } } @@ -136,18 +136,18 @@ namespace Isis { /** * Returns the name of the map projection, "Equirectangular" * - * @return string Name of projection, "Equirectangular" + * @return QString Name of projection, "Equirectangular" */ - string Equirectangular::Name() const { + QString Equirectangular::Name() const { return "Equirectangular"; } /** * Returns the version of the map projection * - * @return string Version number + * @return QString Version number */ - string Equirectangular::Version() const { + QString Equirectangular::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/Equirectangular/Equirectangular.h b/isis/src/base/objs/Equirectangular/Equirectangular.h index 9d39164a8d..5f400c6560 100644 --- a/isis/src/base/objs/Equirectangular/Equirectangular.h +++ b/isis/src/base/objs/Equirectangular/Equirectangular.h @@ -81,8 +81,8 @@ namespace Isis { ~Equirectangular(); bool operator==(const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; double TrueScaleLatitude() const; bool IsEquatorialCylindrical(); diff --git a/isis/src/base/objs/Equirectangular/unitTest.cpp b/isis/src/base/objs/Equirectangular/unitTest.cpp index 6ebf5569da..1b1acea4c2 100644 --- a/isis/src/base/objs/Equirectangular/unitTest.cpp +++ b/isis/src/base/objs/Equirectangular/unitTest.cpp @@ -16,15 +16,15 @@ int main(int argc, char *argv[]) { Pvl lab; lab.AddGroup(PvlGroup("Mapping")); PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += PvlKeyword("EquatorialRadius", 1.0); - mapGroup += PvlKeyword("PolarRadius", 1.0); + mapGroup += PvlKeyword("EquatorialRadius", toString(1.0)); + mapGroup += PvlKeyword("PolarRadius", toString(1.0)); mapGroup += PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += PvlKeyword("LongitudeDomain", 180); - mapGroup += PvlKeyword("MinimumLatitude", -90.0); - mapGroup += PvlKeyword("MaximumLatitude", 90.0); - mapGroup += PvlKeyword("MinimumLongitude", -180.0); - mapGroup += PvlKeyword("MaximumLongitude", 180.0); + mapGroup += PvlKeyword("LongitudeDomain", toString(180)); + mapGroup += PvlKeyword("MinimumLatitude", toString(-90.0)); + mapGroup += PvlKeyword("MaximumLatitude", toString(90.0)); + mapGroup += PvlKeyword("MinimumLongitude", toString(-180.0)); + mapGroup += PvlKeyword("MaximumLongitude", toString(180.0)); mapGroup += PvlKeyword("ProjectionName", "Equirectangular"); cout << "Test missing center longitude keyword ..." << endl; @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { } cout << endl; - mapGroup += PvlKeyword("CenterLongitude", -90.0); + mapGroup += PvlKeyword("CenterLongitude", toString(-90.0)); cout << "Test missing center latitude keyword ..." << endl; try { @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) { } cout << endl; - mapGroup += PvlKeyword("CenterLatitude", 0.0); + mapGroup += PvlKeyword("CenterLatitude", toString(0.0)); Projection &p = *ProjectionFactory::Create(lab); @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) { cout << endl; std::cout << "Check Invalid Latitude" << std::endl; - mapGroup.AddKeyword(PvlKeyword("CenterLatitude", 90.0), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("CenterLatitude", toString(90.0)), Pvl::Replace); std::cout << mapGroup << std::endl; try { Equirectangular p2(lab); diff --git a/isis/src/base/objs/ExportDescription/ExportDescription.cpp b/isis/src/base/objs/ExportDescription/ExportDescription.cpp index bb7f6ec0a4..9140f650ce 100644 --- a/isis/src/base/objs/ExportDescription/ExportDescription.cpp +++ b/isis/src/base/objs/ExportDescription/ExportDescription.cpp @@ -4,8 +4,7 @@ #include -using namespace Isis; - +#include "IString.h" namespace Isis { /** @@ -56,7 +55,7 @@ namespace Isis { break; default: throw IException(IException::Programmer, - "Invalid export pixel type [" + IString(type) + "]", + "Invalid export pixel type [" + toString(type) + "]", _FILEINFO_); } } diff --git a/isis/src/base/objs/ExportDescription/unitTest.cpp b/isis/src/base/objs/ExportDescription/unitTest.cpp index 2e8e959a15..4e6c300bc7 100644 --- a/isis/src/base/objs/ExportDescription/unitTest.cpp +++ b/isis/src/base/objs/ExportDescription/unitTest.cpp @@ -79,9 +79,9 @@ int main() { compareEqual(innerName + "::filename()", filenames[i].name(), channel.filename().name()); compareEqual(innerName + "::attributes()", - IString("1"), - IString( - QString::fromStdString(channel.attributes().toString()).mid(1))); + QString("1"), + QString( + channel.attributes().toString()).mid(1)); if (i == 0) { compareEqual(innerName + "::hasCustomRange()", diff --git a/isis/src/base/objs/ExportPdsTable/ExportPdsTable.cpp b/isis/src/base/objs/ExportPdsTable/ExportPdsTable.cpp index 75be5e5056..193ba06555 100644 --- a/isis/src/base/objs/ExportPdsTable/ExportPdsTable.cpp +++ b/isis/src/base/objs/ExportPdsTable/ExportPdsTable.cpp @@ -81,7 +81,7 @@ namespace Isis { */ PvlObject ExportPdsTable::exportTable(char *pdsTableBuffer, int outputFileRecordBytes, - IString pdsTableByteOrder) { + QString pdsTableByteOrder) { // Currently, we will not allow our table rows to be wrapped. So we must // check that the rowbytes of the output table are no larger than the total // record bytes allowed in the output pds file @@ -89,17 +89,17 @@ namespace Isis { if (m_rowBytes > m_outputRecordBytes) { throw IException(IException::Unknown, "Unable to export Isis::Table object to PDS. The " - "Isis::Table record size [" + IString(m_rowBytes) + "Isis::Table record size [" + toString(m_rowBytes) + "] is larger than the record bytes allowed in the " - "PDS file [" + IString(m_outputRecordBytes) + "].", + "PDS file [" + toString(m_outputRecordBytes) + "].", _FILEINFO_); } // update variables - m_pdsByteOrder = pdsTableByteOrder.UpCase(); + m_pdsByteOrder = pdsTableByteOrder.toUpper(); if (m_pdsByteOrder != "MSB" && m_pdsByteOrder != "LSB") { - IString msg = "Unable to export the Isis Table [" + m_isisTable->Name() + QString msg = "Unable to export the Isis Table [" + m_isisTable->Name() + "] to a PDS table using the requested byte order [" + m_pdsByteOrder + "]. Valid values are MSB or LSB."; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -138,28 +138,28 @@ namespace Isis { * @return PvlObject containing PDS Table metadata. */ PvlObject ExportPdsTable::fillMetaData() { - IString pdsTableName = formatPdsTableName(); + QString pdsTableName = formatPdsTableName(); PvlObject pdsTableLabelInfo(pdsTableName); // Data Object Descriptions // NOTE: this class is currently only exporting BINARY format PDS tables. // implementation may be added later to export ASCII PDS tables. pdsTableLabelInfo.AddKeyword(PvlKeyword("INTERCHANGE_FORMAT", "BINARY")); - pdsTableLabelInfo.AddKeyword(PvlKeyword("ROWS", m_isisTable->Records())); - pdsTableLabelInfo.AddKeyword(PvlKeyword("COLUMNS", m_isisTable->RecordFields())); - pdsTableLabelInfo.AddKeyword(PvlKeyword("ROW_BYTES", m_rowBytes)); - pdsTableLabelInfo.AddKeyword(PvlKeyword("ROW_SUFFIX_BYTES", m_outputRecordBytes - m_rowBytes)); + pdsTableLabelInfo.AddKeyword(PvlKeyword("ROWS", toString(m_isisTable->Records()))); + pdsTableLabelInfo.AddKeyword(PvlKeyword("COLUMNS", toString(m_isisTable->RecordFields()))); + pdsTableLabelInfo.AddKeyword(PvlKeyword("ROW_BYTES", toString(m_rowBytes))); + pdsTableLabelInfo.AddKeyword(PvlKeyword("ROW_SUFFIX_BYTES", toString(m_outputRecordBytes - m_rowBytes))); int startByte = 1; // PDS begins indexing at 1 for(int fieldIndex = 0; fieldIndex < m_isisTable->RecordFields(); fieldIndex++) { int columnBytes = 0; TableField field = (*m_isisTable)[0][fieldIndex]; PvlObject columnObj("COLUMN"); - columnObj.AddKeyword(PvlKeyword("COLUMN_NUMBER", fieldIndex + 1)); + columnObj.AddKeyword(PvlKeyword("COLUMN_NUMBER", toString(fieldIndex + 1))); columnObj.AddKeyword(PvlKeyword("NAME", field.name())); if (field.type() == TableField::Text) { columnObj.AddKeyword(PvlKeyword("DATA_TYPE", "CHARACTER")); - string val = (string)field; + QString val = field; for(int i = 0; i < field.size(); i++) { columnBytes++; } @@ -200,13 +200,13 @@ namespace Isis { else { // This error is not covered in the unitTest since currently, there // are no other valid values for TableField types. It is meant to // catch other values if they are added to Table Field. - string msg = "Unable to export Isis::Table object to PDS. Invalid " - "field type found for [" + field.name() + "]."; + QString msg = "Unable to export Isis::Table object to PDS. Invalid " + "field type found for [" + field.name() + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } - columnObj.AddKeyword(PvlKeyword("START_BYTE", startByte)); + columnObj.AddKeyword(PvlKeyword("START_BYTE", toString(startByte))); startByte += columnBytes; - columnObj.AddKeyword(PvlKeyword("BYTES", IString(columnBytes))); + columnObj.AddKeyword(PvlKeyword("BYTES", toString(columnBytes))); pdsTableLabelInfo.AddObject(columnObj); } return pdsTableLabelInfo; @@ -215,9 +215,9 @@ namespace Isis { /** * Format the PDS table object name using the Isis3 table name. * - * @return IString containing the formatted PDS table name. + * @return QString containing the formatted PDS table name. */ - IString ExportPdsTable::formatPdsTableName() { + QString ExportPdsTable::formatPdsTableName() { return ExportPdsTable::formatPdsTableName(m_isisTable->Name()); } @@ -227,16 +227,15 @@ namespace Isis { * a PDS table name that is underscore separated, all upper case and * with "_TABLE" appended to the end of the name, if not already present. * - * @param isisTableName An IString containing the Isis3 upper camel case + * @param isisTableName An QString containing the Isis3 upper camel case * table name. - * @return IString containing the formatted PDS table name. + * @return QString containing the formatted PDS table name. */ - IString ExportPdsTable::formatPdsTableName(IString isisTableName) { - IString tableName = IString::ConvertWhiteSpace(isisTableName); - tableName.Compress(); - IString pdsTableName; + QString ExportPdsTable::formatPdsTableName(QString isisTableName) { + QString tableName = isisTableName.simplified(); + QString pdsTableName; pdsTableName.push_back(tableName[0]); - for (unsigned int i = 1 ; i < tableName.size() ; i++) { + for (int i = 1 ; i < tableName.size() ; i++) { if (tableName[i] >= 65 && tableName[i] <= 90) { pdsTableName.push_back('_'); pdsTableName.push_back(tableName[i]); @@ -245,8 +244,8 @@ namespace Isis { pdsTableName.push_back(tableName[i]); } } - pdsTableName = pdsTableName.UpCase(); - if (pdsTableName.find("_TABLE") != pdsTableName.length() - 6) { + pdsTableName = pdsTableName.toUpper(); + if (pdsTableName.indexOf("_TABLE") != pdsTableName.length() - 6) { pdsTableName += "_TABLE"; } return pdsTableName; @@ -289,11 +288,11 @@ namespace Isis { } } else if(field.isText()) { - string val = (string)field; + QString val = field; // copy each character and count each byte individually for(int i = 0; i < field.size(); i++) { if(i < (int)val.length()) { - buffer[startByte] = val[i]; + buffer[startByte] = val[i].toAscii(); } else { // this line is not covered by unitTest since this is a case that @@ -315,8 +314,8 @@ namespace Isis { else { // This error is not covered in the unitTest since currently, there // are no other valid values for TableField types. It is meant to // catch other values if they are added to Table Field. - string msg = "Unable to export Isis::Table object to PDS. Invalid " - "field type found for [" + field.name() + "]."; + QString msg = "Unable to export Isis::Table object to PDS. Invalid " + "field type found for [" + field.name() + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -326,7 +325,7 @@ namespace Isis { // tested since it should not be possible // unless the number of bytes reserved for // each of the types changes - IString msg = "Unable to export Isis::Table object [" + m_isisTable->Name() + QString msg = "Unable to export Isis::Table object [" + m_isisTable->Name() + "] to PDS. Record lengths are uneven."; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/ExportPdsTable/ExportPdsTable.h b/isis/src/base/objs/ExportPdsTable/ExportPdsTable.h index b7e7fd49df..f3f59a815f 100644 --- a/isis/src/base/objs/ExportPdsTable/ExportPdsTable.h +++ b/isis/src/base/objs/ExportPdsTable/ExportPdsTable.h @@ -23,11 +23,11 @@ */ #include -#include "IString.h" + +#include namespace Isis { class EndianSwapper; - class IString; class Pvl; class PvlObject; class Table; @@ -69,9 +69,9 @@ namespace Isis { ExportPdsTable(Table isisTable); ~ExportPdsTable(); PvlObject exportTable(char *pdsTableBuffer, int pdsFileRecordBytes, - IString pdsByteOrder); - IString formatPdsTableName(); - static IString formatPdsTableName(IString isisTableName); + QString pdsByteOrder); + QString formatPdsTableName(); + static QString formatPdsTableName(QString isisTableName); private: void Pack(TableRecord record, char *buffer, EndianSwapper *endianSwap); PvlObject fillMetaData(); @@ -85,7 +85,7 @@ namespace Isis { PDS table. This value is the same as the RecordSize (number of bytes per record) of the Isis3 Table.**/ - IString m_pdsByteOrder; /**< A string indicating the byte order of the + QString m_pdsByteOrder; /**< A string indicating the byte order of the exported PDS file.**/ }; } diff --git a/isis/src/base/objs/ExportPdsTable/ExportPdsTable.truth b/isis/src/base/objs/ExportPdsTable/ExportPdsTable.truth index 13d81569190ee3f5ab57ec5693cc98c9badfbd5f..8fa4f59518b400f82cceb771c273049bb383b66c 100644 GIT binary patch delta 15 XcmZ3&v4~^BmW^9=88<&>bYubmG@%9w delta 19 bcmZ3)v4ms77Dk4RTXY#288$y;bYubmLNf*k diff --git a/isis/src/base/objs/ExportPdsTable/unitTest.cpp b/isis/src/base/objs/ExportPdsTable/unitTest.cpp index bc5cf246fc..412ebc5b7c 100644 --- a/isis/src/base/objs/ExportPdsTable/unitTest.cpp +++ b/isis/src/base/objs/ExportPdsTable/unitTest.cpp @@ -1,4 +1,7 @@ #include "ExportPdsTable.h" + +#include + #include "FileName.h" #include "IException.h" #include "ImportPdsTable.h" @@ -45,17 +48,17 @@ int main(int argc, char *argv[]) { PvlObject metadata = exportedTable.exportTable(buf, tableRecBytes, "lsb"); // Create a label file containing the needed information. FileName lsbLabelFile("$temporary/lsbPdsTable.lbl"); - ofstream outputLsbLabel((lsbLabelFile.expanded()).c_str()); + ofstream outputLsbLabel((lsbLabelFile.expanded()).toAscii().data()); outputLsbLabel << PvlKeyword("RECORD_TYPE", "FIXED_LENGTH") << endl; - outputLsbLabel << PvlKeyword("RECORD_BYTES", tableRecBytes) << endl; - IString tableName = ExportPdsTable::formatPdsTableName(table.Name()); + outputLsbLabel << PvlKeyword("RECORD_BYTES", toString(tableRecBytes)) << endl; + QString tableName = ExportPdsTable::formatPdsTableName(table.Name()); outputLsbLabel << PvlKeyword("^" + tableName, "lsbPdsTable.dat") << endl; outputLsbLabel << endl; // Add table object to label keywords outputLsbLabel << metadata; outputLsbLabel.close(); FileName lsbTableFile("$temporary/lsbPdsTable.dat"); - ofstream outputLsbTable((lsbTableFile.expanded()).c_str()); + ofstream outputLsbTable((lsbTableFile.expanded()).toAscii().data()); outputLsbTable.write(buf, tableRecBytes*table.Records()); outputLsbTable.close(); ImportPdsTable lsbTable(lsbLabelFile.expanded(), lsbTableFile.expanded(), tableName); @@ -67,14 +70,14 @@ int main(int argc, char *argv[]) { cout << reimportedLsbTable[0][2].name() << "\t"; cout << reimportedLsbTable[0][3].name() << "\n"; for (int i = 0; i < reimportedLsbTable.Records(); i++) { - cout << IString((double) reimportedLsbTable[i][0]) << "\t\t\t"; - cout << IString((int) reimportedLsbTable[i][1]) << "\t\t\t\t"; - cout << IString((string) reimportedLsbTable[i][2]) << "\t\t\t"; - cout << IString((float) reimportedLsbTable[i][3]) << "\n"; + cout << toString((double) reimportedLsbTable[i][0]) << "\t\t\t"; + cout << toString((int) reimportedLsbTable[i][1]) << "\t\t\t\t"; + cout << (QString) reimportedLsbTable[i][2] << "\t\t\t"; + cout << toString((float) reimportedLsbTable[i][3]) << "\n"; } // remove files and reset buffer - remove((lsbLabelFile.expanded()).c_str()); - remove((lsbTableFile.expanded()).c_str()); + QFile::remove((lsbLabelFile.expanded())); + QFile::remove((lsbTableFile.expanded())); delete [] buf; buf = NULL; cout << endl; @@ -87,16 +90,16 @@ int main(int argc, char *argv[]) { metadata = exportedTable.exportTable(buf, tableRecBytes, "msb"); // Create a label file containing the needed information. FileName msbLabelFile("$temporary/msbPdsTable.lbl"); - ofstream outputMsbLabel((msbLabelFile.expanded()).c_str()); + ofstream outputMsbLabel((msbLabelFile.expanded()).toAscii().data()); outputMsbLabel << PvlKeyword("RECORD_TYPE", "FIXED_LENGTH") << endl; - outputMsbLabel << PvlKeyword("RECORD_BYTES", tableRecBytes) << endl; + outputMsbLabel << PvlKeyword("RECORD_BYTES", toString(tableRecBytes)) << endl; outputMsbLabel << PvlKeyword("^" + tableName, "msbPdsTable.dat") << endl; outputMsbLabel << endl; // Add table object to label keywords outputMsbLabel << metadata; outputMsbLabel.close(); FileName msbTableFile("$temporary/msbPdsTable.dat"); - ofstream outputMsbTable((msbTableFile.expanded()).c_str()); + ofstream outputMsbTable((msbTableFile.expanded()).toAscii().data()); outputMsbTable.write(buf, tableRecBytes*table.Records()); outputMsbTable.close(); ImportPdsTable msbTable(msbLabelFile.expanded(), msbTableFile.expanded(), tableName); @@ -110,12 +113,12 @@ int main(int argc, char *argv[]) { for (int i = 0; i < reimportedMsbTable.Records(); i++) { cout << IString((double) reimportedMsbTable[i][0]) << "\t\t\t"; cout << IString((int) reimportedMsbTable[i][1]) << "\t\t\t\t"; - cout << IString((string) reimportedMsbTable[i][2]) << "\t\t\t"; + cout << IString((QString) reimportedMsbTable[i][2]) << "\t\t\t"; cout << IString((float) reimportedMsbTable[i][3]) << "\n"; } // remove files and reset buffer and tableRecBytes - remove((msbLabelFile.expanded()).c_str()); - remove((msbTableFile.expanded()).c_str()); + QFile::remove((msbLabelFile.expanded())); + QFile::remove((msbTableFile.expanded())); delete [] buf; buf = NULL; tableRecBytes -= 4; diff --git a/isis/src/base/objs/FileList/FileList.cpp b/isis/src/base/objs/FileList/FileList.cpp index 5716f9d576..f1cfb38cc6 100644 --- a/isis/src/base/objs/FileList/FileList.cpp +++ b/isis/src/base/objs/FileList/FileList.cpp @@ -66,9 +66,9 @@ namespace Isis { void FileList::read(FileName listFile) { // Open the file ifstream istm; - istm.open(listFile.toString().c_str(), std::ios::in); + istm.open(listFile.toString().toAscii().data(), std::ios::in); if(!istm) { - string message = Isis::Message::FileOpen(listFile.toString()); + QString message = Isis::Message::FileOpen(listFile.toString()); throw IException(IException::Io, message, _FILEINFO_); } @@ -82,7 +82,7 @@ namespace Isis { catch (IException &e) { printf("debugB\n"); istm.close(); - string msg = "File [" + listFile.toString() + "] contains no data"; + QString msg = "File [" + listFile.toString() + "] contains no data"; throw IException(IException::User, msg, _FILEINFO_); } @@ -152,7 +152,7 @@ namespace Isis { s = s.Token(" \n\r\t\v,"); } - this->push_back(s); + this->push_back(s.ToQt()); in.getline(buf, 65536); } } @@ -174,9 +174,9 @@ namespace Isis { void FileList::write(FileName outputFileList) { // Open the file ofstream ostm; - ostm.open(outputFileList.toString().c_str(), std::ios::out); + ostm.open(outputFileList.toString().toAscii().data(), std::ios::out); if (!ostm) { - string message = Message::FileOpen(outputFileList.toString()); + QString message = Message::FileOpen(outputFileList.toString()); throw IException(IException::Io, message, _FILEINFO_); } diff --git a/isis/src/base/objs/FileList/FileList.h b/isis/src/base/objs/FileList/FileList.h index 6e0d349ee8..24dd5c4668 100644 --- a/isis/src/base/objs/FileList/FileList.h +++ b/isis/src/base/objs/FileList/FileList.h @@ -26,9 +26,10 @@ #include #include +class QString; + namespace Isis { class FileName; - class IString; /** * @brief Internalizes a list of files. * @@ -65,7 +66,7 @@ namespace Isis { */ class FileList : public QList { public: - //FileList(IString listFileString); + //FileList(QString listFileString); FileList(FileName listFile); FileList(std::istream &in); FileList(); @@ -74,7 +75,7 @@ namespace Isis { ~FileList() {}; void read(FileName listFile); - //void read(const std::string &list); + //void read(const QString &list); void read(std::istream &in); void write(FileName outputFileList); void write(std::ostream &out); diff --git a/isis/src/base/objs/FileName/FileName.cpp b/isis/src/base/objs/FileName/FileName.cpp index 25969c75d8..ebe3778b53 100644 --- a/isis/src/base/objs/FileName/FileName.cpp +++ b/isis/src/base/objs/FileName/FileName.cpp @@ -52,18 +52,6 @@ namespace Isis { } - FileName::FileName(const std::string &file) { - m_d = new Data; - m_d->setOriginal(file); - } - - - FileName::FileName(const IString &file) { - m_d = new Data; - m_d->setOriginal(file); - } - - FileName::FileName(const QString &file) { m_d = new Data; m_d->setOriginal(file); @@ -79,7 +67,7 @@ namespace Isis { } - IString FileName::originalPath() const { + QString FileName::originalPath() const { return QFileInfo(m_d->original(false)).path(); } @@ -97,12 +85,12 @@ namespace Isis { * "/home/me/img" * */ - IString FileName::path() const { + QString FileName::path() const { return QFileInfo(expanded()).path(); } - IString FileName::attributes() const { + QString FileName::attributes() const { QString result; QString fileNameWithAttribs = QFileInfo(m_d->original(true)).fileName(); @@ -115,36 +103,36 @@ namespace Isis { } - IString FileName::baseName() const { + QString FileName::baseName() const { return QFileInfo(m_d->original(false)).completeBaseName(); } - IString FileName::name() const { + QString FileName::name() const { return QFileInfo(m_d->original(false)).fileName(); } - IString FileName::extension() const { + QString FileName::extension() const { return QFileInfo(m_d->original(false)).suffix(); } - IString FileName::expanded() const { + QString FileName::expanded() const { return m_d->expanded(false); } - IString FileName::original() const { + QString FileName::original() const { return m_d->original(true); } - FileName FileName::addExtension(const IString &newExtension) const { + FileName FileName::addExtension(const QString &newExtension) const { FileName result = *this; if (result.extension() != newExtension) { - IString attributesStr = result.attributes().ToQt(); + QString attributesStr = result.attributes(); if (attributesStr == "") result = FileName(result.originalPath() + "/" + result.name() + "." + newExtension); @@ -158,7 +146,7 @@ namespace Isis { FileName FileName::removeExtension() const { - IString attributesStr = attributes().ToQt(); + QString attributesStr = attributes(); FileName result; if (attributesStr == "") @@ -170,7 +158,7 @@ namespace Isis { } - FileName FileName::setExtension(const IString &newExtension) const { + FileName FileName::setExtension(const QString &newExtension) const { FileName result = *this; if (extension() != newExtension) { @@ -189,12 +177,12 @@ namespace Isis { bool FileName::isNumericallyVersioned() const { - return FileName(expanded()).name().ToQt().contains("?"); + return FileName(expanded()).name().contains("?"); } bool FileName::isDateVersioned() const { - return FileName(expanded()).name().ToQt().contains(QRegExp("\\{.*\\}")); + return FileName(expanded()).name().contains(QRegExp("\\{.*\\}")); } @@ -207,7 +195,7 @@ namespace Isis { throw IException(IException::Unknown, QObject::tr("Asked for highest version of file named [%1] in [%2] but there " "are no version sequences in the name") - .arg(name().ToQt()).arg(originalPath().ToQt()), + .arg(name()).arg(originalPath()), _FILEINFO_); } @@ -234,7 +222,7 @@ namespace Isis { throw IException(IException::Unknown, QObject::tr("Asked for new version of file named [%1] in [%2] but there " "are no version sequences in the name") - .arg(name().ToQt()).arg(originalPath().ToQt()), + .arg(name()).arg(originalPath()), _FILEINFO_); } @@ -257,7 +245,7 @@ namespace Isis { throw IException(IException::Unknown, QObject::tr("Could not generate unique new version of file named [%1] in " "[%2] because the file [%3] exists") - .arg(name().ToQt()).arg(originalPath().ToQt()).arg(result.name().ToQt()), + .arg(name()).arg(originalPath()).arg(result.name()), _FILEINFO_); } @@ -275,7 +263,7 @@ namespace Isis { throw IException(IException::Unknown, QObject::tr("FileName does not support negative version numbers in the file name, " "tried to get version [%1] in file named [%2]") - .arg(versionNumber).arg(originalPath().ToQt() + "/" + file), + .arg(versionNumber).arg(originalPath() + "/" + file), _FILEINFO_); } @@ -283,7 +271,7 @@ namespace Isis { throw IException(IException::Unknown, QObject::tr("FileName does not support version numbers greater than what would fit in " "the file name, tried to get version [%1] in file named [%2]") - .arg(versionNumber).arg(originalPath().ToQt() + "/" + file), + .arg(versionNumber).arg(originalPath() + "/" + file), _FILEINFO_); } @@ -293,44 +281,44 @@ namespace Isis { file = before + QString("%1").arg(QString::number(versionNumber), width, '0') + after; - return FileName(originalPath().ToQt() + "/" + file); + return FileName(originalPath() + "/" + file); } FileName FileName::version(QDate versionDate) const { QString newName = versionDate.toString(fileNameQDatePattern()); - return FileName(originalPath().ToQt() + "/" + newName); + return FileName(originalPath() + "/" + newName); } bool FileName::fileExists() const { - return QFileInfo(expanded().ToQt()).exists(); + return QFileInfo(expanded()).exists(); } QDir FileName::dir() const { - return QFileInfo(expanded().ToQt()).dir(); + return QFileInfo(expanded()).dir(); } FileName FileName::createTempFile(FileName templateFileName) { - QString preppedFileName = QString("%1/%2XXXXXX.%3").arg(templateFileName.path().ToQt()) - .arg(templateFileName.baseName().ToQt()).arg(templateFileName.extension().ToQt()); + QString preppedFileName = QString("%1/%2XXXXXX.%3").arg(templateFileName.path()) + .arg(templateFileName.baseName()).arg(templateFileName.extension()); QTemporaryFile tempFile(preppedFileName); tempFile.setAutoRemove(false); if (!tempFile.open()) { throw IException(IException::Io, QObject::tr("Could not create a unique temporary file name based on [%1]") - .arg(templateFileName.original().ToQt()), + .arg(templateFileName.original()), _FILEINFO_); } // We want to set the 'original' path as correctly as possible. So let's use the input original // path with the output temp file's file name in our result. FileName result; - QString newTempFileNameStr = templateFileName.originalPath().ToQt() + "/" + + QString newTempFileNameStr = templateFileName.originalPath() + "/" + QFileInfo(tempFile.fileName()).fileName(); result = FileName(newTempFileNameStr); @@ -338,7 +326,7 @@ namespace Isis { } - IString FileName::toString() const { + QString FileName::toString() const { return expanded(); } @@ -387,13 +375,13 @@ namespace Isis { QPair truncateRange(-1, -1); if (fileQDatePattern.contains("?")) { - QString trueLengthName = name().ToQt().replace(QRegExp("[{}]"), ""); + QString trueLengthName = name().replace(QRegExp("[{}]"), ""); truncateRange.first = trueLengthName.indexOf("?"); truncateRange.second = trueLengthName.lastIndexOf("?"); fileQDatePattern = fileQDatePattern.replace("?", ""); } - QString file = name().ToQt(); + QString file = name(); QDate result; QDate sputnikLaunch(1957, 10, 4); @@ -432,7 +420,7 @@ namespace Isis { throw IException(IException::Unknown, QObject::tr("No existing files found with a date version matching [%1] in " "[%2]") - .arg(FileName(expanded()).name().ToQt()).arg(path().ToQt()), + .arg(FileName(expanded()).name()).arg(path()), _FILEINFO_); } @@ -468,7 +456,7 @@ namespace Isis { throw IException(IException::Unknown, QObject::tr("No existing files found with a numerial version matching [%1] " "in [%2]") - .arg(FileName(expanded()).name().ToQt()).arg(path().ToQt()), + .arg(FileName(expanded()).name()).arg(path()), _FILEINFO_); } @@ -561,8 +549,8 @@ namespace Isis { m_originalFileNameString = NULL; m_expandedFileNameString = NULL; - m_originalFileNameString = new IString; - m_expandedFileNameString = new IString; + m_originalFileNameString = new QString; + m_expandedFileNameString = new QString; } @@ -570,8 +558,8 @@ namespace Isis { m_originalFileNameString = NULL; m_expandedFileNameString = NULL; - m_originalFileNameString = new IString(*other.m_originalFileNameString); - m_expandedFileNameString = new IString(*other.m_expandedFileNameString); + m_originalFileNameString = new QString(*other.m_originalFileNameString); + m_expandedFileNameString = new QString(*other.m_expandedFileNameString); } @@ -584,7 +572,7 @@ namespace Isis { } - IString FileName::Data::original(bool includeAttributes) const { + QString FileName::Data::original(bool includeAttributes) const { QString result = *m_originalFileNameString; @@ -599,7 +587,7 @@ namespace Isis { } - void FileName::Data::setOriginal(const IString &originalStr) { + void FileName::Data::setOriginal(const QString &originalStr) { *m_originalFileNameString = originalStr; // Expand the file name and store that too. @@ -629,8 +617,8 @@ namespace Isis { // Find the corresponding Isis Preference if one exists if(Preference::Preferences().HasGroup("DataDirectory")) { PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); - if(dataDir.HasKeyword(varName.toStdString())) { - varValue = ((IString)dataDir[varName.toStdString().c_str()][0]).ToQt(); + if(dataDir.HasKeyword(varName)) { + varValue = ((QString)dataDir[varName.toStdString().c_str()][0]); } } @@ -665,7 +653,7 @@ namespace Isis { } - IString FileName::Data::expanded(bool includeAttributes) const { + QString FileName::Data::expanded(bool includeAttributes) const { QString result = *m_expandedFileNameString; diff --git a/isis/src/base/objs/FileName/FileName.h b/isis/src/base/objs/FileName/FileName.h index bc7986be43..c7891679b0 100644 --- a/isis/src/base/objs/FileName/FileName.h +++ b/isis/src/base/objs/FileName/FileName.h @@ -33,8 +33,6 @@ class QString; template class QPair; namespace Isis { - class IString; - /** * @brief File name manipulation and expansion. * @@ -96,8 +94,8 @@ namespace Isis { * @history 2011-08-19 Jeannie Backer - Modified unitTest to use * $temporary variable instead of /tmp directory. * Added some documentation to methods. - * @history 2011-08-24 Steven Lambright and Tracie Sucharski - Uses IString - * instead of std::string for simplicity when used + * @history 2011-08-24 Steven Lambright and Tracie Sucharski - Uses QString + * instead of QString for simplicity when used * with our GUI applications. Removed extra includes * and cleaned up code a little. * @history 2012-04-14 Steven Lambright - Renamed FileName to FileName. No @@ -112,26 +110,24 @@ namespace Isis { public: FileName(); FileName(const char *fileName); - FileName(const std::string &fileName); - FileName(const IString &fileName); FileName(const QString &fileName); FileName(const FileName &other); ~FileName(); - IString originalPath() const; - IString path() const; + QString originalPath() const; + QString path() const; - IString attributes() const; - IString baseName() const; - IString name() const; - IString extension() const; + QString attributes() const; + QString baseName() const; + QString name() const; + QString extension() const; - IString expanded() const; - IString original() const; + QString expanded() const; + QString original() const; - FileName addExtension(const IString &extension) const; + FileName addExtension(const QString &extension) const; FileName removeExtension() const; - FileName setExtension(const IString &extension) const; + FileName setExtension(const QString &extension) const; bool isVersioned() const; bool isNumericallyVersioned() const; @@ -150,7 +146,7 @@ namespace Isis { static FileName createTempFile(FileName templateFileName = "$TEMPORARY/temp"); - IString toString() const; + QString toString() const; FileName &operator=(const FileName &rhs); bool operator==(const FileName &rhs); bool operator!=(const FileName &rhs); @@ -178,17 +174,17 @@ namespace Isis { Data(const Data &other); ~Data(); - IString original(bool includeAttributes) const; - void setOriginal(const IString &); + QString original(bool includeAttributes) const; + void setOriginal(const QString &); - IString expanded(bool includeAttributes) const; + QString expanded(bool includeAttributes) const; // assignment operator is defined in QSharedData // Data &operator=(const Data &rhs); private: - IString *m_originalFileNameString; - IString *m_expandedFileNameString; + QString *m_originalFileNameString; + QString *m_expandedFileNameString; }; //! @see QSharedDataPointer diff --git a/isis/src/base/objs/FileName/unitTest.cpp b/isis/src/base/objs/FileName/unitTest.cpp index 730f8bd9a0..6d6f1536c3 100644 --- a/isis/src/base/objs/FileName/unitTest.cpp +++ b/isis/src/base/objs/FileName/unitTest.cpp @@ -15,10 +15,10 @@ using namespace std; using namespace Isis; -void TestVersioning(IString prefix, IString name, bool containsDate = false); -void TestExpanded(IString prefix, IString name); -void TestExtensionChanges(IString prefix, IString name, bool showExpandedValues); -void TestGenericAccessors(IString prefix, IString name, bool showExpandedValues); +void TestVersioning(QString prefix, QString name, bool containsDate = false); +void TestExpanded(QString prefix, QString name); +void TestExtensionChanges(QString prefix, QString name, bool showExpandedValues); +void TestGenericAccessors(QString prefix, QString name, bool showExpandedValues); int main(int argc, char *argv[]) { Preference::Preferences(true); @@ -54,16 +54,16 @@ int main(int argc, char *argv[]) { // Test temp files thoroughly cout << "Testing temporary file name placement" << endl; - IString tempFileNameTestStr = "$TEMPORARY/tttt.tmp"; + QString tempFileNameTestStr = "$TEMPORARY/tttt.tmp"; FileName n = FileName::createTempFile(tempFileNameTestStr); cout << "\tInput name and extension : " << tempFileNameTestStr << endl; cout << "\tExtension: : " << n.extension() << endl; cout << "\tOriginal Path: : " << n.originalPath() << endl; cout << "\tExists: : " << n.fileExists() << endl; cout << "\tName (cleaned): : " << - IString(n.name().ToQt().mid(0, 4) + + QString(n.name().mid(0, 4) + QString("%1").arg("", n.name().size() - 8, '?') + - n.name().ToQt().mid(n.name().size() - 4)) << endl; + n.name().mid(n.name().size() - 4)) << endl; cout << endl; if (!QFile(n.toString()).remove()) { @@ -166,7 +166,7 @@ int main(int argc, char *argv[]) { todayFileName = todayFileName.newVersion(); QDate today = QDate::currentDate(); QString expected = today.toString("'tttt'dd'tt'yyyy'tt'MMM'.tmp'"); - success = todayFileName.name() == expected.toStdString(); + success = todayFileName.name() == expected; cout << "\tMade today's filename successfully? " << success << endl; if (!success) @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) { } -void TestVersioning(IString prefix, IString name, bool containsDate) { +void TestVersioning(QString prefix, QString name, bool containsDate) { cout << prefix << "Testing Versioning Methods [" << name << "]" << endl; try { @@ -234,7 +234,7 @@ void TestVersioning(IString prefix, IString name, bool containsDate) { } -void TestGenericAccessors(IString prefix, IString name, bool showExpandedValues) { +void TestGenericAccessors(QString prefix, QString name, bool showExpandedValues) { FileName a(name); // Test our assignment & copy construct every time @@ -267,7 +267,7 @@ void TestGenericAccessors(IString prefix, IString name, bool showExpandedValues) } -void TestExtensionChanges(IString prefix, IString name, bool showExpandedValues) { +void TestExtensionChanges(QString prefix, QString name, bool showExpandedValues) { FileName a(name); // Test our assignment & copy construct every time @@ -277,7 +277,7 @@ void TestExtensionChanges(IString prefix, IString name, bool showExpandedValues) FileName test; test = c; - IString (FileName::*toStringMethod)() const = &FileName::toString; + QString (FileName::*toStringMethod)() const = &FileName::toString; FileName beforeLastChange = test; @@ -327,7 +327,7 @@ void TestExtensionChanges(IString prefix, IString name, bool showExpandedValues) } -void TestExpanded(IString prefix, IString name) { +void TestExpanded(QString prefix, QString name) { FileName a(name); // Test our assignment & copy construct every time diff --git a/isis/src/base/objs/ForstnerOperator/ForstnerOperator.h b/isis/src/base/objs/ForstnerOperator/ForstnerOperator.h index 9cbb434c33..27e913d954 100644 --- a/isis/src/base/objs/ForstnerOperator/ForstnerOperator.h +++ b/isis/src/base/objs/ForstnerOperator/ForstnerOperator.h @@ -1,4 +1,4 @@ -#if !defined(ForstnerOperator_h) +#ifndef ForstnerOperator_h #define ForstnerOperator_h /** * @file diff --git a/isis/src/base/objs/ForstnerOperator/unitTest.cpp b/isis/src/base/objs/ForstnerOperator/unitTest.cpp index 2ee3166412..fdb775a512 100644 --- a/isis/src/base/objs/ForstnerOperator/unitTest.cpp +++ b/isis/src/base/objs/ForstnerOperator/unitTest.cpp @@ -16,19 +16,19 @@ int main() { Isis::Preference::Preferences(true); PvlGroup op("Operator"); op += PvlKeyword("Name", "Forstner"); - op += PvlKeyword("DeltaLine", 100); - op += PvlKeyword("DeltaSamp", 100); - op += PvlKeyword("Samples", 15); - op += PvlKeyword("Lines", 15); - op += PvlKeyword("MinimumInterest", 0.0); + op += PvlKeyword("DeltaLine", "100"); + op += PvlKeyword("DeltaSamp", "100"); + op += PvlKeyword("Samples", "15"); + op += PvlKeyword("Lines", "15"); + op += PvlKeyword("MinimumInterest", "0.0"); PvlGroup opv("ValidMeasure"); - opv += PvlKeyword("MinDN", 0.0); - opv += PvlKeyword("MaxDN", 1.0); - opv += PvlKeyword("MinEmission", 15.0); - opv += PvlKeyword("MaxEmission", 25.0); - opv += PvlKeyword("MinIncidence", 0.0); - opv += PvlKeyword("MaxIncidence", 135.0); + opv += PvlKeyword("MinDN", "0.0"); + opv += PvlKeyword("MaxDN", "1.0"); + opv += PvlKeyword("MinEmission", "15.0"); + opv += PvlKeyword("MaxEmission", "25.0"); + opv += PvlKeyword("MinIncidence", "0.0"); + opv += PvlKeyword("MaxIncidence", "135.0"); PvlObject o("InterestOperator"); o.AddGroup(op); diff --git a/isis/src/base/objs/FramingCamera/unitTest.cpp b/isis/src/base/objs/FramingCamera/unitTest.cpp index ff4cc8e1df..b1094f4b18 100644 --- a/isis/src/base/objs/FramingCamera/unitTest.cpp +++ b/isis/src/base/objs/FramingCamera/unitTest.cpp @@ -79,7 +79,7 @@ int main() { //NOTE: The following cube is not from a framing camera. The test returns //true for framing camera type since MyCamera is a child class of FramingCamera try { - string inputFile = "$base/testData/ab102401_ideal.cub"; + QString inputFile = "$base/testData/ab102401_ideal.cub"; Pvl pvl(inputFile); MyCamera cam(pvl); @@ -91,9 +91,9 @@ int main() { // test ShutterOpenCloseTimes() method PvlGroup inst = pvl.FindGroup ("Instrument",Pvl::Traverse); - string startTime = inst["StartTime"]; + QString startTime = inst["StartTime"]; double eTime = 0.0; - utc2et_c(startTime.c_str(), &eTime); + utc2et_c(startTime.toAscii().data(), &eTime); double expoDur = ((double) inst["ExposureDuration"])/1000; // in seconds pair octime = cam.ShutterOpenCloseTimes(eTime,expoDur); cout.precision(12); diff --git a/isis/src/base/objs/FunctionTools/FunctionTools.h b/isis/src/base/objs/FunctionTools/FunctionTools.h index 342bf5aab0..cec9e29f06 100644 --- a/isis/src/base/objs/FunctionTools/FunctionTools.h +++ b/isis/src/base/objs/FunctionTools/FunctionTools.h @@ -24,13 +24,19 @@ #ifndef FunctionTools_h #define FunctionTools_h -#include "IString.h" -#include "IException.h" #include #include +#include +#include + +#include "Constants.h" +#include "IException.h" +#include "IString.h" + namespace Isis { - /** A collection of tools for mathmatical function root finding, maximization, etc (eventually) + /** + * A collection of tools for mathmatical function root finding, maximization, etc (eventually) * This class contains only static methods, and cannot be instantiated * * @ingroup Math @@ -55,7 +61,7 @@ namespace Isis { * @param coefflinearTerm coefficient of the linear term * @param coeffConstTerm coefficient of the constant term */ - static QList realLinearRoots(const double coeffLinearTerm, const double coeffConstTerm) { + static QList realLinearRoots(double coeffLinearTerm, double coeffConstTerm) { double m=coeffLinearTerm, b=coeffConstTerm; QList roots; @@ -78,8 +84,8 @@ namespace Isis { * @param coefflinearTerm coefficient of the linear term * @param coeffConstTerm coefficient of the constant term */ - static QList realQuadraticRoots(const double coeffQuadTerm, const double coeffLinearTerm, - const double coeffConstTerm) { + static QList realQuadraticRoots(double coeffQuadTerm, double coeffLinearTerm, + double coeffConstTerm) { double A=coeffQuadTerm, B=coeffLinearTerm, C=coeffConstTerm; double disc,q,temp; //helpers on the way to a solution @@ -113,8 +119,8 @@ namespace Isis { * @param coefflinearTerm coefficient of the linear term * @param coeffConstTerm coefficient of the constant term */ - static QList realCubicRoots(const double coeffCubicTerm, const double coeffQuadTerm, - const double coeffLinearTerm, const double coeffConstTerm) { + static QList realCubicRoots(double coeffCubicTerm, double coeffQuadTerm, + double coeffLinearTerm, double coeffConstTerm) { double a=coeffQuadTerm, b=coeffLinearTerm, c=coeffConstTerm; double Q,R; //helpers on the way to a solution @@ -194,7 +200,7 @@ namespace Isis { //check to see if the points bracket a root(s), if the signs are equal they don't if ( (fa > 0) - (fa < 0) == (fb > 0) - (fb < 0) ) { - IString msg = "The function evaluations of two bounding points passed to Brents Method " + QString msg = "The function evaluations of two bounding points passed to Brents Method " "have the same sign. Therefore, they don't necessary bound a root. No " "root finding will be attempted.\n"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -272,8 +278,8 @@ namespace Isis { } try { fbnew = func(bnew + offset); - } catch (IException e) { - IString msg = "Function evaluation failed at:" + IString(bnew) + + } catch (IException &e) { + QString msg = "Function evaluation failed at:" + toString(bnew) + ". Function must be continuous and defined for the entire interval " "inorder to gaurentee brentsRootFinder will work."; throw IException(e, IException::Programmer, msg, _FILEINFO_); diff --git a/isis/src/base/objs/GSLUtility/GSLUtility.h b/isis/src/base/objs/GSLUtility/GSLUtility.h index f3fc99df92..55f0c6ffba 100644 --- a/isis/src/base/objs/GSLUtility/GSLUtility.h +++ b/isis/src/base/objs/GSLUtility/GSLUtility.h @@ -1,4 +1,4 @@ -#if !defined(GSLUtility_h) +#ifndef GSLUtility_h #define GSLUtility_h /** * @file @@ -30,17 +30,19 @@ #include #include -#include "tnt/tnt_array1d.h" -#include "tnt/tnt_array1d_utils.h" -#include "tnt/tnt_array2d.h" -#include "tnt/tnt_array2d_utils.h" +#include + +#include +#include +#include +#include #include #include // Some GSL optimization on by default, off if DEBUG or SAFE_GSL is defined -#if !defined(DEBUG) -#if !defined(SAFE_GSL) +#ifndef DEBUG +#ifndef SAFE_GSL #define GSL_RANGE_CHECK_OFF 1 #endif #endif @@ -97,10 +99,10 @@ namespace Isis { * @brief Returns GSL specific error text * * @param gsl_errno GSL error number - * @return std::string Textual context of GSL error + * @return QString Textual context of GSL error */ - inline std::string status(int gsl_errno) const { - return (std::string(gsl_strerror(gsl_errno))); + inline QString status(int gsl_errno) const { + return (QString(gsl_strerror(gsl_errno))); } void check(int gsl_status, const char *src = __FILE__, int line = __LINE__) diff --git a/isis/src/base/objs/GradientOperator/GradientOperator.h b/isis/src/base/objs/GradientOperator/GradientOperator.h index f382b4d94d..b9a34c31a8 100644 --- a/isis/src/base/objs/GradientOperator/GradientOperator.h +++ b/isis/src/base/objs/GradientOperator/GradientOperator.h @@ -1,4 +1,4 @@ -#if !defined(GradientOperator_h) +#ifndef GradientOperator_h #define GradientOperator_h /** * @file diff --git a/isis/src/base/objs/GradientOperator/unitTest.cpp b/isis/src/base/objs/GradientOperator/unitTest.cpp index 016506ef28..6289ef0268 100644 --- a/isis/src/base/objs/GradientOperator/unitTest.cpp +++ b/isis/src/base/objs/GradientOperator/unitTest.cpp @@ -16,19 +16,19 @@ int main() { try { PvlGroup op("Operator"); op += PvlKeyword("Name", "Gradient"); - op += PvlKeyword("DeltaLine", 100); - op += PvlKeyword("DeltaSamp", 100); - op += PvlKeyword("Samples", 15); - op += PvlKeyword("Lines", 15); - op += PvlKeyword("MinimumInterest", 1); + op += PvlKeyword("DeltaLine", "100"); + op += PvlKeyword("DeltaSamp", "100"); + op += PvlKeyword("Samples", "15"); + op += PvlKeyword("Lines", "15"); + op += PvlKeyword("MinimumInterest", "1"); PvlGroup opv("ValidMeasure"); - opv += PvlKeyword("MinDN", 0.0); - opv += PvlKeyword("MaxDN", 1.0); - opv += PvlKeyword("MinEmission", 15.0); - opv += PvlKeyword("MaxEmission", 25.0); - opv += PvlKeyword("MinIncidence", 0.0); - opv += PvlKeyword("MaxIncidence", 135.0); + opv += PvlKeyword("MinDN", "0.0"); + opv += PvlKeyword("MaxDN", "1.0"); + opv += PvlKeyword("MinEmission", "15.0"); + opv += PvlKeyword("MaxEmission", "25.0"); + opv += PvlKeyword("MinIncidence", "0.0"); + opv += PvlKeyword("MaxIncidence", "135.0"); PvlObject o("InterestOperator"); o.AddGroup(op); diff --git a/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.cpp b/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.cpp index beda82943a..0d046faa96 100644 --- a/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.cpp +++ b/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.cpp @@ -68,7 +68,7 @@ namespace Isis { std::vector GridPolygonSeeder::Seed(const geos::geom::MultiPolygon *lonLatPoly) { //Projection *proj) { /*if (proj == NULL) { - std::string msg = "No Projection object available"; + QString msg = "No Projection object available"; throw iException::Message(iException::Programmer, msg, _FILEINFO_); }*/ @@ -90,8 +90,8 @@ namespace Isis { const geos::geom::Envelope *polyBoundBox = multiPoly->getEnvelopeInternal(); // Call the parents standardTests member - std::string msg = StandardTests(multiPoly, polyBoundBox); - if(!msg.empty()) { + QString msg = StandardTests(multiPoly, polyBoundBox); + if(!msg.isEmpty()) { return points; } @@ -147,8 +147,8 @@ namespace Isis { const geos::geom::Envelope *polyBoundBox = multiPoly->getEnvelopeInternal(); // Call the parents standardTests member - std::string msg = StandardTests(multiPoly, polyBoundBox); - if(!msg.empty()) { + QString msg = StandardTests(multiPoly, polyBoundBox); + if(!msg.isEmpty()) { return points; } @@ -414,7 +414,7 @@ namespace Isis { } } else { - std::string msg = "PVL for GridPolygonSeeder must contain [XSpacing] in ["; + QString msg = "PVL for GridPolygonSeeder must contain [XSpacing] in ["; msg += pvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -427,21 +427,21 @@ namespace Isis { } } else { - std::string msg = "PVL for GridPolygonSeeder must contain [YSpacing] in ["; + QString msg = "PVL for GridPolygonSeeder must contain [YSpacing] in ["; msg += pvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } p_subGrid = false; if(algo.HasKeyword("SubGrid")) { - p_subGrid = IString((std::string)algo["SubGrid"]).UpCase() != "FALSE"; + p_subGrid = IString((QString)algo["SubGrid"]).UpCase() != "FALSE"; if(invalgo.HasKeyword("SubGrid")) { invalgo.DeleteKeyword("SubGrid"); } } } catch(IException &e) { - std::string msg = "Improper format for PolygonSeeder PVL [" + pvl.FileName() + "]"; + QString msg = "Improper format for PolygonSeeder PVL [" + pvl.FileName() + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -455,15 +455,15 @@ namespace Isis { } } - PvlGroup GridPolygonSeeder::PluginParameters(std::string grpName) { + PvlGroup GridPolygonSeeder::PluginParameters(QString grpName) { PvlGroup pluginInfo(grpName); PvlKeyword name("Name", Algorithm()); - PvlKeyword minThickness("MinimumThickness", MinimumThickness()); - PvlKeyword minArea("MinimumArea", MinimumArea()); - PvlKeyword xSpac("XSpacing", p_Xspacing); - PvlKeyword ySpac("YSpacing", p_Yspacing); - PvlKeyword subGrid("SubGrid", p_subGrid); + PvlKeyword minThickness("MinimumThickness", toString(MinimumThickness())); + PvlKeyword minArea("MinimumArea", toString(MinimumArea())); + PvlKeyword xSpac("XSpacing", toString(p_Xspacing)); + PvlKeyword ySpac("YSpacing", toString(p_Yspacing)); + PvlKeyword subGrid("SubGrid", toString(p_subGrid)); pluginInfo.AddKeyword(name); pluginInfo.AddKeyword(minThickness); diff --git a/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.h b/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.h index 79c8d1373d..a8437bd3a2 100644 --- a/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.h +++ b/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.h @@ -59,7 +59,7 @@ namespace Isis { * - included SubGrid for what PluginParameters * returns * @history 2010-04-20 Christopher Austin - adapted for generic/unitless - * seeding + * seeding */ class GridPolygonSeeder : public PolygonSeeder { public: @@ -73,7 +73,7 @@ namespace Isis { const bool SubGrid() { return p_subGrid; } - virtual PvlGroup PluginParameters(std::string grpName); + virtual PvlGroup PluginParameters(QString grpName); protected: virtual void Parse(Pvl &pvl); diff --git a/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.truth b/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.truth index c124cc06e4..4a62473b66 100644 --- a/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.truth +++ b/isis/src/base/objs/GridPolygonSeeder/GridPolygonSeeder.truth @@ -388,7 +388,7 @@ Object = AutoSeed MinimumArea = 10 XSpacing = 1500 YSpacing = 1500 - SubGrid = 1 + SubGrid = Yes End_Group End_Object End diff --git a/isis/src/base/objs/GridPolygonSeeder/unitTest.cpp b/isis/src/base/objs/GridPolygonSeeder/unitTest.cpp index 249b8b4c28..253b78e77e 100644 --- a/isis/src/base/objs/GridPolygonSeeder/unitTest.cpp +++ b/isis/src/base/objs/GridPolygonSeeder/unitTest.cpp @@ -31,14 +31,14 @@ int main() { if(!alg.HasKeyword("Name")) { cout << "Test without subgrid" << endl; alg += PvlKeyword("Name", "Grid"); - alg += PvlKeyword("MinimumThickness", 0.3); - alg += PvlKeyword("MinimumArea", 10); - alg += PvlKeyword("XSpacing", 1500); - alg += PvlKeyword("YSpacing", 1500); + alg += PvlKeyword("MinimumThickness", toString(0.3)); + alg += PvlKeyword("MinimumArea", toString(10)); + alg += PvlKeyword("XSpacing", toString(1500)); + alg += PvlKeyword("YSpacing", toString(1500)); } else { cout << "Test with subgrid" << endl; - alg += PvlKeyword("SubGrid", true); + alg += PvlKeyword("SubGrid", toString(true)); } PvlObject o("AutoSeed"); @@ -82,13 +82,13 @@ int main() { Isis::Pvl maplab; maplab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = maplab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); - mapGroup += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapGroup += Isis::PvlKeyword("EquatorialRadius", radii["EquatorialRadius"]); + mapGroup += Isis::PvlKeyword("PolarRadius", radii["PolarRadius"]); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", toString(360)); + mapGroup += Isis::PvlKeyword("CenterLatitude", toString(0)); + mapGroup += Isis::PvlKeyword("CenterLongitude", toString(0)); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); Projection *proj = Isis::ProjectionFactory::Create(maplab); @@ -145,13 +145,13 @@ int main() { Isis::Pvl maplab; maplab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = maplab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); - mapGroup += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapGroup += Isis::PvlKeyword("EquatorialRadius", radii["EquatorialRadius"]); + mapGroup += Isis::PvlKeyword("PolarRadius", radii["PolarRadius"]); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", toString(360)); + mapGroup += Isis::PvlKeyword("CenterLatitude", toString(0)); + mapGroup += Isis::PvlKeyword("CenterLongitude", toString(0)); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); Projection *proj = Isis::ProjectionFactory::Create(maplab); diff --git a/isis/src/base/objs/GroundGrid/GroundGrid.cpp b/isis/src/base/objs/GroundGrid/GroundGrid.cpp index c4c06ab0af..a858023e43 100644 --- a/isis/src/base/objs/GroundGrid/GroundGrid.cpp +++ b/isis/src/base/objs/GroundGrid/GroundGrid.cpp @@ -86,7 +86,8 @@ namespace Isis { Distance::Meters); if(p_mapping->HasKeyword("MinimumLatitude")) { - p_minLat = new Latitude((*p_mapping)["MinimumLatitude"][0], *p_mapping, + p_minLat = new Latitude( + toDouble((*p_mapping)["MinimumLatitude"][0]), *p_mapping, Angle::Degrees); } else { @@ -94,7 +95,8 @@ namespace Isis { } if(p_mapping->HasKeyword("MaximumLatitude")) { - p_maxLat = new Latitude((*p_mapping)["MaximumLatitude"][0], *p_mapping, + p_maxLat = new Latitude( + toDouble((*p_mapping)["MaximumLatitude"][0]), *p_mapping, Angle::Degrees); } else { @@ -102,7 +104,8 @@ namespace Isis { } if(p_mapping->HasKeyword("MinimumLongitude")) { - p_minLon = new Longitude((*p_mapping)["MinimumLongitude"][0], *p_mapping, + p_minLon = new Longitude( + toDouble((*p_mapping)["MinimumLongitude"][0]), *p_mapping, Angle::Degrees); } else { @@ -110,7 +113,8 @@ namespace Isis { } if(p_mapping->HasKeyword("MaximumLongitude")) { - p_maxLon = new Longitude((*p_mapping)["MaximumLongitude"][0], *p_mapping, + p_maxLon = new Longitude( + toDouble((*p_mapping)["MaximumLongitude"][0]), *p_mapping, Angle::Degrees); } else { diff --git a/isis/src/base/objs/GroupedStatistics/GroupedStatistics.cpp b/isis/src/base/objs/GroupedStatistics/GroupedStatistics.cpp index 6fcf7e5360..5118b11aaa 100644 --- a/isis/src/base/objs/GroupedStatistics/GroupedStatistics.cpp +++ b/isis/src/base/objs/GroupedStatistics/GroupedStatistics.cpp @@ -63,7 +63,7 @@ namespace Isis { i = groupedStats->constFind(statType); if(i == groupedStats->constEnd()) { - std::string msg = statType.toStdString(); + QString msg = statType; msg += " passed to GetStats but does not exist within the map"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Gruen/Gruen.cpp b/isis/src/base/objs/Gruen/Gruen.cpp index cedb28aaab..c38758bae6 100644 --- a/isis/src/base/objs/Gruen/Gruen.cpp +++ b/isis/src/base/objs/Gruen/Gruen.cpp @@ -105,7 +105,7 @@ namespace Isis { * @param pattern Specifies an optional directory and file pattern to write * the subsearch chip at each algorithm iteration. */ - void Gruen::WriteSubsearchChips(const std::string &pattern) { + void Gruen::WriteSubsearchChips(const QString &pattern) { m_filePattern = pattern; return; } @@ -235,7 +235,7 @@ namespace Isis { std::ostringstream mess; mess << "Minimum points (" << MinValidPoints(maxPnts) << ") criteria not met (" << npts << ")"; - return (logError(NotEnoughPoints, string(mess.str()))); + return (logError(NotEnoughPoints, mess.str().c_str())); } // Create the ATA array @@ -259,8 +259,8 @@ namespace Isis { atai = Cholsl(atai, p, b, x); } catch(IException &ie) { - string mess = "Cholesky Failed:: " + ie.toString(); - return (logError(CholeskyFailed, string(mess.c_str()))); + QString mess = "Cholesky Failed:: " + ie.toString(); + return (logError(CholeskyFailed, mess)); } // Compute the affine update if result are requested by caller. @@ -284,7 +284,7 @@ namespace Isis { affrad = AffineRadio(alpha); } catch(IException &ie) { - string mess = "Affine failed: " + ie.toString(); + QString mess = "Affine failed: " + ie.toString(); return (logError(AffineNotInvertable, mess)); } @@ -335,7 +335,7 @@ namespace Isis { } } catch(IException &ie) { - string errmsg = "Eigen Solution Failed:: " + ie.toString(); + QString errmsg = "Eigen Solution Failed:: " + ie.toString(); results.m_status = logError(EigenSolutionFailed, errmsg); return (results); } @@ -703,7 +703,7 @@ namespace Isis { // implementation ensures caller must request it per call to this routine. // See the WriteSubsearchChips() method. m_callCount++; - string chipOut = m_filePattern; + QString chipOut = m_filePattern; m_filePattern = ""; // Initialize match point. Ensure points are centered to get real cube @@ -745,11 +745,11 @@ namespace Isis { sChip.Extract(fChip, extractor); // If requested for this run, write the current subsearch chip state - if (!chipOut.empty()) { + if (!chipOut.isEmpty()) { std::ostringstream ss; ss << "C" << std::setw(6) << std::setfill('0') << m_callCount << "I" << std::setw(3) << std::setfill('0') << m_nIters; - std::string sfname = chipOut + ss.str() + ".cub"; + QString sfname = chipOut + ss.str().c_str() + ".cub"; fChip.Write(sfname); } @@ -768,7 +768,7 @@ namespace Isis { // Test for termination conditions - errors or convergence matchpt.m_nIters = ++m_nIters; if (m_nIters > m_maxIters) { - string errmsg = "Maximum Iterations exceeded"; + QString errmsg = "Maximum Iterations exceeded"; matchpt.setStatus(logError(MaxIterationsExceeded, errmsg)); return (Status(matchpt)); // Error condition } @@ -801,7 +801,7 @@ namespace Isis { affine += alpha; } catch (IException &ie) { - string mess = "Affine invalid/not invertable"; + QString mess = "Affine invalid/not invertable"; matchpt.setStatus(logError(AffineNotInvertable, mess)); return (Status(matchpt)); // Another error condition to return } @@ -849,7 +849,7 @@ namespace Isis { } if (m_unclassified > 0) { - algo += PvlKeyword("UnclassifiedErrors", m_unclassified); + algo += PvlKeyword("UnclassifiedErrors", toString(m_unclassified)); } pvl.AddGroup(algo); pvl.AddGroup(StatsLog()); @@ -870,7 +870,7 @@ namespace Isis { PvlGroup Gruen::StatsLog() const { PvlGroup stats("GruenStatistics"); - stats += PvlKeyword("TotalIterations", m_totalIterations); + stats += PvlKeyword("TotalIterations", toString(m_totalIterations)); stats += ValidateKey("IterationMinimum", m_iterStat.Minimum()); stats += ValidateKey("IterationAverage", m_iterStat.Average()); stats += ValidateKey("IterationMaximum", m_iterStat.Maximum()); @@ -907,20 +907,20 @@ namespace Isis { PvlGroup Gruen::ParameterLog() const { PvlGroup parms("GruenParameters"); - parms += PvlKeyword("MaximumIterations", m_maxIters); + parms += PvlKeyword("MaximumIterations", toString(m_maxIters)); parms += ValidateKey("AffineScaleTolerance", m_scaleTol); parms += ValidateKey("AffineShearTolerance", m_shearTol); parms += ValidateKey("AffineTranslationTolerance", m_transTol); parms += ParameterKey("AffineTolerance", m_affineTol); - parms += ParameterKey("SpiceTolerance", m_spiceTol); + parms += ParameterKey("SpiceTolerance", m_spiceTol); parms += ParameterKey("RadioShiftTolerance", m_shiftTol); parms += ParameterKey("RadioGainMinTolerance", m_rgainMinTol); parms += ParameterKey("RadioGainMaxTolerance", m_rgainMaxTol); - parms += ValidateKey("DefaultRadioGain", m_defGain); + parms += ValidateKey("DefaultRadioGain", m_defGain); parms += ValidateKey("DefaultRadioShift", m_defShift); return (parms); @@ -962,7 +962,7 @@ namespace Isis { * @param gerrno One of the errors as defined by GruenError enum * @param gerrmsg Optional message although it is ignored in this context */ - int Gruen::logError(int gerrno, const std::string &gerrmsg) { + int Gruen::logError(int gerrno, const QString &gerrmsg) { if (!m_errors.exists(gerrno)) { m_unclassified++; } @@ -990,25 +990,25 @@ namespace Isis { m_prof = DbProfile(pvl); } - if (m_prof.Name().empty()) m_prof.setName("Gruen"); + if (m_prof.Name().isEmpty()) m_prof.setName("Gruen"); // Define internal parameters - m_maxIters = ConfKey(m_prof, "MaximumIterations", 30); + m_maxIters = toInt(ConfKey(m_prof, "MaximumIterations", toString(30))); - m_transTol = ConfKey(m_prof, "AffineTranslationTolerance", 0.1); - m_scaleTol = ConfKey(m_prof, "AffineScaleTolerance", 0.3); - m_shearTol = ConfKey(m_prof, "AffineShearTolerance", m_scaleTol); - m_affineTol = ConfKey(m_prof, "AffineTolerance", DBL_MAX); + m_transTol = toDouble(ConfKey(m_prof, "AffineTranslationTolerance", toString(0.1))); + m_scaleTol = toDouble(ConfKey(m_prof, "AffineScaleTolerance", toString(0.3))); + m_shearTol = toDouble(ConfKey(m_prof, "AffineShearTolerance", toString(m_scaleTol))); + m_affineTol = toDouble(ConfKey(m_prof, "AffineTolerance", toString(DBL_MAX))); - m_spiceTol = ConfKey(m_prof, "SpiceTolerance", DBL_MAX); + m_spiceTol = toDouble(ConfKey(m_prof, "SpiceTolerance", toString(DBL_MAX))); - m_shiftTol = ConfKey(m_prof, "RadioShiftTolerance", DBL_MAX); - m_rgainMinTol = ConfKey(m_prof, "RadioGainMinTolerance", -DBL_MAX); - m_rgainMaxTol = ConfKey(m_prof, "RadioGainMaxTolerance", DBL_MAX); + m_shiftTol = toDouble(ConfKey(m_prof, "RadioShiftTolerance", toString(DBL_MAX))); + m_rgainMinTol = toDouble(ConfKey(m_prof, "RadioGainMinTolerance", toString(-DBL_MAX))); + m_rgainMaxTol = toDouble(ConfKey(m_prof, "RadioGainMaxTolerance", toString(DBL_MAX))); // Set radiometric defaults - m_defGain = ConfKey(m_prof, "DefaultRadioGain", 0.0); - m_defShift = ConfKey(m_prof, "DefaultRadioShift", 0.0); + m_defGain = toDouble(ConfKey(m_prof, "DefaultRadioGain", toString(0.0))); + m_defShift = toDouble(ConfKey(m_prof, "DefaultRadioShift", toString(0.0))); m_callCount = 0; m_filePattern = ""; @@ -1109,20 +1109,20 @@ namespace Isis { // Point must be good for check to occur if (point.isValid()) { if (point.m_nIters > m_maxIters) { - string errmsg = "Maximum Iterations exceeded"; + QString errmsg = "Maximum Iterations exceeded"; return (logError(MaxIterationsExceeded, errmsg)); } m_iterStat.AddData(point.m_nIters); if (point.getEigen() > Tolerance()) { - string errmsg = "Maximum Eigenvalue exceeded"; + QString errmsg = "Maximum Eigenvalue exceeded"; return (logError(MaxEigenExceeded, errmsg)); } m_eigenStat.AddData(point.getEigen()); double shift = point.m_affine.m_radio.Shift(); if ( shift > m_shiftTol) { - string errmsg = "Radiometric shift exceeds tolerance"; + QString errmsg = "Radiometric shift exceeds tolerance"; return (logError(RadShiftExceeded, errmsg)); } m_shiftStat.AddData(shift); @@ -1130,7 +1130,7 @@ namespace Isis { double gain = point.m_affine.m_radio.Gain(); if (((1.0 + gain) > m_rgainMaxTol) || ((1.0 + gain) < m_rgainMinTol)) { - string errmsg = "Radiometric gain exceeds tolerances"; + QString errmsg = "Radiometric gain exceeds tolerances"; return (logError(RadGainExceeded, errmsg)); } m_gainStat.AddData(gain); @@ -1138,7 +1138,7 @@ namespace Isis { double dist = point.getAffinePoint(Coordinate(0.0, 0.0)).getDistance(); if (dist > getAffineConstraint()) { - string errmsg = "Affine distance exceeded"; + QString errmsg = "Affine distance exceeded"; return (logError(AffineDistExceeded, errmsg)); } } diff --git a/isis/src/base/objs/Gruen/Gruen.h b/isis/src/base/objs/Gruen/Gruen.h index 3d4a285060..fa47f19b8c 100644 --- a/isis/src/base/objs/Gruen/Gruen.h +++ b/isis/src/base/objs/Gruen/Gruen.h @@ -1,4 +1,4 @@ -#if !defined(Gruen_h) +#ifndef Gruen_h #define Gruen_h /** * @file @@ -100,7 +100,7 @@ namespace Isis { /** Returns the current call count */ BigInt CallCount() const { return (m_callCount); } - void WriteSubsearchChips(const std::string &pattern = "SubChip"); + void WriteSubsearchChips(const QString &pattern = "SubChip"); AffineTolerance getAffineTolerance() const; @@ -137,7 +137,7 @@ namespace Isis { protected: /** Returns the default name of the algorithm as Gruen */ - virtual IString AlgorithmName() const { + virtual QString AlgorithmName() const { return ("Gruen"); } @@ -181,16 +181,16 @@ namespace Isis { /** Struct that maintains error counts */ struct ErrorCounter { ErrorCounter() : m_gerrno(0), m_keyname("Unknown"), m_count(0) { } - ErrorCounter(int gerrno, const std::string &keyname) : m_gerrno(gerrno), + ErrorCounter(int gerrno, const QString &keyname) : m_gerrno(gerrno), m_keyname(keyname), m_count(0) { } inline int Errno() const { return (m_gerrno); } inline BigInt Count() const { return (m_count); } inline void BumpIt() { m_count++; } - PvlKeyword LogIt() const { return (PvlKeyword(m_keyname, m_count)); } + PvlKeyword LogIt() const { return (PvlKeyword(m_keyname, toString(m_count))); } int m_gerrno; - std::string m_keyname; + QString m_keyname; BigInt m_count; }; @@ -199,7 +199,7 @@ namespace Isis { // Iteration loop variables BigInt m_callCount; - std::string m_filePattern; + QString m_filePattern; ErrorList m_errors; // Error logger BigInt m_unclassified; // Unclassified errors @@ -238,6 +238,36 @@ namespace Isis { // Static init of default PVL parameters static Pvl &getDefaultParameters(); + /** + * @brief Helper method to initialize parameters + * + * This method will check the existance of a keyword and extract the value + + * if it exists to the passed parameter (type). If it doesn't exist, the + * default values is returned. + * + * @param T Templated variable type + * @param conf Parameter profile container + * @param keyname Name of keyword to get a value from + * @param defval Default value it keyword/value doesn't exist + * @param index Optional index of the value for keyword arrays + * + * @return T Return type + */ + QString ConfKey(const DbProfile &conf, const QString &keyname, + const QString &defval, int index = 0) const { + if(!conf.exists(keyname)) { + return (defval); + } + if(conf.count(keyname) < index) { + return (defval); + } + QString iValue(conf.value(keyname, index)); + IString tmp(iValue); + QString value = tmp.ToQt(); // This makes it work with a string? + return (value); + }; + /** * @brief Helper method to initialize parameters * @@ -255,7 +285,7 @@ namespace Isis { * @return T Return type */ template - T ConfKey(const DbProfile &conf, const std::string &keyname, + T ConfKey(const DbProfile &conf, const QString &keyname, const T &defval, int index = 0) const { if(!conf.exists(keyname)) { return (defval); @@ -263,8 +293,9 @@ namespace Isis { if(conf.count(keyname) < index) { return (defval); } - IString iValue(conf.value(keyname, index)); - T value = iValue; // This makes it work with a string? + QString iValue(conf.value(keyname, index)); + IString tmp(iValue); + T value = tmp; // This makes it work with a string? return (value); }; @@ -282,9 +313,9 @@ namespace Isis { * @return PvlKeyword Constructed keyword for key/value */ template - PvlKeyword ParameterKey(const std::string &keyname, + PvlKeyword ParameterKey(const QString &keyname, const T &value, - const std::string &unit = "") const { + const QString &unit = "") const { if(m_prof.exists(keyname)) { return(ValidateKey(keyname, value, unit)); } @@ -304,19 +335,19 @@ namespace Isis { * * @return PvlKeyword Returns newly created keyword/value */ - inline PvlKeyword ValidateKey(const std::string keyname, + inline PvlKeyword ValidateKey(const QString keyname, const double &value, - const std::string &unit = "") const { + const QString &unit = "") const { if(IsSpecial(value)) { return (PvlKeyword(keyname, "NULL")); } else { - return (PvlKeyword(keyname, value, unit)); + return (PvlKeyword(keyname, toString(value), unit)); } } ErrorList initErrorList() const; - int logError(int gerrno, const std::string &gerrmsg); + int logError(int gerrno, const QString &gerrmsg); PvlGroup StatsLog() const; PvlGroup ParameterLog() const; diff --git a/isis/src/base/objs/Gruen/GruenTypes.h b/isis/src/base/objs/Gruen/GruenTypes.h index 345615c7ab..abb423ff23 100644 --- a/isis/src/base/objs/Gruen/GruenTypes.h +++ b/isis/src/base/objs/Gruen/GruenTypes.h @@ -1,4 +1,4 @@ -#if !defined(GruenTypes_h) +#ifndef GruenTypes_h #define GruenTypes_h /** * @file @@ -300,8 +300,8 @@ namespace Isis { /** Generate a matrix from the Gruen alpha vector */ void clone(const GVector &alpha) { if ( alpha.dim1() != 8 ) { - std::string mess = "Alpha array for AffineRadio must have 8 elements " - " but has " + IString(alpha.dim1()); + QString mess = "Alpha array for AffineRadio must have 8 elements " + " but has " + toString(alpha.dim1()); throw IException(IException::Programmer, mess, _FILEINFO_); } m_affine = Affine::getIdentity(); diff --git a/isis/src/base/objs/Gruen/unitTest.cpp b/isis/src/base/objs/Gruen/unitTest.cpp index e8bc0d99dd..1965adf67d 100644 --- a/isis/src/base/objs/Gruen/unitTest.cpp +++ b/isis/src/base/objs/Gruen/unitTest.cpp @@ -17,18 +17,18 @@ int main() { try { PvlGroup alg("Algorithm"); alg += PvlKeyword("Name", "Gruen"); - alg += PvlKeyword("Tolerance", 100.0); - alg += PvlKeyword("AffineTranslationTolerance", 0.15); - alg += PvlKeyword("AffineScaleTolerance", 0.3); - alg += PvlKeyword("MaximumIterations", 30); + alg += PvlKeyword("Tolerance", toString(100.0)); + alg += PvlKeyword("AffineTranslationTolerance", toString(0.15)); + alg += PvlKeyword("AffineScaleTolerance", toString(0.3)); + alg += PvlKeyword("MaximumIterations", toString(30)); PvlGroup pchip("PatternChip"); - pchip += PvlKeyword("Samples", 19); - pchip += PvlKeyword("Lines", 19); + pchip += PvlKeyword("Samples", toString(19)); + pchip += PvlKeyword("Lines", toString(19)); PvlGroup schip("SearchChip"); - schip += PvlKeyword("Samples", 25); - schip += PvlKeyword("Lines", 25); + schip += PvlKeyword("Samples", toString(25)); + schip += PvlKeyword("Lines", toString(25)); PvlObject o("AutoRegistration"); o.AddGroup(alg); diff --git a/isis/src/base/objs/Gui/Gui.cpp b/isis/src/base/objs/Gui/Gui.cpp index 5584c70a9d..76a24184ee 100644 --- a/isis/src/base/objs/Gui/Gui.cpp +++ b/isis/src/base/objs/Gui/Gui.cpp @@ -85,8 +85,8 @@ namespace Isis { // However, Isis supports overriding this with a setting in IsisPreferences. // Here we check to see if this has been done and force the style if needed. if(uiPref.HasKeyword("GuiStyle")) { - std::string style = uiPref["GuiStyle"]; - QApplication::setStyle((IString)style); + QString style = uiPref["GuiStyle"]; + QApplication::setStyle(style); } // Create the main window @@ -271,7 +271,7 @@ namespace Isis { // Create the "Begin/Start Processing" action QAction *Gui::CreateProcessAction() { QAction *processAction = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); processAction->setIcon(QPixmap(baseDir + "/guiRun.png")); processAction->setText("&Run"); processAction->setToolTip("Run"); @@ -307,10 +307,7 @@ namespace Isis { GuiParameter ¶m = *(p_parameters[p]); ui.Clear(param.Name()); if(param.IsEnabled() && param.IsModified()) { - Isis::IString value = param.Value(); - value.ConvertWhiteSpace(); - value.Compress(); - value.Trim(" "); + QString value = param.Value().simplified().trimmed(); if(value.length() > 0) { ui.PutAsString(param.Name(), value); } @@ -356,7 +353,7 @@ namespace Isis { // Create the "Exit" action QAction *Gui::CreateExitAction() { QAction *exitAction = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); exitAction->setIcon(QPixmap(baseDir + "/guiExit.png")); exitAction->setText("&Exit"); exitAction->setToolTip("Exit"); @@ -371,7 +368,7 @@ namespace Isis { // Create the "Reset" action QAction *Gui::CreateResetAction() { QAction *resetAction = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); resetAction->setIcon(QPixmap(baseDir + "/guiReset.png")); resetAction->setText("&Reset"); resetAction->setToolTip("Reset parameters"); @@ -388,7 +385,7 @@ namespace Isis { // Create the "Stop" action QAction *Gui::CreateStopAction() { QAction *stopAction = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); stopAction->setIcon(QPixmap(baseDir + "/guiStop.png")); stopAction->setText("&Stop"); stopAction->setToolTip("Stop"); @@ -405,7 +402,7 @@ namespace Isis { // Create the "SaveLog" action QAction *Gui::CreateSaveLogAction() { QAction *saveLogAction = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); saveLogAction->setIcon(QPixmap(baseDir + "/guiSaveLog.png")); saveLogAction->setText("&Save Log..."); saveLogAction->setToolTip("Save log"); @@ -421,7 +418,7 @@ namespace Isis { // Create the "ClearLog" action QAction *Gui::CreateClearLogAction() { QAction *clearlogAction = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); clearlogAction->setIcon(QPixmap(baseDir + "/guiClearLog.png")); clearlogAction->setText("&Clear Log"); clearlogAction->setToolTip("Clear log"); @@ -438,7 +435,7 @@ namespace Isis { // Create the "Previous History" action QAction *Gui::CreatePreviousHistoryAction() { QAction *previousHistoryAction = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); previousHistoryAction->setIcon(QPixmap(baseDir + "/guiPrevHistory.png")); previousHistoryAction->setText("&Previous"); previousHistoryAction->setToolTip("Previous parameters"); @@ -455,7 +452,7 @@ namespace Isis { // Create the "Next History" action QAction *Gui::CreateNextHistoryAction() { QAction *nextHistoryAction = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); nextHistoryAction->setIcon(QPixmap(baseDir + "/guiNextHistory.png")); nextHistoryAction->setText("&Next"); nextHistoryAction->setToolTip("Next parameters"); @@ -472,7 +469,7 @@ namespace Isis { // Create the Whats Action action QAction *Gui::CreateWhatsThisAction() { QAction *action = new QAction(this); - QString baseDir = (IString)FileName("$BASE/icons").expanded(); + QString baseDir = FileName("$BASE/icons").expanded(); action->setIcon(QPixmap(baseDir + "/contexthelp.png")); action->setText("&What's This"); action->setToolTip("What's This"); @@ -492,7 +489,7 @@ namespace Isis { QGridLayout *gridLayout = NULL; if(!p_grids.contains(ui.GroupName(group))) { // Create a new groupbox and add it to the scroll layout - QGroupBox *groupBox = new QGroupBox((IString)ui.GroupName(group)); + QGroupBox *groupBox = new QGroupBox(ui.GroupName(group)); p_scrollLayout->addWidget(groupBox); groupBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); groupBox->setAlignment(Qt::AlignHCenter); @@ -523,8 +520,8 @@ namespace Isis { } //! Change progress text - void Gui::ProgressText(const std::string &text) { - p_statusText->setText((IString)text); + void Gui::ProgressText(const QString &text) { + p_statusText->setText(text); qApp->processEvents(); // Needed when programs run programs } @@ -544,33 +541,30 @@ namespace Isis { } //! Add more information to the error message - void Gui::LoadMessage(const std::string &message) { + void Gui::LoadMessage(const QString &message) { // Convert newlines to breaks - std::string m = message; - while(m.find("\n") != std::string::npos) { - m.replace(m.find("\n"), 1, "
"); - } + QString m = QString(message).replace("\n", "
"); // If there is a set of "[]" change everything between them to red text - if((message.find("[") >= 0) && - (message.rfind("]") < message.size()) && - (message.find("[") < message.rfind("]"))) { + if(message.contains("[") && + message.contains("]") && + (message.indexOf("[") < message.indexOf("]"))) { int indx = 0; - while(m.find("[", indx) != std::string::npos) { - m.insert(m.find("[", indx) + 1, ""); - m.insert(m.find("]", indx), ""); - indx = m.find("]", indx) + 1; + while(m.indexOf("[", indx) != -1) { + m.insert(m.indexOf("[", indx) + 1, ""); + m.insert(m.indexOf("]", indx), ""); + indx = m.indexOf("]", indx) + 1; } } - p_errorString += (QString)(IString)m; + p_errorString += m; } //! Show an error message and return if the user wants to continue/abort int Gui::ShowWarning() { Isis::UserInterface &ui = Isis::iApp->GetUserInterface(); int status = QMessageBox::warning(this, - (IString)ui.ProgramName(), + ui.ProgramName(), p_errorString, "Ok", "Abort", "", 0, 1); p_errorString.clear(); @@ -578,9 +572,8 @@ namespace Isis { } //! Write text to the gui log - void Gui::Log(const std::string &text) { - QString s = (IString)text; - p_log->Write(s); + void Gui::Log(const QString &text) { + p_log->Write(text); } //! Reset the Progress bar when the user moves the mouse onto the toolbar @@ -600,7 +593,7 @@ namespace Isis { Isis::UserInterface &ui = Application::GetUserInterface(); switch(QMessageBox::information(this, - (IString)ui.ProgramName(), + ui.ProgramName(), QString("Program suspended, choose to ") + QString("continue processing, stop ") + QString("processing or exit the program"), @@ -689,7 +682,7 @@ namespace Isis { } catch(...) { p_historyEntry = -1; - std::string msg = "A corrupt parameter history file [" + progHist.expanded() + + QString msg = "A corrupt parameter history file [" + progHist.expanded() + "] has been detected. Please fix or remove this file"; LoadMessage(msg); if(ShowWarning()) exit(0); @@ -713,8 +706,8 @@ namespace Isis { try { Isis::PvlGroup &up = hist.Group(useEntry); for(int k = 0; k < up.Keywords(); k++) { - std::string key = up[k].Name(); - std::string val = up[k]; + QString key = up[k].Name(); + QString val = up[k]; ui.Clear(key); ui.PutAsString(key, val); } @@ -745,7 +738,7 @@ namespace Isis { // Now disable things for(unsigned int p = 0; p < p_parameters.size(); p++) { GuiParameter ¶m = *(p_parameters[p]); - std::vector excludeList = param.Exclusions(); + std::vector excludeList = param.Exclusions(); for(int i = 0; i < (int)excludeList.size(); i++) { for(unsigned int e = 0; e < p_parameters.size(); e++) { GuiParameter &exclude = *(p_parameters[e]); @@ -758,18 +751,17 @@ namespace Isis { //! Update the command line toolbar void Gui::UpdateCommandLine() { - std::string cline = Isis::Application::GetUserInterface().ProgramName(); + QString cline = Isis::Application::GetUserInterface().ProgramName(); for(int p = 0; p < (int)p_parameters.size(); p++) { GuiParameter ¶m = *(p_parameters[p]); if(param.IsEnabled() && param.IsModified()) { cline += " "; - IString name = param.Name(); - name.DownCase(); + QString name = param.Name().toLower(); cline += name; cline += "="; - IString value = param.Value(); + QString value = param.Value(); if(param.Type() == GuiParameter::StringWidget) { - if(value.find(" ") != std::string::npos) { + if(value.contains(" ")) { cline += "\"" + value + "\""; } else { @@ -781,12 +773,12 @@ namespace Isis { cline += value; } else { - value.DownCase(); + value = value.toLower(); cline += value; } } } - p_commandLineEdit->setText(cline.c_str()); + p_commandLineEdit->setText(cline); } //! Update Parameters @@ -805,14 +797,14 @@ namespace Isis { // Show help for Isis void Gui::AboutIsis() { Isis::PvlGroup &uig = Isis::Preference::Preferences().FindGroup("UserInterface"); - std::string command = (std::string) uig["GuiHelpBrowser"] + + QString command = (QString) uig["GuiHelpBrowser"] + " http://isis.astrogeology.usgs.gov >> /dev/null &"; ProgramLauncher::RunSystemCommand(command); } // Show help for the current app void Gui::AboutProgram() { - Isis::FileName file((std::string) + Isis::FileName file((QString) "$ISISROOT/doc/Application/presentation/PrinterFriendly/" + Isis::Application::GetUserInterface().ProgramName() + "/" + @@ -820,8 +812,8 @@ namespace Isis { ".html"); Isis::PvlGroup &uig = Isis::Preference::Preferences().FindGroup("UserInterface"); - std::string command = (std::string) uig["GuiHelpBrowser"] + - (std::string)" file:" + file.expanded() + " &"; + QString command = (QString) uig["GuiHelpBrowser"] + + (QString)" file:" + file.expanded() + " &"; ProgramLauncher::RunSystemCommand(command); } @@ -836,10 +828,7 @@ namespace Isis { GuiParameter ¶m = *(p_parameters[p]); ui.Clear(param.Name()); if(param.IsEnabled() && param.IsModified()) { - Isis::IString value = param.Value(); - value.ConvertWhiteSpace(); - value.Compress(); - value.Trim(" "); + QString value = param.Value().simplified().trimmed(); if(value.length() > 0) { ui.PutAsString(param.Name(), value); } @@ -847,7 +836,7 @@ namespace Isis { } // Get the helper function and run - void *ptr = Isis::iApp->GetGuiHelper(funct.toStdString()); + void *ptr = Isis::iApp->GetGuiHelper(funct); void (*helper)(); helper = (void ( *)())ptr; helper(); diff --git a/isis/src/base/objs/Gui/Gui.h b/isis/src/base/objs/Gui/Gui.h index 303599043b..47ca087084 100644 --- a/isis/src/base/objs/Gui/Gui.h +++ b/isis/src/base/objs/Gui/Gui.h @@ -84,17 +84,17 @@ namespace Isis { static Gui *Create(Isis::UserInterface &ui, int &argc, char *argv[]); - void ProgressText(const std::string &text); + void ProgressText(const QString &text); void Progress(int percent); int Exec(void (*funct)()); bool ProcessEvents(); - void LoadMessage(const std::string &message); + void LoadMessage(const QString &message); int ShowWarning(); void ShowLog() {}; - void Log(const std::string &text); + void Log(const QString &text); Gui(Isis::UserInterface &ui); ~Gui(); @@ -139,7 +139,7 @@ namespace Isis { QAction *p_previousHistoryAction; QAction *p_nextHistoryAction; - QMap p_grids; + QMap p_grids; std::vector p_parameters; diff --git a/isis/src/base/objs/Gui/GuiBooleanParameter.cpp b/isis/src/base/objs/Gui/GuiBooleanParameter.cpp index 98a01cade7..57869ac9b4 100644 --- a/isis/src/base/objs/Gui/GuiBooleanParameter.cpp +++ b/isis/src/base/objs/Gui/GuiBooleanParameter.cpp @@ -11,7 +11,7 @@ namespace Isis { int group, int param) : GuiParameter(grid, ui, group, param) { - p_checkBox = new QCheckBox((IString)ui.ParamBrief(group, param)); + p_checkBox = new QCheckBox((QString)ui.ParamBrief(group, param)); grid->addWidget(p_checkBox, param, 2); @@ -29,29 +29,29 @@ namespace Isis { GuiBooleanParameter::~GuiBooleanParameter() {} - void GuiBooleanParameter::Set(IString newValue) { + void GuiBooleanParameter::Set(QString newValue) { p_checkBox->setChecked(p_ui->StringToBool(newValue)); emit ValueChanged(); } - IString GuiBooleanParameter::Value() { + QString GuiBooleanParameter::Value() { return p_checkBox->isChecked() ? "YES" : "NO"; } - std::vector GuiBooleanParameter::Exclusions() { - std::vector list; + std::vector GuiBooleanParameter::Exclusions() { + std::vector list; // Exclude exclusions or inclusions if(Value() == "YES") { for(int i = 0; i < p_ui->ParamExcludeSize(p_group, p_param); i++) { - std::string s = p_ui->ParamExclude(p_group, p_param, i); + QString s = p_ui->ParamExclude(p_group, p_param, i); list.push_back(s); } } else { for(int i = 0; i < p_ui->ParamIncludeSize(p_group, p_param); i++) { - std::string s = p_ui->ParamInclude(p_group, p_param, i); + QString s = p_ui->ParamInclude(p_group, p_param, i); list.push_back(s); } } @@ -62,15 +62,14 @@ namespace Isis { //! Return if the parameter value is different from the default value bool GuiBooleanParameter::IsModified() { if(!IsEnabled()) return false; - IString value; + QString value; if(p_ui->ParamDefault(p_group, p_param).size() > 0) { - value = p_ui->ParamDefault(p_group, p_param); + value = p_ui->ParamDefault(p_group, p_param).toUpper(); } else { value = "NO"; } - value.UpCase(); if(value == "0") value = "NO"; if(value == "FALSE") value = "NO"; if(value == "N") value = "NO"; diff --git a/isis/src/base/objs/Gui/GuiBooleanParameter.h b/isis/src/base/objs/Gui/GuiBooleanParameter.h index b3d25ad433..9c2a9f816b 100644 --- a/isis/src/base/objs/Gui/GuiBooleanParameter.h +++ b/isis/src/base/objs/Gui/GuiBooleanParameter.h @@ -23,11 +23,11 @@ namespace Isis { int group, int param); ~GuiBooleanParameter(); - IString Value(); + QString Value(); - void Set(IString newValue); + void Set(QString newValue); - virtual std::vector Exclusions(); + virtual std::vector Exclusions(); bool IsModified(); diff --git a/isis/src/base/objs/Gui/GuiComboBoxParameter.cpp b/isis/src/base/objs/Gui/GuiComboBoxParameter.cpp index d8a249e387..e7858807c0 100644 --- a/isis/src/base/objs/Gui/GuiComboBoxParameter.cpp +++ b/isis/src/base/objs/Gui/GuiComboBoxParameter.cpp @@ -27,11 +27,11 @@ namespace Isis { // Create a menu item in the combo box for each list item and add it // to the layout for(int item = 0; item < ui.ParamListSize(group, param); item++) { - IString btext = ui.ParamListBrief(group, param, item); + QString btext = ui.ParamListBrief(group, param, item); btext += " ("; btext += ui.ParamListValue(group, param, item); btext += ")"; - p_combo->insertItem(item, (IString)btext); + p_combo->insertItem(item, btext); } lo->addWidget(p_combo); connect(p_combo, SIGNAL(activated(int)), @@ -47,7 +47,7 @@ namespace Isis { } - void GuiComboBoxParameter::Set(IString newValue) { + void GuiComboBoxParameter::Set(QString newValue) { IString value = newValue; value.UpCase(); @@ -67,18 +67,18 @@ namespace Isis { } - IString GuiComboBoxParameter::Value() { - return (IString)p_ui->ParamListValue(p_group, p_param, - p_combo->currentIndex()); + QString GuiComboBoxParameter::Value() { + return p_ui->ParamListValue(p_group, p_param, + p_combo->currentIndex()); } - std::vector GuiComboBoxParameter::Exclusions() { - std::vector list; + std::vector GuiComboBoxParameter::Exclusions() { + std::vector list; int index = p_combo->currentIndex(); for(int i = 0; i < p_ui->ParamListExcludeSize(p_group, p_param, index); i++) { - std::string s = p_ui->ParamListExclude(p_group, p_param, index, i); + QString s = p_ui->ParamListExclude(p_group, p_param, index, i); list.push_back(s); } diff --git a/isis/src/base/objs/Gui/GuiComboBoxParameter.h b/isis/src/base/objs/Gui/GuiComboBoxParameter.h index 61a284adf2..1cd0cbb0e4 100644 --- a/isis/src/base/objs/Gui/GuiComboBoxParameter.h +++ b/isis/src/base/objs/Gui/GuiComboBoxParameter.h @@ -27,11 +27,11 @@ namespace Isis { int group, int param); ~GuiComboBoxParameter(); - IString Value(); + QString Value(); - void Set(IString newValue); + void Set(QString newValue); - virtual std::vector Exclusions(); + virtual std::vector Exclusions(); private: QComboBox *p_combo; diff --git a/isis/src/base/objs/Gui/GuiCubeParameter.cpp b/isis/src/base/objs/Gui/GuiCubeParameter.cpp index fbab8fe852..2935071d0d 100644 --- a/isis/src/base/objs/Gui/GuiCubeParameter.cpp +++ b/isis/src/base/objs/Gui/GuiCubeParameter.cpp @@ -105,15 +105,15 @@ namespace Isis { */ void GuiCubeParameter::SelectAttribute() { if(p_ui->ParamFileMode(p_group, p_param) == "input") { - Isis::CubeAttributeInput att(p_lineEdit->text().toStdString()); - std::string curAtt = att.toString(); - std::string newAtt; + Isis::CubeAttributeInput att(p_lineEdit->text()); + QString curAtt = att.toString(); + QString newAtt; int status = GuiInputAttribute::GetAttributes(curAtt, newAtt, p_ui->ParamName(p_group, p_param), p_fileButton); if((status == 1) && (curAtt != newAtt)) { - Isis::FileName f(p_lineEdit->text().toStdString()); - p_lineEdit->setText((IString)(f.expanded() + newAtt)); + Isis::FileName f(p_lineEdit->text()); + p_lineEdit->setText(f.expanded() + newAtt); } } else { @@ -121,15 +121,15 @@ namespace Isis { bool allowProp = att.propagatePixelType(); att.addAttributes(FileName(p_lineEdit->text())); - std::string curAtt = att.toString(); - std::string newAtt; + QString curAtt = att.toString(); + QString newAtt; int status = GuiOutputAttribute::GetAttributes(curAtt, newAtt, p_ui->ParamName(p_group, p_param), allowProp, p_fileButton); if((status == 1) && (curAtt != newAtt)) { - Isis::FileName f(p_lineEdit->text().toStdString()); - p_lineEdit->setText((IString)(f.expanded() + newAtt)); + Isis::FileName f(p_lineEdit->text()); + p_lineEdit->setText(f.expanded() + newAtt); } } @@ -144,7 +144,7 @@ namespace Isis { try { // Make sure the user entered a value if(IsModified()) { - std::string cubeName = Value(); + QString cubeName = Value(); // Check to make sure the cube can be opened Isis::Cube temp; @@ -152,12 +152,12 @@ namespace Isis { temp.close(); // Open the cube in Qview - IString command = "$ISISROOT/bin/qview " + cubeName + " &"; + QString command = "$ISISROOT/bin/qview " + cubeName + " &"; ProgramLauncher::RunSystemCommand(command); } // Throw an error if no cube name was entered else { - std::string msg = "You must enter a cube name to open"; + QString msg = "You must enter a cube name to open"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -174,7 +174,7 @@ namespace Isis { try { // Make sure the user entered a value if(IsModified()) { - std::string cubeName = Value(); + QString cubeName = Value(); // Check to make sure the cube can be opened Isis::Cube temp; @@ -189,7 +189,7 @@ namespace Isis { } else { - std::string msg = "You must enter a cube name to open"; + QString msg = "You must enter a cube name to open"; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/base/objs/Gui/GuiDoubleParameter.cpp b/isis/src/base/objs/Gui/GuiDoubleParameter.cpp index 5ff3780d52..213ca86742 100644 --- a/isis/src/base/objs/Gui/GuiDoubleParameter.cpp +++ b/isis/src/base/objs/Gui/GuiDoubleParameter.cpp @@ -29,13 +29,13 @@ namespace Isis { GuiDoubleParameter::~GuiDoubleParameter() {} - void GuiDoubleParameter::Set(IString newValue) { - p_lineEdit->setText(newValue.c_str()); + void GuiDoubleParameter::Set(QString newValue) { + p_lineEdit->setText(newValue); } - IString GuiDoubleParameter::Value() { - return p_lineEdit->text().toStdString(); + QString GuiDoubleParameter::Value() { + return p_lineEdit->text(); } } diff --git a/isis/src/base/objs/Gui/GuiDoubleParameter.h b/isis/src/base/objs/Gui/GuiDoubleParameter.h index bd21009af2..1bd22a270f 100644 --- a/isis/src/base/objs/Gui/GuiDoubleParameter.h +++ b/isis/src/base/objs/Gui/GuiDoubleParameter.h @@ -24,9 +24,9 @@ namespace Isis { int group, int param); ~GuiDoubleParameter(); - IString Value(); + QString Value(); - void Set(IString newValue); + void Set(QString newValue); private: QLineEdit *p_lineEdit; diff --git a/isis/src/base/objs/Gui/GuiEditFile.cpp b/isis/src/base/objs/Gui/GuiEditFile.cpp index f2d4c0058f..985532f2aa 100644 --- a/isis/src/base/objs/Gui/GuiEditFile.cpp +++ b/isis/src/base/objs/Gui/GuiEditFile.cpp @@ -29,7 +29,7 @@ namespace Isis { * @param pUI - User Interface of parent app * @param psFile - File to edit */ - void GuiEditFile::EditFile(UserInterface & pUI, std::string psFile) { + void GuiEditFile::EditFile(UserInterface & pUI, QString psFile) { if (m_instance == NULL) { m_instance = new GuiEditFile(pUI, psFile); } @@ -45,8 +45,8 @@ namespace Isis { * * @param psFile - File to edit */ - void GuiEditFile::showWindow(std::string psFile) { - m_fileName = QString(psFile.c_str()); + void GuiEditFile::showWindow(QString psFile) { + m_fileName = QString(psFile); m_editWin->setWindowTitle (m_fileName); OpenFile(m_fileName); m_editWin->show(); @@ -60,10 +60,10 @@ namespace Isis { * @param pUI * @param psFile */ - GuiEditFile::GuiEditFile(UserInterface & pUI, std::string psFile) { + GuiEditFile::GuiEditFile(UserInterface & pUI, QString psFile) { // Init data members m_parent = pUI.TheGui(); - m_fileName = QString(psFile.c_str()); + m_fileName = QString(psFile); m_editFile=NULL; // Main Window @@ -336,7 +336,7 @@ namespace Isis { * @param psfile - current file */ void GuiEditFile::windowTitle(QString & psfile) { - m_editWin->setWindowTitle(FileName(psfile.toStdString()).name().c_str()); + m_editWin->setWindowTitle(FileName(psfile).name()); } } diff --git a/isis/src/base/objs/Gui/GuiEditFile.h b/isis/src/base/objs/Gui/GuiEditFile.h index 5ae7b065b0..379a02450a 100644 --- a/isis/src/base/objs/Gui/GuiEditFile.h +++ b/isis/src/base/objs/Gui/GuiEditFile.h @@ -50,10 +50,10 @@ namespace Isis { Q_OBJECT public: //! Creates a single instance of the GuiEditFile - static void EditFile(UserInterface & pUI, std::string psFile=""); + static void EditFile(UserInterface & pUI, QString psFile=""); //! If there is already an instance of this object, then display the window - void showWindow(std::string psFile=""); + void showWindow(QString psFile=""); //! Destructor ~GuiEditFile(); @@ -73,7 +73,7 @@ namespace Isis { private: //! Constructor - GuiEditFile(UserInterface & pUI, std::string psFile=""); + GuiEditFile(UserInterface & pUI, QString psFile=""); void windowTitle(QString & psfile); //!< display only the file base name static GuiEditFile* m_instance; //!< Instance of this object - singleton diff --git a/isis/src/base/objs/Gui/GuiFilenameParameter.cpp b/isis/src/base/objs/Gui/GuiFilenameParameter.cpp index 93038ea85d..97ec3717c8 100644 --- a/isis/src/base/objs/Gui/GuiFilenameParameter.cpp +++ b/isis/src/base/objs/Gui/GuiFilenameParameter.cpp @@ -51,12 +51,12 @@ namespace Isis { grid->addWidget(p_fileButton, param, 3); QAction *action = new QAction(this); - std::string file = FileName("$ISIS3DATA/base/icons/view_tree.png").expanded(); - action->setIcon(QPixmap((IString)file)); + QString file = FileName("$ISIS3DATA/base/icons/view_tree.png").expanded(); + action->setIcon(QPixmap(file)); connect(action, SIGNAL(triggered(bool)), this, SLOT(SelectFile())); p_fileButton->setIconSize(QSize(22, 22)); - p_fileButton->setIcon(QPixmap((IString)file)); + p_fileButton->setIcon(QPixmap(file)); p_fileButton->setDefaultAction(action); p_fileButton->setToolTip("Select file"); QString fileButtonWhatsThisText = "

Function: \ @@ -85,8 +85,8 @@ namespace Isis { * * @param newValue */ - void GuiFileNameParameter::Set(IString newValue) { - p_lineEdit->setText(newValue.ToQt()); + void GuiFileNameParameter::Set(QString newValue) { + p_lineEdit->setText(newValue); } @@ -95,8 +95,8 @@ namespace Isis { * * @return @b IString Value found in line edit text box */ - IString GuiFileNameParameter::Value() { - return p_lineEdit->text().toStdString(); + QString GuiFileNameParameter::Value() { + return p_lineEdit->text(); } /** @@ -122,17 +122,17 @@ namespace Isis { // What directory do we look in? QString dir; if((p_lineEdit->text().length() > 0) && - (p_lineEdit->text().toStdString() != p_ui->ParamInternalDefault(p_group, p_param))) { - Isis::FileName fname(p_lineEdit->text().toStdString()); - dir = (QString)(IString)fname.expanded(); + (p_lineEdit->text() != p_ui->ParamInternalDefault(p_group, p_param))) { + Isis::FileName fname(p_lineEdit->text()); + dir = fname.expanded(); } else if(p_ui->ParamPath(p_group, p_param).length() > 0) { Isis::FileName fname(p_ui->ParamPath(p_group, p_param)); - dir = (QString)(IString)fname.expanded(); + dir = fname.expanded(); } // Set up the filter - QString filter = (IString)p_ui->ParamFilter(p_group, p_param); + QString filter = p_ui->ParamFilter(p_group, p_param); if(filter.isEmpty()) { filter = "Any(*)"; } @@ -159,11 +159,11 @@ namespace Isis { fnameQString = QFileDialog::getSaveFileName(p_fileButton, "Select file", dir, filter, 0, options); } if(fnameQString != "") { - Isis::FileName fname(fnameQString.toStdString()); + Isis::FileName fname(fnameQString); if(fname.dir() == QDir::currentPath()) { - fnameQString = (QString)(IString)fname.name(); + fnameQString = fname.name(); } - Set(fnameQString.toStdString()); + Set(fnameQString); } } } diff --git a/isis/src/base/objs/Gui/GuiFilenameParameter.h b/isis/src/base/objs/Gui/GuiFilenameParameter.h index 904946a99f..55e694324e 100644 --- a/isis/src/base/objs/Gui/GuiFilenameParameter.h +++ b/isis/src/base/objs/Gui/GuiFilenameParameter.h @@ -55,9 +55,9 @@ namespace Isis { int group, int param); ~GuiFileNameParameter(); - IString Value(); + QString Value(); - void Set(IString newValue); + void Set(QString newValue); protected slots: virtual void SelectFile(); diff --git a/isis/src/base/objs/Gui/GuiHelperAction.h b/isis/src/base/objs/Gui/GuiHelperAction.h index bc9bdae3f9..6477c1295e 100644 --- a/isis/src/base/objs/Gui/GuiHelperAction.h +++ b/isis/src/base/objs/Gui/GuiHelperAction.h @@ -1,5 +1,5 @@ #include -#include "IString.h" +#include namespace Isis { /** diff --git a/isis/src/base/objs/Gui/GuiInputAttribute.cpp b/isis/src/base/objs/Gui/GuiInputAttribute.cpp index 860b9ad6f5..f30cae5231 100644 --- a/isis/src/base/objs/Gui/GuiInputAttribute.cpp +++ b/isis/src/base/objs/Gui/GuiInputAttribute.cpp @@ -37,16 +37,16 @@ namespace Isis { //! Convenience access to dialog - int GuiInputAttribute::GetAttributes(const std::string &defaultAttribute, - std::string &newAttribute, - const std::string &title, + int GuiInputAttribute::GetAttributes(const QString &defaultAttribute, + QString &newAttribute, + const QString &title, QWidget *parent) { // Construct dialog if necessary static GuiInputAttribute *p_dialog = 0; if(p_dialog == 0) { p_dialog = new GuiInputAttribute(parent); } - p_dialog->setWindowTitle(title.c_str()); + p_dialog->setWindowTitle(title); // Load default attributes and then get the new ones p_dialog->SetAttributes(defaultAttribute); @@ -115,30 +115,26 @@ namespace Isis { // Return the attributes in the dialog - std::string GuiInputAttribute::GetAttributes() { + QString GuiInputAttribute::GetAttributes() { if(p_lineEdit->isEnabled()) { - Isis::IString s = p_lineEdit->text().toStdString(); - s.Remove(" "); - s.Trim("+"); - if(s == "") return s; - return (std::string)"+" + s; + return FileName(p_lineEdit->text()).attributes(); } else { - return std::string(""); + return QString(""); } } // Set the attributes in the dialog - void GuiInputAttribute::SetAttributes(const std::string &value) { + void GuiInputAttribute::SetAttributes(const QString &value) { Isis::CubeAttributeInput att(value); - std::vector bands = att.bands(); + std::vector bands = att.bands(); if(bands.size() == 0) { p_buttonGroup->buttons()[0]->setChecked(true); p_lineEdit->setText(""); } else { p_buttonGroup->buttons()[1]->setChecked(true); - p_lineEdit->setText((IString)att.toString()); + p_lineEdit->setText(att.toString()); } } } diff --git a/isis/src/base/objs/Gui/GuiInputAttribute.h b/isis/src/base/objs/Gui/GuiInputAttribute.h index 9732ad74c0..b5b2187eb6 100644 --- a/isis/src/base/objs/Gui/GuiInputAttribute.h +++ b/isis/src/base/objs/Gui/GuiInputAttribute.h @@ -42,13 +42,13 @@ namespace Isis { ~GuiInputAttribute(); - std::string GetAttributes(); + QString GetAttributes(); - void SetAttributes(const std::string &value); + void SetAttributes(const QString &value); - static int GetAttributes(const std::string &defaultAttribute, - std::string &newAttribute, - const std::string &title, + static int GetAttributes(const QString &defaultAttribute, + QString &newAttribute, + const QString &title, QWidget *parent); private: QLineEdit *p_lineEdit; diff --git a/isis/src/base/objs/Gui/GuiIntegerParameter.cpp b/isis/src/base/objs/Gui/GuiIntegerParameter.cpp index fe97898b89..16f4d783b3 100644 --- a/isis/src/base/objs/Gui/GuiIntegerParameter.cpp +++ b/isis/src/base/objs/Gui/GuiIntegerParameter.cpp @@ -26,13 +26,13 @@ namespace Isis { GuiIntegerParameter::~GuiIntegerParameter() {} - void GuiIntegerParameter::Set(IString newValue) { + void GuiIntegerParameter::Set(QString newValue) { p_lineEdit->setText(newValue); } - IString GuiIntegerParameter::Value() { - return p_lineEdit->text().toStdString(); + QString GuiIntegerParameter::Value() { + return p_lineEdit->text(); } } diff --git a/isis/src/base/objs/Gui/GuiIntegerParameter.h b/isis/src/base/objs/Gui/GuiIntegerParameter.h index 24aef7b187..62266c8578 100644 --- a/isis/src/base/objs/Gui/GuiIntegerParameter.h +++ b/isis/src/base/objs/Gui/GuiIntegerParameter.h @@ -25,9 +25,9 @@ namespace Isis { int group, int param); ~GuiIntegerParameter(); - IString Value(); + QString Value(); - void Set(IString newValue); + void Set(QString newValue); private: QLineEdit *p_lineEdit; diff --git a/isis/src/base/objs/Gui/GuiListParameter.cpp b/isis/src/base/objs/Gui/GuiListParameter.cpp index 70d0365adb..342f08387a 100644 --- a/isis/src/base/objs/Gui/GuiListParameter.cpp +++ b/isis/src/base/objs/Gui/GuiListParameter.cpp @@ -29,7 +29,7 @@ namespace Isis { // Create a button for each list item and add each to a button group and // to the layout for(int item = 0; item < ui.ParamListSize(group, param); item++) { - IString btext = ui.ParamListBrief(group, param, item); + QString btext = ui.ParamListBrief(group, param, item); btext += " ("; btext += ui.ParamListValue(group, param, item); btext += ")"; @@ -42,7 +42,7 @@ namespace Isis { lo->addLayout(hlo); // Create radio button & add to horizontal layout - QRadioButton *rb = new QRadioButton((IString)btext); + QRadioButton *rb = new QRadioButton(btext); hlo->addWidget(rb); p_buttonGroup->addButton(rb); @@ -54,7 +54,7 @@ namespace Isis { RememberWidget(helper); } else { - QRadioButton *rb = new QRadioButton((IString)btext); + QRadioButton *rb = new QRadioButton(btext); lo->addWidget(rb); p_buttonGroup->addButton(rb); RememberWidget(rb); @@ -72,14 +72,12 @@ namespace Isis { } - void GuiListParameter::Set(IString newValue) { - IString value = newValue; - value.UpCase(); + void GuiListParameter::Set(QString newValue) { + QString value = newValue.toUpper(); int foundAtButton = -1; for(int i = 0; i < p_ui->ParamListSize(p_group, p_param); i++) { - IString option = p_ui->ParamListValue(p_group, p_param, i); - option.UpCase(); + QString option = p_ui->ParamListValue(p_group, p_param, i).toUpper(); //if(option.compare(0, value.size(), value) == 0) foundAtButton = i; if(option == value) foundAtButton = i; } @@ -92,23 +90,23 @@ namespace Isis { } - IString GuiListParameter::Value() { + QString GuiListParameter::Value() { if(p_buttonGroup->checkedButton() == 0) { return ""; } - return (IString)p_ui->ParamListValue(p_group, p_param, - p_buttonGroup->buttons().indexOf(p_buttonGroup->checkedButton())); + return p_ui->ParamListValue(p_group, p_param, + p_buttonGroup->buttons().indexOf(p_buttonGroup->checkedButton())); } - std::vector GuiListParameter::Exclusions() { - std::vector list; + std::vector GuiListParameter::Exclusions() { + std::vector list; if(p_buttonGroup->checkedButton() == 0) return list; int index = p_buttonGroup->buttons().indexOf(p_buttonGroup->checkedButton()); for(int i = 0; i < p_ui->ParamListExcludeSize(p_group, p_param, index); i++) { - std::string s = p_ui->ParamListExclude(p_group, p_param, index, i); + QString s = p_ui->ParamListExclude(p_group, p_param, index, i); list.push_back(s); } diff --git a/isis/src/base/objs/Gui/GuiListParameter.h b/isis/src/base/objs/Gui/GuiListParameter.h index 077694066e..471989d362 100644 --- a/isis/src/base/objs/Gui/GuiListParameter.h +++ b/isis/src/base/objs/Gui/GuiListParameter.h @@ -27,11 +27,11 @@ namespace Isis { int group, int param); ~GuiListParameter(); - IString Value(); + QString Value(); - void Set(IString newValue); + void Set(QString newValue); - virtual std::vector Exclusions(); + virtual std::vector Exclusions(); private: QButtonGroup *p_buttonGroup; diff --git a/isis/src/base/objs/Gui/GuiOutputAttribute.cpp b/isis/src/base/objs/Gui/GuiOutputAttribute.cpp index c2d6a991d7..3db7669762 100644 --- a/isis/src/base/objs/Gui/GuiOutputAttribute.cpp +++ b/isis/src/base/objs/Gui/GuiOutputAttribute.cpp @@ -40,9 +40,9 @@ namespace Isis { //! Convenience access to dialog - int GuiOutputAttribute::GetAttributes(const std::string &defaultAttribute, - std::string &newAttribute, - const std::string &title, + int GuiOutputAttribute::GetAttributes(const QString &defaultAttribute, + QString &newAttribute, + const QString &title, bool allowProp, QWidget *parent) { // Construct dialog if necessary @@ -50,7 +50,7 @@ namespace Isis { if(p_dialog == 0) { p_dialog = new GuiOutputAttribute(parent); } - p_dialog->setWindowTitle((IString)title); + p_dialog->setWindowTitle(title); p_dialog->SetPropagation(allowProp); // Load default attributes and then get the new ones @@ -192,8 +192,8 @@ namespace Isis { // Return the attributes in the dialog - std::string GuiOutputAttribute::GetAttributes() { - std::string att; + QString GuiOutputAttribute::GetAttributes() { + QString att; if(p_lsb->isChecked()) att += "+Lsb"; if(p_msb->isChecked()) att += "+Msb"; @@ -210,19 +210,19 @@ namespace Isis { if(p_unsignedByte->isChecked() || p_signedWord->isChecked()) { if((p_minEdit->text() != "") && (p_maxEdit->text() != "")) { att += "+"; - att += p_minEdit->text().toStdString(); + att += p_minEdit->text(); att += ":"; - att += p_maxEdit->text().toStdString(); + att += p_maxEdit->text(); } } Isis::CubeAttributeOutput catt(att); - std::string s = catt.toString(); + QString s = catt.toString(); return s; } // Set the attributes in the dialog - void GuiOutputAttribute::SetAttributes(const std::string &value) { + void GuiOutputAttribute::SetAttributes(const QString &value) { Isis::CubeAttributeOutput att(value); if(att.fileFormat() == Cube::Tile) { p_tiled->setChecked(true); diff --git a/isis/src/base/objs/Gui/GuiOutputAttribute.h b/isis/src/base/objs/Gui/GuiOutputAttribute.h index fb3ea3a930..850f9ce3b6 100644 --- a/isis/src/base/objs/Gui/GuiOutputAttribute.h +++ b/isis/src/base/objs/Gui/GuiOutputAttribute.h @@ -49,13 +49,13 @@ namespace Isis { ~GuiOutputAttribute(); - std::string GetAttributes(); + QString GetAttributes(); - void SetAttributes(const std::string &value); + void SetAttributes(const QString &value); - static int GetAttributes(const std::string &defaultAttribute, - std::string &newAttribute, - const std::string &title, + static int GetAttributes(const QString &defaultAttribute, + QString &newAttribute, + const QString &title, bool allowProp, QWidget *parent); diff --git a/isis/src/base/objs/Gui/GuiParameter.cpp b/isis/src/base/objs/Gui/GuiParameter.cpp index 2d59675096..1672f5eba3 100644 --- a/isis/src/base/objs/Gui/GuiParameter.cpp +++ b/isis/src/base/objs/Gui/GuiParameter.cpp @@ -51,25 +51,25 @@ namespace Isis { p_label = new QLabel(p_name); p_label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - p_label->setToolTip((IString)p_ui->ParamBrief(group, param)); + p_label->setToolTip(p_ui->ParamBrief(group, param)); grid->addWidget(p_label, param, 0, Qt::AlignCenter); QString whatsThis; - whatsThis = (QString)(IString)("Parameter: " + p_ui->ParamName(group, param)); - whatsThis += (QString)(IString)("

Type: " + p_ui->ParamType(group, param) + "

"); - whatsThis += (QString)(IString)("

Brief: " + p_ui->ParamBrief(group, param) + "

"); - IString def = p_ui->ParamDefault(group, param); + whatsThis = (QString)("Parameter: " + p_ui->ParamName(group, param)); + whatsThis += (QString)("

Type: " + p_ui->ParamType(group, param) + "

"); + whatsThis += (QString)("

Brief: " + p_ui->ParamBrief(group, param) + "

"); + QString def = p_ui->ParamDefault(group, param); if(def == "") def = "None"; whatsThis += "

Default: " + QString(def) + "

"; - IString intdef = p_ui->ParamInternalDefault(group, param); + QString intdef = p_ui->ParamInternalDefault(group, param); if(intdef != "") { whatsThis += "

Internal Default: " + QString(intdef) + "

"; } - IString pixtype = p_ui->PixelType(group, param); + QString pixtype = p_ui->PixelType(group, param); if(pixtype != "") { whatsThis += "

Pixel Type: " + QString(pixtype) + "

"; } - IString pmin = p_ui->ParamMinimum(group, param); + QString pmin = p_ui->ParamMinimum(group, param); if(pmin != "") { if(p_ui->ParamMinimumInclusive(group, param) == "YES") { whatsThis += "

Greater Than Or Equal To: " + @@ -79,7 +79,7 @@ namespace Isis { whatsThis += "

Greater Than: " + QString(pmin) + "

"; } } - IString pmax = p_ui->ParamMaximum(group, param); + QString pmax = p_ui->ParamMaximum(group, param); if(pmax != "") { if(p_ui->ParamMaximumInclusive(group, param) == "YES") { whatsThis += "

Less Than Or Equal To: " + @@ -91,68 +91,68 @@ namespace Isis { } if(p_ui->ParamLessThanSize(group, param) > 0) { whatsThis += "

Less Than: " + - QString((IString)p_ui->ParamLessThan(group, param, 0)); + QString(p_ui->ParamLessThan(group, param, 0)); for(int l = 1; l < p_ui->ParamLessThanSize(group, param); l++) { - whatsThis += ", " + QString((IString)p_ui->ParamLessThan(group, param, l)); + whatsThis += ", " + QString(p_ui->ParamLessThan(group, param, l)); } whatsThis += "

"; } if(p_ui->ParamLessThanOrEqualSize(group, param) > 0) { whatsThis += "

Less Than Or Equal: " + - QString((IString)p_ui->ParamLessThanOrEqual(group, param, 0)); + QString(p_ui->ParamLessThanOrEqual(group, param, 0)); for(int l = 1; l < p_ui->ParamLessThanOrEqualSize(group, param); l++) { whatsThis += ", " + - QString((IString)p_ui->ParamLessThanOrEqual(group, param, l)); + QString(p_ui->ParamLessThanOrEqual(group, param, l)); } whatsThis += "

"; } if(p_ui->ParamNotEqualSize(group, param) > 0) { whatsThis += "

Not Equal: " + - QString((IString)p_ui->ParamNotEqual(group, param, 0)); + QString(p_ui->ParamNotEqual(group, param, 0)); for(int l = 1; l < p_ui->ParamNotEqualSize(group, param); l++) { - whatsThis += ", " + QString((IString)p_ui->ParamNotEqual(group, param, l)); + whatsThis += ", " + QString(p_ui->ParamNotEqual(group, param, l)); } whatsThis += "

"; } if(p_ui->ParamGreaterThanSize(group, param) > 0) { whatsThis += "

Greater Than: " + - QString((IString)p_ui->ParamGreaterThan(group, param, 0)); + QString(p_ui->ParamGreaterThan(group, param, 0)); for(int l = 1; l < p_ui->ParamGreaterThanSize(group, param); l++) { whatsThis += ", " + - QString((IString)p_ui->ParamGreaterThan(group, param, l)); + QString(p_ui->ParamGreaterThan(group, param, l)); } whatsThis += "

"; } if(p_ui->ParamGreaterThanOrEqualSize(group, param) > 0) { whatsThis += "

Greater Than Or Equal: " + - QString((IString)p_ui->ParamGreaterThanOrEqual(group, param, 0)); + QString(p_ui->ParamGreaterThanOrEqual(group, param, 0)); for(int l = 1; l < p_ui->ParamGreaterThanOrEqualSize(group, param); l++) { whatsThis += ", " + - QString((IString)p_ui->ParamGreaterThanOrEqual(group, param, l)); + QString(p_ui->ParamGreaterThanOrEqual(group, param, l)); } whatsThis += "

"; } if(p_ui->ParamIncludeSize(group, param) > 0) { whatsThis += "

Inclusions: " + - QString((IString)p_ui->ParamInclude(group, param, 0)); + QString(p_ui->ParamInclude(group, param, 0)); for(int l = 1; l < p_ui->ParamIncludeSize(group, param); l++) { whatsThis += ", " + - QString((IString)p_ui->ParamInclude(group, param, l)); + QString(p_ui->ParamInclude(group, param, l)); } whatsThis += "

"; } if(p_ui->ParamExcludeSize(group, param) > 0) { whatsThis += "

Exclusions: " + - QString((IString)p_ui->ParamExclude(group, param, 0)); + QString(p_ui->ParamExclude(group, param, 0)); for(int l = 1; l < p_ui->ParamExcludeSize(group, param); l++) { whatsThis += ", " + - QString((IString)p_ui->ParamExclude(group, param, l)); + QString(p_ui->ParamExclude(group, param, l)); } whatsThis += "

"; } if(p_ui->ParamOdd(group, param) != "") { whatsThis += "

Odd: " + - QString((IString)p_ui->ParamOdd(group, param)) + "

"; + QString(p_ui->ParamOdd(group, param)) + "

"; } p_label->setWhatsThis(whatsThis); @@ -252,8 +252,8 @@ namespace Isis { } //! Return list of current exclusions - std::vector GuiParameter::Exclusions() { - std::vector list; + std::vector GuiParameter::Exclusions() { + std::vector list; return list; } @@ -262,29 +262,29 @@ namespace Isis { // Just make one single helper button if(p_ui->HelpersSize(p_group, p_param) == 1) { GuiHelperAction *action = - new GuiHelperAction(lo, (IString)p_ui->HelperFunction(p_group, p_param, 0)); + new GuiHelperAction(lo, p_ui->HelperFunction(p_group, p_param, 0)); if(p_ui->HelperIcon(p_group, p_param, 0) != "") { - IString file = FileName( + QString file = FileName( p_ui->HelperIcon(p_group, p_param, 0)).expanded(); action->setIcon(QIcon(QPixmap(file))); } else { - action->setText((IString)p_ui->HelperButtonName(p_group, p_param, 0)); + action->setText(p_ui->HelperButtonName(p_group, p_param, 0)); } - action->setToolTip((IString)p_ui->HelperBrief(p_group, p_param, 0)); + action->setToolTip(p_ui->HelperBrief(p_group, p_param, 0)); QString helperText = "

Function: " + - QString((IString)p_ui->HelperDescription(p_group, p_param, 0)) + "

"; + QString(p_ui->HelperDescription(p_group, p_param, 0)) + "

"; action->setWhatsThis(helperText); connect(action, SIGNAL(trigger(const QString &)), this, SIGNAL(HelperTrigger(const QString &))); QToolButton *helper = new QToolButton(); - helper->setText((IString)p_ui->HelperButtonName(p_group, p_param, 0)); + helper->setText(p_ui->HelperButtonName(p_group, p_param, 0)); helper->setDefaultAction(action); if(p_ui->HelperIcon(p_group, p_param, 0) != "") { helper->setText(""); - IString file = FileName( + QString file = FileName( p_ui->HelperIcon(p_group, p_param, 0)).expanded(); helper->setIconSize(QSize(22, 22)); helper->setIcon(QIcon(QPixmap(file))); @@ -309,34 +309,34 @@ namespace Isis { // Create default action item GuiHelperAction *action = - new GuiHelperAction(lo, (IString)p_ui->HelperFunction(p_group, p_param, 0)); + new GuiHelperAction(lo, p_ui->HelperFunction(p_group, p_param, 0)); if(p_ui->HelperIcon(p_group, p_param, 0) != "") { - IString file = FileName( + QString file = FileName( p_ui->HelperIcon(p_group, p_param, 0)).expanded(); action->setIcon(QIcon(QPixmap(file))); } else { - action->setText((IString)p_ui->HelperButtonName(p_group, p_param, 0)); + action->setText(p_ui->HelperButtonName(p_group, p_param, 0)); } connect(action, SIGNAL(trigger(const QString &)), this, SIGNAL(HelperTrigger(const QString &))); // Set up helper button QToolButton *helper = new QToolButton(); - helper->setText((IString)p_ui->HelperButtonName(p_group, p_param, 0)); + helper->setText(p_ui->HelperButtonName(p_group, p_param, 0)); helper->setMenu(p_helperMenu); helper->setPopupMode(QToolButton::MenuButtonPopup); helper->setDefaultAction(action); - helper->setToolTip((IString)p_ui->HelperBrief(p_group, p_param, 0)); + helper->setToolTip(p_ui->HelperBrief(p_group, p_param, 0)); QString text = "

Function: " + - QString((IString)p_ui->HelperDescription(p_group, p_param, 0)) + "

" + + QString(p_ui->HelperDescription(p_group, p_param, 0)) + "

" + "

Hint: Click on the arrow to see more helper functions

"; helper->setWhatsThis(text); if(p_ui->HelperIcon(p_group, p_param, 0) != "") { helper->setText(""); - IString file = FileName( + QString file = FileName( p_ui->HelperIcon(p_group, p_param, 0)).expanded(); helper->setIconSize(QSize(22, 22)); helper->setIcon(QIcon(QPixmap(file))); @@ -348,11 +348,11 @@ namespace Isis { // Set up default action item in menu list GuiHelperAction *action2 = - new GuiHelperAction(lo, (IString)p_ui->HelperFunction(p_group, p_param, 0)); - action2->setText((IString)p_ui->HelperBrief(p_group, p_param, 0)); - action2->setToolTip((IString)p_ui->HelperBrief(p_group, p_param, 0)); + new GuiHelperAction(lo, p_ui->HelperFunction(p_group, p_param, 0)); + action2->setText(p_ui->HelperBrief(p_group, p_param, 0)); + action2->setToolTip(p_ui->HelperBrief(p_group, p_param, 0)); QString helperText = "

Function: " + - QString((IString)p_ui->HelperDescription(p_group, p_param, 0)) + "

"; + QString(p_ui->HelperDescription(p_group, p_param, 0)) + "

"; action2->setWhatsThis(helperText); connect(action2, SIGNAL(trigger(const QString &)), this, SIGNAL(HelperTrigger(const QString &))); @@ -362,11 +362,11 @@ namespace Isis { // Add each additional helper button to the menu list for(int i = 1; i < p_ui->HelpersSize(p_group, p_param); i++) { GuiHelperAction *helperAction = - new GuiHelperAction(lo, (IString)p_ui->HelperFunction(p_group, p_param, i)); - helperAction->setText((IString)p_ui->HelperBrief(p_group, p_param, i)); - helperAction->setToolTip((IString)p_ui->HelperBrief(p_group, p_param, i)); + new GuiHelperAction(lo, p_ui->HelperFunction(p_group, p_param, i)); + helperAction->setText(p_ui->HelperBrief(p_group, p_param, i)); + helperAction->setToolTip(p_ui->HelperBrief(p_group, p_param, i)); QString helperText = "

Function: " + - QString((IString)p_ui->HelperDescription(p_group, p_param, i)) + "

"; + QString(p_ui->HelperDescription(p_group, p_param, i)) + "

"; helperAction->setWhatsThis(helperText); connect(helperAction, SIGNAL(trigger(const QString &)), this, SIGNAL(HelperTrigger(const QString &))); diff --git a/isis/src/base/objs/Gui/GuiParameter.h b/isis/src/base/objs/Gui/GuiParameter.h index e7f174bb56..5af6cf2b26 100644 --- a/isis/src/base/objs/Gui/GuiParameter.h +++ b/isis/src/base/objs/Gui/GuiParameter.h @@ -29,10 +29,9 @@ #include #include #include +#include #include -#include "IString.h" - namespace Isis { class UserInterface; @@ -58,7 +57,7 @@ namespace Isis { virtual ~GuiParameter(); //! Return the name of the parameter - IString Name() const { + QString Name() const { return p_name; }; @@ -66,9 +65,9 @@ namespace Isis { void SetToCurrent(); - virtual IString Value() = 0; + virtual QString Value() = 0; - virtual void Set(IString newValue) = 0; + virtual void Set(QString newValue) = 0; void SetEnabled(bool enabled, bool isParentCombo=false); @@ -85,7 +84,7 @@ namespace Isis { QWidget *AddHelpers(QObject *lo); - virtual std::vector Exclusions(); + virtual std::vector Exclusions(); enum ParameterType { IntegerWidget, DoubleWidget, StringWidget, ListWidget, FileNameWidget, CubeWidget, @@ -102,7 +101,7 @@ namespace Isis { int p_group; int p_param; - IString p_name; + QString p_name; UserInterface *p_ui; QLabel *p_label; diff --git a/isis/src/base/objs/Gui/GuiParameterFactory.cpp b/isis/src/base/objs/Gui/GuiParameterFactory.cpp index 17df24687d..cff9ef21a4 100644 --- a/isis/src/base/objs/Gui/GuiParameterFactory.cpp +++ b/isis/src/base/objs/Gui/GuiParameterFactory.cpp @@ -14,7 +14,7 @@ namespace Isis { GuiParameter *GuiParameterFactory::Create(QGridLayout *grid, Isis::UserInterface &ui, int group, int param) { - std::string paramType = ui.ParamType(group, param); + QString paramType = ui.ParamType(group, param); GuiParameter *p = NULL; if(ui.ParamListSize(group, param) > 0) { @@ -43,7 +43,7 @@ namespace Isis { p = new GuiBooleanParameter(grid, ui, group, param); } else { - std::string msg = "Invalid parameter type in XML [" + paramType + "]"; + QString msg = "Invalid parameter type in XML [" + paramType + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Gui/GuiStringParameter.cpp b/isis/src/base/objs/Gui/GuiStringParameter.cpp index 44792898e4..6abc6ff15f 100644 --- a/isis/src/base/objs/Gui/GuiStringParameter.cpp +++ b/isis/src/base/objs/Gui/GuiStringParameter.cpp @@ -25,13 +25,13 @@ namespace Isis { GuiStringParameter::~GuiStringParameter() {} - void GuiStringParameter::Set(IString newValue) { - p_lineEdit->setText((IString)newValue); + void GuiStringParameter::Set(QString newValue) { + p_lineEdit->setText(newValue); } - IString GuiStringParameter::Value() { - return p_lineEdit->text().toStdString(); + QString GuiStringParameter::Value() { + return p_lineEdit->text(); } diff --git a/isis/src/base/objs/Gui/GuiStringParameter.h b/isis/src/base/objs/Gui/GuiStringParameter.h index 8f6523c36b..cbbea692cb 100644 --- a/isis/src/base/objs/Gui/GuiStringParameter.h +++ b/isis/src/base/objs/Gui/GuiStringParameter.h @@ -1,5 +1,5 @@ -#ifndef Isis_GuIStringParameter_h -#define Isis_GuIStringParameter_h +#ifndef Isis_GuQStringParameter_h +#define Isis_GuQStringParameter_h #include @@ -24,9 +24,9 @@ namespace Isis { int group, int param); ~GuiStringParameter(); - IString Value(); + QString Value(); - void Set(IString newValue); + void Set(QString newValue); private: QLineEdit *p_lineEdit; diff --git a/isis/src/base/objs/Hapke/Hapke.cpp b/isis/src/base/objs/Hapke/Hapke.cpp index 0a5e65891a..f0af5415ac 100644 --- a/isis/src/base/objs/Hapke/Hapke.cpp +++ b/isis/src/base/objs/Hapke/Hapke.cpp @@ -22,8 +22,7 @@ namespace Isis { PvlGroup &algorithm = pvl.FindObject("PhotometricModel").FindGroup("Algorithm", Pvl::Traverse); - p_algName = AlgorithmName(); - p_algName.UpCase(); + p_algName = AlgorithmName().toUpper(); if(algorithm.HasKeyword("Hg1")) { SetPhotoHg1(algorithm["Hg1"]); @@ -42,9 +41,9 @@ namespace Isis { } if(algorithm.HasKeyword("ZeroB0Standard")) { - SetPhoto0B0Standard((string)algorithm["ZeroB0Standard"]); + SetPhoto0B0Standard(algorithm["ZeroB0Standard"][0]); } else if (algorithm.HasKeyword("ZeroB0St")) { - SetPhoto0B0Standard((string)algorithm["ZeroB0St"]); + SetPhoto0B0Standard(algorithm["ZeroB0St"][0]); } else { SetPhoto0B0Standard("TRUE"); } @@ -414,7 +413,7 @@ namespace Isis { * * @param b0standard Hapke opposition surge initialization, default is true */ - void Hapke::SetPhoto0B0Standard(const string &b0standard) { + void Hapke::SetPhoto0B0Standard(const QString &b0standard) { IString temp(b0standard); temp = temp.UpCase(); diff --git a/isis/src/base/objs/Hapke/Hapke.h b/isis/src/base/objs/Hapke/Hapke.h index ebb08b5733..8f3e9c1de7 100644 --- a/isis/src/base/objs/Hapke/Hapke.h +++ b/isis/src/base/objs/Hapke/Hapke.h @@ -115,9 +115,9 @@ namespace Isis { p_photoThetaold = theta; } - void SetPhoto0B0Standard(const std::string &b0standard); + void SetPhoto0B0Standard(const QString &b0standard); //! Return photometric B0 standardization value -/* inline std::string Photo0B0Standard() const { +/* inline QString Photo0B0Standard() const { return p_photo0B0Standard; }*/ @@ -143,8 +143,8 @@ namespace Isis { double p_photoTant; double p_photoSr; double p_photoOsr; - IString p_algName; - std::string p_photo0B0Standard; + QString p_algName; + QString p_photo0B0Standard; double p_photoWh; double p_photoHh; double p_photoB0; diff --git a/isis/src/base/objs/Hapke/unitTest.cpp b/isis/src/base/objs/Hapke/unitTest.cpp index 1a3e4e5233..1515a84864 100644 --- a/isis/src/base/objs/Hapke/unitTest.cpp +++ b/isis/src/base/objs/Hapke/unitTest.cpp @@ -46,12 +46,12 @@ int main() { PvlGroup algp2("Algorithm"); algp2 += PvlKeyword("Name", "HapkeHen"); - algp2 += PvlKeyword("Wh", 0.52); - algp2 += PvlKeyword("B0", 1.0); - algp2 += PvlKeyword("Hh", 1.0); - algp2 += PvlKeyword("Theta", 30.0); - algp2 += PvlKeyword("Hg1", 0.213); - algp2 += PvlKeyword("Hg2", 1.0); + algp2 += PvlKeyword("Wh", toString(0.52)); + algp2 += PvlKeyword("B0", toString(1.0)); + algp2 += PvlKeyword("Hh", toString(1.0)); + algp2 += PvlKeyword("Theta", toString(30.0)); + algp2 += PvlKeyword("Hg1", toString(0.213)); + algp2 += PvlKeyword("Hg2", toString(1.0)); algp2 += PvlKeyword("ZeroB0St", "TRUE"); PvlObject op2("PhotometricModel"); @@ -82,12 +82,12 @@ int main() { PvlGroup algp3("Algorithm"); algp3 += PvlKeyword("Name", "HapkeHen"); - algp3 += PvlKeyword("Wh", 0.52); - algp3 += PvlKeyword("B0", 1.0); - algp3 += PvlKeyword("Hh", 1.0); - algp3 += PvlKeyword("Theta", 30.0); - algp3 += PvlKeyword("Hg1", 0.213); - algp3 += PvlKeyword("Hg2", 1.0); + algp3 += PvlKeyword("Wh", toString(0.52)); + algp3 += PvlKeyword("B0", toString(1.0)); + algp3 += PvlKeyword("Hh", toString(1.0)); + algp3 += PvlKeyword("Theta", toString(30.0)); + algp3 += PvlKeyword("Hg1", toString(0.213)); + algp3 += PvlKeyword("Hg2", toString(1.0)); algp3 += PvlKeyword("ZeroB0St", "YES"); PvlObject op3("PhotometricModel"); @@ -121,12 +121,12 @@ int main() { PvlGroup algp4("Algorithm"); algp4 += PvlKeyword("Name", "HapkeLeg"); - algp4 += PvlKeyword("Wh", 0.52); - algp4 += PvlKeyword("B0", 1.0); - algp4 += PvlKeyword("Hh", 1.0); - algp4 += PvlKeyword("Bh", 0.0); - algp4 += PvlKeyword("Ch", 0.0); - algp4 += PvlKeyword("Theta", 30.0); + algp4 += PvlKeyword("Wh", toString(0.52)); + algp4 += PvlKeyword("B0", toString(1.0)); + algp4 += PvlKeyword("Hh", toString(1.0)); + algp4 += PvlKeyword("Bh", toString(0.0)); + algp4 += PvlKeyword("Ch", toString(0.0)); + algp4 += PvlKeyword("Theta", toString(30.0)); algp4 += PvlKeyword("ZeroB0Standard", "FALSE"); PvlObject op4("PhotometricModel"); @@ -157,12 +157,12 @@ int main() { PvlGroup algp5("Algorithm"); algp5 += PvlKeyword("Name", "HapkeLeg"); - algp5 += PvlKeyword("Wh", 0.52); - algp5 += PvlKeyword("B0", 1.0); - algp5 += PvlKeyword("Hh", 1.0); - algp5 += PvlKeyword("Bh", 0.0); - algp5 += PvlKeyword("Ch", 0.0); - algp5 += PvlKeyword("Theta", 30.0); + algp5 += PvlKeyword("Wh", toString(0.52)); + algp5 += PvlKeyword("B0", toString(1.0)); + algp5 += PvlKeyword("Hh", toString(1.0)); + algp5 += PvlKeyword("Bh", toString(0.0)); + algp5 += PvlKeyword("Ch", toString(0.0)); + algp5 += PvlKeyword("Theta", toString(30.0)); algp5 += PvlKeyword("ZeroB0Standard", "NO"); PvlObject op5("PhotometricModel"); @@ -193,12 +193,12 @@ int main() { PvlGroup algp6("Algorithm"); algp6 += PvlKeyword("Name", "HapkeLeg"); - algp6 += PvlKeyword("Wh", 0.52); - algp6 += PvlKeyword("B0", 1.0); - algp6 += PvlKeyword("Hh", 1.0); - algp6 += PvlKeyword("Bh", 0.0); - algp6 += PvlKeyword("Ch", 0.0); - algp6 += PvlKeyword("Theta", 30.0); + algp6 += PvlKeyword("Wh", toString(0.52)); + algp6 += PvlKeyword("B0", toString(1.0)); + algp6 += PvlKeyword("Hh", toString(1.0)); + algp6 += PvlKeyword("Bh", toString(0.0)); + algp6 += PvlKeyword("Ch", toString(0.0)); + algp6 += PvlKeyword("Theta", toString(30.0)); algp6 += PvlKeyword("ZeroB0Standard", "MAYBE"); PvlObject op6("PhotometricModel"); diff --git a/isis/src/base/objs/Histogram/Histogram.cpp b/isis/src/base/objs/Histogram/Histogram.cpp index 428e85e3ca..d1528e95ab 100644 --- a/isis/src/base/objs/Histogram/Histogram.cpp +++ b/isis/src/base/objs/Histogram/Histogram.cpp @@ -555,7 +555,7 @@ namespace Isis { */ BigInt Histogram::BinCount(const int index) const { if ((index < 0) || (index >= (int)p_bins.size())) { - string message = Message::ArraySubscriptNotInRange(index); + QString message = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, message, _FILEINFO_); } @@ -577,7 +577,7 @@ namespace Isis { void Histogram::BinRange(const int index, double &low, double &high) const { if ((index < 0) || (index >= (int)p_bins.size())) { - string message = Message::ArraySubscriptNotInRange(index); + QString message = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, message, _FILEINFO_); } @@ -597,7 +597,7 @@ namespace Isis { */ double Histogram::BinMiddle(const int index) const { if ((index < 0) || (index >= (int)p_bins.size())) { - string message = Message::ArraySubscriptNotInRange(index); + QString message = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, message, _FILEINFO_); } diff --git a/isis/src/base/objs/History/History.cpp b/isis/src/base/objs/History/History.cpp index 529a9a1580..d92883714b 100644 --- a/isis/src/base/objs/History/History.cpp +++ b/isis/src/base/objs/History/History.cpp @@ -37,7 +37,7 @@ namespace Isis { * Constructor for reading a history blob * @param name */ - History::History(const std::string &name) : Isis::Blob(name, "History") { + History::History(const QString &name) : Isis::Blob(name, "History") { p_history.SetTerminator(""); } @@ -46,7 +46,7 @@ namespace Isis { * @param name * @param file */ - History::History(const std::string &name, const std::string &file) : + History::History(const QString &name, const QString &file) : Isis::Blob(name, "History") { Blob::Read(file); } diff --git a/isis/src/base/objs/History/History.h b/isis/src/base/objs/History/History.h index 40e1694ccd..c97c1b076f 100644 --- a/isis/src/base/objs/History/History.h +++ b/isis/src/base/objs/History/History.h @@ -50,8 +50,8 @@ namespace Isis { */ class History : public Isis::Blob { public: - History(const std::string &name); - History(const std::string &name, const std::string &file); + History(const QString &name); + History(const QString &name, const QString &file); ~History(); void AddEntry(); diff --git a/isis/src/base/objs/History/unitTest.cpp b/isis/src/base/objs/History/unitTest.cpp index 5a75563b58..3714c79421 100644 --- a/isis/src/base/objs/History/unitTest.cpp +++ b/isis/src/base/objs/History/unitTest.cpp @@ -13,12 +13,12 @@ void IsisMain() { Isis::History h("Haha");; h.AddEntry(); - std::string file = "unitTest.tttt"; + QString file = "unitTest.tttt"; h.Write(file); Isis::History h2("Haha", file); Isis::PvlObject o = h2.ReturnHist(); std::cout << o << std::endl; - remove(file.c_str()); + remove(file.toAscii().data()); } diff --git a/isis/src/base/objs/ID/ID.cpp b/isis/src/base/objs/ID/ID.cpp index 928c999ea1..48b583bdce 100644 --- a/isis/src/base/objs/ID/ID.cpp +++ b/isis/src/base/objs/ID/ID.cpp @@ -30,24 +30,24 @@ namespace Isis { * @param basenum The number to start the count at. Defaults to * one. */ - ID::ID(const std::string &name, int basenum) { + ID::ID(const QString &name, int basenum) { p_current = basenum; p_namebase = name; - if(p_namebase.find("?", 0) == std::string::npos) { - std::string msg = "No replacement set in string [" + p_namebase + "]"; + if(!p_namebase.contains("?")) { + QString msg = "No replacement set in string [" + p_namebase + "]"; throw IException(IException::User, msg, _FILEINFO_); } - p_numStart = ((int) p_namebase.find("?", 0)); - int endPos = (int)p_namebase.find_last_of("?", p_namebase.size()); + p_numStart = ((int) p_namebase.indexOf("?", 0)); + int endPos = (int)p_namebase.lastIndexOf("?"); p_numLength = (endPos - p_numStart) + 1; - std::string sub = p_namebase.substr(p_numStart, p_numLength); + QString sub = p_namebase.mid(p_numStart, p_numLength); for(int i = 0; i < (int)sub.length(); i++) { if(sub[i] != '?') { - std::string msg = "IString [" + p_namebase + "] contains more than one replacement set"; + QString msg = "IString [" + p_namebase + "] contains more than one replacement set"; throw IException(IException::User, msg, _FILEINFO_); } } - p_namebase.erase(p_numStart, p_numLength); + p_namebase.remove(p_numStart, p_numLength); } /** @@ -59,25 +59,25 @@ namespace Isis { /** * Returns the next ID in the sequence. * - * @return std::string The next ID in the sequence + * @return QString The next ID in the sequence */ - std::string ID::Next() { + QString ID::Next() { IString num(p_current); if((int)num.size() > p_numLength) { - std::string replacement = "?"; + QString replacement = "?"; while((int)replacement.size() < p_numLength) { replacement += "?"; } - std::string original = p_namebase; + QString original = p_namebase; original.insert(p_numStart, replacement); - std::string msg = "Maximum number reached for string [" + original + "]"; + QString msg = "Maximum number reached for string [" + original + "]"; throw IException(IException::User, msg, _FILEINFO_); } while((int)num.size() < p_numLength) { num = "0" + num; } p_current++; - std::string temp = p_namebase; + QString temp = p_namebase; return temp.insert((p_numStart), num.c_str()); } diff --git a/isis/src/base/objs/ID/ID.h b/isis/src/base/objs/ID/ID.h index 00f555959d..a08d17d7f9 100644 --- a/isis/src/base/objs/ID/ID.h +++ b/isis/src/base/objs/ID/ID.h @@ -1,4 +1,4 @@ -#if !defined(ID_h) +#ifndef ID_h #define ID_h /** @@ -23,7 +23,7 @@ * http://www.usgs.gov/privacy.html. */ -#include +#include namespace Isis { /** @@ -43,14 +43,14 @@ namespace Isis { */ class ID { public: - ID(const std::string &name, int basenum = 1); + ID(const QString &name, int basenum = 1); ~ID(); - std::string Next(); + QString Next(); private: - std::string p_namebase; + QString p_namebase; int p_current; int p_numLength; int p_numStart; diff --git a/isis/src/base/objs/ID/unitTest.cpp b/isis/src/base/objs/ID/unitTest.cpp index ec6a52af22..e82af29267 100644 --- a/isis/src/base/objs/ID/unitTest.cpp +++ b/isis/src/base/objs/ID/unitTest.cpp @@ -1,54 +1,61 @@ #include + +#include + #include "IException.h" +#include "IString.h" #include "ID.h" #include "Preference.h" +using namespace Isis; +using namespace std; + int main() { - Isis::Preference::Preferences(true); - std::cout << "Test One: core test and limit test" << std::endl; + Preference::Preferences(true); + cout << "Test One: core test and limit test" << endl; try { - Isis::ID pid("ABCD??EFG"); + ID pid("ABCD??EFG"); for(int i = 0; i < 100; i++) { - std::string test = pid.Next(); + QString test = pid.Next(); if(i % 10 == 0) { - std::cout << test << std::endl; + cout << test << endl; } } } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } - std::cout << std::endl << "Test 2: No '?' test" << std::endl; + cout << endl << "Test 2: No '?' test" << endl; try { - Isis::ID pid2("Serial"); + ID pid2("Serial"); for(int i = 0; i < 5; i++) { - std::cout << pid2.Next() << std::endl; + cout << pid2.Next() << endl; } } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } - std::cout << std::endl << "Test 3: Broken replacement string" << std::endl; + cout << endl << "Test 3: Broken replacement string" << endl; try { - Isis::ID pid3("Serial??Number??"); + ID pid3("Serial??Number??"); for(int i = 0; i < 5; i++) { - std::cout << pid3.Next() << std::endl; + cout << pid3.Next() << endl; } } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } - std::cout << std::endl << "Test 4: differing start numbers" << std::endl; + cout << endl << "Test 4: differing start numbers" << endl; try { - Isis::ID pid4("Test??", 0); + ID pid4("Test??", 0); for(int i = 0; i < 5; i++) { - std::cout << pid4.Next() << std::endl; + cout << pid4.Next() << endl; } } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } return 0; diff --git a/isis/src/base/objs/IException/IException.cpp b/isis/src/base/objs/IException/IException.cpp index 2951463f81..e7a16c815a 100644 --- a/isis/src/base/objs/IException/IException.cpp +++ b/isis/src/base/objs/IException/IException.cpp @@ -30,11 +30,11 @@ #include #include #include +#include #include #include "Application.h" -#include "IString.h" #include "Preference.h" #include "Pvl.h" @@ -65,6 +65,44 @@ namespace Isis { } + /** + * This version of the constructor creates an IException instance with the + * given error type, message, and file info. The IException instance will not + * have any previous exceptions associated with it initially (i.e. no + * exception caused this one to be thrown). + * + * @code + * throw IException(IException::Unknown, + * tr("While doing an important process, we could not do ... " + * "because the data [%1] is invalid").arg(...), + * _FILEINFO_); + * @endcode + * + * @param type the source of the error that this exception represents + * @param message the string message containing details about the error, which + * may be displayed to the user + * @param fileName the filename of the file that this exception was thrown in + * @param lineNumber the line in the source code file that threw this + * exception + */ + IException::IException(ErrorType type, const QString &message, + const char *fileName, int lineNumber) { + m_what = NULL; + m_message = NULL; + m_fileName = NULL; + m_previousExceptions = NULL; + + m_errorType = type; + m_message = new QString(QString(message).trimmed()); + m_fileName = new QString(fileName); + m_lineNumber = lineNumber; + + deleteEmptyMemberStrings(); + + m_what = buildWhat(); + } + + /** * This version of the constructor creates an IException instance with the * given error type, message, and file info. The IException instance will not @@ -93,8 +131,8 @@ namespace Isis { m_previousExceptions = NULL; m_errorType = type; - m_message = new IString(IString(message).Trim(" \n\t")); - m_fileName = new IString(fileName); + m_message = new QString(QString(message).trimmed()); + m_fileName = new QString(fileName); m_lineNumber = lineNumber; deleteEmptyMemberStrings(); @@ -107,10 +145,11 @@ namespace Isis { * This version of the constructor creates an IException instance with the * given error type, message, and file info. The IException instance will not * have any previous exceptions associated with it initially (i.e. no - * exception caused this one to be thrown). + * exception caused this one to be thrown). The QString version of + * this constructor is preferred over this one. * * @code - * IString message = "While doing an important process, we could not do .. " + * std::string message = "While doing an important process, we could not do .. " * "because the data [" ... "] is invalid"; * throw IException(IException::Unknown, message, _FILEINFO_); * @endcode @@ -122,7 +161,7 @@ namespace Isis { * @param lineNumber the line in the source code file that threw this * exception */ - IException::IException(ErrorType type, const IString &message, + IException::IException(ErrorType type, const std::string &message, const char *fileName, int lineNumber) { m_what = NULL; m_message = NULL; @@ -130,8 +169,8 @@ namespace Isis { m_previousExceptions = NULL; m_errorType = type; - m_message = new IString(IString(message).Trim(" \n\t")); - m_fileName = new IString(fileName); + m_message = new QString(QString(message.c_str()).trimmed()); + m_fileName = new QString(fileName); m_lineNumber = lineNumber; deleteEmptyMemberStrings(); @@ -179,8 +218,56 @@ namespace Isis { m_previousExceptions = NULL; m_errorType = type; - m_message = new IString(IString(message).Trim(" \n\t")); - m_fileName = new IString(fileName); + m_message = new QString(QString(message).trimmed()); + m_fileName = new QString(fileName); + m_lineNumber = lineNumber; + + deleteEmptyMemberStrings(); + + append(caughtException); + } + + + /** + * This version of the constructor creates an IException instance with the + * given error type, message, file info. The IException instance will append + * the given exception to its list of previous exceptions (as well as any + * previous exceptions associated with the caught exception). Use this + * constructor when you want to rethrow a new exception after catching an + * exception and preserve the previous message(s). The QString version of + * this constructor is preferred over this one. + * + * @code + * try { + * ... + * } + * catch (IException &e) { + * string message = "While doing an important process, we could not do " + * "... "; + * throw IException(e, IException::Unknown, message, _FILEINFO_); + * } + * @endcode + * + * @param caughtException the previous exception that caused this exception to + * be thrown + * @param type the source of the error that this exception represents + * @param message the string message containing details about the error, which + * may be displayed to the user + * @param fileName the filename of the file that this exception was thrown in + * @param lineNumber the line in the source code file that threw this + * exception + */ + IException::IException(const IException &caughtException, + ErrorType type, const std::string &message, + const char *fileName, int lineNumber) { + m_what = NULL; + m_message = NULL; + m_fileName = NULL; + m_previousExceptions = NULL; + + m_errorType = type; + m_message = new QString(QString(message.c_str()).trimmed()); + m_fileName = new QString(fileName); m_lineNumber = lineNumber; deleteEmptyMemberStrings(); @@ -202,7 +289,7 @@ namespace Isis { * ... * } * catch (IException &e) { - * IString message = "While doing an important process, we could not do " + * QString message = "While doing an important process, we could not do " * "... "; * throw IException(e, IException::Unknown, message, _FILEINFO_); * } @@ -218,7 +305,7 @@ namespace Isis { * exception */ IException::IException(const IException &caughtException, - ErrorType type, const IString &message, + ErrorType type, const QString &message, const char *fileName, int lineNumber) { m_what = NULL; m_message = NULL; @@ -226,8 +313,8 @@ namespace Isis { m_previousExceptions = NULL; m_errorType = type; - m_message = new IString(IString(message).Trim(" \n\t")); - m_fileName = new IString(fileName); + m_message = new QString(message.trimmed()); + m_fileName = new QString(fileName); m_lineNumber = lineNumber; deleteEmptyMemberStrings(); @@ -258,11 +345,11 @@ namespace Isis { } if (other.m_message) { - m_message = new IString(*other.m_message); + m_message = new QString(*other.m_message); } if (other.m_fileName) { - m_fileName = new IString(*other.m_fileName); + m_fileName = new QString(*other.m_fileName); } if (other.m_previousExceptions) { @@ -372,9 +459,9 @@ namespace Isis { * exceptions thrown by your class. */ void IException::print() const { - IString errorString = toString(); + QString errorString = toString(); if (errorString != "") - cerr << errorString << endl; + cerr << errorString.toAscii().data() << endl; } @@ -388,9 +475,9 @@ namespace Isis { * user's preferences file regarding file info. */ void IException::print(bool printFileInfo) const { - IString errorString = toString(printFileInfo); + QString errorString = toString(printFileInfo); if (errorString != "") - cerr << errorString << endl; + cerr << errorString.toAscii().data() << endl; } @@ -427,14 +514,14 @@ namespace Isis { exceptionIsBlank = false; } - errGroup += PvlKeyword("Code", (int)exception.m_errorType); + errGroup += PvlKeyword("Code", Isis::toString(exception.m_errorType)); if (exception.m_message) { exceptionIsBlank = false; - IString message(*exception.m_message); + QString message(*exception.m_message); if (message.size() && message[message.size() - 1] == '.') - message = message.substr(0, message.size() - 1); + message = message.mid(0, message.size() - 1); errGroup += PvlKeyword("Message", message); } @@ -443,7 +530,7 @@ namespace Isis { errGroup += PvlKeyword("File", *exception.m_fileName); if (exception.m_lineNumber != -1) - errGroup += PvlKeyword("Line", exception.m_lineNumber); + errGroup += PvlKeyword("Line", Isis::toString(exception.m_lineNumber)); } if (!exceptionIsBlank) @@ -463,15 +550,15 @@ namespace Isis { * * @return a string representation of this exception */ - IString IException::toString() const { + QString IException::toString() const { bool reportFileLine = true; if (Preference::Preferences().HasGroup("ErrorFacility")) { PvlGroup &errorFacility = Preference::Preferences().FindGroup("ErrorFacility"); if (errorFacility.HasKeyword("FileLine")) { - IString fileLine = errorFacility["FileLine"][0]; - reportFileLine = (fileLine.UpCase() == "ON"); + QString fileLine = errorFacility["FileLine"][0]; + reportFileLine = (fileLine.toUpper() == "ON"); } } @@ -490,8 +577,8 @@ namespace Isis { * the user's preferences file regarding file info. * @return a string representation of this exception */ - IString IException::toString(bool includeFileInfo) const { - IString result; + QString IException::toString(bool includeFileInfo) const { + QString result; bool usePvlFormat = false; @@ -499,8 +586,8 @@ namespace Isis { PvlGroup &errorFacility = Preference::Preferences().FindGroup("ErrorFacility"); if (errorFacility.HasKeyword("Format")) { - IString format = errorFacility["Format"][0]; - usePvlFormat = (format.UpCase() == "PVL"); + QString format = errorFacility["Format"][0]; + usePvlFormat = (format.toUpper() == "PVL"); } } @@ -510,7 +597,7 @@ namespace Isis { if (errors.Groups() != 0) { stringstream stringStream; stringStream << errors; - result = stringStream.str(); + result = stringStream.str().c_str(); } } else { @@ -533,10 +620,10 @@ namespace Isis { bool needsPeriod = false; if (exception.m_message) { - IString message(*exception.m_message); + QString message(*exception.m_message); if (message.size() && message[message.size() - 1] == '.') - message = message.substr(0, message.size() - 1); + message = message.mid(0, message.size() - 1); // There is always a **TYPE** already in the string, so prefix the // message with a space. result += " " + message; @@ -546,7 +633,7 @@ namespace Isis { if(includeFileInfo && exception.m_fileName) { result += " in " + *exception.m_fileName; if (exception.m_lineNumber != -1) - result += " at " + IString(exception.m_lineNumber); + result += " at " + Isis::toString(exception.m_lineNumber); needsPeriod = true; } @@ -558,7 +645,7 @@ namespace Isis { } } - return result.Trim(" \n\t"); + return result.trimmed(); } @@ -602,10 +689,10 @@ namespace Isis { IException IException::createStackTrace() { vector theStack; StackTrace::GetStackTrace(&theStack); - IString message; + QString message; for(unsigned int i = 1; i < theStack.size(); i++) { - message += theStack[i] + "\n"; + message += (theStack[i] + "\n").c_str(); } IException result; @@ -624,8 +711,8 @@ namespace Isis { * @return a string representation of the error type. For example, * "USER ERROR" if the error type is User */ - IString IException::errorTypeToString(ErrorType type) { - IString result; + QString IException::errorTypeToString(ErrorType type) { + QString result; switch(type) { case User: @@ -654,7 +741,7 @@ namespace Isis { * if the string reads "USER ERROR", will return type User. */ IException::ErrorType IException::stringToErrorType( - const IString &string) { + const QString &string) { ErrorType result = Unknown; if(string == "USER ERROR") @@ -677,10 +764,10 @@ namespace Isis { * @return a C string representation of this exception */ char *IException::buildWhat() const { - IString whatStr = toString(); + QString whatStr = toString(); char *result = new char[whatStr.size() + 1]; - strncpy(result, whatStr.c_str(), whatStr.size()); + strncpy(result, whatStr.toAscii().data(), whatStr.size()); result[whatStr.size()] = '\0'; return result; diff --git a/isis/src/base/objs/IException/IException.h b/isis/src/base/objs/IException/IException.h index d5b1154b57..a5c4672dac 100644 --- a/isis/src/base/objs/IException/IException.h +++ b/isis/src/base/objs/IException/IException.h @@ -25,9 +25,12 @@ */ #include +#include template class QList; +class QString; + /** * Macro for the filename and line number. This is typically used for the last * arguments to constructing an IException. @@ -35,7 +38,6 @@ template class QList; #define _FILEINFO_ __FILE__,__LINE__ namespace Isis { - class IString; class Pvl; /** @@ -166,7 +168,10 @@ namespace Isis { IException(ErrorType type, const char *message, const char *fileName, int lineNumber); - IException(ErrorType type, const IString &message, + IException(ErrorType type, const std::string &message, + const char *fileName, int lineNumber); + + IException(ErrorType type, const QString &message, const char *fileName, int lineNumber); IException(const IException &caughtException, @@ -174,7 +179,11 @@ namespace Isis { const char *fileName, int lineNumber); IException(const IException &caughtException, - ErrorType newExceptionType, const IString &message, + ErrorType newExceptionType, const std::string &message, + const char *fileName, int lineNumber); + + IException(const IException &caughtException, + ErrorType newExceptionType, const QString &message, const char *fileName, int lineNumber); IException(const IException &other); @@ -189,16 +198,16 @@ namespace Isis { void print() const; void print(bool printFileInfo) const; Pvl toPvl() const; - IString toString() const; - IString toString(bool printFileInfo) const; + QString toString() const; + QString toString(bool printFileInfo) const; void swap(IException &other); IException &operator=(const IException &rhs); private: static IException createStackTrace(); - static IString errorTypeToString(ErrorType t); - static ErrorType stringToErrorType(const IString &s); + static QString errorTypeToString(ErrorType t); + static ErrorType stringToErrorType(const QString &s); char *buildWhat() const; void deleteEmptyMemberStrings(); @@ -221,12 +230,12 @@ namespace Isis { * The message associated with this exception. This will be NULL if the * message is empty (or only contained whitespace). */ - IString * m_message; + QString * m_message; /** * The source code file that threw this exception. */ - IString * m_fileName; + QString * m_fileName; /** * The line in the source code file that threw this exception. diff --git a/isis/src/base/objs/IException/unitTest.cpp b/isis/src/base/objs/IException/unitTest.cpp index be5cb263a8..88ccfedaeb 100644 --- a/isis/src/base/objs/IException/unitTest.cpp +++ b/isis/src/base/objs/IException/unitTest.cpp @@ -137,7 +137,7 @@ int main(void) { cerr << "Test Preference 'FileLine'\n"; { - IString &fileLineValue = errorPrefs["FileLine"][0]; + QString &fileLineValue = errorPrefs["FileLine"][0]; fileLineValue = "On"; @@ -162,7 +162,7 @@ int main(void) { cerr << "Test Preference 'Format'\n"; { - IString &formatValue = errorPrefs["Format"][0]; + QString &formatValue = errorPrefs["Format"][0]; formatValue = "Standard"; diff --git a/isis/src/base/objs/IString/IString.cpp b/isis/src/base/objs/IString/IString.cpp index 733612d6a8..211697f269 100644 --- a/isis/src/base/objs/IString/IString.cpp +++ b/isis/src/base/objs/IString/IString.cpp @@ -19,30 +19,36 @@ * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ +#include "IString.h" -#include -#include -#include -#include -#include -#include #include +#include +#include #include -#include "IString.h" +#include +#include +#include +#include + +#include + #include "IException.h" #include "SpecialPixel.h" using namespace std; + namespace Isis { /** * Convert from a string to a boolean. Known string values include anything that remotely looks * like a true or false. - * + * + * @param string QString to be converted to a boolean. * @return The boolean equivalent to the string */ bool toBool(const QString &string) { QStringList trues; trues.append("true"); + trues.append("t"); trues.append("yes"); trues.append("y"); trues.append("on"); @@ -50,6 +56,7 @@ namespace Isis { QStringList falses; falses.append("false"); + falses.append("f"); falses.append("no"); falses.append("n"); falses.append("off"); @@ -75,7 +82,7 @@ namespace Isis { if (!foundMatch) { qSort(trues); qSort(falses); - IString message = QObject::tr("Failed to convert string [%1] to a boolean. " + QString message = QObject::tr("Failed to convert string [%1] to a boolean. " "Please specify one of [%2] for true, or one of [%3] for false.") .arg(string).arg(trues.join(", ")).arg(falses.join(", ")); throw IException(IException::Unknown, message, _FILEINFO_); @@ -88,6 +95,7 @@ namespace Isis { /** * Convert from a string to an integer. * + * @param string QString to be converted to an integer. * @return The integer equivalent to the string */ int toInt(const QString &string) { @@ -96,7 +104,7 @@ namespace Isis { int result = string.toInt(&ok); if (!ok) { - IString message = QObject::tr("Failed to convert string [%1] to an integer").arg(string); + QString message = QObject::tr("Failed to convert string [%1] to an integer").arg(string); throw IException(IException::Unknown, message, _FILEINFO_); } @@ -107,6 +115,7 @@ namespace Isis { /** * Convert from a string to a "big" integer. * + * @param string QString to be converted to a big integer. * @return The BigInt equivalent to the string */ BigInt toBigInt(const QString &string) { @@ -124,7 +133,7 @@ namespace Isis { } } catch(...) { - IString message = QObject::tr("Failed to convert string [%1] to a big integer").arg(string); + QString message = QObject::tr("Failed to convert string [%1] to a big integer").arg(string); throw IException(IException::Unknown, message, _FILEINFO_); } @@ -135,16 +144,58 @@ namespace Isis { /** * Convert from a string to a double. * + * @param string QString to be converted to a double. * @return The double equivalent to the string */ double toDouble(const QString &string) { - bool ok = true; + double result = 0.0; + + if (string.startsWith("16#") && string.endsWith("#")) { + try { + stringstream s; + s << string.mid(3, string.size() - 3); + s.seekg(0, ios::beg); - double result = string.toDouble(&ok); + union { + unsigned int intData; + float floatData; + } raw; - if (!ok) { - IString message = QObject::tr("Failed to convert string [%1] to a double").arg(string); - throw IException(IException::Unknown, message, _FILEINFO_); + s >> hex >> raw.intData; + + ios::iostate state = s.rdstate(); + if((state & ios::failbit) || (state & ios::badbit)) { + throw IException(); + } + + result = raw.floatData; + } + catch(...) { + QString message = QObject::tr("Failed to convert HEX string [%1] to a " + "double").arg(string); + throw IException(IException::Unknown, message, _FILEINFO_); + } + } + else { + static QMap knownStrings; + if (knownStrings.isEmpty()) { + // Special case: user called toDouble(toString(DBL_MAX)) + knownStrings["1.79769313486232e+308"] = DBL_MAX; + knownStrings["-1.79769313486232e+308"] = -DBL_MAX; + } + + bool ok = true; + if (!knownStrings.contains(string)) { + result = string.toDouble(&ok); + } + else { + result = knownStrings[string]; + } + + if (!ok) { + QString message = QObject::tr("Failed to convert string [%1] to a double").arg(string); + throw IException(IException::Unknown, message, _FILEINFO_); + } } return result; @@ -153,6 +204,9 @@ namespace Isis { /** * Convert a boolean to a string. The resulting string will be "Yes" (true) or "No" (false). + * + * @param boolToConvert Boolean value to be converted to a QString. + * @return string Converted QString (Yes or No). */ QString toString(bool boolToConvert) { return boolToConvert? "Yes" : "No"; @@ -160,8 +214,12 @@ namespace Isis { /** - * Convert a character to a string. The resulting string will be a string with length 1 which - * contains only the given ASCII character. + * Convert a character to a string. The resulting string will be + * a string with length 1 which contains only the given ASCII + * character. + * + * @param charToConvert Character value to be converted to a QString. + * @return string Converted QString. */ QString toString(char charToConvert) { QString result; @@ -171,18 +229,35 @@ namespace Isis { /** - * Convert an integer to a string. + * Convert an integer to a string. + * + * @param intToConvert Integer value to be converted to a QString. + * @return string Converted QString. + */ + QString toString(const int &intToConvert) { + return QString::number(intToConvert); + } + + + /** + * Convert an unsigned integer to a string. + * + * @param intToConvert Unsigned integer value to be converted to a QString. + * @return string Converted QString. */ - QString toString(const int &num) { - return QString::number(num); + QString toString(const unsigned int &intToConvert) { + return QString::number(intToConvert); } /** - * Convert a big integer to a string. + * Convert a big integer to a string. + * + * @param intToConvert Big integer value to be converted to a QString. + * @return string Converted QString. */ - QString toString(const BigInt &num) { - return QString::number(num); + QString toString(const BigInt &intToConvert) { + return QString::number(intToConvert); } @@ -194,25 +269,29 @@ namespace Isis { * If (log10(num) > 13.0) it is presented in scientific notation * If (log10(num) >= -3 && log10(num) <= 13) it is presented in normal notation * Trailing zeros are removed such that 5.000 is presented as 5.0 + * + * @param doubleToConvert Double value to be converted to a QString. + * @param precision Number of significant figures to convert. + * @return string Converted QString. */ - QString toString(double num, int precision) { + QString toString(double doubleToConvert, int precision) { // If number is zero, then it is not valid to do a log10 on it. To avoid this, // check for zero ahead of time and handle it. QString result; - if(num == 0.0) { + if(doubleToConvert == 0.0) { result = "0.0"; } - else if(isnan(num)) { + else if(isnan(doubleToConvert)) { result = "nan"; } - if(num > DBL_MAX) { - num = DBL_MAX; + if(doubleToConvert > DBL_MAX) { + doubleToConvert = DBL_MAX; } - if(num < -DBL_MAX) { - num = -DBL_MAX; + if(doubleToConvert < -DBL_MAX) { + doubleToConvert = -DBL_MAX; } if (result == "") { @@ -221,7 +300,7 @@ namespace Isis { // have a leading digit of zero. Numbers of the form 0.0ABCDEFG, // 0.00ABCEFEG and so on are not considered to have a leading digit // (pre = 0). - double temp = qAbs(num); + double temp = qAbs(doubleToConvert); int pre = (int)(log10(temp)) + 1; // If preceding number of digits is too large then we will need to create a @@ -244,7 +323,7 @@ namespace Isis { snprintf(buffer, 8, "%de", precision); strcpy(format, "%21."); strcat(format, buffer); - snprintf(doubleString, 23, format, num); + snprintf(doubleString, 23, format, doubleToConvert); char *e = strchr(doubleString, 'e'); char *sptr = e - 1; @@ -292,7 +371,7 @@ namespace Isis { strcat(format, tempStr); strcat(format, "f"); - snprintf(doubleString, 23, format, num); + snprintf(doubleString, 23, format, doubleToConvert); if(post > 0) { char *sptr = doubleString + strlen(doubleString) - 1; diff --git a/isis/src/base/objs/IString/IString.h b/isis/src/base/objs/IString/IString.h index b00fa4d14c..3db43c5fbc 100644 --- a/isis/src/base/objs/IString/IString.h +++ b/isis/src/base/objs/IString/IString.h @@ -24,11 +24,15 @@ #include #include + #include #include + #include "Constants.h" namespace Isis { + class IString; + bool toBool(const QString &); int toInt(const QString &); BigInt toBigInt(const QString &); @@ -37,6 +41,7 @@ namespace Isis { QString toString(bool); QString toString(char); QString toString(const int &); + QString toString(const unsigned int &); QString toString(const BigInt &); QString toString(double, int precision = 14); @@ -122,36 +127,36 @@ namespace Isis { * @history 2010-10-04 Sharmila Prasad - Remove redundant ParseExpression * @history 2011-06-16 Jai Rideout - Fixed size of double string buffer to * work with doubles that are -DBLMAX - * @history 2012-08-20 Steven Lambright - Deprecated. Please use QString instead of IString or + * @history 2012-08-20 Steven Lambright - Deprecated. Please use IString instead of IString or * std::string. This file now provides toBool(), toInt(), toBigInt(), * toDouble(), and toString() which are not deprecated. Renamed from * iString to IString to better match our new naming conventions and * because this class isn't going to be removed overnight. Here are * some equivalents to IString functionality: - * Trim() - Please use QString::trimmed(), QString::simplified() or - * QString::remove(QRegExp("(^[abc]*|[abc]*$)")) - * TrimHead() - Please use QString::trimmed(), QString::simplified() or - * QString::remove(QRegExp("^[abc]*")) - * TrimTail() - Please use QString::trimmed(), QString::simplified() or - * QString::remove(QRegExp("[abc]*$")) - * UpCase() - Please use QString::toUpper() - * DownCase() - Please use QString::toLower() + * Trim() - Please use IString::trimmed(), IString::simplified() or + * IString::remove(QRegExp("(^[abc]*|[abc]*$)")) + * TrimHead() - Please use IString::trimmed(), IString::simplified() or + * IString::remove(QRegExp("^[abc]*")) + * TrimTail() - Please use IString::trimmed(), IString::simplified() or + * IString::remove(QRegExp("[abc]*$")) + * UpCase() - Please use IString::toUpper() + * DownCase() - Please use IString::toLower() * ToQt() - N/A - * Token() - Please use QString::split() or QString::section() - * Split() - Please use QString::split() - * Replace() - Please use QString::replace(). If you need to respect + * Token() - Please use IString::split() or IString::section() + * Split() - Please use IString::split() + * Replace() - Please use IString::replace(). If you need to respect * quotes, please create a standard-compliant static * method - * Convert() - Please use QString::replace() - * ConvertWhiteSpace() - Please use QString::simplified() or - * QString::replace(QRegExp("\\s"), " ") - * Remove() - Please use QString::remove() - * operator QString() - N/A + * Convert() - Please use IString::replace() + * ConvertWhiteSpace() - Please use IString::simplified() or + * IString::replace(QRegExp("\\s"), " ") + * Remove() - Please use IString::remove() + * operator IString() - N/A * Equal() - Please use operator==() - * ToStd() - Please use QString::toStdString() + * ToStd() - Please use IString::toStdString() * ToQt(vector) - This is not a string operation, it's more of a string * list operation. - * ToStd(QStringList) - This is not a string operation, it's more of + * ToStd(IStringList) - This is not a string operation, it's more of * a string list operation. * operator int()/ToInteger() - see the new function toInt() * operator double()/ToDouble() - see the new function toDouble() @@ -161,10 +166,15 @@ namespace Isis { * operator=(const double &) - toString() handles this * SetDouble() - No longer necessary, only one method converts from a * double to a string - * Compress() - Please use QString::trimmed(), QString::simplified() - * or QString::replace(). If you need to respect quotes, + * Compress() - Please use IString::trimmed(), IString::simplified() + * or IString::replace(). If you need to respect quotes, * please create a standard-compliant static method. * @history 2012-10-13 Kris Becker - Fixed compatability issue with Qt on MacOSX + * @history 2012-12-18 Steven Lambright - Isis' API now only utilizes QStrings. Please use the + * toString(...) and to*(QString) (i.e. toBool(QString), toInt(QString), + * ...) methods. All public API's should use/expect QString (not IString, + * not std::string). This affects virtually every class in Isis. + * Fixes #1312. */ class IString : public std::string { public: @@ -266,11 +276,11 @@ namespace Isis { }; /** - * Attempts to convert the stirng to a QStirng (Qt) and return that QString + * Attempts to convert the stirng to a QStirng (Qt) and return that IString * - * @return QString + * @return IString */ - operator QString() const { + operator IString() const { return ToQt(); }; @@ -283,7 +293,7 @@ namespace Isis { * * @param value [in] The double to be converted to a string * - * @return The Isis::IString representation of the double + * @return The IString representation of the double */ IString &operator= (const double &value) { SetDouble(value); diff --git a/isis/src/base/objs/IString/IString.truth b/isis/src/base/objs/IString/IString.truth index da6a001449..f70c5ebc5f 100644 --- a/isis/src/base/objs/IString/IString.truth +++ b/isis/src/base/objs/IString/IString.truth @@ -1,7 +1,7 @@ Testing toBool True: 1 False: 0 - **ERROR** Failed to convert string [...] to a boolean. Please specify one of [1, on, true, y, yes] for true, or one of [0, false, n, no, off] for false. + **ERROR** Failed to convert string [...] to a boolean. Please specify one of [1, on, t, true, y, yes] for true, or one of [0, f, false, n, no, off] for false. Testing toInt 0 @@ -25,8 +25,10 @@ Testing toDouble 0 5.25 -5.25 + -3.4028226550889e+38 1e+100 -1e+100 + 1.7976931348623e+308 **ERROR** Failed to convert string [fred] to a double. Testing toString @@ -34,6 +36,7 @@ Testing toString bool(true): Yes char(A): A int(2147483647): 2147483647 + uint(2147483648): 2147483648 BigInt(2147483648): 2147483648 double(0.0): 0.0 double(DBL_MIN): 2.2250738585072e-308 diff --git a/isis/src/base/objs/IString/unitTest.cpp b/isis/src/base/objs/IString/unitTest.cpp index 89d318ccfd..a24fc43987 100644 --- a/isis/src/base/objs/IString/unitTest.cpp +++ b/isis/src/base/objs/IString/unitTest.cpp @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) { catch (IException &e) { cerr << "\t" << e.toString() << endl; } - + cerr << endl; cerr << "Testing toInt" << endl; cerr << "\t" << toInt("0") << endl; @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) { catch (IException &e) { cerr << "\t" << e.toString() << endl; } - + try { toBigInt("9223372036854775808"); } @@ -81,8 +81,10 @@ int main(int argc, char *argv[]) { cerr << "\t" << toDouble("0.0") << endl; cerr << "\t" << toDouble("5.25") << endl; cerr << "\t" << toDouble("-5.25") << endl; + cerr << "\t" << toDouble("16#FF7FFFFB#") << endl; cerr << "\t" << toDouble("1e100") << endl; cerr << "\t" << toDouble("-1E100") << endl; + cerr << "\t" << toDouble("1.79769313486232e+308") << endl; try { toDouble("fred"); @@ -97,6 +99,7 @@ int main(int argc, char *argv[]) { cerr << "\tbool(true): " << toString(true) << endl; cerr << "\tchar(A): " << toString('A') << endl; cerr << "\tint(2147483647): " << toString(2147483647) << endl; + cerr << "\tuint(2147483648): " << toString((unsigned int)2147483648) << endl; cerr << "\tBigInt(2147483648): " << toString(2147483648) << endl; cerr << "\tdouble(0.0): " << toString(0.0) << endl; cerr << "\tdouble(DBL_MIN): " << toString(DBL_MIN) << endl; diff --git a/isis/src/base/objs/IdealCamera/IdealCamera.cpp b/isis/src/base/objs/IdealCamera/IdealCamera.cpp index 4a5f63880e..346c423fe1 100644 --- a/isis/src/base/objs/IdealCamera/IdealCamera.cpp +++ b/isis/src/base/objs/IdealCamera/IdealCamera.cpp @@ -202,8 +202,8 @@ namespace Isis { } // Create correct camera type - IString type = (string) inst["InstrumentType"]; - if (type.UpCase() == "FRAMING") { + QString type = (QString) inst["InstrumentType"]; + if (type.toUpper() == "FRAMING") { p_framing = true; new CameraDetectorMap(this); CameraFocalPlaneMap *fmap = new CameraFocalPlaneMap(this, 0); @@ -216,7 +216,7 @@ namespace Isis { setTime(et); LoadCache(); } - else if (type.UpCase() == "LINESCAN") { + else if (type.toUpper() == "LINESCAN") { p_framing = false; new LineScanCameraDetectorMap(this, et, exposureDuration); CameraFocalPlaneMap *fmap = new CameraFocalPlaneMap(this, 0); @@ -230,8 +230,8 @@ namespace Isis { NaifStatus::CheckErrors(); } else { - string msg = "Unknown InstrumentType [" + - (string) inst["InstrumentType"] + "]"; + QString msg = "Unknown InstrumentType [" + + (QString) inst["InstrumentType"] + "]"; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/base/objs/ImageExporter/ImageExporter.cpp b/isis/src/base/objs/ImageExporter/ImageExporter.cpp index 3ec822a906..09135165aa 100644 --- a/isis/src/base/objs/ImageExporter/ImageExporter.cpp +++ b/isis/src/base/objs/ImageExporter/ImageExporter.cpp @@ -154,13 +154,13 @@ namespace Isis { * * @param extension The extension for the output image */ - void ImageExporter::setExtension(IString extension) { + void ImageExporter::setExtension(QString extension) { m_extension = extension; // World file extension is the first and last characters of the extension // with an added 'w' at the end int last = extension.length() - 1; - m_world = extension.substr(0, 1) + extension.substr(last) + "w"; + m_world = extension.mid(0, 1) + extension.mid(last) + "w"; } @@ -187,7 +187,7 @@ namespace Isis { break; default: throw IException(IException::Programmer, - "Cannot export an image with [" + IString(desc.channelCount()) + + "Cannot export an image with [" + QString(desc.channelCount()) + "] channels", _FILEINFO_); } @@ -284,10 +284,10 @@ namespace Isis { * * @return A pointer to the instantiated exporter owned by the caller */ - ImageExporter * ImageExporter::fromFormat(IString format) { + ImageExporter * ImageExporter::fromFormat(QString format) { ImageExporter *exporter = NULL; - format.DownCase(); + format = format.toLower(); if (TiffExporter::canWriteFormat(format)) { exporter = new TiffExporter(); } diff --git a/isis/src/base/objs/ImageExporter/ImageExporter.h b/isis/src/base/objs/ImageExporter/ImageExporter.h index 77d64c6af8..f2b1e6d43a 100644 --- a/isis/src/base/objs/ImageExporter/ImageExporter.h +++ b/isis/src/base/objs/ImageExporter/ImageExporter.h @@ -26,7 +26,7 @@ #include -#include "IString.h" +#include using std::vector; @@ -96,13 +96,13 @@ namespace Isis { */ virtual void setRgba(ExportDescription &desc) = 0; - static ImageExporter * fromFormat(IString format); + static ImageExporter * fromFormat(QString format); protected: //! Friendly alias for a method used to write a particular color channel. typedef void (ImageExporter::*WriteChannels)(vector &in) const; - void setExtension(IString extension); + void setExtension(QString extension); Cube * setInput(ExportDescription &desc); ProcessExport & getProcess() const; @@ -143,10 +143,10 @@ namespace Isis { WriteChannels m_writeMethod; //! Extension to append to the output image if not already provided. - IString m_extension; + QString m_extension; //! Extension to append to the output world file. - IString m_world; + QString m_world; //! Number of samples (columns) in the output image. int m_samples; diff --git a/isis/src/base/objs/ImageImporter/ImageImporter.cpp b/isis/src/base/objs/ImageImporter/ImageImporter.cpp index ef61ddcbdc..76221cce28 100644 --- a/isis/src/base/objs/ImageImporter/ImageImporter.cpp +++ b/isis/src/base/objs/ImageImporter/ImageImporter.cpp @@ -400,7 +400,7 @@ namespace Isis { else if (format != "") { importer = new QtImporter(inputName); } - else if (JP2Decoder::IsJP2(inputName.expanded())) { + else if (JP2Decoder::IsJP2(inputName.expanded().toAscii().data())) { importer = new JP2Importer(inputName); } else { diff --git a/isis/src/base/objs/ImageImporter/unitTest.cpp b/isis/src/base/objs/ImageImporter/unitTest.cpp index ce654499c1..2d76414a28 100644 --- a/isis/src/base/objs/ImageImporter/unitTest.cpp +++ b/isis/src/base/objs/ImageImporter/unitTest.cpp @@ -1,5 +1,7 @@ #include +#include + #include "FileName.h" #include "IException.h" #include "ImageImporter.h" @@ -26,7 +28,7 @@ int main(int argc, char *argv[]) { cout << "Clean-up" << endl; delete importer; - remove(outputName.expanded().c_str()); + QFile::remove(outputName.expanded()); cout << endl << "Done" << endl; } diff --git a/isis/src/base/objs/ImageOverlap/ImageOverlap.cpp b/isis/src/base/objs/ImageOverlap/ImageOverlap.cpp index 0a8beff473..71c254cc3f 100644 --- a/isis/src/base/objs/ImageOverlap/ImageOverlap.cpp +++ b/isis/src/base/objs/ImageOverlap/ImageOverlap.cpp @@ -29,7 +29,7 @@ namespace Isis { * @param polygon The polygon that defines the overlap area. * */ - ImageOverlap::ImageOverlap(std::string serialNumber, + ImageOverlap::ImageOverlap(QString serialNumber, geos::geom::MultiPolygon &polygon) { Init(); SetPolygon(polygon); @@ -48,9 +48,8 @@ namespace Isis { std::string fileData; getline(inputStream, fileData); - IString serialNums = fileData; - IString serialNum; - while((serialNum = serialNums.Token(",")) != "") { + QString serialNums = fileData.c_str(); + foreach (QString serialNum, serialNums.split(",")) { Add(serialNum); } @@ -122,7 +121,7 @@ namespace Isis { void ImageOverlap::Write(std::ostream &outputStream) { geos::io::WKBWriter geosWriter; - IString serialNums; + QString serialNums; for(unsigned int sn = 0; sn < p_serialNumbers.size(); sn++) { if(sn != 0) { @@ -145,10 +144,11 @@ namespace Isis { * @param sn The serial number to be added to the list. * */ - void ImageOverlap::Add(std::string &sn) { + void ImageOverlap::Add(QString &sn) { for(unsigned int s = 0; s < p_serialNumbers.size(); ++s) { if(sn == p_serialNumbers[s]) { - std::string msg = "Duplicate SN added to [" + p_polygon->toString() + "]"; + QString msg = "Duplicate SN added to [" + + QString::fromStdString(p_polygon->toString()) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -189,12 +189,12 @@ namespace Isis { * This method will return true if input serial number exists in the * ImageOverlap. * - * @param[in] sn (std::string &) Serial Number to search for + * @param[in] sn (QString &) Serial Number to search for * * @return bool Returns true if the serial number exists in the * ImageOverlap. */ - bool ImageOverlap::HasSerialNumber(std::string &sn) const { + bool ImageOverlap::HasSerialNumber(QString &sn) const { for(int thisSn = 0; thisSn < Size(); ++thisSn) { if(p_serialNumbers[thisSn] == sn) { return true; diff --git a/isis/src/base/objs/ImageOverlap/ImageOverlap.h b/isis/src/base/objs/ImageOverlap/ImageOverlap.h index 0acbaf5000..7915bb7c01 100644 --- a/isis/src/base/objs/ImageOverlap/ImageOverlap.h +++ b/isis/src/base/objs/ImageOverlap/ImageOverlap.h @@ -23,10 +23,11 @@ * http://www.usgs.gov/privacy.html. */ -#include #include -#include "geos/geom/MultiPolygon.h" +#include + +#include namespace Isis { @@ -55,7 +56,7 @@ namespace Isis { class ImageOverlap { public: ImageOverlap(); - ImageOverlap(std::string serialNumber, geos::geom::MultiPolygon &polygon); + ImageOverlap(QString serialNumber, geos::geom::MultiPolygon &polygon); ImageOverlap(std::istream &inputStream); virtual ~ImageOverlap(); @@ -65,7 +66,7 @@ namespace Isis { virtual void SetPolygon(const geos::geom::MultiPolygon *polygon); // Add a serial number - void Add(std::string &sn); + void Add(QString &sn); // Return the number of serial numbers in this overlap area int Size() const { @@ -73,7 +74,7 @@ namespace Isis { }; // Return the ith serial number - std::string operator[](int index) const { + QString operator[](int index) const { return p_serialNumbers[index]; }; @@ -89,12 +90,12 @@ namespace Isis { bool HasAnySameSerialNumber(ImageOverlap &other) const; // Does serial number exist in this ImageOverlap - bool HasSerialNumber(std::string &sn) const; + bool HasSerialNumber(QString &sn) const; void Write(std::ostream &outputStream); private: - std::vector p_serialNumbers; + std::vector p_serialNumbers; geos::geom::MultiPolygon *p_polygon; void Init(); diff --git a/isis/src/base/objs/ImageOverlap/unitTest.cpp b/isis/src/base/objs/ImageOverlap/unitTest.cpp index fd495d4d0d..b6ecafe137 100644 --- a/isis/src/base/objs/ImageOverlap/unitTest.cpp +++ b/isis/src/base/objs/ImageOverlap/unitTest.cpp @@ -1,20 +1,22 @@ #include -#include "Preference.h" +#include +#include +#include +#include +#include + #include "ImageOverlap.h" +#include "IString.h" #include "PolygonTools.h" -#include "geos/geom/CoordinateSequence.h" -#include "geos/geom/CoordinateArraySequence.h" -#include "geos/geom/Polygon.h" -#include "geos/geom/MultiPolygon.h" -#include "geos/util/GEOSException.h" - +#include "Preference.h" +using namespace Isis; using namespace std; int main() { - Isis::Preference::Preferences(true); - void PrintImageOverlap(Isis::ImageOverlap & poi); + Preference::Preferences(true); + void PrintImageOverlap(ImageOverlap & poi); { cout << "One ----------------------------------------------" << endl; @@ -33,22 +35,22 @@ int main() { // Create a multi polygon vector polys; - polys.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts), NULL)); - geos::geom::MultiPolygon *mPolygon = Isis::globalFactory.createMultiPolygon(polys); + polys.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts), NULL)); + geos::geom::MultiPolygon *mPolygon = globalFactory.createMultiPolygon(polys); // Add more coordinates so we can make sure we did a deep copy when we // created the multipolygon pts->add(geos::geom::Coordinate(-1, -1)); pts->add(geos::geom::Coordinate(-2, -2)); - Isis::ImageOverlap a("idOne", *mPolygon); + ImageOverlap a("idOne", *mPolygon); PrintImageOverlap(a); // Add some serial numbers and print it again cout << "Two ----------------------------------------------" << endl; - std::string st = "sn2"; + QString st = "sn2"; a.Add(st); st = "sn3"; a.Add(st); @@ -68,9 +70,9 @@ int main() { try { vector polys3; - polys3.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts3), NULL)); - geos::geom::MultiPolygon *mPolygon3 = Isis::globalFactory.createMultiPolygon(polys3); + polys3.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts3), NULL)); + geos::geom::MultiPolygon *mPolygon3 = globalFactory.createMultiPolygon(polys3); a.SetPolygon(*mPolygon3); delete mPolygon3; } @@ -91,9 +93,9 @@ int main() { try { vector polys4; - polys4.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts4), NULL)); - geos::geom::MultiPolygon *mPolygon4 = Isis::globalFactory.createMultiPolygon(polys4); + polys4.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts4), NULL)); + geos::geom::MultiPolygon *mPolygon4 = globalFactory.createMultiPolygon(polys4); a.SetPolygon(mPolygon4); delete mPolygon4; } @@ -119,12 +121,12 @@ int main() { try { vector polys; - polys.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts), NULL)); + polys.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts), NULL)); - geos::geom::MultiPolygon *mPolygon = Isis::globalFactory.createMultiPolygon(polys); + geos::geom::MultiPolygon *mPolygon = globalFactory.createMultiPolygon(polys); - Isis::ImageOverlap a("idFour", *mPolygon); + ImageOverlap a("idFour", *mPolygon); PrintImageOverlap(a); } catch(geos::util::GEOSException *exc) { @@ -136,7 +138,7 @@ int main() { } // Print a ImageOverlap -void PrintImageOverlap(Isis::ImageOverlap &poi) { +void PrintImageOverlap(ImageOverlap &poi) { // Write the wkt version of the multi polygon to the screen const geos::geom::MultiPolygon *mp = poi.Polygon(); diff --git a/isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.cpp b/isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.cpp index 124c2c71f3..1c731127a0 100644 --- a/isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.cpp +++ b/isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.cpp @@ -72,7 +72,7 @@ namespace Isis { cube.open(sns.FileName(i)); } catch(IException &error) { - std::string msg = "Unable to open cube for serial number ["; + QString msg = "Unable to open cube for serial number ["; msg += sns.SerialNumber(i) + "] filename [" + sns.FileName(i) + "]"; HandleError(error, &sns, msg); @@ -160,10 +160,10 @@ namespace Isis { * @param outputFile The output ImageOverlapSet file * */ - void ImageOverlapSet::FindImageOverlaps(SerialNumberList &boundaries, std::string outputFile) { + void ImageOverlapSet::FindImageOverlaps(SerialNumberList &boundaries, QString outputFile) { // Do a common sense programmer check, this should be empty before we start if(!p_lonLatOverlaps.empty()) { - string msg = "FindImageOverlaps(SerialNumberList&,std::string) may not be called on " \ + string msg = "FindImageOverlaps(SerialNumberList&,QString) may not be called on " \ "an ImageOverlapSet which already contains overlaps."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -202,10 +202,10 @@ namespace Isis { /** This is a strict pthread implementation of this class' multi-threading! * - void ImageOverlapSet::FindImageOverlaps(SerialNumberList &boundaries, std::string outputFile) { + void ImageOverlapSet::FindImageOverlaps(SerialNumberList &boundaries, QString outputFile) { // Do a common sense programmer check, this should be empty before we start if(!p_lonLatOverlaps.empty()) { - string msg = "FindImageOverlaps(SerialNumberList&,std::string) may not be called on an ImageOverlapSet " \ + string msg = "FindImageOverlaps(SerialNumberList&,QString) may not be called on an ImageOverlapSet " \ "which already contains overlaps."; throw iException::Message(iException::Programmer, msg, _FILEINFO_); } @@ -288,7 +288,7 @@ namespace Isis { * * @see automaticRegistration.doc */ - void ImageOverlapSet::FindImageOverlaps(std::vector sns, + void ImageOverlapSet::FindImageOverlaps(std::vector sns, std::vector polygons) { if(sns.size() != polygons.size()) { @@ -313,7 +313,7 @@ namespace Isis { * * @param filename The file to read the image overlaps from */ - void ImageOverlapSet::ReadImageOverlaps(const std::string &filename) { + void ImageOverlapSet::ReadImageOverlaps(const QString &filename) { IString file = FileName(filename).expanded(); try { @@ -418,7 +418,7 @@ namespace Isis { * * @param filename The file to write the image overlaps to */ - void ImageOverlapSet::WriteImageOverlaps(const std::string &filename) { + void ImageOverlapSet::WriteImageOverlaps(const QString &filename) { IString file = FileName(filename).expanded(); bool failed = false; if(p_threadedCalculate) p_calculatePolygonMutex.lock(); @@ -543,7 +543,7 @@ namespace Isis { } catch(IException &e) { intersected = NULL; - string error = "Intersection of overlaps failed."; + QString error = "Intersection of overlaps failed."; // We never want to double seed, so we must delete one or both // of these polygons because they more than likely have an intersection @@ -755,7 +755,7 @@ namespace Isis { */ void ImageOverlapSet::AddSerialNumbers(ImageOverlap *to, ImageOverlap *from) { for(int i = 0; i < from->Size(); i++) { - string s = (*from)[i]; + QString s = (*from)[i]; to->Add(s); } } @@ -769,7 +769,7 @@ namespace Isis { * @param latLonPolygon The object to copy the serial numbers from * */ - ImageOverlap *ImageOverlapSet::CreateNewOverlap(std::string serialNumber, + ImageOverlap *ImageOverlapSet::CreateNewOverlap(QString serialNumber, geos::geom::MultiPolygon *latLonPolygon) { return new ImageOverlap(serialNumber, *latLonPolygon); @@ -788,7 +788,7 @@ namespace Isis { * @return List of related ImageOverlap objects, ownership is retained by * ImageOverlapSet* */ - std::vector ImageOverlapSet::operator[](std::string serialNumber) { + std::vector ImageOverlapSet::operator[](QString serialNumber) { vector matches; // Look at all the ImageOverlaps we have and return the ones that @@ -814,7 +814,7 @@ namespace Isis { * @param overlap1 First problematic overlap * @param overlap2 Second problematic overlap */ - void ImageOverlapSet::HandleError(IException &e, SerialNumberList *snlist, IString msg, int overlap1, int overlap2) { + void ImageOverlapSet::HandleError(IException &e, SerialNumberList *snlist, QString msg, int overlap1, int overlap2) { PvlGroup err("ImageOverlapError"); if(overlap1 >= 0 && overlap1 < p_lonLatOverlaps.size()) { @@ -829,7 +829,7 @@ namespace Isis { filename += snlist->FileName((*p_lonLatOverlaps.at(overlap1))[i]); } } - polygon += p_lonLatOverlaps.at(overlap1)->Polygon()->toString(); + polygon += p_lonLatOverlaps.at(overlap1)->Polygon()->toString().c_str(); err += serialNumbers; @@ -852,7 +852,7 @@ namespace Isis { filename += snlist->FileName((*p_lonLatOverlaps.at(overlap2))[i]); } } - polygon += p_lonLatOverlaps.at(overlap2)->Polygon()->toString(); + polygon += p_lonLatOverlaps.at(overlap2)->Polygon()->toString().c_str(); err += serialNumbers; @@ -865,7 +865,7 @@ namespace Isis { err += PvlKeyword("Error", e.what()); - if(!msg.empty()) { + if(!msg.isEmpty()) { err += PvlKeyword("Description", msg); } @@ -884,7 +884,7 @@ namespace Isis { * @param overlap1 First problematic overlap * @param overlap2 Second problematic overlap */ - void ImageOverlapSet::HandleError(geos::util::GEOSException *exc, SerialNumberList *snlist, IString msg, int overlap1, int overlap2) { + void ImageOverlapSet::HandleError(geos::util::GEOSException *exc, SerialNumberList *snlist, QString msg, int overlap1, int overlap2) { PvlGroup err("ImageOverlapError"); if(overlap1 >= 0 && overlap1 < p_lonLatOverlaps.size()) { @@ -925,9 +925,9 @@ namespace Isis { } } - err += PvlKeyword("Error", IString(exc->what())); + err += PvlKeyword("Error", exc->what()); - if(!msg.empty()) { + if(!msg.isEmpty()) { err += PvlKeyword("Description", msg); } @@ -952,7 +952,7 @@ namespace Isis { * @param overlap1 First problematic overlap * @param overlap2 Second problematic overlap */ - void ImageOverlapSet::HandleError(SerialNumberList *snlist, IString msg, int overlap1, int overlap2) { + void ImageOverlapSet::HandleError(SerialNumberList *snlist, QString msg, int overlap1, int overlap2) { PvlGroup err("ImageOverlapError"); if(overlap1 >= 0 && overlap1 < p_lonLatOverlaps.size()) { diff --git a/isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.h b/isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.h index 40a91fe5bd..7a5047fbbb 100644 --- a/isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.h +++ b/isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.h @@ -95,11 +95,11 @@ namespace Isis { virtual ~ImageOverlapSet(); void FindImageOverlaps(SerialNumberList &boundaries); - void FindImageOverlaps(std::vector sns, + void FindImageOverlaps(std::vector sns, std::vector polygons); - void FindImageOverlaps(SerialNumberList &boundaries, std::string outputFile); - void ReadImageOverlaps(const std::string &filename); - void WriteImageOverlaps(const std::string &filename); + void FindImageOverlaps(SerialNumberList &boundaries, QString outputFile); + void ReadImageOverlaps(const QString &filename); + void WriteImageOverlaps(const QString &filename); /** * Returns the total number of latitude and longitude overlaps @@ -122,7 +122,7 @@ namespace Isis { return p_lonLatOverlaps[index]; }; - std::vector operator[](std::string serialNumber); + std::vector operator[](QString serialNumber); //! Return the a list of errors encountered const std::vector &Errors() { @@ -145,13 +145,13 @@ namespace Isis { QList p_lonLatOverlaps; //!< The list of lat/lon overlaps - ImageOverlap *CreateNewOverlap(std::string serialNumber, + ImageOverlap *CreateNewOverlap(QString serialNumber, geos::geom::MultiPolygon *lonLatPolygon); bool SetPolygon(geos::geom::Geometry *poly, int position, ImageOverlap *sncopy = NULL, bool insert = false); - void HandleError(IException &e, SerialNumberList *snlist, IString msg = "", int overlap1 = -1, int overlap2 = -1); - void HandleError(geos::util::GEOSException *exc, SerialNumberList *snlist, IString msg = "", int overlap1 = -1, int overlap2 = -1); - void HandleError(SerialNumberList *snlist, IString msg, int overlap1 = -1, int overlap2 = -1); + void HandleError(IException &e, SerialNumberList *snlist, QString msg = "", int overlap1 = -1, int overlap2 = -1); + void HandleError(geos::util::GEOSException *exc, SerialNumberList *snlist, QString msg = "", int overlap1 = -1, int overlap2 = -1); + void HandleError(SerialNumberList *snlist, QString msg, int overlap1 = -1, int overlap2 = -1); bool p_continueAfterError; //!< If false iExceptions will be thrown from FindImageOverlaps(...) bool p_threadedCalculate; //!< True if we want to do calculations in a threaded way diff --git a/isis/src/base/objs/ImageOverlapSet/unitTest.cpp b/isis/src/base/objs/ImageOverlapSet/unitTest.cpp index 6db6c85ff5..cbb3dd5270 100644 --- a/isis/src/base/objs/ImageOverlapSet/unitTest.cpp +++ b/isis/src/base/objs/ImageOverlapSet/unitTest.cpp @@ -11,11 +11,12 @@ #include "geos/geom/LinearRing.h" #include "geos/geom/CoordinateArraySequence.h" +using namespace Isis; using namespace std; int main() { - Isis::Preference::Preferences(true); - void PrintImageOverlap(const Isis::ImageOverlap * poi); + Preference::Preferences(true); + void PrintImageOverlap(const ImageOverlap * poi); // Create 6 multi polygons // 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 @@ -62,7 +63,7 @@ int main() { // Fill a vector of MultiPolygon* and serial numbers vector boundaries; - vector sns; + vector sns; // Reusable variables geos::geom::CoordinateSequence *pts; @@ -76,10 +77,10 @@ int main() { pts->add(geos::geom::Coordinate(1, 4)); pts->add(geos::geom::Coordinate(1, 9)); - polys.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts), NULL)); + polys.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts), NULL)); - boundaries.push_back(Isis::globalFactory.createMultiPolygon(polys)); + boundaries.push_back(globalFactory.createMultiPolygon(polys)); for(unsigned int i = 0; i < polys.size(); ++i) delete polys[i]; polys.clear(); @@ -93,9 +94,9 @@ int main() { pts->add(geos::geom::Coordinate(3, 7)); pts->add(geos::geom::Coordinate(3, 10)); - polys.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts), NULL)); - boundaries.push_back(Isis::globalFactory.createMultiPolygon(polys)); + polys.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts), NULL)); + boundaries.push_back(globalFactory.createMultiPolygon(polys)); for(unsigned int i = 0; i < polys.size(); ++i) delete polys[i]; polys.clear(); @@ -109,9 +110,9 @@ int main() { pts->add(geos::geom::Coordinate(15, 5)); pts->add(geos::geom::Coordinate(11, 5)); - polys.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts), NULL)); - boundaries.push_back(Isis::globalFactory.createMultiPolygon(polys)); + polys.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts), NULL)); + boundaries.push_back(globalFactory.createMultiPolygon(polys)); for(unsigned int i = 0; i < polys.size(); ++i) delete polys[i]; polys.clear(); @@ -125,9 +126,9 @@ int main() { pts->add(geos::geom::Coordinate(5, 8)); pts->add(geos::geom::Coordinate(14, 8)); - polys.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts), NULL)); - boundaries.push_back(Isis::globalFactory.createMultiPolygon(polys)); + polys.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts), NULL)); + boundaries.push_back(globalFactory.createMultiPolygon(polys)); for(unsigned int i = 0; i < polys.size(); ++i) delete polys[i]; polys.clear(); @@ -141,9 +142,9 @@ int main() { pts->add(geos::geom::Coordinate(10, 4)); pts->add(geos::geom::Coordinate(10, 6)); - polys.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts), NULL)); - boundaries.push_back(Isis::globalFactory.createMultiPolygon(polys)); + polys.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts), NULL)); + boundaries.push_back(globalFactory.createMultiPolygon(polys)); for(unsigned int i = 0; i < polys.size(); ++i) delete polys[i]; polys.clear(); @@ -157,17 +158,17 @@ int main() { pts->add(geos::geom::Coordinate(4, 1)); pts->add(geos::geom::Coordinate(1, 1)); - polys.push_back(Isis::globalFactory.createPolygon( - Isis::globalFactory.createLinearRing(pts), NULL)); - boundaries.push_back(Isis::globalFactory.createMultiPolygon(polys)); + polys.push_back(globalFactory.createPolygon( + globalFactory.createLinearRing(pts), NULL)); + boundaries.push_back(globalFactory.createMultiPolygon(polys)); for(unsigned int i = 0; i < polys.size(); ++i) delete polys[i]; polys.clear(); sns.push_back("F"); // Create a ImageOverlapSet object with the multipolys and sns from above - Isis::ImageOverlapSet overlapSet1(true); - Isis::ImageOverlapSet overlapSet2(true); + ImageOverlapSet overlapSet1(true); + ImageOverlapSet overlapSet2(true); overlapSet1.FindImageOverlaps(sns, boundaries); // Test read/write methods @@ -188,7 +189,7 @@ int main() { // Print an ImageOverlap -void PrintImageOverlap(const Isis::ImageOverlap *poi) { +void PrintImageOverlap(const ImageOverlap *poi) { // Write the wkt version of the multi polygon to the screen const geos::geom::MultiPolygon *mp = poi->Polygon(); diff --git a/isis/src/base/objs/ImagePolygon/ImagePolygon.cpp b/isis/src/base/objs/ImagePolygon/ImagePolygon.cpp index 633b261753..dfbd22c296 100644 --- a/isis/src/base/objs/ImagePolygon/ImagePolygon.cpp +++ b/isis/src/base/objs/ImagePolygon/ImagePolygon.cpp @@ -130,7 +130,7 @@ namespace Isis { p_isProjected = true; } catch(IException &projError) { - std::string msg = "Can not create polygon, "; + QString msg = "Can not create polygon, "; msg += "cube [" + cube.getFileName(); msg += "] is not a camera or map projection"; @@ -244,7 +244,7 @@ namespace Isis { } else { e.print(); // This should be a NAIF error - std::string msg = "Cannot find polygon for image " + QString msg = "Cannot find polygon for image " "[" + cube.getFileName() + "]: "; msg += increasePrecision ? "Cannot increase precision any further" : "The increment/step size might be too large"; @@ -1325,7 +1325,7 @@ namespace Isis { streampos sbyte = p_startByte - 1; is.seekg(sbyte, std::ios::beg); if (!is.good()) { - string msg = "Error preparing to read data from " + p_type + + QString msg = "Error preparing to read data from " + p_type + " [" + p_blobName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1340,7 +1340,7 @@ namespace Isis { delete [] buf; if (!is.good()) { - string msg = "Error reading data from " + p_type + " [" + + QString msg = "Error reading data from " + p_type + " [" + p_blobName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/ImagePolygon/unitTest.cpp b/isis/src/base/objs/ImagePolygon/unitTest.cpp index 249bd4d57e..2533511188 100644 --- a/isis/src/base/objs/ImagePolygon/unitTest.cpp +++ b/isis/src/base/objs/ImagePolygon/unitTest.cpp @@ -26,7 +26,7 @@ int main() { */ // simple MOC image - string inFile = "$mgs/testData/ab102401.cub"; + QString inFile = "$mgs/testData/ab102401.cub"; // Open the cube Cube cube; @@ -38,14 +38,14 @@ int main() { poly.Create(cube); } catch(IException &e) { - std::string msg = "Cannot create polygon for [" + cube.getFileName() + "]"; + QString msg = "Cannot create polygon for [" + cube.getFileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } // write poly as WKT - ProgramLauncher::RunSystemCommand("echo \"" + poly.Polys()->toString() - + "\" | sed " + ProgramLauncher::RunSystemCommand("echo \"" + QString(poly.Polys()->toString().c_str()) + + "\" | sed " "'s/\\([0-9][0-9]*\\.[0-9][0-9][0-9][0-9][0-9]\\)\\([0-9]*\\)/\\1/g'" ); @@ -54,13 +54,13 @@ int main() { poly.Create(cube, 12, 1, 384, 640, 385); } catch(IException &e) { - std::string msg = "Cannot create sub-polygon for [" + cube.getFileName() + "]"; + QString msg = "Cannot create sub-polygon for [" + cube.getFileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } // write poly as WKT - ProgramLauncher::RunSystemCommand("echo \"" + poly.Polys()->toString() - + "\" | sed " + ProgramLauncher::RunSystemCommand("echo \"" + QString(poly.Polys()->toString().c_str()) + + "\" | sed " "'s/\\([0-9][0-9]*\\.[0-9][0-9][0-9][0-9][0-9][0-9]\\)\\([0-9]*\\)/\\1/g'" ); @@ -70,13 +70,13 @@ int main() { poly.Create(cube, 10, 12, 1, 384, 640, 385); } catch(IException &e) { - std::string msg = "Cannot create lower quality polygon for [" + + QString msg = "Cannot create lower quality polygon for [" + cube.getFileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } // write poly as WKT - ProgramLauncher::RunSystemCommand("echo \"" + poly.Polys()->toString() - + "\" | sed " + ProgramLauncher::RunSystemCommand("echo \"" + QString(poly.Polys()->toString().c_str()) + + "\" | sed " "'s/\\([0-9][0-9]*\\.[0-9][0-9][0-9][0-9][0-9][0-9]\\)\\([0-9]*\\)/\\1/g'" ); diff --git a/isis/src/base/objs/ImportPdsTable/ImportPdsTable.cpp b/isis/src/base/objs/ImportPdsTable/ImportPdsTable.cpp index 06abffcb43..f7b9e249ff 100644 --- a/isis/src/base/objs/ImportPdsTable/ImportPdsTable.cpp +++ b/isis/src/base/objs/ImportPdsTable/ImportPdsTable.cpp @@ -25,7 +25,9 @@ #include #include #include -#include + +#include +#include #include "EndianSwapper.h" #include "FileName.h" @@ -66,7 +68,7 @@ namespace Isis { * It will extract the description of the columns and read the contents of the * table data file. * - * If no table file is given or an empty string is given for the table file, + * If no table file is given or an empty QString is given for the table file, * the table location will be read from the label file. * * If no table name is given, the default name for the object is TABLE. @@ -77,10 +79,10 @@ namespace Isis { * @param pdsTableFile Name of table data file * @param pdsTableName The name of the table object in the PDS file. */ - ImportPdsTable::ImportPdsTable(const std::string &pdsLabFile, - const std::string &pdsTableFile, - const std::string &pdsTableName) { - m_tableName = QString::fromStdString(pdsTableName); + ImportPdsTable::ImportPdsTable(const QString &pdsLabFile, + const QString &pdsTableFile, + const QString &pdsTableName) { + m_tableName = pdsTableName; load(pdsLabFile, pdsTableFile); } @@ -110,19 +112,19 @@ namespace Isis { * @param pdsTableFile Name of PDS table data file to be imported into Isis * (optional) */ - void ImportPdsTable::load(const std::string &pdsLabFile, - const std::string &pdsTableFile) { + void ImportPdsTable::load(const QString &pdsLabFile, + const QString &pdsTableFile) { init(); - string tempTblFile; + QString tempTblFile; loadLabel(pdsLabFile, tempTblFile); - if (!pdsTableFile.empty()) tempTblFile = pdsTableFile; + if (!pdsTableFile.isEmpty()) tempTblFile = pdsTableFile; // Vet the table filename. Many PDS files record the filename in // uppercase and in practice, the filename is in lowercase. Do this // check here. FileName tableFile(tempTblFile); try { - int tableStartRecord = tableFile.baseName().ToInteger(); + int tableStartRecord = toInt(tableFile.baseName()); tempTblFile = pdsLabFile; m_pdsTableStart = tableStartRecord; } @@ -132,7 +134,7 @@ namespace Isis { if (!tableFile.fileExists()) { // if the table file name doesn't exist, try lowercased version... FileName tableFileLowercase(tableFile.path() + "/" - + IString(tableFile.name()).DownCase()); + + tableFile.name().toLower()); if (!tableFileLowercase.fileExists()) { IString msg = "Unable to import PDS table. Neither of the following " "possible table files were found: [" @@ -148,7 +150,7 @@ namespace Isis { if (m_pdsTableType == "ASCII") { loadTable(tempTblFile); } - m_pdsTableFile = QString::fromStdString(tempTblFile); + m_pdsTableFile = tempTblFile; return; } @@ -158,11 +160,11 @@ namespace Isis { * * This method can be called for ASCII or BINARY PDS tables. * - * @param colName A string containing the column name. + * @param colName A QString containing the column name. * * @return @b bool Indicates whether the table has the given column. */ - bool ImportPdsTable::hasColumn(const std::string &colName) const { + bool ImportPdsTable::hasColumn(const QString &colName) const { return (findColumn(colName) != 0); } @@ -182,9 +184,9 @@ namespace Isis { * @param formatted Specifies to convert the name to Camel-Case if true, * otherwise leave as is in the PDS table. * - * @return std::string Returns the column name as requested + * @return QString Returns the column name as requested */ - std::string ImportPdsTable::getColumnName(const unsigned int &index, + QString ImportPdsTable::getColumnName(const unsigned int &index, const bool &formatted) const { if ((int) index >= columns() - 1) { QString msg = "Unable to import the binary PDS table [" + m_tableName @@ -193,7 +195,7 @@ namespace Isis { + toString(columns() - 1) + "]"; throw IException(IException::Programmer, msg.toStdString(), _FILEINFO_); } - string name = m_coldesc[index].m_name; + QString name = m_coldesc[index].m_name; if (formatted) name = getFormattedName(name); return (name); } @@ -212,13 +214,13 @@ namespace Isis { * @param formatted Specifies to convert the name to Camel-Case if true, * otherwise leave as is in the PDS table. * - * @return std::vector Returns vector of all column names + * @return std::vector Returns vector of all column names */ - std::vector ImportPdsTable::getColumnNames(const bool &formatted) + QStringList ImportPdsTable::getColumnNames(const bool &formatted) const { - vector colnames; + QStringList colnames; for (int i = 0 ; i < columns() ; i++) { - string name = m_coldesc[i].m_name; + QString name = m_coldesc[i].m_name; if (formatted) name = getFormattedName(name); colnames.push_back(name); } @@ -229,7 +231,7 @@ namespace Isis { * @brief Get the type associated with the specified column * * This method returns the datatype associated with the specfied column. If - * the column does not exist, an empty string is returned. + * the column does not exist, an empty QString is returned. * * This method can be called for ASCII or BINARY PDS tables. * @@ -237,12 +239,12 @@ namespace Isis { * * @param colName Name of column to get type for * - * @return std::string Returns the type of the column. If the column does not - * exist, an empty string is returned. + * @return QString Returns the type of the column. If the column does not + * exist, an empty QString is returned. */ - std::string ImportPdsTable::getType(const std::string &colName) const { + QString ImportPdsTable::getType(const QString &colName) const { const ColumnDescr *column = findColumn(colName); - string dtype(""); + QString dtype(""); if (column != 0) { dtype = column->m_dataType; } @@ -265,11 +267,11 @@ namespace Isis { * * @return bool */ - bool ImportPdsTable::setType(const std::string &colName, - const std::string &dataType) { + bool ImportPdsTable::setType(const QString &colName, + const QString &dataType) { ColumnDescr *column = findColumn(colName); if (column != 0) { - column->m_dataType = IString(dataType).UpCase(); + column->m_dataType = dataType.toUpper(); } return (column != 0); } @@ -285,7 +287,7 @@ namespace Isis { * * @return Table Table containing PDS table data */ - Table ImportPdsTable::importTable(const std::string &isisTableName) { + Table ImportPdsTable::importTable(const QString &isisTableName) { try { TableRecord record = makeRecord(m_coldesc); Table table(isisTableName, record); @@ -304,9 +306,9 @@ namespace Isis { /** * @brief Populate ISIS Table with specified column(s) from ASCII table * - * This method extracts columns specified by the caller in a string. It is + * This method extracts columns specified by the caller in a QString. It is * typically used for a single column, but any number of columns can be - * provided. colnames is a comma delimited string that contains the name of + * provided. colnames is a comma delimited QString that contains the name of * the columns that will be exported in the table. * * This method should only be called for ASCII PDS tables. If needed for @@ -317,11 +319,9 @@ namespace Isis { * * @return Table Table containing the specified columns */ - Table ImportPdsTable::importTable(const std::string &colnames, - const std::string &isisTableName) { - std::vector cols; - IString::Split(',', colnames, cols); - return (importTable(cols, isisTableName)); + Table ImportPdsTable::importTable(const QString &colnames, + const QString &isisTableName) { + return (importTable(colnames.split(","), isisTableName)); } /** @@ -338,15 +338,15 @@ namespace Isis { * * @return Table */ - Table ImportPdsTable::importTable(const std::vector &colnames, - const std::string &isisTableName) { + Table ImportPdsTable::importTable(const QStringList &colnames, + const QString &isisTableName) { ColumnTypes ctypes; - for (unsigned int i = 0 ; i < colnames.size() ; i++) { + for (int i = 0 ; i < colnames.size() ; i++) { const ColumnDescr *descr = findColumn(colnames[i]); if (!descr) { QString msg = "Unable to import the PDS table [" + m_tableName + "] into Isis. The requested column name [" - + QString::fromStdString(colnames[i]) + "] does not " + + colnames[i] + "] does not " "exist in table."; throw IException(IException::Programmer, msg.toStdString(), _FILEINFO_); } @@ -390,29 +390,29 @@ namespace Isis { * @param pdsLabFile Name of PDS table label description file * @param pdsTableFile Returns the name of the PDS table data */ - void ImportPdsTable::loadLabel(const std::string &pdsLabFile, - std::string &pdsTableFile) { + void ImportPdsTable::loadLabel(const QString &pdsLabFile, + QString &pdsTableFile) { Isis::Pvl label(pdsLabFile); - if (!label.HasObject(m_tableName.toStdString())) { - QString msg = "The PDS file " + QString::fromStdString(pdsLabFile) + + if (!label.HasObject(m_tableName)) { + QString msg = "The PDS file " + pdsLabFile + " does not have the required TABLE object, [" + m_tableName +"]. The PDS label file is probably invalid"; throw IException(IException::Unknown, msg.toStdString(), _FILEINFO_); } m_recordBytes = (int) label.FindKeyword("RECORD_BYTES"); // Get some pertinent information from the label - PvlObject &tabobj = label.FindObject(m_tableName.toStdString()); + PvlObject &tabobj = label.FindObject(m_tableName); pdsTableFile = FileName(pdsLabFile).path() + "/" - + label["^" + m_tableName.toStdString()][0]; + + label["^" + m_tableName][0]; m_trows = (int) tabobj.FindKeyword("ROWS"); int ncols = (int) tabobj.FindKeyword("COLUMNS"); - m_pdsTableType = QString(QString::fromStdString(tabobj.FindKeyword("INTERCHANGE_FORMAT")));//[0]; + m_pdsTableType = QString(tabobj.FindKeyword("INTERCHANGE_FORMAT")); if (m_pdsTableType != "ASCII" && m_pdsTableType.toUpper() != "BINARY") { QString msg = "Unable to import the PDS table [" + m_tableName + "] from the PDS file [" - + QString::fromStdString(pdsTableFile) + "] into Isis. " + + pdsTableFile + "] into Isis. " "The PDS INTERCHANGE_FORMAT [" + m_pdsTableType + "] is not supported. Valid values are ASCII or BINARY."; throw IException(IException::User, msg.toStdString(), _FILEINFO_); @@ -461,13 +461,13 @@ namespace Isis { * * @param pdsTableFile Name of PDS table data file */ - void ImportPdsTable::loadTable(const std::string &pdsTableFile) { + void ImportPdsTable::loadTable(const QString &pdsTableFile) { // Vet the filename. Many PDS files record the filename in uppercase and // in practice, the filename is in lowercase. Do this check here. - string tempTblFile(pdsTableFile); + QString tempTblFile(pdsTableFile); TextFile tfile(tempTblFile); - string tline; + QString tline; m_rows.clear(); int irow(0); while (tfile.GetLine(tline, false)) { @@ -506,10 +506,10 @@ namespace Isis { cd.m_name = colobj["NAME"][0]; cd.m_colnum = nth; if (m_pdsTableType == "ASCII") { - cd.m_dataType = IString(getGenericType(colobj["DATA_TYPE"][0])).UpCase(); + cd.m_dataType = getGenericType(colobj["DATA_TYPE"][0]).toUpper(); } else { - cd.m_dataType = IString(colobj["DATA_TYPE"][0]).UpCase(); + cd.m_dataType = colobj["DATA_TYPE"][0].toUpper(); //cd.m_numBytes = colobj["ITEM_BYTES"]; } cd.m_startByte = ((int) colobj["START_BYTE"]) - 1; // 0-based indexing @@ -532,12 +532,12 @@ namespace Isis { * returned if found otherwise, NULL is returned. */ ImportPdsTable::ColumnDescr *ImportPdsTable::findColumn( - const std::string &colName) { - string cName = getFormattedName(colName); + const QString &colName) { + QString cName = getFormattedName(colName); ColumnTypes::iterator col = m_coldesc.begin(); while (col != m_coldesc.end()) { - string c = getFormattedName(col->m_name); - if (IString::Equal(c, cName)) { return (&(*col)); } + QString c = getFormattedName(col->m_name); + if (c.toUpper() == cName.toUpper()) { return (&(*col)); } col++; } return (0); @@ -558,12 +558,12 @@ namespace Isis { * returned if found otherwise, NULL is returned. */ const ImportPdsTable::ColumnDescr *ImportPdsTable::findColumn( - const std::string &colName) const { - string cName = getFormattedName(colName); + const QString &colName) const { + QString cName = getFormattedName(colName); ColumnTypes::const_iterator col = m_coldesc.begin(); while (col != m_coldesc.end()) { - string c = getFormattedName(col->m_name); - if (IString::Equal(c, cName)) { return (&(*col)); } + QString c = getFormattedName(col->m_name); + if (c.toUpper() == cName.toUpper()) { return (&(*col)); } col++; } return (0); @@ -571,18 +571,18 @@ namespace Isis { /** - * @brief Extracts a column from a string based upon a description + * @brief Extracts a column from a QString based upon a description * * This method should not be called for BINARY PDS tables. * * @param tline Row from table data * @param cdesc Column description * - * @return std::string Returns the extracted column as a string + * @return QString Returns the extracted column as a QString */ - std::string ImportPdsTable::getColumnValue(const std::string &tline, + QString ImportPdsTable::getColumnValue(const QString &tline, const ColumnDescr &cdesc) const { - return (tline.substr(cdesc.m_startByte, cdesc.m_numBytes)); + return (tline.mid(cdesc.m_startByte, cdesc.m_numBytes)); } /** @@ -594,7 +594,7 @@ namespace Isis { * space. Any left/right parens are removed. Then the conversion to * camel-case is performed. * - * Camel case always converts the first character in a string to uppercase. + * Camel case always converts the first character in a QString to uppercase. * Any space or '_' character are removed and the following character is * converted to uppercase. All other characters are converted to lowercase. * @@ -602,31 +602,28 @@ namespace Isis { * * @param colname Column name to converty * - * @return std::string Returns the formatted keyword + * @return QString Returns the formatted keyword */ - std::string ImportPdsTable::getFormattedName( - const std::string &colname) const { - - IString cname = IString::ConvertWhiteSpace(colname); - cname.Remove("(,)"); - cname.Compress(); + QString ImportPdsTable::getFormattedName( + const QString &colname) const { + QString cname = QString(colname).replace(QRegExp("[(),]"), " ").simplified(); bool uppercase = true; - string ostring; - for (unsigned int i = 0 ; i < cname.size() ; i++) { + QString oString; + for (int i = 0 ; i < cname.size() ; i++) { if (uppercase) { - ostring.push_back(toupper(cname[i])); + oString.push_back(cname[i].toUpper()); uppercase = false; } else if ( (cname[i] == ' ') || (cname[i] == '_') ) { uppercase = true; } else { - ostring.push_back(tolower(cname[i])); + oString.push_back(cname[i].toLower()); } } - return (ostring); + return (oString); } @@ -645,12 +642,10 @@ namespace Isis { * * @param ttype PDS data type to convert * - * @return std::string Generic type found in the data type. + * @return QString Generic type found in the data type. */ - std::string ImportPdsTable::getGenericType(const std::string &ttype) const { - vector parts; - int n = IString::Split('_', ttype, parts); - return (parts[n-1]); + QString ImportPdsTable::getGenericType(const QString &ttype) const { + return ttype.split("_").last(); } @@ -672,8 +667,8 @@ namespace Isis { * @return TableField Returns a TableField for the column type */ TableField ImportPdsTable::makeField(const ColumnDescr &cdesc) { - string dtype = cdesc.m_dataType; - string name = getFormattedName(cdesc.m_name); + QString dtype = cdesc.m_dataType; + QString name = getFormattedName(cdesc.m_name); if (m_pdsTableType == "ASCII") { if ( dtype == "INTEGER" ) { return (TableField(name, TableField::Integer)); @@ -745,13 +740,13 @@ namespace Isis { tfield = data.ToDouble(); } else { // Its a text field - string str(tfield.size(), ' '); - str.insert(0, data.Trim(" \t\r\n")); + QString str(tfield.size(), ' '); + str.insert(0, data.Trim(" \t\r\n").ToQt()); tfield = str; } } catch (IException &e) { - string msg = "Conversion failure of column " + cdesc.m_name; + QString msg = "Conversion failure of column " + cdesc.m_name; throw IException(e, IException::Programmer, msg, _FILEINFO_); } @@ -801,14 +796,14 @@ namespace Isis { table += extract(m_rows[i], cols, record); } catch (IException &e) { - string msg = "Failed to convert data in row [" + IString((int) i) + "]"; + QString msg = "Failed to convert data in row [" + toString((int) i) + "]"; throw IException(e, IException::Programmer, msg, _FILEINFO_); } } } else { - string tempTblFile = m_pdsTableFile.toStdString(); - ifstream pdsFileStream(tempTblFile.c_str(), ifstream::binary); + QString tempTblFile = m_pdsTableFile; + ifstream pdsFileStream(tempTblFile.toAscii().data(), ifstream::binary); if (!pdsFileStream) { IString msg = "Unable to open file containing PDS table [" + tempTblFile + "]."; @@ -875,35 +870,35 @@ namespace Isis { TableRecord ImportPdsTable::extractBinary(char *rowBuffer, TableRecord &record) const { // for each record loop through the columns to get field values for (int colIndex = 0; colIndex < columns(); colIndex++) { - QString columnName = QString::fromStdString(m_coldesc[colIndex].m_name); + QString columnName = m_coldesc[colIndex].m_name; for (int fieldIndex = 0 ; fieldIndex < record.Fields() ; fieldIndex++) { - QString fieldName = QString::fromStdString(record[fieldIndex].name()); + QString fieldName = record[fieldIndex].name(); if (fieldName == columnName) { int startByte = m_coldesc[colIndex].m_startByte; int numBytes = m_coldesc[colIndex].m_numBytes; if (record[fieldIndex].isInteger()) { int columnValue; memmove(&columnValue, &rowBuffer[startByte], numBytes); - EndianSwapper endianSwap(m_byteOrder.toStdString()); + EndianSwapper endianSwap(m_byteOrder); int fieldValue = endianSwap.Int(&columnValue); record[fieldIndex] = fieldValue; } else if (record[fieldIndex].isDouble()) { - EndianSwapper endianSwap(m_byteOrder.toStdString()); + EndianSwapper endianSwap(m_byteOrder); double columnValue; memmove(&columnValue, &rowBuffer[startByte], numBytes); double fieldValue = endianSwap.Double(&columnValue); record[fieldIndex] = fieldValue; } else if (record[fieldIndex].isReal()) { - EndianSwapper endianSwap(m_byteOrder.toStdString()); + EndianSwapper endianSwap(m_byteOrder); float columnValue; memmove(&columnValue, &rowBuffer[startByte], numBytes); float fieldValue = endianSwap.Float(&columnValue); record[fieldIndex] = fieldValue; } else if (record[fieldIndex].isText()) { - string fieldValue(numBytes, '\0'); + QString fieldValue(numBytes, '\0'); for (int byte = 0; byte < numBytes; byte++) { fieldValue[byte] = rowBuffer[startByte + byte]; } @@ -930,16 +925,16 @@ namespace Isis { * no value. */ TableField ImportPdsTable::makeFieldFromBinaryTable(const ColumnDescr &cdesc){ - string dataType = cdesc.m_dataType; + QString dataType = cdesc.m_dataType; // For binary tables, we will not reformat the name of the column - string name = cdesc.m_name; + QString name = cdesc.m_name; if (dataType == "MSB_INTEGER" || dataType == "INTEGER" || dataType == "SUN_INTEGER" || dataType == "MAC_INTEGER") { if (cdesc.m_numBytes != 4) { - IString msg = "Only 4 byte integer values are supported in Isis. " + QString msg = "Only 4 byte integer values are supported in Isis. " "PDS Column [" + cdesc.m_name + "] has an integer DATA_TYPE with [BYTES = " - + IString(cdesc.m_numBytes) + "]."; + + toString(cdesc.m_numBytes) + "]."; throw IException(IException::Unknown, msg, _FILEINFO_); } setPdsByteOrder("MSB"); @@ -948,10 +943,10 @@ namespace Isis { else if (dataType == "LSB_INTEGER" || dataType == "VAX_INTEGER" || dataType == "PC_INTEGER" ) { if (cdesc.m_numBytes != 4) { - IString msg = "Only 4 byte integer values are supported in Isis. " + QString msg = "Only 4 byte integer values are supported in Isis. " "PDS Column [" + cdesc.m_name + "] has an integer DATA_TYPE with [BYTES = " - + IString(cdesc.m_numBytes) + "]."; + + toString(cdesc.m_numBytes) + "]."; throw IException(IException::Unknown, msg, _FILEINFO_); } setPdsByteOrder("LSB"); @@ -973,7 +968,7 @@ namespace Isis { IString msg = "Only 4 byte or 8 byte real values are supported in Isis. " "PDS Column [" + cdesc.m_name + "] has a real DATA_TYPE with [BYTES = " - + IString(cdesc.m_numBytes) + "]."; + + toString(cdesc.m_numBytes) + "]."; throw IException(IException::Unknown, msg, _FILEINFO_); } } @@ -986,15 +981,15 @@ namespace Isis { return TableField(name, TableField::Real); } else { - IString msg = "Only 4 byte or 8 byte real values are supported in Isis. " + QString msg = "Only 4 byte or 8 byte real values are supported in Isis. " "PDS Column [" + cdesc.m_name + "] has a real DATA_TYPE with [BYTES = " - + IString(cdesc.m_numBytes) + "]."; + + toString(cdesc.m_numBytes) + "]."; throw IException(IException::Unknown, msg, _FILEINFO_); } } - else if (dataType.find("CHARACTER") != string::npos - || dataType.find("ASCII") != string::npos + else if (dataType.contains("CHARACTER") + || dataType.contains("ASCII") || dataType == "DATE" || dataType == "TIME" ) { return TableField(name, TableField::Text, cdesc.m_numBytes); } diff --git a/isis/src/base/objs/ImportPdsTable/ImportPdsTable.h b/isis/src/base/objs/ImportPdsTable/ImportPdsTable.h index d3ed71eabc..7aadac8077 100644 --- a/isis/src/base/objs/ImportPdsTable/ImportPdsTable.h +++ b/isis/src/base/objs/ImportPdsTable/ImportPdsTable.h @@ -28,8 +28,9 @@ #include #include +class QString; + namespace Isis { - class IString; class Table; class TableField; class TableRecord; @@ -105,58 +106,58 @@ namespace Isis { class ImportPdsTable { public: ImportPdsTable(); - ImportPdsTable(const std::string &pdsLabFile, - const std::string &pdsTabFile="", - const std::string &pdsTableName="TABLE"); + ImportPdsTable(const QString &pdsLabFile, + const QString &pdsTabFile="", + const QString &pdsTableName="TABLE"); ~ImportPdsTable(); int columns() const; int rows() const; - void load(const std::string &pdsLabFile, const std::string &pdsTabFile = ""); + void load(const QString &pdsLabFile, const QString &pdsTabFile = ""); - bool hasColumn(const std::string &colName) const; - std::string getColumnName(const unsigned int &index = 0, + bool hasColumn(const QString &colName) const; + QString getColumnName(const unsigned int &index = 0, const bool &formatted = true) const; - std::vector getColumnNames(const bool &formatted = true) const; - std::string getFormattedName(const std::string &colname) const; + QStringList getColumnNames(const bool &formatted = true) const; + QString getFormattedName(const QString &colname) const; - std::string getType(const std::string &colName) const; - bool setType(const std::string &colName, const std::string &dataType); + QString getType(const QString &colName) const; + bool setType(const QString &colName, const QString &dataType); - Table importTable(const std::string &isisTableName); - Table importTable(const std::string &colNames, - const std::string &isisTableName); - Table importTable(const std::vector &colNames, - const std::string &isisTableName); + Table importTable(const QString &isisTableName); + Table importTable(const QString &colNames, + const QString &isisTableName); + Table importTable(const QStringList &colNames, + const QString &isisTableName); private: struct ColumnDescr { - std::string m_name; //!< Name of column + QString m_name; //!< Name of column int m_colnum; //!< Column number - std::string m_dataType; //!< PDS table DATA_TYPE of column + QString m_dataType; //!< PDS table DATA_TYPE of column int m_startByte; //!< Starting byte of data int m_numBytes; //!< Number bytes in column int m_itemBytes; //!< }; typedef std::vector ColumnTypes; - typedef std::vector Columns; + typedef std::vector Columns; typedef std::vector Rows; void init(); - void loadLabel(const std::string &labfile, std::string &tblfile); - void loadTable(const std::string &tabfile); + void loadLabel(const QString &labfile, QString &tblfile); + void loadTable(const QString &tabfile); ColumnDescr getColumnDescription(PvlObject &colobj, int nth) const; - ColumnDescr *findColumn(const std::string &colName); - const ColumnDescr *findColumn(const std::string &colName) const; + ColumnDescr *findColumn(const QString &colName); + const ColumnDescr *findColumn(const QString &colName) const; - std::string getColumnValue(const std::string &tline, + QString getColumnValue(const QString &tline, const ColumnDescr &cdesc) const; - std::string getGenericType(const std::string &ttype) const; + QString getGenericType(const QString &ttype) const; TableRecord makeRecord(const ColumnTypes &ctypes); TableField makeField(const ColumnDescr &cdesc); diff --git a/isis/src/base/objs/ImportPdsTable/ImportPdsTable.truth b/isis/src/base/objs/ImportPdsTable/ImportPdsTable.truth index b1abe69f3d2aac36ef7dce6b1cbf2fd333ceeb45..e8f18f36dfbefc52633b44189b1e9a3123f12050 100644 GIT binary patch delta 32 ocmaE?^+0O_FVki|CKr~;!E77YI5|0u^b96%;Fa2}!fww80Hm)7!~g&Q delta 25 hcmaE$^;l~IFVkioCRY|lhRK0!8yFcjGqT6?0RU$52BiQ1 diff --git a/isis/src/base/objs/ImportPdsTable/unitTest.cpp b/isis/src/base/objs/ImportPdsTable/unitTest.cpp index dbfc3e54fa..379ec4645e 100644 --- a/isis/src/base/objs/ImportPdsTable/unitTest.cpp +++ b/isis/src/base/objs/ImportPdsTable/unitTest.cpp @@ -9,27 +9,24 @@ #include "Preference.h" #include "Table.h" -// Convenience list -typedef std::vector StrList; - using namespace std; using namespace Isis; int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); - string inputFile = "data/VIR_IR_1A_1_332974737_1_HK.LBL"; + QString inputFile = "data/VIR_IR_1A_1_332974737_1_HK.LBL"; if (--argc == 1) { inputFile = argv[1]; } cout << "\n\nTesting ImportPdsTable class using file " << inputFile << "\n"; ImportPdsTable myTable(inputFile); cout << "\n\nList of Columns found - Total: " << myTable.columns() << "\n"; - StrList kfiles = myTable.getColumnNames(); - copy(kfiles.begin(), kfiles.end(), ostream_iterator(cout, "\n")); + QStringList kfiles = myTable.getColumnNames(); + cout << kfiles.join("\n"); cout << "\n\nNow without Name Conversion: \n"; kfiles = myTable.getColumnNames(false); - copy(kfiles.begin(), kfiles.end(), ostream_iterator(cout, "\n")); + cout << kfiles.join("\n") << endl; // Update/correct column types myTable.setType("ShutterStatus", "CHARACTER"); @@ -81,9 +78,9 @@ int main(int argc, char *argv[]) { // The following tests were added when the class was expanded to import binary // PDS tables also... - string pdsTableDir = "data/"; - string pdsLabelFile = ""; - string pdsTableFile = ""; + QString pdsTableDir = "data/"; + QString pdsLabelFile = ""; + QString pdsTableFile = ""; cout << "\n\n\nImport PDS table from PDS table exported as MSB...\n"; pdsLabelFile = pdsTableDir + "msb_pds_binary_table.lbl"; @@ -98,10 +95,10 @@ int main(int argc, char *argv[]) { cout << isisTableFromMsb[0][2].name() << "\t"; cout << isisTableFromMsb[0][3].name() << "\n"; for (int i = 0; i < isisTableFromMsb.Records(); i++) { - cout << IString((double) isisTableFromMsb[i][0]) << "\t\t\t"; - cout << IString((int) isisTableFromMsb[i][1]) << "\t\t\t\t"; - cout << IString((string) isisTableFromMsb[i][2]) << "\t\t\t"; - cout << IString((float) isisTableFromMsb[i][3]) << "\n"; + cout << toString((double) isisTableFromMsb[i][0]) << "\t\t\t"; + cout << toString((int) isisTableFromMsb[i][1]) << "\t\t\t\t"; + cout << QString( isisTableFromMsb[i][2]) << "\t\t\t"; + cout << toString((float) isisTableFromMsb[i][3]) << "\n"; } cout << "\n\n\nImport PDS table from PDS table exported as LSB...\n"; @@ -121,10 +118,10 @@ int main(int argc, char *argv[]) { cout << isisTableFromLsb[0][2].name() << "\t"; cout << isisTableFromLsb[0][3].name() << "\n"; for (int i = 0; i < isisTableFromLsb.Records(); i++) { - cout << IString((double) isisTableFromLsb[i][0]) << "\t\t\t"; - cout << IString((int) isisTableFromLsb[i][1]) << "\t\t\t\t"; - cout << IString((string) isisTableFromLsb[i][2]) << "\t\t\t"; - cout << IString((float) isisTableFromLsb[i][3]) << "\n"; + cout << toString((double) isisTableFromLsb[i][0]) << "\t\t\t"; + cout << toString((int) isisTableFromLsb[i][1]) << "\t\t\t\t"; + cout << QString( isisTableFromLsb[i][2]) << "\t\t\t"; + cout << toString((float) isisTableFromLsb[i][3]) << "\n"; } cout << endl; @@ -164,8 +161,8 @@ int main(int argc, char *argv[]) { // 3) importTable(vector colNames, string tableName) - Unable to import the PDS table into Isis. The requested column name does not exist in the table. try { cout << "Throw error for attempt to export non-existant columns: " << endl; - vector columnNames; - columnNames.push_back("Invalid Column Name"); + QStringList columnNames; + columnNames.append("Invalid Column Name"); myTable.importTable(columnNames, "VIR_DATA"); } catch (IException &e) { @@ -326,8 +323,8 @@ int main(int argc, char *argv[]) { cout << "rows = " << pdsLsbTable.rows() << endl; cout << "has double = " << pdsLsbTable.hasColumn("Double Value") << endl; cout << "col 1 name = " << pdsLsbTable.getColumnName(1) << endl; - vector names = pdsLsbTable.getColumnNames(); - for (unsigned int i = 0; i < names.size(); i++) { + QStringList names = pdsLsbTable.getColumnNames(); + for (int i = 0; i < names.size(); i++) { cout << names[i] << endl; } cout << "type Double Value column = " << pdsLsbTable.getType("Double Value") << endl; diff --git a/isis/src/base/objs/InfixToPostfix/InfixToPostfix.cpp b/isis/src/base/objs/InfixToPostfix/InfixToPostfix.cpp index fb8f1f021f..61afee60e4 100644 --- a/isis/src/base/objs/InfixToPostfix/InfixToPostfix.cpp +++ b/isis/src/base/objs/InfixToPostfix/InfixToPostfix.cpp @@ -21,9 +21,12 @@ */ #include "InfixToPostfix.h" -#include "IException.h" + #include +#include "IException.h" +#include "IString.h" + using namespace std; namespace Isis { @@ -118,10 +121,11 @@ namespace Isis { * * @return IString A space-delimited string with data between every pair of spaces */ - IString InfixToPostfix::cleanSpaces(IString equation) { + QString InfixToPostfix::cleanSpaces(QString equation) { + IString equationIStr = equation; IString clean = ""; - while(!equation.empty()) { - IString data = equation.Token(" "); + while(!equationIStr.empty()) { + IString data = equationIStr.Token(" "); if(data.empty()) { continue; } @@ -134,7 +138,7 @@ namespace Isis { } } - return clean; + return clean.ToQt(); } /** @@ -147,7 +151,7 @@ namespace Isis { * * @return IString The postfix equation */ - IString InfixToPostfix::convert(const IString &infix) { + QString InfixToPostfix::convert(const QString &infix) { // Prep our equation for the conversion IString equation = tokenizeEquation(infix); IString postfix = ""; @@ -170,16 +174,20 @@ namespace Isis { // There will be no empty tokens, so don't worry about checking for it. // TokenizeEquation cleans excess spaces in it's return value. - IString data = equation.Token(" "); + QString data = equation.Token(" ").ToQt(); if(data.compare("(") == 0) { theStack.push(*findOperator(data)); } else if(data.compare(")") == 0) { - closeParenthesis(postfix, theStack); + QString postfixQStr = postfix.ToQt(); + closeParenthesis(postfixQStr, theStack); + postfix = postfixQStr; } else if(isKnownSymbol(data)) { - addOperator(postfix, *findOperator(data), theStack); + QString postfixQStr = postfix.ToQt(); + addOperator(postfixQStr, *findOperator(data), theStack); + postfix = postfixQStr; if(isFunction(data)) { // For a general check, zero single argument functions the @@ -203,7 +211,7 @@ namespace Isis { else { try { // Make sure this is truly an operand and not an operator by casting it - (double)data; + toDouble(data); } catch(IException &) { throw IException(IException::User, @@ -215,7 +223,7 @@ namespace Isis { numConsecutiveOperators = 0; numConsecutiveOperands ++; - postfix += ' ' + data + ' '; + postfix += IString(' ' + data + ' '); } // If we found consecutive operators or operands, tell the user @@ -246,7 +254,7 @@ namespace Isis { postfix = postfix.Remove(","); // Clean spaces just to double check and return our postfix answer - return cleanSpaces(postfix); + return cleanSpaces(postfix.ToQt()); } /** @@ -257,7 +265,7 @@ namespace Isis { * * @return bool True if it looks valid, false if it's not known */ - bool InfixToPostfix::isKnownSymbol(IString representation) { + bool InfixToPostfix::isKnownSymbol(QString representation) { for(int i = 0; i < p_operators.size(); i++) { if(representation.compare(p_operators[i]->inputString()) == 0) { return true; @@ -274,7 +282,7 @@ namespace Isis { * * @return bool True if it's a known function, false otherwise */ - bool InfixToPostfix::isFunction(IString representation) { + bool InfixToPostfix::isFunction(QString representation) { if(isKnownSymbol(representation)) { return findOperator(representation)->isFunction(); } @@ -291,7 +299,7 @@ namespace Isis { * @param op The operator * @param theStack The operator stack */ - void InfixToPostfix::addOperator(IString &postfix, const InfixOperator &op, std::stack &theStack) { + void InfixToPostfix::addOperator(QString &postfix, const InfixOperator &op, std::stack &theStack) { while(!theStack.empty()) { InfixOperator top = theStack.top(); theStack.pop(); @@ -320,7 +328,7 @@ namespace Isis { * @param postfix The postix generated thus far * @param theStack The operator stack */ - void InfixToPostfix::closeParenthesis(IString &postfix, std::stack &theStack) { + void InfixToPostfix::closeParenthesis(QString &postfix, std::stack &theStack) { bool openingFound = false; while(!theStack.empty()) { InfixOperator op = theStack.top(); @@ -351,7 +359,7 @@ namespace Isis { * * @return InfixOperator* A pointer to the operator object that contains known information about the operator */ - InfixOperator *InfixToPostfix::findOperator(IString representation) { + InfixOperator *InfixToPostfix::findOperator(QString representation) { for(int i = 0; i < p_operators.size(); i++) { if(representation.compare(p_operators[i]->inputString()) == 0) { return p_operators[i]; @@ -373,14 +381,14 @@ namespace Isis { * * @return IString A tokenized equation with additional parentheses */ - IString InfixToPostfix::tokenizeEquation(const IString &equation) { + QString InfixToPostfix::tokenizeEquation(const QString &equation) { IString output = ""; // Insert whitespace, make everything lowercase, and change all braces to // parenthesis - for(unsigned int i = 0; i < equation.size(); i++) { + for(int i = 0; i < equation.size(); i++) { // Ensure there is whitespace in the equation - if(!isalnum(equation[i]) && !isspace(equation[i]) && equation[i] != '.') { + if(!equation[i].isLetterOrNumber() && !equation[i].isSpace() && equation[i] != '.') { // Convert all braces to parens if(equation[i] == '[' || equation[i] == '{') { output += " ( "; @@ -418,8 +426,8 @@ namespace Isis { i++; } // Take care of scientific notiation where the exponent is negative - else if((i > 1) && equation[i] == '-' && tolower(equation[i-1]) == 'e' && isalnum(equation[i-2])) { - output += equation[i]; + else if((i > 1) && equation[i] == '-' && equation[i-1].toLower() == 'e' && equation[i-2].isLetterOrNumber()) { + output += equation[i].toAscii(); } // Look for negative operator disguised as '-' else if(equation[i] == '-') { @@ -449,16 +457,16 @@ namespace Isis { } else { output += ' '; - output += equation[i]; + output += equation[i].toAscii(); output += ' '; } } else { - output += equation[i]; + output += equation[i].toAscii(); } } - IString cleanedEquation = cleanSpaces(formatFunctionCalls(output.DownCase())); + QString cleanedEquation = cleanSpaces(formatFunctionCalls(output.DownCase().ToQt())); return cleanedEquation; } @@ -474,15 +482,18 @@ namespace Isis { * * @return IString The parenthesized equation */ - IString InfixToPostfix::formatFunctionCalls(IString equation) { + QString InfixToPostfix::formatFunctionCalls(QString equation) { // Clean our space-delimited equation equation = cleanSpaces(equation); - IString output = ""; + QString output = ""; // We'll use tokens to get through the entire equation, which is space-delimited. // So continue processing until we're out of tokens and the string is empty. - while(!equation.empty()) { - IString element = equation.Token(" "); + while(!equation.isEmpty()) { + IString tmp = equation; + + QString element = tmp.Token(" ").ToQt(); + equation = tmp.ToQt(); // Did we find a function? Figure out what it is! if(isFunction(element)) { @@ -496,7 +507,9 @@ namespace Isis { // Deal with 0-argument functions if(func->argumentCount() == 0) { - IString next = equation.Token(" "); + IString tmp = equation; + QString next = tmp.Token(" ").ToQt(); + equation = tmp.ToQt(); // If they didn't add parentheses around the zero-argument // function, we still know what they mean. Close the arguments @@ -508,13 +521,15 @@ namespace Isis { equation = next + " " + equation; } else { + IString tmp = equation; // We see a zero-arg function, and we grabbed an open parenthesis from it. // Make sure the next thing is a close or we have a problem. - if(equation.Token(" ") != ")") { + if(tmp.Token(" ") != ")") { throw IException(IException::User, "The function " + func->inputString() + " should not have any arguments.", _FILEINFO_); } + equation = tmp.ToQt(); // Close the arguments and the wrapping parentheses. They wrote their call correct :) output += " ) ) "; @@ -523,16 +538,23 @@ namespace Isis { else { // Deal with 1+ argument functions by parsing out the arguments + IString tmp = equation; + // Make sure the user put parentheses around these, otherwise we're left in the dark. - if(func->argumentCount() > 1 && equation.Token(" ") != "(") { + if (func->argumentCount() > 1 && tmp.Token(" ") != "(") { throw IException(IException::User, "Missing parenthesis after " + func->inputString(), _FILEINFO_); } + equation = tmp.ToQt(); + // Single argument missing parenthesis? - else if(func->argumentCount() == 1) { - IString argument = equation.Token(" "); + if(func->argumentCount() == 1) { + + IString tmp = equation; + QString argument = tmp.Token(" ").ToQt(); + equation = tmp.ToQt(); if(argument != "(") { // We might have a problem. They're calling a function without adding parentheses.... @@ -553,8 +575,11 @@ namespace Isis { else { // We are negating a function result. We must do a mini-parse to figure out // the function and resursively call, then append the negation. - IString functionName = argument; - IString openParen = equation.Token(" "); + QString functionName = argument; + + IString tmp = equation; + QString openParen = tmp.Token(" ").ToQt(); + equation = tmp.ToQt(); // No open parens? Call ourself again with this supposed function if(openParen != "(") { @@ -570,7 +595,9 @@ namespace Isis { // and append the negation. int numParens = 0; while(numParens > -1) { - IString newElem = equation.Token(" "); + IString tmp = equation; + QString newElem = tmp.Token(" ").ToQt(); + equation = tmp.ToQt(); if(newElem == "") { throw IException(IException::User, @@ -599,11 +626,13 @@ namespace Isis { * out what an argument is, we recursively call FormatFunctionCalls to format any and all functionality * inside of the argument. */ - IString argument = ""; + QString argument = ""; int numParens = 0; int argNum = 0; while(argNum < func->argumentCount()) { - IString elem = equation.Token(" "); + IString tmp = equation; + QString elem = tmp.Token(" ").ToQt(); + equation = tmp.ToQt(); // Ran out of data, the function call is not complete. if(elem == "") { @@ -668,14 +697,12 @@ namespace Isis { return output; } - void InfixToPostfix::checkArgument(IString funcName, int argNum, IString argument) { - argument = argument.Remove(" "); - argument = argument.Remove("("); - argument = argument.Remove(")"); + void InfixToPostfix::checkArgument(QString funcName, int argNum, QString argument) { + argument = argument.remove(QRegExp("[ ()]")); if(argument == "") { throw IException(IException::User, - "Argument " + (IString)(argNum + 1) + " in function " + funcName + " must not be empty.", + "Argument " + toString(argNum + 1) + " in function " + funcName + " must not be empty.", _FILEINFO_); } } diff --git a/isis/src/base/objs/InfixToPostfix/InfixToPostfix.h b/isis/src/base/objs/InfixToPostfix/InfixToPostfix.h index c2f4ab9451..6e11478c95 100644 --- a/isis/src/base/objs/InfixToPostfix/InfixToPostfix.h +++ b/isis/src/base/objs/InfixToPostfix/InfixToPostfix.h @@ -23,10 +23,12 @@ #ifndef INFIXTOPOSTFIX_H_ #define INFIXTOPOSTFIX_H_ -#include "IString.h" #include #include +#include +#include + namespace Isis { class InfixOperator; class InfixFunction; @@ -57,26 +59,27 @@ namespace Isis { InfixToPostfix(); virtual ~InfixToPostfix(); - IString convert(const IString &infix); - IString tokenizeEquation(const IString &equation); + QString convert(const QString &infix); + QString tokenizeEquation(const QString &equation); protected: - virtual bool isKnownSymbol(IString representation); - virtual InfixOperator *findOperator(IString representation); + virtual bool isKnownSymbol(QString representation); + virtual InfixOperator *findOperator(QString representation); QList p_operators; + private: void initialize(); void uninitialize(); - IString formatFunctionCalls(IString equation); - IString cleanSpaces(IString equation); + QString formatFunctionCalls(QString equation); + QString cleanSpaces(QString equation); - void closeParenthesis(IString &postfix, std::stack &theStack); - void addOperator(IString &postfix, const InfixOperator &op, std::stack &theStack); - bool isFunction(IString representation); - void checkArgument(IString funcName, int argNum, IString argument); + void closeParenthesis(QString &postfix, std::stack &theStack); + void addOperator(QString &postfix, const InfixOperator &op, std::stack &theStack); + bool isFunction(QString representation); + void checkArgument(QString funcName, int argNum, QString argument); }; /** @@ -88,14 +91,14 @@ namespace Isis { */ class InfixOperator { public: - InfixOperator(int prec, IString inString, bool isFunc = false) { + InfixOperator(int prec, QString inString, bool isFunc = false) { m_precedence = prec; m_inputString = inString; m_outputString = inString; m_isFunction = isFunc; } - InfixOperator(int prec, IString inString, IString outString, + InfixOperator(int prec, QString inString, QString outString, bool isFunc = false) { m_precedence = prec; m_inputString = inString; @@ -103,11 +106,11 @@ namespace Isis { m_isFunction = isFunc; } - const IString &inputString() const { + const QString &inputString() const { return m_inputString; } - const IString &outputString() const { + const QString &outputString() const { return m_outputString; } @@ -122,8 +125,8 @@ namespace Isis { private: int m_precedence; - IString m_inputString; - IString m_outputString; + QString m_inputString; + QString m_outputString; bool m_isFunction; }; @@ -137,12 +140,12 @@ namespace Isis { */ class InfixFunction : public InfixOperator { public: - InfixFunction(IString inString, int argCount) : + InfixFunction(QString inString, int argCount) : InfixOperator(-1, inString, true) { m_numArguments = argCount; } - InfixFunction(IString inString, IString outString, int argCount) : + InfixFunction(QString inString, QString outString, int argCount) : InfixOperator(-1, inString, outString, true) { m_numArguments = argCount; } diff --git a/isis/src/base/objs/InfixToPostfix/unitTest.cpp b/isis/src/base/objs/InfixToPostfix/unitTest.cpp index dd54c82892..f21ca4cccc 100644 --- a/isis/src/base/objs/InfixToPostfix/unitTest.cpp +++ b/isis/src/base/objs/InfixToPostfix/unitTest.cpp @@ -16,7 +16,7 @@ int main(int argc, char *argv[]) { cout << "Test InfixToPostfix" << endl; const int NUM_EQUATIONS = 25; - IString equations[NUM_EQUATIONS] = { + QString equations[NUM_EQUATIONS] = { "-4", "1*2", "((1)+(1))", @@ -49,9 +49,9 @@ int main(int argc, char *argv[]) { cout << endl << endl << equation + 1 << ": Convert '" << equations[equation] << "' to postfix" << endl; try { - IString tokenized = converter.tokenizeEquation(equations[equation]); + QString tokenized = converter.tokenizeEquation(equations[equation]); cout << " Tokenized equation: '" << tokenized << "'" << endl; - IString postfix = converter.convert(equations[equation]); + QString postfix = converter.convert(equations[equation]); cout << " Postfix: '" << postfix << "'" << endl; } catch(IException e) { diff --git a/isis/src/base/objs/Isis/Isis.h b/isis/src/base/objs/Isis/Isis.h index b5fcaf8f3d..afbf662243 100644 --- a/isis/src/base/objs/Isis/Isis.h +++ b/isis/src/base/objs/Isis/Isis.h @@ -82,10 +82,10 @@ * @history 2006-03-18 Elizabeth Miller - Added gui helper stuff * @history 2006-05-17 Elizabeth Miller - Removed .xml and documented .h file */ -std::map GuiHelpers(); +std::map GuiHelpers(); #ifndef GUIHELPERS -std::map GuiHelpers() { - std::map empty; +std::map GuiHelpers() { + std::map empty; return empty; } #endif diff --git a/isis/src/base/objs/Isis/IsisDebug.h b/isis/src/base/objs/Isis/IsisDebug.h index e26b064f8a..55b61007c9 100644 --- a/isis/src/base/objs/Isis/IsisDebug.h +++ b/isis/src/base/objs/Isis/IsisDebug.h @@ -27,10 +27,10 @@ void InterruptSignal(int); /** * The next two includes are bad, but are necessary without complicating code to * an extreme. These shouldn't cause an issue because they are not included in - * release mode, or ever on systems without libcwd. IString is necessary for + * release mode, or ever on systems without libcwd. QString is necessary for * string conversions and Constants.h for the definition of BigInt. */ -#include "IString.h" +#include "QString.h" #include "Constants.h" /** @@ -88,7 +88,7 @@ class StackTrace { currElement += std::string(addrInfo.file()) + std::string(":") + - Isis::IString((Isis::BigInt)addrInfo.line()) + + QString((Isis::BigInt)addrInfo.line()) + std::string(" --- ") + demangled_name; } diff --git a/isis/src/base/objs/IsisAml/IsisAml.cpp b/isis/src/base/objs/IsisAml/IsisAml.cpp index 2a3698caca..ce1c8eaa14 100644 --- a/isis/src/base/objs/IsisAml/IsisAml.cpp +++ b/isis/src/base/objs/IsisAml/IsisAml.cpp @@ -51,8 +51,8 @@ namespace XERCES = XERCES_CPP_NAMESPACE; * * @param xmlfile Indicates the pull path of the XML file to be parsed. */ -IsisAml::IsisAml(const string &xmlfile) { - StartParser(xmlfile.c_str()); +IsisAml::IsisAml(const QString &xmlfile) { + StartParser(xmlfile.toAscii().data()); } /** @@ -66,10 +66,10 @@ IsisAml::~IsisAml() { * performed on the value passed in. * * @param paramName The partial or full name of the parameter to be modified. - * @param value The string representation of the value to be placed in the - * parameters value data member. For parameters of type integer, the string - * must be convertable to an integer. For parameters of type double, the string - * must be convertable to a double. For parameters of type boolean, the string + * @param value The QString representation of the value to be placed in the + * parameters value data member. For parameters of type integer, the QString + * must be convertable to an integer. For parameters of type double, the QString + * must be convertable to a double. For parameters of type boolean, the QString * must be one of: (TRUE, FALSE, YES, NO, or a partial match of any of these * beginning with the first character). * @@ -78,13 +78,13 @@ IsisAml::~IsisAml() { * to erase all values in the value data member instead of overwriting an * existing value. */ -void IsisAml::PutAsString(const string ¶mName, - const string &value) { +void IsisAml::PutAsString(const QString ¶mName, + const QString &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been entered."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -99,20 +99,20 @@ void IsisAml::PutAsString(const string ¶mName, * performed on the value passed in. * * @param paramName The partial or full name of the parameter to be modified. - * @param value The string vector representation of the value to be placed in - * the parameters value data member. For parameters of type integer, the string - * must be convertable to an integer. For parameters of type double, the string - * must be convertable to a double. For parameters of type boolean, the string + * @param value The QString vector representation of the value to be placed in + * the parameters value data member. For parameters of type integer, the QString + * must be convertable to an integer. For parameters of type double, the QString + * must be convertable to a double. For parameters of type boolean, the QString * must be one of: (TRUE, FALSE, YES, NO, or a partial match of any of these * beginning with the first character). */ -void IsisAml::PutAsString(const string ¶mName, - const vector &value) { +void IsisAml::PutAsString(const QString ¶mName, + const vector &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been entered."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -123,7 +123,7 @@ void IsisAml::PutAsString(const string ¶mName, } -// Public: Sets the value member of a parameter of type string whose name +// Public: Sets the value member of a parameter of type QString whose name // starts with paramName /** @@ -132,26 +132,26 @@ void IsisAml::PutAsString(const string ¶mName, * performed on the value passed in. * * @param paramName The partial or full name of the parameter to be modified. - * @param value The string representation of the value to be placed in the + * @param value The QString representation of the value to be placed in the * parameters value data member. For parameters of type integer, the - * string - * must be convertable to an integer. For parameters of type double, the string - * must be convertable to a double. For parameters of type boolean, the string + * QString + * must be convertable to an integer. For parameters of type double, the QString + * must be convertable to a double. For parameters of type boolean, the QString * must be one of: (TRUE, FALSE, YES, NO, or a partial match of any of these * beginning with the first character). * */ -void IsisAml::PutString(const string ¶mName, const string &value) { +void IsisAml::PutString(const QString ¶mName, const QString &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "string" && param->type != "combo") { - string message = "Parameter [" + paramName + "] is not a string."; + QString message = "Parameter [" + paramName + "] is not a string."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -164,27 +164,27 @@ void IsisAml::PutString(const string ¶mName, const string &value) { } -// Public: Sets the value member of a parameter of type string whose name +// Public: Sets the value member of a parameter of type QString whose name // starts with paramName /** * Allows the insertion of a value for a parameter of type "string". A validity - * check is performed on the value passed in, but all strings are allowed. + * check is performed on the value passed in, but all QStrings are allowed. * * @param paramName The partial or full name of the parameter to be modified. - * @param value The string value to be placed in the string's value data member. + * @param value The QString value to be placed in the QString's value data member. */ -void IsisAml::PutString(const string ¶mName, - const vector &value) { +void IsisAml::PutString(const QString ¶mName, + const vector &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "string" && param->type != "combo") { - string message = "Parameter [" + paramName + "] is not a string."; + QString message = "Parameter [" + paramName + "] is not a string."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -205,21 +205,21 @@ void IsisAml::PutString(const string ¶mName, * validity check is performed on the value passed in. * * @param paramName The partial or full name of the parameter to be modified. - * @param value The string representation of the value to be placed in the + * @param value The QString representation of the value to be placed in the * filename's value data member. */ -void IsisAml::PutFileName(const string ¶mName, - const string &value) { +void IsisAml::PutFileName(const QString ¶mName, + const QString &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if((param->type != "filename") && (param->type != "cube")) { - string message = "Parameter [" + paramName + "] is not a filename."; + QString message = "Parameter [" + paramName + "] is not a filename."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -240,7 +240,7 @@ void IsisAml::PutFileName(const string ¶mName, * validity check is performed on the value passed in. * * @param paramName The partial or full name of the parameter to be modified. - * @param value The string vector representation of the value to be placed in + * @param value The QString vector representation of the value to be placed in * the filename's value data member. * * @throws iException (IsisProgrammerError) The parameter is not of type @@ -250,18 +250,18 @@ void IsisAml::PutFileName(const string ¶mName, * Use "Clear" to erase all values in the value data member instead of * overwriting an existing value. */ -void IsisAml::PutFileName(const string ¶mName, - const vector &value) { +void IsisAml::PutFileName(const QString ¶mName, + const vector &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if((param->type != "filename") && (param->type != "cube")) { - string message = "Parameter [" + paramName + "] is not a filename."; + QString message = "Parameter [" + paramName + "] is not a filename."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -288,25 +288,25 @@ void IsisAml::PutFileName(const string ¶mName, * @throws iException (IsisProgrammerError) The parameter is not of type * "int". */ -void IsisAml::PutInteger(const string ¶mName, +void IsisAml::PutInteger(const QString ¶mName, const int &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "integer") { - string message = "Parameter [" + paramName + "] is not an integer."; + QString message = "Parameter [" + paramName + "] is not an integer."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } param->values.clear(); - param->values.push_back(Isis::IString(value)); + param->values.push_back(Isis::toString(value)); Verify(param); } @@ -329,18 +329,18 @@ void IsisAml::PutInteger(const string ¶mName, * an existing value. * @throws iException (IsisProgrammerError) The parameter is not of type "int". */ -void IsisAml::PutInteger(const string ¶mName, +void IsisAml::PutInteger(const QString ¶mName, const vector &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "integer") { - string message = "Parameter [" + paramName + "] is not an integer."; + QString message = "Parameter [" + paramName + "] is not an integer."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -348,7 +348,7 @@ void IsisAml::PutInteger(const string ¶mName, param->values.resize(value.size()); for(unsigned int i = 0; i < value.size(); i++) { - param->values[i] = Isis::IString(value[i]); + param->values[i] = Isis::toString(value[i]); } Verify(param); @@ -374,25 +374,25 @@ void IsisAml::PutInteger(const string ¶mName, * @throws iException (IsisProgrammerError) The parameter is not of type * "double". */ -void IsisAml::PutDouble(const string ¶mName, +void IsisAml::PutDouble(const QString ¶mName, const double &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "double") { - string message = "Parameter [" + paramName + "] is not a double."; + QString message = "Parameter [" + paramName + "] is not a double."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } param->values.clear(); - param->values.push_back(Isis::IString(value)); + param->values.push_back(Isis::toString(value)); Verify(param); } @@ -415,18 +415,18 @@ void IsisAml::PutDouble(const string ¶mName, * @throws iException (IsisProgrammerError) The parameter is not of type * "double". */ -void IsisAml::PutDouble(const string ¶mName, +void IsisAml::PutDouble(const QString ¶mName, const vector &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "double") { - string message = "Parameter [" + paramName + "] is not a double."; + QString message = "Parameter [" + paramName + "] is not a double."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -434,7 +434,7 @@ void IsisAml::PutDouble(const string ¶mName, param->values.resize(value.size()); for(unsigned int i = 0; i < value.size(); i++) { - param->values[i] = Isis::IString(value[i]); + param->values[i] = Isis::toString(value[i]); } Verify(param); @@ -459,18 +459,18 @@ void IsisAml::PutDouble(const string ¶mName, * @throws iException (IsisProgrammerError) The parameter is not of type * "boolean". */ -void IsisAml::PutBoolean(const string ¶mName, +void IsisAml::PutBoolean(const QString ¶mName, const bool &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "boolean") { - string message = "Parameter [" + paramName + "] is not a boolean."; + QString message = "Parameter [" + paramName + "] is not a boolean."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -505,18 +505,18 @@ void IsisAml::PutBoolean(const string ¶mName, * @throws iException (IsisProgrammerError) The parameter is not of type * "boolean". */ -void IsisAml::PutBoolean(const string ¶mName, +void IsisAml::PutBoolean(const QString ¶mName, const vector &value) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "boolean") { - string message = "Parameter [" + paramName + "] is not a boolean."; + QString message = "Parameter [" + paramName + "] is not a boolean."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() > 0) { - string message = "A value for this parameter [" + paramName + "] has " + QString message = "A value for this parameter [" + paramName + "] has " "already been saved (possibly by IsisGui). If you need to " "change the value use \"Clear\" before the Put."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -539,24 +539,24 @@ void IsisAml::PutBoolean(const string ¶mName, // Accessor methods for getting the value(s) of a parameter // Public: Returns the first element of the value member of a parameter whos -// name starts with paramName as a string. Any type can be retrieve with this member. +// name starts with paramName as a QString. Any type can be retrieve with this member. /** * Allows the retrieval of a value for a parameter of any type. The value will - * be returned as a string no matter what the parameter type is. + * be returned as a QString no matter what the parameter type is. * * @param paramName The partial or full name of the parameter to be retrieved. * - * @return A string representation of the value for the specified parameter. + * @return A QString representation of the value for the specified parameter. * * @throws iException (IsisProgrammerError) The parameter has no value. */ -string IsisAml::GetAsString(const string ¶mName) const { +QString IsisAml::GetAsString(const QString ¶mName) const { const IsisParameterData *param = ReturnParam(paramName); - string value; + QString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } else { @@ -571,10 +571,10 @@ string IsisAml::GetAsString(const string ¶mName) const { } // Public: Returns the value member of a parameter whose name starts with paramName -// as a vector +// as a vector /** * Allows the retrieval of a value for a parameter of any type. The value will - * be returned as a string no matter what the parameter type is. + * be returned as a QString no matter what the parameter type is. * * @param paramName The partial or full name of the parameter to be retrieved. * @param values The value member of the parameter whose name starts with @@ -582,16 +582,16 @@ string IsisAml::GetAsString(const string ¶mName) const { * * @throws iException (IsisProgrammerError) The parameter has no value. */ -void IsisAml::GetAsString(const string ¶mName, - vector &values) const { +void IsisAml::GetAsString(const QString ¶mName, + vector &values) const { const IsisParameterData *param = ReturnParam(paramName); values.clear(); - string value; + QString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -609,7 +609,7 @@ void IsisAml::GetAsString(const string ¶mName, // Public: Returns the first element of the value member of a parameter whose -// name starts with paramName as a string/filename +// name starts with paramName as a QString/filename /** * Allows the retrieval of a value for a parameter of type "filename". * @@ -620,19 +620,19 @@ void IsisAml::GetAsString(const string ¶mName, * * @return The value of the parameter. */ -Isis::IString IsisAml::GetFileName(const string ¶mName, string extension) const { +QString IsisAml::GetFileName(const QString ¶mName, QString extension) const { const IsisParameterData *param = ReturnParam(paramName); if((param->type != "filename") && (param->type != "cube")) { - string message = "Parameter [" + paramName + "] is not a filename."; + QString message = "Parameter [" + paramName + "] is not a filename."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } - string value; + QString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -652,7 +652,7 @@ Isis::IString IsisAml::GetFileName(const string ¶mName, string extension) co // Public: Returns the value member of a parameter whose name starts with paramName -// as a vector +// as a vector /** * Allows the retrieval of a value for a parameter of type "filename". * @@ -660,20 +660,20 @@ Isis::IString IsisAml::GetFileName(const string ¶mName, string extension) co * @param values The value membet of the parameter whose name starts with * paramName. */ -void IsisAml::GetFileName(const string ¶mName, - vector &values) const { +void IsisAml::GetFileName(const QString ¶mName, + vector &values) const { const IsisParameterData *param = ReturnParam(paramName); if((param->type != "filename") && (param->type != "cube")) { - string message = "Parameter [" + paramName + "] is not a filename."; + QString message = "Parameter [" + paramName + "] is not a filename."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } values.clear(); if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -695,7 +695,7 @@ void IsisAml::GetFileName(const string ¶mName, // Public: Returns the first element of the value member of a parameter whos -// name starts with paramName as a string +// name starts with paramName as a QString /** * Allows the retrieval of a value for a parameter of type "string". * @@ -705,19 +705,19 @@ void IsisAml::GetFileName(const string ¶mName, * * @throws iException::Programmer (IsisErrorUser) The parameter has no value. */ -string IsisAml::GetString(const string ¶mName) const { +QString IsisAml::GetString(const QString ¶mName) const { const IsisParameterData *param = ReturnParam(paramName); - Isis::IString value; + QString value; if(param->type != "string" && param->type != "combo") { - string message = "Parameter [" + paramName + "] is not a string."; + QString message = "Parameter [" + paramName + "] is not a string."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -729,28 +729,27 @@ string IsisAml::GetString(const string ¶mName) const { // If there is a list of legal values return the list option that matches // or begins with what was entered rather than exactly what was entered if(param->listOptions.size() > 0) { - value = value.UpCase(); + value = value.toUpper(); int found = -1; int foundcount = 0; for(unsigned int p = 0; p < param->listOptions.size(); p++) { - Isis::IString option = param->listOptions[p].value; - option = option.UpCase(); + QString option = param->listOptions[p].value; + option = option.toUpper(); if(value == option) { return value; } - else if(value.compare(0, min(value.size(), option.size()), - option , 0, min(value.size(), option.size())) == 0) { + else if(value.startsWith(option) || option.startsWith(value)) { found = p; foundcount = foundcount + 1; } } if(foundcount == 0) { - string message = "Value [" + value + "] for parameter [" + + QString message = "Value [" + value + "] for parameter [" + paramName + "] is not a valid value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } if(foundcount > 1) { - string message = "Value [" + value + "] for parameter [" + + QString message = "Value [" + value + "] for parameter [" + paramName + "] is not unique."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -767,7 +766,7 @@ string IsisAml::GetString(const string ¶mName) const { // Public: Returns the value member of a parameter whose name starts with paramName -// as a vector +// as a vector /** * Allows the retrieval of a value for a parameter of type "string". * @@ -778,21 +777,21 @@ string IsisAml::GetString(const string ¶mName) const { * * @throws iException::Programmer (IsisErrorUser) The parameter has no value. */ -void IsisAml::GetString(const string ¶mName, - vector &values) const { +void IsisAml::GetString(const QString ¶mName, + vector &values) const { const IsisParameterData *param = ReturnParam(paramName); if(param->type != "string" && param->type != "combo") { - string message = "Parameter [" + paramName + "] is not a string."; + QString message = "Parameter [" + paramName + "] is not a string."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } values.clear(); - string value; + QString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -821,19 +820,19 @@ void IsisAml::GetString(const string ¶mName, * * @throws iException::Programmer (IsisErrorUser) The parameter has no value. */ -int IsisAml::GetInteger(const string ¶mName) const { +int IsisAml::GetInteger(const QString ¶mName) const { const IsisParameterData *param = ReturnParam(paramName); if(param->type != "integer") { - string message = "Parameter [" + paramName + "] is not an integer."; + QString message = "Parameter [" + paramName + "] is not an integer."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } Isis::IString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -860,13 +859,13 @@ int IsisAml::GetInteger(const string ¶mName) const { * * @throws iException::Programmer (IsisErrorUser) The parameter has no value. */ -void IsisAml::GetInteger(const string ¶mName, +void IsisAml::GetInteger(const QString ¶mName, vector &values) const { const IsisParameterData *param = ReturnParam(paramName); if(param->type != "integer") { - string message = "Parameter [" + paramName + "] is not an integer."; + QString message = "Parameter [" + paramName + "] is not an integer."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } @@ -874,7 +873,7 @@ void IsisAml::GetInteger(const string ¶mName, Isis::IString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -905,19 +904,19 @@ void IsisAml::GetInteger(const string ¶mName, * * @throws iException::Programmer (IsisErrorUser) The parameter has no value. */ -double IsisAml::GetDouble(const string ¶mName) const { +double IsisAml::GetDouble(const QString ¶mName) const { const IsisParameterData *param = ReturnParam(paramName); if(param->type != "double") { - string message = "Parameter [" + paramName + "] is not a double."; + QString message = "Parameter [" + paramName + "] is not a double."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } Isis::IString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -943,13 +942,13 @@ double IsisAml::GetDouble(const string ¶mName) const { * * @throws iException::Programmer (IsisErrorUser) The parameter has no value. */ -void IsisAml::GetDouble(const string ¶mName, +void IsisAml::GetDouble(const QString ¶mName, vector &values) const { const IsisParameterData *param = ReturnParam(paramName); if(param->type != "double") { - string message = "Parameter [" + paramName + "] is not a double."; + QString message = "Parameter [" + paramName + "] is not a double."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } @@ -957,7 +956,7 @@ void IsisAml::GetDouble(const string ¶mName, Isis::IString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -987,19 +986,19 @@ void IsisAml::GetDouble(const string ¶mName, * * @throws iException::Programmer (IsisErrorUser) The parameter has no value. */ -bool IsisAml::GetBoolean(const string ¶mName) const { +bool IsisAml::GetBoolean(const QString ¶mName) const { const IsisParameterData *param = ReturnParam(paramName); if(param->type != "boolean") { - string message = "Parameter [" + paramName + "] is not a boolean."; + QString message = "Parameter [" + paramName + "] is not a boolean."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } - Isis::IString value; + QString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -1010,7 +1009,7 @@ bool IsisAml::GetBoolean(const string ¶mName) const { value = param->values[0]; } - return StringToBool(value); + return Isis::toBool(value); } @@ -1027,36 +1026,34 @@ bool IsisAml::GetBoolean(const string ¶mName) const { * * @throws iException::Programmer (IsisErrorUser) The parameter has no value. */ -void IsisAml::GetBoolean(const string ¶mName, +void IsisAml::GetBoolean(const QString ¶mName, vector &values) const { const IsisParameterData *param = ReturnParam(paramName); if(param->type != "boolean") { - string message = "Parameter [" + paramName + "] is not a boolean."; + QString message = "Parameter [" + paramName + "] is not a boolean."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } values.clear(); - vector value; - Isis::IString tmp; + vector value; + QString tmp; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { - string message = "Parameter [" + paramName + "] has no value."; + QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { for(unsigned int i = 0; i < param->defaultValues.size(); i++) { - tmp = param->defaultValues[i]; - tmp.UpCase(); + tmp = param->defaultValues[i].toUpper(); value.push_back(tmp); } } } else { for(unsigned int i = 0; i < param->values.size(); i++) { - tmp = param->values[i]; - tmp.UpCase(); + tmp = param->values[i].toUpper(); value.push_back(tmp); } } @@ -1073,8 +1070,8 @@ void IsisAml::GetBoolean(const string ¶mName, * * @return The name of the program. */ -string IsisAml::ProgramName() const { - string tmp = name; +QString IsisAml::ProgramName() const { + QString tmp = name; return tmp; } @@ -1084,7 +1081,7 @@ string IsisAml::ProgramName() const { * * @return The brief description. */ -string IsisAml::Brief() const { +QString IsisAml::Brief() const { return brief; } @@ -1094,7 +1091,7 @@ string IsisAml::Brief() const { * * @return The full description. */ -string IsisAml::Description() const { +QString IsisAml::Description() const { return description; } @@ -1114,8 +1111,8 @@ int IsisAml::NumGroups() const { * * @return The group name. */ -string IsisAml::GroupName(const int &index) const { - string s = groups[index].name; +QString IsisAml::GroupName(const int &index) const { + QString s = groups[index].name; return s; } @@ -1128,7 +1125,7 @@ string IsisAml::GroupName(const int &index) const { * * @return int */ -int IsisAml::GroupIndex(const string & grpName) const { +int IsisAml::GroupIndex(const QString & grpName) const { for(int i=0; i<(int)groups.size(); i++) { if(Isis::IString(grpName).DownCase() == Isis::IString(groups[i].name).DownCase()) { return i; @@ -1150,7 +1147,7 @@ int IsisAml::GroupIndex(const string & grpName) const { * @param pvlGrpName - output PVL Group name * @param include - vector of parameter names to be part of the output PVL */ -void IsisAml::CreatePVL(Isis::Pvl &pvlDef , string guiGrpName, string pvlObjName, string pvlGrpName, vector & include) { +void IsisAml::CreatePVL(Isis::Pvl &pvlDef , QString guiGrpName, QString pvlObjName, QString pvlGrpName, vector & include) { Isis::PvlObject *pvlObj = NULL; if (pvlObjName != "") { @@ -1161,24 +1158,24 @@ void IsisAml::CreatePVL(Isis::Pvl &pvlDef , string guiGrpName, string pvlObjName int grpIndex= GroupIndex(guiGrpName); if (pvlGrpName == "" || grpIndex == -1 ) { - string errMsg = "Must provide Group Name\n"; + QString errMsg = "Must provide Group Name\n"; throw Isis::IException(Isis::IException::User, errMsg, _FILEINFO_); } Isis::PvlGroup grp(pvlGrpName); for(int i=0; i & include) { +bool IsisAml::IsParamInPvlInclude(QString & paramName, vector & include) { for(int i=0; i<(int)include.size(); i++) { if(Isis::IString(paramName).DownCase() == Isis::IString(include[i]).DownCase()) { @@ -1235,8 +1232,8 @@ int IsisAml::NumParams(const int &group) const { * * @return The name of the parameter. */ -string IsisAml::ParamName(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].name; +QString IsisAml::ParamName(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].name; return s; } @@ -1248,8 +1245,8 @@ string IsisAml::ParamName(const int &group, const int ¶m) const { * * @return The brief description. */ -string IsisAml::ParamBrief(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].brief; +QString IsisAml::ParamBrief(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].brief; return s; } @@ -1261,8 +1258,8 @@ string IsisAml::ParamBrief(const int &group, const int ¶m) const { * * @return The long description */ -string IsisAml::ParamDescription(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].description; +QString IsisAml::ParamDescription(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].description; return s; } @@ -1274,8 +1271,8 @@ string IsisAml::ParamDescription(const int &group, const int ¶m) const { * * @return The minimum */ -string IsisAml::ParamMinimum(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].minimum; +QString IsisAml::ParamMinimum(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].minimum; return s; } @@ -1287,8 +1284,8 @@ string IsisAml::ParamMinimum(const int &group, const int ¶m) const { * * @return The maximum */ -string IsisAml::ParamMaximum(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].maximum; +QString IsisAml::ParamMaximum(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].maximum; return s; } @@ -1300,8 +1297,8 @@ string IsisAml::ParamMaximum(const int &group, const int ¶m) const { * * @return Whether minimum is inclusive or not */ -string IsisAml::ParamMinimumInclusive(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].minimum_inclusive; +QString IsisAml::ParamMinimumInclusive(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].minimum_inclusive; return s; } @@ -1313,8 +1310,8 @@ string IsisAml::ParamMinimumInclusive(const int &group, const int ¶m) const * * @return Whether maximum is inclusive or not */ -string IsisAml::ParamMaximumInclusive(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].maximum_inclusive; +QString IsisAml::ParamMaximumInclusive(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].maximum_inclusive; return s; } @@ -1327,8 +1324,8 @@ string IsisAml::ParamMaximumInclusive(const int &group, const int ¶m) const * * @return Whether the parameter restricts odd values or not */ -string IsisAml::ParamOdd(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].odd; +QString IsisAml::ParamOdd(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].odd; return s; } @@ -1403,9 +1400,9 @@ int IsisAml::ParamNotEqualSize(const int &group, const int ¶m) const { * * @return The name of the greaterThan parameter */ -string IsisAml::ParamGreaterThan(const int &group, const int ¶m, +QString IsisAml::ParamGreaterThan(const int &group, const int ¶m, const int &great) const { - string s = groups[group].parameters[param].greaterThan[great]; + QString s = groups[group].parameters[param].greaterThan[great]; return s; } @@ -1418,9 +1415,9 @@ string IsisAml::ParamGreaterThan(const int &group, const int ¶m, * * @return The name of the greaterThanOrEqual parameter */ -string IsisAml::ParamGreaterThanOrEqual(const int &group, const int ¶m, +QString IsisAml::ParamGreaterThanOrEqual(const int &group, const int ¶m, const int &great) const { - string s = groups[group].parameters[param].greaterThanOrEqual[great]; + QString s = groups[group].parameters[param].greaterThanOrEqual[great]; return s; } @@ -1433,9 +1430,9 @@ string IsisAml::ParamGreaterThanOrEqual(const int &group, const int ¶m, * * @return The name of the lessThan parameter */ -string IsisAml::ParamLessThan(const int &group, const int ¶m, +QString IsisAml::ParamLessThan(const int &group, const int ¶m, const int &les) const { - string s = groups[group].parameters[param].lessThan[les]; + QString s = groups[group].parameters[param].lessThan[les]; return s; } @@ -1448,9 +1445,9 @@ string IsisAml::ParamLessThan(const int &group, const int ¶m, * * @return The name of the lessThanOrEqual parameter */ -string IsisAml::ParamLessThanOrEqual(const int &group, const int ¶m, +QString IsisAml::ParamLessThanOrEqual(const int &group, const int ¶m, const int &les) const { - string s = groups[group].parameters[param].lessThanOrEqual[les]; + QString s = groups[group].parameters[param].lessThanOrEqual[les]; return s; } @@ -1463,9 +1460,9 @@ string IsisAml::ParamLessThanOrEqual(const int &group, const int ¶m, * * @return The name of the notEqual parameter */ -string IsisAml::ParamNotEqual(const int &group, const int ¶m, +QString IsisAml::ParamNotEqual(const int &group, const int ¶m, const int ¬Eq) const { - string s = groups[group].parameters[param].notEqual[notEq]; + QString s = groups[group].parameters[param].notEqual[notEq]; return s; } @@ -1478,9 +1475,9 @@ string IsisAml::ParamNotEqual(const int &group, const int ¶m, * * @return The name of the excluded parameter */ -string IsisAml::ParamExclude(const int &group, const int ¶m, +QString IsisAml::ParamExclude(const int &group, const int ¶m, const int &exclude) const { - string s = groups[group].parameters[param].exclude[exclude]; + QString s = groups[group].parameters[param].exclude[exclude]; return s; } @@ -1493,9 +1490,9 @@ string IsisAml::ParamExclude(const int &group, const int ¶m, * * @return The name of the included parameter */ -string IsisAml::ParamInclude(const int &group, const int ¶m, +QString IsisAml::ParamInclude(const int &group, const int ¶m, const int &include) const { - string s = groups[group].parameters[param].include[include]; + QString s = groups[group].parameters[param].include[include]; return s; } @@ -1508,8 +1505,8 @@ string IsisAml::ParamInclude(const int &group, const int ¶m, * * @return The type of parameter. */ -string IsisAml::ParamType(const int &group, const int ¶m) const { - string s = groups[group].parameters[param].type; +QString IsisAml::ParamType(const int &group, const int ¶m) const { + QString s = groups[group].parameters[param].type; return s; } @@ -1521,8 +1518,8 @@ string IsisAml::ParamType(const int &group, const int ¶m) const { * * @return The default for the specified parameter. */ -string IsisAml::ParamDefault(const int &group, const int ¶m) const { - string s; +QString IsisAml::ParamDefault(const int &group, const int ¶m) const { + QString s; if(groups[group].parameters[param].defaultValues.size() == 0) { s = ""; } @@ -1540,8 +1537,8 @@ string IsisAml::ParamDefault(const int &group, const int ¶m) const { * * @return The internal default for the specified parameter. */ -string IsisAml::ParamInternalDefault(const int &group, const int ¶m) const { - string s; +QString IsisAml::ParamInternalDefault(const int &group, const int ¶m) const { + QString s; if(groups[group].parameters[param].internalDefault.size() == 0) { s = ""; } @@ -1559,8 +1556,8 @@ string IsisAml::ParamInternalDefault(const int &group, const int ¶m) const { * * @return The paramter filter. */ -string IsisAml::ParamFilter(const int &group, const int ¶m) const { - string s; +QString IsisAml::ParamFilter(const int &group, const int ¶m) const { + QString s; if(groups[group].parameters[param].filter.size() == 0) { s = ""; } @@ -1578,8 +1575,8 @@ string IsisAml::ParamFilter(const int &group, const int ¶m) const { * * @return The default path. */ -string IsisAml::ParamPath(const int &group, const int ¶m) const { - string s; +QString IsisAml::ParamPath(const int &group, const int ¶m) const { + QString s; if(groups[group].parameters[param].path.size() == 0) { s = ""; } @@ -1597,8 +1594,8 @@ string IsisAml::ParamPath(const int &group, const int ¶m) const { * * @return The file mode for the parameter. */ -string IsisAml::ParamFileMode(const int &group, const int ¶m) const { - string s; +QString IsisAml::ParamFileMode(const int &group, const int ¶m) const { + QString s; if(groups[group].parameters[param].fileMode.size() == 0) { s = ""; } @@ -1631,9 +1628,9 @@ int IsisAml::ParamListSize(const int &group, const int ¶m) const { * * @return The value of the option. */ -string IsisAml::ParamListValue(const int &group, const int ¶m, +QString IsisAml::ParamListValue(const int &group, const int ¶m, const int &option) const { - string s = groups[group].parameters[param].listOptions[option].value; + QString s = groups[group].parameters[param].listOptions[option].value; return s; } @@ -1646,9 +1643,9 @@ string IsisAml::ParamListValue(const int &group, const int ¶m, * * @return The brief description of the option. */ -string IsisAml::ParamListBrief(const int &group, const int ¶m, +QString IsisAml::ParamListBrief(const int &group, const int ¶m, const int &option) const { - string s = groups[group].parameters[param].listOptions[option].brief; + QString s = groups[group].parameters[param].listOptions[option].brief; return s; } @@ -1661,9 +1658,9 @@ string IsisAml::ParamListBrief(const int &group, const int ¶m, * * @return The full description of the option. */ -string IsisAml::ParamListDescription(const int &group, const int ¶m, +QString IsisAml::ParamListDescription(const int &group, const int ¶m, const int &option) const { - string s = groups[group].parameters[param].listOptions[option].description; + QString s = groups[group].parameters[param].listOptions[option].description; return s; } @@ -1691,9 +1688,9 @@ int IsisAml::ParamListExcludeSize(const int &group, const int ¶m, * * @return The parameter name to be excluded if this option is selected. */ -string IsisAml::ParamListExclude(const int &group, const int ¶m, +QString IsisAml::ParamListExclude(const int &group, const int ¶m, const int &option, const int &exclude) const { - string s = groups[group].parameters[param].listOptions[option].exclude[exclude]; + QString s = groups[group].parameters[param].listOptions[option].exclude[exclude]; return s; } @@ -1721,9 +1718,9 @@ int IsisAml::ParamListIncludeSize(const int &group, const int ¶m, * * @return The parameter name to be included if this option is selected. */ -string IsisAml::ParamListInclude(const int &group, const int ¶m, +QString IsisAml::ParamListInclude(const int &group, const int ¶m, const int &option, const int &include) const { - string s = groups[group].parameters[param].listOptions[option].include[include]; + QString s = groups[group].parameters[param].listOptions[option].include[include]; return s; } @@ -1759,7 +1756,7 @@ int IsisAml::ParamIncludeSize(const int &group, const int ¶m) const { * * @return The default pixel type */ -string IsisAml::PixelType(const int &group, const int ¶m) const { +QString IsisAml::PixelType(const int &group, const int ¶m) const { return groups[group].parameters[param].pixelType; } @@ -1782,9 +1779,9 @@ int IsisAml::HelpersSize(const int &group, const int ¶m) const { * @param param The parameter index * @param helper The helper index * - * @return string The name of the helper + * @return QString The name of the helper */ -string IsisAml::HelperButtonName(const int &group, const int ¶m, +QString IsisAml::HelperButtonName(const int &group, const int ¶m, const int &helper) const { return groups[group].parameters[param].helpers[helper].name; } @@ -1796,9 +1793,9 @@ string IsisAml::HelperButtonName(const int &group, const int ¶m, * @param param The parameter index * @param helper The helper index * - * @return string The name of the helper function + * @return QString The name of the helper function */ -string IsisAml::HelperFunction(const int &group, const int ¶m, +QString IsisAml::HelperFunction(const int &group, const int ¶m, const int &helper) const { return groups[group].parameters[param].helpers[helper].function; } @@ -1810,9 +1807,9 @@ string IsisAml::HelperFunction(const int &group, const int ¶m, * @param param The parameter index * @param helper The helper index * - * @return string The brief description of the helper button + * @return QString The brief description of the helper button */ -string IsisAml::HelperBrief(const int &group, const int ¶m, +QString IsisAml::HelperBrief(const int &group, const int ¶m, const int &helper) const { return groups[group].parameters[param].helpers[helper].brief; } @@ -1824,9 +1821,9 @@ string IsisAml::HelperBrief(const int &group, const int ¶m, * @param param The parameter index * @param helper The helper index * - * @return string The long description of the helper button + * @return QString The long description of the helper button */ -string IsisAml::HelperDescription(const int &group, const int ¶m, +QString IsisAml::HelperDescription(const int &group, const int ¶m, const int &helper) const { return groups[group].parameters[param].helpers[helper].description; } @@ -1838,9 +1835,9 @@ string IsisAml::HelperDescription(const int &group, const int ¶m, * @param param The parameter index * @param helper The helper index * - * @return string The name of the helper icon + * @return QString The name of the helper icon */ -string IsisAml::HelperIcon(const int &group, const int ¶m, +QString IsisAml::HelperIcon(const int &group, const int ¶m, const int &helper) const { return groups[group].parameters[param].helpers[helper].icon; } @@ -1852,7 +1849,7 @@ string IsisAml::HelperIcon(const int &group, const int ¶m, * * @return True if the parameter was entered, and false if it was not */ -bool IsisAml::WasEntered(const string ¶mName) const { +bool IsisAml::WasEntered(const QString ¶mName) const { const IsisParameterData *param = ReturnParam(paramName); @@ -1868,7 +1865,7 @@ bool IsisAml::WasEntered(const string ¶mName) const { * * @param paramName The name of the parameter to clear */ -void IsisAml::Clear(const string ¶mName) { +void IsisAml::Clear(const QString ¶mName) { IsisParameterData *param = const_cast (ReturnParam(paramName)); param->values.clear(); @@ -1890,21 +1887,21 @@ void IsisAml::Clear(const string ¶mName) { * @throws iException::Programmer "Parameter is not a cube." * @throws iException::Programmer "Parameter in not an input cube" */ -Isis::CubeAttributeInput &IsisAml::GetInputAttribute(const string ¶mName) { +Isis::CubeAttributeInput &IsisAml::GetInputAttribute(const QString ¶mName) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "cube") { - string message = "Unable to get input cube attributes. Parameter [" + QString message = "Unable to get input cube attributes. Parameter [" + paramName + "] is not a cube. Parameter type = [" + param->type + "]."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } - string value; + QString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { value.clear(); -// string message = "Parameter [" + paramName + "] has no value."; +// QString message = "Parameter [" + paramName + "] has no value."; // throw Isis::IException(Isis::IException::User,message, _FILEINFO_); } else { @@ -1918,7 +1915,7 @@ Isis::CubeAttributeInput &IsisAml::GetInputAttribute(const string ¶mName) { param->inCubeAtt.setAttributes(value); } else { - string message = "Unable to get input cube attributes. Parameter [" + QString message = "Unable to get input cube attributes. Parameter [" + paramName + "] is not an input. Parameter fileMode = [" + param->fileMode + "]."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } @@ -1935,21 +1932,21 @@ Isis::CubeAttributeInput &IsisAml::GetInputAttribute(const string ¶mName) { * @throws iException::Programmer "Parameter is not a cube" * @throws iException::Programmer "Parameter in not an output" */ -Isis::CubeAttributeOutput &IsisAml::GetOutputAttribute(const string ¶mName) { +Isis::CubeAttributeOutput &IsisAml::GetOutputAttribute(const QString ¶mName) { IsisParameterData *param = const_cast (ReturnParam(paramName)); if(param->type != "cube") { - string message = "Unable to get output cube attributes. Parameter [" + QString message = "Unable to get output cube attributes. Parameter [" + paramName + "] is not a cube. Parameter type = [" + param->type + "]."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } - string value; + QString value; if(param->values.size() == 0) { if(param->defaultValues.size() == 0) { value.clear(); -// string message = "Parameter [" + paramName + "] has no value."; +// QString message = "Parameter [" + paramName + "] has no value."; // throw Isis::IException(Isis::IException::User,message, _FILEINFO_); } else { @@ -1964,7 +1961,7 @@ Isis::CubeAttributeOutput &IsisAml::GetOutputAttribute(const string ¶mName) param->outCubeAtt.addAttributes(Isis::FileName(value)); } else { - string message = "Unable to get output cube attributes. Parameter [" + QString message = "Unable to get output cube attributes. Parameter [" + paramName + "] is not an output. Parameter fileMode = [" + param->fileMode + "]."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } @@ -1981,7 +1978,7 @@ Isis::CubeAttributeOutput &IsisAml::GetOutputAttribute(const string ¶mName) * @throws iException::User (Parameter is not unique) * @throws iException::User (Unknown Parameter) */ -const IsisParameterData *IsisAml::ReturnParam(const string ¶mName) const { +const IsisParameterData *IsisAml::ReturnParam(const QString ¶mName) const { Isis::IString pn = paramName; pn.UpCase(); int found = 0; @@ -1996,7 +1993,7 @@ const IsisParameterData *IsisAml::ReturnParam(const string ¶mName) const { if(cur_pn.find(pn) == 0) { if(cur_pn == pn) { if(exact) { - string message = "Parameter [" + paramName + "] is not unique."; + QString message = "Parameter [" + paramName + "] is not unique."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { @@ -2013,11 +2010,11 @@ const IsisParameterData *IsisAml::ReturnParam(const string ¶mName) const { } } if(param == NULL) { - string message = "Unknown parameter [" + paramName + "]."; + QString message = "Unknown parameter [" + paramName + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if((found > 1) && (!exact)) { - string message = "Parameter [" + paramName + "] is not unique."; + QString message = "Parameter [" + paramName + "] is not unique."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } return param; @@ -2035,7 +2032,7 @@ const IsisParameterData *IsisAml::ReturnParam(const string ¶mName) const { */ void IsisAml::Verify(const IsisParameterData *param) { - // Check to make sure the value string can be converted to the correct type + // Check to make sure the value QString can be converted to the correct type for(unsigned int i = 0; i < param->values.size(); i++) { if(param->type == "integer") { try { @@ -2043,7 +2040,7 @@ void IsisAml::Verify(const IsisParameterData *param) { value.ToInteger(); } catch(Isis::IException &e) { - string message = "Unable to convert [" + param->values[i] + "] to an integer," + QString message = "Unable to convert [" + param->values[i] + "] to an integer," " parameter [" + param->name + "]."; throw Isis::IException(e, Isis::IException::User, message, _FILEINFO_); } @@ -2054,27 +2051,26 @@ void IsisAml::Verify(const IsisParameterData *param) { value.ToDouble(); } catch(Isis::IException &e) { - string message = "Unable to convert [" + param->values[i] + "] to a double," + QString message = "Unable to convert [" + param->values[i] + "] to a double," " parameter [" + param->name + "]."; throw Isis::IException(e, Isis::IException::User, message, _FILEINFO_); } } else if(param->type == "boolean") { - Isis::IString v = param->values[i]; - v.UpCase(); + QString v = param->values[i].toUpper(); try { StringToBool(v); } catch(Isis::IException &e) { - string message = "Illegal value for [" + param->name + "], [" + param->values[i] + "]."; + QString message = "Illegal value for [" + param->name + "], [" + param->values[i] + "]."; throw Isis::IException(e, Isis::IException::User, message, _FILEINFO_); } } else if(param->type == "filename") { // If this is an output file and a file with this name already exists, // check user filename customization preferences. - Isis::IString value(param->values[i]); + QString value(param->values[i]); Isis::FileName name(value); value = name.expanded(); if(name.fileExists() && param->fileMode == "output") { @@ -2090,7 +2086,7 @@ void IsisAml::Verify(const IsisParameterData *param) { // value = name.expanded(); // if (name.Exists() && param->fileMode == "output" // && Isis::Preference::Preferences().FindGroup("CubeCustomization").FindKeyword("Overwrite")[0] == "Error") { - // string message = "Invalid output cube for [" + param->name + "]. The cube file [" + value + "] already exists. " + + // QString message = "Invalid output cube for [" + param->name + "]. The cube file [" + value + "] already exists. " + // "The user preference cube customization group is set to disallow cube overwrites."; // throw Isis::IException(Isis::IException::User, message, _FILEINFO_); // } @@ -2100,7 +2096,7 @@ void IsisAml::Verify(const IsisParameterData *param) { // Check the default values if there were no values if(param->values.size() == 0) { for(unsigned int i = 0; i < param->defaultValues.size(); i++) { - // Check to make sure the DefaultValue string can be converted to the + // Check to make sure the DefaultValue QString can be converted to the // correct type if(param->type == "integer") { try { @@ -2108,7 +2104,7 @@ void IsisAml::Verify(const IsisParameterData *param) { value.ToInteger(); } catch(Isis::IException &e) { - string message = "Unable to convert default [" + param->defaultValues[i] + + QString message = "Unable to convert default [" + param->defaultValues[i] + "] to an integer, parameter [" + param->name + "]."; throw Isis::IException(e, Isis::IException::Programmer, message, _FILEINFO_); } @@ -2119,27 +2115,26 @@ void IsisAml::Verify(const IsisParameterData *param) { value.ToDouble(); } catch(Isis::IException &e) { - string message = "Unable to convert default [" + param->defaultValues[i] + + QString message = "Unable to convert default [" + param->defaultValues[i] + "] to a double, parameter [" + param->name + "]."; throw Isis::IException(e, Isis::IException::Programmer, message, _FILEINFO_); } } else if(param->type == "boolean") { - Isis::IString v = param->defaultValues[i]; - v.UpCase(); + QString v = param->defaultValues[i].toUpper(); try { StringToBool(v); } catch(Isis::IException &e) { - string message = "Illegal default value for [" + param->name + "], [" + QString message = "Illegal default value for [" + param->name + "], [" + param->defaultValues[i] + "]."; throw Isis::IException(e, Isis::IException::User, message, _FILEINFO_); } } else if(param->type == "filename") { // Put something here once we figure out what to do with filenames - Isis::IString value(param->defaultValues[i]); + QString value(param->defaultValues[i]); Isis::FileName name(value); value = name.expanded(); if(name.fileExists() && param->fileMode == "output") { @@ -2163,7 +2158,7 @@ void IsisAml::Verify(const IsisParameterData *param) { if(value == option) { // If we already have one exact match then there is an error if(exact) { - string message = "Duplicate list options [" + + QString message = "Duplicate list options [" + param->listOptions[p].value + "] in parameter [" + param->name + "]."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); @@ -2171,15 +2166,15 @@ void IsisAml::Verify(const IsisParameterData *param) { exact = true; } // Check for a partial match - // Compare the shorter of the two (values[i]) to a substring of the - // longer string (listOptions[p].value) + // Compare the shorter of the two (values[i]) to a subQString of the + // longer QString (listOptions[p].value) else if(option.compare(0, min(value.size(), option.size()), value, 0, min(value.size(), option.size())) == 0) { partial++; } } if(!exact && partial == 0) { - string message = "Value of [" + param->name + "] must be one of [" + + QString message = "Value of [" + param->name + "] must be one of [" + param->listOptions[0].value; for(unsigned int p = 1; p < param->listOptions.size(); p++) { message += ", " + param->listOptions[p].value; @@ -2188,7 +2183,7 @@ void IsisAml::Verify(const IsisParameterData *param) { throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!exact && partial > 1) { - string msg = "Value of [" + param->name + + QString msg = "Value of [" + param->name + "] does not match a list option uniquely."; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } @@ -2197,20 +2192,20 @@ void IsisAml::Verify(const IsisParameterData *param) { // Check the values against the minimum if(param->minimum.length() > 0) { - Isis::IString incl = param->minimum_inclusive; + QString incl = param->minimum_inclusive; for(unsigned int i = 0; i < param->values.size(); i++) { if(param->type == "integer") { - Isis::IString value(param->values[i]); - int temp = value.ToInteger(); + QString value(param->values[i]); + int temp = Isis::toInt(value); value = param->minimum; - int min = value.ToInteger(); + int min = Isis::toInt(value); if(StringToBool(incl) && (temp < min)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than or equal to [" + param->minimum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!StringToBool(incl) && (temp <= min)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than [" + param->minimum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2221,12 +2216,12 @@ void IsisAml::Verify(const IsisParameterData *param) { value = param->minimum; double min = value.ToDouble(); if(StringToBool(incl) && (temp < min)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than or equal to [" + param->minimum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!StringToBool(incl) && (temp <= min)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than [" + param->minimum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2240,12 +2235,12 @@ void IsisAml::Verify(const IsisParameterData *param) { value = param->minimum; int min = value.ToInteger(); if(StringToBool(incl) && (temp < min)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than or equal to [" + param->minimum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!StringToBool(incl) && (temp <= min)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than [" + param->minimum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2256,12 +2251,12 @@ void IsisAml::Verify(const IsisParameterData *param) { value = param->minimum; double min = value.ToDouble(); if(StringToBool(incl) && (temp < min)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than or equal to [" + param->minimum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!StringToBool(incl) && (temp <= min)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than [" + param->minimum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2272,21 +2267,20 @@ void IsisAml::Verify(const IsisParameterData *param) { // Check the values against the maximum if(param->maximum.length() > 0) { - Isis::IString incl = param->maximum_inclusive; - incl.DownCase(); + QString incl = param->maximum_inclusive.toLower(); for(unsigned int i = 0; i < param->values.size(); i++) { if(param->type == "integer") { - Isis::IString value(param->values[i]); - int temp = value.ToInteger(); + QString value(param->values[i]); + int temp = Isis::toInt(value); value = param->maximum; - int max = value.ToInteger(); + int max = Isis::toInt(value); if(StringToBool(incl) && (temp > max)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than or equal to [" + param->maximum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!StringToBool(incl) && (temp >= max)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than [" + param->maximum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2297,12 +2291,12 @@ void IsisAml::Verify(const IsisParameterData *param) { value = param->maximum; double max = value.ToDouble(); if(StringToBool(incl) && (temp > max)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than or equal to [" + param->maximum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!StringToBool(incl) && (temp >= max)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than [" + param->maximum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2316,12 +2310,12 @@ void IsisAml::Verify(const IsisParameterData *param) { value = param->maximum; int max = value.ToInteger(); if(StringToBool(incl) && (temp > max)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than or equal to [" + param->maximum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!StringToBool(incl) && (temp >= max)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than [" + param->maximum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2332,12 +2326,12 @@ void IsisAml::Verify(const IsisParameterData *param) { value = param->maximum; double max = value.ToDouble(); if(StringToBool(incl) && (temp > max)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than or equal to [" + param->maximum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else if(!StringToBool(incl) && (temp >= max)) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than [" + param->maximum + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2347,12 +2341,11 @@ void IsisAml::Verify(const IsisParameterData *param) { } // Check the value for an odd test - Isis::IString odd = param->odd; - odd.DownCase(); + QString odd = param->odd.toLower(); if((odd != "") || StringToBool(odd)) { if(param->type != "integer") { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be of type integer to have an [odd] test."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } @@ -2360,7 +2353,7 @@ void IsisAml::Verify(const IsisParameterData *param) { for(unsigned int i = 0; i < param->values.size(); i++) { Isis::IString value(param->values[i]); if((value.ToInteger() % 2) != 1) { - string message = "Value for [" + param->name + "] must be odd."; + QString message = "Value for [" + param->name + "] must be odd."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } } @@ -2387,20 +2380,17 @@ void IsisAml::Verify(const IsisParameterData *param) { * @internal * @history 2010-07-19 Jeannie Walldren - Original version. */ -void IsisAml::CheckFileNamePreference(string filename, string paramname) { +void IsisAml::CheckFileNamePreference(QString filename, QString paramname) { Isis::PvlGroup fileCustomization = Isis::Preference::Preferences().FindGroup("FileCustomization"); - Isis::IString overwritePreference = fileCustomization.FindKeyword("Overwrite")[0]; - overwritePreference.ConvertWhiteSpace(); - overwritePreference.Compress(); - overwritePreference.Trim(" "); - string temp = overwritePreference; - if(overwritePreference.UpCase() == "ERROR") { - string message = "Invalid output filename for [" + paramname + "]. The file [" + filename + "] already exists. " + + QString overwritePreference = fileCustomization.FindKeyword("Overwrite")[0].simplified().trimmed(); + QString temp = overwritePreference; + if(overwritePreference.toUpper() == "ERROR") { + QString message = "Invalid output filename for [" + paramname + "]. The file [" + filename + "] already exists. " + "The user preference file customization group is set to disallow file overwrites."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } - else if(overwritePreference.UpCase() != "ALLOW") { // not set to ERROR or ALLOW - string message = "Invalid entry in user preference file FileCustomization group."; + else if(overwritePreference.toUpper() != "ALLOW") { // not set to ERROR or ALLOW + QString message = "Invalid entry in user preference file FileCustomization group."; message += " Overwrite = [" + temp + "]. Valid values: [Allow] or [Error]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } @@ -2430,7 +2420,7 @@ void IsisAml::VerifyAll() { if((param2->values.size()) == 0 && (param2->defaultValues.size() == 0) && (param2->internalDefault.size() == 0)) { - string message = "Parameter [" + param2->name + + QString message = "Parameter [" + param2->name + "] must be used if parameter [" + param->name + "] equates to true."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2449,7 +2439,7 @@ void IsisAml::VerifyAll() { if((param->values.size()) == 0 && (param->defaultValues.size() == 0) && (param->internalDefault.size() == 0)) { - string message = "Parameter [" + param2->name + + QString message = "Parameter [" + param2->name + "] must be used if parameter [" + param->name + "] is used."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2463,7 +2453,7 @@ void IsisAml::VerifyAll() { param2->values.size() == 0 && param2->defaultValues.size() == 0 && param2->internalDefault.size() == 0) { - string message = "Parameter [" + param2->name + + QString message = "Parameter [" + param2->name + "] must be used if parameter [" + param->name + "] is used."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2482,7 +2472,7 @@ void IsisAml::VerifyAll() { const IsisParameterData *param2 = ReturnParam(param->exclude[item]); if(param2->values.size() > 0) { - string message = "Parameter [" + param2->name + + QString message = "Parameter [" + param2->name + "] must NOT be used if parameter [" + param->name + "] equates to true."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2497,7 +2487,7 @@ void IsisAml::VerifyAll() { ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) && StringToBool(param2->defaultValues[0]))) { if(param->values.size() > 0) { - string message = "Parameter [" + param2->name + + QString message = "Parameter [" + param2->name + "] must be used if parameter [" + param->name + "] is used."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2507,7 +2497,7 @@ void IsisAml::VerifyAll() { // Neither parameter is a boolean else { if(param->values.size() > 0 && param2->values.size() > 0) { - string message = "Parameter [" + param2->name + + QString message = "Parameter [" + param2->name + "] must NOT be used if parameter [" + param->name + "] is used."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2529,7 +2519,7 @@ void IsisAml::VerifyAll() { double1 = GetDouble(param->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } @@ -2541,13 +2531,13 @@ void IsisAml::VerifyAll() { double2 = GetDouble(param2->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } if(double2 >= double1) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than parameter [" + param2->name + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2570,7 +2560,7 @@ void IsisAml::VerifyAll() { double1 = GetDouble(param->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } @@ -2582,13 +2572,13 @@ void IsisAml::VerifyAll() { double2 = GetDouble(param2->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } if(double2 > double1) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be greater than or equal to parameter [" + param2->name + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2609,7 +2599,7 @@ void IsisAml::VerifyAll() { double1 = GetDouble(param->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } @@ -2621,13 +2611,13 @@ void IsisAml::VerifyAll() { double2 = GetDouble(param2->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } if(double2 <= double1) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than parameter [" + param2->name + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2650,7 +2640,7 @@ void IsisAml::VerifyAll() { double1 = GetDouble(param->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } @@ -2662,13 +2652,13 @@ void IsisAml::VerifyAll() { double2 = GetDouble(param2->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } if(double2 < double1) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must be less than or equal to parameter [" + param2->name + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2690,7 +2680,7 @@ void IsisAml::VerifyAll() { double1 = GetDouble(param->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } @@ -2702,13 +2692,13 @@ void IsisAml::VerifyAll() { double2 = GetDouble(param2->name); } else { - string msg = "Parameter is not INTEGER or DOUBLE type [" + + QString msg = "Parameter is not INTEGER or DOUBLE type [" + param->name + "]"; throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } if(double2 == double1) { - string message = "Parameter [" + param->name + + QString message = "Parameter [" + param->name + "] must NOT be equal to parameter [" + param2->name + "]."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); @@ -2721,25 +2711,25 @@ void IsisAml::VerifyAll() { // the excluded parameter has NO value if(((param->values.size() > 0) || (param->defaultValues.size())) > 0) { for(unsigned int o2 = 0; o2 < param->listOptions.size(); o2++) { - Isis::IString value, option; + QString value, option; if(param->type == "string" || param->type == "combo") { value = GetString(param->name); - value = value.UpCase(); + value = value.toUpper(); option = param->listOptions[o2].value; - option = option.UpCase(); + option = option.toUpper(); } else if(param->type == "integer") { value = GetAsString(param->name); - value = value.Trim("\n\r\t\f\v\b"); + value = value.trimmed(); option = param->listOptions[o2].value; - option = option.Trim("\n\r\t\f\v\b"); + option = option.trimmed(); } if(value == option) { for(unsigned int e2 = 0; e2 < param->listOptions[o2].exclude.size(); e2++) { const IsisParameterData *param2 = ReturnParam(param->listOptions[o2].exclude[e2]); if(param2->values.size() > 0) { - string message = "Parameter [" + param2->name + + QString message = "Parameter [" + param2->name + "] can not be entered if parameter [" + param->name + "] is equal to [" + value + "]"; @@ -2754,18 +2744,18 @@ void IsisAml::VerifyAll() { // the included parameter has a value if(((param->values.size() > 0) || (param->defaultValues.size())) > 0) { for(unsigned int o2 = 0; o2 < param->listOptions.size(); o2++) { - Isis::IString value, option; + QString value, option; if(param->type == "string" || param->type == "combo") { value = GetString(param->name); - value = value.UpCase(); + value = value.toUpper(); option = param->listOptions[o2].value; - option = option.UpCase(); + option = option.toUpper(); } else if(param->type == "integer") { value = GetAsString(param->name); - value = value.Trim("\n\r\t\f\v\b"); + value = value.trimmed(); option = param->listOptions[o2].value; - option = option.Trim("\n\r\t\f\v\b"); + option = option.trimmed(); } if(value == option) { for(unsigned int e2 = 0; e2 < param->listOptions[o2].include.size(); e2++) { @@ -2773,7 +2763,7 @@ void IsisAml::VerifyAll() { ReturnParam(param->listOptions[o2].include[e2]); if((param2->values.size() == 0) && (param2->defaultValues.size() == 0)) { - string message = "Parameter [" + param2->name + + QString message = "Parameter [" + param2->name + "] must be entered if parameter [" + param->name + "] is equal to [" + value + "]"; @@ -2800,7 +2790,7 @@ void IsisAml::VerifyAll() { for(unsigned int e2 = 0; e2 < groups[g2].parameters[p2].listOptions[o2].exclude.size(); e2++) { - string excl = + QString excl = this->groups[g2].parameters[p2].listOptions[o2].exclude[e2]; if(excl == param->name) { excluded = true; @@ -2816,7 +2806,7 @@ void IsisAml::VerifyAll() { !StringToBool(param2->defaultValues[0]))) { for(unsigned int e2 = 0; e2 < groups[g2].parameters[p2].include.size(); e2++) { - string incl = + QString incl = this->groups[g2].parameters[p2].include[e2]; if(incl == param->name) { excluded = true; @@ -2828,7 +2818,7 @@ void IsisAml::VerifyAll() { StringToBool(param2->defaultValues[0]))) { for(unsigned int e2 = 0; e2 < groups[g2].parameters[p2].exclude.size(); e2++) { - string excl = + QString excl = this->groups[g2].parameters[p2].exclude[e2]; if(excl == param->name) { excluded = true; @@ -2873,7 +2863,7 @@ void IsisAml::VerifyAll() { } if(!excluded) { - string message = "Parameter [" + param->name + "] must be entered."; + QString message = "Parameter [" + param->name + "] must be entered."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } } @@ -2882,17 +2872,17 @@ void IsisAml::VerifyAll() { } /** - * Returns a boolean value based on the string contents + * Returns a boolean value based on the QString contents * * @param value The value to convert to a boolean * - * @return boolean value based on string contents + * @return boolean value based on QString contents * * @throws iException::Programmer (Invalid boolean value) */ -bool IsisAml::StringToBool(Isis::IString value) const { +bool IsisAml::StringToBool(QString value) const { - value.UpCase(); + value = value.toUpper(); if(value == "") { return false; } @@ -2921,7 +2911,7 @@ bool IsisAml::StringToBool(Isis::IString value) const { return true; } else { - string message = "Invalid boolean value [" + value + "]."; + QString message = "Invalid boolean value [" + value + "]."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } return false; @@ -2929,7 +2919,7 @@ bool IsisAml::StringToBool(Isis::IString value) const { /** - * Creates a string which could be used as a command line + * Creates a QString which could be used as a command line * * @param cont Pvl to put command line information in */ @@ -3010,8 +3000,8 @@ void IsisAml::CommandLine(Isis::Pvl &cont) const { * * @return The application version date */ -string IsisAml::Version() const { - string st = "000-00-00"; +QString IsisAml::Version() const { + QString st = "000-00-00"; for(unsigned int i = 0; i < changes.size(); i++) { if(changes[i].date > st) st = changes[i].date; } @@ -3034,8 +3024,8 @@ void IsisAml::StartParser(const char *xmlfile) { } catch(const XERCES::XMLException &toCatch) { - string message = "Error during XML parser initialization" + - (string)XERCES::XMLString::transcode(toCatch.getMessage()); + QString message = "Error during XML parser initialization" + + (QString)XERCES::XMLString::transcode(toCatch.getMessage()); throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); return; } @@ -3078,8 +3068,8 @@ void IsisAml::StartParser(const char *xmlfile) { parser->parse(xmlfile); } catch(const XERCES::XMLException &toCatch) { - string message = "Error in application XML file: " + - (string)XERCES::XMLString::transcode(toCatch.getMessage()); + QString message = "Error in application XML file: " + + (QString)XERCES::XMLString::transcode(toCatch.getMessage()); throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); XERCES::XMLPlatformUtils::Terminate(); return; diff --git a/isis/src/base/objs/IsisAml/IsisAml.h b/isis/src/base/objs/IsisAml/IsisAml.h index 94e17d14e3..f04916cb97 100644 --- a/isis/src/base/objs/IsisAml/IsisAml.h +++ b/isis/src/base/objs/IsisAml/IsisAml.h @@ -27,16 +27,15 @@ #include #include +#include + #include #include "IsisXMLApplication.h" #include "IsisAmlData.h" -#include "IString.h" #include "Pvl.h" -namespace Isis { - class IString; -} +class QString; /** * @brief Application program XML file parameter manager. @@ -152,7 +151,7 @@ class IsisAml : protected IsisAmlData { // Public section public: - IsisAml(const std::string &xmlfile); + IsisAml(const QString &xmlfile); ~IsisAml(); @@ -160,84 +159,84 @@ class IsisAml : protected IsisAmlData { // Methods for searching and retrieving application info // via the parameter name - void PutAsString(const std::string ¶mName, const std::string &value); - void PutAsString(const std::string ¶mName, const std::vector &value); + void PutAsString(const QString ¶mName, const QString &value); + void PutAsString(const QString ¶mName, const std::vector &value); - void PutFileName(const std::string ¶mName, const std::string &value); - void PutFileName(const std::string ¶mName, const std::vector &value); + void PutFileName(const QString ¶mName, const QString &value); + void PutFileName(const QString ¶mName, const std::vector &value); - void PutDouble(const std::string ¶mName, const double &value); - void PutDouble(const std::string ¶mName, const std::vector &value); + void PutDouble(const QString ¶mName, const double &value); + void PutDouble(const QString ¶mName, const std::vector &value); - void PutInteger(const std::string ¶mName, const int &value); - void PutInteger(const std::string ¶mName, const std::vector &value); + void PutInteger(const QString ¶mName, const int &value); + void PutInteger(const QString ¶mName, const std::vector &value); - void PutBoolean(const std::string ¶mName, const bool &value); - void PutBoolean(const std::string ¶mName, const std::vector &value); + void PutBoolean(const QString ¶mName, const bool &value); + void PutBoolean(const QString ¶mName, const std::vector &value); - void PutString(const std::string ¶mName, const std::string &value); - void PutString(const std::string ¶mName, const std::vector &value); + void PutString(const QString ¶mName, const QString &value); + void PutString(const QString ¶mName, const std::vector &value); - std::string GetAsString(const std::string ¶mName) const; - void GetAsString(const std::string ¶mName, std::vector &values) const; + QString GetAsString(const QString ¶mName) const; + void GetAsString(const QString ¶mName, std::vector &values) const; - Isis::IString GetFileName(const std::string ¶mName, std::string extension = "") const; - void GetFileName(const std::string ¶mName, std::vector &values) const; + QString GetFileName(const QString ¶mName, QString extension = "") const; + void GetFileName(const QString ¶mName, std::vector &values) const; - std::string GetString(const std::string ¶mName) const; - void GetString(const std::string ¶mName, std::vector &values) const; + QString GetString(const QString ¶mName) const; + void GetString(const QString ¶mName, std::vector &values) const; - int GetInteger(const std::string ¶mName) const; - void GetInteger(const std::string ¶mName, std::vector &values) const; + int GetInteger(const QString ¶mName) const; + void GetInteger(const QString ¶mName, std::vector &values) const; - bool GetBoolean(const std::string ¶mName) const; + bool GetBoolean(const QString ¶mName) const; - void GetBoolean(const std::string ¶mName, std::vector &values) const; + void GetBoolean(const QString ¶mName, std::vector &values) const; - double GetDouble(const std::string ¶mName) const; - void GetDouble(const std::string ¶mName, std::vector &values) const; + double GetDouble(const QString ¶mName) const; + void GetDouble(const QString ¶mName, std::vector &values) const; - bool WasEntered(const std::string ¶mName) const; - void Clear(const std::string ¶mName); + bool WasEntered(const QString ¶mName) const; + void Clear(const QString ¶mName); - Isis::CubeAttributeInput &GetInputAttribute(const std::string ¶mName); - Isis::CubeAttributeOutput &GetOutputAttribute(const std::string ¶mName); + Isis::CubeAttributeInput &GetInputAttribute(const QString ¶mName); + Isis::CubeAttributeOutput &GetOutputAttribute(const QString ¶mName); // Methods for retrieving application info not inside a group - std::string ProgramName() const; - std::string Brief() const; - std::string Description() const; + QString ProgramName() const; + QString Brief() const; + QString Description() const; // Methods for searching and retrieving application info // via the index into groups and parameters int NumGroups() const; - std::string GroupName(const int &group) const; + QString GroupName(const int &group) const; //! Given the group name get its index in group array - int GroupIndex(const std::string & grpName) const; + int GroupIndex(const QString & grpName) const; int NumParams(const int &) const; - std::string ParamName(const int &group, const int ¶m) const; + QString ParamName(const int &group, const int ¶m) const; - std::string ParamType(const int &group, const int ¶m) const; + QString ParamType(const int &group, const int ¶m) const; - std::string ParamBrief(const int &group, const int ¶m) const; + QString ParamBrief(const int &group, const int ¶m) const; - std::string ParamDescription(const int &group, const int ¶m) const; + QString ParamDescription(const int &group, const int ¶m) const; - std::string ParamMinimum(const int &group, const int ¶m) const; + QString ParamMinimum(const int &group, const int ¶m) const; - std::string ParamMinimumInclusive(const int &group, const int ¶m) const; + QString ParamMinimumInclusive(const int &group, const int ¶m) const; - std::string ParamMaximum(const int &group, const int ¶m) const; + QString ParamMaximum(const int &group, const int ¶m) const; - std::string ParamMaximumInclusive(const int &group, const int ¶m) const; + QString ParamMaximumInclusive(const int &group, const int ¶m) const; - std::string ParamOdd(const int &group, const int ¶m) const; + QString ParamOdd(const int &group, const int ¶m) const; int ParamGreaterThanSize(const int &group, const int ¶m) const; @@ -249,102 +248,102 @@ class IsisAml : protected IsisAmlData { int ParamNotEqualSize(const int &group, const int ¶m) const; - std::string ParamGreaterThan(const int &group, const int ¶m, + QString ParamGreaterThan(const int &group, const int ¶m, const int &great) const; - std::string ParamGreaterThanOrEqual(const int &group, const int ¶m, + QString ParamGreaterThanOrEqual(const int &group, const int ¶m, const int &great) const; - std::string ParamLessThan(const int &group, const int ¶m, + QString ParamLessThan(const int &group, const int ¶m, const int &great) const; - std::string ParamLessThanOrEqual(const int &group, const int ¶m, + QString ParamLessThanOrEqual(const int &group, const int ¶m, const int &les) const; - std::string ParamNotEqual(const int &group, const int ¶m, + QString ParamNotEqual(const int &group, const int ¶m, const int ¬Eq) const; int ParamListSize(const int &group, const int ¶m) const; - std::string ParamListValue(const int &group, const int ¶m, + QString ParamListValue(const int &group, const int ¶m, const int &option) const; - std::string ParamListBrief(const int &group, const int ¶m, + QString ParamListBrief(const int &group, const int ¶m, const int &option) const; - std::string ParamListDescription(const int &group, const int ¶m, + QString ParamListDescription(const int &group, const int ¶m, const int &option) const; int ParamListExcludeSize(const int &group, const int ¶m, const int &option) const; - std::string ParamListExclude(const int &group, const int ¶m, + QString ParamListExclude(const int &group, const int ¶m, const int &option, const int &exclude) const; int ParamListIncludeSize(const int &group, const int ¶m, const int &option) const; - std::string ParamListInclude(const int &group, const int ¶m, + QString ParamListInclude(const int &group, const int ¶m, const int &option, const int &include) const; - std::string ParamDefault(const int &group, const int ¶m) const; + QString ParamDefault(const int &group, const int ¶m) const; - std::string ParamInternalDefault(const int &group, const int ¶m) const; + QString ParamInternalDefault(const int &group, const int ¶m) const; - std::string ParamFilter(const int &group, const int ¶m) const; + QString ParamFilter(const int &group, const int ¶m) const; - std::string ParamPath(const int &group, const int ¶m) const; + QString ParamPath(const int &group, const int ¶m) const; - std::string ParamFileMode(const int &group, const int ¶m) const; + QString ParamFileMode(const int &group, const int ¶m) const; int ParamExcludeSize(const int &group, const int ¶m) const; - std::string ParamExclude(const int &group, const int ¶m, + QString ParamExclude(const int &group, const int ¶m, const int &exclude) const; int ParamIncludeSize(const int &group, const int ¶m) const; - std::string ParamInclude(const int &group, const int ¶m, + QString ParamInclude(const int &group, const int ¶m, const int &include) const; - std::string PixelType(const int &group, const int ¶m) const; + QString PixelType(const int &group, const int ¶m) const; int HelpersSize(const int &group, const int ¶m) const; - std::string HelperButtonName(const int &group, const int ¶m, + QString HelperButtonName(const int &group, const int ¶m, const int &helper) const; - std::string HelperFunction(const int &group, const int ¶m, + QString HelperFunction(const int &group, const int ¶m, const int &helper) const; - std::string HelperBrief(const int &group, const int ¶m, + QString HelperBrief(const int &group, const int ¶m, const int &helper) const; - std::string HelperDescription(const int &group, const int ¶m, + QString HelperDescription(const int &group, const int ¶m, const int &helper) const; - std::string HelperIcon(const int &group, const int ¶m, + QString HelperIcon(const int &group, const int ¶m, const int &helper) const; //! Verify whether Parameter name is in the Include list //! Used in creation of DefFile - bool IsParamInPvlInclude(std::string & paramName, std::vector & exclude); + bool IsParamInPvlInclude(QString & paramName, std::vector & exclude); //! Create Pvl with the parameters in a user defined group given the Pvl object and group name - void CreatePVL(Isis::Pvl &pvlDef , std::string guiGrpName, std::string pvlObjName, - std::string pvlGrpName, std::vector & exclude); + void CreatePVL(Isis::Pvl &pvlDef , QString guiGrpName, QString pvlObjName, + QString pvlGrpName, std::vector & exclude); // Test all parameters for valid values and conditions void VerifyAll(); - bool StringToBool(Isis::IString value) const; + bool StringToBool(QString value) const; void CommandLine(Isis::Pvl &lab) const; - std::string Version() const; + QString Version() const; protected: - const IsisParameterData *ReturnParam(const std::string ¶mName) const; + const IsisParameterData *ReturnParam(const QString ¶mName) const; private: @@ -359,7 +358,7 @@ class IsisAml : protected IsisAmlData { void Verify(const IsisParameterData *param); - void CheckFileNamePreference(std::string filename, std::string paramname); + void CheckFileNamePreference(QString filename, QString paramname); }; diff --git a/isis/src/base/objs/IsisAml/IsisAml.truth b/isis/src/base/objs/IsisAml/IsisAml.truth index e2dddffd24..798250de96 100644 --- a/isis/src/base/objs/IsisAml/IsisAml.truth +++ b/isis/src/base/objs/IsisAml/IsisAml.truth @@ -7,7 +7,7 @@ Create the aml object parameter 0, name = G0p0 type = filename brief = G0P0 Filename - description = Description for G0P0

Paragraph 2 of description for G0P0

End of description for G0P0 + description = Description for G0P0

Paragraph 2 of description for G0P0

End of description for G0P0 internal def = helpers = 0 count = @@ -1497,7 +1497,7 @@ Exact and partial name match tests: GetBoolean: **USER ERROR** Parameter [G6P0] has no value. -**PROGRAMMER ERROR** Invalid boolean value [CCCC]. +**ERROR** Failed to convert string [cccc] to a boolean. Please specify one of [1, on, t, true, y, yes] for true, or one of [0, f, false, n, no, off] for false. **PROGRAMMER ERROR** Parameter [G1P1] is not a boolean. diff --git a/isis/src/base/objs/IsisAml/IsisAmlData.cpp b/isis/src/base/objs/IsisAml/IsisAmlData.cpp index 91392c14e1..ebdb38db78 100644 --- a/isis/src/base/objs/IsisAml/IsisAmlData.cpp +++ b/isis/src/base/objs/IsisAml/IsisAmlData.cpp @@ -28,11 +28,6 @@ using namespace std; // Constructors IsisAmlData::IsisAmlData() { - name.erase(); - brief.erase(); - description.erase(); - groups.clear(); - categorys.clear(); } IsisAmlData::~IsisAmlData() { @@ -41,11 +36,6 @@ IsisAmlData::~IsisAmlData() { // Helper classes IsisHelperData::IsisHelperData() { - name.erase(); - icon.erase(); - brief.erase(); - description.erase(); - function.erase(); } IsisHelperData::~IsisHelperData() { @@ -53,7 +43,6 @@ IsisHelperData::~IsisHelperData() { IsisGroupData::IsisGroupData() { - name.erase(); } IsisGroupData::~IsisGroupData() { @@ -61,29 +50,6 @@ IsisGroupData::~IsisGroupData() { IsisParameterData::IsisParameterData() { - values.clear(); - name.erase(); - brief.erase(); - description.erase(); - type.erase(); - internalDefault.erase(); - count.erase(); - defaultValues.clear(); - exclude.clear(); - include.clear(); - filter.erase(); - greaterThan.clear(); - greaterThanOrEqual.clear(); - lessThan.clear(); - lessThanOrEqual.clear(); - internalDefault.erase(); - notEqual.clear(); - maximum.erase(); - maximum_inclusive.erase(); - minimum.erase(); - minimum_inclusive.erase(); - odd.erase(); - helpers.clear(); } IsisParameterData::~IsisParameterData() { @@ -91,10 +57,6 @@ IsisParameterData::~IsisParameterData() { IsisListOptionData::IsisListOptionData() { - value.erase(); - brief.erase(); - description.erase(); - exclude.clear(); } IsisListOptionData::~IsisListOptionData() { @@ -102,9 +64,6 @@ IsisListOptionData::~IsisListOptionData() { IsisChangeData::IsisChangeData() { - name.erase(); - date.erase(); - description.erase(); } IsisChangeData::~IsisChangeData() { diff --git a/isis/src/base/objs/IsisAml/IsisAmlData.h b/isis/src/base/objs/IsisAml/IsisAmlData.h index d52b611244..7e9ab73157 100644 --- a/isis/src/base/objs/IsisAml/IsisAmlData.h +++ b/isis/src/base/objs/IsisAml/IsisAmlData.h @@ -36,11 +36,11 @@ */ class IsisListOptionData { public: - std::string value; - std::string brief; - std::string description; - std::vector exclude; - std::vector include; + QString value; + QString brief; + QString description; + std::vector exclude; + std::vector include; IsisListOptionData(); ~IsisListOptionData(); @@ -53,11 +53,11 @@ class IsisListOptionData { */ class IsisHelperData { public: - std::string name; - std::string icon; - std::string brief; - std::string description; - std::string function; + QString name; + QString icon; + QString brief; + QString description; + QString function; IsisHelperData(); ~IsisHelperData(); @@ -70,33 +70,33 @@ class IsisHelperData { */ class IsisParameterData { public: - std::vector values; - std::string name; - std::string brief; - std::string description; - std::string type; - std::vector defaultValues; - std::string internalDefault; - std::string count; + std::vector values; + QString name; + QString brief; + QString description; + QString type; + std::vector defaultValues; + QString internalDefault; + QString count; std::vector listOptions; - std::string minimum_inclusive; - std::string minimum; - std::string maximum_inclusive; - std::string maximum; - std::vector greaterThan; - std::vector greaterThanOrEqual; - std::vector lessThan; - std::vector lessThanOrEqual; - std::vector notEqual; - std::vector exclude; - std::vector include; - std::string odd; - std::string filter; - std::string path; - std::string fileMode; + QString minimum_inclusive; + QString minimum; + QString maximum_inclusive; + QString maximum; + std::vector greaterThan; + std::vector greaterThanOrEqual; + std::vector lessThan; + std::vector lessThanOrEqual; + std::vector notEqual; + std::vector exclude; + std::vector include; + QString odd; + QString filter; + QString path; + QString fileMode; Isis::CubeAttributeOutput outCubeAtt; Isis::CubeAttributeInput inCubeAtt; - std::string pixelType; + QString pixelType; std::vector helpers; IsisParameterData(); @@ -111,7 +111,7 @@ class IsisParameterData { */ class IsisGroupData { public: - std::string name; + QString name; std::vector parameters; IsisGroupData(); @@ -125,9 +125,9 @@ class IsisGroupData { */ class IsisChangeData { public: - std::string name; - std::string date; - std::string description; + QString name; + QString date; + QString description; IsisChangeData(); ~IsisChangeData(); @@ -141,11 +141,11 @@ class IsisChangeData { */ class IsisAmlData { public: - std::string name; - std::string brief; - std::string description; + QString name; + QString brief; + QString description; std::vector groups; - std::vector categorys; + std::vector categorys; std::vector changes; IsisAmlData(); diff --git a/isis/src/base/objs/IsisAml/IsisXMLApplication.cpp b/isis/src/base/objs/IsisAml/IsisXMLApplication.cpp index b3cdc011a7..ec4d102ab3 100644 --- a/isis/src/base/objs/IsisAml/IsisXMLApplication.cpp +++ b/isis/src/base/objs/IsisAml/IsisXMLApplication.cpp @@ -96,8 +96,8 @@ void IsisXMLApplication::startElement(const XMLCh *const uri, const XERCES::Attributes &attributes) { if((string)XERCES::XMLString::transcode(localname) == (string)"application") { - Isis::IString name = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); - appData->name = name.DownCase(); + QString name = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); + appData->name = name.toLower(); } else if((string)XERCES::XMLString::transcode(localname) == (string)"brief") { if(briefHandler != NULL) { diff --git a/isis/src/base/objs/IsisAml/IsisXMLGroup.cpp b/isis/src/base/objs/IsisAml/IsisXMLGroup.cpp index 4191ebd67d..028c6eaa5a 100644 --- a/isis/src/base/objs/IsisAml/IsisXMLGroup.cpp +++ b/isis/src/base/objs/IsisAml/IsisXMLGroup.cpp @@ -90,7 +90,7 @@ void IsisXMLGroup::startElement(const XMLCh *const uri, } unsigned int index = group->parameters.size(); group->parameters.resize(index + 1); - Isis::IString name = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); + QString name = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); // Taken out after PVL refactor name.UpCase(); group->parameters[index].name = name; parameterHandler = new IsisXMLParameter(encodingName, expandNamespaces, diff --git a/isis/src/base/objs/IsisAml/IsisXMLHandler.cpp b/isis/src/base/objs/IsisAml/IsisXMLHandler.cpp index 32d89f7cc2..5cd2763255 100644 --- a/isis/src/base/objs/IsisAml/IsisXMLHandler.cpp +++ b/isis/src/base/objs/IsisAml/IsisXMLHandler.cpp @@ -51,7 +51,7 @@ IsisXMLHandler::IsisXMLHandler() { IsisXMLHandler::IsisXMLHandler(char *PencodingName, bool &PexpandNamespaces, XERCES::SAX2XMLReader* &Pparser, - std::string *Pvalue) { + QString *Pvalue) { encodingName = PencodingName; expandNamespaces = PexpandNamespaces; @@ -121,9 +121,9 @@ void IsisXMLHandler::characters(const XMLCh *const chars, const XMLSize_t length) { if(value != NULL) { - Isis::IString str; - str = (string)XERCES::XMLString::transcode(chars); - str.Trim(" \n\r"); + QString str; + str = XERCES::XMLString::transcode(chars); + str = str.trimmed(); *value += str; } } @@ -138,8 +138,8 @@ void IsisXMLHandler::endElement(const XMLCh *const uri, const XMLCh *const qname) { if(outputEndTag > 0) { - Isis::IString str; - str = (string)XERCES::XMLString::transcode(localname); + QString str; + str = XERCES::XMLString::transcode(localname); *value += ""; outputEndTag--; } @@ -171,8 +171,8 @@ void IsisXMLHandler::startElement(const XMLCh *const uri, const XERCES::Attributes &attributes) { if(value != NULL) { - Isis::IString str; - str = (string)XERCES::XMLString::transcode(localname); + QString str; + str = XERCES::XMLString::transcode(localname); // Note: need to build the attributes into the string too *value += "<" + str + ">"; outputEndTag++; diff --git a/isis/src/base/objs/IsisAml/IsisXMLHandler.h b/isis/src/base/objs/IsisAml/IsisXMLHandler.h index 5246d94393..2637cc95b9 100644 --- a/isis/src/base/objs/IsisAml/IsisXMLHandler.h +++ b/isis/src/base/objs/IsisAml/IsisXMLHandler.h @@ -44,7 +44,7 @@ class IsisXMLHandler : public XERCES::DefaultHandler { IsisXMLHandler(char *PencodingName, bool &PexpandNamespaces, XERCES::SAX2XMLReader* &Pparser, - std::string *chars); + QString *chars); IsisXMLHandler(char *PencodingName, bool &PexpandNamespaces, @@ -87,7 +87,7 @@ class IsisXMLHandler : public XERCES::DefaultHandler { char *encodingName; bool expandNamespaces; XERCES::SAX2XMLReader *parser; - std::string *value; + QString *value; int outputEndTag; }; diff --git a/isis/src/base/objs/IsisAml/IsisXMLMultipleValues.cpp b/isis/src/base/objs/IsisAml/IsisXMLMultipleValues.cpp index 99ba2bf760..e4f0a17f21 100644 --- a/isis/src/base/objs/IsisAml/IsisXMLMultipleValues.cpp +++ b/isis/src/base/objs/IsisAml/IsisXMLMultipleValues.cpp @@ -36,7 +36,7 @@ using namespace std; IsisXMLMultipleValues::IsisXMLMultipleValues(char *PencodingName, bool &PexpandNamespaces, XERCES::SAX2XMLReader* &Pparser, - std::vector *PmultipleValues) { + std::vector *PmultipleValues) { encodingName = PencodingName; expandNamespaces = PexpandNamespaces; diff --git a/isis/src/base/objs/IsisAml/IsisXMLMultipleValues.h b/isis/src/base/objs/IsisAml/IsisXMLMultipleValues.h index 7e6473d4ba..e7555055b1 100644 --- a/isis/src/base/objs/IsisAml/IsisXMLMultipleValues.h +++ b/isis/src/base/objs/IsisAml/IsisXMLMultipleValues.h @@ -45,7 +45,7 @@ class IsisXMLMultipleValues : public IsisXMLHandler { IsisXMLMultipleValues(char *PencodingName, bool &PexpandNamespaces, XERCES::SAX2XMLReader* &Pparser, - std::vector *PmultipleValues); + std::vector *PmultipleValues); ~IsisXMLMultipleValues(); @@ -69,7 +69,7 @@ class IsisXMLMultipleValues : public IsisXMLHandler { char *encodingName; bool expandNamespaces; XERCES::SAX2XMLReader *parser; - std::vector *multipleValues; + std::vector *multipleValues; // Handlers this handler knows how to create IsisXMLHandler *generalHandler; diff --git a/isis/src/base/objs/IsisAml/IsisXMLParameter.cpp b/isis/src/base/objs/IsisAml/IsisXMLParameter.cpp index 345c2c4eb2..cdf2098886 100644 --- a/isis/src/base/objs/IsisAml/IsisXMLParameter.cpp +++ b/isis/src/base/objs/IsisAml/IsisXMLParameter.cpp @@ -159,8 +159,8 @@ void IsisXMLParameter::startElement(const XMLCh *const uri, } unsigned int index = parameter->listOptions.size(); parameter->listOptions.resize(index + 1); - Isis::IString lo = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); - lo.UpCase(); + QString lo = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); + lo = lo.toUpper(); parameter->listOptions[index].value = lo; listHandler = new IsisXMLList(encodingName, expandNamespaces, parser, ¶meter->listOptions[index]); @@ -170,9 +170,8 @@ void IsisXMLParameter::startElement(const XMLCh *const uri, delete generalHandler; generalHandler = NULL; } - Isis::IString mi = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); - mi.DownCase(); - parameter->minimum_inclusive = mi; + QString mi = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); + parameter->minimum_inclusive = mi.toLower(); generalHandler = new IsisXMLHandler(encodingName, expandNamespaces, parser, ¶meter->minimum); } @@ -181,9 +180,8 @@ void IsisXMLParameter::startElement(const XMLCh *const uri, delete generalHandler; generalHandler = NULL; } - Isis::IString mi = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); - mi.DownCase(); - parameter->maximum_inclusive = mi; + QString mi = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0)); + parameter->maximum_inclusive = mi.toLower(); generalHandler = new IsisXMLHandler(encodingName, expandNamespaces, parser, ¶meter->maximum); } diff --git a/isis/src/base/objs/IsisAml/unitTest.cpp b/isis/src/base/objs/IsisAml/unitTest.cpp index 018e6e5f78..347bea6a3e 100644 --- a/isis/src/base/objs/IsisAml/unitTest.cpp +++ b/isis/src/base/objs/IsisAml/unitTest.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include "IsisAml.h" @@ -11,10 +11,10 @@ #include "TextFile.h" +using namespace Isis; using namespace std; - -void ReportError(Isis::IString err); +void ReportError(QString err); class Inheritor : public IsisAml { public: @@ -154,22 +154,22 @@ Inheritor::Inheritor(const char *xmlfile): IsisAml(xmlfile) { } } } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } } int main(void) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); // Create the aml object cout << "Create the aml object" << endl; Inheritor *aml; - string xmlFile = Isis::FileName("./unitTest.xml").expanded(); + QString xmlFile = FileName("./unitTest.xml").expanded(); try { - aml = new Inheritor(xmlFile.c_str()); + aml = new Inheritor(xmlFile.toAscii().data()); } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); exit(1); } @@ -316,7 +316,7 @@ int main(void) { cout << " FR's value = " << aml->GetString("fr") << endl; cout << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } cout << endl; @@ -331,7 +331,7 @@ int main(void) { aml->PutAsString("G1P0", "11111"); aml->PutAsString("G1P0", "22222"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G1P0"); @@ -341,7 +341,7 @@ int main(void) { aml->PutString("G1P0", "G1P0L0"); aml->PutString("G1P0", "22222"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G1P0"); @@ -349,7 +349,7 @@ int main(void) { try { // PARAMETER NOT STRING aml->PutString("G2P4", "xxxxxx"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -358,7 +358,7 @@ int main(void) { aml->PutFileName("G0P0", "xxxxxxx"); aml->PutFileName("G0P0", "yyyyyyy"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G0P0"); @@ -366,7 +366,7 @@ int main(void) { try { // PARAMETER NOT FILENAME aml->PutFileName("G2P4", "xxxxxx"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -374,23 +374,23 @@ int main(void) { try { // UNABLE TO GET INPUT CUBE ATTRIBUTES aml->PutFileName("CUBE2", "xxxxxxx.cub+1,2-4"); - Isis::CubeAttributeInput &att = aml->GetInputAttribute("CUBE2"); + CubeAttributeInput &att = aml->GetInputAttribute("CUBE2"); cout << " " << att.toString() << endl; } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("CUBE2"); try { // UNABLE TO GET OUTPUT CUBE ATTRIBUTES aml->PutFileName("CUBE1", "yyyyyyy.cub+8-bit+BSQ+detached"); - Isis::CubeAttributeOutput &att = aml->GetOutputAttribute("CUBE1"); - string strng = att.toString(); - cout << " Att string = " << strng << endl; + CubeAttributeOutput &att = aml->GetOutputAttribute("CUBE1"); + QString strng = att.toString(); + cout << " Att QString = " << strng << endl; cout << " File format = " << att.fileFormatString() << endl; - cout << " Pixel type = " << Isis::PixelTypeName(att.pixelType()) << endl; + cout << " Pixel type = " << PixelTypeName(att.pixelType()) << endl; } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("CUBE1"); @@ -400,7 +400,7 @@ int main(void) { aml->PutInteger("G6P2", 1); aml->PutInteger("G6P2", 1); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G6P2"); @@ -408,7 +408,7 @@ int main(void) { try { // PARAMETER NOT INTEGER aml->PutInteger("G6P0", 1); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -417,7 +417,7 @@ int main(void) { aml->PutDouble("G1P2", 1.0); aml->PutDouble("G1P2", 1.0); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G1P2"); @@ -425,7 +425,7 @@ int main(void) { try { // PARAMETER NOT DOUBLE aml->PutDouble("G0P0", 1.0); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -435,7 +435,7 @@ int main(void) { aml->PutBoolean("G6P0", true); aml->PutBoolean("G6P0", false); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G6P0"); @@ -443,65 +443,65 @@ int main(void) { try { // PARAMETER NOT BOOLEAN aml->PutBoolean("G0P0", false); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } cout << " GetAsString:" << endl; try { // PARAMETER HAS NO VALUE - string s = aml->GetAsString("G2P0"); + QString s = aml->GetAsString("G2P0"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } cout << " GetFileName:" << endl; try { // PARAMETER HAS NO VALUE - string s = aml->GetFileName("G0P0"); + QString s = aml->GetFileName("G0P0"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } try { // PARAMETER NOT FILENAME - string s = aml->GetFileName("G2P4"); + QString s = aml->GetFileName("G2P4"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } #if 0 cout << " GetCube:" << endl; try { - string s = aml->GetCube("CUBE1"); + QString s = aml->GetCube("CUBE1"); } - catch(Isis::IException &error) { - ReportError(Isis::IString(error.Errors())); + catch(IException &error) { + ReportError(IString(error.Errors())); error.Clear(); } cout << endl; try { - string s = aml->GetCube("G2P4"); + QString s = aml->GetCube("G2P4"); } - catch(Isis::IException &error) { - ReportError(Isis::IString(error.Errors())); + catch(IException &error) { + ReportError(IString(error.Errors())); error.Clear(); } #endif cout << " GetString:" << endl; try { // PARAMETER HAS NO VALUE - string s = aml->GetString("G6P3"); + QString s = aml->GetString("G6P3"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } try { // PARAMETER NOT STRING - string s = aml->GetString("G2P4"); + QString s = aml->GetString("G2P4"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -509,14 +509,14 @@ int main(void) { try { // PARAMETER HAS NO VALUE aml->GetInteger("G2P0"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } try { // PARAMETER NOT INTEGER aml->GetInteger("G0P0"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -524,14 +524,14 @@ int main(void) { try { // PARAMETER HAS NO VALUE aml->GetDouble("G1P3"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } try { // PARAMETER NOT DOUBLE aml->GetDouble("G0P1"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -539,7 +539,7 @@ int main(void) { try { // PARAMETER HAS NO VALUE aml->GetBoolean("G6P0"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -547,7 +547,7 @@ int main(void) { aml->PutAsString("G6P0", "cccc"); aml->GetBoolean("G6P0"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G6P0"); @@ -555,19 +555,19 @@ int main(void) { try { // PARAMETER NOT BOOLEAN aml->GetBoolean("G1P1"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } try { // PARAMETER NOT UNIQUE - string s = aml->GetString("F"); + QString s = aml->GetString("F"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } // Load up a valid set of parameters @@ -675,7 +675,7 @@ int main(void) { try { aml->VerifyAll(); } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } cout << endl; @@ -683,11 +683,11 @@ int main(void) { // Test the command line member cout << "The current command line:" << endl; try { - Isis::Pvl lab; + Pvl lab; aml->CommandLine(lab); cout << lab << endl << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } @@ -700,7 +700,7 @@ int main(void) { try { // PARAMETER MUST BE ENTERED IF OTHER PARAMETER HAS PARTICULAR VALUE aml->VerifyAll(); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G1P0"); @@ -712,7 +712,7 @@ int main(void) { try { // PARAMETER CAN NOT BE ENTERED IF OTHER PARAMETER HAS PARTICULAR VALUE aml->VerifyAll(); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } aml->Clear("G2P0"); @@ -721,22 +721,22 @@ int main(void) { try { // UNKNOWN PARAMETER aml->Clear("xyz"); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } cout << "---------- Check errors for user file overwrite preferences ----------" << endl; // Create a file - string testFile = "junk.txt"; - string lines[3]; + QString testFile = "junk.txt"; + QString lines[3]; lines[0] = "1"; - vector strvect; + vector strvect; strvect.push_back(lines[0]); - Isis::TextFile f1(testFile, "overwrite", strvect); + TextFile f1(testFile, "overwrite", strvect); aml->Clear("G0P1"); // set output parameter to equal existing file aml->PutAsString("G0P1", "junk.txt"); - Isis::Preference &testpref = Isis::Preference::Preferences(); + Preference &testpref = Preference::Preferences(); try { // FILE OVERWRITE NOT ALLOWED @@ -744,7 +744,7 @@ int main(void) { cout << " Overwrite not allowed:" << endl; aml->VerifyAll(); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } @@ -753,7 +753,7 @@ int main(void) { cout << " Invalid Overwrite preference value:" << endl; aml->VerifyAll(); } - catch(Isis::IException &error) { + catch(IException &error) { ReportError(error.toString()); } remove("junk.txt"); @@ -766,41 +766,7 @@ int main(void) { * @internal * @history 2010-07-26 Jeannie Walldren - Original version. */ -void ReportError(Isis::IString err) { - Isis::IString report = ""; // report will be modified error message - Isis::IString errorLine = ""; // read message one line at a time - Isis::FileName expandedfile; - while(err != "") { - // pull off first line - errorLine = err.Token("\n"); - while(errorLine != "") { - size_t openBrace = errorLine.find('['); - if(openBrace != string::npos) { - // if open brace is found, look to see if a filename is inside (indicated by '/') - if(errorLine.at(openBrace + 1) == '/') { - // add message up to and including [ - report += errorLine.Token("["); - report += "["; - // read entire path into FileName object - expandedfile = errorLine.Token("]"); - report += expandedfile.name(); // only report base name, rather than fully expanded path - report += "]"; - } - else { - // not a filename inside braces, add message up to and including ] - report += errorLine.Token("]"); - report += "]"; - continue; - } - } - else { - // no more braces are found, add rest of error message - report += errorLine; - break; - } - } - report += "\n"; - } - cout << report << endl; +void ReportError(QString err) { + cout << err.replace(QRegExp("\\[/[^\\]]*\\]"), "[]") << endl << endl; } diff --git a/isis/src/base/objs/JP2Decoder/JP2Decoder.cpp b/isis/src/base/objs/JP2Decoder/JP2Decoder.cpp index 1a940803af..a58dc8884b 100644 --- a/isis/src/base/objs/JP2Decoder/JP2Decoder.cpp +++ b/isis/src/base/objs/JP2Decoder/JP2Decoder.cpp @@ -39,7 +39,7 @@ namespace Isis { * @param jp2file The name of the JP2 file that needs to be decoded. * */ - JP2Decoder::JP2Decoder(const std::string &jp2file) { + JP2Decoder::JP2Decoder(const QString &jp2file) { #if ENABLEJP2K p_jp2File = jp2file; @@ -66,12 +66,12 @@ namespace Isis { // Open the JP2 file stream JP2_Stream = new jp2_family_src(); - JP2_Stream->open(p_jp2File.c_str()); + JP2_Stream->open(p_jp2File.toAscii().data()); // Open the JP2 source JP2_Source = new jp2_source(); if(!JP2_Source->open(JP2_Stream)) { - std::string msg = "Unable to open the decoder because the source file "; + QString msg = "Unable to open the decoder because the source file "; msg += "does not have valid JP2 format content [" + p_jp2File + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -96,7 +96,7 @@ namespace Isis { p_pixelBytes = (p_pixelBits >> 3) + ((p_pixelBits % 8) ? 1 : 0); if(p_pixelBytes == 3) p_pixelBytes = 4; if(p_pixelBits > 16 || p_pixelBytes > 2) { - std::string msg = "The source file has unsupported pixel type "; + QString msg = "The source file has unsupported pixel type "; msg += "[" + p_jp2File + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -229,10 +229,10 @@ namespace Isis { } - bool JP2Decoder::IsJP2(string filename) { + bool JP2Decoder::IsJP2(QString filename) { #if ENABLEJP2K jp2_family_src *stream = new jp2_family_src(); - stream->open(filename.c_str()); + stream->open(filename.toAscii().data()); jp2_source *source = new jp2_source(); bool result = source->open(stream); diff --git a/isis/src/base/objs/JP2Decoder/JP2Decoder.h b/isis/src/base/objs/JP2Decoder/JP2Decoder.h index c44a87053d..b8f6a0ae1a 100644 --- a/isis/src/base/objs/JP2Decoder/JP2Decoder.h +++ b/isis/src/base/objs/JP2Decoder/JP2Decoder.h @@ -43,7 +43,7 @@ namespace Isis { * Here is an example of how to use JP2Decoder * @code * JP2Decoder *JP2_decoder; - * JP2_decoder = new JP2Decoder(IString(ui.GetFileName("FROM"))); + * JP2_decoder = new JP2Decoder(QString(ui.GetFileName("FROM"))); * JP2_decoder->OpenFile(); * int nsamps = JP2_decoder->GetSampleDimension(); * int nlines = JP2_decoder->GetLineDimension(); @@ -66,7 +66,7 @@ namespace Isis { * "The file [" + ui.GetFileName("FROM") + "] contains unsupported data type.", * _FILEINFO_); * } - * jp.SetInputFile(IString(ui.GetFileName("FROM"))); + * jp.SetInputFile(QString(ui.GetFileName("FROM"))); * jp.SetOutputCube("TO"); * jp.SetOrganization(ProcessImport::JP2); * jp.StartProcess(); @@ -91,7 +91,7 @@ namespace Isis { */ class JP2Decoder { public: - JP2Decoder(const std::string &jp2file); + JP2Decoder(const QString &jp2file); ~JP2Decoder(); // Register with the Kakadu error facility @@ -133,10 +133,10 @@ namespace Isis { // Read 16-bit data from the JP2 file void Read(short int **inbuf); - static bool IsJP2(std::string filename); + static bool IsJP2(QString filename); private: - std::string p_jp2File; //!open(p_jp2File.c_str()); + JP2_Stream->open(p_jp2File.toAscii().data()); // Open the JP2 boxes JP2_Boxes = new jp2_target(); diff --git a/isis/src/base/objs/JP2Encoder/JP2Encoder.h b/isis/src/base/objs/JP2Encoder/JP2Encoder.h index 3727837121..4ac6d510ee 100644 --- a/isis/src/base/objs/JP2Encoder/JP2Encoder.h +++ b/isis/src/base/objs/JP2Encoder/JP2Encoder.h @@ -79,7 +79,7 @@ namespace Isis { */ class JP2Encoder { public: - JP2Encoder(const std::string &jp2file, const unsigned int nsamps, + JP2Encoder(const QString &jp2file, const unsigned int nsamps, const unsigned int nlines, const unsigned int nbands, const Isis::PixelType type); ~JP2Encoder(); @@ -99,7 +99,7 @@ namespace Isis { void Write(short int **inbuf); private: - std::string p_jp2File; //! +#include + #include "FileName.h" #include "IException.h" #include "JP2Importer.h" @@ -26,7 +28,7 @@ int main(int argc, char *argv[]) { cout << "Clean-up" << endl; delete importer; - remove(outputName.expanded().c_str()); + QFile::remove(outputName.expanded()); cout << endl << "Done" << endl; } diff --git a/isis/src/base/objs/Kernels/Kernels.cpp b/isis/src/base/objs/Kernels/Kernels.cpp index 6269fb2b11..f9fdb9389d 100644 --- a/isis/src/base/objs/Kernels/Kernels.cpp +++ b/isis/src/base/objs/Kernels/Kernels.cpp @@ -29,6 +29,8 @@ #include #include +#include + #include "Kernels.h" #include "FileName.h" #include "PvlKeyword.h" @@ -102,7 +104,7 @@ namespace Isis { * * @param filename Name of ISIS cube file */ - Kernels::Kernels(const std::string &filename) { + Kernels::Kernels(const QString &filename) { Pvl pvl(filename); Init(pvl); } @@ -188,7 +190,7 @@ namespace Isis { * @return bool True if the files was added to the list, false if it already * exists */ - bool Kernels::Add(const std::string &kfile) { + bool Kernels::Add(const QString &kfile) { if (!findByName(kfile)) { _kernels.push_back(examine(kfile, true)); return (true); @@ -370,18 +372,18 @@ namespace Isis { * * @return int Number of kernels loaded */ - int Kernels::Load(const std::string &ktypes) { + int Kernels::Load(const QString &ktypes) { // If no types specified, return them all int nLoaded(0); - if (ktypes.empty()) { + if (ktypes.isEmpty()) { for (unsigned int k = 0 ; k < _kernels.size() ; k++) { if (Load(_kernels[k])) { nLoaded++; } } } else { // Find types and return requested types - vector tlist = getTypes(ktypes); - for (unsigned int t = 0 ; t < tlist.size() ; t++) { + QStringList tlist = getTypes(ktypes); + for (int t = 0 ; t < tlist.size() ; t++) { for (unsigned int k = 0; k < _kernels.size() ; k++) { if (_kernels[k].ktype == tlist[t]) { if (Load(_kernels[k])) { nLoaded++; } @@ -459,16 +461,16 @@ namespace Isis { * * @return int Number of kernels unloaded */ - int Kernels::UnLoad(const std::string &ktypes) { + int Kernels::UnLoad(const QString &ktypes) { // If not types specified, return them all int nUnloaded(0); - if (ktypes.empty()) { + if (ktypes.isEmpty()) { nUnloaded = UnLoad(); } else { // Find types and return requested types - vector tlist = getTypes(ktypes); - for (unsigned int t = 0 ; t < tlist.size() ; t++) { + QStringList tlist = getTypes(ktypes); + for (int t = 0 ; t < tlist.size() ; t++) { for (unsigned int k = 0; k < _kernels.size() ; k++) { if (_kernels[k].ktype == tlist[t]) { if (UnLoad(_kernels[k])) nUnloaded++; @@ -506,7 +508,7 @@ namespace Isis { SpiceChar source[128]; SpiceInt handle; SpiceBoolean found; - kinfo_c(_kernels[i].fullpath.c_str(), sizeof(ktype), sizeof(source), + kinfo_c(_kernels[i].fullpath.toAscii().data(), sizeof(ktype), sizeof(source), ktype,source, &handle, &found); if (found == SPICETRUE) { if (!_kernels[i].loaded) nchanged++; @@ -649,13 +651,13 @@ namespace Isis { * string value after the last '/' character. This is typically the value * that is also returned by the NAIF kinfo_c utility. * - * @return std::vector Alphabetical list of kernel types + * @return std::vector Alphabetical list of kernel types */ - std::vector Kernels::getKernelTypes() const { + QStringList Kernels::getKernelTypes() const { TypeList kmap = categorizeByType(); - std::vector types; + QStringList types; for (int i = 0 ; i < kmap.size() ; i++) { - types.push_back(kmap.key(i)); + types.append(kmap.key(i)); } return (types); } @@ -671,21 +673,21 @@ namespace Isis { * can be any type found in the internal list as returned by * getKernelTypes(). If empty, returns all kernels. * - * @return std::vector A vector of filenames of SPICE kernels + * @return std::vector A vector of filenames of SPICE kernels */ - std::vector Kernels::getKernelList(const std::string &ktypes) const { + QStringList Kernels::getKernelList(const QString &ktypes) const { // If not types specified, return them all - vector flist; - if (ktypes.empty()) { + QStringList flist; + if (ktypes.isEmpty()) { for (unsigned int k = 0; k < _kernels.size() ; k++) { flist.push_back(_kernels[k].pathname); } } else { // Find types and return requested types - vector tlist = getTypes(ktypes); - for (unsigned int t = 0 ; t < tlist.size() ; t++) { + QStringList tlist = getTypes(ktypes); + for (int t = 0 ; t < tlist.size() ; t++) { for (unsigned int k = 0; k < _kernels.size() ; k++) { if (_kernels[k].ktype == tlist[t]) { flist.push_back(_kernels[k].pathname); @@ -717,21 +719,21 @@ namespace Isis { * return if loaded. If empty, returns all types of kernels * that are deemed loaded. * - * @return std::vector List of kernel filenames that are + * @return std::vector List of kernel filenames that are * currently loaded. * */ - std::vector Kernels::getLoadedList(const std::string &ktypes) + QStringList Kernels::getLoadedList(const QString &ktypes) const { - std::vector flist; - if (ktypes.empty()) { + QStringList flist; + if (ktypes.isEmpty()) { for (unsigned int i = 0 ; i < _kernels.size() ; i++) { if (_kernels[i].loaded) flist.push_back(_kernels[i].pathname); } } else { - std::vector tlist = getTypes(ktypes); - for (unsigned int t = 0 ; t < tlist.size() ; t++ ) { + QStringList tlist = getTypes(ktypes); + for (int t = 0 ; t < tlist.size() ; t++ ) { for (unsigned int k = 0; k < _kernels.size() ; k++) { if (_kernels[k].ktype == tlist[t]) { flist.push_back(_kernels[k].pathname); @@ -751,10 +753,10 @@ namespace Isis { * then this routine returns a list of files missing. * * - * @return std::vector List of missing kernel files + * @return std::vector List of missing kernel files */ - std::vector Kernels::getMissingList() const { - std::vector flist; + QStringList Kernels::getMissingList() const { + QStringList flist; for (unsigned int i = 0 ; i < _kernels.size() ; i++) { if (!_kernels[i].exists) flist.push_back(_kernels[i].pathname); } @@ -780,7 +782,7 @@ namespace Isis { if (!kfile.loaded) { NaifStatus::CheckErrors(); try { - furnsh_c(kfile.fullpath.c_str()); + furnsh_c(kfile.fullpath.toAscii().data()); NaifStatus::CheckErrors(); kfile.loaded = true; kfile.managed = true; @@ -822,7 +824,7 @@ namespace Isis { if (kfile.managed) { NaifStatus::CheckErrors(); try { - unload_c(kfile.fullpath.c_str()); + unload_c(kfile.fullpath.toAscii().data()); NaifStatus::CheckErrors(); } catch (IException &) { @@ -848,7 +850,7 @@ namespace Isis { * Here is now the strings are used: * * @code - * std::vector klist = myKernels.getTypes("LSK,FK,SPK"); for + * std::vector klist = myKernels.getTypes("LSK,FK,SPK"); for * (unsigned int i = 0 ; i < klist.size(I) ; i++) { * cout << i << ": " << klist[i] << endl; * } @@ -864,14 +866,13 @@ namespace Isis { * * @param ktypes Sgtring containing comma separated list of kernel file types * - * @return std::vector Vector containing values between commas. + * @return std::vector Vector containing values between commas. */ - std::vector Kernels::getTypes(const std::string &ktypes) const { + QStringList Kernels::getTypes(const QString &ktypes) const { // Find types and return requested types - vector tlist; - IString::Split(',', ktypes, tlist); - for (unsigned int k = 0 ; k < tlist.size() ; k++) { - tlist[k] = IString(tlist[k]).Trim(" \r\n\t\v\b\f").UpCase(); + QStringList tlist = ktypes.split(","); + for (int k = 0 ; k < tlist.size() ; k++) { + tlist[k] = IString(tlist[k]).Trim(" \r\n\t\v\b\f").UpCase().ToQt(); } return (tlist); } @@ -906,7 +907,7 @@ namespace Isis { * @return Kernels::KernelList List of scrutinized kernel file names */ Kernels::KernelList Kernels::findKernels(Pvl &pvl, - const std::string &kname, + const QString &kname, const bool &manage) { KernelList klist; // Get the kernel group and load main kernels @@ -916,7 +917,7 @@ namespace Isis { PvlKeyword &kkey = kernels[kname]; for (int i = 0 ; i < kkey.Size() ; i++) { if (!kkey.IsNull(i)) { - if (!IString::Equal(kkey[i], "Table")) { + if (kkey[i].toLower() != "table") { klist.push_back(examine(kkey[i], manage)); } } @@ -951,7 +952,7 @@ namespace Isis { * with the name if it exists in the list, otherwise a 0 pointer * is returned indicating it does not exist in the list */ - Kernels::KernelFile *Kernels::findByName(const std::string &kfile) { + Kernels::KernelFile *Kernels::findByName(const QString &kfile) { KernelList::iterator klist; for (klist = _kernels.begin() ; klist != _kernels.end() ; ++klist) { if (klist->pathname == kfile) { return (&(*klist)); } @@ -993,9 +994,9 @@ namespace Isis { * * @return bool True if it is a NAIF kernel type */ - bool Kernels::IsNaifType(const std::string &ktype) const { - if (IString::Equal(ktype, "UNKNOWN")) return (false); - if (IString::Equal(ktype, "DEM")) return (false); + bool Kernels::IsNaifType(const QString &ktype) const { + if (ktype.toUpper() == "UNKNOWN") return (false); + if (ktype.toUpper() == "DEM") return (false); return (true); } /** @@ -1046,7 +1047,7 @@ namespace Isis { * @return Kernels::KernelFile An internal Kernels file structure describing * the file. */ - Kernels::KernelFile Kernels::examine(const std::string &kfile, + Kernels::KernelFile Kernels::examine(const QString &kfile, const bool &manage) const { FileName kernfile(kfile); @@ -1069,12 +1070,12 @@ namespace Isis { SpiceChar source[128]; SpiceInt handle; SpiceBoolean found; - kinfo_c(kf.fullpath.c_str(), sizeof(ktype), sizeof(source), ktype, + kinfo_c(kf.fullpath.toAscii().data(), sizeof(ktype), sizeof(source), ktype, source, &handle, &found); if (found == SPICETRUE) { kf.loaded = true; kf.managed = false; - kf.ktype = IString(ktype).UpCase(); + kf.ktype = IString(ktype).UpCase().ToQt(); } } } @@ -1103,14 +1104,14 @@ namespace Isis { * * @param kfile Name of potential NAIF kernel to determine type for * - * @return std::string Value of the identifier found. If undetermined, + * @return QString Value of the identifier found. If undetermined, * "UNKNOWN" is returned. */ - std::string Kernels::resolveType(const std::string &kfile) const { + QString Kernels::resolveType(const QString &kfile) const { FileName kernFile(kfile); - string kpath = kernFile.expanded(); - ifstream ifile(kpath.c_str(), ios::in | ios::binary); - string ktype("UNKNOWN"); + QString kpath = kernFile.expanded(); + ifstream ifile(kpath.toAscii().data(), ios::in | ios::binary); + QString ktype("UNKNOWN"); if (ifile) { char ibuf[10]; ifile.read(ibuf, 8); @@ -1120,13 +1121,9 @@ namespace Isis { // See if the file is a known NAIF type. Assume it has been // extracted from a NAIF compliant kernel - string istr = IString(ibuf).Trim(" \n\r\f\t\v\b"); - if (!istr.empty()) { - vector parts; - IString::Split('/', istr, parts); - if (parts.size() > 1) { - ktype = parts[parts.size()-1]; - } + QString istr = IString(ibuf).Trim(" \n\r\f\t\v\b").ToQt(); + if (istr.contains("/")) { + ktype = istr.split("/").last(); } // If type is not resolved, check file extensions and special ISIS types @@ -1179,12 +1176,12 @@ namespace Isis { * @param iktype Default type to be used in none are determined from this * methiod * - * @return std::string Type of kernel found from file extensions + * @return QString Type of kernel found from file extensions */ - std::string Kernels::resolveTypeByExt(const std::string &kfile, - const std::string &iktype) const { + QString Kernels::resolveTypeByExt(const QString &kfile, + const QString &iktype) const { - string ktype(iktype); // Set default condition + QString ktype(iktype); // Set default condition // Deciminate file parts FileName kf(kfile); diff --git a/isis/src/base/objs/Kernels/Kernels.h b/isis/src/base/objs/Kernels/Kernels.h index b7fa036538..9f9b54da58 100644 --- a/isis/src/base/objs/Kernels/Kernels.h +++ b/isis/src/base/objs/Kernels/Kernels.h @@ -1,4 +1,4 @@ -#if !defined(Kernels_h) +#ifndef Kernels_h #define Kernels_h /** * @file @@ -109,7 +109,7 @@ class Kernels { /** Default Constructor */ Kernels(); Kernels(const Kernels &kernels); - Kernels(const std::string &filename); + Kernels(const QString &filename); Kernels(Cube &cube); Kernels(Pvl &pvl); /** Destructor always unloads the kernels from the pool */ @@ -122,7 +122,7 @@ class Kernels { int Missing() const; void Init(Pvl &pvl); - bool Add(const std::string &kfile); + bool Add(const QString &kfile); void Clear(); int Discover(); @@ -133,22 +133,22 @@ class Kernels { void InitializeNaifKernelPool(); - int Load(const std::string &ktype); + int Load(const QString &ktype); int Load(); - int UnLoad(const std::string &ktype); + int UnLoad(const QString &ktype); int UnLoad(); int UpdateLoadStatus(); int Merge(const Kernels &other); - std::vector getKernelTypes() const; - std::vector getKernelList(const std::string &ktype = "") + QStringList getKernelTypes() const; + QStringList getKernelList(const QString &ktype = "") const; - std::vector getLoadedList(const std::string &ktypes = "") + QStringList getLoadedList(const QString &ktypes = "") const; - std::vector getMissingList() const; + QStringList getMissingList() const; /** Returns the ISIS camera model version number */ @@ -156,11 +156,11 @@ class Kernels { private: struct KernelFile { - std::string pathname; - std::string name; - std::string fullpath; + QString pathname; + QString name; + QString fullpath; bool exists; - std::string ktype; + QString ktype; mutable bool loaded; bool managed; }; @@ -170,28 +170,28 @@ class Kernels { int _camVersion; typedef std::vector KernelFileList; - typedef CollectorMap TypeList; + typedef CollectorMap TypeList; bool Load(KernelFile &kfile); bool UnLoad(KernelFile &kfile); - std::vector getTypes(const std::string &ktypes) const; - std::string resolveType(const std::string &kfile) const; - std::string resolveTypeByExt(const std::string &kfile, - const std::string &iktype = "UNKNOWN") const; + QStringList getTypes(const QString &ktypes) const; + QString resolveType(const QString &kfile) const; + QString resolveTypeByExt(const QString &kfile, + const QString &iktype = "UNKNOWN") const; - bool IsNaifType(const std::string &ktype) const; - KernelFile examine(const std::string &fname, const bool &manage = true) + bool IsNaifType(const QString &ktype) const; + KernelFile examine(const QString &fname, const bool &manage = true) const; int UpdateManagedStatus(); - std::vector findKernels(Pvl &pvl, const std::string &kname, + std::vector findKernels(Pvl &pvl, const QString &kname, const bool &manage = true); - KernelFile *findByName(const std::string &kfile); + KernelFile *findByName(const QString &kfile); TypeList categorizeByType() const; void addKernels(const KernelList &klist); - std::string getKernelType(const std::string &kname) const; - void loadKernel(const std::string &ktype = ""); + QString getKernelType(const QString &kname) const; + void loadKernel(const QString &ktype = ""); int getCameraVersion(Pvl &pvl) const; }; diff --git a/isis/src/base/objs/Kernels/Kernels.truth b/isis/src/base/objs/Kernels/Kernels.truth index ec639ec05b..e4eaa100bc 100644 --- a/isis/src/base/objs/Kernels/Kernels.truth +++ b/isis/src/base/objs/Kernels/Kernels.truth @@ -25,6 +25,7 @@ SPK Initial currently loaded kernel files = 0 + After LoadALL option, kernels loaded = 8 $base/kernels/spk/de405.bsp $mgs/kernels/spk/mgs_ab1.bsp @@ -102,6 +103,7 @@ SPK Unknown kernels in list: 0 + Loading all, total loaded: 7 $base/kernels/lsk/naif0009.tls $base/kernels/spk/de405.bsp diff --git a/isis/src/base/objs/Kernels/unitTest.cpp b/isis/src/base/objs/Kernels/unitTest.cpp index 768dc836d9..633a8cb3d5 100644 --- a/isis/src/base/objs/Kernels/unitTest.cpp +++ b/isis/src/base/objs/Kernels/unitTest.cpp @@ -7,43 +7,41 @@ #include "Kernels.h" // Used extensively in Kernels interface -typedef std::vector StrList; - using namespace std; using namespace Isis; -string stripPath(string input) { - QString result = QString::fromStdString(input).replace( +QString stripPath(QString input) { + QString result = input.replace( QRegExp("(.*/)([^/]*/[^/]*/[^/]*/[^/]*$)"), "$\\2"); - return result.toStdString(); + return result; } int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); - string inputFile = "$ISIS3DATA/mgs/testData/ab102401.lev2.cub"; + QString inputFile = "$ISIS3DATA/mgs/testData/ab102401.lev2.cub"; if (--argc == 1) { inputFile = argv[1]; } cout << "\n\nTesting Kernels class using file " << inputFile << "\n"; Kernels myKernels(inputFile); cout << "\nList of kernels found - Total: " << myKernels.size() << "\n"; - StrList kfiles = myKernels.getKernelList(); + QStringList kfiles = myKernels.getKernelList(); transform(kfiles.begin(), kfiles.end(), kfiles.begin(), &stripPath); - copy(kfiles.begin(), kfiles.end(), ostream_iterator(cout, "\n")); + cout << kfiles.join("\n") << endl; cout << "\nTypes of kernels found\n"; - StrList ktypes = myKernels.getKernelTypes(); - copy(ktypes.begin(), ktypes.end(), ostream_iterator(cout, "\n")); + QStringList ktypes = myKernels.getKernelTypes(); + cout << ktypes.join("\n") << endl; // Test to see if we have any kernels loaded at all Kernels query; query.Discover(); cout << "\nInitial currently loaded kernel files = " << query.size() << "\n"; - StrList kloaded = query.getKernelList(); + QStringList kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Load all the kernels myKernels.Load(); @@ -51,7 +49,7 @@ int main(int argc, char *argv[]) { cout << "\nAfter LoadALL option, kernels loaded = " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Unload and check for proper status myKernels.UnLoad(); @@ -64,7 +62,7 @@ int main(int argc, char *argv[]) { cout << "\nLoaded SPK kernels = " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Load kernels needed for Time manipulation myKernels.Load("LSK,SCLK"); @@ -73,7 +71,7 @@ int main(int argc, char *argv[]) { cout << "\nLoad LSK, SCLK for Time manip, unload SPK kernels = " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Check double load behavior Kernels clone; @@ -90,7 +88,7 @@ int main(int argc, char *argv[]) { cout << "\nCheck Double-Load of LSK, SCLK = " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Unload each set clone.UnLoad(); @@ -98,7 +96,7 @@ int main(int argc, char *argv[]) { cout << "\nUnload the cloned set = " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; clone.UnManage(); // Load SPK set @@ -108,7 +106,7 @@ int main(int argc, char *argv[]) { cout << "\nCheck SPK load (LSK,FK,DAF,SPK)= " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Now unload SPKs, preserve LSK and load CK stuff myKernels.UnLoad("DAF,SPK"); @@ -118,7 +116,7 @@ int main(int argc, char *argv[]) { cout << "\nCheck CK load (SCLK,IK,CK) = " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Now reload all and check myKernels.Load("LSK,FK,SCLK,IK,CK"); @@ -126,7 +124,7 @@ int main(int argc, char *argv[]) { cout << "\nCheck CK reload (LSK,FK,SCLK,IK,CK) = " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Clear the pool and start fresh. Clear all instances and reinitialize NAIF clone.Clear(); @@ -157,17 +155,17 @@ int main(int argc, char *argv[]) { << ", Missing: "<< myKernels.Missing() << "\n"; cout << "\nList of kernels in object..\n"; kfiles = myKernels.getKernelList(); - transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kfiles.begin(), kfiles.end(), ostream_iterator(cout, "\n")); + transform(kfiles.begin(), kfiles.end(), kfiles.begin(), &stripPath); + cout << kfiles.join("\n") << endl; cout << "\nList of kernel types\n"; ktypes = myKernels.getKernelTypes(); - copy(ktypes.begin(), ktypes.end(), ostream_iterator(cout, "\n")); + cout << ktypes.join("\n") << endl; // Find unknown types kfiles = myKernels.getKernelList("UNKNOWN"); cout << "\nUnknown kernels in list: " << kfiles.size() << "\n"; - copy(kfiles.begin(), kfiles.end(), ostream_iterator(cout, "\n")); + cout << kfiles.join("\n") << endl; // Load them all @@ -175,14 +173,14 @@ int main(int argc, char *argv[]) { kloaded = myKernels.getLoadedList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); cout << "\nLoading all, total loaded: " << kloaded.size() << "\n"; - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Now double check list query.Discover(); cout << "\nCheck Load Status = " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; // Unload SPK and CKs myKernels.UnLoad("SPK,CK"); @@ -190,7 +188,7 @@ int main(int argc, char *argv[]) { cout << "\nUnload SPK,CK - Loaded: " << query.size() << "\n"; kloaded = query.getKernelList(); transform(kloaded.begin(), kloaded.end(), kloaded.begin(), &stripPath); - copy(kloaded.begin(), kloaded.end(), ostream_iterator(cout, "\n")); + cout << kloaded.join("\n") << endl; myKernels.UnLoad(); query.Discover(); diff --git a/isis/src/base/objs/Lambert/Lambert.h b/isis/src/base/objs/Lambert/Lambert.h index 01f3946fea..f75174a671 100644 --- a/isis/src/base/objs/Lambert/Lambert.h +++ b/isis/src/base/objs/Lambert/Lambert.h @@ -1,4 +1,4 @@ -#if !defined(Lambert_h) +#ifndef Lambert_h #define Lambert_h /** * @file diff --git a/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.cpp b/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.cpp index c08095a2bc..8ad904da9c 100644 --- a/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.cpp +++ b/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.cpp @@ -91,7 +91,7 @@ namespace Isis { if (!mapGroup.HasKeyword("CenterLongitude")) { if (allowDefaults) { double centerLon = (MinimumLongitude() + MaximumLongitude()) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", centerLon, "Degrees"); + mapGroup += PvlKeyword("CenterLongitude", toString(centerLon), "Degrees"); } else { IString message = "Cannot project using Lambert Azimuthal equal-area"; @@ -106,7 +106,7 @@ namespace Isis { if (!mapGroup.HasKeyword("CenterLatitude")) { if (allowDefaults) { double centerLat = (MinimumLatitude() + MaximumLatitude()) / 2.0; - mapGroup += PvlKeyword("CenterLatitude", centerLat, "Degrees"); + mapGroup += PvlKeyword("CenterLatitude", toString(centerLat), "Degrees"); } else { IString message = "Cannot project using Lambert Azimuthal equal-area"; @@ -184,22 +184,22 @@ namespace Isis { /** * Returns the name of the map projection. * - * @return string Name of projection + * @return QString Name of projection * * @author 2012-07-25 Jeannie Backer * @internal * @history 2012-07-25 Jeannie Backer - Original version. */ - string LambertAzimuthalEqualArea::Name() const { + QString LambertAzimuthalEqualArea::Name() const { return "LambertAzimuthalEqualArea"; } /** * Returns the version of the map projection. * - * @return std::string Version number + * @return QString Version number */ - string LambertAzimuthalEqualArea::Version() const { + QString LambertAzimuthalEqualArea::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.h b/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.h index 1e50e6eae0..8424a46e74 100644 --- a/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.h +++ b/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.h @@ -109,8 +109,8 @@ namespace Isis { ~LambertAzimuthalEqualArea(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; double TrueScaleLatitude() const; // since this projection is not cylindrical the following method does not // need to be be overwritten, returning false by default diff --git a/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.truth b/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.truth index fad3d5b387..6ef3908634 100644 --- a/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.truth +++ b/isis/src/base/objs/LambertAzimuthalEqualArea/LambertAzimuthalEqualArea.truth @@ -1201,7 +1201,7 @@ Group = Mapping MinimumLongitude = -90.0 MaximumLongitude = 90.0 ProjectionName = LambertAzimuthalEqualArea - PixelResolution = 0.001 + PixelResolution = .001 EquatorialRadius = 6378206.4 CenterLongitude = 0.0 CenterLatitude = 0.0 @@ -1219,7 +1219,7 @@ Group = Mapping LatitudeType = Planetographic LongitudeDirection = PositiveEast LongitudeDomain = 180 - PixelResolution = 0.001 + PixelResolution = .001 MinimumLatitude = 20.0 MaximumLatitude = 80.0 MinimumLongitude = -180.0 diff --git a/isis/src/base/objs/LambertAzimuthalEqualArea/unitTest.cpp b/isis/src/base/objs/LambertAzimuthalEqualArea/unitTest.cpp index 79b2052ddc..a4a2ad6aec 100644 --- a/isis/src/base/objs/LambertAzimuthalEqualArea/unitTest.cpp +++ b/isis/src/base/objs/LambertAzimuthalEqualArea/unitTest.cpp @@ -23,19 +23,19 @@ int main(int argc, char *argv[]) { Pvl lab; lab.AddGroup(PvlGroup("Mapping")); PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += PvlKeyword("EquatorialRadius", 1.0); - mapGroup += PvlKeyword("PolarRadius", 1.0); + mapGroup += PvlKeyword("EquatorialRadius", "1.0"); + mapGroup += PvlKeyword("PolarRadius", "1.0"); mapGroup += PvlKeyword("LatitudeType", "Planetographic"); mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += PvlKeyword("LongitudeDomain", 180); - mapGroup += PvlKeyword("MinimumLatitude", 20.0); - mapGroup += PvlKeyword("MaximumLatitude", 80.0); - mapGroup += PvlKeyword("MinimumLongitude", -180.0); - mapGroup += PvlKeyword("MaximumLongitude", 180.0); + mapGroup += PvlKeyword("LongitudeDomain", "180"); + mapGroup += PvlKeyword("MinimumLatitude", "20.0"); + mapGroup += PvlKeyword("MaximumLatitude", "80.0"); + mapGroup += PvlKeyword("MinimumLongitude", "-180.0"); + mapGroup += PvlKeyword("MaximumLongitude", "180.0"); mapGroup += PvlKeyword("ProjectionName", "LambertAzimuthalEqualArea"); - mapGroup += PvlKeyword("CenterLatitude", 0); - mapGroup += PvlKeyword("CenterLongitude", 0); - mapGroup += PvlKeyword("PixelResolution", .001); + mapGroup += PvlKeyword("CenterLatitude", "0"); + mapGroup += PvlKeyword("CenterLongitude", "0"); + mapGroup += PvlKeyword("PixelResolution", ".001"); try { string border = "||||||||||||||||||||||||||||||||||||||||" @@ -280,10 +280,10 @@ int main(int argc, char *argv[]) { cout << "(x,y) = (" << p1.XCoord() << ", " << p1.YCoord() << ")"<< endl; cout << endl; cout << endl; - mapGroup.FindKeyword("MinimumLatitude").SetValue(-90.0); - mapGroup.FindKeyword("MaximumLatitude").SetValue(90.0); - mapGroup.FindKeyword("MinimumLongitude").SetValue(-179.99999); - mapGroup.FindKeyword("MaximumLongitude").SetValue(179.99999); + mapGroup.FindKeyword("MinimumLatitude").SetValue("-90.0"); + mapGroup.FindKeyword("MaximumLatitude").SetValue("90.0"); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-179.99999"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("179.99999"); Projection &p1a = *ProjectionFactory::Create(lab); cout << "Given: " << endl; cout << " Minimum Latitude: " << p1a.MinimumLatitude() << endl; @@ -309,8 +309,8 @@ int main(int argc, char *argv[]) { p1a.SetCoordinate(0, minY); cout << " SetCoordinate(0,minY) returns lat/lon = " << p1a.Latitude() << " / " << p1a.Longitude() << endl; - mapGroup.FindKeyword("MinimumLongitude").SetValue(-90.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(90.0); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-90.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("90.0"); cout << "Given: " << endl; Projection &p1b = *ProjectionFactory::Create(lab); cout << " Minimum Latitude: " << p1b.MinimumLatitude() << endl; @@ -346,13 +346,13 @@ int main(int argc, char *argv[]) { cout << border << endl << endl; //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| mapGroup.DeleteKeyword("EquatorialRadius"); - mapGroup += PvlKeyword("EquatorialRadius", 3.0); - mapGroup.FindKeyword("PolarRadius").SetValue(3.0); - mapGroup.FindKeyword("CenterLatitude").SetValue(40.0); - mapGroup.FindKeyword("CenterLongitude").SetValue(-100.0); - mapGroup.FindKeyword("MinimumLongitude").SetValue(-279.99999); - mapGroup.FindKeyword("MaximumLongitude").SetValue(79.99999); - mapGroup.FindKeyword("LongitudeDomain").SetValue(360); + mapGroup += PvlKeyword("EquatorialRadius", "3.0"); + mapGroup.FindKeyword("PolarRadius").SetValue("3.0"); + mapGroup.FindKeyword("CenterLatitude").SetValue("40.0"); + mapGroup.FindKeyword("CenterLongitude").SetValue("-100.0"); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-279.99999"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("79.99999"); + mapGroup.FindKeyword("LongitudeDomain").SetValue("360"); Projection &p2 = *ProjectionFactory::Create(lab); cout << mapGroup["CenterLatitude"] << endl; cout << mapGroup["CenterLongitude"] << endl; @@ -527,8 +527,8 @@ int main(int argc, char *argv[]) { << p2.Latitude() << " / " << p2.Longitude() << endl; cout << endl; cout << endl; - mapGroup.FindKeyword("MinimumLongitude").SetValue(-110.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(70.0); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-110.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("70.0"); Projection &p2a = *ProjectionFactory::Create(lab); cout << std::setprecision(7); cout << "Given: " << endl; @@ -565,9 +565,9 @@ int main(int argc, char *argv[]) { cout << "\t\t\t SPHERICAL-PLANETOGRAPHIC-POSITIVEEAST-SOUTH POLAR-180" << endl; cout << border << endl << endl; //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - mapGroup.FindKeyword("CenterLatitude").SetValue(-90.0); - mapGroup.FindKeyword("CenterLongitude").SetValue(-96.0); - mapGroup.FindKeyword("LongitudeDomain").SetValue(180); + mapGroup.FindKeyword("CenterLatitude").SetValue("-90.0"); + mapGroup.FindKeyword("CenterLongitude").SetValue("-96.0"); + mapGroup.FindKeyword("LongitudeDomain").SetValue("180"); Projection &p3 = *ProjectionFactory::Create(lab); cout << mapGroup["CenterLatitude"] << endl; cout << mapGroup["CenterLongitude"] << endl; @@ -784,10 +784,10 @@ int main(int argc, char *argv[]) { cout << "(x,y) = (" << p3.XCoord() << ", " << p3.YCoord() << ")"<< endl; cout << endl; cout << endl; - mapGroup.FindKeyword("MinimumLatitude").SetValue(-90.0); - mapGroup.FindKeyword("MaximumLatitude").SetValue(0.0); - mapGroup.FindKeyword("MinimumLongitude").SetValue(-336.0);//24 - mapGroup.FindKeyword("MaximumLongitude").SetValue(-66.0);//294 + mapGroup.FindKeyword("MinimumLatitude").SetValue("-90.0"); + mapGroup.FindKeyword("MaximumLatitude").SetValue("0.0"); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-336.0");//24 + mapGroup.FindKeyword("MaximumLongitude").SetValue("-66.0");//294 Projection &p3a = *ProjectionFactory::Create(lab); cout << "Given: " << endl; cout << " Minimum Latitude: " << p3a.MinimumLatitude() << endl; @@ -823,8 +823,8 @@ int main(int argc, char *argv[]) { << p3a.Latitude() << " / " << p3a.Longitude() << endl; cout << endl; cout << endl; - mapGroup.FindKeyword("MinimumLongitude").SetValue(-66.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(-51.0); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-66.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("-51.0"); Projection &p3b = *ProjectionFactory::Create(lab); cout << "Given: " << endl; cout << " Minimum Latitude: " << p3b.MinimumLatitude() << endl; @@ -867,13 +867,13 @@ int main(int argc, char *argv[]) { cout << "\t\t\t SPHERICAL-PLANETOCENTRIC-POSITIVEWEST-NORTH POLAR-180" << endl; cout << border << endl << endl; //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - mapGroup.FindKeyword("CenterLatitude").SetValue(90.0); + mapGroup.FindKeyword("CenterLatitude").SetValue("90.0"); mapGroup.FindKeyword("LatitudeType").SetValue("Planetocentric"); mapGroup.FindKeyword("LongitudeDirection").SetValue("PositiveWest"); - mapGroup.FindKeyword("MinimumLatitude").SetValue(-89.99999); - mapGroup.FindKeyword("MaximumLatitude").SetValue(0.0); - mapGroup.FindKeyword("MinimumLongitude").SetValue(-51.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(129.0); + mapGroup.FindKeyword("MinimumLatitude").SetValue("-89.99999"); + mapGroup.FindKeyword("MaximumLatitude").SetValue("0.0"); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-51.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("129.0"); Projection &p4 = *ProjectionFactory::Create(lab); cout << mapGroup["CenterLatitude"] << endl; cout << mapGroup["CenterLongitude"] << endl; @@ -1075,8 +1075,8 @@ int main(int argc, char *argv[]) { p4.SetGround(-90, 90); cout << endl; cout << endl; - mapGroup.FindKeyword("MinimumLongitude").SetValue(-6.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(24.0); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-6.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("24.0"); Projection &p4a = *ProjectionFactory::Create(lab); cout << "Given: " << endl; cout << std::setprecision(7);// so all of the 9's are visible for minlat @@ -1117,7 +1117,7 @@ int main(int argc, char *argv[]) { << p4a.Latitude() << " / " << p4a.Longitude() << endl; cout << endl; cout << endl; - mapGroup.FindKeyword("MinimumLatitude").SetValue(-90.0); + mapGroup.FindKeyword("MinimumLatitude").SetValue("-90.0"); Projection &p4b = *ProjectionFactory::Create(lab); cout << "Given: " << endl; cout << std::setprecision(7); @@ -1161,12 +1161,12 @@ int main(int argc, char *argv[]) { mapGroup.FindKeyword("LatitudeType").SetValue("Planetographic"); mapGroup.FindKeyword("LongitudeDirection").SetValue("PositiveEast"); mapGroup.DeleteKeyword("EquatorialRadius"); - mapGroup += PvlKeyword("EquatorialRadius", 6378388.0); - mapGroup.FindKeyword("PolarRadius").SetValue(6378388.0*sqrt(1-.00672267)); - mapGroup.FindKeyword("MinimumLatitude").SetValue(-89.99999); - mapGroup.FindKeyword("CenterLongitude").SetValue(-100.0); - mapGroup.FindKeyword("MinimumLongitude").SetValue(-100.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(215.0); + mapGroup += PvlKeyword("EquatorialRadius", "6378388.0"); + mapGroup.FindKeyword("PolarRadius").SetValue(toString(6378388.0*sqrt(1-.00672267))); + mapGroup.FindKeyword("MinimumLatitude").SetValue("-89.99999"); + mapGroup.FindKeyword("CenterLongitude").SetValue("-100.0"); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-100.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("215.0"); // we do not have relative scale factor methods in Projection as of 06/2012 // so these need to be tested with a LambertAzimuthalEqualArea object // specifically. The following values were compared to the table in Snyder @@ -1381,8 +1381,8 @@ int main(int argc, char *argv[]) { p5.Latitude() << " / " << p5.Longitude() << endl; cout << endl; cout << endl; - mapGroup.FindKeyword("MinimumLongitude").SetValue(-55.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(-10.0); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-55.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("-10.0"); Projection &p5a = *ProjectionFactory::Create(lab); cout << "Given: " << endl; cout << std::setprecision(7);// so all of the 9's are visible for minlat @@ -1429,7 +1429,7 @@ int main(int argc, char *argv[]) { cout << "\t\t \t ELLIPSOIDAL-PLANETOGRAPHIC-POSITIVEEAST-SOUTH POLAR-180" <Name() << endl; @@ -2077,25 +2077,25 @@ int main(int argc, char *argv[]) { cout << border << endl << endl; //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| mapGroup.DeleteKeyword("CenterLongitude"); - mapGroup.DeleteKeyword("CenterLatitude"); cout << "Error check: Missing center longitude keyword" << endl; try { LambertAzimuthalEqualArea p(lab); } catch(IException &e) { e.print(); - mapGroup += PvlKeyword("CenterLongitude",180); + mapGroup += PvlKeyword("CenterLongitude", "180"); } cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; cout << endl; + mapGroup.DeleteKeyword("CenterLatitude"); cout << "Error check: Missing center latitude keyword" << endl; try { LambertAzimuthalEqualArea p(lab); } catch(IException &e) { e.print(); - mapGroup += PvlKeyword("CenterLatitude",0); + mapGroup += PvlKeyword("CenterLatitude","0"); } cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; @@ -2103,13 +2103,13 @@ int main(int argc, char *argv[]) { cout << "Error check: MinimumLongitude more than 360 degrees " "from CenterLongitude" << endl; try { - mapGroup.FindKeyword("MinimumLongitude").SetValue(-181.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(270.0); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-181.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("270.0"); LambertAzimuthalEqualArea p(lab); } catch(IException &e) { e.print(); - mapGroup.FindKeyword("MinimumLongitude").SetValue(-180.0); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-180.0"); } cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; @@ -2117,12 +2117,12 @@ int main(int argc, char *argv[]) { cout << "Error check: MaximumLongitude more than 360 degrees " "from CenterLongitude" << endl; try { - mapGroup.FindKeyword("MaximumLongitude").SetValue(541.0); + mapGroup.FindKeyword("MaximumLongitude").SetValue("541.0"); LambertAzimuthalEqualArea p(lab); } catch(IException &e) { e.print(); - mapGroup.FindKeyword("MaximumLongitude").SetValue(270.0); + mapGroup.FindKeyword("MaximumLongitude").SetValue("270.0"); } cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; @@ -2133,31 +2133,31 @@ int main(int argc, char *argv[]) { } catch(IException &e) { e.print(); - mapGroup.FindKeyword("MinimumLongitude").SetValue(90.0); + mapGroup.FindKeyword("MinimumLongitude").SetValue("90.0"); } cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; cout << endl; cout << "Error check: Center longitude out of valid range" << endl; try { - mapGroup.FindKeyword("CenterLongitude").SetValue(361.0); + mapGroup.FindKeyword("CenterLongitude").SetValue("361.0"); LambertAzimuthalEqualArea p(lab); } catch(IException &e) { e.print(); - mapGroup.FindKeyword("CenterLongitude").SetValue(180.0); + mapGroup.FindKeyword("CenterLongitude").SetValue("180.0"); } cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; cout << endl; cout << "Error check: Center latitude out of valid range" << endl; try { - mapGroup.FindKeyword("CenterLatitude").SetValue(-91.0); + mapGroup.FindKeyword("CenterLatitude").SetValue("-91.0"); LambertAzimuthalEqualArea p(lab); } catch(IException &e) { e.print(); - mapGroup.FindKeyword("CenterLatitude").SetValue(0.0); + mapGroup.FindKeyword("CenterLatitude").SetValue("0.0"); } cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; @@ -2166,14 +2166,14 @@ int main(int argc, char *argv[]) { "antipodal point for equatorial projections." << endl; try { // non-polar, clat = 0 (equatorial) - mapGroup.FindKeyword("CenterLatitude").SetValue(0); + mapGroup.FindKeyword("CenterLatitude").SetValue("0"); // minlat(-90) <= -clat <= maxlat(90) - mapGroup.FindKeyword("MinimumLatitude").SetValue(-90); - mapGroup.FindKeyword("MaximumLatitude").SetValue(90.0); + mapGroup.FindKeyword("MinimumLatitude").SetValue("-90"); + mapGroup.FindKeyword("MaximumLatitude").SetValue("90.0"); // minlon(-180) <= clon-180 <= maxlon(90) - mapGroup.FindKeyword("CenterLongitude").SetValue(0); - mapGroup.FindKeyword("MinimumLongitude").SetValue(-180.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(90.0); + mapGroup.FindKeyword("CenterLongitude").SetValue("0"); + mapGroup.FindKeyword("MinimumLongitude").SetValue("-180.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("90.0"); LambertAzimuthalEqualArea p(lab); } catch(IException &e) { @@ -2186,19 +2186,19 @@ int main(int argc, char *argv[]) { "antipodal point for oblique projections." << endl; try { // non-polar, clat = 10 (oblique) - mapGroup.FindKeyword("CenterLatitude").SetValue(10); + mapGroup.FindKeyword("CenterLatitude").SetValue("10"); // minlat(-20) <= -clat(-10) <= maxlat(0) - mapGroup.FindKeyword("MinimumLatitude").SetValue(-20); - mapGroup.FindKeyword("MaximumLatitude").SetValue(0); + mapGroup.FindKeyword("MinimumLatitude").SetValue("-20"); + mapGroup.FindKeyword("MaximumLatitude").SetValue("0"); // minlon(180) <= clon+180(190) <= maxlon(200) - mapGroup.FindKeyword("CenterLongitude").SetValue(10); - mapGroup.FindKeyword("MinimumLongitude").SetValue(180.0); - mapGroup.FindKeyword("MaximumLongitude").SetValue(200.0); + mapGroup.FindKeyword("CenterLongitude").SetValue("10"); + mapGroup.FindKeyword("MinimumLongitude").SetValue("180.0"); + mapGroup.FindKeyword("MaximumLongitude").SetValue("200.0"); LambertAzimuthalEqualArea p(lab); } catch(IException &e) { e.print(); - mapGroup.FindKeyword("MaximumLongitude").SetValue(189.0); + mapGroup.FindKeyword("MaximumLongitude").SetValue("189.0"); } cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; @@ -2226,8 +2226,8 @@ int main(int argc, char *argv[]) { cout << endl; cout << "\t\t\t\t/-----------------------------------------/" << endl; cout << endl; - mapGroup.FindKeyword("EquatorialRadius").SetValue(2.0); - mapGroup.FindKeyword("PolarRadius").SetValue(1.0); + mapGroup.FindKeyword("EquatorialRadius").SetValue("2.0"); + mapGroup.FindKeyword("PolarRadius").SetValue("1.0"); cout << "Error check: Relative scale factor. " "Ellipsoidal oblique aspect projection." << endl; LambertAzimuthalEqualArea pp(lab); @@ -2243,7 +2243,7 @@ int main(int argc, char *argv[]) { cout << endl; cout << "Error check: Relative scale factor. " "Polar aspect projection projected at opposite pole." << endl; - mapGroup.FindKeyword("CenterLatitude").SetValue(90); + mapGroup.FindKeyword("CenterLatitude").SetValue("90"); LambertAzimuthalEqualArea nPole(lab); nPole.SetGround(-90,0); try { @@ -2252,7 +2252,7 @@ int main(int argc, char *argv[]) { catch(IException &e) { e.print(); } - mapGroup.FindKeyword("CenterLatitude").SetValue(-90); + mapGroup.FindKeyword("CenterLatitude").SetValue("-90"); LambertAzimuthalEqualArea sPole(lab); sPole.SetGround(90,0); try { diff --git a/isis/src/base/objs/LambertConformal/LambertConformal.cpp b/isis/src/base/objs/LambertConformal/LambertConformal.cpp index 11392b3daa..485272cbfb 100644 --- a/isis/src/base/objs/LambertConformal/LambertConformal.cpp +++ b/isis/src/base/objs/LambertConformal/LambertConformal.cpp @@ -64,14 +64,14 @@ namespace Isis { // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = (m_minimumLongitude + m_maximumLongitude) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } // Compute and write the default center latitude if allowed and // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLatitude"))) { double lat = (m_minimumLatitude + m_maximumLatitude) / 2.0; - mapGroup += PvlKeyword("CenterLatitude", lat); + mapGroup += PvlKeyword("CenterLatitude", toString(lat)); } // Get the center longitude & latitude @@ -104,17 +104,17 @@ namespace Isis { // Test to make sure standard parallels are valid if (fabs(m_par1) > 90.0 || fabs(m_par2) > 90.0) { - string message = "Standard Parallels must between -90 and 90"; + QString message = "Standard Parallels must between -90 and 90"; throw IException(IException::Unknown, message, _FILEINFO_); } if (fabs(m_par1 + m_par2) < DBL_EPSILON) { - string message = "Standard Parallels cannot be symmetric to the equator"; + QString message = "Standard Parallels cannot be symmetric to the equator"; throw IException(IException::Unknown, message, _FILEINFO_); } // Removed because this test only works for northern hemisphere // Just reorder the parallels so p1 is at the larger radius of the two //if (m_par1 > m_par2) { - // string message = "Standard Parallels must be ordered"; + // QString message = "Standard Parallels must be ordered"; // throw IException::Message(IException::Projection,message,_FILEINFO_); //} @@ -180,7 +180,7 @@ namespace Isis { m_rho = m_equatorialRadius * m_f * pow(tclat, m_n); } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } } @@ -210,9 +210,9 @@ namespace Isis { /** * Returns the name of the map projection, "LambertConformal" * - * @return string Name of projection, "LambertConformal" + * @return QString Name of projection, "LambertConformal" */ - string LambertConformal::Name() const { + QString LambertConformal::Name() const { return "LambertConformal"; } @@ -220,9 +220,9 @@ namespace Isis { * Returns the version of the map projection * * - * @return string Version number + * @return QString Version number */ - string LambertConformal::Version() const { + QString LambertConformal::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/LambertConformal/LambertConformal.h b/isis/src/base/objs/LambertConformal/LambertConformal.h index f78078f352..5f8755c69a 100644 --- a/isis/src/base/objs/LambertConformal/LambertConformal.h +++ b/isis/src/base/objs/LambertConformal/LambertConformal.h @@ -77,8 +77,8 @@ namespace Isis { ~LambertConformal(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; double TrueScaleLatitude() const; bool SetGround(const double lat, const double lon); diff --git a/isis/src/base/objs/LambertConformal/unitTest.cpp b/isis/src/base/objs/LambertConformal/unitTest.cpp index 302361d894..4990f20c9a 100644 --- a/isis/src/base/objs/LambertConformal/unitTest.cpp +++ b/isis/src/base/objs/LambertConformal/unitTest.cpp @@ -2,76 +2,79 @@ #include #include "LambertConformal.h" #include "IException.h" +#include "IString.h" #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "UNIT TEST FOR LambertConformal" << endl << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 1.0); - mapGroup += Isis::PvlKeyword("PolarRadius", 1.0); - mapGroup += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 180); - mapGroup += Isis::PvlKeyword("MinimumLatitude", 20.0); - mapGroup += Isis::PvlKeyword("MaximumLatitude", 80.0); - mapGroup += Isis::PvlKeyword("MinimumLongitude", -180.0); - mapGroup += Isis::PvlKeyword("MaximumLongitude", 180.0); - mapGroup += Isis::PvlKeyword("ProjectionName", "LambertConformal"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup = lab.FindGroup("Mapping"); + mapGroup += PvlKeyword("EquatorialRadius", "1.0"); + mapGroup += PvlKeyword("PolarRadius", "1.0"); + mapGroup += PvlKeyword("LatitudeType", "Planetographic"); + mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup += PvlKeyword("LongitudeDomain", "180"); + mapGroup += PvlKeyword("MinimumLatitude", "20.0"); + mapGroup += PvlKeyword("MaximumLatitude", "80.0"); + mapGroup += PvlKeyword("MinimumLongitude", "-180.0"); + mapGroup += PvlKeyword("MaximumLongitude", "180.0"); + mapGroup += PvlKeyword("ProjectionName", "LambertConformal"); cout << "Test missing center longitude keyword ..." << endl; try { - Isis::LambertConformal p(lab); + LambertConformal p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLongitude", -96.0); + mapGroup += PvlKeyword("CenterLongitude", "-96.0"); cout << "Test missing center latitude keyword..." << endl; try { - Isis::LambertConformal p(lab); + LambertConformal p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLatitude", 23.0); + mapGroup += PvlKeyword("CenterLatitude", "23.0"); cout << "Test missing first standard parallel keyword..." << endl; try { - Isis::LambertConformal p(lab); + LambertConformal p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("FirstStandardParallel", 33); + mapGroup += PvlKeyword("FirstStandardParallel", "33"); cout << "Test missing second standard parallel keyword..." << endl; try { - Isis::LambertConformal p(lab); + LambertConformal p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("SecondStandardParallel", 45); + mapGroup += PvlKeyword("SecondStandardParallel", "45"); try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); - // Isis::LambertConformal p(lab); + Projection &p = *ProjectionFactory::Create(lab); + // LambertConformal p(lab); cout << "Test SetGround method ... " << endl; cout << std::setprecision(9); @@ -103,7 +106,7 @@ int main(int argc, char *argv[]) { cout << "Maximum Y: " << maxY << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; @@ -112,7 +115,7 @@ int main(int argc, char *argv[]) { cout << "Test default computation ... " << endl; mapGroup.DeleteKeyword("CenterLongitude"); mapGroup.DeleteKeyword("CenterLatitude"); - Isis::LambertConformal p2(lab, true); + LambertConformal p2(lab, true); cout << lab << endl; cout << endl; @@ -122,9 +125,9 @@ int main(int argc, char *argv[]) { cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -140,24 +143,24 @@ int main(int argc, char *argv[]) { cout << "Test invalid combinations of mapping parameters ..." << endl; mapGroup.DeleteKeyword("CenterLatitude"); - mapGroup += Isis::PvlKeyword("CenterLatitude", -90.0); + mapGroup += PvlKeyword("CenterLatitude", "-90.0"); try { - Isis::LambertConformal p(lab); + LambertConformal p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; mapGroup.DeleteKeyword("CenterLatitude"); - mapGroup += Isis::PvlKeyword("CenterLatitude", 90.0); + mapGroup += PvlKeyword("CenterLatitude", "90.0"); mapGroup.DeleteKeyword("FirstStandardParallel"); - mapGroup += Isis::PvlKeyword("FirstStandardParallel", -60); + mapGroup += PvlKeyword("FirstStandardParallel", "-60"); try { - Isis::LambertConformal p(lab); + LambertConformal p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; @@ -171,7 +174,7 @@ int main(int argc, char *argv[]) { cout << " USGS Professional Paper 1395 by John P. Snyder" << endl; cout << " Pages 295-297" << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/Latitude/Latitude.cpp b/isis/src/base/objs/Latitude/Latitude.cpp index 7e12704ee2..16de0c7394 100644 --- a/isis/src/base/objs/Latitude/Latitude.cpp +++ b/isis/src/base/objs/Latitude/Latitude.cpp @@ -95,9 +95,9 @@ namespace Isis { m_equatorialRadius = NULL; m_polarRadius = NULL; - m_equatorialRadius = new Distance(mapping["EquatorialRadius"][0], + m_equatorialRadius = new Distance(toDouble(mapping["EquatorialRadius"][0]), Distance::Meters); - m_polarRadius = new Distance(mapping["PolarRadius"][0], + m_polarRadius = new Distance(toDouble(mapping["PolarRadius"][0]), Distance::Meters); m_errors = errors; @@ -109,7 +109,7 @@ namespace Isis { setPlanetocentric(latitude.radians(), Radians); } else { - IString msg = "Latitude type [" + IString(mapping["LatitudeType"][0]) + + QString msg = "Latitude type [" + mapping["LatitudeType"][0] + "] is not recognized"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -135,9 +135,9 @@ namespace Isis { m_equatorialRadius = NULL; m_polarRadius = NULL; - m_equatorialRadius = new Distance(mapping["EquatorialRadius"][0], + m_equatorialRadius = new Distance(toDouble(mapping["EquatorialRadius"][0]), Distance::Meters); - m_polarRadius = new Distance(mapping["PolarRadius"][0], + m_polarRadius = new Distance(toDouble(mapping["PolarRadius"][0]), Distance::Meters); m_errors = errors; @@ -408,8 +408,8 @@ namespace Isis { Latitude Latitude::add(Angle angleToAdd, PvlGroup mapping) { CoordinateType latType; - Distance equatorialRadius(mapping["EquatorialRadius"][0], Distance::Meters); - Distance polarRadius(mapping["PolarRadius"][0], Distance::Meters); + Distance equatorialRadius(toDouble(mapping["EquatorialRadius"][0]), Distance::Meters); + Distance polarRadius(toDouble(mapping["PolarRadius"][0]), Distance::Meters); if(mapping["LatitudeType"][0] == "Planetocentric") latType = Planetocentric; diff --git a/isis/src/base/objs/Latitude/unitTest.cpp b/isis/src/base/objs/Latitude/unitTest.cpp index 30c6cef782..880d9e73e6 100644 --- a/isis/src/base/objs/Latitude/unitTest.cpp +++ b/isis/src/base/objs/Latitude/unitTest.cpp @@ -170,18 +170,18 @@ int main(int argc, char *argv[]) { latRangeTest.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &latTestGroup = latRangeTest.FindGroup("Mapping"); latTestGroup += Isis::PvlKeyword("ProjectionName", "Equirectangular"); - latTestGroup += Isis::PvlKeyword("EquatorialRadius", 5000.0); - latTestGroup += Isis::PvlKeyword("PolarRadius", 1000.0); + latTestGroup += Isis::PvlKeyword("EquatorialRadius", "5000.0"); + latTestGroup += Isis::PvlKeyword("PolarRadius", "1000.0"); latTestGroup += Isis::PvlKeyword("LatitudeType", "Planetographic"); latTestGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - latTestGroup += Isis::PvlKeyword("LongitudeDomain", 360); - latTestGroup += Isis::PvlKeyword("Scale", 5.0); - latTestGroup += Isis::PvlKeyword("MinimumLatitude", -90.0); - latTestGroup += Isis::PvlKeyword("MaximumLatitude", 90.0); - latTestGroup += Isis::PvlKeyword("MinimumLongitude", 0.0); - latTestGroup += Isis::PvlKeyword("MaximumLongitude", 360.0); - latTestGroup += Isis::PvlKeyword("CenterLatitude", 0.0); - latTestGroup += Isis::PvlKeyword("CenterLongitude", 0.0); + latTestGroup += Isis::PvlKeyword("LongitudeDomain", "360"); + latTestGroup += Isis::PvlKeyword("Scale", "5.0"); + latTestGroup += Isis::PvlKeyword("MinimumLatitude", "-90.0"); + latTestGroup += Isis::PvlKeyword("MaximumLatitude", "90.0"); + latTestGroup += Isis::PvlKeyword("MinimumLongitude", "0.0"); + latTestGroup += Isis::PvlKeyword("MaximumLongitude", "360.0"); + latTestGroup += Isis::PvlKeyword("CenterLatitude", "0.0"); + latTestGroup += Isis::PvlKeyword("CenterLongitude", "0.0"); Latitude ographicLat(25, latTestGroup, Angle::Degrees); Angle ographicAngle(30, Angle::Degrees); diff --git a/isis/src/base/objs/LeastSquares/LeastSquares.cpp b/isis/src/base/objs/LeastSquares/LeastSquares.cpp index 48796389f9..124631234a 100644 --- a/isis/src/base/objs/LeastSquares/LeastSquares.cpp +++ b/isis/src/base/objs/LeastSquares/LeastSquares.cpp @@ -23,7 +23,7 @@ #include "jama/jama_svd.h" #include "jama/jama_qr.h" -#if !defined(__sun__) +#ifndef __sun__ #include "gmm/gmm_superlu_interface.h" #endif @@ -60,7 +60,7 @@ namespace Isis { throw IException(IException::Programmer, msg, _FILEINFO_); } -#if !defined(__sun__) +#ifndef __sun__ gmm::resize(p_sparseA, sparseRows, sparseCols); gmm::resize(p_normals, sparseCols, sparseCols); gmm::resize(p_ATb, sparseCols, 1); @@ -118,7 +118,7 @@ namespace Isis { void LeastSquares::AddKnown(const std::vector &data, double result, double weight) { if((int) data.size() != p_basis->Variables()) { - std::string msg = "Number of elements in data does not match basis [" + + QString msg = "Number of elements in data does not match basis [" + p_basis->Name() + "] requirements"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -133,7 +133,7 @@ namespace Isis { } if(p_sparse) { -#if !defined(__sun__) +#ifndef __sun__ FillSparseA(data); #endif } @@ -158,7 +158,7 @@ namespace Isis { * from p_weight to p_sqrtweight. * */ -#if !defined(__sun__) +#ifndef __sun__ void LeastSquares::FillSparseA(const std::vector &data) { p_basis->Expand(data); @@ -252,7 +252,7 @@ namespace Isis { SolveQRD(); } else if(method == SPARSE) { -#if !defined(__sun__) +#ifndef __sun__ int column = SolveSparse(); return column; #endif @@ -456,7 +456,7 @@ namespace Isis { * @history 2011-03-17 Ken Edmundson Corrected computation of residuals * */ -#if !defined(__sun__) +#ifndef __sun__ int LeastSquares::SolveSparse() { // form "normal equations" matrix by multiplying ATA @@ -657,7 +657,7 @@ namespace Isis { * datum (i.e. constraining a minimum of seven parameters - * usually 3 coordinates of two points and 1 of a third). */ -#if !defined(__sun__) +#ifndef __sun__ bool LeastSquares::SparseErrorPropagation () { // clear memory diff --git a/isis/src/base/objs/LeastSquares/LeastSquares.h b/isis/src/base/objs/LeastSquares/LeastSquares.h index 3a616a4e52..7386c048fa 100644 --- a/isis/src/base/objs/LeastSquares/LeastSquares.h +++ b/isis/src/base/objs/LeastSquares/LeastSquares.h @@ -26,7 +26,7 @@ #include "tnt/tnt_array2d.h" -#if !defined(__sun__) +#ifndef __sun__ #include "gmm/gmm.h" #endif @@ -149,7 +149,7 @@ namespace Isis { int GetDegreesOfFreedom() { return p_degreesOfFreedom; } void Reset (); -#if !defined(__sun__) +#ifndef __sun__ void ResetSparse() { Reset(); } bool SparseErrorPropagation(); std::vector GetEpsilons () const { return p_epsilonsSparse; } @@ -163,7 +163,7 @@ namespace Isis { void SolveQRD(); void SolveCholesky () {} -#if !defined(__sun__) +#ifndef __sun__ int SolveSparse(); void FillSparseA(const std::vector &data); bool ApplyParameterWeights(); diff --git a/isis/src/base/objs/LimitPolygonSeeder/LimitPolygonSeeder.cpp b/isis/src/base/objs/LimitPolygonSeeder/LimitPolygonSeeder.cpp index 025b229e8e..f290da4293 100644 --- a/isis/src/base/objs/LimitPolygonSeeder/LimitPolygonSeeder.cpp +++ b/isis/src/base/objs/LimitPolygonSeeder/LimitPolygonSeeder.cpp @@ -69,8 +69,8 @@ namespace Isis { const geos::geom::Envelope *polyBoundBox = multiPoly->getEnvelopeInternal(); // Call the parents standardTests member - std::string msg = StandardTests(multiPoly, polyBoundBox); - if(!msg.empty()) { + QString msg = StandardTests(multiPoly, polyBoundBox); + if(!msg.isEmpty()) { return points; } @@ -177,7 +177,7 @@ namespace Isis { } } else { - std::string msg = "PVL for LimitPolygonSeeder must contain [MajorAxisPoints] in ["; + QString msg = "PVL for LimitPolygonSeeder must contain [MajorAxisPoints] in ["; msg += pvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -190,13 +190,13 @@ namespace Isis { } } else { - std::string msg = "PVL for LimitPolygonSeeder must contain [MinorAxisPoints] in ["; + QString msg = "PVL for LimitPolygonSeeder must contain [MinorAxisPoints] in ["; msg += pvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } } catch(IException &e) { - std::string msg = "Improper format for PolygonSeeder PVL [" + pvl.FileName() + "]"; + QString msg = "Improper format for PolygonSeeder PVL [" + pvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -211,14 +211,14 @@ namespace Isis { } } - PvlGroup LimitPolygonSeeder::PluginParameters(std::string grpName) { + PvlGroup LimitPolygonSeeder::PluginParameters(QString grpName) { PvlGroup pluginInfo(grpName); PvlKeyword name("Name", Algorithm()); - PvlKeyword minThickness("MinimumThickness", MinimumThickness()); - PvlKeyword minArea("MinimumArea", MinimumArea()); - PvlKeyword majAxis("MajorAxisPoints", p_majorAxisPts); - PvlKeyword minAxis("MinorAxisPoints", p_minorAxisPts); + PvlKeyword minThickness("MinimumThickness", toString(MinimumThickness())); + PvlKeyword minArea("MinimumArea", toString(MinimumArea())); + PvlKeyword majAxis("MajorAxisPoints", toString(p_majorAxisPts)); + PvlKeyword minAxis("MinorAxisPoints", toString(p_minorAxisPts)); pluginInfo.AddKeyword(name); pluginInfo.AddKeyword(minThickness); diff --git a/isis/src/base/objs/LimitPolygonSeeder/LimitPolygonSeeder.h b/isis/src/base/objs/LimitPolygonSeeder/LimitPolygonSeeder.h index 84d69f126c..3973b1d0c7 100644 --- a/isis/src/base/objs/LimitPolygonSeeder/LimitPolygonSeeder.h +++ b/isis/src/base/objs/LimitPolygonSeeder/LimitPolygonSeeder.h @@ -57,7 +57,7 @@ namespace Isis { * @history 2010-04-15 Eric Hyer - Now updates parent's invalidInput * variable * @history 2010-04-20 Christopher Austin - adapted for generic/unitless - * seeding + * seeding */ class LimitPolygonSeeder : public PolygonSeeder { public: @@ -68,7 +68,7 @@ namespace Isis { std::vector Seed(const geos::geom::MultiPolygon *mp); - virtual PvlGroup PluginParameters(std::string grpName); + virtual PvlGroup PluginParameters(QString grpName); protected: virtual void Parse(Pvl &pvl); diff --git a/isis/src/base/objs/LimitPolygonSeeder/unitTest.cpp b/isis/src/base/objs/LimitPolygonSeeder/unitTest.cpp index 8f41aea20e..439d78fe94 100644 --- a/isis/src/base/objs/LimitPolygonSeeder/unitTest.cpp +++ b/isis/src/base/objs/LimitPolygonSeeder/unitTest.cpp @@ -29,10 +29,10 @@ int main() { if(!alg.HasKeyword("Name")) { alg += PvlKeyword("Name", "Limit"); - alg += PvlKeyword("MinimumThickness", 0.3); - alg += PvlKeyword("MinimumArea", 5); - alg += PvlKeyword("MajorAxisPoints", 2); - alg += PvlKeyword("MinorAxisPoints", 2); + alg += PvlKeyword("MinimumThickness", "0.3"); + alg += PvlKeyword("MinimumArea", "5"); + alg += PvlKeyword("MajorAxisPoints", "2"); + alg += PvlKeyword("MinorAxisPoints", "2"); } PvlObject o("AutoSeed"); @@ -74,13 +74,13 @@ int main() { Isis::Pvl maplab; maplab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = maplab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); - mapGroup += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapGroup += Isis::PvlKeyword("EquatorialRadius", (QString)radii["EquatorialRadius"]); + mapGroup += Isis::PvlKeyword("PolarRadius", (QString)radii["PolarRadius"]); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", "360"); + mapGroup += Isis::PvlKeyword("CenterLatitude", "0"); + mapGroup += Isis::PvlKeyword("CenterLongitude", "0"); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); Projection *proj = Isis::ProjectionFactory::Create(maplab); @@ -137,13 +137,13 @@ int main() { Isis::Pvl maplab; maplab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = maplab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); - mapGroup += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapGroup += Isis::PvlKeyword("EquatorialRadius", (QString)radii["EquatorialRadius"]); + mapGroup += Isis::PvlKeyword("PolarRadius", (QString)radii["PolarRadius"]); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", "360"); + mapGroup += Isis::PvlKeyword("CenterLatitude", "0"); + mapGroup += Isis::PvlKeyword("CenterLongitude", "0"); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); //Projection *proj = Isis::ProjectionFactory::Create(maplab); diff --git a/isis/src/base/objs/LineEquation/LineEquation.h b/isis/src/base/objs/LineEquation/LineEquation.h index 18e85418d4..7f37ebc94f 100644 --- a/isis/src/base/objs/LineEquation/LineEquation.h +++ b/isis/src/base/objs/LineEquation/LineEquation.h @@ -1,4 +1,4 @@ -#if !defined(LineEquation_h) +#ifndef LineEquation_h #define LineEquation_h /** * @file diff --git a/isis/src/base/objs/LineManager/LineManager.cpp b/isis/src/base/objs/LineManager/LineManager.cpp index 618078df6d..e4a4d93185 100644 --- a/isis/src/base/objs/LineManager/LineManager.cpp +++ b/isis/src/base/objs/LineManager/LineManager.cpp @@ -23,8 +23,10 @@ #include "LineManager.h" #include "IException.h" +#include "IString.h" using namespace std; + namespace Isis { /** @@ -57,8 +59,8 @@ namespace Isis { bool LineManager::SetLine(const int line, const int band) { if(line < 1) { - string message = "LineManager is unable to set the line to [" - + IString(line) + "]. Minimum line value is 1."; + QString message = "LineManager is unable to set the line to [" + + toString(line) + "]. Minimum line value is 1."; throw IException(IException::Programmer, message, _FILEINFO_); } diff --git a/isis/src/base/objs/LineManager/unitTest.cpp b/isis/src/base/objs/LineManager/unitTest.cpp index e2b12e5841..857084b978 100644 --- a/isis/src/base/objs/LineManager/unitTest.cpp +++ b/isis/src/base/objs/LineManager/unitTest.cpp @@ -8,11 +8,12 @@ #include "LineManager.h" using namespace std; + int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); - string fname = "$base/testData/isisTruth.cub"; + QString fname = "$base/testData/isisTruth.cub"; Isis::Cube cube; cube.open(fname); diff --git a/isis/src/base/objs/LineScanCamera/unitTest.cpp b/isis/src/base/objs/LineScanCamera/unitTest.cpp index f7181e3ea0..33e8834f73 100644 --- a/isis/src/base/objs/LineScanCamera/unitTest.cpp +++ b/isis/src/base/objs/LineScanCamera/unitTest.cpp @@ -47,7 +47,7 @@ class MyCamera : public LineScanCamera { int main() { Preference::Preferences(true); - string inputFile = "$mgs/testData/ab102401.lev2.cub"; + QString inputFile = "$mgs/testData/ab102401.lev2.cub"; Pvl pvl(inputFile); MyCamera cam(pvl); diff --git a/isis/src/base/objs/LineScanCameraGroundMap/unitTest.cpp b/isis/src/base/objs/LineScanCameraGroundMap/unitTest.cpp index 2018bebee2..e46e87e23a 100644 --- a/isis/src/base/objs/LineScanCameraGroundMap/unitTest.cpp +++ b/isis/src/base/objs/LineScanCameraGroundMap/unitTest.cpp @@ -12,7 +12,7 @@ int main() { cerr << "This class is mostly tested by the applications and the individual Camera models." << endl; //create a camera for the test cube - string inputFile = "$base/testData/LRONAC_M139722912RE_cropped.cub"; + QString inputFile = "$base/testData/LRONAC_M139722912RE_cropped.cub"; CameraPointInfo campt; campt.SetCube(inputFile); diff --git a/isis/src/base/objs/LommelSeeliger/LommelSeeliger.h b/isis/src/base/objs/LommelSeeliger/LommelSeeliger.h index c1fdd766b1..6d85614f70 100644 --- a/isis/src/base/objs/LommelSeeliger/LommelSeeliger.h +++ b/isis/src/base/objs/LommelSeeliger/LommelSeeliger.h @@ -1,4 +1,4 @@ -#if !defined(LommelSeeliger_h) +#ifndef LommelSeeliger_h #define LommelSeeliger_h /** * @file diff --git a/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.cpp b/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.cpp index 74269d5ff1..a1643cd714 100644 --- a/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.cpp +++ b/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.cpp @@ -54,7 +54,7 @@ namespace Isis { m_maxLibration *= PI / 180.0; } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(IException::Unknown, message, _FILEINFO_); } } @@ -86,9 +86,9 @@ namespace Isis { /** * Returns the name of the map projection, "LunarAzimuthalEqualArea" * - * @return string Name of projection, "LunarAzimuthalEqualArea" + * @return QString Name of projection, "LunarAzimuthalEqualArea" */ - string LunarAzimuthalEqualArea::Name() const { + QString LunarAzimuthalEqualArea::Name() const { return "LunarAzimuthalEqualArea"; } @@ -96,9 +96,9 @@ namespace Isis { * Returns the version of the map projection * * - * @return string Version number + * @return QString Version number */ - string LunarAzimuthalEqualArea::Version() const { + QString LunarAzimuthalEqualArea::Version() const { return "0.1"; } diff --git a/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.h b/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.h index ae97d7d038..b7ce489b89 100644 --- a/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.h +++ b/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.h @@ -63,8 +63,8 @@ namespace Isis { ~LunarAzimuthalEqualArea(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; bool SetGround(const double lat, const double lon); bool SetCoordinate(const double x, const double y); diff --git a/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.truth b/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.truth index a355eded50..b694f0bb86 100644 --- a/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.truth +++ b/isis/src/base/objs/LunarAzimuthalEqualArea/LunarAzimuthalEqualArea.truth @@ -93,7 +93,7 @@ print the output of the XYRange and Mapping methods... Name method returns "LunarAzimuthalEqualArea"................ [ OK ] -Isis::Projection * s = &p; // p is this projection +Projection * s = &p; // p is this projection (*s == p) returns true! ..................................... [ OK ] created a second Projection reference p2 using the same pvl as p except for that PolarRadius = 42 diff --git a/isis/src/base/objs/LunarAzimuthalEqualArea/unitTest.cpp b/isis/src/base/objs/LunarAzimuthalEqualArea/unitTest.cpp index 5f231fb7a5..98732cbb4b 100644 --- a/isis/src/base/objs/LunarAzimuthalEqualArea/unitTest.cpp +++ b/isis/src/base/objs/LunarAzimuthalEqualArea/unitTest.cpp @@ -3,35 +3,39 @@ #include #include #include + #include "LunarAzimuthalEqualArea.h" #include "IException.h" +#include "IString.h" #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "UNIT TEST FOR LunarAzimuthalEqualArea\n\n"; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 6378206.4); - mapGroup += Isis::PvlKeyword("PolarRadius", 6378206.4); - mapGroup += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 180); - mapGroup += Isis::PvlKeyword("MinimumLatitude", -30.0); - mapGroup += Isis::PvlKeyword("MaximumLatitude", -15.0); - mapGroup += Isis::PvlKeyword("MinimumLongitude", -30.0); - mapGroup += Isis::PvlKeyword("MaximumLongitude", -15.0); - mapGroup += Isis::PvlKeyword("MaximumLibration", 1); - mapGroup += Isis::PvlKeyword("ProjectionName", + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup = lab.FindGroup("Mapping"); + mapGroup += PvlKeyword("EquatorialRadius", toString(6378206.4)); + mapGroup += PvlKeyword("PolarRadius", toString(6378206.4)); + mapGroup += PvlKeyword("LatitudeType", "Planetographic"); + mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup += PvlKeyword("LongitudeDomain", toString(180)); + mapGroup += PvlKeyword("MinimumLatitude", toString(-30.0)); + mapGroup += PvlKeyword("MaximumLatitude", toString(-15.0)); + mapGroup += PvlKeyword("MinimumLongitude", toString(-30.0)); + mapGroup += PvlKeyword("MaximumLongitude", toString(-15.0)); + mapGroup += PvlKeyword("MaximumLibration", toString(1)); + mapGroup += PvlKeyword("ProjectionName", "LunarAzimuthalEqualArea"); try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); + Projection &p = *ProjectionFactory::Create(lab); cout << "\n******* Test SetGround and SetCoordinate methods ********" << "\n\nfor all lat and lon in [-90..90] step 45" @@ -68,16 +72,16 @@ int main(int argc, char *argv[]) { else cout << "[ FAILED ]\n"; - Isis::Projection *s = &p; - cout << "\nIsis::Projection * s = &p; // p is this projection" + Projection *s = &p; + cout << "\nProjection * s = &p; // p is this projection" << "\n(*s == p) returns "; if(*s == p) cout << "true! ..................................... [ OK ]\n"; else cout << "false! .................................... [ FAILED ]\n"; - mapGroup["PolarRadius"].SetValue(42); - Isis::Pvl tmp1; - Isis::Projection &p2 = *Isis::ProjectionFactory::Create(lab); + mapGroup["PolarRadius"].SetValue(toString(42)); + Pvl tmp1; + Projection &p2 = *ProjectionFactory::Create(lab); tmp1.AddGroup(p2.Mapping()); s = &p2; cout << "created a second Projection reference p2" @@ -98,11 +102,11 @@ int main(int argc, char *argv[]) { << "\n Minimum Y: " << minY << "\n Maximum Y: " << maxY << "\n"; - Isis::Pvl tmp2; + Pvl tmp2; tmp2.AddGroup(p.Mapping()); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/LunarLambert/LunarLambert.h b/isis/src/base/objs/LunarLambert/LunarLambert.h index cdfe696b00..04d012c32d 100644 --- a/isis/src/base/objs/LunarLambert/LunarLambert.h +++ b/isis/src/base/objs/LunarLambert/LunarLambert.h @@ -1,4 +1,4 @@ -#if !defined(LunarLambert_h) +#ifndef LunarLambert_h #define LunarLambert_h /** * @file diff --git a/isis/src/base/objs/LunarLambertEmpirical/LunarLambertEmpirical.cpp b/isis/src/base/objs/LunarLambertEmpirical/LunarLambertEmpirical.cpp index 0ea0abf732..2afe42f3c8 100755 --- a/isis/src/base/objs/LunarLambertEmpirical/LunarLambertEmpirical.cpp +++ b/isis/src/base/objs/LunarLambertEmpirical/LunarLambertEmpirical.cpp @@ -11,19 +11,19 @@ namespace Isis { if (algo.HasKeyword("PhaseList")) { SetPhotoPhaseList(algo["PhaseList"]); } else { - std::string msg = "The empirical Lunar Lambert phase list was not provided by user"; + QString msg = "The empirical Lunar Lambert phase list was not provided by user"; throw IException(IException::User, msg, _FILEINFO_); } if (algo.HasKeyword("LList")) { SetPhotoLList(algo["LList"]); } else { - std::string msg = "The empirical Lunar Lambert l exponent list was not provided by user"; + QString msg = "The empirical Lunar Lambert l exponent list was not provided by user"; throw IException(IException::User, msg, _FILEINFO_); } if (algo.HasKeyword("PhaseCurveList")) { SetPhotoPhaseCurveList(algo["PhaseCurveList"]); } else { - std::string msg = "The empirical Lunar Lambert phase brightness list was not provided by user"; + QString msg = "The empirical Lunar Lambert phase brightness list was not provided by user"; throw IException(IException::User, msg, _FILEINFO_); } @@ -31,13 +31,13 @@ namespace Isis { p_photoPhaseAngleCount = (int)p_photoPhaseList.size(); if (p_photoPhaseAngleCount != (int)p_photoLList.size()) { - std::string msg = "Number of empirical Lunar Lambert l list values must be equal"; + QString msg = "Number of empirical Lunar Lambert l list values must be equal"; msg += "to number of phase angles provided"; throw IException(IException::User, msg, _FILEINFO_); } if (p_photoPhaseAngleCount != (int)p_photoPhaseCurveList.size()) { - std::string msg = "Number of empirical Lunar Lambert phase curve list values must be equal"; + QString msg = "Number of empirical Lunar Lambert phase curve list values must be equal"; msg += "to number of phase angles provided"; throw IException(IException::User, msg, _FILEINFO_); } @@ -70,7 +70,7 @@ namespace Isis { * * @param phaselist List of phase angles to interpolate */ - void LunarLambertEmpirical::SetPhotoPhaseList(const string phasestrlist) { + void LunarLambertEmpirical::SetPhotoPhaseList(QString phasestrlist) { double phaseangle; IString strlist(phasestrlist); p_photoPhaseList.clear(); @@ -78,8 +78,8 @@ namespace Isis { while (strlist.length()) { phaseangle = strlist.Token(","); if (phaseangle < 0.0 || phaseangle > 180.0) { - std::string msg = "Invalid value of empirical Lunar Lambert phase angle list value [" + - IString(phaseangle) + "]"; + QString msg = "Invalid value of empirical Lunar Lambert phase angle list value [" + + toString(phaseangle) + "]"; throw IException(IException::User, msg, _FILEINFO_); } p_photoPhaseList.push_back(phaseangle); @@ -96,7 +96,7 @@ namespace Isis { * * @param llist List of Lunar Lambert function exponents to interpolate */ - void LunarLambertEmpirical::SetPhotoLList(const string lstrlist) { + void LunarLambertEmpirical::SetPhotoLList(QString lstrlist) { double lvalue; IString strlist(lstrlist); p_photoLList.clear(); @@ -114,7 +114,7 @@ namespace Isis { * * @param phasecurvelist List of brightness values corresponding to Lunar Lambert function exponents */ - void LunarLambertEmpirical::SetPhotoPhaseCurveList(const string phasecurvestrlist) { + void LunarLambertEmpirical::SetPhotoPhaseCurveList(QString phasecurvestrlist) { double phasecurve; IString strlist(phasecurvestrlist); p_photoPhaseCurveList.clear(); diff --git a/isis/src/base/objs/LunarLambertEmpirical/LunarLambertEmpirical.h b/isis/src/base/objs/LunarLambertEmpirical/LunarLambertEmpirical.h index 186e6817fb..5bb8a21e07 100755 --- a/isis/src/base/objs/LunarLambertEmpirical/LunarLambertEmpirical.h +++ b/isis/src/base/objs/LunarLambertEmpirical/LunarLambertEmpirical.h @@ -1,4 +1,4 @@ -#if !defined(LunarLambertEmpirical_h) +#ifndef LunarLambertEmpirical_h #define LunarLambertEmpirical_h /** * @file @@ -61,9 +61,9 @@ namespace Isis { LunarLambertEmpirical(Pvl &pvl); virtual ~LunarLambertEmpirical(); - void SetPhotoPhaseList(const string phasestrlist); - void SetPhotoLList(const string kstrlist); - void SetPhotoPhaseCurveList(const string phasecurvestrlist); + void SetPhotoPhaseList(QString phasestrlist); + void SetPhotoLList(QString kstrlist); + void SetPhotoPhaseCurveList(QString phasecurvestrlist); //! Return photometric phase angle list // inline std::vector PhotoPhaseList() const { diff --git a/isis/src/base/objs/MaximumCorrelation/MaximumCorrelation.h b/isis/src/base/objs/MaximumCorrelation/MaximumCorrelation.h index a18f68f3ba..c426e97b3d 100644 --- a/isis/src/base/objs/MaximumCorrelation/MaximumCorrelation.h +++ b/isis/src/base/objs/MaximumCorrelation/MaximumCorrelation.h @@ -1,4 +1,4 @@ -#if !defined(MaximumCorrelation_h) +#ifndef MaximumCorrelation_h #define MaximumCorrelation_h /** * @file @@ -60,7 +60,7 @@ namespace Isis { virtual double IdealFit() const { return 1.0; }; - virtual IString AlgorithmName() const { + virtual QString AlgorithmName() const { return "MaximumCorrelation"; }; diff --git a/isis/src/base/objs/MaximumCorrelation/unitTest.cpp b/isis/src/base/objs/MaximumCorrelation/unitTest.cpp index 333d7dd6e1..a24794daaa 100644 --- a/isis/src/base/objs/MaximumCorrelation/unitTest.cpp +++ b/isis/src/base/objs/MaximumCorrelation/unitTest.cpp @@ -16,18 +16,18 @@ int main() { try { PvlGroup alg("Algorithm"); alg += PvlKeyword("Name", "MaximumCorrelation"); - alg += PvlKeyword("Tolerance", 0.1); + alg += PvlKeyword("Tolerance", "0.1"); alg += PvlKeyword("SubpixelAccuracy", "True"); PvlGroup pchip("PatternChip"); - pchip += PvlKeyword("Samples", 15); - pchip += PvlKeyword("Lines", 15); - pchip += PvlKeyword("Sampling", 50); - pchip += PvlKeyword("ValidPercent", 10); + pchip += PvlKeyword("Samples", "15"); + pchip += PvlKeyword("Lines", "15"); + pchip += PvlKeyword("Sampling", "50"); + pchip += PvlKeyword("ValidPercent", "10"); PvlGroup schip("SearchChip"); - schip += PvlKeyword("Samples", 35); - schip += PvlKeyword("Lines", 35); + schip += PvlKeyword("Samples", "35"); + schip += PvlKeyword("Lines", "35"); PvlObject o("AutoRegistration"); o.AddGroup(alg); diff --git a/isis/src/base/objs/Mercator/Mercator.cpp b/isis/src/base/objs/Mercator/Mercator.cpp index 95d4a3f39e..d75cac8fab 100644 --- a/isis/src/base/objs/Mercator/Mercator.cpp +++ b/isis/src/base/objs/Mercator/Mercator.cpp @@ -60,14 +60,14 @@ namespace Isis { // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = (m_minimumLongitude + m_maximumLongitude) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } // Compute and write the default center latitude if allowed and // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLatitude"))) { double lat = (m_minimumLatitude + m_maximumLatitude) / 2.0; - mapGroup += PvlKeyword("CenterLatitude", lat); + mapGroup += PvlKeyword("CenterLatitude", toString(lat)); } // Get the center longitude & latitude @@ -89,7 +89,7 @@ namespace Isis { m_scalefactor = cos_clat / sqrt(1.0 - m_eccsq * sin_clat * sin_clat); } catch (IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } } @@ -119,9 +119,9 @@ namespace Isis { /** * Returns the name of the map projection, "Mercator" * - * @return string Name of projection, "Mercator" + * @return QString Name of projection, "Mercator" */ - string Mercator::Name() const { + QString Mercator::Name() const { return "Mercator"; } @@ -129,9 +129,9 @@ namespace Isis { * Returns the version of the map projection * * - * @return string Version number + * @return QString Version number */ - string Mercator::Version() const { + QString Mercator::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/Mercator/Mercator.h b/isis/src/base/objs/Mercator/Mercator.h index f4bcd9f895..efe1b06dda 100644 --- a/isis/src/base/objs/Mercator/Mercator.h +++ b/isis/src/base/objs/Mercator/Mercator.h @@ -74,8 +74,8 @@ namespace Isis { ~Mercator(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; double TrueScaleLatitude() const; bool IsEquatorialCylindrical(); diff --git a/isis/src/base/objs/Mercator/unitTest.cpp b/isis/src/base/objs/Mercator/unitTest.cpp index acf79afee0..39fe2a091e 100644 --- a/isis/src/base/objs/Mercator/unitTest.cpp +++ b/isis/src/base/objs/Mercator/unitTest.cpp @@ -5,51 +5,53 @@ #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "UNIT TEST FOR Mercator" << endl << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 6378206.4); - mapGroup += Isis::PvlKeyword("PolarRadius", 6356583.8); - mapGroup += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 180); - mapGroup += Isis::PvlKeyword("MinimumLatitude", -70.0); - mapGroup += Isis::PvlKeyword("MaximumLatitude", 70.0); - mapGroup += Isis::PvlKeyword("MinimumLongitude", -180.0); - mapGroup += Isis::PvlKeyword("MaximumLongitude", 180.0); - mapGroup += Isis::PvlKeyword("ProjectionName", "Mercator"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup = lab.FindGroup("Mapping"); + mapGroup += PvlKeyword("EquatorialRadius", "6378206.4"); + mapGroup += PvlKeyword("PolarRadius", "6356583.8"); + mapGroup += PvlKeyword("LatitudeType", "Planetographic"); + mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup += PvlKeyword("LongitudeDomain", "180"); + mapGroup += PvlKeyword("MinimumLatitude", "-70.0"); + mapGroup += PvlKeyword("MaximumLatitude", "70.0"); + mapGroup += PvlKeyword("MinimumLongitude", "-180.0"); + mapGroup += PvlKeyword("MaximumLongitude", "180.0"); + mapGroup += PvlKeyword("ProjectionName", "Mercator"); cout << "Test missing center longitude keyword ..." << endl; try { - Isis::Mercator p(lab); + Mercator p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLongitude", -180.0); + mapGroup += PvlKeyword("CenterLongitude", "-180.0"); cout << "Test missing center latitude keyword..." << endl; try { - Isis::Mercator p(lab); + Mercator p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLatitude", 0.0); + mapGroup += PvlKeyword("CenterLatitude", "0.0"); try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); - // Isis::Mercator p(lab); + Projection &p = *ProjectionFactory::Create(lab); + // Mercator p(lab); cout << "Test SetGround method ... " << endl; cout << std::setprecision(9); @@ -80,7 +82,7 @@ int main(int argc, char *argv[]) { cout << "Maximum Y: " << maxY << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; @@ -89,7 +91,7 @@ int main(int argc, char *argv[]) { cout << "Test default computation ... " << endl; mapGroup.DeleteKeyword("CenterLongitude"); mapGroup.DeleteKeyword("CenterLatitude"); - Isis::Mercator p2(lab, true); + Mercator p2(lab, true); cout << lab << endl; cout << endl; @@ -99,9 +101,9 @@ int main(int argc, char *argv[]) { cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -119,7 +121,7 @@ int main(int argc, char *argv[]) { cout << " USGS Professional Paper 1395 by John P. Snyder" << endl; cout << " Pages 267-268" << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/Message/ArraySubscriptNotInRange.cpp b/isis/src/base/objs/Message/ArraySubscriptNotInRange.cpp index 287dba1dc3..e10223d3b2 100644 --- a/isis/src/base/objs/Message/ArraySubscriptNotInRange.cpp +++ b/isis/src/base/objs/Message/ArraySubscriptNotInRange.cpp @@ -24,10 +24,10 @@ using namespace std; #include + +#include "IString.h" #include "Message.h" -string Isis::Message::ArraySubscriptNotInRange(const int index) { - ostringstream os; - os << "Array subscript [" << index << "] is out of array bounds"; - return os.str(); +QString Isis::Message::ArraySubscriptNotInRange(int index) { + return "Array subscript [" + toString(index) + "] is out of array bounds"; } diff --git a/isis/src/base/objs/Message/FileCreate.cpp b/isis/src/base/objs/Message/FileCreate.cpp index ac7f3fb956..10f5ecec79 100644 --- a/isis/src/base/objs/Message/FileCreate.cpp +++ b/isis/src/base/objs/Message/FileCreate.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::FileCreate(const string &filename) { - string message; - message = "Unable to create [" + filename + "]"; - return message; +QString Isis::Message::FileCreate(const QString &filename) { + return "Unable to create [" + filename + "]"; } diff --git a/isis/src/base/objs/Message/FileOpen.cpp b/isis/src/base/objs/Message/FileOpen.cpp index acc5f4fd54..07ac66dfb2 100644 --- a/isis/src/base/objs/Message/FileOpen.cpp +++ b/isis/src/base/objs/Message/FileOpen.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::FileOpen(const string &filename) { - string message; - message = "Unable to open [" + filename + "]"; - return message; +QString Isis::Message::FileOpen(const QString &filename) { + return "Unable to open [" + filename + "]"; } diff --git a/isis/src/base/objs/Message/FileRead.cpp b/isis/src/base/objs/Message/FileRead.cpp index 1d1ded823f..b1c58bea62 100644 --- a/isis/src/base/objs/Message/FileRead.cpp +++ b/isis/src/base/objs/Message/FileRead.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::FileRead(const string &filename) { - string message; - message = "Unable to read [" + filename + "]"; - return message; +QString Isis::Message::FileRead(const QString &filename) { + return "Unable to read [" + filename + "]"; } diff --git a/isis/src/base/objs/Message/FileWrite.cpp b/isis/src/base/objs/Message/FileWrite.cpp index a111a6fc5f..23213a6ca9 100644 --- a/isis/src/base/objs/Message/FileWrite.cpp +++ b/isis/src/base/objs/Message/FileWrite.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::FileWrite(const string &filename) { - string message; - message = "Unable to write [" + filename + "]"; - return message; +QString Isis::Message::FileWrite(const QString &filename) { + return "Unable to write [" + filename + "]"; } diff --git a/isis/src/base/objs/Message/KeywordAmbiguous.cpp b/isis/src/base/objs/Message/KeywordAmbiguous.cpp index 685a727d4a..43beb5208a 100644 --- a/isis/src/base/objs/Message/KeywordAmbiguous.cpp +++ b/isis/src/base/objs/Message/KeywordAmbiguous.cpp @@ -27,8 +27,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordAmbiguous(const string &key) { - string message; - message = "Keyword [" + key + "] ambiguous"; - return message; +QString Isis::Message::KeywordAmbiguous(const QString &key) { + return "Keyword [" + key + "] ambiguous"; } diff --git a/isis/src/base/objs/Message/KeywordBlockEndMissing.cpp b/isis/src/base/objs/Message/KeywordBlockEndMissing.cpp index fb300a04f2..a70e06ceaa 100644 --- a/isis/src/base/objs/Message/KeywordBlockEndMissing.cpp +++ b/isis/src/base/objs/Message/KeywordBlockEndMissing.cpp @@ -25,10 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordBlockEndMissing -(const string &block, const string &found) { - string message; - message = "Expecting end of keyword block [" + block + "] " + - "but found [" + found + "]"; - return message; +QString Isis::Message::KeywordBlockEndMissing(const QString &block, const QString &found) { + return "Expecting end of keyword block [" + block + "] but found [" + found + "]"; } diff --git a/isis/src/base/objs/Message/KeywordBlockInvalid.cpp b/isis/src/base/objs/Message/KeywordBlockInvalid.cpp index beb68e2c59..b00eb3259e 100644 --- a/isis/src/base/objs/Message/KeywordBlockInvalid.cpp +++ b/isis/src/base/objs/Message/KeywordBlockInvalid.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordBlockInvalid(const string &block) { - string message; - message = "Keyword block [" + block + "] is invalid"; - return message; +QString Isis::Message::KeywordBlockInvalid(const QString &block) { + return "Keyword block [" + block + "] is invalid"; } diff --git a/isis/src/base/objs/Message/KeywordBlockStartMissing.cpp b/isis/src/base/objs/Message/KeywordBlockStartMissing.cpp index e7494caeed..188416ba30 100644 --- a/isis/src/base/objs/Message/KeywordBlockStartMissing.cpp +++ b/isis/src/base/objs/Message/KeywordBlockStartMissing.cpp @@ -25,10 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordBlockStartMissing -(const string &block, const string &found) { - string message; - message = "Expecting start of keyword block [" + block + "] " + - "but found [" + found + "]"; - return message; +QString Isis::Message::KeywordBlockStartMissing(const QString &block, const QString &found) { + return "Expecting start of keyword block [" + block + "] but found [" + found + "]"; } diff --git a/isis/src/base/objs/Message/KeywordDuplicated.cpp b/isis/src/base/objs/Message/KeywordDuplicated.cpp index 8b8940bc42..7fe49cea32 100644 --- a/isis/src/base/objs/Message/KeywordDuplicated.cpp +++ b/isis/src/base/objs/Message/KeywordDuplicated.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordDuplicated(const string &key) { - string message; - message = "Keyword [" + key + "] duplicated"; - return message; +QString Isis::Message::KeywordDuplicated(const QString &key) { + return "Keyword [" + key + "] duplicated"; } diff --git a/isis/src/base/objs/Message/KeywordNotArray.cpp b/isis/src/base/objs/Message/KeywordNotArray.cpp index b478978a08..c9865c208c 100644 --- a/isis/src/base/objs/Message/KeywordNotArray.cpp +++ b/isis/src/base/objs/Message/KeywordNotArray.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordNotArray(const string &key) { - string message; - message = "Keyword [" + key + "] is not an array"; - return message; +QString Isis::Message::KeywordNotArray(const QString &key) { + return "Keyword [" + key + "] is not an array"; } diff --git a/isis/src/base/objs/Message/KeywordNotFound.cpp b/isis/src/base/objs/Message/KeywordNotFound.cpp index 590fbe4210..1b4eaed041 100644 --- a/isis/src/base/objs/Message/KeywordNotFound.cpp +++ b/isis/src/base/objs/Message/KeywordNotFound.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordNotFound(const string &key) { - string message; - message = "Keyword [" + key + "] required but was not found"; - return message; +QString Isis::Message::KeywordNotFound(const QString &key) { + return "Keyword [" + key + "] required but was not found"; } diff --git a/isis/src/base/objs/Message/KeywordUnrecognized.cpp b/isis/src/base/objs/Message/KeywordUnrecognized.cpp index 64883534fc..09fa197d24 100644 --- a/isis/src/base/objs/Message/KeywordUnrecognized.cpp +++ b/isis/src/base/objs/Message/KeywordUnrecognized.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordUnrecognized(const string &key) { - string message; - message = "Keyword [" + key + "] unrecognized"; - return message; +QString Isis::Message::KeywordUnrecognized(const QString &key) { + return "Keyword [" + key + "] unrecognized"; } diff --git a/isis/src/base/objs/Message/KeywordValueBad.cpp b/isis/src/base/objs/Message/KeywordValueBad.cpp index a440ecdb69..4ed5a39e5c 100644 --- a/isis/src/base/objs/Message/KeywordValueBad.cpp +++ b/isis/src/base/objs/Message/KeywordValueBad.cpp @@ -25,21 +25,19 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordValueBad(const string &key) { - string message; - message = "Keyword [" + key + "] has bad value"; - return message; +QString Isis::Message::KeywordValueBad(const QString &key) { + return "Keyword [" + key + "] has bad value"; } -string Isis::Message::KeywordValueBad(const string &key, const string &value) { - string message; +QString Isis::Message::KeywordValueBad(const QString &key, const QString &value) { + QString message; message = "Keyword [" + key + "] has bad value ["; if(value.size() <= 20) { message += value + "]"; } else { - message += value.substr(0, 20) + " ...]"; + message += value.mid(0, 20) + " ...]"; } return message; } diff --git a/isis/src/base/objs/Message/KeywordValueExpected.cpp b/isis/src/base/objs/Message/KeywordValueExpected.cpp index be75523f41..8dda11d818 100644 --- a/isis/src/base/objs/Message/KeywordValueExpected.cpp +++ b/isis/src/base/objs/Message/KeywordValueExpected.cpp @@ -25,8 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordValueExpected(const string &key) { - string message; - message = "Keyword value for [" + key + "] expected but was not found"; - return message; +QString Isis::Message::KeywordValueExpected(const QString &key) { + return "Keyword value for [" + key + "] expected but was not found"; } diff --git a/isis/src/base/objs/Message/KeywordValueNotInList.cpp b/isis/src/base/objs/Message/KeywordValueNotInList.cpp index 14da7f2b2b..9582ca6e06 100644 --- a/isis/src/base/objs/Message/KeywordValueNotInList.cpp +++ b/isis/src/base/objs/Message/KeywordValueNotInList.cpp @@ -25,9 +25,9 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordValueNotInList -(const string &key, const string &value, const vector &list) { - string message; +QString Isis::Message::KeywordValueNotInList(const QString &key, const QString &value, + const vector &list) { + QString message; message = "Keyword [" + key + "=" + value + "] must be one of ["; for(unsigned int i = 0; i < list.size(); i++) { message += list[i]; diff --git a/isis/src/base/objs/Message/KeywordValueNotInRange.cpp b/isis/src/base/objs/Message/KeywordValueNotInRange.cpp index be1f39bd9a..2abbaf825c 100644 --- a/isis/src/base/objs/Message/KeywordValueNotInRange.cpp +++ b/isis/src/base/objs/Message/KeywordValueNotInRange.cpp @@ -25,10 +25,6 @@ using namespace std; #include "Message.h" -string Isis::Message::KeywordValueNotInRange -(const string &key, const string &value, const string &range) { - string message; - message = "Keyword [" + key + "=" + value + "] " + - "is not in the range of " + range; - return message; +QString Isis::Message::KeywordValueNotInRange(const QString &key, const QString &value, const QString &range) { + return "Keyword [" + key + "=" + value + "] is not in the range of " + range; } diff --git a/isis/src/base/objs/Message/MemoryAllocationFailed.cpp b/isis/src/base/objs/Message/MemoryAllocationFailed.cpp index 9291ffcea2..547fd90d05 100644 --- a/isis/src/base/objs/Message/MemoryAllocationFailed.cpp +++ b/isis/src/base/objs/Message/MemoryAllocationFailed.cpp @@ -2,8 +2,6 @@ using namespace std; #include "Message.h" -string Isis::Message::MemoryAllocationFailed() { - string message; - message = "Unable to allocate dynamic memory"; - return message; +QString Isis::Message::MemoryAllocationFailed() { + return "Unable to allocate dynamic memory"; } diff --git a/isis/src/base/objs/Message/Message.h b/isis/src/base/objs/Message/Message.h index d7a5fd648d..33986890e4 100644 --- a/isis/src/base/objs/Message/Message.h +++ b/isis/src/base/objs/Message/Message.h @@ -24,7 +24,7 @@ #ifndef Message_h #define Message_h -#include +#include #include namespace Isis { @@ -32,17 +32,16 @@ namespace Isis { * isis/src/docsys/Object/build/isisDoxyDefs.doxydef */ namespace Message { - using namespace std; /** * This error should be used when an Isis object or application is checking * array bounds and the legal range has been violated. * * @param index - Array index which is out of bounds * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string ArraySubscriptNotInRange(const int index); + QString ArraySubscriptNotInRange(int index); /** * This error should be used when a supplied keyword for an Isis application @@ -51,10 +50,10 @@ namespace Isis { * * @param key - The name of the keyword which is ambiguous * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordAmbiguous(const string &key); + QString KeywordAmbiguous(const QString &key); /** * This error should be used when a supplied keyword for an Isis application @@ -62,10 +61,10 @@ namespace Isis { * * @param key - The name of the keyword which is unrecognized * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordUnrecognized(const string &key); + QString KeywordUnrecognized(const QString &key); /** * This error should be used when a supplied keyword for an Isis application @@ -73,10 +72,10 @@ namespace Isis { * * @param key - The name of the keyword which has been duplicated * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordDuplicated(const string &key); + QString KeywordDuplicated(const QString &key); /** * This error should be used when a supplied keyword is being used as an @@ -84,10 +83,10 @@ namespace Isis { * * @param key - The name of the keyword which is not an array * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordNotArray(const string &key); + QString KeywordNotArray(const QString &key); /** * This error should be used when a supplied keyword is not defined in the @@ -95,42 +94,42 @@ namespace Isis { * * @param key - The name of the keyword which was not found * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordNotFound(const string &key); + QString KeywordNotFound(const QString &key); /** * This error has been deprecated and should not be used in new code. * * @param block - The name of the invalid keyword block * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordBlockInvalid(const string &block); + QString KeywordBlockInvalid(const QString &block); /** * This error has been deprecated and should not be used in new code. * * @param block - The name of the block with the missing start tag - * @param found - The string found in the place of the missing block start + * @param found - The QString found in the place of the missing block start * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordBlockStartMissing(const string &block, const string &found); + QString KeywordBlockStartMissing(const QString &block, const QString &found); /** * This error has been deprecated and should not be used in new code. * * @param block - The name of the block with the missing end tag - * @param found - The string found in the place of the missing block end + * @param found - The QString found in the place of the missing block end * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordBlockEndMissing(const string &block, const string &found); + QString KeywordBlockEndMissing(const QString &block, const QString &found); /** * This error should be used when a supplied keyword does not appear in @@ -138,10 +137,10 @@ namespace Isis { * * @param key - The name of the keyword which is bad * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordValueBad(const string &key); + QString KeywordValueBad(const QString &key); /** * This error should be used when the value of a supplied keyword is @@ -150,10 +149,10 @@ namespace Isis { * @param key - The keyword name which is bad * @param value - The value of the keyword which is bad * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordValueBad(const string &key, const string &value); + QString KeywordValueBad(const QString &key, const QString &value); /** * This error should be used when the value of a supplied keyword was @@ -161,10 +160,10 @@ namespace Isis { * * @param key - The keyword name which is bad * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordValueExpected(const string &key); + QString KeywordValueExpected(const QString &key); /** * This error should be used when the value of a supplied keyword is @@ -173,13 +172,13 @@ namespace Isis { * @param key - The keyword name which has a bad value * @param value - The value of the keyword * @param range - The minimum and maximum allowed values for the keyword - * formatted and inserted into a string + * formatted and inserted into a QString * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordValueNotInRange(const string &key, const string &value, - const string &range); + QString KeywordValueNotInRange(const QString &key, const QString &value, + const QString &range); /** * This error should be used when the value of a supplied keyword is @@ -189,21 +188,21 @@ namespace Isis { * @param value - The value of the keyword * @param list - A vector of all the legal values for the keyword * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string KeywordValueNotInList(const string &key, const string &value, - const vector &list); + QString KeywordValueNotInList(const QString &key, const QString &value, + const std::vector &list); /** * This error should be used when a delimiter is missing. * * @param delimiter - The delimiter that is missing * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string MissingDelimiter(const char delimiter); + QString MissingDelimiter(const char delimiter); /** * This error should be used when a delimiter is missing. @@ -211,59 +210,59 @@ namespace Isis { * @param delimiter - The delimiter that is missing * @param near - The value the missing delimiter is near * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string MissingDelimiter(const char delimiter, const string &near); + QString MissingDelimiter(const char delimiter, const QString &near); /** * This error should be used when a file could not be opened. * * @param filename - The name of the file * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string FileOpen(const string &filename); + QString FileOpen(const QString &filename); /** * This error should be used when a file could not be created. * * @param filename - The name of the file * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string FileCreate(const string &filename); + QString FileCreate(const QString &filename); /** * This error should be used when an error accrues during a read of a file. * * @param filename - The name of the file * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string FileRead(const string &filename); + QString FileRead(const QString &filename); /** * This error should be used when an error accrues during a write to a file. * * @param filename - The name of the file * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string FileWrite(const string &filename); + QString FileWrite(const QString &filename); /** * This error should be used when an error accrues during a memory * allocation such as "new". * - * @return string - A standardized Isis error message with the parameter + * @return QString - A standardized Isis error message with the parameter * inserted */ - string MemoryAllocationFailed(); + QString MemoryAllocationFailed(); } } diff --git a/isis/src/base/objs/Message/MissingDelimiter.cpp b/isis/src/base/objs/Message/MissingDelimiter.cpp index e3059a229f..def8d68eee 100644 --- a/isis/src/base/objs/Message/MissingDelimiter.cpp +++ b/isis/src/base/objs/Message/MissingDelimiter.cpp @@ -1,23 +1,23 @@ using namespace std; #include + +#include "IString.h" #include "Message.h" -string Isis::Message::MissingDelimiter(const char d) { - ostringstream os; - os << "Missing delimiter [" << d << "]"; - return os.str(); +QString Isis::Message::MissingDelimiter(char d) { + return "Missing delimiter [" + toString(d) + "]"; } -string Isis::Message::MissingDelimiter(const char d, const string &near) { - ostringstream os; - - os << "Missing delimiter [" << d << "] at or near ["; +QString Isis::Message::MissingDelimiter(char d, const QString &near) { + QString message = "Missing delimiter [" + toString(d) + "] at or near ["; + if(near.size() <= 20) { - os << near << "]"; + message += near + "]"; } else { - os << near.substr(0, 20) << " ...]"; + message += near.mid(0, 20) + " ...]"; } - return os.str(); + + return message; } diff --git a/isis/src/base/objs/Message/unitTest.cpp b/isis/src/base/objs/Message/unitTest.cpp index 2a90a8434e..05b3741238 100644 --- a/isis/src/base/objs/Message/unitTest.cpp +++ b/isis/src/base/objs/Message/unitTest.cpp @@ -1,96 +1,99 @@ #include + #include "Message.h" #include "Preference.h" +#include "IString.h" +using namespace Isis; using namespace std; + int main(void) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); //*************************************************************************** - - cout << Isis::Message::ArraySubscriptNotInRange(100000) + cout << Message::ArraySubscriptNotInRange(100000) << endl; cout << endl; //*************************************************************************** - cout << Isis::Message::KeywordAmbiguous("KEY") + cout << Message::KeywordAmbiguous("KEY") << endl; - cout << Isis::Message::KeywordUnrecognized("KEY") + cout << Message::KeywordUnrecognized("KEY") << endl; - cout << Isis::Message::KeywordDuplicated("KEY") + cout << Message::KeywordDuplicated("KEY") << endl; - cout << Isis::Message::KeywordNotArray("KEY") + cout << Message::KeywordNotArray("KEY") << endl; - cout << Isis::Message::KeywordNotFound("KEY") + cout << Message::KeywordNotFound("KEY") << endl; cout << endl; //*************************************************************************** - cout << Isis::Message::KeywordBlockInvalid("BLOCK") + cout << Message::KeywordBlockInvalid("BLOCK") << endl; - cout << Isis::Message::KeywordBlockStartMissing("BLOCK", "FOUND") + cout << Message::KeywordBlockStartMissing("BLOCK", "FOUND") << endl; - cout << Isis::Message::KeywordBlockEndMissing("BLOCK", "FOUND") + cout << Message::KeywordBlockEndMissing("BLOCK", "FOUND") << endl; cout << endl; //*************************************************************************** - cout << Isis::Message::KeywordValueBad("KEY") + cout << Message::KeywordValueBad("KEY") << endl; - cout << Isis::Message::KeywordValueBad("KEY", "12345678901234567890") + cout << Message::KeywordValueBad("KEY", "12345678901234567890") << endl; - cout << Isis::Message::KeywordValueBad("KEY", "abcdefghijklmnopqrstuvwxyz") + cout << Message::KeywordValueBad("KEY", "abcdefghijklmnopqrstuvwxyz") << endl; - cout << Isis::Message::KeywordValueExpected("KEY") + cout << Message::KeywordValueExpected("KEY") << endl; - cout << Isis::Message::KeywordValueNotInRange("KEY", "0", "(0,20]") + cout << Message::KeywordValueNotInRange("KEY", "0", "(0,20]") << endl; - vector list; + vector list; list.push_back("X"); list.push_back("Y"); list.push_back("Z"); - cout << Isis::Message::KeywordValueNotInList("KEY", "A", list) + cout << Message::KeywordValueNotInList("KEY", "A", list) << endl; cout << endl; //*************************************************************************** - cout << Isis::Message::MissingDelimiter(')') + cout << Message::MissingDelimiter(')') << endl; - cout << Isis::Message::MissingDelimiter(')', "12345678901234567890") + cout << Message::MissingDelimiter(')', "12345678901234567890") << endl; - cout << Isis::Message::MissingDelimiter(')', "abcdefghijklmnopqrstuvwxyz") + cout << Message::MissingDelimiter(')', "abcdefghijklmnopqrstuvwxyz") << endl; cout << endl; //*************************************************************************** - cout << Isis::Message::FileOpen("test.dat") << endl; - cout << Isis::Message::FileCreate("test.dat") << endl; - cout << Isis::Message::FileRead("test.dat") << endl; - cout << Isis::Message::FileWrite("test.dat") << endl; + cout << Message::FileOpen("test.dat") << endl; + cout << Message::FileCreate("test.dat") << endl; + cout << Message::FileRead("test.dat") << endl; + cout << Message::FileWrite("test.dat") << endl; cout << endl; } diff --git a/isis/src/base/objs/MinimumDifference/MinimumDifference.h b/isis/src/base/objs/MinimumDifference/MinimumDifference.h index 855bda8284..d628d0a3d5 100644 --- a/isis/src/base/objs/MinimumDifference/MinimumDifference.h +++ b/isis/src/base/objs/MinimumDifference/MinimumDifference.h @@ -1,4 +1,4 @@ -#if !defined(MinimumDifference_h) +#ifndef MinimumDifference_h #define MinimumDifference_h /** * @file @@ -84,7 +84,7 @@ namespace Isis { virtual double IdealFit() const { return 0.0; }; - virtual IString AlgorithmName() const { + virtual QString AlgorithmName() const { return "MinimumDifference"; }; diff --git a/isis/src/base/objs/MinimumDifference/unitTest.cpp b/isis/src/base/objs/MinimumDifference/unitTest.cpp index f5047c428a..db4ef8bbb8 100644 --- a/isis/src/base/objs/MinimumDifference/unitTest.cpp +++ b/isis/src/base/objs/MinimumDifference/unitTest.cpp @@ -16,19 +16,19 @@ int main() { try { PvlGroup alg("Algorithm"); alg += PvlKeyword("Name", "MinimumDifference"); - alg += PvlKeyword("Tolerance", 5.0); + alg += PvlKeyword("Tolerance", "5.0"); alg += PvlKeyword("SubpixelAccuracy", "True"); PvlGroup pchip("PatternChip"); - pchip += PvlKeyword("Samples", 15); - pchip += PvlKeyword("Lines", 15); - pchip += PvlKeyword("Sampling", 25); - pchip += PvlKeyword("ValidPercent", 10); + pchip += PvlKeyword("Samples", "15"); + pchip += PvlKeyword("Lines", "15"); + pchip += PvlKeyword("Sampling", "25"); + pchip += PvlKeyword("ValidPercent", "10"); PvlGroup schip("SearchChip"); - schip += PvlKeyword("Samples", 35); - schip += PvlKeyword("Lines", 35); - schip += PvlKeyword("Sampling", 50); + schip += PvlKeyword("Samples", "35"); + schip += PvlKeyword("Lines", "35"); + schip += PvlKeyword("Sampling", "50"); PvlObject o("AutoRegistration"); o.AddGroup(alg); diff --git a/isis/src/base/objs/Minnaert/Minnaert.h b/isis/src/base/objs/Minnaert/Minnaert.h index 6cf06de90c..8b5ddc06be 100644 --- a/isis/src/base/objs/Minnaert/Minnaert.h +++ b/isis/src/base/objs/Minnaert/Minnaert.h @@ -1,4 +1,4 @@ -#if !defined(Minnaert_h) +#ifndef Minnaert_h #define Minnaert_h /** * @file diff --git a/isis/src/base/objs/MinnaertEmpirical/MinnaertEmpirical.cpp b/isis/src/base/objs/MinnaertEmpirical/MinnaertEmpirical.cpp index d5a26572ac..7e70a98894 100755 --- a/isis/src/base/objs/MinnaertEmpirical/MinnaertEmpirical.cpp +++ b/isis/src/base/objs/MinnaertEmpirical/MinnaertEmpirical.cpp @@ -70,7 +70,7 @@ namespace Isis { * * @param phaselist List of phase angles to interpolate */ - void MinnaertEmpirical::SetPhotoPhaseList(const string phasestrlist) { + void MinnaertEmpirical::SetPhotoPhaseList(QString phasestrlist) { double phaseangle; IString strlist(phasestrlist); p_photoPhaseList.clear(); @@ -95,7 +95,7 @@ namespace Isis { * * @param klist List of Minnaert function exponents to interpolate */ - void MinnaertEmpirical::SetPhotoKList(const string kstrlist) { + void MinnaertEmpirical::SetPhotoKList(QString kstrlist) { double kvalue; IString strlist(kstrlist); p_photoKList.clear(); @@ -118,7 +118,7 @@ namespace Isis { * * @param phasecurvelist List of brightness values corresponding to Minnaert function exponents */ - void MinnaertEmpirical::SetPhotoPhaseCurveList(const string phasecurvestrlist) { + void MinnaertEmpirical::SetPhotoPhaseCurveList(QString phasecurvestrlist) { double phasecurve; IString strlist(phasecurvestrlist); p_photoPhaseCurveList.clear(); diff --git a/isis/src/base/objs/MinnaertEmpirical/MinnaertEmpirical.h b/isis/src/base/objs/MinnaertEmpirical/MinnaertEmpirical.h index 7fc2936157..525e644eca 100755 --- a/isis/src/base/objs/MinnaertEmpirical/MinnaertEmpirical.h +++ b/isis/src/base/objs/MinnaertEmpirical/MinnaertEmpirical.h @@ -1,4 +1,4 @@ -#if !defined(MinnaertEmpirical_h) +#ifndef MinnaertEmpirical_h #define MinnaertEmpirical_h /** * @file @@ -61,9 +61,9 @@ namespace Isis { MinnaertEmpirical(Pvl &pvl); virtual ~MinnaertEmpirical(); - void SetPhotoPhaseList(const string phasestrlist); - void SetPhotoKList(const string kstrlist); - void SetPhotoPhaseCurveList(const string phasecurvestrlist); + void SetPhotoPhaseList(QString phasestrlist); + void SetPhotoKList(QString kstrlist); + void SetPhotoPhaseCurveList(QString phasecurvestrlist); //! Return photometric phase angle list // inline std::vector PhotoPhaseList() const { diff --git a/isis/src/base/objs/Mixed/Mixed.h b/isis/src/base/objs/Mixed/Mixed.h index adda1f2ac1..5196c66ae1 100644 --- a/isis/src/base/objs/Mixed/Mixed.h +++ b/isis/src/base/objs/Mixed/Mixed.h @@ -1,4 +1,4 @@ -#if !defined(Mixed_h) +#ifndef Mixed_h #define Mixed_h /** * @file diff --git a/isis/src/base/objs/Mixed/Mixed.truth b/isis/src/base/objs/Mixed/Mixed.truth index d54e238615..f4c4fa839f 100644 --- a/isis/src/base/objs/Mixed/Mixed.truth +++ b/isis/src/base/objs/Mixed/Mixed.truth @@ -9,7 +9,7 @@ End_Object Object = NormalizationModel Group = Algorithm Name = Mixed - Albedo = 0.0690507 + Albedo = .0690507 Incmat = 51.0 End_Group End_Object diff --git a/isis/src/base/objs/Mixed/unitTest.cpp b/isis/src/base/objs/Mixed/unitTest.cpp index bd17564c3c..a128735e9e 100644 --- a/isis/src/base/objs/Mixed/unitTest.cpp +++ b/isis/src/base/objs/Mixed/unitTest.cpp @@ -28,8 +28,8 @@ int main() { PvlGroup algn("Algorithm"); algn += PvlKeyword("Name", "Mixed"); - algn += PvlKeyword("Albedo", .0690507); - algn += PvlKeyword("Incmat", 51.0); + algn += PvlKeyword("Albedo", ".0690507"); + algn += PvlKeyword("Incmat", "51.0"); PvlObject on("NormalizationModel"); on.AddGroup(algn); diff --git a/isis/src/base/objs/MoonAlbedo/MoonAlbedo.h b/isis/src/base/objs/MoonAlbedo/MoonAlbedo.h index d6e371d4b4..87b47e27a6 100644 --- a/isis/src/base/objs/MoonAlbedo/MoonAlbedo.h +++ b/isis/src/base/objs/MoonAlbedo/MoonAlbedo.h @@ -1,4 +1,4 @@ -#if !defined(MoonAlbedo_h) +#ifndef MoonAlbedo_h #define MoonAlbedo_h /** * @file diff --git a/isis/src/base/objs/MoravecOperator/unitTest.cpp b/isis/src/base/objs/MoravecOperator/unitTest.cpp index 7b5e72d733..3f7f407947 100644 --- a/isis/src/base/objs/MoravecOperator/unitTest.cpp +++ b/isis/src/base/objs/MoravecOperator/unitTest.cpp @@ -19,21 +19,21 @@ int main() { try { PvlGroup op("Operator"); op += PvlKeyword("Name", "Moravec"); - op += PvlKeyword("DeltaSamp", 100); - op += PvlKeyword("DeltaLine", 100); - op += PvlKeyword("Samples", 15); - op += PvlKeyword("Lines", 15); - op += PvlKeyword("MinimumDN", 0.0); - op += PvlKeyword("MaximumDN", 1.0); - op += PvlKeyword("MinimumInterest", 0.0); + op += PvlKeyword("DeltaSamp", "100"); + op += PvlKeyword("DeltaLine", "100"); + op += PvlKeyword("Samples", "15"); + op += PvlKeyword("Lines", "15"); + op += PvlKeyword("MinimumDN", "0.0"); + op += PvlKeyword("MaximumDN", "1.0"); + op += PvlKeyword("MinimumInterest", "0.0"); PvlGroup opv("ValidMeasure"); - opv += PvlKeyword("MinDN", 0.0); - opv += PvlKeyword("MaxDN", 1.0); - opv += PvlKeyword("MinEmission", 15.0); - opv += PvlKeyword("MaxEmission", 25.0); - opv += PvlKeyword("MinIncidence", 0.0); - opv += PvlKeyword("MaxIncidence", 135.0); + opv += PvlKeyword("MinDN", "0.0"); + opv += PvlKeyword("MaxDN", "1.0"); + opv += PvlKeyword("MinEmission", "15.0"); + opv += PvlKeyword("MaxEmission", "25.0"); + opv += PvlKeyword("MinIncidence", "0.0"); + opv += PvlKeyword("MaxIncidence", "135.0"); PvlObject o("InterestOperator"); o.AddGroup(op); diff --git a/isis/src/base/objs/NaifStatus/NaifStatus.cpp b/isis/src/base/objs/NaifStatus/NaifStatus.cpp index a7bcbd7fc4..64e5aa1d3b 100644 --- a/isis/src/base/objs/NaifStatus/NaifStatus.cpp +++ b/isis/src/base/objs/NaifStatus/NaifStatus.cpp @@ -77,7 +77,7 @@ namespace Isis { getmsg_c("LONG", LONG_DESC_LEN, naifLong); // Search for known naif errors... - IString errMsg; + QString errMsg; Pvl error; PvlGroup errorDescription("ErrorDescription"); @@ -106,8 +106,8 @@ namespace Isis { } errMsg += " The short explanation "; - errMsg += "provided by NAIF is [" + IString(naifShort) + "]. "; - errMsg += "The Naif error is [" + IString(naifLong) + "]"; + errMsg += "provided by NAIF is [" + QString(naifShort) + "]. "; + errMsg += "The Naif error is [" + QString(naifLong) + "]"; throw IException(IException::Unknown, errMsg, _FILEINFO_); } diff --git a/isis/src/base/objs/NoNormalization/NoNormalization.h b/isis/src/base/objs/NoNormalization/NoNormalization.h index 50aad8a84e..5ec63b8c18 100644 --- a/isis/src/base/objs/NoNormalization/NoNormalization.h +++ b/isis/src/base/objs/NoNormalization/NoNormalization.h @@ -1,4 +1,4 @@ -#if !defined(NoNormalization_h) +#ifndef NoNormalization_h #define NoNormalization_h /** * @file diff --git a/isis/src/base/objs/NoOperator/unitTest.cpp b/isis/src/base/objs/NoOperator/unitTest.cpp index fd1f2e6abd..5450fe4f6c 100644 --- a/isis/src/base/objs/NoOperator/unitTest.cpp +++ b/isis/src/base/objs/NoOperator/unitTest.cpp @@ -18,21 +18,21 @@ int main() { try { PvlGroup op("Operator"); op += PvlKeyword("Name", "No"); - op += PvlKeyword("DeltaLine", 100); - op += PvlKeyword("DeltaSamp", 100); - op += PvlKeyword("Samples", 15); - op += PvlKeyword("Lines", 15); - op += PvlKeyword("MinimumDN", 0.0); - op += PvlKeyword("MaximumDN", 1.0); - op += PvlKeyword("MinimumInterest", 0.01); + op += PvlKeyword("DeltaLine", "100"); + op += PvlKeyword("DeltaSamp", "100"); + op += PvlKeyword("Samples", "15"); + op += PvlKeyword("Lines", "15"); + op += PvlKeyword("MinimumDN", "0.0"); + op += PvlKeyword("MaximumDN", "1.0"); + op += PvlKeyword("MinimumInterest", "0.01"); PvlGroup opv("ValidMeasure"); - opv += PvlKeyword("MinDN", 0.0); - opv += PvlKeyword("MaxDN", 1.0); - opv += PvlKeyword("MinEmission", 15.0); - opv += PvlKeyword("MaxEmission", 25.0); - opv += PvlKeyword("MinIncidence", 0.0); - opv += PvlKeyword("MaxIncidence", 135.0); + opv += PvlKeyword("MinDN", "0.0"); + opv += PvlKeyword("MaxDN", "1.0"); + opv += PvlKeyword("MinEmission", "15.0"); + opv += PvlKeyword("MaxEmission", "25.0"); + opv += PvlKeyword("MinIncidence", "0.0"); + opv += PvlKeyword("MaxIncidence", "135.0"); PvlObject o("InterestOperator"); o.AddGroup(op); diff --git a/isis/src/base/objs/NormModel/NormModel.h b/isis/src/base/objs/NormModel/NormModel.h index 9db5ec87bc..bc10c1809e 100644 --- a/isis/src/base/objs/NormModel/NormModel.h +++ b/isis/src/base/objs/NormModel/NormModel.h @@ -1,4 +1,4 @@ -#if !defined(NormModel_h) +#ifndef NormModel_h #define NormModel_h /** * @file diff --git a/isis/src/base/objs/NormModelFactory/NormModelFactory.cpp b/isis/src/base/objs/NormModelFactory/NormModelFactory.cpp index 90a9234c65..edef0b67d2 100644 --- a/isis/src/base/objs/NormModelFactory/NormModelFactory.cpp +++ b/isis/src/base/objs/NormModelFactory/NormModelFactory.cpp @@ -53,15 +53,15 @@ namespace Isis { // Get the algorithm name to create PvlGroup &algo = pvl.FindObject("NormalizationModel") .FindGroup("Algorithm", Pvl::Traverse); - std::string algorithm = ""; + QString algorithm = ""; if (algo.HasKeyword("NormName")) { - algorithm = std::string(algo["NormName"]); + algorithm = QString(algo["NormName"]); } else if (algo.HasKeyword("Name")) { - algorithm = std::string(algo["Name"]); + algorithm = QString(algo["Name"]); } else { - IString msg = "Keyword [Name] or keyword [NormName] must "; + QString msg = "Keyword [Name] or keyword [NormName] must "; msg += "exist in [Group = Algorithm]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -109,12 +109,12 @@ namespace Isis { // Get the algorithm name to create PvlGroup &algo = pvl.FindObject("NormalizationModel") .FindGroup("Algorithm", Pvl::Traverse); - std::string algorithm = ""; + QString algorithm = ""; if (algo.HasKeyword("NormName")) { - algorithm = std::string(algo["NormName"]); + algorithm = QString(algo["NormName"]); } else if (algo.HasKeyword("Name")) { - algorithm = std::string(algo["Name"]); + algorithm = QString(algo["Name"]); } else { IString msg = "Keyword [Name] or keyword [NormName] must "; diff --git a/isis/src/base/objs/ObliqueCylindrical/ObliqueCylindrical.cpp b/isis/src/base/objs/ObliqueCylindrical/ObliqueCylindrical.cpp index 7926ef994c..76e070f609 100644 --- a/isis/src/base/objs/ObliqueCylindrical/ObliqueCylindrical.cpp +++ b/isis/src/base/objs/ObliqueCylindrical/ObliqueCylindrical.cpp @@ -104,17 +104,17 @@ namespace Isis { if (!calculateVectors) { // Read in vectors - m_xAxisVector.push_back(mapGroup["XAxisVector"][0]); - m_xAxisVector.push_back(mapGroup["XAxisVector"][1]); - m_xAxisVector.push_back(mapGroup["XAxisVector"][2]); + m_xAxisVector.push_back(toDouble(mapGroup["XAxisVector"][0])); + m_xAxisVector.push_back(toDouble(mapGroup["XAxisVector"][1])); + m_xAxisVector.push_back(toDouble(mapGroup["XAxisVector"][2])); - m_yAxisVector.push_back(mapGroup["YAxisVector"][0]); - m_yAxisVector.push_back(mapGroup["YAxisVector"][1]); - m_yAxisVector.push_back(mapGroup["YAxisVector"][2]); + m_yAxisVector.push_back(toDouble(mapGroup["YAxisVector"][0])); + m_yAxisVector.push_back(toDouble(mapGroup["YAxisVector"][1])); + m_yAxisVector.push_back(toDouble(mapGroup["YAxisVector"][2])); - m_zAxisVector.push_back(mapGroup["ZAxisVector"][0]); - m_zAxisVector.push_back(mapGroup["ZAxisVector"][1]); - m_zAxisVector.push_back(mapGroup["ZAxisVector"][2]); + m_zAxisVector.push_back(toDouble(mapGroup["ZAxisVector"][0])); + m_zAxisVector.push_back(toDouble(mapGroup["ZAxisVector"][1])); + m_zAxisVector.push_back(toDouble(mapGroup["ZAxisVector"][2])); } else { // Calculate the vectors and store them in the labels @@ -148,16 +148,16 @@ namespace Isis { m_yAxisVector.push_back(pvec[1][i]); //Y[i] m_zAxisVector.push_back(pvec[2][i]); //Z[i] - mapGroup["XAxisVector"] += pvec[0][i]; //X[i] - mapGroup["YAxisVector"] += pvec[1][i]; //Y[i] - mapGroup["ZAxisVector"] += pvec[2][i]; //Z[i] + mapGroup["XAxisVector"] += toString(pvec[0][i]); //X[i] + mapGroup["YAxisVector"] += toString(pvec[1][i]); //Y[i] + mapGroup["ZAxisVector"] += toString(pvec[2][i]); //Z[i] } } init(); } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } } @@ -189,9 +189,9 @@ namespace Isis { /** * Returns the name of the map projection, "ObliqueCylindrical" * - * @return string Name of projection, "ObliqueCylindrical" + * @return QString Name of projection, "ObliqueCylindrical" */ - string ObliqueCylindrical::Name() const { + QString ObliqueCylindrical::Name() const { return "ObliqueCylindrical"; } @@ -199,9 +199,9 @@ namespace Isis { * Returns the version of the map projection * * - * @return std::string Version number + * @return std::QString Version number */ - string ObliqueCylindrical::Version() const { + QString ObliqueCylindrical::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/ObliqueCylindrical/ObliqueCylindrical.h b/isis/src/base/objs/ObliqueCylindrical/ObliqueCylindrical.h index c3287833e7..f05749c408 100644 --- a/isis/src/base/objs/ObliqueCylindrical/ObliqueCylindrical.h +++ b/isis/src/base/objs/ObliqueCylindrical/ObliqueCylindrical.h @@ -81,8 +81,8 @@ namespace Isis { ~ObliqueCylindrical(); bool operator==(const Isis::Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; bool SetGround(const double lat, const double lon); bool SetCoordinate(const double x, const double y); diff --git a/isis/src/base/objs/ObliqueCylindrical/unitTest.cpp b/isis/src/base/objs/ObliqueCylindrical/unitTest.cpp index 6add54a5f6..7bc4b6aab9 100644 --- a/isis/src/base/objs/ObliqueCylindrical/unitTest.cpp +++ b/isis/src/base/objs/ObliqueCylindrical/unitTest.cpp @@ -6,49 +6,51 @@ #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "UNIT TEST FOR ObliqueCylindrical" << endl << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGrp = lab.FindGroup("Mapping"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGrp = lab.FindGroup("Mapping"); - mapGrp += Isis::PvlKeyword("EquatorialRadius", 2575000.0); - mapGrp += Isis::PvlKeyword("PolarRadius", 2575000.0); + mapGrp += PvlKeyword("EquatorialRadius", "2575000.0"); + mapGrp += PvlKeyword("PolarRadius", "2575000.0"); - mapGrp += Isis::PvlKeyword("PoleLatitude", 22.858149); - mapGrp += Isis::PvlKeyword("PoleLongitude", 297.158602); + mapGrp += PvlKeyword("PoleLatitude", "22.858149"); + mapGrp += PvlKeyword("PoleLongitude", "297.158602"); - mapGrp += Isis::PvlKeyword("LatitudeType", "Planetocentric"); - mapGrp += Isis::PvlKeyword("LongitudeDirection", "PositiveWest"); - mapGrp += Isis::PvlKeyword("LongitudeDomain", 360); - mapGrp += Isis::PvlKeyword("ProjectionName", "ObliqueCylindrical"); + mapGrp += PvlKeyword("LatitudeType", "Planetocentric"); + mapGrp += PvlKeyword("LongitudeDirection", "PositiveWest"); + mapGrp += PvlKeyword("LongitudeDomain", "360"); + mapGrp += PvlKeyword("ProjectionName", "ObliqueCylindrical"); - mapGrp += Isis::PvlKeyword("MinimumLatitude", -90); - mapGrp += Isis::PvlKeyword("MaximumLatitude", 0.92523); - mapGrp += Isis::PvlKeyword("MinimumLongitude", -0.8235); - mapGrp += Isis::PvlKeyword("MaximumLongitude", 180.5); + mapGrp += PvlKeyword("MinimumLatitude", "-90"); + mapGrp += PvlKeyword("MaximumLatitude", "0.92523"); + mapGrp += PvlKeyword("MinimumLongitude", "-0.8235"); + mapGrp += PvlKeyword("MaximumLongitude", "180.5"); cout << "Test missing pole rotation keyword ..." << endl; try { - Isis::ObliqueCylindrical p(lab); + ObliqueCylindrical p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; // Add the missing keyword "PoleRotation" - mapGrp += Isis::PvlKeyword("PoleRotation", 45.7832); + mapGrp += PvlKeyword("PoleRotation", "45.7832"); // testing operator == cout << "Testing operator == ..." << endl; try { - Isis::ObliqueCylindrical p1(lab); - Isis::ObliqueCylindrical p2(lab); + ObliqueCylindrical p1(lab); + ObliqueCylindrical p2(lab); bool flag = (p1 == p2); if(flag) { cout << "(p1==p2) = True" << endl; @@ -57,25 +59,25 @@ int main(int argc, char *argv[]) { cout << "*** Error ****" << endl; } } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); + Projection &p = *ProjectionFactory::Create(lab); cout << "Test X,Y,Z Axis Vector Calculations ... " << endl; - cout << "Map Group Data (X[0]): " << (double)mapGrp["XAxisVector"][0] << endl; - cout << "Map Group Data (X[1]): " << (double)mapGrp["XAxisVector"][1] << endl; - cout << "Map Group Data (X[2]): " << (double)mapGrp["XAxisVector"][2] << endl; - cout << "Map Group Data (Y[0]): " << (double)mapGrp["YAxisVector"][0] << endl; - cout << "Map Group Data (Y[1]): " << (double)mapGrp["YAxisVector"][1] << endl; - cout << "Map Group Data (Y[2]): " << (double)mapGrp["YAxisVector"][2] << endl; - cout << "Map Group Data (Z[0]): " << (double)mapGrp["ZAxisVector"][0] << endl; - cout << "Map Group Data (Z[1]): " << (double)mapGrp["ZAxisVector"][1] << endl; - cout << "Map Group Data (Z[2]): " << (double)mapGrp["ZAxisVector"][2] << endl; + cout << "Map Group Data (X[0]): " << toDouble(mapGrp["XAxisVector"][0]) << endl; + cout << "Map Group Data (X[1]): " << toDouble(mapGrp["XAxisVector"][1]) << endl; + cout << "Map Group Data (X[2]): " << toDouble(mapGrp["XAxisVector"][2]) << endl; + cout << "Map Group Data (Y[0]): " << toDouble(mapGrp["YAxisVector"][0]) << endl; + cout << "Map Group Data (Y[1]): " << toDouble(mapGrp["YAxisVector"][1]) << endl; + cout << "Map Group Data (Y[2]): " << toDouble(mapGrp["YAxisVector"][2]) << endl; + cout << "Map Group Data (Z[0]): " << toDouble(mapGrp["ZAxisVector"][0]) << endl; + cout << "Map Group Data (Z[1]): " << toDouble(mapGrp["ZAxisVector"][1]) << endl; + cout << "Map Group Data (Z[2]): " << toDouble(mapGrp["ZAxisVector"][2]) << endl; cout << endl; const double X = -2646.237039, Y = -537.814519; @@ -109,14 +111,14 @@ int main(int argc, char *argv[]) { cout << "Maximum Y: " << maxY << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; cout << endl; - mapGrp["PoleRotation"] = 43.8423; - Isis::ObliqueCylindrical different(lab); + mapGrp["PoleRotation"] = "43.8423"; + ObliqueCylindrical different(lab); cout << "Test Name and comparision method with differing data... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (different == *s) << endl; @@ -124,9 +126,9 @@ int main(int argc, char *argv[]) { cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -139,7 +141,7 @@ int main(int argc, char *argv[]) { cout << tmp3 << endl; cout << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/ObservationNumber/ObservationNumber.cpp b/isis/src/base/objs/ObservationNumber/ObservationNumber.cpp index f7dd7e1af5..e248922dfd 100644 --- a/isis/src/base/objs/ObservationNumber/ObservationNumber.cpp +++ b/isis/src/base/objs/ObservationNumber/ObservationNumber.cpp @@ -22,8 +22,8 @@ namespace Isis { * * @param label A pvl formatted label to be used to generate the serial number */ - std::string ObservationNumber::Compose(Pvl &label, bool def2filename) { - std::string sn; + QString ObservationNumber::Compose(Pvl &label, bool def2filename) { + QString sn; try { PvlGroup snGroup = FindObservationTranslation(label); sn = CreateSerialNumber(snGroup, (int)snGroup["ObservationKeys"]); @@ -32,8 +32,8 @@ namespace Isis { if(def2filename) { // Try to return the filename if it exists in the label, otherwise use // "Unknown" as a last resort. - std::string snTemp = label.FileName(); - if(!snTemp.empty()) { + QString snTemp = label.FileName(); + if(!snTemp.isEmpty()) { sn = FileName(snTemp).name(); } else { @@ -53,7 +53,7 @@ namespace Isis { * * @param cube An opened Isis cube */ - std::string ObservationNumber::Compose(Cube &cube, bool def2filename) { + QString ObservationNumber::Compose(Cube &cube, bool def2filename) { return Compose(*cube.getLabel(), def2filename); } @@ -62,7 +62,7 @@ namespace Isis { * * @param filename a filename to open */ - std::string ObservationNumber::Compose(const std::string &filename, bool def2filename) { + QString ObservationNumber::Compose(const QString &filename, bool def2filename) { Pvl p(filename); return Compose(p, def2filename); } @@ -77,30 +77,30 @@ namespace Isis { static PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); // Get the mission name - static std::string missionTransFile = (std::string) dataDir["base"] + "/translations/MissionName2DataDir.trn"; + static QString missionTransFile = (QString) dataDir["base"] + "/translations/MissionName2DataDir.trn"; static PvlTranslationManager missionXlater(missionTransFile); missionXlater.SetLabel(label); - std::string mission = missionXlater.Translate("MissionName"); + QString mission = missionXlater.Translate("MissionName"); // Get the instrument name - static std::string instTransFile = (std::string) dataDir["base"] + "/translations/Instruments.trn"; + static QString instTransFile = (QString) dataDir["base"] + "/translations/Instruments.trn"; static PvlTranslationManager instrumentXlater(instTransFile); instrumentXlater.SetLabel(label); - std::string instrument = instrumentXlater.Translate("InstrumentName"); + QString instrument = instrumentXlater.Translate("InstrumentName"); // We want to use this instrument's translation manager. It's much faster for // ObservationNumberList if we keep the translation manager in memory, so re-reading // from the disk is not necessary every time. To do this, we'll use a map to store // the translation managers and observation number keys with a string identifier to find them. // This identifier needs to have the mission name and the instrument name. - static std::map > missionTranslators; - std::string key = mission + "_" + instrument; - std::map >::iterator + static std::map > missionTranslators; + QString key = mission + "_" + instrument; + std::map >::iterator translationIterator = missionTranslators.find(key); if(translationIterator == missionTranslators.end()) { // Get the file - FileName snFile((std::string) dataDir[mission] + "/translations/" + + FileName snFile((QString) dataDir[mission] + "/translations/" + instrument + "SerialNumber????.trn"); snFile = snFile.highestVersion(); @@ -113,7 +113,7 @@ namespace Isis { // use the translation file to generate keywords missionTranslators.insert( - std::pair > + std::pair > (key, std::pair(PvlTranslationManager(snFile.expanded()), observationKeys)) ); @@ -125,11 +125,11 @@ namespace Isis { PvlGroup snGroup = outLabel.FindGroup("SerialNumberKeywords"); // Delets the extra - if(!translationIterator->second.second.Name().empty()) { + if(!translationIterator->second.second.Name().isEmpty()) { snGroup += translationIterator->second.second; } else { - snGroup += PvlKeyword("ObservationKeys", snGroup.Keywords()); + snGroup += PvlKeyword("ObservationKeys", toString(snGroup.Keywords())); } return snGroup; @@ -143,10 +143,10 @@ namespace Isis { * * @param list the SerialNumberList */ - std::vector ObservationNumber::PossibleSerial(const std::string &on, SerialNumberList &list) { - std::vector sn; + std::vector ObservationNumber::PossibleSerial(const QString &on, SerialNumberList &list) { + std::vector sn; for(int i = 0; i < list.Size(); i++) { - if(list.SerialNumber(i).find(on) == 0) { + if(list.SerialNumber(i).startsWith(on)) { sn.push_back(list.SerialNumber(i)); } } diff --git a/isis/src/base/objs/ObservationNumber/ObservationNumber.h b/isis/src/base/objs/ObservationNumber/ObservationNumber.h index 9b9150bf97..bc53b24237 100644 --- a/isis/src/base/objs/ObservationNumber/ObservationNumber.h +++ b/isis/src/base/objs/ObservationNumber/ObservationNumber.h @@ -1,5 +1,5 @@ -#if !defined(ObservationNumber_h) +#ifndef ObservationNumber_h #define ObservationNumber_h /** @@ -63,13 +63,13 @@ namespace Isis { virtual ~ObservationNumber(); - static std::string Compose(Pvl &label, bool def2filename = false); + static QString Compose(Pvl &label, bool def2filename = false); - static std::string Compose(Cube &cube, bool def2filename = false); + static QString Compose(Cube &cube, bool def2filename = false); - static std::string Compose(const std::string &filename, bool def2filename = false); + static QString Compose(const QString &filename, bool def2filename = false); - std::vector PossibleSerial(const std::string &on, SerialNumberList &list); + std::vector PossibleSerial(const QString &on, SerialNumberList &list); private: diff --git a/isis/src/base/objs/ObservationNumber/unitTest.cpp b/isis/src/base/objs/ObservationNumber/unitTest.cpp index 3398dfb797..71b0ae0207 100644 --- a/isis/src/base/objs/ObservationNumber/unitTest.cpp +++ b/isis/src/base/objs/ObservationNumber/unitTest.cpp @@ -5,14 +5,16 @@ #include "Cube.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::FileName file("$lo/testData/3133_h1.cub"); - Isis::Pvl p1(file.expanded()); + FileName file("$lo/testData/3133_h1.cub"); + Pvl p1(file.expanded()); - std::cout << Isis::ObservationNumber::Compose(p1) << std::endl; + cout << ObservationNumber::Compose(p1) << endl; return (0); } diff --git a/isis/src/base/objs/ObservationNumberList/ObservationNumberList.cpp b/isis/src/base/objs/ObservationNumberList/ObservationNumberList.cpp index e8c4294bad..f3a25a04ce 100644 --- a/isis/src/base/objs/ObservationNumberList/ObservationNumberList.cpp +++ b/isis/src/base/objs/ObservationNumberList/ObservationNumberList.cpp @@ -15,7 +15,7 @@ namespace Isis { * to make sure the target names match between files added * to the observationnumber list */ - ObservationNumberList::ObservationNumberList(const std::string &listfile, bool checkTarget) : + ObservationNumberList::ObservationNumberList(const QString &listfile, bool checkTarget) : SerialNumberList(listfile, checkTarget) { init(this); } @@ -39,12 +39,12 @@ namespace Isis { void ObservationNumberList::init(Isis::SerialNumberList *snlist) { if(snlist->Size() == 0) { - std::string msg = "Serial number list is empty"; + QString msg = "Serial number list is empty"; throw IException(IException::User, msg, _FILEINFO_); } - std::map observationMap; - std::string observationNumber; + std::map observationMap; + QString observationNumber; int currentIndex = 0; int observationIndex; @@ -53,7 +53,7 @@ namespace Isis { observationNumber = snlist->ObservationNumber(isn); if(observationMap.find(observationNumber) == observationMap.end()) { - observationMap.insert(std::pair(observationNumber, currentIndex)); + observationMap.insert(std::pair(observationNumber, currentIndex)); observationIndex = currentIndex++; } else { @@ -79,15 +79,15 @@ namespace Isis { void ObservationNumberList::Remove(Isis::SerialNumberList *snlist) { if(snlist->Size() == 0) { - std::string msg = "Removing serial number list is empty"; + QString msg = "Removing serial number list is empty"; throw IException(IException::User, msg, _FILEINFO_); } p_sets.clear(); p_indexMap.clear(); - std::map observationMap; - std::string observationNumber; + std::map observationMap; + QString observationNumber; int currentIndex = 0; int observationIndex; @@ -97,7 +97,7 @@ namespace Isis { observationNumber = this->ObservationNumber(isn); if(observationMap.find(observationNumber) == observationMap.end()) { - observationMap.insert(std::pair(observationNumber, currentIndex)); + observationMap.insert(std::pair(observationNumber, currentIndex)); observationIndex = currentIndex++; } else { @@ -115,7 +115,7 @@ namespace Isis { * * @param listfile The list of SerialNumbers to remove */ - void ObservationNumberList::Remove(const std::string &listfile) { + void ObservationNumberList::Remove(const QString &listfile) { Isis::SerialNumberList snlist(listfile); Remove(&snlist); } @@ -133,7 +133,7 @@ namespace Isis { * */ void ObservationNumberList::Add(const int isn, const int observationIndex, - std::string observationNumber) { + QString observationNumber) { ObservationSet nextset; nextset.serialNumberIndex = isn; @@ -162,7 +162,7 @@ namespace Isis { * * @return bool */ - bool ObservationNumberList::HasObservationNumber(const std::string &on) { + bool ObservationNumberList::HasObservationNumber(const QString &on) { for(unsigned index = 0; index < p_pairs.size(); index++) { if(p_pairs[index].observationNumber == on) { return true; @@ -184,8 +184,7 @@ namespace Isis { return p_indexMap.find(serialNumberIndex)->second; } else { - IString num = IString(serialNumberIndex); - std::string msg = "Serial Number Index [" + (std::string) num + "] is invalid"; + QString msg = "Serial Number Index [" + toString(serialNumberIndex) + "] is invalid"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -196,12 +195,12 @@ namespace Isis { * * @param filename The filename to be matched * - * @return std::string The observation number corresponding to + * @return QString The observation number corresponding to * the input filename */ - std::string ObservationNumberList::ObservationNumber(const std::string &filename) { + QString ObservationNumberList::ObservationNumber(const QString &filename) { if(p_fileMap.find(Isis::FileName(filename).expanded()) == p_fileMap.end()) { - std::string msg = "Requested filename [" + + QString msg = "Requested filename [" + Isis::FileName(filename).expanded() + "]"; msg += "does not exist in the list"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -215,15 +214,14 @@ namespace Isis { * * @param index The index of the desired observation number * - * @return std::string The observation number returned + * @return QString The observation number returned */ - std::string ObservationNumberList::ObservationNumber(int index) { + QString ObservationNumberList::ObservationNumber(int index) { if(index >= 0 && index < (int) p_pairs.size()) { return p_pairs[index].observationNumber; } else { - IString num = IString(index); - std::string msg = "Index [" + (std::string) num + "] is invalid"; + QString msg = "Index [" + toString(index) + "] is invalid"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -233,11 +231,11 @@ namespace Isis { * * @param on The observation number of the desired filename * - * @return vector The list of possible filenames + * @return vector The list of possible filenames * matching the input observation number */ - std::vector ObservationNumberList::PossibleFileNames(const std::string &on) { - std::vector filenames; + std::vector ObservationNumberList::PossibleFileNames(const QString &on) { + std::vector filenames; for(unsigned index = 0; index < p_pairs.size(); index++) { if(p_pairs[index].observationNumber == on) { filenames.push_back(p_pairs[index].filename); @@ -247,7 +245,7 @@ namespace Isis { return filenames; } else { - std::string msg = "Requested observation number [" + on + "] "; + QString msg = "Requested observation number [" + on + "] "; msg += "does not exist in the list"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/ObservationNumberList/ObservationNumberList.h b/isis/src/base/objs/ObservationNumberList/ObservationNumberList.h index 439eff1da8..3b0460df4b 100644 --- a/isis/src/base/objs/ObservationNumberList/ObservationNumberList.h +++ b/isis/src/base/objs/ObservationNumberList/ObservationNumberList.h @@ -53,29 +53,29 @@ namespace Isis { */ class ObservationNumberList : public Isis::SerialNumberList { public: - ObservationNumberList(const std::string &list, bool checkTarget = true); + ObservationNumberList(const QString &list, bool checkTarget = true); ObservationNumberList(Isis::SerialNumberList *snlist); ~ObservationNumberList(); - void Add(int isn, const int observationIndex, std::string observationNumber) ; + void Add(int isn, const int observationIndex, QString observationNumber) ; int ObservationSize() const; int ObservationNumberMapIndex(const int serialNumberIndex); void Remove(Isis::SerialNumberList *snlist); - void Remove(const std::string &listfile); + void Remove(const QString &listfile); - bool HasObservationNumber(const std::string &on); + bool HasObservationNumber(const QString &on); - std::string ObservationNumber(const std::string &filename); - std::string ObservationNumber(int index); - std::vector PossibleFileNames(const std::string &on); + QString ObservationNumber(const QString &filename); + QString ObservationNumber(int index); + std::vector PossibleFileNames(const QString &on); private: struct ObservationSet { int serialNumberIndex; int observationNumberIndex; - std::string observationNumber; + QString observationNumber; }; void init(Isis::SerialNumberList *snlist); diff --git a/isis/src/base/objs/ObservationNumberList/unitTest.cpp b/isis/src/base/objs/ObservationNumberList/unitTest.cpp index 2d6967201a..c706a29e85 100644 --- a/isis/src/base/objs/ObservationNumberList/unitTest.cpp +++ b/isis/src/base/objs/ObservationNumberList/unitTest.cpp @@ -29,12 +29,12 @@ int main(int argc, char *argv[]) { } cout << endl; - vector filenames = onl.PossibleFileNames(onl.ObservationNumber(2)); + vector filenames = onl.PossibleFileNames(onl.ObservationNumber(2)); for(unsigned i = 0; i < filenames.size(); i++) { cout << "Possible filename for [" << onl.ObservationNumber(2) << "]: " << FileName(filenames[i]).name() << endl; } - vector serials = onl.PossibleSerialNumbers(onl.ObservationNumber(2)); + vector serials = onl.PossibleSerialNumbers(onl.ObservationNumber(2)); for(unsigned i = 0; i < serials.size(); i++) { cout << "Possible serial number for [" << onl.ObservationNumber(2) << "]: " << serials[i] << endl; diff --git a/isis/src/base/objs/OriginalLabel/OriginalLabel.cpp b/isis/src/base/objs/OriginalLabel/OriginalLabel.cpp index 559ee1b8f8..0ae30a996b 100644 --- a/isis/src/base/objs/OriginalLabel/OriginalLabel.cpp +++ b/isis/src/base/objs/OriginalLabel/OriginalLabel.cpp @@ -42,7 +42,7 @@ namespace Isis { * * @param file File to read labels from */ - OriginalLabel::OriginalLabel(const std::string &file) : + OriginalLabel::OriginalLabel(const QString &file) : Isis::Blob("IsisCube", "OriginalLabel") { Blob::Read(file); } diff --git a/isis/src/base/objs/OriginalLabel/OriginalLabel.h b/isis/src/base/objs/OriginalLabel/OriginalLabel.h index a92c31dcd7..5c653cd51e 100644 --- a/isis/src/base/objs/OriginalLabel/OriginalLabel.h +++ b/isis/src/base/objs/OriginalLabel/OriginalLabel.h @@ -51,7 +51,7 @@ namespace Isis { class OriginalLabel : public Isis::Blob { public: OriginalLabel(); - OriginalLabel(const std::string &file); + OriginalLabel(const QString &file); OriginalLabel(Pvl pvl); ~OriginalLabel(); diff --git a/isis/src/base/objs/Orthographic/Orthographic.cpp b/isis/src/base/objs/Orthographic/Orthographic.cpp index f3cc8b3bde..ebb2e45493 100644 --- a/isis/src/base/objs/Orthographic/Orthographic.cpp +++ b/isis/src/base/objs/Orthographic/Orthographic.cpp @@ -60,14 +60,14 @@ namespace Isis { // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = (m_minimumLongitude + m_maximumLongitude) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } // Compute and write the default center latitude if allowed and // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLatitude"))) { double lat = (m_minimumLatitude + m_maximumLatitude) / 2.0; - mapGroup += PvlKeyword("CenterLatitude", lat); + mapGroup += PvlKeyword("CenterLatitude", toString(lat)); } // Get the center longitude & latitude @@ -150,7 +150,7 @@ namespace Isis { } } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } } @@ -180,9 +180,9 @@ namespace Isis { /** * Returns the name of the map projection, "Orthographic" * - * @return string Name of projection, "Orthographic" + * @return QString Name of projection, "Orthographic" */ - string Orthographic::Name() const { + QString Orthographic::Name() const { return "Orthographic"; } @@ -190,9 +190,9 @@ namespace Isis { * Returns the version of the map projection * * - * @return string Version number + * @return QString Version number */ - string Orthographic::Version() const { + QString Orthographic::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/Orthographic/Orthographic.h b/isis/src/base/objs/Orthographic/Orthographic.h index a4b31dd360..b14a6cd6d5 100644 --- a/isis/src/base/objs/Orthographic/Orthographic.h +++ b/isis/src/base/objs/Orthographic/Orthographic.h @@ -77,8 +77,8 @@ namespace Isis { ~Orthographic(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; double TrueScaleLatitude() const; bool SetGround(const double lat, const double lon); diff --git a/isis/src/base/objs/Orthographic/unitTest.cpp b/isis/src/base/objs/Orthographic/unitTest.cpp index 433c28b25e..ced06d0d8b 100644 --- a/isis/src/base/objs/Orthographic/unitTest.cpp +++ b/isis/src/base/objs/Orthographic/unitTest.cpp @@ -5,51 +5,53 @@ #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "UNIT TEST FOR Orthographic" << endl << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 1.0); - mapGroup += Isis::PvlKeyword("PolarRadius", 1.0); - mapGroup += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 180); - mapGroup += Isis::PvlKeyword("MinimumLatitude", -70.0); - mapGroup += Isis::PvlKeyword("MaximumLatitude", 70.0); - mapGroup += Isis::PvlKeyword("MinimumLongitude", -180.0); - mapGroup += Isis::PvlKeyword("MaximumLongitude", 180.0); - mapGroup += Isis::PvlKeyword("ProjectionName", "Orthographic"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup = lab.FindGroup("Mapping"); + mapGroup += PvlKeyword("EquatorialRadius", "1.0"); + mapGroup += PvlKeyword("PolarRadius", "1.0"); + mapGroup += PvlKeyword("LatitudeType", "Planetographic"); + mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup += PvlKeyword("LongitudeDomain", "180"); + mapGroup += PvlKeyword("MinimumLatitude", "-70.0"); + mapGroup += PvlKeyword("MaximumLatitude", "70.0"); + mapGroup += PvlKeyword("MinimumLongitude", "-180.0"); + mapGroup += PvlKeyword("MaximumLongitude", "180.0"); + mapGroup += PvlKeyword("ProjectionName", "Orthographic"); cout << "Test missing center longitude keyword ..." << endl; try { - Isis::Orthographic p(lab); + Orthographic p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLongitude", -100.0); + mapGroup += PvlKeyword("CenterLongitude", "-100.0"); cout << "Test missing center latitude keyword..." << endl; try { - Isis::Orthographic p(lab); + Orthographic p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLatitude", 40.0); + mapGroup += PvlKeyword("CenterLatitude", "40.0"); try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); - // Isis::Orthographic p(lab); + Projection &p = *ProjectionFactory::Create(lab); + // Orthographic p(lab); cout << "Test TrueScaleLatitude method... " << endl; cout << "TrueScaleLatitude = " << p.TrueScaleLatitude() << endl; @@ -84,7 +86,7 @@ int main(int argc, char *argv[]) { cout << "Maximum Y: " << maxY << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; @@ -93,15 +95,15 @@ int main(int argc, char *argv[]) { cout << "Test default computation ... " << endl; mapGroup.DeleteKeyword("CenterLongitude"); mapGroup.DeleteKeyword("CenterLatitude"); - Isis::Orthographic p2(lab, true); + Orthographic p2(lab, true); cout << lab << endl; cout << endl; cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -119,7 +121,7 @@ int main(int argc, char *argv[]) { cout << " USGS Professional Paper 1395 by John P. Snyder" << endl; cout << " Pages 311-312" << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/OverlapStatistics/OverlapStatistics.cpp b/isis/src/base/objs/OverlapStatistics/OverlapStatistics.cpp index 955474ea0c..e3b7ff6aa2 100644 --- a/isis/src/base/objs/OverlapStatistics/OverlapStatistics.cpp +++ b/isis/src/base/objs/OverlapStatistics/OverlapStatistics.cpp @@ -53,7 +53,7 @@ namespace Isis { * bands */ OverlapStatistics::OverlapStatistics(Isis::Cube &x, Isis::Cube &y, - std::string progressMsg, double sampPercent) { + QString progressMsg, double sampPercent) { // Test to ensure sampling percent in bound if (sampPercent <= 0.0 || sampPercent > 100.0) { string msg = "The sampling percent must be a decimal (0.0, 100.0]"; @@ -68,7 +68,7 @@ namespace Isis { // Make sure number of bands match if (x.getBandCount() != y.getBandCount()) { - string msg = "Number of bands do not match between cubes [" + + QString msg = "Number of bands do not match between cubes [" + p_xFile.name() + "] and [" + p_yFile.name() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -81,7 +81,7 @@ namespace Isis { // Test to make sure projection parameters match if (*projX != *projY) { - string msg = "Mapping groups do not match between cubes [" + + QString msg = "Mapping groups do not match between cubes [" + p_xFile.name() + "] and [" + p_yFile.name() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -185,18 +185,18 @@ namespace Isis { try { PvlObject o("OverlapStatistics"); PvlGroup gX("File1"); - PvlKeyword stsX("StartSample", StartSampleX()); - PvlKeyword ensX("EndSample", EndSampleX()); - PvlKeyword stlX("StartLine", StartLineX()); - PvlKeyword enlX("EndLine", EndLineX()); + PvlKeyword stsX("StartSample", toString(StartSampleX())); + PvlKeyword ensX("EndSample", toString(EndSampleX())); + PvlKeyword stlX("StartLine", toString(StartLineX())); + PvlKeyword enlX("EndLine", toString(EndLineX())); PvlKeyword avgX("Average"); PvlKeyword stdX("StandardDeviation"); PvlKeyword varX("Variance"); for (int band = 1; band <= Bands(); band++) { if (HasOverlap(band)) { - avgX += GetMStats(band).X().Average(); - stdX += GetMStats(band).X().StandardDeviation(); - varX += GetMStats(band).X().Variance(); + avgX += toString(GetMStats(band).X().Average()); + stdX += toString(GetMStats(band).X().StandardDeviation()); + varX += toString(GetMStats(band).X().Variance()); } } gX += stsX; @@ -208,18 +208,18 @@ namespace Isis { gX += varX; PvlGroup gY("File2"); - PvlKeyword stsY("StartSample", StartSampleY()); - PvlKeyword ensY("EndSample", EndSampleY()); - PvlKeyword stlY("StartLine", StartLineY()); - PvlKeyword enlY("EndLine", EndLineY()); + PvlKeyword stsY("StartSample", toString(StartSampleY())); + PvlKeyword ensY("EndSample", toString(EndSampleY())); + PvlKeyword stlY("StartLine", toString(StartLineY())); + PvlKeyword enlY("EndLine", toString(EndLineY())); PvlKeyword avgY("Average"); PvlKeyword stdY("StandardDeviation"); PvlKeyword varY("Variance"); for (int band = 1; band <= Bands(); band++) { if (HasOverlap(band)) { - avgY += GetMStats(band).Y().Average(); - stdY += GetMStats(band).Y().StandardDeviation(); - varY += GetMStats(band).Y().Variance(); + avgY += toString(GetMStats(band).Y().Average()); + stdY += toString(GetMStats(band).Y().StandardDeviation()); + varY += toString(GetMStats(band).Y().Variance()); } } gY += stsY; @@ -232,9 +232,9 @@ namespace Isis { o += PvlKeyword("File1", FileNameX().name()); o += PvlKeyword("File2", FileNameY().name()); - o += PvlKeyword("Width", Samples()); - o += PvlKeyword("Height", Lines()); - o += PvlKeyword("SamplingPercent", SampPercent()); + o += PvlKeyword("Width", toString(Samples())); + o += PvlKeyword("Height", toString(Lines())); + o += PvlKeyword("SamplingPercent", toString(SampPercent())); o.AddGroup(gX); o.AddGroup(gY); @@ -247,14 +247,14 @@ namespace Isis { PvlKeyword tot("TotalPixels"); for (int band = 1; band <= Bands(); band++) { if (HasOverlap(band)) { - std::string validStr = "false"; + QString validStr = "false"; if (IsValid(band)) validStr = "true"; valid += validStr; - cov += GetMStats(band).Covariance(); - cor += GetMStats(band).Correlation(); - val += GetMStats(band).ValidPixels(); - inv += GetMStats(band).InvalidPixels(); - tot += GetMStats(band).TotalPixels(); + cov += toString(GetMStats(band).Covariance()); + cor += toString(GetMStats(band).Correlation()); + val += toString(GetMStats(band).ValidPixels()); + inv += toString(GetMStats(band).InvalidPixels()); + tot += toString(GetMStats(band).TotalPixels()); } } o += valid; @@ -266,14 +266,13 @@ namespace Isis { for (int band = 1; band <= Bands(); band++) { if (HasOverlap(band)) { - IString bandNum(band); - std::string bandStr = "LinearRegression" + bandNum; + QString bandStr = "LinearRegression" + toString(band); PvlKeyword LinReg(bandStr); double a, b; try { GetMStats(band).LinearRegression(a, b); - LinReg += a; - LinReg += b; + LinReg += toString(a); + LinReg += toString(b); } catch (IException &e) { // It is possible one of the overlaps was constant and therefore @@ -286,7 +285,7 @@ namespace Isis { return o; } catch (IException &e) { - string msg = "Trivial overlap between [" + FileNameX().name(); + QString msg = "Trivial overlap between [" + FileNameX().name(); msg += "] and [" + FileNameY().name() + "]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/OverlapStatistics/OverlapStatistics.h b/isis/src/base/objs/OverlapStatistics/OverlapStatistics.h index 4a21eb849c..15f1c788f5 100644 --- a/isis/src/base/objs/OverlapStatistics/OverlapStatistics.h +++ b/isis/src/base/objs/OverlapStatistics/OverlapStatistics.h @@ -70,7 +70,7 @@ namespace Isis { class OverlapStatistics { public: OverlapStatistics(Isis::Cube &x, Isis::Cube &y, - std::string progressMsg = "Gathering Overlap Statistics", + QString progressMsg = "Gathering Overlap Statistics", double sampPercent = 100.0); /** @@ -90,7 +90,7 @@ namespace Isis { /** * Returns the filename of the first cube * - * @return string The name of the first cube + * @return QString The name of the first cube */ Isis::FileName FileNameX() const { return p_xFile; @@ -99,7 +99,7 @@ namespace Isis { /** * Returns the filename of the second cube * - * @return string The name of the second cube + * @return QString The name of the second cube */ Isis::FileName FileNameY() const { return p_yFile; diff --git a/isis/src/base/objs/OverlapStatistics/unitTest.cpp b/isis/src/base/objs/OverlapStatistics/unitTest.cpp index d2b78befc2..984d84cb9f 100644 --- a/isis/src/base/objs/OverlapStatistics/unitTest.cpp +++ b/isis/src/base/objs/OverlapStatistics/unitTest.cpp @@ -4,20 +4,21 @@ #include "OverlapStatistics.h" #include "Preference.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); try { cout << "UnitTest for Overlap Statistics" << endl; - Isis::Cube cube1, cube2; + Cube cube1, cube2; cube1.open("$odyssey/testData/I00824006RDR.lev2.cub"); cube2.open("$odyssey/testData/I02609002RDR.lev2.cub"); cout << setprecision(9); // Check to make sure the overlap calculation is working correctly - Isis::OverlapStatistics oStats(cube1, cube2); + OverlapStatistics oStats(cube1, cube2); cout << "For Overlap of I00824006RDR.lev2.cub & I02609002RDR.lev2.cub..." << endl; cout << "Has Overlap? = " << oStats.HasOverlap() << endl << endl; @@ -27,19 +28,19 @@ int main(int argc, char *argv[]) { cout << " Bands = " << oStats.Bands() << endl << endl; cout << "Overlap Areas:" << endl; - cout << " Filename = " << Isis::FileName(oStats.FileNameX()).name() << endl; + cout << " Filename = " << FileName(oStats.FileNameX()).name() << endl; cout << " Start Sample = " << oStats.StartSampleX() << endl; cout << " End Sample = " << oStats.EndSampleX() << endl; cout << " Start Line = " << oStats.StartLineX() << endl; cout << " End Line = " << oStats.EndLineX() << endl << endl; - cout << " Filename = " << Isis::FileName(oStats.FileNameY()).name() << endl; + cout << " Filename = " << FileName(oStats.FileNameY()).name() << endl; cout << " Start Sample = " << oStats.StartSampleY() << endl; cout << " End Sample = " << oStats.EndSampleY() << endl; cout << " Start Line = " << oStats.StartLineY() << endl; cout << " End Line = " << oStats.EndLineY() << endl << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/Parabola/Parabola.h b/isis/src/base/objs/Parabola/Parabola.h index 5ad48d30d4..2d15030b23 100644 --- a/isis/src/base/objs/Parabola/Parabola.h +++ b/isis/src/base/objs/Parabola/Parabola.h @@ -53,7 +53,7 @@ namespace Isis { // Get help to figure out why I have to pass the name in even with the // default set - Parabola(const std::string &bname = "Parabola") : + Parabola(const QString &bname = "Parabola") : Isis::BasisFunction(bname, 1, 3) { } //! Destroys the Parabola object diff --git a/isis/src/base/objs/Parabola/unitTest.cpp b/isis/src/base/objs/Parabola/unitTest.cpp index e22a3d4a75..2e3ae90db8 100644 --- a/isis/src/base/objs/Parabola/unitTest.cpp +++ b/isis/src/base/objs/Parabola/unitTest.cpp @@ -2,12 +2,13 @@ #include #include "Preference.h" +using namespace Isis; using namespace std; int main() { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::Parabola b("Parabola"); + Parabola b("Parabola"); vector coefs; coefs.push_back(-6.0); coefs.push_back(5.0); diff --git a/isis/src/base/objs/PhotoModel/PhotoModel.cpp b/isis/src/base/objs/PhotoModel/PhotoModel.cpp index d64edb47c0..10707cac29 100644 --- a/isis/src/base/objs/PhotoModel/PhotoModel.cpp +++ b/isis/src/base/objs/PhotoModel/PhotoModel.cpp @@ -23,10 +23,10 @@ namespace Isis { // Use 'PhtName' instead of 'Name' if using the Gui combo box // for unique Pvl keyword in DefFile if(algorithm.HasKeyword("PhtName")) { - p_photoAlgorithmName = string(algorithm["PhtName"]); + p_photoAlgorithmName = algorithm["PhtName"][0]; } else if(algorithm.HasKeyword("Name")) { - p_photoAlgorithmName = string(algorithm["Name"]); + p_photoAlgorithmName = algorithm["Name"][0]; } else { IString msg = "Keyword [Name] or keyword [PhtName] must "; diff --git a/isis/src/base/objs/PhotoModel/PhotoModel.h b/isis/src/base/objs/PhotoModel/PhotoModel.h index 6fae52d3df..cae32c6f36 100644 --- a/isis/src/base/objs/PhotoModel/PhotoModel.h +++ b/isis/src/base/objs/PhotoModel/PhotoModel.h @@ -58,7 +58,7 @@ namespace Isis { virtual ~PhotoModel() {}; //! Return algorithm name found in Pvl file from constructor - inline std::string AlgorithmName() const { + inline QString AlgorithmName() const { return p_photoAlgorithmName; }; @@ -200,7 +200,7 @@ namespace Isis { double p_photoTant; double p_photoSr; double p_photoOsr; - IString p_algName; + QString p_algName; std::string p_photo0B0Standard; double p_photoWh; double p_photoHh; @@ -220,7 +220,7 @@ namespace Isis { private: //! Unique name of the photometric model - std::string p_photoAlgorithmName; + QString p_photoAlgorithmName; //! Indicates whether standard conditions are used bool p_standardConditions; }; diff --git a/isis/src/base/objs/PhotoModelFactory/PhotoModelFactory.cpp b/isis/src/base/objs/PhotoModelFactory/PhotoModelFactory.cpp index 6bf695683c..fdb7ae5f90 100644 --- a/isis/src/base/objs/PhotoModelFactory/PhotoModelFactory.cpp +++ b/isis/src/base/objs/PhotoModelFactory/PhotoModelFactory.cpp @@ -53,15 +53,15 @@ namespace Isis { PvlGroup &algo = pvl.FindObject("PhotometricModel") .FindGroup("Algorithm", Pvl::Traverse); - std::string algorithm = ""; + QString algorithm = ""; if (algo.HasKeyword("PhtName")) { - algorithm = std::string(algo["PhtName"]); + algorithm = algo["PhtName"][0]; } else if (algo.HasKeyword("Name")) { - algorithm = std::string(algo["Name"]); + algorithm = algo["Name"][0]; } else { - IString msg = "Keyword [Name] or keyword [PhtName] must "; + QString msg = "Keyword [Name] or keyword [PhtName] must "; msg += "exist in [Group = Algorithm]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Pipeline/Pipeline.cpp b/isis/src/base/objs/Pipeline/Pipeline.cpp index d6b68bc1d1..80f48620fb 100644 --- a/isis/src/base/objs/Pipeline/Pipeline.cpp +++ b/isis/src/base/objs/Pipeline/Pipeline.cpp @@ -1,5 +1,7 @@ #include +#include + #include "Pipeline.h" #include "PipelineApplication.h" #include "ProgramLauncher.h" @@ -25,7 +27,7 @@ namespace Isis { * @history 2011-08-15 Debbie A. Cook Added initialization for new member * p_pausePosition */ - Pipeline::Pipeline(const IString &procAppName) { + Pipeline::Pipeline(const QString &procAppName) { p_pausePosition = -1; p_procAppName = procAppName; p_addedCubeatt = false; @@ -75,11 +77,11 @@ namespace Isis { // Look to see if we need to eliminate virtual bands... for (unsigned int i = 0; i < p_virtualBands.size(); i++) { - mustElimBands |= !p_virtualBands[i].empty(); + mustElimBands |= !p_virtualBands[i].isEmpty(); } // Keep track of temp files for conflicts - vector tmpFiles; + vector tmpFiles; // Loop through all the pipeline apps, look for a good place to remove virtual // bands and tell the apps the prepare themselves. Double check the first program @@ -88,7 +90,7 @@ namespace Isis { if (p_apps[i] == NULL) continue; if (mustElimBands && p_apps[i]->SupportsVirtualBands()) { if (i != 0 && p_virtualBands.size() != 1) { - IString message = "If multiple original inputs were set in the pipeline, the first application must support virtual bands."; + QString message = "If multiple original inputs were set in the pipeline, the first application must support virtual bands."; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -111,7 +113,7 @@ namespace Isis { else { // Pipeline is responsible for the virtual bands, reset any apps // who have an old virtual bands setting. - vector empty; + vector empty; p_apps[i]->SetVirtualBands(empty); } @@ -120,10 +122,10 @@ namespace Isis { p_apps[i]->BuildParamString(); // keep track of tmp files - vector theseTempFiles = p_apps[i]->TemporaryFiles(); + vector theseTempFiles = p_apps[i]->TemporaryFiles(); for (int tmpFile = 0; tmpFile < (int)theseTempFiles.size(); tmpFile++) { // no need to delete blank files - if (theseTempFiles[tmpFile].find("blank") == string::npos) { + if (theseTempFiles[tmpFile].contains("blank")) { tmpFiles.push_back(theseTempFiles[tmpFile]); } } @@ -132,7 +134,7 @@ namespace Isis { foundFirst = true; if (p_apps[i]->InputBranches().size() != OriginalBranches().size()) { - string msg = "The program [" + p_apps[i]->Name() + "] can not be the first in the pipeline"; + QString msg = "The program [" + p_apps[i]->Name() + "] can not be the first in the pipeline"; msg += " because it must be run multiple times with unspecified varying inputs"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -149,7 +151,7 @@ namespace Isis { for (int i = 0; successfulPrepare && i < (int)tmpFiles.size(); i++) { for (int j = i + 1; j < (int)tmpFiles.size(); j++) { if (tmpFiles[i] == tmpFiles[j]) { - string msg = "There is a conflict with the temporary file naming. The temporary file ["; + QString msg = "There is a conflict with the temporary file naming. The temporary file ["; msg += tmpFiles[i] + "] is created twice."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -216,20 +218,22 @@ namespace Isis { appName.CheckStatus(); // grab the sets of parameters this program needs to be run with - const vector ¶ms = Application(i).ParamString(); + const vector ¶ms = Application(i).ParamString(); for (int j = 0; j < (int)params.size(); j++) { // check for non-program run special strings - IString special(params[j].substr(0, 7)); + QString special(params[j].mid(0, 7)); // If ">>LIST", then we need to make a list file if (special == ">>LIST ") { - IString cmd = params[j].substr(7); - IString listFileName = cmd.Token(" "); + QString cmd = params[j].mid(7); + + QStringList listData = cmd.split(" "); + QString listFileName = listData.takeFirst(); TextFile listFile(listFileName, "overwrite"); - while (!cmd.empty()) { - listFile.PutLine(cmd.Token(" ")); + while (!listData.isEmpty()) { + listFile.PutLine(listData.takeFirst()); } listFile.Close(); @@ -258,9 +262,9 @@ namespace Isis { for (int i = 0; i < Size(); i++) { if (p_apps[i] == NULL) continue; if (Application(i).Enabled()) { - vector tmpFiles = Application(i).TemporaryFiles(); + vector tmpFiles = Application(i).TemporaryFiles(); for (int file = 0; file < (int)tmpFiles.size(); file++) { - remove(tmpFiles[file].c_str()); + QFile::remove(tmpFiles[file]); } } } @@ -280,7 +284,7 @@ namespace Isis { * the input file */ void Pipeline::SetInputFile(const char *inputParam) { - SetInputFile(IString(inputParam)); + SetInputFile(QString(inputParam)); } @@ -294,7 +298,7 @@ namespace Isis { * @history 2010-12-20 Sharmila Prasad - Changed p_originalBranches array * to p_inputBranches */ - void Pipeline::SetInputFile(const IString &inputParam) { + void Pipeline::SetInputFile(const QString &inputParam) { UserInterface &ui = Application::GetUserInterface(); p_originalInput.push_back(ui.GetFileName(inputParam)); p_inputBranches.push_back(inputParam); @@ -327,7 +331,7 @@ namespace Isis { * the input file */ void Pipeline::SetInputListFile(const char *inputParam) { - SetInputListFile(IString(inputParam)); + SetInputListFile(QString(inputParam)); } @@ -341,16 +345,16 @@ namespace Isis { * @history 2010-12-20 Sharmila Prasad - Changed p_originalBranches array * to p_inputBranches */ - void Pipeline::SetInputListFile(const IString &inputParam) { + void Pipeline::SetInputListFile(const QString &inputParam) { UserInterface &ui = Application::GetUserInterface(); TextFile filelist(FileName(ui.GetFileName(inputParam)).expanded()); - string filename; + QString filename; int branch = 1; while (filelist.GetLineNoFilter(filename)) { p_originalInput.push_back(filename); - p_inputBranches.push_back(inputParam + IString(branch)); + p_inputBranches.push_back(inputParam + toString(branch)); p_virtualBands.push_back(""); p_finalOutput.push_back(FileName(filename).name()); @@ -371,12 +375,12 @@ namespace Isis { */ void Pipeline::SetInputListFile(const FileName &inputFileName) { TextFile filelist(inputFileName.expanded()); - string filename; + QString filename; int branch = 1; while (filelist.GetLineNoFilter(filename)) { p_originalInput.push_back(filename); - p_inputBranches.push_back(FileName(inputFileName).expanded() + " " + IString(branch)); + p_inputBranches.push_back(FileName(inputFileName).expanded() + " " + QString(branch)); p_finalOutput.push_back(FileName(filename).name()); p_virtualBands.push_back(""); @@ -399,7 +403,7 @@ namespace Isis { * parameter exists. */ void Pipeline::SetInputFile(const char *inputParam, const char *virtualBandsParam) { - SetInputFile(IString(inputParam), IString(virtualBandsParam)); + SetInputFile(QString(inputParam), QString(virtualBandsParam)); } @@ -416,12 +420,12 @@ namespace Isis { * @history 2010-12-20 Sharmila Prasad - Changed p_originalBranches array * to p_inputBranches */ - void Pipeline::SetInputFile(const IString &inputParam, const IString &virtualBandsParam) { + void Pipeline::SetInputFile(const QString &inputParam, const QString &virtualBandsParam) { UserInterface &ui = Application::GetUserInterface(); p_originalInput.push_back(ui.GetAsString(inputParam)); p_inputBranches.push_back(inputParam); - if (!virtualBandsParam.empty() && ui.WasEntered(virtualBandsParam)) { + if (!virtualBandsParam.isEmpty() && ui.WasEntered(virtualBandsParam)) { p_virtualBands.push_back(ui.GetAsString(virtualBandsParam)); } else { @@ -440,7 +444,7 @@ namespace Isis { * the output file; internal default is supported. */ void Pipeline::SetOutputFile(const char *outputParam) { - SetOutputFile(IString(outputParam)); + SetOutputFile(QString(outputParam)); } @@ -453,7 +457,7 @@ namespace Isis { * @param outputParam The parameter to get from the user interface that contains * the output file; internal default is supported. */ - void Pipeline::SetOutputFile(const IString &outputParam) { + void Pipeline::SetOutputFile(const QString &outputParam) { UserInterface &ui = Application::GetUserInterface(); p_finalOutput.clear(); @@ -486,7 +490,7 @@ namespace Isis { * list file */ void Pipeline::SetOutputListFile(const char *outputFileNameParam) { - SetOutputListFile(IString(outputFileNameParam)); + SetOutputListFile(QString(outputFileNameParam)); } @@ -498,7 +502,7 @@ namespace Isis { * @param outputFileNameList Parameter name containing the path to the output * list file */ - void Pipeline::SetOutputListFile(const IString &outputFileNameParam) { + void Pipeline::SetOutputListFile(const QString &outputFileNameParam) { UserInterface &ui = Application::GetUserInterface(); if (ui.WasEntered(outputFileNameParam)) { @@ -527,7 +531,7 @@ namespace Isis { p_finalOutput.clear(); TextFile filelist(outputFileNameList.expanded()); - string filename; + QString filename; while (filelist.GetLineNoFilter(filename)) { p_finalOutput.push_back(filename); @@ -557,7 +561,7 @@ namespace Isis { */ void Pipeline::AddPause() { // Add the pause - IString pauseAppId = ""; + QString pauseAppId = ""; PipelineApplication *pauseApp = NULL; p_apps.push_back(pauseApp); @@ -578,11 +582,11 @@ namespace Isis { * @history 2011-08-15 Debbie A. Cook Added check for NULL pointers in p_apps * */ - void Pipeline::AddToPipeline(const IString &appname, const IString &identifier) { + void Pipeline::AddToPipeline(const QString &appname, const QString &identifier) { // Check uniqueness first for (unsigned int appIdentifier = 0; appIdentifier < p_appIdentifiers.size(); appIdentifier++) { if (p_appIdentifiers[appIdentifier] == identifier) { - IString message = "The application identifier [" + identifier + "] is not unique. " + + QString message = "The application identifier [" + identifier + "] is not unique. " + "Please providing a unique identifier"; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -590,7 +594,7 @@ namespace Isis { // If we've got cubeatt on our list of applications for band eliminating, take it away temporarily PipelineApplication *cubeAtt = NULL; - IString cubeAttId = ""; + QString cubeAttId = ""; if (p_addedCubeatt) { cubeAtt = p_apps[p_apps.size()-1]; cubeAttId = p_appIdentifiers[p_appIdentifiers.size()-1]; @@ -601,7 +605,7 @@ namespace Isis { //Check for non nulls instead of size ie. find last non null or use this int appsSize = 0; - IString pauseAppId = ""; + QString pauseAppId = ""; for (int iapp = 0; iapp < (int) p_apps.size(); iapp++) if (p_apps[iapp] != NULL) appsSize++; @@ -640,11 +644,11 @@ namespace Isis { * @history 2011-08-15 Debbie A. Cook Added check for NULL pointers in p_apps * */ - void Pipeline::AddToPipeline(const IString &appname) { + void Pipeline::AddToPipeline(const QString &appname) { // Check uniqueness first for (unsigned int appIdentifier = 0; appIdentifier < p_appIdentifiers.size(); appIdentifier++) { if (p_appIdentifiers[appIdentifier] == appname) { - IString message = "The application identifier [" + appname + "] is not unique. Please use " + + QString message = "The application identifier [" + appname + "] is not unique. Please use " + "the other AddToPipeline method providing a unique identifier"; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -652,7 +656,7 @@ namespace Isis { // If we've got cubeatt on our list of applications for band eliminating, take it away temporarily PipelineApplication *cubeAtt = NULL; - IString cubeAttId = ""; + QString cubeAttId = ""; if (p_addedCubeatt) { cubeAtt = p_apps[p_apps.size()-1]; cubeAttId = p_appIdentifiers[p_appIdentifiers.size()-1]; @@ -693,7 +697,7 @@ namespace Isis { * * @return PipelineApplication& The application's representation in the pipeline */ - PipelineApplication &Pipeline::Application(const IString &identifier) { + PipelineApplication &Pipeline::Application(const QString &identifier) { int index = 0; bool found = false; @@ -707,7 +711,7 @@ namespace Isis { } if (!found) { - IString msg = "Application identified by [" + identifier + "] has not been added to the pipeline"; + QString msg = "Application identified by [" + identifier + "] has not been added to the pipeline"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -725,7 +729,7 @@ namespace Isis { */ PipelineApplication &Pipeline::Application(const int &index) { if (index > Size()) { - IString msg = "Index [" + IString(index) + "] out of bounds"; + QString msg = "Index [" + QString(index) + "] out of bounds"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -745,7 +749,7 @@ namespace Isis { * @history 2011-08-15 Debbie A. Cook Added check for NULL pointers in p_apps * */ - void Pipeline::SetFirstApplication(const IString &appname) { + void Pipeline::SetFirstApplication(const QString &appname) { int appIndex = 0; for (appIndex = 0; appIndex < (int)p_apps.size() && p_apps[appIndex]->Name() != appname; appIndex++) { @@ -757,7 +761,7 @@ namespace Isis { // } if (appIndex >= (int)p_apps.size()) { - string msg = "Pipeline could not find application [" + appname + "]"; + QString msg = "Pipeline could not find application [" + appname + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -775,7 +779,7 @@ namespace Isis { * @history 2011-08-15 Debbie A. Cook Added check for NULL pointers in p_apps * */ - void Pipeline::SetLastApplication(const IString &appname) { + void Pipeline::SetLastApplication(const QString &appname) { int appIndex = p_apps.size() - 1; for (appIndex = p_apps.size() - 1; appIndex >= 0 && p_apps[appIndex]->Name() != appname; appIndex --) { if (p_apps[appIndex] == NULL) continue; @@ -783,7 +787,7 @@ namespace Isis { } if (appIndex < 0) { - string msg = "Pipeline could not find application [" + appname + "]"; + QString msg = "Pipeline could not find application [" + appname + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -796,20 +800,20 @@ namespace Isis { * @param branch Branch index to get the final output for * @param addModifiers Whether or not to add the last name modifier * - * @return IString The final output string + * @return QString The final output string * * @internal * @history 2011-08-15 Debbie A. Cook Added check for NULL pointers in p_apps * */ - IString Pipeline::FinalOutput(int branch, bool addModifiers) { - IString output = ((p_finalOutput.size() != 0) ? p_finalOutput[0] : ""); + QString Pipeline::FinalOutput(int branch, bool addModifiers) { + QString output = ((p_finalOutput.size() != 0) ? p_finalOutput[0] : ""); if (p_apps.size() == 0) return output; if (p_finalOutput.size() > 1) { if ((unsigned int)branch >= p_finalOutput.size()) { - IString msg = "Output not set for branch [" + IString(branch) + "]"; + QString msg = "Output not set for branch [" + QString(branch) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -877,11 +881,11 @@ namespace Isis { * This method returns the user's temporary folder for temporary files. It's * simply a conveinient accessor to the user's preferences. * - * @return IString The temporary folder + * @return QString The temporary folder */ - IString Pipeline::TemporaryFolder() { + QString Pipeline::TemporaryFolder() { Pvl &pref = Preference::Preferences(); - return (string)pref.FindGroup("DataDirectory")["Temporary"]; + return pref.FindGroup("DataDirectory")["Temporary"]; } @@ -919,20 +923,22 @@ namespace Isis { ostream &operator<<(ostream &os, Pipeline &pipeline) { pipeline.Prepare(); - if (!pipeline.Name().empty()) { + if (!pipeline.Name().isEmpty()) { os << "PIPELINE -------> " << pipeline.Name() << " <------- PIPELINE" << endl; } for (int i = 0; i < pipeline.Size(); i++) { if (&(pipeline.Application(i)) == NULL) continue; if (pipeline.Application(i).Enabled()) { - const vector ¶ms = pipeline.Application(i).ParamString(); + const vector ¶ms = pipeline.Application(i).ParamString(); for (int j = 0; j < (int)params.size(); j++) { - IString special(params[j].substr(0, 7)); + QString special(params[j].mid(0, 7)); if (special == ">>LIST ") { - IString cmd = params[j].substr(7); - IString file = cmd.Token(" "); - os << "echo " << cmd << " > " << file << endl; + QString cmd = params[j].mid(7); + + QStringList listFileData = cmd.split(" "); + QString file = listFileData.takeFirst(); + os << "echo -e \"" << listFileData.join("\\n") << "\" > " << file << endl; } else { os << pipeline.Application(i).Name() << " " << params[j] << endl; @@ -945,9 +951,9 @@ namespace Isis { for (int i = 0; i < pipeline.Size(); i++) { if (&(pipeline.Application(i)) == NULL) continue; if (pipeline.Application(i).Enabled()) { - vector tmpFiles = pipeline.Application(i).TemporaryFiles(); + vector tmpFiles = pipeline.Application(i).TemporaryFiles(); for (int file = 0; file < (int)tmpFiles.size(); file++) { - if (tmpFiles[file].find("blank") == string::npos) { + if (!tmpFiles[file].contains("blank")) { os << "rm " << tmpFiles[file] << endl; } } @@ -955,7 +961,7 @@ namespace Isis { } } - if (!pipeline.Name().empty()) { + if (!pipeline.Name().isEmpty()) { os << "PIPELINE -------> " << pipeline.Name() << " <------- PIPELINE" << endl; } diff --git a/isis/src/base/objs/Pipeline/Pipeline.h b/isis/src/base/objs/Pipeline/Pipeline.h index 6194103d4e..66969456cb 100644 --- a/isis/src/base/objs/Pipeline/Pipeline.h +++ b/isis/src/base/objs/Pipeline/Pipeline.h @@ -25,10 +25,9 @@ #include -#include "IString.h" -#include "PipelineApplication.h" +#include -using namespace std; +#include "PipelineApplication.h" namespace Isis { class FileName; @@ -135,7 +134,7 @@ namespace Isis { * original input, branching from branches, partial * branch merging (discontinuing branches*) * @history 2008-10-28 Unknown - The input no longer has to have virtual - * bands if the SetInputFile(IString,IString) has an + * bands if the SetInputFile(QString,QString) has an * empty parameter name for the virtual bands * parameter. SetInputListFile(...) method added. * @history 2008-12-19 Unknown - List files are now fully supported, along @@ -160,26 +159,26 @@ namespace Isis { */ class Pipeline { public: - Pipeline(const IString &procAppName = ""); + Pipeline(const QString &procAppName = ""); ~Pipeline(); void Prepare(); void Run(); void SetInputFile(const char *inputParam); - void SetInputFile(const IString &inputParam); + void SetInputFile(const QString &inputParam); void SetInputFile(const char *inputParam, const char *virtualBandsParam); - void SetInputFile(const IString &inputParam, const IString &virtualBandsParam); + void SetInputFile(const QString &inputParam, const QString &virtualBandsParam); void SetInputListFile(const char *inputParam); - void SetInputListFile(const IString &inputParam); + void SetInputListFile(const QString &inputParam); void SetInputFile(const FileName &inputFileName); void SetInputListFile(const FileName &inputFileName); void SetOutputFile(const char *outputParam); - void SetOutputFile(const IString &outputParam); + void SetOutputFile(const QString &outputParam); void SetOutputFile(const FileName &outputFile); void SetOutputListFile(const char *outputFileNameParam); - void SetOutputListFile(const IString &outputFileNameParam); + void SetOutputListFile(const QString &outputFileNameParam); void SetOutputListFile(const FileName &outputFileNameList); void KeepTemporaryFiles(bool keep); //! Returns true if temporary files will not be deleted, false if they will @@ -188,18 +187,18 @@ namespace Isis { } void AddPause(); - void AddToPipeline(const IString &appname); - void AddToPipeline(const IString &appname, const IString &identifier); - PipelineApplication &Application(const IString &identifier); + void AddToPipeline(const QString &appname); + void AddToPipeline(const QString &appname, const QString &identifier); + PipelineApplication &Application(const QString &identifier); PipelineApplication &Application(const int &index); - void SetFirstApplication(const IString &appname); - void SetLastApplication(const IString &appname); + void SetFirstApplication(const QString &appname); + void SetLastApplication(const QString &appname); - friend ostream &operator<<(ostream &os, Pipeline &pipeline); + friend std::ostream &operator<<(std::ostream &os, Pipeline &pipeline); //! Returns the name of the pipeline - IString Name() const { + QString Name() const { return p_procAppName; } //! Returns the number of applications in the pipeline @@ -212,9 +211,9 @@ namespace Isis { * * @param branch Branch of the original input to get the filename from * - * @return IString Name of the original input file + * @return QString Name of the original input file */ - IString OriginalInput(unsigned int branch) { + QString OriginalInput(unsigned int branch) { return ((branch < p_originalInput.size()) ? p_originalInput[branch] : ""); } @@ -240,15 +239,15 @@ namespace Isis { //! Returns the names of the original branches of the pipeline //! (input files * branches if any) - vector OriginalBranches() { + std::vector OriginalBranches() { if (p_originalBranches.size() > 0){ return p_originalBranches; } return p_inputBranches; } - IString FinalOutput(int branch = 0, bool addModifiers = true); - IString TemporaryFolder(); + QString FinalOutput(int branch = 0, bool addModifiers = true); + QString TemporaryFolder(); void EnableAllApplications(); @@ -259,7 +258,7 @@ namespace Isis { * * @param branch - Branch name to be added */ - void AddOriginalBranch(IString branch){ + void AddOriginalBranch(QString branch){ int size = (int)p_inputBranches.size(); if (size == 1) { p_originalBranches.push_back(branch); @@ -284,16 +283,16 @@ namespace Isis { private: int p_pausePosition; - IString p_procAppName; //!< The name of the pipeline - vector p_originalInput; //!< The original input file - vector p_inputBranches; //!< Branches for input list - vector p_originalBranches; //!< The input file(s) + original branches from pipeline - vector p_finalOutput; //!< The final output file (empty if needs calculated) - vector p_virtualBands;//!< The virtual bands string + QString p_procAppName; //!< The name of the pipeline + std::vector p_originalInput; //!< The original input file + std::vector p_inputBranches; //!< Branches for input list + std::vector p_originalBranches; //!< The input file(s) + original branches from pipeline + std::vector p_finalOutput; //!< The final output file (empty if needs calculated) + std::vector p_virtualBands;//!< The virtual bands string bool p_keepTemporary; //!< True if keeping temporary files bool p_addedCubeatt; //!< True if the "cubeatt" program was added - vector< PipelineApplication * > p_apps; //!< The pipeline applications - vector< IString > p_appIdentifiers; //!< The strings to identify the pipeline applications + std::vector< PipelineApplication * > p_apps; //!< The pipeline applications + std::vector< QString > p_appIdentifiers; //!< The strings to identify the pipeline applications bool p_outputListNeedsModifiers; bool p_continue; //!< continue the execution even if exception is encountered. }; diff --git a/isis/src/base/objs/Pipeline/Pipeline.truth b/isis/src/base/objs/Pipeline/Pipeline.truth index 7bd71e6c20..47a790f6fd 100644 --- a/isis/src/base/objs/Pipeline/Pipeline.truth +++ b/isis/src/base/objs/Pipeline/Pipeline.truth @@ -167,7 +167,7 @@ thmvistrim FROM="./out.flat.even.cub" TO="./out.cal.even.cub" thmvistrim FROM="./out.flat.odd.cub" TO="./out.cal.odd.cub" cam2map FROM="./out.cal.even.cub" TO="./out.lev2.even.cub" cam2map FROM="./out.cal.odd.cub" TO="./out.lev2.odd.cub" MAP="./out.lev2.even.cub" PIXRES="MAP" DEFAULTRANGE="MAP" -echo ./out.lev2.even.cub ./out.lev2.odd.cub > ./out.lis +echo -e "\n./out.lev2.even.cub\n./out.lev2.odd.cub" > ./out.lis automos FROMLIST="./out.lis" TO="/work1/out.cub" rm ./out.lev1.even.cub rm ./out.lev1.odd.cub @@ -190,7 +190,7 @@ thmvistrim FROM="./out.flat.even.cub" TO="./out.cal.even.cub" thmvistrim FROM="./out.flat.odd.cub" TO="./out.cal.odd.cub" cam2map FROM="./out.cal.even.cub" TO="./out.lev2.even.cub" cam2map FROM="./out.cal.odd.cub" TO="./out.lev2.odd.cub" MAP="./out.lev2.even.cub" PIXRES="MAP" DEFAULTRANGE="MAP" -echo ./out.lev2.even.cub ./out.lev2.odd.cub > ./out.lis +echo -e "\n./out.lev2.even.cub\n./out.lev2.odd.cub" > ./out.lis automos FROMLIST="./out.lis" TO="/work1/out.cub" rm ./out.lev1.even.cub rm ./out.lev1.odd.cub @@ -213,7 +213,7 @@ thmvistrim FROM="./out.flat.even.cub" TO="./out.cal.even.cub" thmvistrim FROM="./out.flat.odd.cub" TO="./out.cal.odd.cub" cam2map FROM="./out.cal.even.cub" TO="./out.lev2.even.cub" cam2map FROM="./out.cal.odd.cub" TO="./out.lev2.odd.cub" MAP="./out.lev2.even.cub" PIXRES="MAP" DEFAULTRANGE="MAP" -echo ./out.lev2.even.cub ./out.lev2.odd.cub > ./out.lis +echo -e "\n./out.lev2.even.cub\n./out.lev2.odd.cub" > ./out.lis automos FROMLIST="./out.lis" TO="/work1/out.cub" rm ./out.lev1.even.cub rm ./out.lev1.odd.cub @@ -315,7 +315,7 @@ thmvistrim FROM="./out.flat.even.cub" TO="./out.cal.even.cub" thmvistrim FROM="./out.flat.odd.cub" TO="./out.cal.odd.cub" cam2map FROM="./out.cal.even.cub" TO="./out.lev2.even.cub" cam2map FROM="./out.cal.odd.cub" TO="./out.lev2.odd.cub" MAP="./out.lev2.even.cub" PIXRES="MAP" DEFAULTRANGE="MAP" -echo ./out.lev2.even.cub ./out.lev2.odd.cub > ./out.lis +echo -e "\n./out.lev2.even.cub\n./out.lev2.odd.cub" > ./out.lis automos FROMLIST="./out.lis" TO="/work1/out.cub" rm ./out.lev1.even.cub rm ./out.lev1.odd.cub @@ -338,7 +338,7 @@ thmvistrim FROM="./out.flat.even.cub" TO="./out.cal.even.cub" thmvistrim FROM="./out.flat.odd.cub" TO="./out.cal.odd.cub" cam2map FROM="./out.cal.even.cub" TO="./out.lev2.even.cub" cam2map FROM="./out.cal.odd.cub" TO="./out.lev2.odd.cub" MAP="./out.lev2.even.cub" PIXRES="MAP" DEFAULTRANGE="MAP" -echo ./out.lev2.even.cub ./out.lev2.odd.cub > ./out.lis +echo -e "\n./out.lev2.even.cub\n./out.lev2.odd.cub" > ./out.lis automos FROMLIST="./out.lis" TO="/work1/out.cub" rm ./out.lev1.even.cub rm ./out.lev1.odd.cub @@ -374,7 +374,7 @@ PIPELINE -------> unitTest3 <------- PIPELINE PIPELINE -------> unitTest3 <------- PIPELINE fft FROM="$ISIS3DATA/odyssey/testData/I00831002RDR.even.cub+2,4-5" MAGNITUDE="./out.fft.FROM.mag.cub" MAGNITUDE="./out.fft.FROM2.mag.cub" PHASE="./out.fft.FROM2.phase.cub" PHASE="./out.fft.FROM.phase.cub" fft FROM="$ISIS3DATA/odyssey/testData/I00831002RDR.odd.cub+2,4-5" MAGNITUDE="./out.fft.FROM2.mag.cub" PHASE="./out.fft.FROM2.phase.cub" -echo ./out.fft.FROM.mag.cub ./out.fft.FROM2.mag.cub ./out.fft.FROM2.phase.cub ./out.fft.FROM.phase.cub > ./out.FROM.mag.lis +echo -e "\n./out.fft.FROM.mag.cub\n./out.fft.FROM2.mag.cub\n./out.fft.FROM2.phase.cub\n./out.fft.FROM.phase.cub" > ./out.FROM.mag.lis fx FILELIST="./out.FROM.mag.lis" TO="/work1/out.FROM.mag.cub" equation="1+2" MODE="list" fx FILELIST="./out.FROM.mag.lis" TO="/work1/out.FROM2.phase.cub" MODE="list" equation="1+3" rm ./out.fft.FROM.mag.cub @@ -387,7 +387,7 @@ PIPELINE -------> unitTest3 <------- PIPELINE PIPELINE -------> unitTest3 <------- PIPELINE fft FROM="$ISIS3DATA/odyssey/testData/I00831002RDR.even.cub+2,4-5" MAGNITUDE="./out.fft.FROM.mag.cub" MAGNITUDE="./out.fft.FROM2.mag.cub" PHASE="./out.fft.FROM2.phase.cub" PHASE="./out.fft.FROM.phase.cub" fft FROM="$ISIS3DATA/odyssey/testData/I00831002RDR.odd.cub+2,4-5" MAGNITUDE="./out.fft.FROM2.mag.cub" PHASE="./out.fft.FROM2.phase.cub" -echo ./out.fft.FROM.mag.cub ./out.fft.FROM2.mag.cub ./out.fft.FROM2.phase.cub ./out.fft.FROM.phase.cub > ./out.fx2.FROM.mag.lis +echo -e "\n./out.fft.FROM.mag.cub\n./out.fft.FROM2.mag.cub\n./out.fft.FROM2.phase.cub\n./out.fft.FROM.phase.cub" > ./out.fx2.FROM.mag.lis fx FILELIST="./out.fx2.FROM.mag.lis" TO="./out.fx2.FROM.mag.cub" equation="1+2" MODE="list" fx FILELIST="./out.fx2.FROM.mag.lis" TO="./out.fx2.FROM2.phase.cub" MODE="list" equation="1+3" ifft MAGNITUDE="./out.fx2.FROM.mag.cub" TO="/work1/out.cub" PHASE="./out.fx2.FROM2.phase.cub" @@ -403,7 +403,7 @@ PIPELINE -------> unitTest3 <------- PIPELINE PIPELINE -------> unitTest3 <------- PIPELINE fft FROM="$ISIS3DATA/odyssey/testData/I00831002RDR.even.cub+2,4-5" MAGNITUDE="./out.fft.FROM.mag.cub" MAGNITUDE="./out.fft.FROM2.mag.cub" PHASE="./out.fft.FROM2.phase.cub" PHASE="./out.fft.FROM.phase.cub" fft FROM="$ISIS3DATA/odyssey/testData/I00831002RDR.odd.cub+2,4-5" MAGNITUDE="./out.fft.FROM2.mag.cub" PHASE="./out.fft.FROM2.phase.cub" -echo ./out.fft.FROM.mag.cub ./out.fft.FROM2.mag.cub ./out.fft.FROM2.phase.cub ./out.fft.FROM.phase.cub > ./out.fx2.FROM.mag.lis +echo -e "\n./out.fft.FROM.mag.cub\n./out.fft.FROM2.mag.cub\n./out.fft.FROM2.phase.cub\n./out.fft.FROM.phase.cub" > ./out.fx2.FROM.mag.lis fx FILELIST="./out.fx2.FROM.mag.lis" TO="./out.fx2.FROM.mag.cub" equation="1+2" MODE="list" fx FILELIST="./out.fx2.FROM.mag.lis" TO="./out.fx2.FROM2.phase.cub" MODE="list" equation="1+3" ifft MAGNITUDE="./out.fx2.FROM.mag.cub" TO="./out.untranslated.cub" PHASE="./out.fx2.FROM2.phase.cub" @@ -426,7 +426,7 @@ cubeatt FROM="fileC" TO="./fileC.jitter.copy.FROM3.cub" spiceinit FROM="./fileA.jitter.copy.FROM1.cub" ATTACH="NO" spiceinit FROM="./fileB.jitter.copy.FROM2.cub" ATTACH="NO" spiceinit FROM="./fileC.jitter.copy.FROM3.cub" ATTACH="NO" -echo ./fileA.jitter.copy.FROM1.cub ./fileB.jitter.copy.FROM2.cub ./fileC.jitter.copy.FROM3.cub > ./appjit.lis +echo -e "\n./fileA.jitter.copy.FROM1.cub\n./fileB.jitter.copy.FROM2.cub\n./fileC.jitter.copy.FROM3.cub" > ./appjit.lis appjit FROMLIST="./appjit.lis" MASTER="MASTER.cub" DEGREE="1" noproj FROM="./fileA.jitter.copy.FROM1.cub" TO="./fileA.jitter.cub" MATCH="MATCH.cub" noproj FROM="./fileB.jitter.copy.FROM2.cub" TO="./fileB.jitter.cub" MATCH="MATCH.cub" @@ -441,7 +441,7 @@ PIPELINE -------> unitTest4 <------- PIPELINE PIPELINE -------> unitTest5 <------- PIPELINE lowpass FROM="$ISIS3DATA/odyssey/testData/I00831002RDR.cub" TO="./out.lowpass.lpf.cub" SAMPLES="3" LINES="3" highpass FROM="$ISIS3DATA/odyssey/testData/I00831002RDR.cub" TO="./out.highpass.hpf.cub" SAMPLES="3" LINES="3" -echo ./out.highpass.hpf.cub ./out.lowpass.lpf.cub > ./out.add.lis +echo -e "\n./out.highpass.hpf.cub\n./out.lowpass.lpf.cub" > ./out.add.lis fx FROMLIST="./out.add.lis" TO="./out.add.cub" MODE="LIST" EQUATION="f1+f2" cubeatt FROM="./out.add.cub+2,4-5" TO="./out.cub" rm ./out.lowpass.lpf.cub diff --git a/isis/src/base/objs/Pipeline/PipelineApplication.cpp b/isis/src/base/objs/Pipeline/PipelineApplication.cpp index 4f3abc6fed..b214bf3fa7 100644 --- a/isis/src/base/objs/Pipeline/PipelineApplication.cpp +++ b/isis/src/base/objs/Pipeline/PipelineApplication.cpp @@ -16,7 +16,7 @@ namespace Isis { * @param pipe The pipeline * @history 2010-12-20 Sharmila Prasad Initialise & enable the branches */ - PipelineApplication::PipelineApplication(IString appName, Pipeline *pipe) { + PipelineApplication::PipelineApplication(QString appName, Pipeline *pipe) { p_name = appName; p_enabled = true; p_previous = NULL; @@ -46,7 +46,7 @@ namespace Isis { * @param previous The previously last pipeline application * @history 2010-12-20 Sharmila Prasad Initialise & enable the branches */ - PipelineApplication::PipelineApplication(IString appName, PipelineApplication *previous) { + PipelineApplication::PipelineApplication(QString appName, PipelineApplication *previous) { p_name = appName; p_enabled = true; p_previous = previous; @@ -70,7 +70,7 @@ namespace Isis { * @param inputParamName Name of the input parameter, typically "FROM" * @param supportsVirtualBands True if this application supports virtual bands */ - void PipelineApplication::SetInputParameter(const IString &inputParamName, bool supportsVirtualBands) { + void PipelineApplication::SetInputParameter(const QString &inputParamName, bool supportsVirtualBands) { p_input.clear(); p_input.push_back(PipelineParameter(inputParamName)); p_supportsVirtualBands = supportsVirtualBands; @@ -87,7 +87,7 @@ namespace Isis { * SetInputParameter instead of specifying LastOutput * @param supportsVirtualBands True if this application supports virtual bands */ - void PipelineApplication::SetInputParameter(const IString &inputParamName, CustomParameterValue value, bool supportsVirtualBands) { + void PipelineApplication::SetInputParameter(const QString &inputParamName, CustomParameterValue value, bool supportsVirtualBands) { if(value == LastAppOutputList) { // Merge p_outBranches.clear(); @@ -113,8 +113,8 @@ namespace Isis { * @param outNameModifier Modifier to add to the cube name, such as "lev1" * @param outFileExtension Extension of the output file (usually "cub" for cube) */ - void PipelineApplication::SetOutputParameter(const IString &branch, const IString &outputParamName, - const IString &outNameModifier, const IString &outFileExtension) { + void PipelineApplication::SetOutputParameter(const QString &branch, const QString &outputParamName, + const QString &outNameModifier, const QString &outFileExtension) { p_output.push_back(PipelineParameter(FindBranch(branch, false), outputParamName)); p_outputMod = outNameModifier; p_outputExtension = outFileExtension; @@ -128,7 +128,7 @@ namespace Isis { * @param outNameModifier Modifier to add to the cube name, such as "lev1" * @param outFileExtension Extension of the output file (usually "cub" for cube) */ - void PipelineApplication::SetOutputParameter(const IString &outputParamName, const IString &outNameModifier, const IString &outFileExtension) { + void PipelineApplication::SetOutputParameter(const QString &outputParamName, const QString &outNameModifier, const QString &outFileExtension) { p_output.clear(); p_output.push_back(PipelineParameter(outputParamName)); p_outputMod = outNameModifier; @@ -154,7 +154,7 @@ namespace Isis { * @param type Modifier type; currently only supports constant strings * @history 2010-12-20 Sharmila Prasad Enable the branch at the time of creation */ - void PipelineApplication::AddBranch(const IString &modString, NameModifierType type) { + void PipelineApplication::AddBranch(const QString &modString, NameModifierType type) { if(modString == "") { string msg = "Can not add empty branch to pipeline"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -201,7 +201,7 @@ namespace Isis { * @param inputParamName Parameter in the proc program * @param appParamName Parameter in this application */ - void PipelineApplication::AddParameter(const IString &inputParamName, const IString &appParamName) { + void PipelineApplication::AddParameter(const QString &inputParamName, const QString &appParamName) { UserInterface &ui = Application::GetUserInterface(); if(ui.WasEntered(inputParamName)) { @@ -219,7 +219,7 @@ namespace Isis { * @param inputParamName Parameter in the proc program * @param appParamName Parameter in the this application */ - void PipelineApplication::AddParameter(const IString &branch, const IString &inputParamName, const IString &appParamName) { + void PipelineApplication::AddParameter(const QString &branch, const QString &inputParamName, const QString &appParamName) { UserInterface &ui = Application::GetUserInterface(); if(ui.WasEntered(inputParamName)) { @@ -235,7 +235,7 @@ namespace Isis { * @param appParamName Name of the parameter * @param appParamValue Value of the parameter */ - void PipelineApplication::AddConstParameter(const IString &appParamName, const IString &appParamValue) { + void PipelineApplication::AddConstParameter(const QString &appParamName, const QString &appParamValue) { bool added = false; for(unsigned int i = 0; !added && i < p_params.size(); i++) { @@ -261,7 +261,7 @@ namespace Isis { * @param appParamName Name of the parameter * @param appParamValue Value of the parameter */ - void PipelineApplication::AddConstParameter(const IString &branch, const IString &appParamName, const IString &appParamValue) { + void PipelineApplication::AddConstParameter(const QString &branch, const QString &appParamName, const QString &appParamValue) { p_params.push_back(PipelineParameter(FindBranch(branch, false), appParamName, appParamValue)); } @@ -273,7 +273,7 @@ namespace Isis { * @param appParamName Parameter name * @param value Value type */ - void PipelineApplication::AddParameter(const IString &appParamName, CustomParameterValue value) { + void PipelineApplication::AddParameter(const QString &appParamName, CustomParameterValue value) { p_params.push_back(PipelineParameter(appParamName, value)); } @@ -286,7 +286,7 @@ namespace Isis { * @param appParamName Parameter name * @param value Value type */ - void PipelineApplication::AddParameter(const IString &branch, const IString &appParamName, CustomParameterValue value) { + void PipelineApplication::AddParameter(const QString &branch, const QString &appParamName, CustomParameterValue value) { p_params.push_back(PipelineParameter(FindBranch(branch, false), appParamName, value)); } @@ -309,7 +309,7 @@ namespace Isis { // These are used if the pipeline needs a list file; must be out here in case multiple branches use // the list file. bool needList = false; - IString listFile; + QString listFile; bool runOnce = Merges() && !Branches(); @@ -343,20 +343,20 @@ namespace Isis { } if(!BranchEnabled(branch)) { - IString tmpBranch(branch); + QString tmpBranch(branch); p_outputs.push_back(p_name + "." +tmpBranch + ".blank"); continue; } // Figure out the input file; could throw an exception if the user didnt set it - IString inputFile = CalculateInputFile(branch); + QString inputFile = CalculateInputFile(branch); // Figure out the output file; This adds the output to the output list* - IString outputFile = CalculateOutputFile(branch); + QString outputFile = CalculateOutputFile(branch); // This parameter gives us more detail about the input parameter PipelineParameter &inputParam = GetInputParameter(branch); - string params = ""; + QString params = ""; // If we havent needed a list yet, let's see if we need one now if(!needList) { @@ -370,16 +370,16 @@ namespace Isis { // If we need a list file, create a parameter that starts with ">>LIST" to say it's a list file. // The first element is the list file, the rest is the contents of the list file. if(needList) { - IString listName = outputFile; + QString listName = outputFile; - if(listName.empty()) { + if(listName.isEmpty()) { // This might have to become more robust in the future, we // have an input list but no outputs to the program for // this case. This is the naming of the list. listName = Name(); } - IString input = p_pipeline->TemporaryFolder() + "/" + FileName(listName).baseName() + ".lis"; + QString input = p_pipeline->TemporaryFolder() + "/" + FileName(listName).baseName() + ".lis"; params = ">>LIST " + input + " "; PipelineApplication * prev = Previous(); @@ -412,7 +412,7 @@ namespace Isis { if(p_virtualBands.size() == 1) { params += "+" + p_virtualBands[0]; } - else if(p_virtualBands.size() == p_inBranches.size() && !p_virtualBands[branch].empty()) { + else if(p_virtualBands.size() == p_inBranches.size() && !p_virtualBands[branch].isEmpty()) { params += "+" + p_virtualBands[branch]; } @@ -440,7 +440,7 @@ namespace Isis { params += " " + p_output[outParam].Name() + "=\"" + p_outputs[outBranch] + "\""; if(outputSet) { - IString message = "Application [" + Name() + "] in the pipeline branches with an "; + QString message = "Application [" + Name() + "] in the pipeline branches with an "; message += "output parameter for each branch, but branch [" + p_outBranches[outBranch]; message += "] has multiple output files specified."; throw IException(IException::Programmer, message, _FILEINFO_); @@ -451,7 +451,7 @@ namespace Isis { } if(!outputSet) { - IString message = "Application [" + Name() + "] in the pipeline branches with an "; + QString message = "Application [" + Name() + "] in the pipeline branches with an "; message += "output parameter for each branch, but branch [" + p_outBranches[outBranch]; message += "] has no output files specified."; throw IException(IException::Programmer, message, _FILEINFO_); @@ -488,8 +488,8 @@ namespace Isis { } } - if(inputFile.empty()) { - IString message = "There was a problem with calculating the inputs for program [" + Name(); + if(inputFile.isEmpty()) { + QString message = "There was a problem with calculating the inputs for program [" + Name(); message += "]. Please verify your program is not setting outputs for branches that "; message += "don't have input."; throw IException(IException::Programmer, message, _FILEINFO_); @@ -506,12 +506,12 @@ namespace Isis { * * @param branch Branch this input file affects * - * @return IString Input filename + * @return QString Input filename * @history 2010-12-20 Sharmila Prasad Get the right input for this branch if previous * branch is disabled. */ - IString PipelineApplication::CalculateInputFile(int branch) { - IString file = ""; + QString PipelineApplication::CalculateInputFile(int branch) { + QString file = ""; PipelineApplication *prev = Previous(); @@ -529,7 +529,7 @@ namespace Isis { } } /* else { - vector inputs = prev->GetInputs(); + vector inputs = prev->GetInputs(); if((int)inputs.size() > branch) { file = inputs[branch]; } @@ -553,9 +553,9 @@ namespace Isis { } // We're either the first program, or nothing has generated output yet. - if(file.empty()){ + if(file.isEmpty()){ file = p_pipeline->OriginalInput(branch); - if (file.empty()) { + if (file.isEmpty()) { int index = branch / (p_pipeline->OriginalBranchesSize() / p_pipeline->OriginalInputSize()); file = p_pipeline->OriginalInput(index); } @@ -579,11 +579,11 @@ namespace Isis { * * @param branch Branch this output file is for * - * @return IString The output file + * @return QString The output file */ - IString PipelineApplication::CalculateOutputFile(int branch) { - IString outputFile; - IString outFolder = p_pipeline->TemporaryFolder(); + QString PipelineApplication::CalculateOutputFile(int branch) { + QString outputFile; + QString outFolder = p_pipeline->TemporaryFolder(); // We need to know this to know if we actually need to add modifiers to the // output name @@ -616,11 +616,11 @@ namespace Isis { if(!usedBranch) return ""; if(!LastApplicationWithOutput()) { - IString lastOutput = p_pipeline->FinalOutput(branch, false); + QString lastOutput = p_pipeline->FinalOutput(branch, false); outputFile = outFolder + "/" + FileName(lastOutput).baseName() + "." + p_outputMod + "." + p_outputExtension; - if(p_outputMod.empty()) { + if(p_outputMod.isEmpty()) { outputFile = outFolder + "/" + FileName(lastOutput).baseName() + "." + p_outputExtension; } @@ -630,10 +630,10 @@ namespace Isis { outFolder = FileName(outputFile).path(); } - if(!LastApplicationWithOutput() && numUsedBranches != 1 && !p_outputMod.empty()) { + if(!LastApplicationWithOutput() && numUsedBranches != 1 && !p_outputMod.isEmpty()) { FileName outfile(outputFile); - IString realOut(outFolder + "/" + outfile.baseName() + "." + p_outBranches[branch] + "." + p_outputExtension); + QString realOut(outFolder + "/" + outfile.baseName() + "." + p_outBranches[branch] + "." + p_outputExtension); if(usedBranch) { @@ -660,7 +660,7 @@ namespace Isis { } } } - else if(!p_outputMod.empty()) { + else if(!p_outputMod.isEmpty()) { if(p_outputs.size() == usedBranchIndex) { p_outputs.push_back(outputFile); } @@ -732,11 +732,11 @@ namespace Isis { } if(p_inBranches[0] != "") { - string msg = "Application [" + Name() + "] in the pipeline does not have an input for branch [" + p_inBranches[branch] + "]"; + QString msg = "Application [" + Name() + "] in the pipeline does not have an input for branch [" + p_inBranches[branch] + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } else { - string msg = "Application [" + Name() + "] in the pipeline does not have an input"; + QString msg = "Application [" + Name() + "] in the pipeline does not have an input"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -750,7 +750,7 @@ namespace Isis { * * @return int Branch index */ - int PipelineApplication::FindBranch(IString name, bool input) { + int PipelineApplication::FindBranch(QString name, bool input) { int branchIndex = 0; bool found = false; @@ -776,7 +776,7 @@ namespace Isis { } if(!found) { - string msg = "Branch [" + name + "] does not exist in the pipeline application [" + Name() + "]"; + QString msg = "Branch [" + name + "] does not exist in the pipeline application [" + Name() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -788,10 +788,10 @@ namespace Isis { * This method returns a list of the temporary files generated by this program * * - * @return vector The temporary files + * @return vector The temporary files */ - vector PipelineApplication::TemporaryFiles() { - vector tmp; + vector PipelineApplication::TemporaryFiles() { + vector tmp; if(!LastApplicationWithOutput()) { for(int i = 0; i < (int)p_outputs.size(); i++) { @@ -814,9 +814,9 @@ namespace Isis { * @param skipOne Skip the very last output; this is used to skip the output of * the current run * - * @return IString The last output file + * @return QString The last output file */ - IString PipelineApplication::GetRealLastOutput(bool skipOne) { + QString PipelineApplication::GetRealLastOutput(bool skipOne) { if(!skipOne) { return GetOutputs()[GetOutputs().size()-1]; } @@ -847,12 +847,12 @@ namespace Isis { * @param bands The virtual bands string, excluding the "+". For example, * "2,4-5,8" */ - void PipelineApplication::SetVirtualBands(vector bands) { + void PipelineApplication::SetVirtualBands(vector bands) { p_virtualBands = bands; } //! This returns this application's output files. Only valid after BuildParamString is called. - vector &PipelineApplication::GetOutputs() { + vector &PipelineApplication::GetOutputs() { if(Enabled() && p_outputs.size() != 0) { return p_outputs; } diff --git a/isis/src/base/objs/Pipeline/PipelineApplication.h b/isis/src/base/objs/Pipeline/PipelineApplication.h index 391878b0cd..1f7e5b35aa 100644 --- a/isis/src/base/objs/Pipeline/PipelineApplication.h +++ b/isis/src/base/objs/Pipeline/PipelineApplication.h @@ -24,10 +24,10 @@ */ #include -#include "IException.h" -#include "IString.h" -using namespace std; +#include + +#include "IException.h" namespace Isis { class Pipeline; @@ -61,8 +61,8 @@ namespace Isis { */ class PipelineApplication { public: - PipelineApplication(IString appName, Pipeline *pipe); - PipelineApplication(IString appName, PipelineApplication *previous); + PipelineApplication(QString appName, Pipeline *pipe); + PipelineApplication(QString appName, PipelineApplication *previous); //! This is the destructor ~PipelineApplication() {}; @@ -91,19 +91,19 @@ namespace Isis { }; //! Get the name of this pipeline application - const IString &Name() const { + const QString &Name() const { return p_name; } //! Get the parameters for running this program; one element in the vector per run - const vector &ParamString() const { + const std::vector &ParamString() const { return p_paramString; } //! Get the branches this program expects as input - const vector &InputBranches() const { + const std::vector &InputBranches() const { return p_inBranches; } //! Get the branches this program has as output - const vector &OutputBranches() const { + const std::vector &OutputBranches() const { if(!Enabled() && Previous()) { return Previous()->OutputBranches(); } @@ -130,36 +130,36 @@ namespace Isis { return p_enabled; } - void SetInputParameter(const IString &inputParamName, bool supportsVirtualBands); - void SetInputParameter(const IString &inputParamName, CustomParameterValue value, bool supportsVirtualBands); + void SetInputParameter(const QString &inputParamName, bool supportsVirtualBands); + void SetInputParameter(const QString &inputParamName, CustomParameterValue value, bool supportsVirtualBands); - void SetOutputParameter(const IString &outputParamName, const IString &outNameModifier, const IString &outFileExtension = "cub"); - void SetOutputParameter(const IString &branch, const IString &outputParamName, - const IString &outNameModifier, const IString &outFileExtension); + void SetOutputParameter(const QString &outputParamName, const QString &outNameModifier, const QString &outFileExtension = "cub"); + void SetOutputParameter(const QString &branch, const QString &outputParamName, + const QString &outNameModifier, const QString &outFileExtension); - void AddBranch(const IString &modString, NameModifierType type); + void AddBranch(const QString &modString, NameModifierType type); - void AddParameter(const IString &inputParamName, const IString &appParamName); - void AddParameter(const IString &branch, const IString &inputParamName, const IString &appParamName); + void AddParameter(const QString &inputParamName, const QString &appParamName); + void AddParameter(const QString &branch, const QString &inputParamName, const QString &appParamName); - void AddConstParameter(const IString &appParamName, const IString &appParamValue); - void AddConstParameter(const IString &branch, const IString &appParamName, const IString &appParamValue); + void AddConstParameter(const QString &appParamName, const QString &appParamValue); + void AddConstParameter(const QString &branch, const QString &appParamName, const QString &appParamValue); - void AddParameter(const IString &appParamName, CustomParameterValue value); - void AddParameter(const IString &branch, const IString &appParamName, CustomParameterValue value); + void AddParameter(const QString &appParamName, CustomParameterValue value); + void AddParameter(const QString &branch, const QString &appParamName, CustomParameterValue value); //! This returns this application's output name modifier - IString OutputNameModifier() { - return (!p_outputMod.empty() || !Previous()) ? p_outputMod : Previous()->OutputNameModifier(); + QString OutputNameModifier() { + return (!p_outputMod.isEmpty() || !Previous()) ? p_outputMod : Previous()->OutputNameModifier(); } //! This returns this application's output file name's extension - IString OutputExtension() { - return (!p_outputExtension.empty() || !Previous()) ? p_outputExtension : Previous()->OutputExtension(); + QString OutputExtension() { + return (!p_outputExtension.isEmpty() || !Previous()) ? p_outputExtension : Previous()->OutputExtension(); } //! This returns this application's output files. Only valid after BuildParamString is called. - vector &GetOutputs(); + std::vector &GetOutputs(); - vector TemporaryFiles(); + std::vector TemporaryFiles(); /** * Link to the next application in the pipeline @@ -205,7 +205,7 @@ namespace Isis { } bool SupportsVirtualBands(); - void SetVirtualBands(vector bands); + void SetVirtualBands(std::vector bands); /** * Enable/Disable Branch given the branch name @@ -215,9 +215,9 @@ namespace Isis { * @param branch - branch name * @param flag - true/false */ - void EnableBranch(IString branch, bool flag) { + void EnableBranch(QString branch, bool flag) { for(int i=0; i<(int)p_inBranches.size(); i++) { - if (p_inBranches[i].rfind(branch) != string::npos) + if (p_inBranches[i].contains(branch)) p_enableBranch[i] = flag; } } @@ -286,40 +286,40 @@ namespace Isis { * @param from Longer string ("abcdef") * @param compare String to compare against ("abc") */ - bool StringStartsWith(IString from, IString compare) { + bool StringStartsWith(QString from, QString compare) { if(compare.size() > from.size()) return false; - for(unsigned int index = 0; index < compare.size(); index++) + for(int index = 0; index < compare.size(); index++) if(from[index] != compare[index]) return false; return true; } - IString CalculateInputFile(int branch); - IString CalculateOutputFile(int branch); - IString GetRealLastOutput(bool skipOne = false); + QString CalculateInputFile(int branch); + QString CalculateOutputFile(int branch); + QString GetRealLastOutput(bool skipOne = false); PipelineParameter &GetInputParameter(int branch); - int FindBranch(IString name, bool input = true); + int FindBranch(QString name, bool input = true); bool p_continue;//!< Continue the pipeline execution even if an error is encountered by this app bool p_enabled; //!< This application enabled? bool p_supportsVirtualBands; //!< This application supports virtual bands? - IString p_name; //!< Name of this application - vector p_outputs; //!< Actual output files - vector p_tempFiles; //!< Actial temporary files - vector p_paramString; //!< Built parameter strings - vector p_inBranches; //!< Input branches - vector p_outBranches; //!< Output branches - vector p_enableBranch; //!< Branch enabled/disabled + QString p_name; //!< Name of this application + std::vector p_outputs; //!< Actual output files + std::vector p_tempFiles; //!< Actial temporary files + std::vector p_paramString; //!< Built parameter strings + std::vector p_inBranches; //!< Input branches + std::vector p_outBranches; //!< Output branches + std::vector p_enableBranch; //!< Branch enabled/disabled - vector p_output; //!< Output parameters - IString p_outputMod; //!< Output file name modifier - IString p_outputExtension; //!< Output file name extension - vector p_virtualBands; //!< Virtual bands string to add (empty if none) + std::vector p_output; //!< Output parameters + QString p_outputMod; //!< Output file name modifier + QString p_outputExtension; //!< Output file name extension + std::vector p_virtualBands; //!< Virtual bands string to add (empty if none) - vector p_input; //!< Input parameters - vector p_params; //!< Regular parameters + std::vector p_input; //!< Input parameters + std::vector p_params; //!< Regular parameters PipelineApplication *p_previous; //!< Previous pipeline application PipelineApplication *p_next; //!< Next pipeline application @@ -344,7 +344,7 @@ namespace Isis { * * @param paramName Parameter name */ - PipelineParameter(IString paramName) { + PipelineParameter(QString paramName) { p_paramName = paramName; p_special = (PipelineApplication::CustomParameterValue) - 1; p_branch = -1; @@ -358,7 +358,7 @@ namespace Isis { * @param paramName Parameter name * @param value Parameter value */ - PipelineParameter(IString paramName, IString value) { + PipelineParameter(QString paramName, QString value) { p_paramName = paramName; p_paramValue = value; p_special = (PipelineApplication::CustomParameterValue) - 1; @@ -373,7 +373,7 @@ namespace Isis { * @param branch Branch this parameter affects * @param paramName Parameter name */ - PipelineParameter(int branch, IString paramName) { + PipelineParameter(int branch, QString paramName) { p_branch = branch; p_paramName = paramName; p_special = (PipelineApplication::CustomParameterValue) - 1; @@ -388,7 +388,7 @@ namespace Isis { * @param paramName Parameter name * @param paramValue Special parameter value */ - PipelineParameter(int branch, IString paramName, IString paramValue) { + PipelineParameter(int branch, QString paramName, QString paramValue) { p_branch = branch; p_paramValue = paramValue; p_paramName = paramName; @@ -403,7 +403,7 @@ namespace Isis { * @param paramName Parameter name * @param special Special value */ - PipelineParameter(IString paramName, PipelineApplication::CustomParameterValue special) { + PipelineParameter(QString paramName, PipelineApplication::CustomParameterValue special) { p_paramName = paramName; p_special = special; p_branch = -1; @@ -418,7 +418,7 @@ namespace Isis { * @param paramName Parameter name * @param special Special parameter value */ - PipelineParameter(int branch, IString paramName, PipelineApplication::CustomParameterValue special) { + PipelineParameter(int branch, QString paramName, PipelineApplication::CustomParameterValue special) { p_paramName = paramName; p_special = special; p_branch = branch; @@ -437,11 +437,11 @@ namespace Isis { } //! Name of the parameter - IString Name() { + QString Name() { return p_paramName; } //! Non-special value of the parameter - IString Value() { + QString Value() { return p_paramValue; } //! True if the parameter value is special @@ -459,8 +459,8 @@ namespace Isis { private: int p_branch; //!< Branch this affects - IString p_paramName; //!< Parameter name - IString p_paramValue; //!< Parameter non-special value + QString p_paramName; //!< Parameter name + QString p_paramValue; //!< Parameter non-special value PipelineApplication::CustomParameterValue p_special; //!< Parameter special value }; }; diff --git a/isis/src/base/objs/Pipeline/unitTest.cpp b/isis/src/base/objs/Pipeline/unitTest.cpp index 6c089c9bc3..e81e1a2d92 100644 --- a/isis/src/base/objs/Pipeline/unitTest.cpp +++ b/isis/src/base/objs/Pipeline/unitTest.cpp @@ -345,8 +345,8 @@ void PipeContinue(void) //p.Application("mask").SetContinue(true); pc1.Application("mask").SetInputParameter("FROM", false); pc1.Application("mask").SetOutputParameter("TO", "mask"); - pc1.Application("mask").AddConstParameter("MINIMUM", IString(VALID_MIN4)); - pc1.Application("mask").AddConstParameter("MAXIMUM", IString(VALID_MAX4)); + pc1.Application("mask").AddConstParameter("MINIMUM", toString(VALID_MIN4)); + pc1.Application("mask").AddConstParameter("MAXIMUM", toString(VALID_MAX4)); pc1.Application("mask").AddConstParameter("PRESERVE", "INSIDE"); pc1.Application("mask").AddConstParameter("SPIXELS", "NONE"); @@ -372,8 +372,8 @@ void PipeContinue(void) pc2.Application("mask1").SetContinue(true); pc2.Application("mask1").SetInputParameter("FROM", false); pc2.Application("mask1").SetOutputParameter("TO", "mask1"); - pc2.Application("mask1").AddConstParameter("MINIMUM", IString(VALID_MIN4)); - pc2.Application("mask1").AddConstParameter("MAXIMUM", IString(VALID_MAX4)); + pc2.Application("mask1").AddConstParameter("MINIMUM", toString(VALID_MIN4)); + pc2.Application("mask1").AddConstParameter("MAXIMUM", toString(VALID_MAX4)); pc2.Application("mask1").AddConstParameter("PRESERVE", "INSIDE"); pc2.Application("mask1").AddConstParameter("SPIXELS", "NONE"); diff --git a/isis/src/base/objs/PixelType/PixelType.h b/isis/src/base/objs/PixelType/PixelType.h index f67fdca902..6ff24301ca 100644 --- a/isis/src/base/objs/PixelType/PixelType.h +++ b/isis/src/base/objs/PixelType/PixelType.h @@ -1,4 +1,4 @@ -#if !defined(PixelType_h) +#ifndef PixelType_h #define PixelType_h /** * @file @@ -22,8 +22,7 @@ * http://www.usgs.gov/privacy.html. */ -#include -#include "IString.h" +#include namespace Isis { /** @@ -80,7 +79,7 @@ namespace Isis { * * @return string Name of PixelType */ - inline std::string PixelTypeName(Isis::PixelType pixelType) { + inline QString PixelTypeName(Isis::PixelType pixelType) { if(pixelType == Isis::None) return "None"; if(pixelType == Isis::UnsignedByte) return "UnsignedByte"; if(pixelType == Isis::SignedByte) return "SignedByte"; @@ -96,16 +95,15 @@ namespace Isis { /** * Returns PixelType enumeration given a string * - * @param type IString containing the name of pixel type. Acceptable values are + * @param type QString containing the name of pixel type. Acceptable values are * UnsignedByte, SignedByte, UnsignedWord, SignedWord, * UnsignedInteger, SignedInteger, Read, and Double (not case * sensitive) * * @return Isis::PixelType */ - inline Isis::PixelType PixelTypeEnumeration(const std::string &type) { - Isis::IString temp(type); - temp = temp.UpCase(); + inline Isis::PixelType PixelTypeEnumeration(const QString &type) { + QString temp = type.toUpper(); if(temp == "UNSIGNEDBYTE" || temp == "8BIT" || temp == "8-BIT") return Isis::UnsignedByte; if(temp == "SIGNEDBYTE") return Isis::SignedByte; if(temp == "UNSIGNEDWORD") return Isis::UnsignedWord; diff --git a/isis/src/base/objs/PixelType/unitTest.cpp b/isis/src/base/objs/PixelType/unitTest.cpp index 2b3595317a..b653458dd9 100644 --- a/isis/src/base/objs/PixelType/unitTest.cpp +++ b/isis/src/base/objs/PixelType/unitTest.cpp @@ -2,38 +2,39 @@ #include "PixelType.h" #include "Preference.h" +using namespace Isis; using namespace std; int main() { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - cout << Isis::SizeOf(Isis::None) << endl; - cout << Isis::SizeOf(Isis::UnsignedByte) << endl; - cout << Isis::SizeOf(Isis::SignedByte) << endl; - cout << Isis::SizeOf(Isis::UnsignedWord) << endl; - cout << Isis::SizeOf(Isis::SignedWord) << endl; - cout << Isis::SizeOf(Isis::UnsignedInteger) << endl; - cout << Isis::SizeOf(Isis::SignedInteger) << endl; - cout << Isis::SizeOf(Isis::Real) << endl; - cout << Isis::SizeOf(Isis::Double) << endl; + cout << SizeOf(None) << endl; + cout << SizeOf(UnsignedByte) << endl; + cout << SizeOf(SignedByte) << endl; + cout << SizeOf(UnsignedWord) << endl; + cout << SizeOf(SignedWord) << endl; + cout << SizeOf(UnsignedInteger) << endl; + cout << SizeOf(SignedInteger) << endl; + cout << SizeOf(Real) << endl; + cout << SizeOf(Double) << endl; cout << endl; - cout << Isis::PixelTypeName(Isis::None) << endl; - cout << Isis::PixelTypeName(Isis::UnsignedByte) << endl; - cout << Isis::PixelTypeName(Isis::SignedByte) << endl; - cout << Isis::PixelTypeName(Isis::UnsignedWord) << endl; - cout << Isis::PixelTypeName(Isis::SignedWord) << endl; - cout << Isis::PixelTypeName(Isis::UnsignedInteger) << endl; - cout << Isis::PixelTypeName(Isis::SignedInteger) << endl; - cout << Isis::PixelTypeName(Isis::Real) << endl; - cout << Isis::PixelTypeName(Isis::Double) << endl; + cout << PixelTypeName(None) << endl; + cout << PixelTypeName(UnsignedByte) << endl; + cout << PixelTypeName(SignedByte) << endl; + cout << PixelTypeName(UnsignedWord) << endl; + cout << PixelTypeName(SignedWord) << endl; + cout << PixelTypeName(UnsignedInteger) << endl; + cout << PixelTypeName(SignedInteger) << endl; + cout << PixelTypeName(Real) << endl; + cout << PixelTypeName(Double) << endl; cout << endl; - cout << Isis::PixelTypeEnumeration("None") << endl; - cout << Isis::PixelTypeEnumeration("UnsignedByte") << endl; - cout << Isis::PixelTypeEnumeration("SignedByte") << endl; - cout << Isis::PixelTypeEnumeration("UnsignedWord") << endl; - cout << Isis::PixelTypeEnumeration("SignedWord") << endl; - cout << Isis::PixelTypeEnumeration("UnsignedInteger") << endl; - cout << Isis::PixelTypeEnumeration("SignedInteger") << endl; - cout << Isis::PixelTypeEnumeration("Real") << endl; - cout << Isis::PixelTypeEnumeration("Double") << endl; + cout << PixelTypeEnumeration("None") << endl; + cout << PixelTypeEnumeration("UnsignedByte") << endl; + cout << PixelTypeEnumeration("SignedByte") << endl; + cout << PixelTypeEnumeration("UnsignedWord") << endl; + cout << PixelTypeEnumeration("SignedWord") << endl; + cout << PixelTypeEnumeration("UnsignedInteger") << endl; + cout << PixelTypeEnumeration("SignedInteger") << endl; + cout << PixelTypeEnumeration("Real") << endl; + cout << PixelTypeEnumeration("Double") << endl; } diff --git a/isis/src/base/objs/Plugin/Plugin.cpp b/isis/src/base/objs/Plugin/Plugin.cpp index 0f9156e165..2be1f3384d 100644 --- a/isis/src/base/objs/Plugin/Plugin.cpp +++ b/isis/src/base/objs/Plugin/Plugin.cpp @@ -52,32 +52,32 @@ namespace Isis { * try to load from current working directory, * then from $ISISROOT/lib. */ - void *Plugin::GetPlugin(const std::string &group) { + void *Plugin::GetPlugin(const QString &group) { // Get the library and plugin to load PvlGroup &g = FindGroup(group); - string library = g["Library"]; + QString library = g["Library"]; - string path = "./"; + QString path = "./"; Isis::FileName libraryFile(path + library); - string pluginName = g["Routine"]; + QString pluginName = g["Routine"]; // Open the library, resolve the routine name, and return the function // address. The function will stay in memory until the application exists // so the scope of lib does not matter. - QLibrary lib(libraryFile.expanded().c_str()); + QLibrary lib(libraryFile.expanded()); bool loadedOk = lib.load(); if(!loadedOk) { path = "$ISISROOT/lib/"; libraryFile = path + library; } - lib.setFileName(libraryFile.expanded().c_str()); + lib.setFileName(libraryFile.expanded()); - void *plugin = lib.resolve(pluginName.c_str()); + void *plugin = lib.resolve(pluginName.toAscii().data()); if(plugin == 0) { - string msg = "Unable to find plugin [" + pluginName + - "] in shared library [" + lib.fileName().toStdString() + "]"; + QString msg = "Unable to find plugin [" + pluginName + + "] in shared library [" + lib.fileName() + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Plugin/Plugin.h b/isis/src/base/objs/Plugin/Plugin.h index 492337f811..48c1d6f532 100644 --- a/isis/src/base/objs/Plugin/Plugin.h +++ b/isis/src/base/objs/Plugin/Plugin.h @@ -75,7 +75,7 @@ namespace Isis { //! Destroys the Plugin object. virtual ~Plugin() {}; - void *GetPlugin(const std::string &group); + void *GetPlugin(const QString &group); }; }; diff --git a/isis/src/base/objs/PointPerspective/PointPerspective.cpp b/isis/src/base/objs/PointPerspective/PointPerspective.cpp index 31a84d1407..0d0aeac021 100644 --- a/isis/src/base/objs/PointPerspective/PointPerspective.cpp +++ b/isis/src/base/objs/PointPerspective/PointPerspective.cpp @@ -60,14 +60,14 @@ namespace Isis { // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = (m_minimumLongitude + m_maximumLongitude) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } // Compute and write the default center latitude if allowed and // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLatitude"))) { double lat = (m_minimumLatitude + m_maximumLatitude) / 2.0; - mapGroup += PvlKeyword("CenterLatitude", lat); + mapGroup += PvlKeyword("CenterLatitude", toString(lat)); } // Get the center longitude & latitude @@ -94,7 +94,7 @@ namespace Isis { } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } } @@ -125,18 +125,18 @@ namespace Isis { /** * Returns the name of the map projection, "PointPerspective" * - * @return string Name of projection, "PointPerspective" + * @return QString Name of projection, "PointPerspective" */ - string PointPerspective::Name() const { + QString PointPerspective::Name() const { return "PointPerspective"; } /** * Returns the version of the map projection * - * @return std::string Version number + * @return std::QString Version number */ - string PointPerspective::Version() const { + QString PointPerspective::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/PointPerspective/PointPerspective.h b/isis/src/base/objs/PointPerspective/PointPerspective.h index f9d1042b12..9aad46fe57 100644 --- a/isis/src/base/objs/PointPerspective/PointPerspective.h +++ b/isis/src/base/objs/PointPerspective/PointPerspective.h @@ -61,8 +61,8 @@ namespace Isis { ~PointPerspective(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; double TrueScaleLatitude() const; bool SetGround(const double lat, const double lon); diff --git a/isis/src/base/objs/PointPerspective/unitTest.cpp b/isis/src/base/objs/PointPerspective/unitTest.cpp index dd2f4cf18a..48852694fd 100644 --- a/isis/src/base/objs/PointPerspective/unitTest.cpp +++ b/isis/src/base/objs/PointPerspective/unitTest.cpp @@ -5,62 +5,64 @@ #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "UNIT TEST FOR PointPerspective" << endl << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 6371000.); - mapGroup += Isis::PvlKeyword("PolarRadius", 6371000.); - mapGroup += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 180); - mapGroup += Isis::PvlKeyword("MinimumLatitude", -90.0); - mapGroup += Isis::PvlKeyword("MaximumLatitude", 90.0); - mapGroup += Isis::PvlKeyword("MinimumLongitude", -180.0); - mapGroup += Isis::PvlKeyword("MaximumLongitude", 180.0); - mapGroup += Isis::PvlKeyword("ProjectionName", "PointPerspective"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup = lab.FindGroup("Mapping"); + mapGroup += PvlKeyword("EquatorialRadius", toString(6371000.)); + mapGroup += PvlKeyword("PolarRadius", toString(6371000.)); + mapGroup += PvlKeyword("LatitudeType", "Planetographic"); + mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup += PvlKeyword("LongitudeDomain", toString(180)); + mapGroup += PvlKeyword("MinimumLatitude", toString(-90.0)); + mapGroup += PvlKeyword("MaximumLatitude", toString(90.0)); + mapGroup += PvlKeyword("MinimumLongitude", toString(-180.0)); + mapGroup += PvlKeyword("MaximumLongitude", toString(180.0)); + mapGroup += PvlKeyword("ProjectionName", "PointPerspective"); cout << "Test missing center longitude keyword ..." << endl; try { - Isis::PointPerspective p(lab); + PointPerspective p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLongitude", -77.0); + mapGroup += PvlKeyword("CenterLongitude", toString(-77.0)); cout << "Test missing center latitude keyword..." << endl; try { - Isis::PointPerspective p(lab); + PointPerspective p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLatitude", 39.0); + mapGroup += PvlKeyword("CenterLatitude", toString(39.0)); cout << "Test missing distance keyword..." << endl; try { - Isis::PointPerspective p(lab); + PointPerspective p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("Distance", 500000.0); + mapGroup += PvlKeyword("Distance", toString(500000.0)); try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); - // Isis::PointPerspective p(lab); + Projection &p = *ProjectionFactory::Create(lab); + // PointPerspective p(lab); cout << "Test TrueScaleLatitude method... " << endl; cout << "TrueScaleLatitude = " << p.TrueScaleLatitude() << endl; @@ -95,7 +97,7 @@ int main(int argc, char *argv[]) { cout << "Maximum Y: " << maxY << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; @@ -104,15 +106,15 @@ int main(int argc, char *argv[]) { cout << "Test default computation ... " << endl; mapGroup.DeleteKeyword("CenterLongitude"); mapGroup.DeleteKeyword("CenterLatitude"); - Isis::PointPerspective p2(lab, true); + PointPerspective p2(lab, true); cout << lab << endl; cout << endl; cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -130,7 +132,7 @@ int main(int argc, char *argv[]) { cout << " USGS Professional Paper 1395 by John P. Snyder" << endl; cout << " Pages 320-321" << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/PolarStereographic/PolarStereographic.cpp b/isis/src/base/objs/PolarStereographic/PolarStereographic.cpp index 3b8ed8a4fb..1ba33d9569 100644 --- a/isis/src/base/objs/PolarStereographic/PolarStereographic.cpp +++ b/isis/src/base/objs/PolarStereographic/PolarStereographic.cpp @@ -65,7 +65,7 @@ namespace Isis { // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = (m_minimumLongitude + m_maximumLongitude) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } // Compute and write the default center latitude if allowed and @@ -73,10 +73,10 @@ namespace Isis { if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLatitude"))) { double lat = (m_minimumLatitude + m_maximumLatitude) / 2.0; if (lat > 0.0) { - mapGroup += PvlKeyword("CenterLatitude", 90.0); + mapGroup += PvlKeyword("CenterLatitude", toString(90.0)); } else { - mapGroup += PvlKeyword("CenterLatitude", -90.0); + mapGroup += PvlKeyword("CenterLatitude", toString(-90.0)); } } @@ -90,7 +90,7 @@ namespace Isis { // radians. m_centerLatitude = mapGroup["CenterLatitude"]; if (m_centerLatitude == 0) { - string msg = "Invalid value for keyword [CenterLatitude] in map file."; + QString msg = "Invalid value for keyword [CenterLatitude] in map file."; msg += " CenterLatitude cannot equal 0.0"; throw IException(IException::User, msg, _FILEINFO_); } @@ -120,7 +120,7 @@ namespace Isis { } } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Unknown, message, _FILEINFO_); } } @@ -153,9 +153,9 @@ namespace Isis { /** * Returns the name of the map projection, "PolarStereographic" * - * @return string Name of projection, "PolarStereographic" + * @return QString Name of projection, "PolarStereographic" */ - string PolarStereographic::Name() const { + QString PolarStereographic::Name() const { return "PolarStereographic"; } @@ -164,9 +164,9 @@ namespace Isis { * Returns the version of the map projection * * - * @return string Version number + * @return QString Version number */ - string PolarStereographic::Version() const { + QString PolarStereographic::Version() const { return "1.0"; } @@ -271,7 +271,7 @@ namespace Isis { m_latitude = m_signFactor * phi; if (fabs(m_latitude) > HALFPI) { - string msg = "X,Y causes latitude to be outside [-90,90] " + QString msg = "X,Y causes latitude to be outside [-90,90] " "in PolarStereographic Class"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/PolarStereographic/PolarStereographic.h b/isis/src/base/objs/PolarStereographic/PolarStereographic.h index b43a88b02f..6943637508 100644 --- a/isis/src/base/objs/PolarStereographic/PolarStereographic.h +++ b/isis/src/base/objs/PolarStereographic/PolarStereographic.h @@ -81,8 +81,8 @@ namespace Isis { ~PolarStereographic(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; double TrueScaleLatitude() const; bool SetGround(const double lat, const double lon); diff --git a/isis/src/base/objs/PolarStereographic/unitTest.cpp b/isis/src/base/objs/PolarStereographic/unitTest.cpp index 45bdc1728b..706a1b7040 100644 --- a/isis/src/base/objs/PolarStereographic/unitTest.cpp +++ b/isis/src/base/objs/PolarStereographic/unitTest.cpp @@ -5,60 +5,62 @@ #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "Unit Test For PolarStereographic" << endl << endl; cout << std::setprecision(14); - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mg = lab.FindGroup("Mapping"); - mg += Isis::PvlKeyword("EquatorialRadius", 6378388.0); - mg += Isis::PvlKeyword("PolarRadius", 6356911.9); - mg += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mg += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mg += Isis::PvlKeyword("LongitudeDomain", 180); - mg += Isis::PvlKeyword("MinimumLatitude", -90.0); - mg += Isis::PvlKeyword("MaximumLatitude", 0.0); - mg += Isis::PvlKeyword("MinimumLongitude", -180.0); - mg += Isis::PvlKeyword("MaximumLongitude", 180.0); - mg += Isis::PvlKeyword("ProjectionName", "PolarStereographic"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mg = lab.FindGroup("Mapping"); + mg += PvlKeyword("EquatorialRadius", toString(6378388.0)); + mg += PvlKeyword("PolarRadius", toString(6356911.9)); + mg += PvlKeyword("LatitudeType", "Planetographic"); + mg += PvlKeyword("LongitudeDirection", "PositiveEast"); + mg += PvlKeyword("LongitudeDomain", toString(180)); + mg += PvlKeyword("MinimumLatitude", toString(-90.0)); + mg += PvlKeyword("MaximumLatitude", toString(0.0)); + mg += PvlKeyword("MinimumLongitude", toString(-180.0)); + mg += PvlKeyword("MaximumLongitude", toString(180.0)); + mg += PvlKeyword("ProjectionName", "PolarStereographic"); cout << "Test missing center longitude keyword ..." << endl; try { - Isis::PolarStereographic p(lab); + PolarStereographic p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mg += Isis::PvlKeyword("CenterLongitude", -100.0); + mg += PvlKeyword("CenterLongitude", toString(-100.0)); cout << "Test missing center latitude keyword ..." << endl; try { - Isis::PolarStereographic p(lab); + PolarStereographic p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; cout << "Test invalid center latitude keyword ..." << endl; - mg += Isis::PvlKeyword("CenterLatitude", 0.0); + mg += PvlKeyword("CenterLatitude", toString(0.0)); try { - Isis::PolarStereographic p(lab); + PolarStereographic p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mg.AddKeyword(Isis::PvlKeyword("CenterLatitude", -71.0), Isis::PvlGroup::Replace); + mg.AddKeyword(PvlKeyword("CenterLatitude", toString(-71.0)), PvlGroup::Replace); try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); - // Isis::PolarStereographic p(lab); + Projection &p = *ProjectionFactory::Create(lab); + // PolarStereographic p(lab); cout << "Test SetGround method ... " << endl; cout << "Setting ground to (-75,150)" << endl; @@ -109,7 +111,7 @@ int main(int argc, char *argv[]) { cout << "TrueScaleLatitude = " << p.TrueScaleLatitude() << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; @@ -118,15 +120,15 @@ int main(int argc, char *argv[]) { cout << "Test default computation ... " << endl; mg.DeleteKeyword("CenterLongitude"); mg.DeleteKeyword("CenterLatitude"); - Isis::PolarStereographic p2(lab, true); + PolarStereographic p2(lab, true); cout << lab << endl; cout << endl; cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -144,7 +146,7 @@ int main(int argc, char *argv[]) { cout << " USGS Professional Paper 1395 by John P. Snyder" << endl; cout << " Pages 315-319" << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/PolygonSeeder/PolygonSeeder.cpp b/isis/src/base/objs/PolygonSeeder/PolygonSeeder.cpp index c274fcdf9b..4130ec231b 100644 --- a/isis/src/base/objs/PolygonSeeder/PolygonSeeder.cpp +++ b/isis/src/base/objs/PolygonSeeder/PolygonSeeder.cpp @@ -78,7 +78,7 @@ namespace Isis { **/ void PolygonSeeder::Parse(Pvl &pvl) { - std::string errorSpot; + QString errorSpot; try { // Get info from Algorithm group @@ -91,7 +91,7 @@ namespace Isis { // Set the algorithm name errorSpot = "Name"; - p_algorithmName = (std::string) algo["Name"]; + p_algorithmName = (QString) algo["Name"]; if(invalgo.HasKeyword("Name")) invalgo.DeleteKeyword("Name"); @@ -117,7 +117,7 @@ namespace Isis { invalgo.DeleteKeyword("MinimumArea"); } catch(IException &e) { - std::string msg = "Improper format for PolygonSeeder PVL ["; + QString msg = "Improper format for PolygonSeeder PVL ["; msg += pvl.FileName() + "]. Location [" + errorSpot + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -133,15 +133,15 @@ namespace Isis { * of lon/lat * @param xyBoundBox The bounding box of the multipoly * - * @return std::string A string with an appropriate message to throw if + * @return QString A string with an appropriate message to throw if * a test was unsuccessful or an empty string if all tests * passed. */ - std::string PolygonSeeder::StandardTests(const geos::geom::MultiPolygon *xymp, + QString PolygonSeeder::StandardTests(const geos::geom::MultiPolygon *xymp, const geos::geom::Envelope *xyBoundBox) { if(xymp->getArea() < MinimumArea()) { - std::string msg = "Polygon did not meet the minimum area of ["; - msg += Isis::IString(MinimumArea()) + "]"; + QString msg = "Polygon did not meet the minimum area of ["; + msg += toString(MinimumArea()) + "]"; return msg; } @@ -149,8 +149,8 @@ namespace Isis { xymp->getArea() / pow(std::max(xyBoundBox->getWidth(), xyBoundBox->getHeight()), 2.0); if(thickness < MinimumThickness()) { - std::string msg = "Polygon did not meet the minimum thickness ratio of ["; - msg += Isis::IString(MinimumThickness()) + "]"; + QString msg = "Polygon did not meet the minimum thickness ratio of ["; + msg += toString(MinimumThickness()) + "]"; return msg; } @@ -161,9 +161,9 @@ namespace Isis { * The name of the algorithm, read from the Name Keyword in the * PolygonSeeder Pvl passed into the constructor. * - * @return @b std::string The value of the Name Keyword in the Pvl. + * @return @b QString The value of the Name Keyword in the Pvl. */ - std::string PolygonSeeder::Algorithm() const { + QString PolygonSeeder::Algorithm() const { return p_algorithmName; } @@ -201,12 +201,12 @@ namespace Isis { * @return @b PvlGroup The PvlGroup with the appropriate parameters added. * */ - PvlGroup PolygonSeeder::PluginParameters(std::string grpName) { + PvlGroup PolygonSeeder::PluginParameters(QString grpName) { PvlGroup pluginInfo(grpName); PvlKeyword name("Name", p_algorithmName); - PvlKeyword minThickness("MinimumThickness", p_minimumThickness); - PvlKeyword minArea("MinimumArea", p_minimumArea); + PvlKeyword minThickness("MinimumThickness", toString(p_minimumThickness)); + PvlKeyword minArea("MinimumArea", toString(p_minimumArea)); pluginInfo.AddKeyword(name); pluginInfo.AddKeyword(minThickness); diff --git a/isis/src/base/objs/PolygonSeeder/PolygonSeeder.h b/isis/src/base/objs/PolygonSeeder/PolygonSeeder.h index f62a8919ac..7b9ff71cd7 100644 --- a/isis/src/base/objs/PolygonSeeder/PolygonSeeder.h +++ b/isis/src/base/objs/PolygonSeeder/PolygonSeeder.h @@ -77,16 +77,16 @@ namespace Isis { double MinimumThickness(); double MinimumArea(); - std::string Algorithm() const; + QString Algorithm() const; - virtual PvlGroup PluginParameters(std::string grpName); + virtual PvlGroup PluginParameters(QString grpName); Pvl InvalidInput(); const PolygonSeeder &operator=(const PolygonSeeder &other); protected: virtual void Parse(Pvl &pvl); - std::string StandardTests(const geos::geom::MultiPolygon *multiPoly, + QString StandardTests(const geos::geom::MultiPolygon *multiPoly, const geos::geom::Envelope *polyBoundBox); protected: @@ -94,7 +94,7 @@ namespace Isis { was used.*/ private: - std::string p_algorithmName; /**< The value for the 'Name' Keyword in the + QString p_algorithmName; /**< The value for the 'Name' Keyword in the PolygonSeederAlgorithm group of the Pvl that is passed into the constructor.*/ double p_minimumThickness; /**< The value for the 'MinimumThickness' diff --git a/isis/src/base/objs/PolygonSeeder/unitTest.cpp b/isis/src/base/objs/PolygonSeeder/unitTest.cpp index 53e1d249ac..b563fb13ae 100644 --- a/isis/src/base/objs/PolygonSeeder/unitTest.cpp +++ b/isis/src/base/objs/PolygonSeeder/unitTest.cpp @@ -17,10 +17,10 @@ int main() { try { PvlGroup alg("PolygonSeederAlgorithm"); alg += PvlKeyword("Name", "Grid"); - alg += PvlKeyword("MinimumThickness", 0.5); - alg += PvlKeyword("MinimumArea", 10); - alg += PvlKeyword("XSpacing", 11); - alg += PvlKeyword("YSpacing", 11); + alg += PvlKeyword("MinimumThickness", "0.5"); + alg += PvlKeyword("MinimumArea", "10"); + alg += PvlKeyword("XSpacing", "11"); + alg += PvlKeyword("YSpacing", "11"); PvlObject o("AutoSeed"); o.AddGroup(alg); diff --git a/isis/src/base/objs/PolygonSeederFactory/PolygonSeederFactory.cpp b/isis/src/base/objs/PolygonSeederFactory/PolygonSeederFactory.cpp index 1f09b92c1e..fa16b9a1eb 100644 --- a/isis/src/base/objs/PolygonSeederFactory/PolygonSeederFactory.cpp +++ b/isis/src/base/objs/PolygonSeederFactory/PolygonSeederFactory.cpp @@ -52,7 +52,7 @@ namespace Isis { PolygonSeeder *PolygonSeederFactory::Create(Pvl &pvl) { // Get the algorithm name to create PvlGroup &algo = pvl.FindGroup("PolygonSeederAlgorithm", Pvl::Traverse); - std::string algorithm = algo["Name"]; + QString algorithm = algo["Name"]; // Open the factory plugin file Plugin p; diff --git a/isis/src/base/objs/PolygonSeederFactory/PolygonSeederFactory.h b/isis/src/base/objs/PolygonSeederFactory/PolygonSeederFactory.h index 731b28bdd2..576a7d89e2 100644 --- a/isis/src/base/objs/PolygonSeederFactory/PolygonSeederFactory.h +++ b/isis/src/base/objs/PolygonSeederFactory/PolygonSeederFactory.h @@ -1,4 +1,4 @@ -#if !defined(PolygonSeederFactory_h) +#ifndef PolygonSeederFactory_h #define PolygonSeederFactory_h /** * @file diff --git a/isis/src/base/objs/PolygonTools/PolygonTools.cpp b/isis/src/base/objs/PolygonTools/PolygonTools.cpp index 762b3d613c..3db0b84662 100644 --- a/isis/src/base/objs/PolygonTools/PolygonTools.cpp +++ b/isis/src/base/objs/PolygonTools/PolygonTools.cpp @@ -392,7 +392,7 @@ namespace Isis { * lon,lat format vertices and GML header */ - string PolygonTools::ToGML(const geos::geom::MultiPolygon *mpolygon, std::string idString) { + QString PolygonTools::ToGML(const geos::geom::MultiPolygon *mpolygon, QString idString) { ostringstream os; @@ -432,7 +432,7 @@ namespace Isis { os << "" << endl; os << "" << endl; - return os.str(); + return os.str().c_str(); } @@ -1704,9 +1704,9 @@ namespace Isis { * * @param geom The geometry to test which type it really is * - * @return std::string + * @return QString */ - std::string PolygonTools::GetGeometryName(const geos::geom::Geometry *geom) { + QString PolygonTools::GetGeometryName(const geos::geom::Geometry *geom) { switch(geom->getGeometryTypeId()) { case geos::geom::GEOS_POINT: return "Point"; diff --git a/isis/src/base/objs/PolygonTools/PolygonTools.h b/isis/src/base/objs/PolygonTools/PolygonTools.h index b0bc41f8d5..589f93f6fd 100644 --- a/isis/src/base/objs/PolygonTools/PolygonTools.h +++ b/isis/src/base/objs/PolygonTools/PolygonTools.h @@ -22,9 +22,11 @@ * http://www.usgs.gov/privacy.html. */ -#include "geos/geom/GeometryFactory.h" -#include "geos/geom/MultiPolygon.h" -#include "geos/geom/CoordinateSequence.h" +#include +#include +#include + +#include namespace Isis { @@ -150,7 +152,7 @@ namespace Isis { static geos::geom::MultiPolygon *To180(geos::geom::MultiPolygon *poly360); //Return a polygon in GML format - static std::string ToGML(const geos::geom::MultiPolygon *mpolygon, std::string idString = "0"); + static QString ToGML(const geos::geom::MultiPolygon *mpolygon, QString idString = QString("0")); //Return the thickness of a polygon static double Thickness(const geos::geom::MultiPolygon *mpolygon); @@ -160,7 +162,7 @@ namespace Isis { static geos::geom::MultiPolygon *MakeMultiPolygon(const geos::geom::Geometry *geom); - static std::string GetGeometryName(const geos::geom::Geometry *geom); + static QString GetGeometryName(const geos::geom::Geometry *geom); static bool Equal(const geos::geom::MultiPolygon *poly1, const geos::geom::MultiPolygon *poly2); static bool Equal(const geos::geom::Polygon *poly1, const geos::geom::Polygon *poly2); diff --git a/isis/src/base/objs/PolygonTools/unitTest.cpp b/isis/src/base/objs/PolygonTools/unitTest.cpp index fbd6e9347d..e5c834c682 100644 --- a/isis/src/base/objs/PolygonTools/unitTest.cpp +++ b/isis/src/base/objs/PolygonTools/unitTest.cpp @@ -69,13 +69,13 @@ int main() { Isis::Pvl lab; lab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 1.0); - mapGroup += Isis::PvlKeyword("PolarRadius", 1.0); + mapGroup += Isis::PvlKeyword("EquatorialRadius", "1.0"); + mapGroup += Isis::PvlKeyword("PolarRadius", "1.0"); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", "360"); + mapGroup += Isis::PvlKeyword("CenterLatitude", "0"); + mapGroup += Isis::PvlKeyword("CenterLongitude", "0"); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); Projection *proj = ProjectionFactory::Create(lab); @@ -90,9 +90,9 @@ int main() { // Change the radius and set a new projection // Then get the XYPolygon again mapGroup.DeleteKeyword("EquatorialRadius"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 10.0); + mapGroup += Isis::PvlKeyword("EquatorialRadius", "10.0"); mapGroup.DeleteKeyword("PolarRadius"); - mapGroup += Isis::PvlKeyword("PolarRadius", 10.0); + mapGroup += Isis::PvlKeyword("PolarRadius", "10.0"); proj = ProjectionFactory::Create(lab); cout << "X/Y polygon radius (10) = " @@ -150,7 +150,7 @@ int main() { cout << endl; cout << "GML Ploygon:" << endl; - std::string GMLpolygon = PolygonTools::ToGML(mPolygon, "test"); + QString GMLpolygon = PolygonTools::ToGML(mPolygon, "test"); cout << GMLpolygon << endl; cout << "GML Thickness:" << endl; diff --git a/isis/src/base/objs/PolynomialBivariate/unitTest.cpp b/isis/src/base/objs/PolynomialBivariate/unitTest.cpp index f748865102..60bae80bd5 100644 --- a/isis/src/base/objs/PolynomialBivariate/unitTest.cpp +++ b/isis/src/base/objs/PolynomialBivariate/unitTest.cpp @@ -2,12 +2,13 @@ #include #include "Preference.h" +using namespace Isis; using namespace std; int main() { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::PolynomialBivariate b(1); + PolynomialBivariate b(1); vector coefs; coefs.push_back(0.5); coefs.push_back(0.5); @@ -40,7 +41,7 @@ int main() { // Test 2nd order // 0.5 + 0.5*v1 + 0.5*v2 + 1.0*v1*v1 + 1.0*v1*v2 + 1.0*v2*v2 - Isis::PolynomialBivariate c(2); + PolynomialBivariate c(2); cout << "---- 2nd order ----" << endl; cout << "Name = " << c.Name() << endl; cout << "Ncoefs = " << c.Coefficients() << endl; diff --git a/isis/src/base/objs/PolynomialUnivariate/unitTest.cpp b/isis/src/base/objs/PolynomialUnivariate/unitTest.cpp index 055683e54e..bef988391f 100644 --- a/isis/src/base/objs/PolynomialUnivariate/unitTest.cpp +++ b/isis/src/base/objs/PolynomialUnivariate/unitTest.cpp @@ -1,10 +1,13 @@ #include "PolynomialUnivariate.h" #include +#include "IString.h" + +using namespace Isis; using namespace std; int main() { - Isis::PolynomialUnivariate b(1); + PolynomialUnivariate b(1); vector coefs; coefs.push_back(0.5); coefs.push_back(0.5); @@ -35,7 +38,7 @@ int main() { // Test 2nd order // 0.5 + 0.5*v1 + 1.0*v1*v1 - Isis::PolynomialUnivariate c(2); + PolynomialUnivariate c(2); cout << "---- 2nd order ----" << endl; cout << "Name = " << c.Name() << endl; cout << "Ncoefs = " << c.Coefficients() << endl; diff --git a/isis/src/base/objs/Portal/Portal.h b/isis/src/base/objs/Portal/Portal.h index 0fe416b672..8039baedac 100644 --- a/isis/src/base/objs/Portal/Portal.h +++ b/isis/src/base/objs/Portal/Portal.h @@ -1,4 +1,4 @@ -#if !defined(Portal_h) +#ifndef Portal_h #define Portal_h /** * @file diff --git a/isis/src/base/objs/Portal/unitTest.cpp b/isis/src/base/objs/Portal/unitTest.cpp index 60d39b6a43..281154d1f1 100644 --- a/isis/src/base/objs/Portal/unitTest.cpp +++ b/isis/src/base/objs/Portal/unitTest.cpp @@ -11,7 +11,7 @@ using namespace std; int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); - string fname = "$base/testData/isisTruth.cub"; + QString fname = "$base/testData/isisTruth.cub"; // Allocate a cube Isis::Cube *cube = new Isis::Cube; diff --git a/isis/src/base/objs/Preference/Preference.cpp b/isis/src/base/objs/Preference/Preference.cpp index 235f6d8a5c..5d42c675fb 100644 --- a/isis/src/base/objs/Preference/Preference.cpp +++ b/isis/src/base/objs/Preference/Preference.cpp @@ -41,7 +41,7 @@ namespace Isis { atexit(Shutdown); } - void Preference::Load(const std::string &file) { + void Preference::Load(const QString &file) { // Read the input PVL preference file Isis::Pvl pvl; diff --git a/isis/src/base/objs/Preference/Preference.h b/isis/src/base/objs/Preference/Preference.h index 2062f6b070..5ef88c71ab 100644 --- a/isis/src/base/objs/Preference/Preference.h +++ b/isis/src/base/objs/Preference/Preference.h @@ -71,7 +71,7 @@ namespace Isis { class Preference : public Pvl { public: - void Load(const std::string &file); + void Load(const QString &file); /** * Tests whether or not a file is a unitTest diff --git a/isis/src/base/objs/Preference/unitTest.cpp b/isis/src/base/objs/Preference/unitTest.cpp index a305fbee69..42b8600907 100644 --- a/isis/src/base/objs/Preference/unitTest.cpp +++ b/isis/src/base/objs/Preference/unitTest.cpp @@ -3,10 +3,10 @@ #include "Preference.h" #include "IException.h" +using namespace Isis; using namespace std; -int main() -{ +int main() { try { // Note: Normally a call to Preferences in a unitTest would be called // with a true. In this case however, we can't have the Preferences @@ -46,7 +46,7 @@ int main() // if (p2.HasGroup("Junk")) { if(Isis::Preference::Preferences(false).HasGroup("Junk")) { Isis::PvlGroup &g = Isis::Preference::Preferences(false).FindGroup("Junk"); - cout << "Value of Vegetable is : " << (string) g["Vegetable"] << endl; + cout << "Value of Vegetable is : " << (QString) g["Vegetable"] << endl; } remove("tmpSystem"); diff --git a/isis/src/base/objs/Process/Process.cpp b/isis/src/base/objs/Process/Process.cpp index 6a7e1b153b..5592771493 100644 --- a/isis/src/base/objs/Process/Process.cpp +++ b/isis/src/base/objs/Process/Process.cpp @@ -79,12 +79,12 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *Process::SetInputCube(const std::string &fname, + Isis::Cube *Process::SetInputCube(const QString &fname, const Isis::CubeAttributeInput &att, int requirements) { Isis::Cube *cube = new Isis::Cube; if(att.bands().size() != 0) { - vector lame = att.bands(); + vector lame = att.bands(); cube->setVirtualBands(lame); } @@ -106,7 +106,7 @@ namespace Isis { if(InputCubes.size() > 0) { if(cube->getLineCount() != 1) { if(cube->getLineCount() != InputCubes[0]->getLineCount()) { - string message = "The number of lines in the secondary input cubes must match"; + QString message = "The number of lines in the secondary input cubes must match"; message += " the primary input cube or be exactly one"; throw IException(IException::User, message, _FILEINFO_); } @@ -114,14 +114,14 @@ namespace Isis { if(cube->getSampleCount() != 1) { if(cube->getSampleCount() != InputCubes[0]->getSampleCount()) { - string message = "The number of samples in the secondary input cubes must match"; + QString message = "The number of samples in the secondary input cubes must match"; message += " the primary input cube or be exactly one"; throw IException(IException::User, message, _FILEINFO_); } } if(cube->getBandCount() != 1) { if(cube->getBandCount() != InputCubes[0]->getBandCount()) { - string message = "The number of bands in the secondary input cubes must match"; + QString message = "The number of bands in the secondary input cubes must match"; message += " the primary input cube or be exactly one"; throw IException(IException::User, message, _FILEINFO_); } @@ -136,15 +136,15 @@ namespace Isis { if(requirements & Isis::SizeMatch) { if(InputCubes.size() > 0) { if(cube->getLineCount() != InputCubes[0]->getLineCount()) { - string message = "The number of lines in the input cubes must match"; + QString message = "The number of lines in the input cubes must match"; throw IException(IException::User, message, _FILEINFO_); } if(cube->getSampleCount() != InputCubes[0]->getSampleCount()) { - string message = "The number of samples in the input cubes must match"; + QString message = "The number of samples in the input cubes must match"; throw IException(IException::User, message, _FILEINFO_); } if(cube->getBandCount() != InputCubes[0]->getBandCount()) { - string message = "The number of bands in the input cubes must match"; + QString message = "The number of bands in the input cubes must match"; throw IException(IException::User, message, _FILEINFO_); } } @@ -154,11 +154,11 @@ namespace Isis { if(requirements & Isis::SpatialMatch) { if(InputCubes.size() > 0) { if(cube->getLineCount() != InputCubes[0]->getLineCount()) { - string message = "The number of lines in the input cubes must match"; + QString message = "The number of lines in the input cubes must match"; throw IException(IException::User, message, _FILEINFO_); } if(cube->getSampleCount() != InputCubes[0]->getSampleCount()) { - string message = "The number of samples in the input cubes must match"; + QString message = "The number of samples in the input cubes must match"; throw IException(IException::User, message, _FILEINFO_); } } @@ -167,7 +167,7 @@ namespace Isis { // Test for one band if(requirements & Isis::OneBand) { if(cube->getBandCount() != 1) { - string message = "Input cube [" + fname + "] must have one band"; + QString message = "Input cube [" + fname + "] must have one band"; throw IException(IException::User, message, _FILEINFO_); } } @@ -177,7 +177,7 @@ namespace Isis { if(cube->getBandCount() != 1) { if(InputCubes.size() > 0) { if(cube->getBandCount() != InputCubes[0]->getBandCount()) { - string message = "The number of bands in the secondary input cubes must match"; + QString message = "The number of bands in the secondary input cubes must match"; message += " the primary input cube or be exactly one"; throw IException(IException::User, message, _FILEINFO_); } @@ -204,7 +204,7 @@ namespace Isis { AddInputCube(inCube, false); } else { - string message = "Input cube does not exist"; + QString message = "Input cube does not exist"; throw IException(IException::User, message, _FILEINFO_); } } @@ -240,9 +240,9 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *Process::SetInputCube(const std::string ¶meter, + Isis::Cube *Process::SetInputCube(const QString ¶meter, const int requirements) { - string fname = Application::GetUserInterface().GetFileName(parameter); + QString fname = Application::GetUserInterface().GetFileName(parameter); Isis::CubeAttributeInput &att = Application::GetUserInterface().GetInputAttribute(parameter); return SetInputCube(fname, att, requirements); } @@ -263,10 +263,10 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *Process::SetOutputCube(const std::string ¶meter) { + Isis::Cube *Process::SetOutputCube(const QString ¶meter) { // Make sure we have an input cube to get a default size from if(InputCubes.size() == 0) { - string message = "No input images have been selected ... therefore"; + QString message = "No input images have been selected ... therefore"; message += "the output image size can not be determined"; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -299,17 +299,17 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *Process::SetOutputCube(const std::string ¶meter, const int ns, + Isis::Cube *Process::SetOutputCube(const QString ¶meter, const int ns, const int nl, const int nb) { // Make sure we have good dimensions if((ns <= 0) || (nl <= 0) || (nb <= 0)) { ostringstream message; message << "Invalid cube size specifications [ns=" << ns << ",nl=" << nl << ",nb=" << nb << "]"; - throw IException(IException::Programmer, message.str(), _FILEINFO_); + throw IException(IException::Programmer, message.str().c_str(), _FILEINFO_); } - string fname = Application::GetUserInterface().GetFileName(parameter); + QString fname = Application::GetUserInterface().GetFileName(parameter); Isis::CubeAttributeOutput &atts = Application::GetUserInterface().GetOutputAttribute(parameter); return SetOutputCube(fname, atts, ns, nl, nb); } @@ -331,7 +331,7 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *Process::SetOutputCube(const std::string &fname, + Isis::Cube *Process::SetOutputCube(const QString &fname, const Isis::CubeAttributeOutput &att, const int ns, const int nl, const int nb) { @@ -340,7 +340,7 @@ namespace Isis { ostringstream message; message << "Invalid cube size specifications [ns=" << ns << ",nl=" << nl << ",nb=" << nb << "]"; - throw IException(IException::Programmer, message.str(), _FILEINFO_); + throw IException(IException::Programmer, message.str().c_str(), _FILEINFO_); } // Setup the cube @@ -356,7 +356,7 @@ namespace Isis { cube->setPixelType(InputCubes[0]->getPixelType()); } else { - string msg = "You told me to propagate PixelType from input to output"; + QString msg = "You told me to propagate PixelType from input to output"; msg += " cube but there are no input cubes loaded"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -370,7 +370,7 @@ namespace Isis { cube->setBaseMultiplier(0.0, 1.0); } else if(InputCubes.size() == 0) { - string msg = "You told me to propagate base/multiplier from input to output"; + QString msg = "You told me to propagate base/multiplier from input to output"; msg += " cube but there are no input cubes loaded"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -382,12 +382,12 @@ namespace Isis { else if((cube->getPixelType() != Isis::Real) && (cube->getPixelType() != Isis::UnsignedByte) && (cube->getPixelType() != Isis::SignedWord)) { - string msg = "Looks like your refactoring to add different pixel types"; + QString msg = "Looks like your refactoring to add different pixel types"; msg += " you'll need to make changes here"; throw IException(IException::Programmer, msg, _FILEINFO_); } else { - string msg = "You've chosen to reduce your output PixelType for [" + + QString msg = "You've chosen to reduce your output PixelType for [" + fname + "] you must specify the output pixel range too"; throw IException(IException::User, msg, _FILEINFO_); } @@ -427,7 +427,7 @@ namespace Isis { Isis::Pvl &inlab = *InputCubes[0]->getLabel(); for(int i = 0; i < inlab.Objects(); i++) { if(inlab.Object(i).IsNamed("Table")) { - Isis::Blob t((string)inlab.Object(i)["Name"], inlab.Object(i).Name()); + Isis::Blob t((QString)inlab.Object(i)["Name"], inlab.Object(i).Name()); InputCubes[0]->read(t); cube->write(t); } @@ -439,7 +439,7 @@ namespace Isis { Isis::Pvl &inlab = *InputCubes[0]->getLabel(); for(int i = 0; i < inlab.Objects(); i++) { if(inlab.Object(i).IsNamed("Polygon")) { - Isis::Blob t((string)inlab.Object(i)["Name"], inlab.Object(i).Name()); + Isis::Blob t((QString)inlab.Object(i)["Name"], inlab.Object(i).Name()); InputCubes[0]->read(t); cube->write(t); } @@ -560,7 +560,7 @@ namespace Isis { * @param cube IString containing the name of the cube containing the labels * to propagate. */ - void Process::PropagateLabels(const std::string &cube) { + void Process::PropagateLabels(const QString &cube) { // Open the Pvl file Isis::Pvl inLabels(cube); @@ -597,7 +597,7 @@ namespace Isis { * cube. This is done at the time this method is called, not during normal * processing. */ - void Process::PropagateTables(const std::string &fromName) { + void Process::PropagateTables(const QString &fromName) { Cube *fromCube = new Isis::Cube; fromCube->open(fromName); const Pvl *fromLabels = fromCube->getLabel(); @@ -607,7 +607,7 @@ namespace Isis { const PvlObject &object = fromLabels->Object(j); if (object.IsNamed("Table")) { - Blob table((string) object["Name"], object.Name()); + Blob table((QString) object["Name"], object.Name()); fromCube->read(table); OutputCubes[i]->write(table); } @@ -663,15 +663,15 @@ namespace Isis { * FileName class for more information on versioned * files. Defaults to false. */ - string Process::MissionData(const std::string &mission, const std::string &file, + QString Process::MissionData(const QString &mission, const QString &file, bool highestVersion) { Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); - string dir = dataDir[mission]; + QString dir = dataDir[mission]; // See if the data directory is installed Isis::FileName installed(dir); if(!installed.fileExists()) { - string message = "Data directory for mission [" + mission + "] " + + QString message = "Data directory for mission [" + mission + "] " + "is not installed at your site"; throw IException(IException::Io, message, _FILEINFO_); } @@ -691,7 +691,7 @@ namespace Isis { Isis::Pvl & inlab = *InputCubes[0]->getLabel(); for(int i = 0; i < inlab.Objects(); i++) { if(inlab.Object(i).IsNamed("History") && Isis::iApp != NULL) { - Isis::History h((string)inlab.Object(i)["Name"]); + Isis::History h((QString)inlab.Object(i)["Name"]); InputCubes[0]->read(h); h.AddEntry(); cube.write(h); @@ -730,9 +730,9 @@ namespace Isis { int bandStop = cube->getBandCount(); int maxSteps = cube->getLineCount() * cube->getBandCount(); - IString cubeNumStr((int)cubeNum + 1); - IString totalCubes((int)InputCubes.size()); - string msg = "Calculating statistics for cube " + cubeNumStr + " of " + totalCubes; + QString cubeNumStr = toString(cubeNum + 1); + QString totalCubes = toString((int)InputCubes.size()); + QString msg = "Calculating statistics for cube " + cubeNumStr + " of " + totalCubes; Isis::Progress progress; progress.SetText(msg); diff --git a/isis/src/base/objs/Process/Process.h b/isis/src/base/objs/Process/Process.h index f3e913b64d..0ef5a4f145 100644 --- a/isis/src/base/objs/Process/Process.h +++ b/isis/src/base/objs/Process/Process.h @@ -77,7 +77,7 @@ namespace Isis { * @history 2003-02-04 Jeff Anderson - Added PropagateLabels method * @history 2003-02-04 Jeff Anderson - Fixed bug in propagation of input labels * to output cube - * @history 2003-02-07 Jeff Anderson - Integrated IString class into the Log + * @history 2003-02-07 Jeff Anderson - Integrated QString class into the Log * methods * @history 2003-04-23 Jeff Anderson - Made accomodations for the updated * Preference class @@ -220,18 +220,18 @@ namespace Isis { virtual void EndProcess(); virtual void Finalize(); - Isis::Cube *SetInputCube(const std::string ¶meter, + Isis::Cube *SetInputCube(const QString ¶meter, const int requirements = 0); - Isis::Cube *SetInputCube(const std::string &fname, + Isis::Cube *SetInputCube(const QString &fname, const Isis::CubeAttributeInput &att, int requirements = 0); void SetInputCube(Isis::Cube *inCube); - Isis::Cube *SetOutputCube(const std::string ¶meter); - Isis::Cube *SetOutputCube(const std::string ¶meter, const int nsamps, + Isis::Cube *SetOutputCube(const QString ¶meter); + Isis::Cube *SetOutputCube(const QString ¶meter, const int nsamps, const int nlines, const int nbands = 1); - Isis::Cube *SetOutputCube(const std::string &fname, + Isis::Cube *SetOutputCube(const QString &fname, const Isis::CubeAttributeOutput &att, const int nsamps, const int nlines, const int nbands = 1); @@ -244,9 +244,9 @@ namespace Isis { void ClearOutputCubes(); void PropagateLabels(const bool prop); - void PropagateLabels(const std::string &cube); + void PropagateLabels(const QString &cube); void PropagateTables(const bool prop); - void PropagateTables(const std::string &fromName); + void PropagateTables(const QString &fromName); void PropagatePolygons(const bool prop); void PropagateHistory(const bool prop); void PropagateOriginalLabel(const bool prop); @@ -260,7 +260,7 @@ namespace Isis { return p_progress; }; - std::string MissionData(const std::string &mission, const std::string &file, + QString MissionData(const QString &mission, const QString &file, bool highestVersion = false); void WriteHistory(Cube &cube); diff --git a/isis/src/base/objs/ProcessByBrick/ProcessByBrick.cpp b/isis/src/base/objs/ProcessByBrick/ProcessByBrick.cpp index 9a35ee6347..d2ee7d5392 100644 --- a/isis/src/base/objs/ProcessByBrick/ProcessByBrick.cpp +++ b/isis/src/base/objs/ProcessByBrick/ProcessByBrick.cpp @@ -67,7 +67,7 @@ namespace Isis { * * @throws iException::Message */ - Cube *ProcessByBrick::SetInputCube(const std::string ¶meter, + Cube *ProcessByBrick::SetInputCube(const QString ¶meter, int requirements) { int allRequirements = AllMatchOrOne; allRequirements |= requirements; @@ -95,7 +95,7 @@ namespace Isis { * * @throws iException::Message */ - Cube *ProcessByBrick::SetInputCube(const std::string &file, + Cube *ProcessByBrick::SetInputCube(const QString &file, const CubeAttributeInput &att, int requirements) { int allRequirements = AllMatchOrOne; diff --git a/isis/src/base/objs/ProcessByBrick/ProcessByBrick.h b/isis/src/base/objs/ProcessByBrick/ProcessByBrick.h index 606524d3f4..0891a37e4c 100644 --- a/isis/src/base/objs/ProcessByBrick/ProcessByBrick.h +++ b/isis/src/base/objs/ProcessByBrick/ProcessByBrick.h @@ -96,10 +96,10 @@ namespace Isis { }; using Process::SetInputCube; - Cube *SetInputCube(const std::string ¶meter, + Cube *SetInputCube(const QString ¶meter, int requirements = 0); - Cube *SetInputCube(const std::string &fname, + Cube *SetInputCube(const QString &fname, const CubeAttributeInput &att, int requirements = 0); diff --git a/isis/src/base/objs/ProcessByLine/ProcessByLine.cpp b/isis/src/base/objs/ProcessByLine/ProcessByLine.cpp index dc438769ac..bede166023 100644 --- a/isis/src/base/objs/ProcessByLine/ProcessByLine.cpp +++ b/isis/src/base/objs/ProcessByLine/ProcessByLine.cpp @@ -54,7 +54,7 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *ProcessByLine::SetInputCube(const std::string ¶meter, + Isis::Cube *ProcessByLine::SetInputCube(const QString ¶meter, const int requirements) { int allRequirements = Isis::SpatialMatch | Isis::BandMatchOrOne; allRequirements |= requirements; @@ -76,7 +76,7 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *ProcessByLine::SetInputCube(const std::string &file, + Isis::Cube *ProcessByLine::SetInputCube(const QString &file, Isis::CubeAttributeInput &att, const int requirements) { int allRequirements = Isis::SpatialMatch | Isis::BandMatchOrOne; diff --git a/isis/src/base/objs/ProcessByLine/ProcessByLine.h b/isis/src/base/objs/ProcessByLine/ProcessByLine.h index 71a37923f4..cb7bf9ae21 100644 --- a/isis/src/base/objs/ProcessByLine/ProcessByLine.h +++ b/isis/src/base/objs/ProcessByLine/ProcessByLine.h @@ -100,9 +100,9 @@ namespace Isis { SetWrap(true); }; - Isis::Cube *SetInputCube(const std::string ¶meter, + Isis::Cube *SetInputCube(const QString ¶meter, const int requirements = 0); - Isis::Cube *SetInputCube(const std::string &file, + Isis::Cube *SetInputCube(const QString &file, Isis::CubeAttributeInput &att, const int requirements = 0); void SetInputCube(Isis::Cube *inCube); diff --git a/isis/src/base/objs/ProcessBySample/ProcessBySample.cpp b/isis/src/base/objs/ProcessBySample/ProcessBySample.cpp index cab42e479b..db574f56fd 100644 --- a/isis/src/base/objs/ProcessBySample/ProcessBySample.cpp +++ b/isis/src/base/objs/ProcessBySample/ProcessBySample.cpp @@ -53,7 +53,7 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *ProcessBySample::SetInputCube(const std::string ¶meter, + Isis::Cube *ProcessBySample::SetInputCube(const QString ¶meter, int requirements) { int allRequirements = Isis::SpatialMatch | Isis::BandMatchOrOne; allRequirements |= requirements; @@ -73,7 +73,7 @@ namespace Isis { * Defaults to 0 * */ - Isis::Cube *ProcessBySample::SetInputCube(const std::string &file, + Isis::Cube *ProcessBySample::SetInputCube(const QString &file, Isis::CubeAttributeInput &att, int requirements) { int allRequirements = Isis::SpatialMatch | Isis::BandMatchOrOne; diff --git a/isis/src/base/objs/ProcessBySample/ProcessBySample.h b/isis/src/base/objs/ProcessBySample/ProcessBySample.h index 6b65a5fcf7..2acabe09af 100644 --- a/isis/src/base/objs/ProcessBySample/ProcessBySample.h +++ b/isis/src/base/objs/ProcessBySample/ProcessBySample.h @@ -56,9 +56,9 @@ namespace Isis { SetWrap(true); }; - Isis::Cube *SetInputCube(const std::string ¶meter, + Isis::Cube *SetInputCube(const QString ¶meter, int requirements = 0); - Isis::Cube *SetInputCube(const std::string &file, + Isis::Cube *SetInputCube(const QString &file, Isis::CubeAttributeInput &att, int requirements = 0); diff --git a/isis/src/base/objs/ProcessBySpectra/ProcessBySpectra.cpp b/isis/src/base/objs/ProcessBySpectra/ProcessBySpectra.cpp index 5d69a33b77..8c353172a6 100644 --- a/isis/src/base/objs/ProcessBySpectra/ProcessBySpectra.cpp +++ b/isis/src/base/objs/ProcessBySpectra/ProcessBySpectra.cpp @@ -53,7 +53,7 @@ namespace Isis { * * @throws Isis::iException::Message */ - Isis::Cube *ProcessBySpectra::SetInputCube(const std::string ¶meter, + Isis::Cube *ProcessBySpectra::SetInputCube(const QString ¶meter, const int requirements) { return ProcessByBrick::SetInputCube(parameter, Isis::SpatialMatch | requirements); @@ -71,7 +71,7 @@ namespace Isis { * Defaults to 0 * */ - Isis::Cube *ProcessBySpectra::SetInputCube(const std::string &file, + Isis::Cube *ProcessBySpectra::SetInputCube(const QString &file, Isis::CubeAttributeInput &att, const int requirements) { return ProcessByBrick::SetInputCube(file, att, diff --git a/isis/src/base/objs/ProcessBySpectra/ProcessBySpectra.h b/isis/src/base/objs/ProcessBySpectra/ProcessBySpectra.h index 52f78a2759..eb1d3a005c 100644 --- a/isis/src/base/objs/ProcessBySpectra/ProcessBySpectra.h +++ b/isis/src/base/objs/ProcessBySpectra/ProcessBySpectra.h @@ -72,9 +72,9 @@ namespace Isis { SetType(type); }; - Isis::Cube *SetInputCube(const std::string ¶meter, + Isis::Cube *SetInputCube(const QString ¶meter, const int requirements = 0); - Isis::Cube *SetInputCube(const std::string &file, + Isis::Cube *SetInputCube(const QString &file, Isis::CubeAttributeInput &att, const int requirements = 0); diff --git a/isis/src/base/objs/ProcessExport/ProcessExport.cpp b/isis/src/base/objs/ProcessExport/ProcessExport.cpp index 9b6dc33e4a..20d6651c5d 100644 --- a/isis/src/base/objs/ProcessExport/ProcessExport.cpp +++ b/isis/src/base/objs/ProcessExport/ProcessExport.cpp @@ -370,7 +370,7 @@ namespace Isis { for(unsigned int i = 0; i < InputCubes.size(); i++) { // Get the manual stretch parameters if needed - string strType = Application::GetUserInterface().GetString("STRETCH"); + QString strType = Application::GetUserInterface().GetString("STRETCH"); if(strType == "MANUAL") { p_inputMinimum.push_back(Application::GetUserInterface().GetDouble("MINIMUM")); p_inputMaximum.push_back(Application::GetUserInterface().GetDouble("MAXIMUM")); @@ -1179,12 +1179,12 @@ namespace Isis { * to write the world information to. * */ - void ProcessExport::CreateWorldFile(const std::string &worldFile) { + void ProcessExport::CreateWorldFile(const QString &worldFile) { try { Projection *proj = InputCubes[0]->getProjection(); proj->SetWorld(1.0, 1.0); ofstream os; - os.open(worldFile.c_str(), ios::out); + os.open(worldFile.toAscii().data(), ios::out); // X resolution os << std::fixed << setprecision(15) diff --git a/isis/src/base/objs/ProcessExport/ProcessExport.h b/isis/src/base/objs/ProcessExport/ProcessExport.h index 1cb68d4a83..4f90b78bec 100644 --- a/isis/src/base/objs/ProcessExport/ProcessExport.h +++ b/isis/src/base/objs/ProcessExport/ProcessExport.h @@ -140,7 +140,7 @@ namespace Isis { const double maximum); void SetInputRange(const double minimum, const double middle, const double maximum, const int index); - void CreateWorldFile(const std::string &worldFile); + void CreateWorldFile(const QString &worldFile); void SetOutputEndian(enum ByteOrder endianness); void SetOutputType(Isis::PixelType pixelIn); diff --git a/isis/src/base/objs/ProcessExportPds/ProcessExportPds.cpp b/isis/src/base/objs/ProcessExportPds/ProcessExportPds.cpp index a4ea5349bb..83d6762387 100644 --- a/isis/src/base/objs/ProcessExportPds/ProcessExportPds.cpp +++ b/isis/src/base/objs/ProcessExportPds/ProcessExportPds.cpp @@ -117,7 +117,7 @@ namespace Isis { CreateImageLabel(); } else { - IString msg = "Unsupported PDS output type"; + QString msg = "Unsupported PDS output type"; throw IException(IException::User, msg, _FILEINFO_); } @@ -149,7 +149,7 @@ namespace Isis { } } else { - IString msg = "Invalid PDS export type"; + QString msg = "Invalid PDS export type"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -222,9 +222,9 @@ namespace Isis { // must also changes the corresponding lines in the OutputLabel member mainPvl += PvlKeyword("LABEL_RECORDS", "???????", "BYTES"); if(m_detachedLabel) { - IString sImageFile = m_detachedPdsLabelFile; - size_t iFound = sImageFile.find(".lbl"); - if(iFound != std::string::npos) { + QString sImageFile = m_detachedPdsLabelFile; + int iFound = sImageFile.indexOf(".lbl"); + if(iFound != -1) { sImageFile.replace(iFound, 4, ".img"); } else { @@ -248,10 +248,10 @@ namespace Isis { mainPvl.GetFormat()->Add("$base/translations/pdsExportImageJP2.typ"); // Create standard ROOT object keywords mainPvl += PvlKeyword("PDS_VERSION_ID", "PDS3"); - IString sImageFile = m_detachedPdsLabelFile; + QString sImageFile = m_detachedPdsLabelFile; if(m_detachedLabel) { - size_t iFound = sImageFile.find(".lbl"); - if(iFound != std::string::npos) { + int iFound = sImageFile.indexOf(".lbl"); + if(iFound != -1) { sImageFile.replace(iFound, 4, ".jp2"); } else { @@ -259,7 +259,7 @@ namespace Isis { } } else { - IString msg = "Labels must be detached for JP2 files"; + QString msg = "Labels must be detached for JP2 files"; throw IException(IException::Programmer, msg, _FILEINFO_); } FileName outFile(sImageFile); @@ -273,13 +273,13 @@ namespace Isis { cmpObj += PvlKeyword("UNCOMPRESSED_FILE_NAME", infilename.name()); int storagebytes = InputCubes[0]->getSampleCount() * InputCubes[0]->getLineCount(); if(p_pixelType == Isis::Real) { - IString msg = "JPEG2000 does not support floating point data"; + QString msg = "JPEG2000 does not support floating point data"; throw IException(IException::Programmer, msg, _FILEINFO_); } if(p_pixelType == Isis::UnsignedWord || p_pixelType == Isis::SignedWord) { storagebytes = storagebytes * 2; } - cmpObj += PvlKeyword("REQUIRED_STORAGE_BYTES", storagebytes); + cmpObj += PvlKeyword("REQUIRED_STORAGE_BYTES", toString(storagebytes)); mainPvl.AddObject(cmpObj); PvlObject ucmpObj("UNCOMPRESSED_FILE"); ucmpObj += PvlKeyword("FILE_NAME", infilename.name()); @@ -288,8 +288,8 @@ namespace Isis { if(p_pixelType == Isis::UnsignedWord || p_pixelType == Isis::SignedWord) { recordbytes = recordbytes * 2; } - ucmpObj += PvlKeyword("RECORD_BYTES", recordbytes); - ucmpObj += PvlKeyword("FILE_RECORDS", InputCubes[0]->getLineCount()); + ucmpObj += PvlKeyword("RECORD_BYTES", toString(recordbytes)); + ucmpObj += PvlKeyword("FILE_RECORDS", toString(InputCubes[0]->getLineCount())); ucmpObj += PvlKeyword("^IMAGE", infilename.name()); mainPvl.AddObject(ucmpObj); } @@ -310,9 +310,9 @@ namespace Isis { mainPvl += PvlKeyword("FILE_RECORDS", "???????"); mainPvl += PvlKeyword("LABEL_RECORDS", "????"); if(m_detachedLabel) { - IString sImageFile = m_detachedPdsLabelFile; - size_t iFound = sImageFile.find(".lbl"); - if(iFound != std::string::npos) { + QString sImageFile = m_detachedPdsLabelFile; + int iFound = sImageFile.indexOf(".lbl"); + if(iFound != -1) { sImageFile.replace(iFound, 4, ".img"); } else { @@ -336,10 +336,10 @@ namespace Isis { mainPvl.GetFormat()->Add("$base/translations/pdsExportImageJP2.typ"); //Create fixed ROOT object keywords mainPvl += PvlKeyword("PDS_VERSION_ID", "PDS3"); - IString sImageFile = m_detachedPdsLabelFile; + QString sImageFile = m_detachedPdsLabelFile; if(m_detachedLabel) { - size_t iFound = sImageFile.find(".lbl"); - if(iFound != std::string::npos) { + int iFound = sImageFile.indexOf(".lbl"); + if(iFound != -1) { sImageFile.replace(iFound, 4, ".jp2"); } else { @@ -347,7 +347,7 @@ namespace Isis { } } else { - IString msg = "Labels must be detached for JP2 files"; + QString msg = "Labels must be detached for JP2 files"; throw IException(IException::Programmer, msg, _FILEINFO_); } FileName outFile(sImageFile); @@ -361,13 +361,13 @@ namespace Isis { cmpObj += PvlKeyword("UNCOMPRESSED_FILE_NAME", infilename.name()); int storagebytes = InputCubes[0]->getSampleCount() * InputCubes[0]->getLineCount(); if(p_pixelType == Isis::Real) { - IString msg = "JPEG2000 does not support floating point data"; + QString msg = "JPEG2000 does not support floating point data"; throw IException(IException::Programmer, msg, _FILEINFO_); } if(p_pixelType == Isis::UnsignedWord || p_pixelType == Isis::SignedWord) { storagebytes = storagebytes * 2; } - cmpObj += PvlKeyword("REQUIRED_STORAGE_BYTES", storagebytes); + cmpObj += PvlKeyword("REQUIRED_STORAGE_BYTES", toString(storagebytes)); mainPvl.AddObject(cmpObj); PvlObject ucmpObj("UNCOMPRESSED_FILE"); ucmpObj += PvlKeyword("FILE_NAME", infilename.name()); @@ -376,8 +376,8 @@ namespace Isis { if(p_pixelType == Isis::UnsignedWord || p_pixelType == Isis::SignedWord) { recordbytes = recordbytes * 2; } - ucmpObj += PvlKeyword("RECORD_BYTES", recordbytes); - ucmpObj += PvlKeyword("FILE_RECORDS", InputCubes[0]->getLineCount()); + ucmpObj += PvlKeyword("RECORD_BYTES", toString(recordbytes)); + ucmpObj += PvlKeyword("FILE_RECORDS", toString(InputCubes[0]->getLineCount())); ucmpObj += PvlKeyword("^IMAGE", infilename.name()); mainPvl.AddObject(ucmpObj); } @@ -441,68 +441,68 @@ namespace Isis { if(!m_forceBandwidth && imgObj.HasKeyword("BANDWIDTH")) imgObj.DeleteKeyword("BANDWIDTH"); if(m_forceBandStorageType) imgObj += PvlKeyword("BAND_STORAGE_TYPE", "BAND_SEQUENTIAL"); - if(m_forceOffset) imgObj += PvlKeyword("OFFSET", base); - if(m_forceScalingFactor) imgObj += PvlKeyword("SCALING_FACTOR", multiplier); + if(m_forceOffset) imgObj += PvlKeyword("OFFSET", toString(base)); + if(m_forceScalingFactor) imgObj += PvlKeyword("SCALING_FACTOR", toString(multiplier)); // Manually set the keyword for pixel type and special pixels if(p_pixelType == Isis::UnsignedByte) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "8"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", 0xff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString(0xff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "MSB_UNSIGNED_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel8.typ"); } else if((p_pixelType == Isis::UnsignedWord) && (p_endianType == Isis::Msb)) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "16"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", 0xffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString(0xffff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "MSB_UNSIGNED_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel16.typ"); } else if((p_pixelType == Isis::UnsignedWord) && (p_endianType == Isis::Lsb)) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "16"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", 0xffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString(0xffff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "LSB_UNSIGNED_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel16.typ"); } else if((p_pixelType == Isis::SignedWord) && (p_endianType == Isis::Msb)) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "16"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", 0xffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString(0xffff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "MSB_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel16.typ"); } else if((p_pixelType == Isis::SignedWord) && (p_endianType == Isis::Lsb)) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "16"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", (BigInt)0xffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString((BigInt)0xffff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "LSB_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel16.typ"); } else if(p_pixelType == Isis::Real) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "32"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", (BigInt)0xffffffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString((BigInt)0xffffffff)); if(p_endianType == Isis::Msb) { if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "IEEE_REAL"); @@ -510,15 +510,15 @@ namespace Isis { else { if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "PC_REAL"); } - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", Isis::INULL4); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", Isis::ILOW_REPR_SAT4); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", Isis::ILOW_INSTR_SAT4); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", Isis::IHIGH_REPR_SAT4); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", Isis::IHIGH_INSTR_SAT4); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString(Isis::INULL4)); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString(Isis::ILOW_REPR_SAT4)); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString(Isis::ILOW_INSTR_SAT4)); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString(Isis::IHIGH_REPR_SAT4)); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString(Isis::IHIGH_INSTR_SAT4)); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel32.typ"); } else { - IString msg = "Unsupported PDS pixel type or sample size"; + QString msg = "Unsupported PDS pixel type or sample size"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -585,68 +585,68 @@ namespace Isis { if(!m_forceBandwidth && imgObj.HasKeyword("BANDWIDTH")) imgObj.DeleteKeyword("BANDWIDTH"); if(m_forceBandStorageType) imgObj += PvlKeyword("BAND_STORAGE_TYPE", "BAND_SEQUENTIAL"); - if(m_forceOffset) imgObj += PvlKeyword("OFFSET", base); - if(m_forceScalingFactor) imgObj += PvlKeyword("SCALING_FACTOR", multiplier); + if(m_forceOffset) imgObj += PvlKeyword("OFFSET", toString(base)); + if(m_forceScalingFactor) imgObj += PvlKeyword("SCALING_FACTOR", toString(multiplier)); // Manually set the keyword for pixel type and special pixels if(p_pixelType == Isis::UnsignedByte) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "8"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", 0xff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString(0xff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "MSB_UNSIGNED_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel8.typ"); } else if((p_pixelType == Isis::UnsignedWord) && (p_endianType == Isis::Msb)) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "16"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", 0xffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString(0xffff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "MSB_UNSIGNED_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel16.typ"); } else if((p_pixelType == Isis::UnsignedWord) && (p_endianType == Isis::Lsb)) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "16"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", 0xffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString(0xffff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "LSB_UNSIGNED_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel16.typ"); } else if((p_pixelType == Isis::SignedWord) && (p_endianType == Isis::Msb)) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "16"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", 0xffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString(0xffff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "MSB_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel16.typ"); } else if((p_pixelType == Isis::SignedWord) && (p_endianType == Isis::Lsb)) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "16"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", (BigInt)0xffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString((BigInt)0xffff)); if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "LSB_INTEGER"); - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", (int)OutputNull()); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", (int)OutputLrs()); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", (int)OutputLis()); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", (int)OutputHrs()); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", (int)OutputHis()); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString((int)OutputNull())); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString((int)OutputLrs())); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString((int)OutputLis())); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString((int)OutputHrs())); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString((int)OutputHis())); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel16.typ"); } else if(p_pixelType == Isis::Real) { if(m_forceSampleBits) imgObj += PvlKeyword("SAMPLE_BITS", "32"); - if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", (BigInt)0xffffffff); + if(m_forceSampleBitMask) imgObj += PvlKeyword("SAMPLE_BIT_MASK", toString((BigInt)0xffffffff)); if(p_endianType == Isis::Msb) { if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "IEEE_REAL"); @@ -654,15 +654,15 @@ namespace Isis { else { if(m_forceSampleType) imgObj += PvlKeyword("SAMPLE_TYPE", "PC_REAL"); } - if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", Isis::INULL4); - if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", Isis::ILOW_REPR_SAT4); - if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", Isis::ILOW_INSTR_SAT4); - if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", Isis::IHIGH_REPR_SAT4); - if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", Isis::IHIGH_INSTR_SAT4); + if(m_forceCoreNull) imgObj += PvlKeyword("CORE_NULL", toString(Isis::INULL4)); + if(m_forceCoreLrs) imgObj += PvlKeyword("CORE_LOW_REPR_SATURATION", toString(Isis::ILOW_REPR_SAT4)); + if(m_forceCoreLis) imgObj += PvlKeyword("CORE_LOW_INSTR_SATURATION", toString(Isis::ILOW_INSTR_SAT4)); + if(m_forceCoreHrs) imgObj += PvlKeyword("CORE_HIGH_REPR_SATURATION", toString(Isis::IHIGH_REPR_SAT4)); + if(m_forceCoreHis) imgObj += PvlKeyword("CORE_HIGH_INSTR_SATURATION", toString(Isis::IHIGH_INSTR_SAT4)); mainPvl.GetFormat()->Add("$base/translations/pdsExportImageImagePixel32.typ"); } else { - IString msg = "Unsupported PDS pixel type or sample size"; + QString msg = "Unsupported PDS pixel type or sample size"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -689,7 +689,7 @@ namespace Isis { xlatGenProj.Auto(outputPvl); // Translate the projection specific keywords for a PDS IMAGE_MAP_PROJECTION - IString projName = ProjectionName(*inputLabel); + QString projName = ProjectionName(*inputLabel); PvlTranslationManager xlatSpecProj(*inputLabel, "$base/translations/pdsExport" + projName + ".trn"); xlatSpecProj.Auto(outputPvl); @@ -703,66 +703,66 @@ namespace Isis { PvlObject &pdsMapObj = outputPvl.FindObject("IMAGE_MAP_PROJECTION"); // Add the projection name -// pdsMapObj += PvlKeyword ("MAP_PROJECTION_TYPE", projName.UpCase()); +// pdsMapObj += PvlKeyword ("MAP_PROJECTION_TYPE", projName.toUpper()); // Modify the radii to be km PvlKeyword &aRadius = pdsMapObj["A_AXIS_RADIUS"]; - IString unit = aRadius.Unit(); - if(unit.UpCase() == "METERS") { + QString unit = aRadius.Unit(); + if(unit.toUpper() == "METERS") { double dValue = (double)aRadius; dValue /= 1000.0; - aRadius.SetValue(dValue, "KM"); + aRadius.SetValue(toString(dValue), "KM"); } PvlKeyword &bRadius = pdsMapObj["B_AXIS_RADIUS"]; unit = bRadius.Unit(); - if(unit.UpCase() == "METERS") { + if(unit.toUpper() == "METERS") { double dValue = (double)bRadius; dValue /= 1000.0; - bRadius.SetValue(dValue, "KM"); + bRadius.SetValue(toString(dValue), "KM"); } PvlKeyword &cRadius = pdsMapObj["C_AXIS_RADIUS"]; unit = cRadius.Unit(); - if(unit.UpCase() == "METERS") { + if(unit.toUpper() == "METERS") { double dValue = (double)cRadius; dValue /= 1000.0; - cRadius.SetValue(dValue, "KM"); + cRadius.SetValue(toString(dValue), "KM"); } // Modify the units on MAP_SCALE and MAP_RESOLUTION PvlKeyword &mapScale = pdsMapObj["MAP_SCALE"]; unit = mapScale.Unit(); - if((unit.UpCase() == "METERS/PIX") || (unit.UpCase() == "METERS/PIXEL")) { + if((unit.toUpper() == "METERS/PIX") || (unit.toUpper() == "METERS/PIXEL")) { if(m_exportResolution == Kilometer) { double dValue = (double)mapScale; dValue /= 1000.0; - mapScale.SetValue(dValue, "KM/PIXEL"); + mapScale.SetValue(toString(dValue), "KM/PIXEL"); } else { - mapScale.SetValue((double)mapScale, "METERS/PIXEL"); + mapScale.SetValue(toString((double)mapScale), "METERS/PIXEL"); } } PvlKeyword &mapRes = pdsMapObj["MAP_RESOLUTION"]; unit = mapRes.Unit(); - if(unit.UpCase() == "PIXELS/DEGREE") { - mapRes.SetValue((string)mapRes, "PIX/DEG"); + if(unit.toUpper() == "PIXELS/DEGREE") { + mapRes.SetValue((QString)mapRes, "PIX/DEG"); } // Add the EASTERNMOST AND WESTERNMOST LONGITUDE keywords PvlKeyword &isisLonDir = inputMapping.FindKeyword("LongitudeDirection"); - IString lonDir = isisLonDir[0]; - lonDir.UpCase(); + QString lonDir = isisLonDir[0]; + lonDir = lonDir.toUpper(); if(lonDir == "POSITIVEEAST") { double maxLon = inputMapping.FindKeyword("MaximumLongitude"); - pdsMapObj += PvlKeyword("EASTERNMOST_LONGITUDE", maxLon); + pdsMapObj += PvlKeyword("EASTERNMOST_LONGITUDE", toString(maxLon)); double minLon = inputMapping.FindKeyword("MinimumLongitude"); - pdsMapObj += PvlKeyword("WESTERNMOST_LONGITUDE", minLon); + pdsMapObj += PvlKeyword("WESTERNMOST_LONGITUDE", toString(minLon)); } else { double minLon = inputMapping.FindKeyword("MinimumLongitude"); - pdsMapObj += PvlKeyword("EASTERNMOST_LONGITUDE", minLon); + pdsMapObj += PvlKeyword("EASTERNMOST_LONGITUDE", toString(minLon)); double maxLon = inputMapping.FindKeyword("MaximumLongitude"); - pdsMapObj += PvlKeyword("WESTERNMOST_LONGITUDE", maxLon); + pdsMapObj += PvlKeyword("WESTERNMOST_LONGITUDE", toString(maxLon)); } // Add the LINE_PROJECTION_OFFSET and SAMPLE_PROJECTION_OFFSET keywords @@ -773,12 +773,12 @@ namespace Isis { lineOffset /= (double)inputMapping.FindKeyword("PixelResolution"); lineOffset *= 1.0; lineOffset += 0.5; // Add half a line to get to the center of (1,1) - pdsMapObj += PvlKeyword("LINE_PROJECTION_OFFSET", lineOffset, "PIXEL"); + pdsMapObj += PvlKeyword("LINE_PROJECTION_OFFSET", toString(lineOffset), "PIXEL"); double sampleOffset = inputMapping.FindKeyword("UpperLeftCornerX"); sampleOffset /= (double)inputMapping.FindKeyword("PixelResolution"); sampleOffset *= -1.0; sampleOffset += 0.5; // Add half a sample to get to the center of (1,1) - pdsMapObj += PvlKeyword("SAMPLE_PROJECTION_OFFSET", sampleOffset, "PIXEL"); + pdsMapObj += PvlKeyword("SAMPLE_PROJECTION_OFFSET", toString(sampleOffset), "PIXEL"); // Add units to keywords already in the IMAGE_MAP_PROJECTION object as necessary if(pdsMapObj.HasKeyword("CENTER_LATITUDE")) { @@ -828,9 +828,9 @@ namespace Isis { * * @return String containing the name of the projection */ - string ProcessExportPds::ProjectionName(Pvl &inputLabel) { + QString ProcessExportPds::ProjectionName(Pvl &inputLabel) { Projection *proj = ProjectionFactory::Create(inputLabel); - IString name = proj->Name(); + QString name = proj->Name(); delete proj; return name; } @@ -873,12 +873,12 @@ namespace Isis { */ void ProcessExportPds::OutputDetachedLabel() { if(!m_detachedLabel) { - IString msg = "Unable to output detached label. Use " + QString msg = "Unable to output detached label. Use " "ProcessExportPds::SetDetached() to set the " "output PDS label file name."; throw IException(IException::Unknown, msg, _FILEINFO_); } - std::ofstream sOutLabelStream(m_detachedPdsLabelFile.c_str()); + std::ofstream sOutLabelStream(m_detachedPdsLabelFile.toAscii().data()); OutputLabel(sOutLabelStream); sOutLabelStream.close(); } @@ -896,9 +896,9 @@ namespace Isis { // corresponding lines in the StandardImageRoot member if(m_exportType == Stream) { if(m_pdsFileType != ProcessExportPds::JP2Image) { - (*m_label)["LABEL_RECORDS"].SetValue(IString(labSize), "BYTES"); + (*m_label)["LABEL_RECORDS"].SetValue(toString(labSize), "BYTES"); if(!m_detachedLabel) { - (*m_label)["^IMAGE"].SetValue(IString(labSize + 1), "BYTES"); + (*m_label)["^IMAGE"].SetValue(toString(labSize + 1), "BYTES"); } } if(m_label->GetFormat() != NULL) { @@ -917,13 +917,13 @@ namespace Isis { int labelRecords; if(m_pdsFileType != ProcessExportPds::JP2Image) { lineBytes = LineBytes(); - (*m_label)["RECORD_BYTES"].SetValue(IString(lineBytes)); + (*m_label)["RECORD_BYTES"].SetValue(toString(lineBytes)); // The number of label records is dependent on the number of label bytes // and the lint bytes labelRecords = (int)ceil((double)labSize / (double)lineBytes); if(m_label->HasKeyword("LABEL_RECORDS")) { //LRO MRF doesn't have this keyword - (*m_label)["LABEL_RECORDS"].SetValue(IString(labelRecords)); + (*m_label)["LABEL_RECORDS"].SetValue(toString(labelRecords)); } int totalTableRecords = 0; for (unsigned int i = 0; i < m_tableRecords.size(); i++) { @@ -932,10 +932,10 @@ namespace Isis { int imageRecords = InputCubes[0]->getLineCount() * InputCubes[0]->getBandCount(); int fileRecords = labelRecords + imageRecords + totalTableRecords; - (*m_label)["FILE_RECORDS"].SetValue(IString(fileRecords)); + (*m_label)["FILE_RECORDS"].SetValue(toString(fileRecords)); if(!m_detachedLabel) { - (*m_label)["^IMAGE"].SetValue(IString(labelRecords + 1)); + (*m_label)["^IMAGE"].SetValue(toString(labelRecords + 1)); } } if(m_label->GetFormat() != NULL) { @@ -982,10 +982,10 @@ namespace Isis { * include a path. The path from the label * file will be used. */ - void ProcessExportPds::ExportTable(Table isisTable, IString detachedPdsTableFileName) { + void ProcessExportPds::ExportTable(Table isisTable, QString detachedPdsTableFileName) { if(Attached() && detachedPdsTableFileName != "") { - IString msg = "The output PDS file has been set to attached and a " + QString msg = "The output PDS file has been set to attached and a " "detached PDS table file name has been given. If detached " "is preferred, set the process to detached SetDetached() " "and call StandardPdsLabel() before calling ExportTable()."; @@ -993,7 +993,7 @@ namespace Isis { } if(Detached() && detachedPdsTableFileName == "") { - IString msg = "The output PDS file has been set to detached. A file name " + QString msg = "The output PDS file has been set to detached. A file name " "for the detached ouput PDS table file is required. " "If an attached output file is prefered, use the method " "ProcessExportPds::SetAttached() before calling ExportTable()."; @@ -1009,7 +1009,7 @@ namespace Isis { PvlObject metadata = pdsTable.exportTable(tableBuffer, fileRecordBytes, ByteOrderName(p_endianType)); - IString pdsTableName = pdsTable.formatPdsTableName(); + QString pdsTableName = pdsTable.formatPdsTableName(); Pvl &mainPvl = *m_label; if (Attached()) { m_tableBuffers.push_back(tableBuffer); @@ -1023,14 +1023,14 @@ namespace Isis { } // for start record values, indexing begins with 1 int tableStartRecord = 1 + labelRecords + imageRecords + totalTableRecords; - mainPvl += PvlKeyword("^" + pdsTableName, IString(tableStartRecord)); + mainPvl += PvlKeyword("^" + pdsTableName, toString(tableStartRecord)); } else { mainPvl += PvlKeyword("^" + pdsTableName, detachedPdsTableFileName); FileName labelFile(m_detachedPdsLabelFile); - IString tableFileWithPath = labelFile.path() + "/" + QString tableFileWithPath = labelFile.path() + "/" + detachedPdsTableFileName; - ofstream os(tableFileWithPath.c_str()); + ofstream os(tableFileWithPath.toAscii().data()); os.write(tableBuffer, isisTable.Records() * fileRecordBytes); os.close(); } @@ -1047,7 +1047,7 @@ namespace Isis { * @param detachedLabelFile A string containing the name of the detached * PDS label file */ - void ProcessExportPds::SetDetached(const std::string detachedLabelFile) { + void ProcessExportPds::SetDetached(QString detachedLabelFile) { m_detachedLabel = true; m_detachedPdsLabelFile = detachedLabelFile; return; @@ -1311,7 +1311,7 @@ namespace Isis { if (!m_detachedLabel) { for (unsigned int i = 0; i < m_tableBuffers.size(); i++) { if (m_tableBuffers[i] == NULL) { - IString msg = "Unable to add tables to PDS output file."; + QString msg = "Unable to add tables to PDS output file."; throw IException(IException::Unknown, msg, _FILEINFO_); } // write each table buffer to fout. diff --git a/isis/src/base/objs/ProcessExportPds/ProcessExportPds.h b/isis/src/base/objs/ProcessExportPds/ProcessExportPds.h index c8d05a51c3..7724ddfc08 100644 --- a/isis/src/base/objs/ProcessExportPds/ProcessExportPds.h +++ b/isis/src/base/objs/ProcessExportPds/ProcessExportPds.h @@ -22,8 +22,9 @@ #include "ProcessExport.h" #include +class QString; + namespace Isis { - class IString; class PvlFormatPds; class Table; @@ -131,7 +132,7 @@ namespace Isis { void OutputLabel(std::ofstream &pdsFileStream); void OutputDetachedLabel(); - void ExportTable(Isis::Table isisTable, IString detachedPdsTableFileName=""); + void ExportTable(Isis::Table isisTable, QString detachedPdsTableFileName=""); // include this using declaration to indicate that ProcessExportPds // objects that call a StartProcess() method that has not been overridden @@ -144,7 +145,7 @@ namespace Isis { bool Attached(); // Mutators - void SetDetached(const std::string detachedLabelFile); + void SetDetached(QString detachedLabelFile); void SetAttached(); void ForceBands(bool force); void ForceBandName(bool force); @@ -169,7 +170,7 @@ namespace Isis { void CreateQubeLabel(); void CreateSpectralQubeLabel(); - std::string ProjectionName(Pvl &inputLabel); + QString ProjectionName(Pvl &inputLabel); PvlFormatPds *m_formatter; /**< Used to determine how to format the keyword values in the PDS file.*/ @@ -219,7 +220,7 @@ namespace Isis { the PDS labels.*/ bool m_detachedLabel; /**< Indicates whether the PDS file will be detached.*/ - IString m_detachedPdsLabelFile;/**< The name of the detached PDS label + QString m_detachedPdsLabelFile;/**< The name of the detached PDS label file.*/ PdsFileType m_pdsFileType; /**< Image, Qube, Spectral Qube, or JP2 Image*/ diff --git a/isis/src/base/objs/ProcessGroundPolygons/ProcessGroundPolygons.cpp b/isis/src/base/objs/ProcessGroundPolygons/ProcessGroundPolygons.cpp index 5725c9e9da..dd29091cf5 100644 --- a/isis/src/base/objs/ProcessGroundPolygons/ProcessGroundPolygons.cpp +++ b/isis/src/base/objs/ProcessGroundPolygons/ProcessGroundPolygons.cpp @@ -167,9 +167,9 @@ namespace Isis { * @param avgFileName * @param countFileName */ - void ProcessGroundPolygons::AppendOutputCube(std::string &cube, - const std::string &avgFileName, - const std::string &countFileName) { + void ProcessGroundPolygons::AppendOutputCube(QString &cube, + const QString &avgFileName, + const QString &countFileName) { /*We need a ground map for converting lat/long to line/sample see Convert()*/ Pvl pvl(cube); p_groundMap = new UniversalGroundMap(pvl); @@ -186,10 +186,10 @@ namespace Isis { * @param outAtts * @param cube */ - void ProcessGroundPolygons::SetOutputCube(const std::string &avgFileName, - const std::string &countFileName, + void ProcessGroundPolygons::SetOutputCube(const QString &avgFileName, + const QString &countFileName, Isis::CubeAttributeOutput &outAtts, - std::string &cube) { + QString &cube) { /*We need a ground map for converting lat/long to line/sample see Convert()*/ Pvl pvl(cube); p_groundMap = new UniversalGroundMap(pvl); @@ -218,18 +218,18 @@ namespace Isis { * @param parameter * @param cube */ - void ProcessGroundPolygons::SetOutputCube(const std::string ¶meter, - std::string &cube) { + void ProcessGroundPolygons::SetOutputCube(const QString ¶meter, + QString &cube) { - std::string avgString = + QString avgString = Application::GetUserInterface().GetFileName(parameter); CubeAttributeOutput atts = Application::GetUserInterface().GetOutputAttribute(parameter); FileName file(avgString); - std::string path = file.path(); - std::string filename = file.baseName(); - std::string countString = path + "/" + filename + "-count-"; + QString path = file.path(); + QString filename = file.baseName(); + QString countString = path + "/" + filename + "-count-"; SetOutputCube(avgString, countString, atts, cube); @@ -242,18 +242,18 @@ namespace Isis { * @param map * @param bands */ - void ProcessGroundPolygons::SetOutputCube(const std::string ¶meter, + void ProcessGroundPolygons::SetOutputCube(const QString ¶meter, Isis::Pvl &map, int bands) { - std::string avgString = + QString avgString = Application::GetUserInterface().GetFileName(parameter); CubeAttributeOutput atts = Application::GetUserInterface().GetOutputAttribute(parameter); FileName file(avgString); - std::string path = file.path(); - std::string filename = file.baseName(); - std::string countString = path + "/" + filename + "-count-"; + QString path = file.path(); + QString filename = file.baseName(); + QString countString = path + "/" + filename + "-count-"; SetOutputCube(avgString, countString, atts, map, bands); @@ -269,8 +269,8 @@ namespace Isis { * @param map * @param bands */ - void ProcessGroundPolygons::SetOutputCube(const std::string &avgFileName, - const std::string &countFileName, + void ProcessGroundPolygons::SetOutputCube(const QString &avgFileName, + const QString &countFileName, Isis::CubeAttributeOutput &atts, Isis::Pvl &map, int bands) { int samples, lines; diff --git a/isis/src/base/objs/ProcessGroundPolygons/ProcessGroundPolygons.h b/isis/src/base/objs/ProcessGroundPolygons/ProcessGroundPolygons.h index 26be61e105..743ef04498 100644 --- a/isis/src/base/objs/ProcessGroundPolygons/ProcessGroundPolygons.h +++ b/isis/src/base/objs/ProcessGroundPolygons/ProcessGroundPolygons.h @@ -28,21 +28,21 @@ namespace Isis { ProcessGroundPolygons(); //Cube is an existing camera cube or projection cube - void SetOutputCube(const std::string ¶meter, std::string &cube); + void SetOutputCube(const QString ¶meter, QString &cube); //Determine cube size from the projection map - void SetOutputCube(const std::string ¶meter, Isis::Pvl &map, int bands); + void SetOutputCube(const QString ¶meter, Isis::Pvl &map, int bands); - void SetOutputCube(const std::string &avgFileName, const std::string + void SetOutputCube(const QString &avgFileName, const QString &countFileName, Isis::CubeAttributeOutput &atts, - std::string &cube); + QString &cube); - void SetOutputCube(const std::string &avgFileName, const std::string + void SetOutputCube(const QString &avgFileName, const QString &countFileName, Isis::CubeAttributeOutput &atts, Isis::Pvl &map, int bands); - void AppendOutputCube(std::string &cube, const std::string &avgFileName, - const std::string &countFileName = ""); + void AppendOutputCube(QString &cube, const QString &avgFileName, + const QString &countFileName = ""); void Rasterize(std::vector &lat, std::vector &lon, diff --git a/isis/src/base/objs/ProcessGroundPolygons/unitTest.cpp b/isis/src/base/objs/ProcessGroundPolygons/unitTest.cpp index 3d5b1dce13..d51b050587 100644 --- a/isis/src/base/objs/ProcessGroundPolygons/unitTest.cpp +++ b/isis/src/base/objs/ProcessGroundPolygons/unitTest.cpp @@ -1,4 +1,7 @@ #include "Isis.h" + +#include + #include "ProcessGroundPolygons.h" #include "ProcessByLine.h" #include "ProcessByBrick.h" @@ -76,17 +79,17 @@ void IsisMain() { CubeAttributeOutput out_atts; out_atts.setPixelType(Real); - const string output1 = "ProcessGroundPolygonsTest.cub"; - const string output2 = "ProcessGroundPolygonsTest_count.cub"; + QString output1 = "ProcessGroundPolygonsTest.cub"; + QString output2 = "ProcessGroundPolygonsTest_count.cub"; p.SetOutputCube(output1 , output2 , out_atts, vimsPvl, 2); for(int f = 0; f < vimsCube.size(); f++) { - Pvl vimsCubePvl(vimsCube[f].toStdString()); + Pvl vimsCubePvl(vimsCube[f]); UniversalGroundMap *groundMap = new UniversalGroundMap(vimsCubePvl); vimsValues.clear(); - pbl.SetInputCube(vimsCube[f].toStdString(), atts0, 0); + pbl.SetInputCube(vimsCube[f], atts0, 0); pbl.StartProcess(readValues); pbl.EndProcess(); double latitude, longitude; @@ -153,8 +156,8 @@ void IsisMain() { pbl.StartProcess(writeAscii); pbl.EndProcess(); - remove(output1.c_str()); - remove(output2.c_str()); + QFile::remove(output1); + QFile::remove(output2); } diff --git a/isis/src/base/objs/ProcessImport/ProcessImport.cpp b/isis/src/base/objs/ProcessImport/ProcessImport.cpp index ab95e8207d..0a50e37a35 100644 --- a/isis/src/base/objs/ProcessImport/ProcessImport.cpp +++ b/isis/src/base/objs/ProcessImport/ProcessImport.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include "Application.h" @@ -127,7 +127,7 @@ namespace Isis { p_pixelType = type; } else { - string msg = "Unsupported pixel type [" + + QString msg = "Unsupported pixel type [" + Isis::PixelTypeName(type) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -153,8 +153,8 @@ namespace Isis { p_nb = nb; } else { - string msg = "Illegal dimension [" + Isis::IString(ns) + ", " + - Isis::IString(nl) + ", " + Isis::IString(nb) + "]"; + QString msg = "Illegal dimension [" + toString(ns) + ", " + + toString(nl) + ", " + toString(nb) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } }; @@ -194,7 +194,7 @@ namespace Isis { p_fileHeaderBytes = bytes; } else { - string msg = "Illegal file header size [" + Isis::IString(bytes) + "]"; + QString msg = "Illegal file header size [" + toString(bytes) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } }; @@ -223,7 +223,7 @@ namespace Isis { p_fileTrailerBytes = bytes; } else { - string msg = "Illegal file trailer size [" + Isis::IString(bytes) + "]"; + QString msg = "Illegal file trailer size [" + toString(bytes) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } }; @@ -251,7 +251,7 @@ namespace Isis { p_dataHeaderBytes = bytes; } else { - string msg = "Illegal data header size [" + Isis::IString(bytes) + "]"; + QString msg = "Illegal data header size [" + toString(bytes) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } }; @@ -281,7 +281,7 @@ namespace Isis { p_dataTrailerBytes = bytes; } else { - string msg = "Illegal data trailer size [" + Isis::IString(bytes) + "]"; + QString msg = "Illegal data trailer size [" + toString(bytes) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } }; @@ -310,7 +310,7 @@ namespace Isis { p_dataPreBytes = bytes; } else { - string msg = "Illegal data prefix size [" + Isis::IString(bytes) + "]"; + QString msg = "Illegal data prefix size [" + toString(bytes) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } }; @@ -339,7 +339,7 @@ namespace Isis { p_dataPostBytes = bytes; } else { - string msg = "Illegal data suffix size [" + Isis::IString(bytes) + "]"; + QString msg = "Illegal data suffix size [" + toString(bytes) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } }; @@ -363,10 +363,9 @@ namespace Isis { */ void ProcessImport::SaveFileHeader() { if(p_fileHeaderBytes == 0) { - IString msg = "File header bytes equals 0. There is nothing to save. " + QString msg = "File header bytes equals 0. There is nothing to save. " "Use SetFileHeaderBytes() first."; - throw IException(IException::Programmer, msg.c_str(), - _FILEINFO_); + throw IException(IException::Programmer, msg, _FILEINFO_); } p_saveFileHeader = true; }; @@ -390,9 +389,9 @@ namespace Isis { */ void ProcessImport::SaveFileTrailer() { if(p_fileTrailerBytes == 0) { - IString msg = "File trailer bytes equals 0. There is nothing to save. " + QString msg = "File trailer bytes equals 0. There is nothing to save. " "Use SetFileTrailerBytes() first."; - throw IException(IException::Programmer, msg.c_str(), + throw IException(IException::Programmer, msg, _FILEINFO_); } p_saveFileTrailer = true; @@ -418,9 +417,9 @@ namespace Isis { */ void ProcessImport::SaveDataHeader() { if(p_dataHeaderBytes == 0) { - IString msg = "Data header bytes equals 0. There is nothing to save. " + QString msg = "Data header bytes equals 0. There is nothing to save. " "Use SetDataHeaderBytes() first."; - throw IException(IException::Programmer, msg.c_str(), + throw IException(IException::Programmer, msg, _FILEINFO_); } p_saveDataHeader = true; @@ -446,9 +445,9 @@ namespace Isis { */ void ProcessImport::SaveDataTrailer() { if(p_dataTrailerBytes == 0) { - IString msg = "Data trailer bytes equals 0. There is nothing to save. " + QString msg = "Data trailer bytes equals 0. There is nothing to save. " "Use SetDataTrailerBytes() first."; - throw IException(IException::Programmer, msg.c_str(), + throw IException(IException::Programmer, msg, _FILEINFO_); } p_saveDataTrailer = true; @@ -473,9 +472,9 @@ namespace Isis { */ void ProcessImport::SaveDataPrefix() { if(p_dataPreBytes == 0) { - IString msg = "Data prefix bytes equals 0. There is nothing to save. " + QString msg = "Data prefix bytes equals 0. There is nothing to save. " "Use SetDataPrefixBytes() first."; - throw IException(IException::Programmer, msg.c_str(), + throw IException(IException::Programmer, msg, _FILEINFO_); } p_saveDataPre = true; @@ -501,9 +500,9 @@ namespace Isis { */ void ProcessImport::SaveDataSuffix() { if(p_dataPostBytes == 0) { - IString msg = "Data suffix bytes equals 0. There is nothing to save. " + QString msg = "Data suffix bytes equals 0. There is nothing to save. " "Use SetDataSuffixBytes() first."; - throw IException(IException::Programmer, msg.c_str(), + throw IException(IException::Programmer, msg, _FILEINFO_); } p_saveDataPost = true; @@ -531,7 +530,7 @@ namespace Isis { if(p_saveFileHeader) { return p_fileHeader; } - std::string msg = "File header was not saved. Use SaveFileHeader()."; + QString msg = "File header was not saved. Use SaveFileHeader()."; throw IException(IException::Programmer, msg, _FILEINFO_); }; @@ -556,7 +555,7 @@ namespace Isis { if(p_saveFileTrailer) { return p_fileTrailer; } - std::string msg = "File trailer was not saved. Use SaveFileTrailer()"; + QString msg = "File trailer was not saved. Use SaveFileTrailer()"; throw IException(IException::Programmer, msg, _FILEINFO_); }; @@ -584,7 +583,7 @@ namespace Isis { if(p_saveDataHeader) { return p_dataHeader; } - std::string msg = "Data header was not saved. Use SaveDataHeader()"; + QString msg = "Data header was not saved. Use SaveDataHeader()"; throw IException(IException::Programmer, msg, _FILEINFO_); }; @@ -611,7 +610,7 @@ namespace Isis { if(p_saveDataTrailer) { return p_dataTrailer; } - std::string msg = "Data trailer was not saved. Use SaveDataTrailer()"; + QString msg = "Data trailer was not saved. Use SaveDataTrailer()"; throw IException(IException::Programmer, msg, _FILEINFO_); }; @@ -638,7 +637,7 @@ namespace Isis { if(p_saveDataPre) { return p_dataPre; } - std::string msg = "Data prefix was not saved. Use SaveDataPrefix()"; + QString msg = "Data prefix was not saved. Use SaveDataPrefix()"; throw IException(IException::Programmer, msg, _FILEINFO_); }; @@ -665,7 +664,7 @@ namespace Isis { if(p_saveDataPost) { return p_dataPost; } - std::string msg = "Data suffix was not saved. Use SaveDataSuffix()"; + QString msg = "Data suffix was not saved. Use SaveDataSuffix()"; throw IException(IException::Programmer, msg, _FILEINFO_); }; @@ -836,7 +835,7 @@ namespace Isis { * @param pixelMin The minimum value of the special pixel range * @param pixelMax The maximum value of the special pixel range */ - void ProcessImport::CheckPixelRange(std::string pixelName, double pixelMin, + void ProcessImport::CheckPixelRange(QString pixelName, double pixelMin, double pixelMax) { if(pixelMin == DBL_MAX || pixelMax == -DBL_MAX) return; @@ -845,9 +844,9 @@ namespace Isis { (pixelMax > p_null_min && pixelMax < p_null_max) || // --max crossing (pixelMin < p_null_min && pixelMax > p_null_max))) { // --straddling // values - string msg = "The " + pixelName + " range [" + IString(pixelMin) + - "," + IString(pixelMax) + "] overlaps the NULL range [" + - IString(p_null_min) + "," + IString(p_null_max) + "]"; + QString msg = "The " + pixelName + " range [" + toString(pixelMin) + + "," + toString(pixelMax) + "] overlaps the NULL range [" + + toString(p_null_min) + "," + toString(p_null_max) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -855,9 +854,9 @@ namespace Isis { (pixelMin > p_lrs_min && pixelMin < p_lrs_max) || (pixelMax > p_lrs_min && pixelMax < p_lrs_max) || (pixelMin < p_lrs_min && pixelMax > p_lrs_max))) { - string msg = "The " + pixelName + " range [" + IString(pixelMin) + - "," + IString(pixelMax) + "] overlaps the LRS range [" + - IString(p_lrs_min) + "," + IString(p_lrs_max) + "]"; + QString msg = "The " + pixelName + " range [" + toString(pixelMin) + + "," + toString(pixelMax) + "] overlaps the LRS range [" + + toString(p_lrs_min) + "," + toString(p_lrs_max) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -865,9 +864,9 @@ namespace Isis { (pixelMin > p_lis_min && pixelMin < p_lis_max) || (pixelMax > p_lis_min && pixelMax < p_lis_max) || (pixelMin < p_lis_min && pixelMax > p_lis_max))) { - string msg = "The " + pixelName + " range [" + IString(pixelMin) + - "," + IString(pixelMax) + "] overlaps the LIS range [" + - IString(p_lis_min) + "," + IString(p_lis_max) + "]"; + QString msg = "The " + pixelName + " range [" + toString(pixelMin) + + "," + toString(pixelMax) + "] overlaps the LIS range [" + + toString(p_lis_min) + "," + toString(p_lis_max) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -875,9 +874,9 @@ namespace Isis { (pixelMin > p_hrs_min && pixelMin < p_hrs_max) || (pixelMax > p_hrs_min && pixelMax < p_hrs_max) || (pixelMin < p_hrs_min && pixelMax > p_hrs_max))) { - string msg = "The " + pixelName + " range [" + IString(pixelMin) + - "," + IString(pixelMax) + "] overlaps the HRS range [" + - IString(p_hrs_min) + "," + IString(p_hrs_max) + "]"; + QString msg = "The " + pixelName + " range [" + toString(pixelMin) + + "," + toString(pixelMax) + "] overlaps the HRS range [" + + toString(p_hrs_min) + "," + toString(p_hrs_max) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -885,9 +884,9 @@ namespace Isis { (pixelMin > p_his_min && pixelMin < p_his_max) || (pixelMax > p_his_min && pixelMax < p_his_max) || (pixelMin < p_his_min && pixelMax > p_his_max))) { - string msg = "The " + pixelName + " range [" + IString(pixelMin) + - "," + IString(pixelMax) + "] overlaps the HIS range [" + - IString(p_his_min) + "," + IString(p_his_max) + "]"; + QString msg = "The " + pixelName + " range [" + toString(pixelMin) + + "," + toString(pixelMax) + "] overlaps the HIS range [" + + toString(p_his_min) + "," + toString(p_his_max) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -935,7 +934,7 @@ namespace Isis { * * @throws Isis::iException::Message "Unsupported pixel type." */ - Isis::Cube *ProcessImport::SetOutputCube(const std::string ¶meter) { + Isis::Cube *ProcessImport::SetOutputCube(const QString ¶meter) { CubeAttributeOutput &att = Application::GetUserInterface().GetOutputAttribute(parameter); @@ -959,7 +958,7 @@ namespace Isis { max = Isis::VALID_MAX1 * p_mult[0] + p_base[0]; } else { - string msg = "Unsupported pixel type [" + + QString msg = "Unsupported pixel type [" + Isis::PixelTypeName(p_pixelType) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -995,7 +994,7 @@ namespace Isis { * @throws Isis::iException::Message "File is not in a supported * organization." */ - Isis::Cube *ProcessImport::SetOutputCube(const std::string ¶meter, + Isis::Cube *ProcessImport::SetOutputCube(const QString ¶meter, Isis::CubeAttributeOutput &att) { return Isis::Process::SetOutputCube(parameter, att, p_ns, p_nl, p_nb); } @@ -1016,7 +1015,7 @@ namespace Isis { ProcessBip(); } else { - string msg = "File [" + p_inFile + QString msg = "File [" + p_inFile + "] is not in a supported organization."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1046,7 +1045,7 @@ namespace Isis { ProcessBip(funct); } else { - string msg = "File [" + p_inFile + "] is not in a supported organization."; + QString msg = "File [" + p_inFile + "] is not in a supported organization."; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -1069,17 +1068,17 @@ namespace Isis { char *in = new char [readBytes]; // Set up an Isis::EndianSwapper object - Isis::IString tok(Isis::ByteOrderName(p_byteOrder)); - tok.UpCase(); + QString tok(Isis::ByteOrderName(p_byteOrder)); + tok = tok.toUpper(); Isis::EndianSwapper swapper(tok); ifstream fin; // Open input file Isis::FileName inFile(p_inFile); - string inFileName(inFile.expanded()); - fin.open(inFileName.c_str(), ios::in | ios::binary); + QString inFileName(inFile.expanded()); + fin.open(inFileName.toAscii().data(), ios::in | ios::binary); if(!fin.is_open()) { - string msg = "Cannot open input file [" + p_inFile + "]"; + QString msg = "Cannot open input file [" + p_inFile + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1095,9 +1094,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1140,9 +1139,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1164,9 +1163,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataPreBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataPreBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1175,9 +1174,9 @@ namespace Isis { pos = fin.tellg(); fin.read(in, readBytes); if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(readBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(readBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1236,9 +1235,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataPreBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataPreBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } } // End line loop @@ -1267,9 +1266,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1287,9 +1286,9 @@ namespace Isis { // Check the io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileTrailerBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileTrailerBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1319,17 +1318,17 @@ namespace Isis { char *in = new char [readBytes]; // Set up an Isis::EndianSwapper object - Isis::IString tok(Isis::ByteOrderName(p_byteOrder)); - tok.UpCase(); + QString tok(Isis::ByteOrderName(p_byteOrder)); + tok = tok.toUpper(); Isis::EndianSwapper swapper(tok); ifstream fin; // Open input file Isis::FileName inFile(p_inFile); - string inFileName(inFile.expanded()); - fin.open(inFileName.c_str(), ios::in | ios::binary); + QString inFileName(inFile.expanded()); + fin.open(inFileName.toAscii().data(), ios::in | ios::binary); if(!fin.is_open()) { - string msg = "Cannot open input file [" + p_inFile + "]"; + QString msg = "Cannot open input file [" + p_inFile + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1345,9 +1344,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1384,9 +1383,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1406,9 +1405,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataPreBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataPreBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1417,9 +1416,9 @@ namespace Isis { pos = fin.tellg(); fin.read(in, readBytes); if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(readBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(readBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1475,9 +1474,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataPreBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataPreBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1496,9 +1495,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1518,9 +1517,9 @@ namespace Isis { // Check the io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileTrailerBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileTrailerBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1551,17 +1550,17 @@ namespace Isis { char *in = new char [readBytes]; // Set up an Isis::EndianSwapper object - Isis::IString tok(Isis::ByteOrderName(p_byteOrder)); - tok.UpCase(); + QString tok(Isis::ByteOrderName(p_byteOrder)); + tok = tok.toUpper(); Isis::EndianSwapper swapper(tok); ifstream fin; // Open input file Isis::FileName inFile(p_inFile); - string inFileName(inFile.expanded()); - fin.open(inFileName.c_str(), ios::in | ios::binary); + QString inFileName(inFile.expanded()); + fin.open(inFileName.toAscii().data(), ios::in | ios::binary); if(!fin.is_open()) { - string msg = "Cannot open input file [" + p_inFile + "]"; + QString msg = "Cannot open input file [" + p_inFile + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1577,9 +1576,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1603,9 +1602,9 @@ namespace Isis { for(int line = 0; line < p_nl; line++) { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1625,9 +1624,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataPreBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataPreBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1635,9 +1634,9 @@ namespace Isis { pos = fin.tellg(); fin.read(in, readBytes); if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(readBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(readBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1706,9 +1705,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_dataPreBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_dataPreBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1727,9 +1726,9 @@ namespace Isis { // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1751,9 +1750,9 @@ namespace Isis { // Check the io if(!fin.good()) { - string msg = "Cannot read file [" + p_inFile + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(p_fileTrailerBytes) + "]" ; + QString msg = "Cannot read file [" + p_inFile + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(p_fileTrailerBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1960,10 +1959,10 @@ namespace Isis { * * @throws Isis::iException::Message "File does not exist." */ - void ProcessImport::SetInputFile(const std::string &file) { + void ProcessImport::SetInputFile(const QString &file) { p_inFile = file; if(!Isis::FileName(file).fileExists()) { - string msg = "File [" + file + "] does not exist"; + QString msg = "File [" + file + "] does not exist"; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/base/objs/ProcessImport/ProcessImport.h b/isis/src/base/objs/ProcessImport/ProcessImport.h index da3935e214..744e4719b5 100644 --- a/isis/src/base/objs/ProcessImport/ProcessImport.h +++ b/isis/src/base/objs/ProcessImport/ProcessImport.h @@ -142,9 +142,9 @@ namespace Isis { ~ProcessImport(); void StartProcess(); void StartProcess(void funct(Isis::Buffer &out)); - void SetInputFile(const std::string &file); - Isis::Cube *SetOutputCube(const std::string ¶meter); - Isis::Cube *SetOutputCube(const std::string ¶meter, + void SetInputFile(const QString &file); + Isis::Cube *SetOutputCube(const QString ¶meter); + Isis::Cube *SetOutputCube(const QString ¶meter, Isis::CubeAttributeOutput &att); void SetPixelType(const Isis::PixelType type); /** @@ -253,7 +253,7 @@ namespace Isis { private: - std::string p_inFile; //!< Input file name + QString p_inFile; //!< Input file name Isis::PixelType p_pixelType; //!< Pixel type of input data int p_ns; //!< Number of samples int p_nl; //!< Number of lines @@ -361,7 +361,7 @@ namespace Isis { void ProcessBip(void funct(Isis::Buffer &out) = NULL); void ProcessJp2(void funct(Isis::Buffer &out) = NULL); - void CheckPixelRange(std::string pixelName, double min, double max); + void CheckPixelRange(QString pixelName, double min, double max); }; }; #endif diff --git a/isis/src/base/objs/ProcessImport/ProcessImport.truth b/isis/src/base/objs/ProcessImport/ProcessImport.truth index af35078562..d18ac678e0 100644 --- a/isis/src/base/objs/ProcessImport/ProcessImport.truth +++ b/isis/src/base/objs/ProcessImport/ProcessImport.truth @@ -1,4 +1,4 @@ -Testing Isis::ProcessImport Class ... +Testing ProcessImport Class ... unittest: Importing 0% Processed 10% Processed 20% Processed 30% Processed 40% Processed 50% Processed 60% Processed 70% Processed 80% Processed 90% Processed 100% Processed unittest: Gathering statistics diff --git a/isis/src/base/objs/ProcessImport/unitTest.cpp b/isis/src/base/objs/ProcessImport/unitTest.cpp index 1a139fdee6..3a2338dc61 100644 --- a/isis/src/base/objs/ProcessImport/unitTest.cpp +++ b/isis/src/base/objs/ProcessImport/unitTest.cpp @@ -1,21 +1,25 @@ #include "Isis.h" + +#include + #include "ProcessImport.h" #include "Cube.h" #include "Application.h" #include "Preference.h" #include "Statistics.h" +using namespace Isis; using namespace std; void IsisMain() { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - cout << "Testing Isis::ProcessImport Class ... " << endl; + cout << "Testing ProcessImport Class ... " << endl; - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::ProcessImport p; + ProcessImport p; p.SetInputFile("$base/testData/isisTruth.dat"); p.SetBase(0.0); p.SetMultiplier(1.0); @@ -25,92 +29,92 @@ void IsisMain() { p.SetDataTrailerBytes(0); p.SetDimensions(126, 126, 1); p.SetFileHeaderBytes(16384); - p.SetOrganization(Isis::ProcessImport::BSQ); - p.SetPixelType(Isis::Real); - p.SetByteOrder(Isis::Lsb); + p.SetOrganization(ProcessImport::BSQ); + p.SetPixelType(Real); + p.SetByteOrder(Lsb); p.SetOutputCube("TO"); p.StartProcess(); p.EndProcess(); - Isis::Process p2; - Isis::CubeAttributeInput att; - string file = Isis::Application::GetUserInterface().GetFileName("TO"); - Isis::Cube *icube = p2.SetInputCube(file, att); - Isis::Statistics *stat = icube->getStatistics(); + Process p2; + CubeAttributeInput att; + QString file = Application::GetUserInterface().GetFileName("TO"); + Cube *icube = p2.SetInputCube(file, att); + Statistics *stat = icube->getStatistics(); cout << endl << "Average: " << stat->Average() << endl; cout << endl << "Variance: " << stat->Variance() << endl; p2.EndProcess(); - remove(file.c_str()); + QFile::remove(file); cout << endl; //Checks the setting of special pixel ranges cout << "Check the settings of the special pixel ranges" << endl; - Isis::ProcessImport pNull; + ProcessImport pNull; pNull.SetNull(0.0, 45.0); try { // Should NOT throw an error pNull.SetNull(0.0, 45.0); } - catch(Isis::IException e) { + catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should throw an error pNull.SetLRS(35.0, 55.0); } - catch(Isis::IException e) { + catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should NOT throw an error pNull.SetLIS(50.0, 52.0); } - catch(Isis::IException e) { + catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should throw an error pNull.SetHRS(-10.0, 5.0); } - catch(Isis::IException e) { + catch(IException e) { cout << e.toString() << endl; } cout << endl; - Isis::ProcessImport pLRS; + ProcessImport pLRS; pLRS.SetLRS(10.0, 145.0); try { // Should throw an error pLRS.SetNull(35.0, 55.0); } - catch(Isis::IException e) { + catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should throw an error pNull.SetLIS(0.0, 15.0); } - catch(Isis::IException e) { + catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should throw an error pLRS.SetHIS(-10.0, 155.0); } - catch(Isis::IException e) { + catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should NOT throw an error pLRS.SetHIS(145.0, 155.0); } - catch(Isis::IException e) { + catch(IException e) { cout << e.toString() << endl; } cout << endl; cout << "Testing ProcessBil()" << endl; - Isis::ProcessImport p3; + ProcessImport p3; p3.SetInputFile("$base/testData/isisTruth.dat"); p3.SetBase(0.0); p3.SetMultiplier(1.0); @@ -120,15 +124,15 @@ void IsisMain() { p3.SetDataTrailerBytes(0); p3.SetDimensions(126, 126, 1); p3.SetFileHeaderBytes(16384); - p3.SetOrganization(Isis::ProcessImport::BIL); - p3.SetPixelType(Isis::Real); - p3.SetByteOrder(Isis::Lsb); + p3.SetOrganization(ProcessImport::BIL); + p3.SetPixelType(Real); + p3.SetByteOrder(Lsb); p3.SetOutputCube("TO"); p3.StartProcess(); p3.EndProcess(); cout << endl << "Testing ProcessBip()" << endl; - Isis::ProcessImport p4; + ProcessImport p4; p4.SetInputFile("$base/testData/isisTruth.dat"); p4.SetBase(0.0); p4.SetMultiplier(1.0); @@ -138,9 +142,9 @@ void IsisMain() { p4.SetDataTrailerBytes(0); p4.SetDimensions(126, 126, 1); p4.SetFileHeaderBytes(16384); - p4.SetOrganization(Isis::ProcessImport::BIP); - p4.SetPixelType(Isis::Real); - p4.SetByteOrder(Isis::Lsb); + p4.SetOrganization(ProcessImport::BIP); + p4.SetPixelType(Real); + p4.SetByteOrder(Lsb); p4.SetOutputCube("TO"); p4.StartProcess(); p4.EndProcess(); diff --git a/isis/src/base/objs/ProcessImportPds/ProcessImportPds.cpp b/isis/src/base/objs/ProcessImportPds/ProcessImportPds.cpp index b7d5fb052f..01650b0ef4 100644 --- a/isis/src/base/objs/ProcessImportPds/ProcessImportPds.cpp +++ b/isis/src/base/objs/ProcessImportPds/ProcessImportPds.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include "IException.h" @@ -56,7 +56,7 @@ namespace Isis { // Set up a translater for PDS file of type IMAGE Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); - p_transDir = (string) dataDir["Base"]; + p_transDir = (QString) dataDir["Base"]; } @@ -72,7 +72,7 @@ namespace Isis { * label. * * @param pdsDataFile The name of the PDS data file where the actual image/cube - * data is stored. This parameter can be an empty string, in + * data is stored. This parameter can be an empty QString, in * which case the label information will be searched to find * the data file name or the data will be assumed to be * after the label information. @@ -81,8 +81,8 @@ namespace Isis { * * @throws Isis::iException::Message */ - void ProcessImportPds::SetPdsFile(const std::string &pdsLabelFile, - const std::string &pdsDataFile, + void ProcessImportPds::SetPdsFile(const QString &pdsLabelFile, + const QString &pdsDataFile, Isis::Pvl &pdsLabel) { // Internalize the PDS label in the PVL that was passed in @@ -130,27 +130,27 @@ namespace Isis { Isis::PvlTranslationManager pdsXlater(p_pdsLabel, trnsStrm); // Check to see if we are dealing with a JPEG2000 file - Isis::IString str; + QString str; if(pdsXlater.InputHasKeyword("PdsEncodingType")) { str = pdsXlater.Translate("PdsEncodingType"); if(str == "JP2") { p_encodingType = JP2; str = pdsXlater.Translate("PdsCompressedFile"); - if(pdsDataFile.empty()) { + if(pdsDataFile.isEmpty()) { Isis::FileName lfile(p_labelFile); Isis::FileName ifile(lfile.path() + "/" + str); if(ifile.fileExists()) { p_jp2File = ifile.expanded(); } else { - string tmp = ifile.expanded(); - str.DownCase(); + QString tmp = ifile.expanded(); + str = str.toLower(); ifile = lfile.path() + "/" + str; if(ifile.fileExists()) { p_jp2File = ifile.expanded(); } else { - string msg = "Unable to find input file [" + tmp + "] or [" + + QString msg = "Unable to find input file [" + tmp + "] or [" + ifile.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -158,7 +158,7 @@ namespace Isis { } } else { - string msg = "Unsupported encoding type in [" + p_labelFile + "]"; + QString msg = "Unsupported encoding type in [" + p_labelFile + "]"; throw IException(IException::Io, msg, _FILEINFO_); } } @@ -174,7 +174,7 @@ namespace Isis { ProcessPdsQubeLabel(pdsDataFile, "pdsSpectralQube.trn"); } else { - string msg = "Unknown label type in [" + p_labelFile + "]"; + QString msg = "Unknown label type in [" + p_labelFile + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -193,9 +193,9 @@ namespace Isis { void ProcessImportPds::ProcessDataFilePointer(Isis::PvlTranslationManager & pdsXlater, const bool & calcOffsetOnly) { const PvlKeyword & dataFilePointer = pdsXlater.InputKeyword("DataFilePointer"); - Isis::IString dataFileName; - Isis::IString units; - Isis::IString str; + QString dataFileName; + QString units; + QString str; int offset = -1; // If only size 1, we either have a file name or an offset @@ -204,7 +204,7 @@ namespace Isis { if (dataFilePointer.Size() == 1) { try { str = pdsXlater.Translate("DataFilePointer"); - offset = str.ToInteger(); + offset = toInt(str); units = dataFilePointer.Unit(); // Successful? we have an offset, means current, p_labelFile // is the location of the data as well @@ -227,14 +227,14 @@ namespace Isis { } // Error, no value else if (dataFilePointer.Size() == 0) { - string msg = "Data file pointer ^IMAGE or ^QUBE has no value, must" + QString msg = "Data file pointer ^IMAGE or ^QUBE has no value, must" "have either file name or offset or both, in [" + p_labelFile + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } // Error, more than two values else { - string msg = "Improperly formatted data file pointer keyword ^IMAGE or " + QString msg = "Improperly formatted data file pointer keyword ^IMAGE or " "^QUBE, in [" + p_labelFile + "], must contain filename " " or offset or both"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -259,14 +259,14 @@ namespace Isis { } // Retry with downcased name, if still no luck, fail else { - string tmp = dataFile.expanded(); - dataFileName.DownCase(); + QString tmp = dataFile.expanded(); + dataFileName = dataFileName.toLower(); dataFile = FileName(labelFile.path() + "/" + dataFileName); if (dataFile.fileExists()) { SetInputFile(dataFile.expanded()); } else { - string msg = "Unable to find input file [" + tmp + "] or [" + + QString msg = "Unable to find input file [" + tmp + "] or [" + dataFile.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -274,13 +274,13 @@ namespace Isis { } // Now, to handle the offset - units.Trim(" \t\r\v\n"); + units = units.trimmed(); if (units == "BYTES" || units == "B") { SetFileHeaderBytes(offset - 1); } else { - Isis::IString recSize = pdsXlater.Translate("DataFileRecordBytes"); - SetFileHeaderBytes((offset - 1) * recSize.ToInteger()); + QString recSize = pdsXlater.Translate("DataFileRecordBytes"); + SetFileHeaderBytes((offset - 1) * toInt(recSize)); } } @@ -289,9 +289,9 @@ namespace Isis { * Calls SetPixelType with the correct values */ void ProcessImportPds::ProcessPixelBitandType(Isis::PvlTranslationManager & pdsXlater) { - IString str; + QString str; str = pdsXlater.Translate("CoreBitsPerPixel"); - int bitsPerPixel = str.ToInteger(); + int bitsPerPixel = toInt(str); str = pdsXlater.Translate("CorePixelType"); if((str == "Real") && (bitsPerPixel == 32)) { SetPixelType(Isis::Real); @@ -318,8 +318,8 @@ namespace Isis { SetPixelType(Isis::UnsignedInteger); } else { - string msg = "Invalid PixelType and BitsPerPixel combination [" + str + - ", " + Isis::IString(bitsPerPixel) + "]"; + QString msg = "Invalid PixelType and BitsPerPixel combination [" + str + + ", " + toString(bitsPerPixel) + "]"; throw IException(IException::Io, msg, _FILEINFO_); } } @@ -328,19 +328,19 @@ namespace Isis { * Handles all special pixel setting, ultimately, calls SetSpecialValues. */ void ProcessImportPds::ProcessSpecialPixels(Isis::PvlTranslationManager & pdsXlater, const bool & isQube) { - IString str; + QString str; // Set any special pixel values double pdsNull = Isis::NULL8; if(pdsXlater.InputHasKeyword("CoreNull")) { str = pdsXlater.Translate("CoreNull"); if(str != "NULL") { - pdsNull = str.ToDouble(); + pdsNull = toDouble(str); } } else if(!isQube && pdsXlater.InputHasKeyword("CoreNull2")) { str = pdsXlater.Translate("CoreNull2"); if(str != "NULL") { - pdsNull = str.ToDouble(); + pdsNull = toDouble(str); } } @@ -348,13 +348,13 @@ namespace Isis { if(pdsXlater.InputHasKeyword("CoreLrs")) { str = pdsXlater.Translate("CoreLrs"); if(str != "NULL") { - pdsLrs = str.ToDouble(); + pdsLrs = toDouble(str); } } else if(!isQube && pdsXlater.InputHasKeyword("CoreLrs2")) { str = pdsXlater.Translate("CoreLrs2"); if(str != "NULL") { - pdsLrs = str.ToDouble(); + pdsLrs = toDouble(str); } } @@ -362,13 +362,13 @@ namespace Isis { if(pdsXlater.InputHasKeyword("CoreLis")) { str = pdsXlater.Translate("CoreLis"); if(str != "NULL") { - pdsLis = str.ToDouble(); + pdsLis = toDouble(str); } } else if(!isQube && pdsXlater.InputHasKeyword("CoreLis2")) { str = pdsXlater.Translate("CoreLis2"); if(str != "NULL") { - pdsLis = str.ToDouble(); + pdsLis = toDouble(str); } } @@ -376,13 +376,13 @@ namespace Isis { if(pdsXlater.InputHasKeyword("CoreHrs")) { str = pdsXlater.Translate("CoreHrs"); if(str != "NULL") { - pdsHrs = str.ToDouble(); + pdsHrs = toDouble(str); } } else if(!isQube && pdsXlater.InputHasKeyword("CoreHrs2")) { str = pdsXlater.Translate("CoreHrs2"); if(str != "NULL") { - pdsHrs = str.ToDouble(); + pdsHrs = toDouble(str); } } @@ -390,13 +390,13 @@ namespace Isis { if(pdsXlater.InputHasKeyword("CoreHis")) { str = pdsXlater.Translate("CoreHis"); if(str != "NULL") { - pdsHis = str.ToDouble(); + pdsHis = toDouble(str); } } else if(!isQube && pdsXlater.InputHasKeyword("CoreHis2")) { str = pdsXlater.Translate("CoreHis2"); if(str != "NULL") { - pdsHis = str.ToDouble(); + pdsHis = toDouble(str); } } @@ -407,24 +407,24 @@ namespace Isis { * Process the PDS label of type IMAGE. * * @param pdsDataFile The name of the PDS data file where the actual image/cube - * data is stored. This parameter can be an empty string, in + * data is stored. This parameter can be an empty QString, in * which case the label information will be searched to find * the data file name or the data will be assumed to be * after the label information. * * @throws Isis::iException::Message */ - void ProcessImportPds::ProcessPdsImageLabel(const std::string &pdsDataFile) { + void ProcessImportPds::ProcessPdsImageLabel(const QString &pdsDataFile) { Isis::FileName transFile(p_transDir + "/translations/pdsImage.trn"); Isis::PvlTranslationManager pdsXlater(p_pdsLabel, transFile.expanded()); - Isis::IString str; + QString str; str = pdsXlater.Translate("CoreLinePrefixBytes"); - SetDataPrefixBytes(str.ToInteger()); + SetDataPrefixBytes(toInt(str)); str = pdsXlater.Translate("CoreLineSuffixBytes"); - SetDataSuffixBytes(str.ToInteger()); + SetDataSuffixBytes(toInt(str)); ProcessPixelBitandType(pdsXlater); @@ -432,11 +432,11 @@ namespace Isis { SetByteOrder(Isis::ByteOrderEnumeration(str)); str = pdsXlater.Translate("CoreSamples"); - int ns = str.ToInteger(); + int ns = toInt(str); str = pdsXlater.Translate("CoreLines"); - int nl = str.ToInteger(); + int nl = toInt(str); str = pdsXlater.Translate("CoreBands"); - int nb = str.ToInteger(); + int nb = toInt(str); SetDimensions(ns, nl, nb); // Set any special pixel values, not qube, so use false @@ -469,9 +469,9 @@ namespace Isis { // Find the image data base and multiplier //------------------------------------------------------------ str = pdsXlater.Translate("CoreBase"); - SetBase(str.ToDouble()); + SetBase(toDouble(str)); str = pdsXlater.Translate("CoreMultiplier"); - SetMultiplier(str.ToDouble()); + SetMultiplier(toDouble(str)); // Find the organization of the image data str = pdsXlater.Translate("CoreOrganization"); @@ -489,7 +489,7 @@ namespace Isis { SetOrganization(ProcessImport::BIL); } else { - string msg = "Unsupported axis order [" + str + "]"; + QString msg = "Unsupported axis order [" + str + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -499,7 +499,7 @@ namespace Isis { * Process the PDS label of type QUBE or SPECTRALQUBE. * * @param pdsDataFile The name of the PDS data file where the actual image/cube - * data is stored. This parameter can be an empty string, in + * data is stored. This parameter can be an empty QString, in * which case the label information will be searched to find * the data file name or the data will be assumed to be * after the label information. @@ -511,14 +511,14 @@ namespace Isis { * @history 2010-12-09 Sharmila Prasad - Set default offset to be 1 for detatched label * and offset not set */ - void ProcessImportPds::ProcessPdsQubeLabel(const std::string &pdsDataFile, - const std::string &transFile) { + void ProcessImportPds::ProcessPdsQubeLabel(const QString &pdsDataFile, + const QString &transFile) { Isis::FileName tFile(p_transDir + "/translations/" + transFile); Isis::PvlTranslationManager pdsXlater(p_pdsLabel, tFile.expanded()); - Isis::IString str; + QString str; // Find the organization of the image data // Save off which axis the samples, lines and bands are on @@ -526,7 +526,7 @@ namespace Isis { int samplePos = 0; int bandPos = 0; int val = pdsXlater.InputKeyword("CoreOrganization").Size(); - Isis::IString tmp = ""; + QString tmp = ""; for(int i = 0; i < val; i++) { str = pdsXlater.Translate("CoreOrganization", i); tmp += str; @@ -540,7 +540,7 @@ namespace Isis { bandPos = i; } else { - string message = "Unknown file axis name [" + str + "]"; + QString message = "Unknown file axis name [" + str + "]"; throw IException(IException::User, message, _FILEINFO_); } } @@ -558,12 +558,13 @@ namespace Isis { SetOrganization(ProcessImport::BIL); } else { - PvlKeyword pdsCoreOrg = p_pdsLabel.FindKeyword(pdsXlater. InputKeywordName("CoreOrganization"), Pvl::Traverse); + PvlKeyword pdsCoreOrg = p_pdsLabel.FindKeyword(pdsXlater. + InputKeywordName("CoreOrganization"), Pvl::Traverse); stringstream pdsCoreOrgStream; pdsCoreOrgStream << pdsCoreOrg; - string msg = "Unsupported axis order [" + pdsCoreOrgStream.str() + "]"; + QString msg = "Unsupported axis order [" + QString(pdsCoreOrgStream.str().c_str()) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -574,17 +575,17 @@ namespace Isis { // Set the number of bytes following the second dimension (right side plane) str = pdsXlater.Translate("SuffixItemSize"); - int suffix = str.ToInteger(); + int suffix = toInt(str); str = pdsXlater.Translate("AxisSuffixCount", 0); - suffix *= str.ToInteger(); + suffix *= toInt(str); SetDataSuffixBytes(suffix); str = pdsXlater.Translate("SuffixItemSize"); - int trailer = str.ToInteger(); + int trailer = toInt(str); str = pdsXlater.Translate("AxisSuffixCount", 1); - trailer *= str.ToInteger(); + trailer *= toInt(str); str = pdsXlater.Translate("CoreSamples", samplePos); - trailer *= str.ToInteger(); + trailer *= toInt(str); trailer += suffix; SetDataTrailerBytes(trailer); @@ -596,11 +597,11 @@ namespace Isis { // Set the number of samples, lines and bands str = pdsXlater.Translate("CoreSamples", samplePos); - int ns = str.ToInteger(); + int ns = toInt(str); str = pdsXlater.Translate("CoreLines", linePos); - int nl = str.ToInteger(); + int nl = toInt(str); str = pdsXlater.Translate("CoreBands", bandPos); - int nb = str.ToInteger(); + int nb = toInt(str); SetDimensions(ns, nl, nb); // Set any special pixels values, qube, so use true @@ -638,18 +639,18 @@ namespace Isis { vector mults; for(int i = 0; i < pdsXlater.InputKeyword("BandBase").Size(); i++) { str = pdsXlater.Translate("BandBase", i); - bases.push_back(str.ToDouble()); + bases.push_back(toDouble(str)); str = pdsXlater.Translate("BandMultiplier", i); - mults.push_back(str.ToDouble()); + mults.push_back(toDouble(str)); } SetBase(bases); SetMultiplier(mults); } else { str = pdsXlater.Translate("CoreBase"); - SetBase(str.ToDouble()); + SetBase(toDouble(str)); str = pdsXlater.Translate("CoreMultiplier"); - SetMultiplier(str.ToDouble()); + SetMultiplier(toDouble(str)); } } @@ -688,7 +689,7 @@ namespace Isis { // Set up the correct projection translation table for this label Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); - Isis::IString transDir = (string) dataDir["Base"]; + QString transDir = (QString) dataDir["Base"]; Isis::FileName transFile; if(projType.InputHasKeyword("PdsProjectionTypeImage")) { @@ -711,44 +712,44 @@ namespace Isis { Isis::PvlGroup mapGroup("Mapping"); mapGroup += Isis::PvlKeyword("ProjectionName", p_projection); mapGroup += Isis::PvlKeyword("TargetName", p_targetName); - mapGroup += Isis::PvlKeyword("EquatorialRadius", p_equatorialRadius, "meters"); - mapGroup += Isis::PvlKeyword("PolarRadius", p_polarRadius, "meters"); + mapGroup += Isis::PvlKeyword("EquatorialRadius", toString(p_equatorialRadius), "meters"); + mapGroup += Isis::PvlKeyword("PolarRadius", toString(p_polarRadius), "meters"); mapGroup += Isis::PvlKeyword("LongitudeDirection", p_longitudeDirection); - mapGroup += Isis::PvlKeyword("LongitudeDomain", p_longitudeDomain); + mapGroup += Isis::PvlKeyword("LongitudeDomain", toString(p_longitudeDomain)); mapGroup += Isis::PvlKeyword("LatitudeType", p_latitudeType); if(p_minimumLatitude != Isis::NULL8) { - mapGroup += Isis::PvlKeyword("MinimumLatitude", p_minimumLatitude); + mapGroup += Isis::PvlKeyword("MinimumLatitude", toString(p_minimumLatitude)); } if(p_maximumLatitude != Isis::NULL8) { - mapGroup += Isis::PvlKeyword("MaximumLatitude", p_maximumLatitude); + mapGroup += Isis::PvlKeyword("MaximumLatitude", toString(p_maximumLatitude)); } if(p_minimumLongitude != Isis::NULL8) { - mapGroup += Isis::PvlKeyword("MinimumLongitude", p_minimumLongitude); + mapGroup += Isis::PvlKeyword("MinimumLongitude", toString(p_minimumLongitude)); } if(p_maximumLongitude != Isis::NULL8) { - mapGroup += Isis::PvlKeyword("MaximumLongitude", p_maximumLongitude); + mapGroup += Isis::PvlKeyword("MaximumLongitude", toString(p_maximumLongitude)); } // if both longitudes exist, verify they are ordered correctly if(p_minimumLongitude != Isis::NULL8 && p_maximumLongitude != Isis::NULL8) { if(p_maximumLongitude <= p_minimumLongitude) { if(p_longitudeDomain == 180) { - mapGroup["MinimumLongitude"] = -180; - mapGroup["MaximumLongitude"] = 180; + mapGroup["MinimumLongitude"] = toString(-180); + mapGroup["MaximumLongitude"] = toString(180); } else { - mapGroup["MinimumLongitude"] = 0; - mapGroup["MaximumLongitude"] = 360; + mapGroup["MinimumLongitude"] = toString(0); + mapGroup["MaximumLongitude"] = toString(360); } } } - mapGroup += Isis::PvlKeyword("PixelResolution", p_pixelResolution, "meters/pixel"); - mapGroup += Isis::PvlKeyword("Scale", p_scaleFactor, "pixels/degree"); - mapGroup += Isis::PvlKeyword("UpperLeftCornerX", p_upperLeftX, "meters"); - mapGroup += Isis::PvlKeyword("UpperLeftCornerY", p_upperLeftY, "meters"); + mapGroup += Isis::PvlKeyword("PixelResolution", toString(p_pixelResolution), "meters/pixel"); + mapGroup += Isis::PvlKeyword("Scale", toString(p_scaleFactor), "pixels/degree"); + mapGroup += Isis::PvlKeyword("UpperLeftCornerX", toString(p_upperLeftX), "meters"); + mapGroup += Isis::PvlKeyword("UpperLeftCornerY", toString(p_upperLeftY), "meters"); if(p_rotation != 0.0) { - mapGroup += Isis::PvlKeyword("Rotation", p_rotation); + mapGroup += Isis::PvlKeyword("Rotation", toString(p_rotation)); } // To handle new projections without the need to modify source code @@ -756,7 +757,7 @@ namespace Isis { // contain the projection specific translations from PDS to ISIS for each // projection - string projSpecificFileName = "$base/translations/pdsImport"; + QString projSpecificFileName = "$base/translations/pdsImport"; projSpecificFileName += p_projection + ".trn"; Isis::PvlTranslationManager specificXlater(p_pdsLabel, projSpecificFileName); @@ -766,17 +767,17 @@ namespace Isis { if(lab.FindGroup("Mapping").HasKeyword("CenterLongitude")) { PvlKeyword ¢erLon = lab.FindGroup("Mapping")["CenterLongitude"]; if(p_longitudeDomain == 180) - centerLon = Projection::To180Domain((double)centerLon); + centerLon = toString(Projection::To180Domain((double)centerLon)); else - centerLon = Projection::To360Domain((double)centerLon); + centerLon = toString(Projection::To360Domain((double)centerLon)); } if(lab.FindGroup("Mapping").HasKeyword("PoleLongitude")) { PvlKeyword &poleLon = lab.FindGroup("Mapping")["PoleLongitude"]; if(p_longitudeDomain == 180) - poleLon = Projection::To180Domain((double)poleLon); + poleLon = toString(Projection::To180Domain((double)poleLon)); else - poleLon = Projection::To360Domain((double)poleLon); + poleLon = toString(Projection::To360Domain((double)poleLon)); } OutputCubes[0]->putGroup(lab.FindGroup("Mapping")); @@ -808,13 +809,13 @@ namespace Isis { */ void ProcessImportPds::ExtractPdsProjection(Isis::PvlTranslationManager &pdsXlater) { - Isis::IString str; + QString str; if(pdsXlater.InputHasKeyword("ProjectionName")) { p_projection = pdsXlater.Translate("ProjectionName"); } else { - string message = "No projection name in labels"; + QString message = "No projection name in labels"; throw IException(IException::Unknown, message, _FILEINFO_); } @@ -822,25 +823,25 @@ namespace Isis { p_targetName = pdsXlater.Translate("TargetName"); } else { - string message = "No target name in labels"; + QString message = "No target name in labels"; throw IException(IException::Unknown, message, _FILEINFO_); } if(pdsXlater.InputHasKeyword("EquatorialRadius")) { str = pdsXlater.Translate("EquatorialRadius"); - p_equatorialRadius = str.ToDouble() * 1000.0; + p_equatorialRadius = toDouble(str) * 1000.0; } else { - string message = "No equatorial radius name in labels"; + QString message = "No equatorial radius name in labels"; throw IException(IException::User, message, _FILEINFO_); } if(pdsXlater.InputHasKeyword("PolarRadius")) { str = pdsXlater.Translate("PolarRadius"); - p_polarRadius = str.ToDouble() * 1000.0; + p_polarRadius = toDouble(str) * 1000.0; } else { - string message = "No polar radius in labels"; + QString message = "No polar radius in labels"; throw IException(IException::User, message, _FILEINFO_); } @@ -864,7 +865,7 @@ namespace Isis { if(pdsXlater.InputHasKeyword("MinimumLatitude")) { str = pdsXlater.Translate("MinimumLatitude"); try { - p_minimumLatitude = str.ToDouble(); + p_minimumLatitude = toDouble(str); } catch(IException &e) { p_minimumLatitude = Isis::NULL8; @@ -877,7 +878,7 @@ namespace Isis { if(pdsXlater.InputHasKeyword("MaximumLatitude")) { str = pdsXlater.Translate("MaximumLatitude"); try { - p_maximumLatitude = str.ToDouble(); + p_maximumLatitude = toDouble(str); } catch(IException &e) { p_maximumLatitude = Isis::NULL8; @@ -894,7 +895,7 @@ namespace Isis { str = pdsXlater.Translate("MinimumLongitude"); try { positiveWest = true; - p_minimumLongitude = str.ToDouble(); + p_minimumLongitude = toDouble(str); } catch(IException &e) { p_minimumLongitude = Isis::NULL8; @@ -903,7 +904,7 @@ namespace Isis { else if(pdsXlater.InputHasKeyword("MinimumLongitude2")) { str = pdsXlater.Translate("MinimumLongitude2"); try { - p_minimumLongitude = str.ToDouble(); + p_minimumLongitude = toDouble(str); } catch(IException &e) { p_minimumLongitude = Isis::NULL8; @@ -917,7 +918,7 @@ namespace Isis { str = pdsXlater.Translate("MaximumLongitude"); try { positiveWest = true; - p_maximumLongitude = str.ToDouble(); + p_maximumLongitude = toDouble(str); } catch(IException &e) { p_maximumLongitude = Isis::NULL8; @@ -926,7 +927,7 @@ namespace Isis { else if(pdsXlater.InputHasKeyword("MaximumLongitude2")) { str = pdsXlater.Translate("MaximumLongitude2"); try { - p_maximumLongitude = str.ToDouble(); + p_maximumLongitude = toDouble(str); } catch(IException &e) { p_maximumLongitude = Isis::NULL8; @@ -937,7 +938,7 @@ namespace Isis { } str = pdsXlater.Translate("LongitudeDomain"); - p_longitudeDomain = str.ToInteger(); + p_longitudeDomain = toInt(str); /** * The input file does not have a longitude domain. @@ -976,20 +977,19 @@ namespace Isis { } str = pdsXlater.Translate("PixelResolution"); - p_pixelResolution = str.ToDouble(); - str = pdsXlater.InputKeyword("PixelResolution").Unit(); - str.UpCase(); + p_pixelResolution = toDouble(str); + str = pdsXlater.InputKeyword("PixelResolution").Unit().toUpper(); // Assume KM/PIXEL if the unit doesn't exist or is not METERS/PIXEL if((str != "METERS/PIXEL") && (str != "M/PIXEL") && (str != "M/PIX")) { p_pixelResolution *= 1000.0; } str = pdsXlater.Translate("Scale"); - p_scaleFactor = str.ToDouble(); + p_scaleFactor = toDouble(str); try { str = pdsXlater.Translate("Rotation"); - p_rotation = str.ToDouble(); + p_rotation = toDouble(str); } catch(IException &) { // assume no rotation if the value isn't a number @@ -1006,7 +1006,7 @@ namespace Isis { else { str = pdsXlater.Translate("LineProjectionOffset2"); } - p_lineProjectionOffset = str.ToDouble(); + p_lineProjectionOffset = toDouble(str); p_upperLeftY = ymult * (p_lineProjectionOffset + yoff) * p_pixelResolution; if(pdsXlater.InputHasKeyword("SampleProjectionOffset")) { @@ -1015,7 +1015,7 @@ namespace Isis { else { str = pdsXlater.Translate("SampleProjectionOffset2"); } - p_sampleProjectionOffset = str.ToDouble(); + p_sampleProjectionOffset = toDouble(str); p_upperLeftX = xmult * (p_sampleProjectionOffset + xoff) * p_pixelResolution; @@ -1135,7 +1135,7 @@ namespace Isis { void ProcessImportPds::TranslateIsis2BandBin(Isis::Pvl &lab) { // Set up a translater for Isis2 labels Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); - Isis::IString transDir = (string) dataDir["Base"]; + QString transDir = (QString) dataDir["Base"]; Isis::FileName transFile(transDir + "/" + "translations/isis2bandbin.trn"); Isis::PvlTranslationManager isis2Xlater(p_pdsLabel, transFile.expanded()); @@ -1153,7 +1153,7 @@ namespace Isis { void ProcessImportPds::TranslateIsis2Instrument(Isis::Pvl &lab) { // Set up a translater for Isis2 labels Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); - Isis::IString transDir = (string) dataDir["Base"]; + QString transDir = (QString) dataDir["Base"]; Isis::FileName transFile(transDir + "/" + "translations/isis2instrument.trn"); Isis::PvlTranslationManager isis2Xlater(p_pdsLabel, transFile.expanded()); @@ -1165,8 +1165,8 @@ namespace Isis { if(inst.HasKeyword("StartTime")) { Isis::PvlKeyword &stkey = inst["StartTime"]; - Isis::IString stime = stkey[0]; - stime = stime.Trim("Zz"); + QString stime = stkey[0]; + stime = stime.remove(QRegExp("[Zz]$")); stkey = stime; } } @@ -1228,12 +1228,12 @@ namespace Isis { Pvl::Traverse); for(int g = 0; g < projDef.Groups(); g++) { - string key = projDef.Group(g)["Keyword"]; + QString key = projDef.Group(g)["Keyword"]; if(p_pdsLabel.HasKeyword(key)) { - string value = p_pdsLabel[key]; - string pattern = projDef.Group(g)["Pattern"]; + QString value = p_pdsLabel[key]; + QString pattern = projDef.Group(g)["Pattern"]; // If value contains pattern, then set the mults to what is in translation file - if(value.find(pattern) != std::string::npos) { + if(value.contains(pattern)) { xmult = projDef.Group(g)["xMult"]; ymult = projDef.Group(g)["yMult"]; xoff = projDef.Group(g)["xOff"]; @@ -1251,16 +1251,16 @@ namespace Isis { * * @param pdsTableName Name of the PDS table object to be imported. */ - void ProcessImportPds::ImportTable(IString pdsTableName) { + void ProcessImportPds::ImportTable(QString pdsTableName) { // No table file given, let ImportPdsTable find it. ImportPdsTable pdsTable(p_labelFile, "", pdsTableName); // reformat the table name. If the name ends with the word "Table", remove // it. (So, for example, INSTRUMENT_POINTING_TABLE gets formatted to // InstrumentPointingTable and then to InstrumentPointing) - IString isisTableName = pdsTable.getFormattedName(pdsTableName); - size_t found = isisTableName.rfind("Table"); + QString isisTableName = pdsTable.getFormattedName(pdsTableName); + int found = isisTableName.lastIndexOf("Table"); if (found == isisTableName.length() - 5) { - isisTableName.erase(found, 5); + isisTableName.remove(found, 5); } Table isisTable = pdsTable.importTable(isisTableName); diff --git a/isis/src/base/objs/ProcessImportPds/ProcessImportPds.h b/isis/src/base/objs/ProcessImportPds/ProcessImportPds.h index fd28fa125b..fbc4c7e1cc 100644 --- a/isis/src/base/objs/ProcessImportPds/ProcessImportPds.h +++ b/isis/src/base/objs/ProcessImportPds/ProcessImportPds.h @@ -27,7 +27,7 @@ #include #include "Pvl.h" -#include "IString.h" +#include namespace Isis { class PvlTranslationManager; @@ -189,7 +189,7 @@ namespace Isis { public: ProcessImportPds(); ~ProcessImportPds(); - void SetPdsFile(const std::string &pdsLabelFile, const std::string &pdsDataFile, + void SetPdsFile(const QString &pdsLabelFile, const QString &pdsDataFile, Pvl &pdsLabel); void TranslatePdsProjection(Pvl &lab); @@ -200,7 +200,7 @@ namespace Isis { void OmitOriginalLabel(); - void ImportTable(IString pdsTableName); + void ImportTable(QString pdsTableName); // since we are overriding StartProcess(), we must specify for other // overloaded calls to StartProcess(), the ProcessImport class method // definitions should be used. @@ -227,8 +227,8 @@ namespace Isis { void ProcessPixelBitandType(PvlTranslationManager & pdsXlater); void ProcessSpecialPixels(PvlTranslationManager & pdsXlater, const bool & isQube); - void ProcessPdsImageLabel(const std::string &pdsDataFile); - void ProcessPdsQubeLabel(const std::string &pdsDataFile, const std::string &transFile); + void ProcessPdsImageLabel(const QString &pdsDataFile); + void ProcessPdsQubeLabel(const QString &pdsDataFile, const QString &transFile); void ExtractPdsProjection(PvlTranslationManager &pdsXlater); void GetProjectionOffsetMults(double &xoff, double &yoff, @@ -242,30 +242,30 @@ namespace Isis { void TranslatePdsArchive(Pvl &lab); Pvl p_pdsLabel; //!< Internalized PDS label - std::string p_labelFile; //!< The filename where the PDS label came from + QString p_labelFile; //!< The filename where the PDS label came from - IString p_transDir; //!< Base data directory + QString p_transDir; //!< Base data directory // Encoding info EncodingType p_encodingType; /**< The encoding type of the image data. The only encoding type currently supported is JP2 (JPEG2000).*/ - std::string p_jp2File; /**< The name of the file containing the + QString p_jp2File; /**< The name of the file containing the encoded JP2 data.*/ // Projection info - std::string p_projection; /**< The name of the projection found in + QString p_projection; /**< The name of the projection found in the PDS projection labels*/ - std::string p_targetName; //!< + QString p_targetName; //!< double p_equatorialRadius; /**< Equatorial radius found in the PDS projection labels*/ double p_polarRadius; /**< The polar radius found in the PDS projection labels*/ - std::string p_longitudeDirection; /**< Longitude direction found in the + QString p_longitudeDirection; /**< Longitude direction found in the PDS projection labels*/ int p_longitudeDomain; /**< Longitude domain found in the PDS projection labels*/ - std::string p_latitudeType; /**< The latitude type found in the PDS + QString p_latitudeType; /**< The latitude type found in the PDS projection labels*/ double p_minimumLatitude; /**< Minimum latitude found in the PDS projection labels*/ diff --git a/isis/src/base/objs/ProcessImportPds/ProcessImportPds.truth b/isis/src/base/objs/ProcessImportPds/ProcessImportPds.truth index 930c708fd8..ec87bf2575 100644 --- a/isis/src/base/objs/ProcessImportPds/ProcessImportPds.truth +++ b/isis/src/base/objs/ProcessImportPds/ProcessImportPds.truth @@ -952,10 +952,9 @@ isisimportpds: Gathering statistics 0% Processed 10% Processed 20% Processed 30% Processed 40% Processed 50% Processed 60% Processed 70% Processed 80% Processed 90% Processed 100% Processed 687.556 282178 -**I/O ERROR** Unable to open OriginalLabel [IsisCube] in file [./unitTest.cub]. -**I/O ERROR** Unable to read OriginalLabel [IsisCube]. -**PROGRAMMER ERROR** Unable to find OriginalLabel [IsisCube]. - +**I/O ERROR** Unable to open OriginalLabel [] in file []. +**I/O ERROR** Unable to read OriginalLabel []. +**PROGRAMMER ERROR** Unable to find OriginalLabel []. Testing Isis2 file isisimportpds: Importing diff --git a/isis/src/base/objs/ProcessImportPds/unitTest.cpp b/isis/src/base/objs/ProcessImportPds/unitTest.cpp index 670c0ef71b..28b3f52aa8 100644 --- a/isis/src/base/objs/ProcessImportPds/unitTest.cpp +++ b/isis/src/base/objs/ProcessImportPds/unitTest.cpp @@ -1,4 +1,7 @@ #include "Isis.h" + +#include + #include "ProcessImportPds.h" #include "Application.h" #include "IString.h" @@ -15,7 +18,7 @@ using namespace Isis; void IsisMain() { Isis::Preference::Preferences(true); - void ReportError(IString err); + void ReportError(QString err); // Test an IMAGE file try { @@ -30,7 +33,7 @@ void IsisMain() { cout << plab << endl; Isis::Process p2; Isis::CubeAttributeInput att; - string file = Isis::Application::GetUserInterface().GetFileName("TO"); + QString file = Isis::Application::GetUserInterface().GetFileName("TO"); Isis::Cube *cube = p2.SetInputCube(file, att); Isis::Statistics *stat = cube->getStatistics(); cout << stat->Average() << endl; @@ -39,7 +42,7 @@ void IsisMain() { Isis::OriginalLabel ol(file); Isis::Pvl label = ol.ReturnLabels(); cout << label << endl; - remove(file.c_str()); + QFile::remove(file); } catch(Isis::IException &e) { e.print(); @@ -60,7 +63,7 @@ void IsisMain() { cout << plab << endl; Isis::Process p2; Isis::CubeAttributeInput att; - string file = Isis::Application::GetUserInterface().GetFileName("TO"); + QString file = Isis::Application::GetUserInterface().GetFileName("TO"); Isis::Cube *cube = p2.SetInputCube(file, att); Isis::Statistics *stat = cube->getStatistics(); cout << stat->Average() << endl; @@ -74,7 +77,7 @@ void IsisMain() { catch(Isis::IException &e) { ReportError(e.toString()); } - remove(file.c_str()); + QFile::remove(file); } catch(Isis::IException &e) { e.print(); @@ -95,8 +98,8 @@ void IsisMain() { p.EndProcess(); cout << ilab << endl; - string file = Isis::Application::GetUserInterface().GetFileName("TO"); - remove(file.c_str()); + QString file = Isis::Application::GetUserInterface().GetFileName("TO"); + QFile::remove(file); } catch(Isis::IException &e) { e.print(); @@ -116,7 +119,7 @@ void IsisMain() { cout << plab << endl; Isis::Process p2; Isis::CubeAttributeInput att; - string file = Isis::Application::GetUserInterface().GetFileName("TO"); + QString file = Isis::Application::GetUserInterface().GetFileName("TO"); Isis::Cube *cube = p2.SetInputCube(file, att); Pvl isisCubeLab = *(cube->getLabel()); (isisCubeLab.FindObject("IsisCube").FindObject("Core")["StartByte"]).SetValue(""); @@ -134,7 +137,7 @@ void IsisMain() { Isis::OriginalLabel ol(file); Isis::Pvl label = ol.ReturnLabels(); cout << label << endl; - remove(file.c_str()); + QFile::remove(file); } catch(Isis::IException &e) { e.print(); @@ -155,46 +158,12 @@ void IsisMain() { /** * Reports error messages from Isis:iException without full paths of filenames - * @param err Error string of iException + * @param err Error QString of iException * @author Jeannie Walldren * @internal * @history 2011-08-05 Jeannie Backer - Copied from Cube class. */ -void ReportError(IString err) { - IString report = ""; // report will be modified error message - IString errorLine = ""; // read message one line at a time - FileName expandedfile; - while(err != "") { - // pull off first line - errorLine = err.Token("\n"); - while(errorLine != "") { - size_t openBrace = errorLine.find('['); - if(openBrace != string::npos) { - // if open brace is found, look to see if a filename is inside (indicated by '/') - if(errorLine.at(openBrace + 1) == '/') { - // add message up to and including [ - report += errorLine.Token("["); - report += "["; - // read entire path into FileName object - expandedfile = errorLine.Token("]"); - report += expandedfile.name(); // only report base name, rather than fully expanded path - report += "]"; - } - else { - // not a filename inside braces, add message up to and including ] - report += errorLine.Token("]"); - report += "]"; - continue; - } - } - else { - // no more braces are found, add rest of error message - report += errorLine; - break; - } - } - report += "\n"; - } - cout << report << endl; +void ReportError(QString err) { + cout << err.replace(QRegExp("\\[[^\\]]*\\]"), "[]") << endl; } diff --git a/isis/src/base/objs/ProcessImportVicar/ProcessImportVicar.cpp b/isis/src/base/objs/ProcessImportVicar/ProcessImportVicar.cpp index a0eb7cf13b..7889735d8c 100644 --- a/isis/src/base/objs/ProcessImportVicar/ProcessImportVicar.cpp +++ b/isis/src/base/objs/ProcessImportVicar/ProcessImportVicar.cpp @@ -23,7 +23,7 @@ #include "ProcessImportVicar.h" #include -#include +#include #include #include "Preference.h" @@ -45,12 +45,12 @@ namespace Isis { * @param vicarFile Name of the vicar file to open * @param vicarLab A PVL object which will contain the vicar labels. */ - void ProcessImportVicar::SetVicarFile(const std::string &vicarFile, Pvl &vicarLab) { + void ProcessImportVicar::SetVicarFile(const QString &vicarFile, Pvl &vicarLab) { // Open vicar file - ifstream vicFile(vicarFile.c_str(), ios::in); + ifstream vicFile(vicarFile.toAscii().data(), ios::in); if(!vicFile) { - string msg = "Cannot open vicar file [" + vicarFile + "]"; + QString msg = "Cannot open vicar file [" + vicarFile + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -77,18 +77,18 @@ namespace Isis { SetDimensions(vLab["NS"], vLab["NL"], vLab["NB"]); - string pixType = vLab["FORMAT"]; + QString pixType = vLab["FORMAT"]; Isis::PixelType pixelType = None; if(pixType == "BYTE") pixelType = UnsignedByte; if(pixType == "HALF") pixelType = SignedWord; if(pixType == "REAL") pixelType = Real; if(pixelType == None) { - string msg = "Unsupported pixel type [FORMAT=" + pixType + "]"; + QString msg = "Unsupported pixel type [FORMAT=" + pixType + "]"; throw IException(IException::Io, msg, _FILEINFO_); } SetPixelType(pixelType); - string order = vLab["INTFMT"]; + QString order = vLab["INTFMT"]; if(order == "LOW") { SetByteOrder(Lsb); } @@ -96,7 +96,7 @@ namespace Isis { SetByteOrder(Msb); } - string organization = vLab["ORG"]; + QString organization = vLab["ORG"]; if(organization == "BSQ") { SetOrganization(ProcessImport::BSQ); } @@ -107,7 +107,7 @@ namespace Isis { SetOrganization(ProcessImport::BIP); } else { - string msg = "Unsupported file organization [" + organization + "]"; + QString msg = "Unsupported file organization [" + organization + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -119,9 +119,9 @@ namespace Isis { (int) vLab["NLB"] * (int) vLab["RECSIZE"] + (int) vLab["NL"] * (int) vLab["NB"] * (int) vLab["RECSIZE"]; - ifstream vicFile(vicarFile.c_str(), ios::in); + ifstream vicFile(vicarFile.toAscii().data(), ios::in); - IString endPvlLabel = ExtractPvlLabel(startByte, vicFile); + QString endPvlLabel = ExtractPvlLabel(startByte, vicFile); stringstream lbl; lbl << endPvlLabel; @@ -136,7 +136,7 @@ namespace Isis { } } catch(IException &e) { - string msg = "Input file [" + vicarFile + "] does not appear to be a vicar file"; + QString msg = "Input file [" + vicarFile + "] does not appear to be a vicar file"; throw IException(IException::User, msg, _FILEINFO_); } @@ -151,12 +151,12 @@ namespace Isis { * * @return a valid PVL label */ - IString ProcessImportVicar::ExtractPvlLabel(const int startPos, std::ifstream &vicarFile) const { + QString ProcessImportVicar::ExtractPvlLabel(int startPos, std::ifstream &vicarFile) const { vicarFile.seekg(startPos, ios::beg); // convert the LBLSIZE to an integer char *lblSizeValue = new char [1024]; - vicarFile.seekg(string("LBLSIZE=").size(), ios_base::cur); + vicarFile.seekg(QString("LBLSIZE=").size(), ios_base::cur); for(int pos = 0; pos < 1024 - 1; pos++) { if(!vicarFile.good()) @@ -170,7 +170,7 @@ namespace Isis { // we're totally lost at this point if(pos == 1023) { - string msg = "Cannot find label size in VICAR file"; + QString msg = "Cannot find label size in VICAR file"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -188,10 +188,10 @@ namespace Isis { vicarFile.close(); // Transform the vicar labels into valid pvl labels - IString vicLabels = buf; + QString vicLabels = buf; bool inQuote = false; - for(unsigned int pos = 0; pos < vicLabels.size(); pos++) { + for(int pos = 0; pos < vicLabels.size(); pos++) { if(vicLabels[pos] == '\'' || vicLabels[pos] == '"') { inQuote = !inQuote; } diff --git a/isis/src/base/objs/ProcessImportVicar/ProcessImportVicar.h b/isis/src/base/objs/ProcessImportVicar/ProcessImportVicar.h index c72469b418..7976f0a4d9 100644 --- a/isis/src/base/objs/ProcessImportVicar/ProcessImportVicar.h +++ b/isis/src/base/objs/ProcessImportVicar/ProcessImportVicar.h @@ -62,10 +62,10 @@ namespace Isis { class ProcessImportVicar : public ProcessImport { public: - void SetVicarFile(const std::string &vicarFile, Pvl &vicarLab); + void SetVicarFile(const QString &vicarFile, Pvl &vicarLab); private: - IString ExtractPvlLabel(const int startPos, std::ifstream &vicarFile) const; + QString ExtractPvlLabel(int startPos, std::ifstream &vicarFile) const; }; }; diff --git a/isis/src/base/objs/ProcessImportVicar/unitTest.cpp b/isis/src/base/objs/ProcessImportVicar/unitTest.cpp index 0aa16f1a39..0a52520459 100644 --- a/isis/src/base/objs/ProcessImportVicar/unitTest.cpp +++ b/isis/src/base/objs/ProcessImportVicar/unitTest.cpp @@ -1,29 +1,34 @@ #include "Isis.h" + +#include + #include "ProcessImportVicar.h" #include "Application.h" #include "Cube.h" #include "Statistics.h" +using namespace Isis; using namespace std; + void IsisMain() { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::ProcessImportVicar p; - Isis::Pvl vlab; + ProcessImportVicar p; + Pvl vlab; p.SetVicarFile("unitTest.img", vlab); p.SetOutputCube("TO"); p.StartProcess(); p.EndProcess(); cout << vlab << endl; - Isis::Process p2; - Isis::CubeAttributeInput att; - string file = Isis::Application::GetUserInterface().GetFileName("TO"); - Isis::Cube *icube = p2.SetInputCube(file, att); - Isis::Statistics *stat = icube->getStatistics(); + Process p2; + CubeAttributeInput att; + QString file = Application::GetUserInterface().GetFileName("TO"); + Cube *icube = p2.SetInputCube(file, att); + Statistics *stat = icube->getStatistics(); cout << stat->Average() << endl; cout << stat->Variance() << endl; p2.EndProcess(); - remove(file.c_str()); + QFile::remove(file); } diff --git a/isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.cpp b/isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.cpp index 71043c9e51..02dc14fe2e 100644 --- a/isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.cpp +++ b/isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.cpp @@ -56,15 +56,15 @@ namespace Isis { /** * Mosaic Processing method, returns false if the cube is not inside the mosaic */ - bool ProcessMapMosaic::StartProcess(std::string inputFile) { + bool ProcessMapMosaic::StartProcess(QString inputFile) { if (InputCubes.size() != 0) { - std::string msg = "Input cubes already exist; do not call SetInputCube when using "; - msg += "ProcessMosaic::StartProcess(std::string)"; + QString msg = "Input cubes already exist; do not call SetInputCube when using "; + msg += "ProcessMosaic::StartProcess(QString)"; throw IException(IException::Programmer, msg, _FILEINFO_); } if (OutputCubes.size() == 0) { - std::string msg = "An output cube must be set before calling StartProcess"; + QString msg = "An output cube must be set before calling StartProcess"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -78,7 +78,7 @@ namespace Isis { int nlMosaic = mosaicCube->getLineCount(); if (*iproj != *oproj) { - string msg = "Mapping groups do not match between cube [" + inputFile + "] and mosaic"; + QString msg = "Mapping groups do not match between cube [" + inputFile + "] and mosaic"; throw IException(IException::User, msg, _FILEINFO_); } @@ -159,7 +159,7 @@ namespace Isis { while (wrapPossible && outSample < nsMosaic); } catch (IException &e) { - string msg = "Unable to mosaic cube [" + FileName(inputFile).name() + "]"; + QString msg = "Unable to mosaic cube [" + FileName(inputFile).name() + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } } @@ -180,7 +180,7 @@ namespace Isis { * and output attributes */ Isis::Cube *ProcessMapMosaic::SetOutputCube(FileList &propagationCubes, CubeAttributeOutput &oAtt, - const std::string &mosaicFile) { + const QString &mosaicFile) { int bands = 0; double xmin = DBL_MAX; double xmax = -DBL_MAX; @@ -194,7 +194,7 @@ namespace Isis { Projection *proj = NULL; if (propagationCubes.size() < 1) { - string msg = "The list does not contain any data"; + QString msg = "The list does not contain any data"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -209,7 +209,7 @@ namespace Isis { Projection *projNew = Isis::ProjectionFactory::CreateFromCube(*(cube.getLabel())); if ((proj != NULL) && (*proj != *projNew)) { - string msg = "Mapping groups do not match between cubes [" + + QString msg = "Mapping groups do not match between cubes [" + propagationCubes[0].toString() + "] and [" + propagationCubes[i].toString() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -253,9 +253,9 @@ namespace Isis { */ Isis::Cube *ProcessMapMosaic::SetOutputCube(FileList &propagationCubes, double slat, double elat, double slon, double elon, - CubeAttributeOutput &oAtt, const std::string &mosaicFile) { + CubeAttributeOutput &oAtt, const QString &mosaicFile) { if (propagationCubes.size() < 1) { - string msg = "The list does not contain any data"; + QString msg = "The list does not contain any data"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -263,10 +263,10 @@ namespace Isis { Pvl label; label.Read(propagationCubes[0].toString()); PvlGroup mGroup = label.FindGroup("Mapping", Pvl::Traverse); - mGroup.AddKeyword(PvlKeyword("MinimumLatitude", slat), Pvl::Replace); - mGroup.AddKeyword(PvlKeyword("MaximumLatitude", elat), Pvl::Replace); - mGroup.AddKeyword(PvlKeyword("MinimumLongitude", slon), Pvl::Replace); - mGroup.AddKeyword(PvlKeyword("MaximumLongitude", elon), Pvl::Replace); + mGroup.AddKeyword(PvlKeyword("MinimumLatitude", toString(slat)), Pvl::Replace); + mGroup.AddKeyword(PvlKeyword("MaximumLatitude", toString(elat)), Pvl::Replace); + mGroup.AddKeyword(PvlKeyword("MinimumLongitude", toString(slon)), Pvl::Replace); + mGroup.AddKeyword(PvlKeyword("MaximumLongitude", toString(elon)), Pvl::Replace); if (mGroup.HasKeyword("UpperLeftCornerX")) mGroup.DeleteKeyword("UpperLeftCornerX"); @@ -300,7 +300,7 @@ namespace Isis { if (proj == NULL) { } else if (*proj != *projNew) { - string msg = "Mapping groups do not match between cube [" + propagationCubes[i].toString() + + QString msg = "Mapping groups do not match between cube [" + propagationCubes[i].toString() + "] and [" + propagationCubes[0].toString() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -321,19 +321,19 @@ namespace Isis { * Set the output cube to specified file name and specified input images * and output attributes and lat,lons */ - Isis::Cube *ProcessMapMosaic::SetOutputCube(const std::string &inputFile, + Isis::Cube *ProcessMapMosaic::SetOutputCube(const QString &inputFile, double xmin, double xmax, double ymin, double ymax, double slat, double elat, double slon, double elon, int nbands, - CubeAttributeOutput &oAtt, const std::string &mosaicFile) { + CubeAttributeOutput &oAtt, const QString &mosaicFile) { Pvl fileLab(inputFile); PvlGroup &mapping = fileLab.FindGroup("Mapping", Pvl::Traverse); - mapping["UpperLeftCornerX"] = xmin; - mapping["UpperLeftCornerY"] = ymax; - mapping.AddKeyword(PvlKeyword("MinimumLatitude", slat), Pvl::Replace); - mapping.AddKeyword(PvlKeyword("MaximumLatitude", elat), Pvl::Replace); - mapping.AddKeyword(PvlKeyword("MinimumLongitude", slon), Pvl::Replace); - mapping.AddKeyword(PvlKeyword("MaximumLongitude", elon), Pvl::Replace); + mapping["UpperLeftCornerX"] = toString(xmin); + mapping["UpperLeftCornerY"] = toString(ymax); + mapping.AddKeyword(PvlKeyword("MinimumLatitude", toString(slat)), Pvl::Replace); + mapping.AddKeyword(PvlKeyword("MaximumLatitude", toString(elat)), Pvl::Replace); + mapping.AddKeyword(PvlKeyword("MinimumLongitude", toString(slon)), Pvl::Replace); + mapping.AddKeyword(PvlKeyword("MaximumLongitude", toString(elon)), Pvl::Replace); Projection *firstProj = ProjectionFactory::CreateFromCube(fileLab); int samps = (int)(ceil(firstProj->ToWorldX(xmax) - firstProj->ToWorldX(xmin)) + 0.5); @@ -388,10 +388,10 @@ namespace Isis { * Set the output cube to specified file name and specified input images * and output attributes and lat,lons */ - Isis::Cube *ProcessMapMosaic::SetOutputCube(const std::string &inputFile, PvlGroup mapping, - CubeAttributeOutput &oAtt, const std::string &mosaicFile) { + Isis::Cube *ProcessMapMosaic::SetOutputCube(const QString &inputFile, PvlGroup mapping, + CubeAttributeOutput &oAtt, const QString &mosaicFile) { if (OutputCubes.size() != 0) { - std::string msg = "You can only specify one output cube and projection"; + QString msg = "You can only specify one output cube and projection"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -448,7 +448,7 @@ namespace Isis { /** * Mosaic output method for Mosaic Processing Method, this will use an existing mosaic */ - Cube *ProcessMapMosaic::SetOutputCube(const std::string &mosaicFile) { + Cube *ProcessMapMosaic::SetOutputCube(const QString &mosaicFile) { p_createMosaic = false; Cube mosaic; mosaic.open(mosaicFile); diff --git a/isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.h b/isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.h index f1f0a6e257..dc4b153078 100644 --- a/isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.h +++ b/isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.h @@ -91,31 +91,31 @@ namespace Isis { ~ProcessMapMosaic(); Isis::Cube *SetOutputCube(FileList &propagationCubes, CubeAttributeOutput &oAtt, - const std::string &mosaicFile); + const QString &mosaicFile); Isis::Cube *SetOutputCube(FileList &propagationCubes, double slat, double elat, double slon, double elon, - CubeAttributeOutput &oAtt, const std::string &mosaicFile); + CubeAttributeOutput &oAtt, const QString &mosaicFile); - Isis::Cube *SetOutputCube(const std::string &inputFile, + Isis::Cube *SetOutputCube(const QString &inputFile, double xmin, double xmax, double ymin, double ymax, double slat, double elat, double slon, double elon, int nbands, - CubeAttributeOutput &oAtt, const std::string &mosaicFile); + CubeAttributeOutput &oAtt, const QString &mosaicFile); - Isis::Cube *SetOutputCube(const std::string &inputFile, PvlGroup mapping, - CubeAttributeOutput &oAtt, const std::string &mosaicFile); + Isis::Cube *SetOutputCube(const QString &inputFile, PvlGroup mapping, + CubeAttributeOutput &oAtt, const QString &mosaicFile); - Isis::Cube *SetOutputCube(const std::string &mosaicFile); + Isis::Cube *SetOutputCube(const QString &mosaicFile); Isis::Cube *SetInputCube(); - bool StartProcess(std::string inputFile); + bool StartProcess(QString inputFile); private: static void FillNull(Buffer &data); /** - * Internal use; SetOutputMosaic (const std::string &) sets to false to + * Internal use; SetOutputMosaic (const QString &) sets to false to * not attempt creation when using SetOutputMosaic */ bool p_createMosaic; diff --git a/isis/src/base/objs/ProcessMosaic/ProcessMosaic.cpp b/isis/src/base/objs/ProcessMosaic/ProcessMosaic.cpp index e0cc6f8705..5dfc93e08c 100644 --- a/isis/src/base/objs/ProcessMosaic/ProcessMosaic.cpp +++ b/isis/src/base/objs/ProcessMosaic/ProcessMosaic.cpp @@ -115,7 +115,7 @@ namespace Isis { void ProcessMosaic::StartProcess(const int &os, const int &ol, const int &ob) { // Error checks ... there must be one input and one output if ((OutputCubes.size() != 1) || (InputCubes.size() != 1)) { - string m = "You must specify exactly one input and one output cube"; + QString m = "You must specify exactly one input and one output cube"; throw IException(IException::Programmer, m, _FILEINFO_); } @@ -168,13 +168,13 @@ namespace Isis { PvlGroup imgPosition("ImageLocation"); imgPosition += PvlKeyword("File", InputCubes[0]->getFileName()); - imgPosition += PvlKeyword("StartSample", m_oss); - imgPosition += PvlKeyword("StartLine", m_osl); + imgPosition += PvlKeyword("StartSample", toString(m_oss)); + imgPosition += PvlKeyword("StartLine", toString(m_osl)); m_imagePositions += imgPosition; // Tests for completly off the mosaic if ((ins < 1) || (inl < 1)) { - string m = "The input cube does not overlap the mosaic"; + QString m = "The input cube does not overlap the mosaic"; throw IException(IException::User, m, _FILEINFO_); } @@ -200,7 +200,7 @@ namespace Isis { (OutputCubes[0]->getBandCount()-1) == 1) || (m_imageOverlay == PlaceImagesOnTop && m_placeHighSatPixels && m_placeLowSatPixels && m_placeNullPixels)) ){ - string m = "Tracking cannot be True for multi-band Mosaic with ontop or beneath priority"; + QString m = "Tracking cannot be True for multi-band Mosaic with ontop or beneath priority"; throw IException(IException::Programmer, m, _FILEINFO_); } } @@ -230,7 +230,7 @@ namespace Isis { } // BandBin group is not found else { - string m = "Match BandBin cannot be True when the Image does not have the BandBin group"; + QString m = "Match BandBin cannot be True when the Image does not have the BandBin group"; throw IException(IException::Programmer, m, _FILEINFO_); } } @@ -341,7 +341,7 @@ namespace Isis { } // Band Priority else if (m_trackingEnabled && m_imageOverlay == UseBandPlacementCriteria) { - int iPixelOrigin = (int) origPortal[pixel]; + int iPixelOrigin = qRound(origPortal[pixel]); if (iPixelOrigin == iIndex) { oPortal[pixel] = iPortal[pixel]; iChanged++; @@ -441,13 +441,13 @@ namespace Isis { * * @throws IException::Message */ - Cube *ProcessMosaic::SetInputCube(const std::string ¶meter, + Cube *ProcessMosaic::SetInputCube(const QString ¶meter, const int ss, const int sl, const int sb, const int ns, const int nl, const int nb) { // Make sure only one input is active at a time if (InputCubes.size() > 0) { - string m = "You must specify exactly one input cube"; + QString m = "You must specify exactly one input cube"; throw IException(IException::Programmer, m, _FILEINFO_); } @@ -464,9 +464,9 @@ namespace Isis { Pvl *cInPvl = InputCubes[0]->getLabel(); if (cInPvl->FindGroup("Dimensions", Pvl::Traverse).HasKeyword("Bands")) { PvlKeyword &cBandKey = cInPvl->FindGroup("Dimensions", Pvl::Traverse).FindKeyword("Bands"); - IString sStr(cBandKey[0]); - if (sStr.ToInteger() < nb) { - string m = "The parameter number of input bands exceeds the actual number of bands in the " + QString sStr(cBandKey[0]); + if (toInt(sStr) < nb) { + QString m = "The parameter number of input bands exceeds the actual number of bands in the " "input cube"; throw IException(IException::Programmer, m, _FILEINFO_); } @@ -511,14 +511,14 @@ namespace Isis { * * @throws IException */ - Cube *ProcessMosaic::SetInputCube(const std::string &fname, + Cube *ProcessMosaic::SetInputCube(const QString &fname, CubeAttributeInput &att, const int ss, const int sl, const int sb, const int ns, const int nl, const int nb) { // Make sure only one input is active at a time if (InputCubes.size() > 0) { - string m = "You must specify exactly one input cube"; + QString m = "You must specify exactly one input cube"; throw IException(IException::Programmer, m, _FILEINFO_); } @@ -535,9 +535,9 @@ namespace Isis { Pvl *cInPvl = InputCubes[0]->getLabel(); if (cInPvl->FindGroup("Dimensions", Pvl::Traverse).HasKeyword("Bands")) { PvlKeyword &cBandKey = cInPvl->FindGroup("Dimensions", Pvl::Traverse).FindKeyword("Bands"); - IString sStr(cBandKey[0]); - if (sStr.ToInteger() < nb) { - string m = "The parameter number of input bands exceeds the actual number of bands in the input cube"; + QString sStr(cBandKey[0]); + if (toInt(sStr) < nb) { + QString m = "The parameter number of input bands exceeds the actual number of bands in the input cube"; throw IException(IException::Programmer, m, _FILEINFO_); } } @@ -559,11 +559,11 @@ namespace Isis { * * @throws IException::Message */ - Cube *ProcessMosaic::SetOutputCube(const std::string &psParameter) { + Cube *ProcessMosaic::SetOutputCube(const QString &psParameter) { // Make sure there is only one output cube if (OutputCubes.size() > 0) { - string m = "You must specify exactly one output cube"; + QString m = "You must specify exactly one output cube"; throw IException(IException::Programmer, m, _FILEINFO_); } @@ -571,7 +571,7 @@ namespace Isis { // (e.g., "TO") and the cube size from an input cube Cube *cube = new Cube; try { - string fname = Application::GetUserInterface().GetFileName(psParameter); + QString fname = Application::GetUserInterface().GetFileName(psParameter); cube->open(fname, "rw"); } catch (IException &) { @@ -619,11 +619,11 @@ namespace Isis { */ void ProcessMosaic::SetMosaicOrigin(int &index) { // Get only the file name - std::string sInputFile = FileName(InputCubes[0]->getFileName()).name(); - std::string sTableName = TRACKING_TABLE_NAME; + QString sInputFile = FileName(InputCubes[0]->getFileName()).name(); + QString sTableName = TRACKING_TABLE_NAME; // Get the serial number - std::string sSerialNumber = SerialNumber::Compose(*(InputCubes[0])); + QString sSerialNumber = SerialNumber::Compose(*(InputCubes[0])); int iFileNameLen = sInputFile.length(); int iSerialNumLen = sSerialNumber.length(); int iFieldLength = iSerialNumLen; @@ -632,7 +632,7 @@ namespace Isis { } // Get output file name - std::string sOutputFile = FileName(OutputCubes[0]->getFileName()).name(); + QString sOutputFile = FileName(OutputCubes[0]->getFileName()).name(); Pvl *cPvlOut = OutputCubes[0]->getLabel(); @@ -697,20 +697,20 @@ namespace Isis { } if (bFull) { - string msg = "The number of images in the Mosaic exceeds the pixel size"; + QString msg = "The number of images in the Mosaic exceeds the pixel size"; throw IException(IException::Programmer, msg, _FILEINFO_); } for (int i = 0; i < iRecs; i++) { // Get the file name and trim out the characters filled due to resizing - string sTableFile = string(cFileTable_Copy[i][0]); - size_t found = sTableFile.rfind(".cub"); - if (found != string::npos) { + QString sTableFile = QString(QString(cFileTable_Copy[i][0]).toAscii().data()); + int found = sTableFile.lastIndexOf(".cub"); + if (found != -1) { // clear the packing characters - get only the file name - sTableFile.erase(found + 4); + sTableFile.remove(found + 4); } - if (sTableFile.compare(sInputFile) == 0) { + if (sTableFile == sInputFile) { index += i; return; } @@ -718,15 +718,15 @@ namespace Isis { // To initialize the new table, on the first file name comparison, check the size of // the existing table record with the size of the new record being added if (!i) { - if (IString(cFieldKey[0]).ToInteger() < iFieldLength) { + if (toInt(QString(cFieldKey[0])) < iFieldLength) { TableRecord cFileRecordUpdate; TableField cFileFieldUpdate("FileName", TableField::Text, iFieldLength); - cFileFieldUpdate = (std::string)cFileTable_Copy[i][0]; + cFileFieldUpdate = (QString)cFileTable_Copy[i][0]; cFileRecordUpdate += cFileFieldUpdate; // Populate with Serial Number TableField cSNFieldUpdate("SerialNumber", TableField::Text, iFieldLength); - cSNFieldUpdate = (std::string)cFileTable_Copy[i][1]; + cSNFieldUpdate = (QString)cFileTable_Copy[i][1]; cFileRecordUpdate += cSNFieldUpdate; // add new record and set the size for all the other records cFileTable = Table(sTableName, cFileRecordUpdate); @@ -767,7 +767,7 @@ namespace Isis { /** * Set the keyword/value to use for comparing when using band priority. */ - void ProcessMosaic::SetBandKeyword(IString bandPriorityKeyName, IString bandPriorityKeyValue) { + void ProcessMosaic::SetBandKeyword(QString bandPriorityKeyName, QString bandPriorityKeyValue) { m_bandPriorityKeyName = bandPriorityKeyName; m_bandPriorityKeyValue = bandPriorityKeyValue; } @@ -907,11 +907,11 @@ namespace Isis { /** - * Convert an ImageOverlay to a string. This is used to translate between + * Convert an ImageOverlay to a QString. This is used to translate between * mapmos, handmos, and automos' interfaces into an ImageOverlay. */ - IString ProcessMosaic::OverlayToString(ImageOverlay imageOverlay) { - IString result; + QString ProcessMosaic::OverlayToString(ImageOverlay imageOverlay) { + QString result; switch (imageOverlay) { case PlaceImagesOnTop: @@ -936,7 +936,7 @@ namespace Isis { if (result == "") { throw IException(IException::Unknown, - "Cannot convert overlay [" + IString((int)imageOverlay) + "] to a string", + "Cannot convert overlay [" + toString((int)imageOverlay) + "] to a string", _FILEINFO_); } @@ -945,13 +945,13 @@ namespace Isis { /** - * Convert a string to an ImageOverlay (case-insensitive). This is used to translate between + * Convert a QString to an ImageOverlay (case-insensitive). This is used to translate between * mapmos, handmos, and automos' interfaces into an ImageOverlay. */ - ProcessMosaic::ImageOverlay ProcessMosaic::StringToOverlay(IString imageOverlayString) { - IString imageOverlayStringUpper = imageOverlayString.UpCase(); + ProcessMosaic::ImageOverlay ProcessMosaic::StringToOverlay(QString imageOverlayString) { + QString imageOverlayStringUpper = imageOverlayString.toUpper(); for (int i = 0; i < NumImageOverlayOptions; i++) { - if (OverlayToString((ImageOverlay)i).UpCase() == imageOverlayStringUpper) + if (OverlayToString((ImageOverlay)i).toUpper() == imageOverlayStringUpper) return (ImageOverlay)i; } @@ -980,28 +980,28 @@ namespace Isis { PvlGroup inMosaicGrp = inLabel->FindObject("IsisCube").FindGroup("Kernels"); if (outMosaicGrp.HasKeyword("ShapeModel") && inMosaicGrp.HasKeyword("ShapeModel")) { PvlKeyword outShapeModelKey = outMosaicGrp.FindKeyword("ShapeModel"); - string sShapeModel = inMosaicGrp.FindKeyword("ShapeModel")[0]; - size_t found = sShapeModel.rfind ("/"); - if (found != string::npos) { - sShapeModel.replace (0, found+1, "\0"); + QString sShapeModel = inMosaicGrp.FindKeyword("ShapeModel")[0]; + int found = sShapeModel.lastIndexOf("/"); + if (found != -1) { + sShapeModel.remove(0, found + 1); } if (sShapeModel == outShapeModelKey[0]) { return; } } } - std::string sErrMsg = "Input and Mosaic DEM Shape Model do not match"; + QString sErrMsg = "Input and Mosaic DEM Shape Model do not match"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } else { if (m_createOutputMosaic) { if (inLabel->FindObject("IsisCube").HasGroup("Kernels")) { - string sShapeModel = + QString sShapeModel = inLabel->FindObject("IsisCube").FindGroup("Kernels").FindKeyword("ShapeModel")[0]; - size_t found = sShapeModel.rfind ("/"); - if (found != string::npos){ - sShapeModel.replace (0, found+1, "\0"); + int found = sShapeModel.lastIndexOf("/"); + if (found != -1){ + sShapeModel.remove(0, found+1); } PvlObject & outIsisCubeObj = outLabel->FindObject("IsisCube"); PvlGroup mosaicGrp("Mosaic"); @@ -1104,7 +1104,7 @@ namespace Isis { PvlGroup &inBin = inLab->FindGroup("BandBin", Pvl::Traverse); PvlGroup &outBin = outLab->FindGroup("BandBin", Pvl::Traverse); if (inBin.Keywords() != outBin.Keywords()) { - string msg = "Pvl Group [BandBin] does not match between the input and output cubes"; + QString msg = "Pvl Group [BandBin] does not match between the input and output cubes"; throw IException(IException::User, msg, _FILEINFO_); } @@ -1115,15 +1115,15 @@ namespace Isis { for (int i = 0; i < outBin.Keywords(); i++) { PvlKeyword &outKey = outBin[i]; - string sOutName = outKey.Name(); + QString sOutName = outKey.Name(); if (inBin.HasKeyword(sOutName)) { PvlKeyword &inKey = inBin[sOutName]; for (int j = osb, k = isb; j < outKey.Size() && k < inKey.Size(); j++, k++) { if (outKey[j] == "NA") { outKey[j] = inKey[k]; if (m_imageOverlay == AverageImageWithMosaic) { - if (sOutName.find("Filter") != string::npos || - sOutName.find("Name") != string::npos) { + if (sOutName.contains("Filter") || + sOutName.contains("Name")) { outKey[j+iOutBandsHalf] = inKey[k] + "_Count"; } else { @@ -1132,14 +1132,14 @@ namespace Isis { } } else if (outKey[j] != inKey[k]) { - string msg = "Pvl Group [BandBin] in Key[" + outKey.Name() + "] In value" + inKey[k] + + QString msg = "Pvl Group [BandBin] in Key[" + outKey.Name() + "] In value" + inKey[k] + "and Out value=" + outKey[j] + " do not match"; throw IException(IException::User, msg, _FILEINFO_); } } } else { - string msg = "Pvl Group [BandBin] In Keyword[" + inBin[i].Name() + "] and Out Keyword[" + + QString msg = "Pvl Group [BandBin] In Keyword[" + inBin[i].Name() + "] and Out Keyword[" + outBin[i].Name() + "] does not match"; throw IException(IException::User, msg, _FILEINFO_); } @@ -1211,11 +1211,11 @@ namespace Isis { int iTotalOutBands = OutputCubes[0]->getBandCount(); isb = origIsb - 1; // reset the input starting band int iOutStartBand = iOutBands + osb; - string sKeyName = cInKey.Name(); + QString sKeyName = cInKey.Name(); bool bFilterKey = false; - if (sKeyName.find("Filter") != string::npos || - sKeyName.find("Original") != string::npos || - sKeyName.find("Name") != string::npos) { + if (sKeyName.contains("Filter") || + sKeyName.contains("Original") || + sKeyName.contains("Name")) { bFilterKey = true; } for (int ob=iOutBands; obwhat() + "]"; + QString msg = "ERROR! geos exception 1 ["; + msg += QString(ill->what()) + "]"; delete ill; throw IException(IException::Programmer, msg, _FILEINFO_); }/*end catch*/ @@ -313,8 +313,8 @@ namespace Isis { } /*end try*/ catch(geos::util::IllegalArgumentException *ill) { - std::string msg = "ERROR! geos exception 1 ["; - msg += (IString)ill->what() + "]"; + QString msg = "ERROR! geos exception 1 ["; + msg += (QString)ill->what() + "]"; delete ill; throw IException(IException::Programmer, msg, _FILEINFO_); }/*end catch*/ @@ -351,13 +351,13 @@ namespace Isis { * * @return Isis::Cube* */ - Isis::Cube *ProcessPolygons::AppendOutputCube(const std::string &avgFileName, - const std::string &countFileName) { + Isis::Cube *ProcessPolygons::AppendOutputCube(const QString &avgFileName, + const QString &countFileName) { FileName *file = new FileName(avgFileName); - std::string path = file->path(); - std::string filename = file->baseName(); - std::string extension = file->extension(); + QString path = file->path(); + QString filename = file->baseName(); + QString extension = file->extension(); /*Open the average file with read/write permission*/ Cube *averageCube = new Cube(); @@ -370,7 +370,7 @@ namespace Isis { if(countFileName == "") { /*if the countFileName was set to nothing, then we use the default count file name.*/ - std::string openFile = path + "/" + filename + "-count-." + extension; + QString openFile = path + "/" + filename + "-count-." + extension; countCube->open(openFile, "rw"); } @@ -391,8 +391,8 @@ namespace Isis { * @param nlines * @param nbands */ - void ProcessPolygons::SetOutputCube(const std::string &avgFileName, const - std::string &countFileName, + void ProcessPolygons::SetOutputCube(const QString &avgFileName, const + QString &countFileName, Isis::CubeAttributeOutput &atts, const int nsamps, const int nlines, const int nbands) { @@ -424,20 +424,20 @@ namespace Isis { * @param nlines * @param nbands */ - void ProcessPolygons::SetOutputCube(const std::string ¶meter, + void ProcessPolygons::SetOutputCube(const QString ¶meter, const int nsamps, const int nlines, const int nbands) { - std::string avgString = + QString avgString = Application::GetUserInterface().GetFileName(parameter); Isis::CubeAttributeOutput atts = Application::GetUserInterface().GetOutputAttribute(parameter); FileName *file = new FileName(avgString); - std::string path = file->path(); - std::string filename = file->baseName(); - std::string countString = path + "/" + filename + "-count"; + QString path = file->path(); + QString filename = file->baseName(); + QString countString = path + "/" + filename + "-count"; SetOutputCube(avgString, countString, atts, nsamps, nlines, nbands); } diff --git a/isis/src/base/objs/ProcessPolygons/ProcessPolygons.h b/isis/src/base/objs/ProcessPolygons/ProcessPolygons.h index af9032a8a8..1a71d68adc 100644 --- a/isis/src/base/objs/ProcessPolygons/ProcessPolygons.h +++ b/isis/src/base/objs/ProcessPolygons/ProcessPolygons.h @@ -26,15 +26,15 @@ namespace Isis { public: ProcessPolygons(); - void SetOutputCube(const std::string ¶meter, const int nsamps, + void SetOutputCube(const QString ¶meter, const int nsamps, const int nlines, int nbands = 1); - void SetOutputCube(const std::string &avgFileName, const std::string + void SetOutputCube(const QString &avgFileName, const QString &countFileName, Isis::CubeAttributeOutput &atts, const int nsamps, const int nlines, int nbands = 1); - Isis::Cube *AppendOutputCube(const std::string &avgFileName, - const std::string &countFileName = ""); + Isis::Cube *AppendOutputCube(const QString &avgFileName, + const QString &countFileName = ""); void Rasterize(std::vector &samples, std::vector &lines, diff --git a/isis/src/base/objs/ProcessPolygons/unitTest.cpp b/isis/src/base/objs/ProcessPolygons/unitTest.cpp index 93e227c5b5..7c74e8c5eb 100644 --- a/isis/src/base/objs/ProcessPolygons/unitTest.cpp +++ b/isis/src/base/objs/ProcessPolygons/unitTest.cpp @@ -1,4 +1,7 @@ #include "Isis.h" + +#include + #include "ProcessPolygons.h" #include "ProcessByLine.h" #include "SpecialPixel.h" @@ -26,8 +29,8 @@ void IsisMain() { CubeAttributeOutput out_atts; out_atts.setPixelType(Real); - const string output1 = "processPolygonsTest.cub"; - const string output2 = "processPolygonsTest_count.cub"; + QString output1 = "processPolygonsTest.cub"; + QString output2 = "processPolygonsTest_count.cub"; p.SetOutputCube(output1 , output2 , out_atts, 4, 4, 2); samples.clear(); @@ -74,8 +77,8 @@ void IsisMain() { pbl.StartProcess(writeAscii); pbl.EndProcess(); - remove(output1.c_str()); - remove(output2.c_str()); + QFile::remove(output1); + QFile::remove(output2); } /** diff --git a/isis/src/base/objs/ProcessRubberSheet/unitTest.cpp b/isis/src/base/objs/ProcessRubberSheet/unitTest.cpp index 197da5f4b0..da09f2964a 100644 --- a/isis/src/base/objs/ProcessRubberSheet/unitTest.cpp +++ b/isis/src/base/objs/ProcessRubberSheet/unitTest.cpp @@ -102,7 +102,7 @@ void IsisMain() { delete interp; UserInterface &ui = Application::GetUserInterface(); - QFile::remove(ui.GetFileName("TO").c_str()); + QFile::remove(ui.GetFileName("TO")); } diff --git a/isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp b/isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp index a2d8c6f92e..0b65ed3d23 100644 --- a/isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp +++ b/isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp @@ -50,8 +50,8 @@ namespace Isis { * @param programName The Isis program name to be run (i.e. catlab, cubeatt) * @param parameters The arguments to give to the program that is being run */ - void ProgramLauncher::RunIsisProgram(IString programName, - IString parameters) { + void ProgramLauncher::RunIsisProgram(QString programName, + QString parameters) { FileName program(programName); FileName isisExecutableFileName("$ISISROOT/bin/" + program.name()); bool isIsisProgram = false; @@ -61,17 +61,17 @@ namespace Isis { program = isisExecutableFileName; } - IString command = program.expanded() + " " + parameters + - " -pid=" + IString(getpid()); + QString command = program.expanded() + " " + parameters + + " -pid=" + toString(getpid()); if(!isIsisProgram) { - IString msg = "Program [" + programName + "] does not appear to be a " + QString msg = "Program [" + programName + "] does not appear to be a " "valid Isis 3 program"; throw IException(IException::Unknown, msg, _FILEINFO_); } - IString serverName = "isis_" + Application::UserName() + - "_" + IString(getpid()); + QString serverName = "isis_" + Application::UserName() + + "_" + toString(getpid()); QLocalServer server; server.listen(serverName); @@ -91,7 +91,7 @@ namespace Isis { } if(!connected) { - IString msg = "Isis child process failed to communicate with parent"; + QString msg = "Isis child process failed to communicate with parent"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -103,8 +103,8 @@ namespace Isis { bool insideCode = true; bool messageDone = false; - IString code; - IString message; + QString code; + QString message; QByteArray lineData; if(childSocket->waitForReadyRead(1000)) { @@ -144,8 +144,8 @@ namespace Isis { childProcess.waitForFinished(); if(childProcess.exitCode() != 0) { - IString msg = "Running Isis program [" + programName + "] failed with " - "return status [" + IString(childProcess.exitCode()) + "]"; + QString msg = "Running Isis program [" + programName + "] failed with " + "return status [" + toString(childProcess.exitCode()) + "]"; throw IException(errors, IException::Unknown, msg, _FILEINFO_); } } @@ -162,14 +162,14 @@ namespace Isis { * parameter. */ IException - ProgramLauncher::ProcessIsisMessageFromChild(IString code, IString msg) { + ProgramLauncher::ProcessIsisMessageFromChild(QString code, QString msg) { IException errors; if(code == "PROGRESSTEXT" && iApp) { iApp->UpdateProgress(msg, true); } else if(code == "PROGRESS" && iApp) { - iApp->UpdateProgress((int)msg, true); + iApp->UpdateProgress(toInt(msg), true); } else if(code == "LOG" && iApp) { stringstream msgStream; @@ -194,14 +194,14 @@ namespace Isis { for(int i = 0; i < errorPvl.Groups(); i++) { PvlGroup &g = errorPvl.Group(i); - std::string eclass = g["Class"]; - std::string emsg = g["Message"]; + QString eclass = g["Class"]; + QString emsg = g["Message"]; int ecode = g["Code"]; - std::string efile = g["File"]; + QString efile = g["File"]; int eline = g["Line"]; errors.append( - IException((IException::ErrorType)ecode, emsg, efile.c_str(), eline)); + IException((IException::ErrorType)ecode, emsg, efile.toAscii().data(), eline)); } } @@ -220,12 +220,12 @@ namespace Isis { * @param fullCommand A string containing the command formatted like what * you would type in a terminal */ - void ProgramLauncher::RunSystemCommand(IString fullCommand) { - int status = system(fullCommand.c_str()); + void ProgramLauncher::RunSystemCommand(QString fullCommand) { + int status = system(fullCommand.toAscii().data()); if(status != 0) { - IString msg = "Executing command [" + fullCommand + - "] failed with return status [" + IString(status) + "]"; + QString msg = "Executing command [" + fullCommand + + "] failed with return status [" + toString(status) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } } diff --git a/isis/src/base/objs/ProgramLauncher/ProgramLauncher.h b/isis/src/base/objs/ProgramLauncher/ProgramLauncher.h index 7d597492a5..bf45bf0259 100644 --- a/isis/src/base/objs/ProgramLauncher/ProgramLauncher.h +++ b/isis/src/base/objs/ProgramLauncher/ProgramLauncher.h @@ -24,9 +24,10 @@ * http://www.usgs.gov/privacy.html. */ +class QString; + namespace Isis { class IException; - class IString; /** * @brief Execute External Programs and Commands @@ -43,11 +44,11 @@ namespace Isis { */ class ProgramLauncher { public: - static void RunIsisProgram(IString isisProgramName, IString arguments); - static void RunSystemCommand(IString commandLine); + static void RunIsisProgram(QString isisProgramName, QString arguments); + static void RunSystemCommand(QString commandLine); private: - static IException ProcessIsisMessageFromChild(IString code, IString msg); + static IException ProcessIsisMessageFromChild(QString code, QString msg); private: //! Construction is not allowed diff --git a/isis/src/base/objs/Progress/Progress.cpp b/isis/src/base/objs/Progress/Progress.cpp index baf1c322fd..add07e15db 100644 --- a/isis/src/base/objs/Progress/Progress.cpp +++ b/isis/src/base/objs/Progress/Progress.cpp @@ -41,8 +41,8 @@ namespace Isis { bool printPercent; Isis::PvlGroup &group = Isis::Preference::Preferences().FindGroup("UserInterface"); percent = group["ProgressBarPercent"]; - Isis::IString temp = (string) group["ProgressBar"]; - printPercent = temp.UpCase() == "ON"; + QString temp = (QString) group["ProgressBar"]; + printPercent = temp.toUpper() == "ON"; // Check for an error if((percent != 1) && (percent != 2) && @@ -73,7 +73,7 @@ namespace Isis { * * @param text Text to output. */ - void Progress::SetText(const std::string &text) { + void Progress::SetText(const QString &text) { p_text = text; } @@ -84,7 +84,7 @@ namespace Isis { * * @return string */ - string Progress::Text() const { + QString Progress::Text() const { return p_text; } diff --git a/isis/src/base/objs/Progress/Progress.h b/isis/src/base/objs/Progress/Progress.h index 4cf1868539..558def485f 100644 --- a/isis/src/base/objs/Progress/Progress.h +++ b/isis/src/base/objs/Progress/Progress.h @@ -22,7 +22,7 @@ * http://www.usgs.gov/privacy.html. */ -#include +#include namespace Isis { /** @@ -55,7 +55,7 @@ namespace Isis { class Progress { private: - std::string p_text; /**< Text string to output at the initial call to + QString p_text; /**< Text string to output at the initial call to CheckStatus (0% processed)*/ int p_maximumSteps; /**< Number of steps in your processing sequence. For example, if there are 20 lines in an cube. @@ -78,11 +78,11 @@ namespace Isis { // destructor ~Progress(); - // Change the text std::string - void SetText(const std::string &text); + // Change the text QString + void SetText(const QString &text); // Get the text string - std::string Text() const; + QString Text() const; // Change the maximum steps void SetMaximumSteps(const int steps); diff --git a/isis/src/base/objs/Progress/unitTest.cpp b/isis/src/base/objs/Progress/unitTest.cpp index 388a9a8b18..5428dcca53 100644 --- a/isis/src/base/objs/Progress/unitTest.cpp +++ b/isis/src/base/objs/Progress/unitTest.cpp @@ -8,7 +8,7 @@ using namespace std; int main() { Isis::Preference &pref = Isis::Preference::Preferences(true); Isis::PvlGroup &uip = pref.FindGroup("UserInterface"); - uip["ProgressBarPercent"] = 5; + uip["ProgressBarPercent"] = "5"; Isis::Progress p; // Check normal operation @@ -42,7 +42,7 @@ int main() { // Check for error on bad creation try { - uip["ProgressBarPercent"] = 3; + uip["ProgressBarPercent"] = "3"; Isis::Progress p2; } catch(Isis::IException &e) { diff --git a/isis/src/base/objs/Projection/Projection.cpp b/isis/src/base/objs/Projection/Projection.cpp index 398db63c73..d5340a0f42 100644 --- a/isis/src/base/objs/Projection/Projection.cpp +++ b/isis/src/base/objs/Projection/Projection.cpp @@ -114,12 +114,12 @@ namespace Isis { } // Get the radii using the "TargetName" keyword and NAIF else if (m_mappingGrp.HasKeyword("TargetName")) { - PvlGroup radii = TargetRadii((string)m_mappingGrp["TargetName"]); + PvlGroup radii = TargetRadii((QString)m_mappingGrp["TargetName"]); m_equatorialRadius = radii["EquatorialRadius"]; m_polarRadius = radii["PolarRadius"]; } else { - IString msg = "Projection failed. No target radii are available " + QString msg = "Projection failed. No target radii are available " "through keywords [EquatorialRadius and PolarRadius] " "or [TargetName]."; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -127,53 +127,53 @@ namespace Isis { // Check the radii for validity if (m_equatorialRadius <= 0.0) { - IString msg = "Projection failed. Invalid value for keyword " + QString msg = "Projection failed. Invalid value for keyword " "[EquatorialRadius]. It must be greater than zero"; throw IException(IException::Unknown, msg, _FILEINFO_); } if (m_polarRadius <= 0.0) { - IString msg = "Projection failed. Invalid value for keyword " + QString msg = "Projection failed. Invalid value for keyword " "[PolarRadius]. It must be greater than zero"; throw IException(IException::Unknown, msg, _FILEINFO_); } // Get the LatitudeType - if ((string) m_mappingGrp["LatitudeType"] == "Planetographic") { + if ((QString) m_mappingGrp["LatitudeType"] == "Planetographic") { m_latitudeType = Planetographic; } - else if ((string) m_mappingGrp["LatitudeType"] == "Planetocentric") { + else if ((QString) m_mappingGrp["LatitudeType"] == "Planetocentric") { m_latitudeType = Planetocentric; } else { - IString msg = "Projection failed. Invalid value for keyword " + QString msg = "Projection failed. Invalid value for keyword " "[LatitudeType] must be " "[Planetographic or Planetocentric]"; throw IException(IException::Unknown, msg, _FILEINFO_); } // Get the LongitudeDirection - if ((string) m_mappingGrp["LongitudeDirection"] == "PositiveWest") { + if (m_mappingGrp["LongitudeDirection"][0].toLower() == "positivewest") { m_longitudeDirection = PositiveWest; } - else if ((string) m_mappingGrp["LongitudeDirection"] == "PositiveEast") { + else if (m_mappingGrp["LongitudeDirection"][0].toLower() == "positiveeast") { m_longitudeDirection = PositiveEast; } else { - IString msg = "Projection failed. Invalid value for keyword " + QString msg = "Projection failed. Invalid value for keyword " "[LongitudeDirection] must be " "[PositiveWest or PositiveEast]"; throw IException(IException::Unknown, msg, _FILEINFO_); } // Get the LongitudeDomain - if ((string) m_mappingGrp["LongitudeDomain"] == "360") { + if ((QString) m_mappingGrp["LongitudeDomain"] == "360") { m_longitudeDomain = 360; } - else if ((string) m_mappingGrp["LongitudeDomain"] == "180") { + else if ((QString) m_mappingGrp["LongitudeDomain"] == "180") { m_longitudeDomain = 180; } else { - IString msg = "Projection failed. Invalid value for keyword " + QString msg = "Projection failed. Invalid value for keyword " "[LongitudeDomain] must be [180 or 360]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -190,33 +190,33 @@ namespace Isis { m_maximumLongitude = m_mappingGrp["MaximumLongitude"]; if ((m_minimumLatitude < -90.0) || (m_minimumLatitude > 90.0)) { - IString msg = "Projection failed. " - "[MinimumLatitude] of [" + IString(m_minimumLatitude) + QString msg = "Projection failed. " + "[MinimumLatitude] of [" + toString(m_minimumLatitude) + "] is outside the range of [-90:90]"; throw IException(IException::Unknown, msg, _FILEINFO_); } if ((m_maximumLatitude < -90.0) || (m_maximumLatitude > 90.0)) { - IString msg = "Projection failed. " - "[MaximumLatitude] of [" + IString(m_maximumLatitude) + QString msg = "Projection failed. " + "[MaximumLatitude] of [" + toString(m_maximumLatitude) + "] is outside the range of [-90:90]"; throw IException(IException::Unknown, msg, _FILEINFO_); } if (m_minimumLatitude >= m_maximumLatitude) { - IString msg = "Projection failed. " + QString msg = "Projection failed. " "[MinimumLatitude,MaximumLatitude] of [" - + IString(m_minimumLatitude) + "," - + IString(m_maximumLatitude) + "] are not " + + toString(m_minimumLatitude) + "," + + toString(m_maximumLatitude) + "] are not " + "properly ordered"; throw IException(IException::Unknown, msg, _FILEINFO_); } if (m_minimumLongitude >= m_maximumLongitude) { - IString msg = "Projection failed. " + QString msg = "Projection failed. " "[MinimumLongitude,MaximumLongitude] of [" - + IString(m_minimumLongitude) + "," - + IString(m_maximumLongitude) + "] are not " + + toString(m_minimumLongitude) + "," + + toString(m_maximumLongitude) + "] are not " + "properly ordered"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -252,10 +252,10 @@ namespace Isis { m_maximumY = -DBL_MAX; if (m_equatorialRadius < m_polarRadius) { - IString msg = "Projection failed. Invalid keyword value(s). " - "[EquatorialRadius] = " + IString(m_equatorialRadius) + QString msg = "Projection failed. Invalid keyword value(s). " + "[EquatorialRadius] = " + toString(m_equatorialRadius) + " must be greater than or equal to [PolarRadius] = " - + IString(m_polarRadius); + + toString(m_polarRadius); throw IException(IException::Unknown, msg, _FILEINFO_); } else { @@ -269,8 +269,8 @@ namespace Isis { m_sky = false; if (m_mappingGrp.HasKeyword("TargetName")) { - IString str = (string) m_mappingGrp["TargetName"]; - if (str.UpCase() == "SKY") m_sky = true; + QString str = m_mappingGrp["TargetName"]; + if (str.toUpper() == "SKY") m_sky = true; } // initialize the rest of the x,y,lat,lon member variables @@ -280,7 +280,7 @@ namespace Isis { m_y = Null; } catch(IException &e) { - IString msg = "Projection failed. Invalid label group [Mapping]"; + QString msg = "Projection failed. Invalid label group [Mapping]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } } @@ -433,28 +433,28 @@ namespace Isis { * EquatorialRadius, and PolarRadius. */ - PvlGroup Projection::TargetRadii(std::string target) { + PvlGroup Projection::TargetRadii(QString target) { // Convert the target name to a NAIF code SpiceInt code; SpiceBoolean found; - bodn2c_c(target.c_str(), &code, &found); + bodn2c_c(target.toAscii().data(), &code, &found); if (!found) { - IString msg = "Could not convert target name [" + target +"] to NAIF code"; + QString msg = "Could not convert target name [" + target +"] to NAIF code"; throw IException(IException::Io, msg, _FILEINFO_); } // Load the most recent target attitude and shape kernel for NAIF FileName kern("$Base/kernels/pck/pck?????.tpc"); kern = kern.highestVersion(); - string kernName(kern.expanded()); - furnsh_c(kernName.c_str()); + QString kernName(kern.expanded()); + furnsh_c(kernName.toAscii().data()); // Get the radii from NAIF NaifStatus::CheckErrors(); SpiceInt n; SpiceDouble radii[3]; bodvar_c(code, "RADII", &n, radii); - unload_c(kernName.c_str()); + unload_c(kernName.toAscii().data()); try { NaifStatus::CheckErrors(); @@ -463,14 +463,14 @@ namespace Isis { throw IException(e, IException::Unknown, QObject::tr("The target name [%1] does not correspond to a target body " - "with known radii").arg(QString::fromStdString(target)), + "with known radii").arg(target), _FILEINFO_); } PvlGroup mapping("Mapping"); mapping += PvlKeyword("TargetName", target); - mapping += PvlKeyword("EquatorialRadius", radii[0] * 1000.0, "meters"); - mapping += PvlKeyword("PolarRadius", radii[2] * 1000.0, "meters"); + mapping += PvlKeyword("EquatorialRadius", toString(radii[0] * 1000.0), "meters"); + mapping += PvlKeyword("PolarRadius", toString(radii[2] * 1000.0), "meters"); return mapping; } @@ -507,7 +507,7 @@ namespace Isis { } PvlGroup inst = cubeLab.FindGroup("Instrument", Pvl::Traverse); - string target = inst["TargetName"]; + QString target = inst["TargetName"]; PvlGroup radii = Projection::TargetRadii(target); //Now INSERT the EquatorialRadius and PolorRadius into the mapGroup pvl. mapGroup += PvlKeyword("EquatorialRadius", @@ -668,7 +668,7 @@ namespace Isis { * * @return string The latitude type, "Planetocentric" or "Planetographic". */ - string Projection::LatitudeTypeString() const { + QString Projection::LatitudeTypeString() const { if (m_latitudeType == Planetographic) return "Planetographic"; return "Planetocentric"; } @@ -726,7 +726,7 @@ namespace Isis { mylon = To180Domain(mylon); } else { - IString msg = "Unable to convert longitude. Domain [" + IString(domain) + QString msg = "Unable to convert longitude. Domain [" + toString(domain) + "] is not 180 or 360."; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -751,7 +751,7 @@ namespace Isis { if (lon == Null) { throw IException(IException::Unknown, "Unable to convert to PositiveWest. The given longitude value [" - + IString(lon) + "] is invalid.", + + toString(lon) + "] is invalid.", _FILEINFO_); } double mylon = lon; @@ -765,7 +765,7 @@ namespace Isis { mylon = To180Domain(mylon); } else { - IString msg = "Unable to convert longitude. Domain [" + IString(domain) + QString msg = "Unable to convert longitude. Domain [" + toString(domain) + "] is not 180 or 360."; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -780,7 +780,7 @@ namespace Isis { * @return string The longitude direction, "PositiveEast" or * "PositiveWest". */ - string Projection::LongitudeDirectionString() const { + QString Projection::LongitudeDirectionString() const { if (m_longitudeDirection == PositiveEast) return "PositiveEast"; return "PositiveWest"; } @@ -858,7 +858,7 @@ namespace Isis { * * @return string The longitude domain, "180" or "360". */ - string Projection::LongitudeDomainString() const { + QString Projection::LongitudeDomainString() const { if (m_longitudeDomain == 360) return "360"; return "180"; } @@ -1384,7 +1384,7 @@ namespace Isis { * * @return string The angle in Degrees, minutes, seconds */ - string Projection::ToDMS(double angle) { + QString Projection::ToDMS(double angle) { int iangle = (int)angle; double mins = abs(angle - iangle) * 60.0; int imins = (int)mins; @@ -1407,7 +1407,7 @@ namespace Isis { s << iangle << " " << setw(2) << setfill('0') << imins << "m " << setw(2) << setfill('0') << isecs << "." << setprecision(3) << frac << "s"; - return s.str(); + return s.str().c_str(); } /** @@ -1419,7 +1419,7 @@ namespace Isis { * * @return string The angle in Hours, minutes, seconds */ - string Projection::ToHMS(double angle) { + QString Projection::ToHMS(double angle) { double tangle = angle; while (tangle < 0.0) tangle += 360.0; while (tangle > 360.0) tangle -= 360.0; @@ -1446,7 +1446,7 @@ namespace Isis { stringstream s; s << setw(2) << setfill('0') << ihrs << "h " << setw(2) << setfill('0') << imins << "m " << setw(2) << setfill('0') << isecs << "." << imsecs << "s"; - return s.str(); + return s.str().c_str(); } /** @@ -2147,8 +2147,8 @@ namespace Isis { */ void Projection::SetUpperLeftCorner(const Displacement &x, const Displacement &y) { - PvlKeyword xKeyword("UpperLeftCornerX", x.meters(), "meters"); - PvlKeyword yKeyword("UpperLeftCornerY", y.meters(), "meters"); + PvlKeyword xKeyword("UpperLeftCornerX", toString(x.meters()), "meters"); + PvlKeyword yKeyword("UpperLeftCornerY", toString(y.meters()), "meters"); m_mappingGrp.AddKeyword(xKeyword,Pvl::Replace); m_mappingGrp.AddKeyword(yKeyword,Pvl::Replace); } @@ -2253,7 +2253,7 @@ namespace Isis { */ double Projection::qCompute(const double sinPhi) const { if (m_eccentricity < DBL_EPSILON) { - IString msg = "Snyder's q variable should only be computed for " + QString msg = "Snyder's q variable should only be computed for " "ellipsoidal projections."; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -2307,7 +2307,7 @@ namespace Isis { } if (iteration >= MAX_ITERATIONS) { - IString msg = "Failed to converge in Projection::phi2Compute()"; + QString msg = "Failed to converge in Projection::phi2Compute()"; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/Projection/Projection.h b/isis/src/base/objs/Projection/Projection.h index 23860075ca..98f2f46068 100644 --- a/isis/src/base/objs/Projection/Projection.h +++ b/isis/src/base/objs/Projection/Projection.h @@ -182,14 +182,14 @@ namespace Isis { * * @return string The name of the map projection. */ - virtual std::string Name() const = 0; + virtual QString Name() const = 0; /** * This method returns the Version of the map projection. It is a pure * virtual method (requires all subclasses to override). * * @return string The Version number of the map projection. */ - virtual std::string Version() const = 0; + virtual QString Version() const = 0; virtual double TrueScaleLatitude() const; virtual bool IsEquatorialCylindrical(); /** @@ -210,7 +210,7 @@ namespace Isis { // Check latitude type or get latitude type as a string bool IsPlanetocentric() const; bool IsPlanetographic() const; - std::string LatitudeTypeString() const; + QString LatitudeTypeString() const; // change latitude type double ToPlanetocentric(const double lat) const; double ToPlanetographic(const double lat) const; @@ -226,11 +226,11 @@ namespace Isis { // Check longitude direction or get longitude direction as a string bool IsPositiveEast() const; bool IsPositiveWest() const; - std::string LongitudeDirectionString() const; + QString LongitudeDirectionString() const; // Check longitude domain or get longitude domain as a string bool Has180Domain() const; bool Has360Domain() const; - std::string LongitudeDomainString() const; + QString LongitudeDomainString() const; // Check if labels contain min/max lat/lon bool HasGroundRange() const; // Get min/max lat/lon @@ -288,11 +288,11 @@ namespace Isis { virtual PvlGroup MappingLongitudes(); // Static conversion methods - static PvlGroup TargetRadii(std::string target); + static PvlGroup TargetRadii(QString target); static PvlGroup TargetRadii(Pvl &cubeLab, PvlGroup &mapGroup); static double ToHours(double angle); - static std::string ToDMS(double angle); - static std::string ToHMS(double angle); + static QString ToDMS(double angle); + static QString ToHMS(double angle); // change latitude type static double ToPlanetocentric(double lat, double eRadius, double pRadius); diff --git a/isis/src/base/objs/Projection/Projection.truth b/isis/src/base/objs/Projection/Projection.truth index 7a73836b39..2c96f1e4fa 100644 --- a/isis/src/base/objs/Projection/Projection.truth +++ b/isis/src/base/objs/Projection/Projection.truth @@ -228,7 +228,7 @@ Testing IsSky method 0 1 -Testing string routines +Testing QString routines Planetographic PositiveEast 360 diff --git a/isis/src/base/objs/Projection/unitTest.cpp b/isis/src/base/objs/Projection/unitTest.cpp index 5b1b1e922d..4c6ce6e324 100644 --- a/isis/src/base/objs/Projection/unitTest.cpp +++ b/isis/src/base/objs/Projection/unitTest.cpp @@ -23,10 +23,10 @@ class MyProjection : public Projection { Projection(lab) { } // override pure virtual methods - string Name() const { + QString Name() const { return "None"; } - string Version() const { + QString Version() const { return "1.0"; } @@ -103,10 +103,10 @@ class EmptyProjection : public Projection { } // pure virtuals, must be overriden, no need to test since MyProjection will test these - string Name() const { + QString Name() const { return "None"; } - string Version() const { + QString Version() const { return "1.0"; } }; @@ -158,23 +158,23 @@ int main(int argc, char *argv[]) { cout << endl; cout << "Test for missing polar radius in the mapping group" << endl; - mg += PvlKeyword("EquatorialRadius", -1.0); + mg += PvlKeyword("EquatorialRadius", toString(-1.0)); Doit(lab); cout << endl; cout << "Test for invalid Equatoral Radius value" << endl; - mg += PvlKeyword("PolarRadius", -0.95); + mg += PvlKeyword("PolarRadius", toString(-0.95)); Doit(lab); cout << endl; cout << "Test for invalid polar radius value" << endl; - mg["EquatorialRadius"] = 1.0; - mg += PvlKeyword("PolarRadius", -0.95); + mg["EquatorialRadius"] = toString(1.0); + mg += PvlKeyword("PolarRadius", toString(-0.95)); Doit(lab); cout << endl; cout << "Test for missing latitude type in the mapping group" << endl; - mg["PolarRadius"] = 0.95; + mg["PolarRadius"] = toString(0.95); Doit(lab); cout << endl; @@ -199,12 +199,12 @@ int main(int argc, char *argv[]) { cout << endl; cout << "Test for invalid longitude domain value in the mapping group" << endl; - mg += PvlKeyword("LongitudeDomain", 75); + mg += PvlKeyword("LongitudeDomain", toString(75)); Doit(lab); cout << "///////////////////////////////////////////////////////////" << endl; cout << endl; - mg["LongitudeDomain"] = 360; + mg["LongitudeDomain"] = toString(360); mg += PvlKeyword("ProjectionName", "MyProjection"); cout << "Projection Specifications" << endl; @@ -267,31 +267,31 @@ int main(int argc, char *argv[]) { cout << "///////////////////////////////////////////////////////////" << endl; cout << "Test More Error Throws...\n" << endl; cout << "Testing unordered latitude range" << endl; - mg += PvlKeyword("MinimumLatitude", 45.0); - mg += PvlKeyword("MaximumLatitude", -80.0); - mg += PvlKeyword("MinimumLongitude", 15.0); - mg += PvlKeyword("MaximumLongitude", -190.0); + mg += PvlKeyword("MinimumLatitude", toString(45.0)); + mg += PvlKeyword("MaximumLatitude", toString(-80.0)); + mg += PvlKeyword("MinimumLongitude", toString(15.0)); + mg += PvlKeyword("MaximumLongitude", toString(-190.0)); Doit(lab); cout << endl; cout << "Testing invalid minimum latitude" << endl; - mg["MinimumLatitude"] = -95.0; + mg["MinimumLatitude"] = toString(-95.0); Doit(lab); cout << endl; cout << "Testing invalid maximum latitude" << endl; - mg["MinimumLatitude"].SetValue(45.0, "units"); - mg["MaximumLatitude"].SetValue(95.0, "units"); + mg["MinimumLatitude"].SetValue(toString(45.0), "units"); + mg["MaximumLatitude"].SetValue(toString(95.0), "units"); Doit(lab); cout << endl; cout << "Testing unordered longitude range" << endl; - mg["MaximumLatitude"].SetValue(80.0, "units"); + mg["MaximumLatitude"].SetValue(toString(80.0), "units"); Doit(lab); cout << "///////////////////////////////////////////////////////////" << endl; cout << endl; - mg["MaximumLongitude"] = 190.0; + mg["MaximumLongitude"] = toString(190.0); cout << "Testing xyRange methods...\n" << endl; MyProjection p2(lab); @@ -354,18 +354,18 @@ int main(int argc, char *argv[]) { Isis::PvlGroup &latTestGroup = latRangeTest.FindGroup("Mapping"); latTestGroup += Isis::PvlKeyword("TargetName", "Moon"); latTestGroup += Isis::PvlKeyword("ProjectionName", "PolarStereographic"); - latTestGroup += Isis::PvlKeyword("EquatorialRadius", 1737400.0); - latTestGroup += Isis::PvlKeyword("PolarRadius", 1737400.0); + latTestGroup += Isis::PvlKeyword("EquatorialRadius", toString(1737400.0)); + latTestGroup += Isis::PvlKeyword("PolarRadius", toString(1737400.0)); latTestGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); latTestGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - latTestGroup += Isis::PvlKeyword("LongitudeDomain", 360); - latTestGroup += Isis::PvlKeyword("Scale", 5.0); - latTestGroup += Isis::PvlKeyword("MinimumLatitude", -90.0); - latTestGroup += Isis::PvlKeyword("MaximumLatitude", -45.0); - latTestGroup += Isis::PvlKeyword("MinimumLongitude", 0.0); - latTestGroup += Isis::PvlKeyword("MaximumLongitude", 360.0); - latTestGroup += Isis::PvlKeyword("CenterLatitude", -90.0); - latTestGroup += Isis::PvlKeyword("CenterLongitude", 0.0); + latTestGroup += Isis::PvlKeyword("LongitudeDomain", toString(360)); + latTestGroup += Isis::PvlKeyword("Scale", toString(5.0)); + latTestGroup += Isis::PvlKeyword("MinimumLatitude", toString(-90.0)); + latTestGroup += Isis::PvlKeyword("MaximumLatitude", toString(-45.0)); + latTestGroup += Isis::PvlKeyword("MinimumLongitude", toString(0.0)); + latTestGroup += Isis::PvlKeyword("MaximumLongitude", toString(360.0)); + latTestGroup += Isis::PvlKeyword("CenterLatitude", toString(-90.0)); + latTestGroup += Isis::PvlKeyword("CenterLongitude", toString(0.0)); Isis::Projection &latTestProjection = *Isis::ProjectionFactory::Create(latRangeTest); cout << "PolarStereographic Projection Specifications" << endl; @@ -475,7 +475,7 @@ int main(int argc, char *argv[]) { cout << p3.IsSky() << endl; cout << endl; - cout << "Testing string routines" << endl; + cout << "Testing QString routines" << endl; cout << p2.LatitudeTypeString() << endl; cout << p2.LongitudeDirectionString() << endl; cout << p2.LongitudeDomainString() << endl; @@ -488,7 +488,7 @@ int main(int argc, char *argv[]) { cout << "operator!=: " << (p != p2) << endl; mg["LongitudeDirection"] = "PositiveWest"; - mg["LongitudeDomain"] = 180; + mg["LongitudeDomain"] = toString(180); EmptyProjection noproj(lab); cout << endl; @@ -523,7 +523,7 @@ int main(int argc, char *argv[]) { cout << "Test Error Throw for compute methods..." << endl; // qCompute is not used for spherical targets // set polar radius = equatorial radius - mg["PolarRadius"] = 1.0; + mg["PolarRadius"] = toString(1.0); Doit(lab); MyProjection p3a(lab); try { @@ -532,7 +532,7 @@ int main(int argc, char *argv[]) { catch(IException &error) { error.print(); } - mg["PolarRadius"] = 0.95; + mg["PolarRadius"] = toString(0.95); cout << "///////////////////////////////////////////////////////////" << endl; cout << endl; @@ -699,7 +699,7 @@ int main(int argc, char *argv[]) { cout << endl; cout << "Rotation Tests" << endl; - mg += PvlKeyword("Rotation", 90.0); + mg += PvlKeyword("Rotation", toString(90.0)); mg["LongitudeDirection"] = "PositiveEast"; MyProjection p4(lab); cout << "Rotation: " << p4.Rotation() << endl; diff --git a/isis/src/base/objs/ProjectionFactory/ProjectionFactory.cpp b/isis/src/base/objs/ProjectionFactory/ProjectionFactory.cpp index ce82b7a4fa..54bec29fda 100644 --- a/isis/src/base/objs/ProjectionFactory/ProjectionFactory.cpp +++ b/isis/src/base/objs/ProjectionFactory/ProjectionFactory.cpp @@ -78,7 +78,7 @@ namespace Isis { try { // Look for info in the mapping group Isis::PvlGroup &mapGroup = label.FindGroup("Mapping", Isis::Pvl::Traverse); - string proj = mapGroup["ProjectionName"]; + QString proj = mapGroup["ProjectionName"]; // Now get the plugin for the projection void *ptr; @@ -86,7 +86,7 @@ namespace Isis { ptr = m_projPlugin.GetPlugin(proj); } catch(IException &e) { - string msg = "Unsupported projection, unable to find plugin for [" + + QString msg = "Unsupported projection, unable to find plugin for [" + proj + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -98,7 +98,7 @@ namespace Isis { return (*plugin)(label, allowDefaults); } catch(IException &e) { - string message = "Unable to initialize Projection information "; + QString message = "Unable to initialize Projection information "; message += "from group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } @@ -154,9 +154,9 @@ namespace Isis { pixelResolution = (2.0 * Isis::PI * localRadius) / (360.0 * scale); } // Write out the scale and resolution with units and truescale latitude - mapGroup.AddKeyword(Isis::PvlKeyword("PixelResolution", pixelResolution, "meters/pixel"), + mapGroup.AddKeyword(Isis::PvlKeyword("PixelResolution", toString(pixelResolution), "meters/pixel"), Isis::Pvl::Replace); - mapGroup.AddKeyword(Isis::PvlKeyword("Scale", scale, "pixels/degree"), Isis::Pvl::Replace); + mapGroup.AddKeyword(Isis::PvlKeyword("Scale", toString(scale), "pixels/degree"), Isis::Pvl::Replace); //mapGroup.AddKeyword(Isis::PvlKeyword ("TrueScaleLatitude", trueScaleLat), // Isis::Pvl::Replace); @@ -182,14 +182,14 @@ namespace Isis { // Couldn't find the cube size from the labels so compute it if(!sizeFound) { if(!proj->HasGroundRange()) { - string msg = "Invalid ground range [MinimumLatitude,MaximumLatitude,"; + QString msg = "Invalid ground range [MinimumLatitude,MaximumLatitude,"; msg += "MinimumLongitude,MaximumLongitude] missing or invalid"; throw IException(IException::Unknown, msg, _FILEINFO_); } double minX, maxX, minY, maxY; if(!proj->XYRange(minX, maxX, minY, maxY)) { - string msg = "Invalid ground range [MinimumLatitude,MaximumLatitude,"; + QString msg = "Invalid ground range [MinimumLatitude,MaximumLatitude,"; msg += "MinimumLongitude,MaximumLongitude] cause invalid computation "; msg += "of image size"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -221,11 +221,11 @@ namespace Isis { // Set the upper left corner and add to the labels upperLeftX = minX; - mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerX", upperLeftX), + mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerX", toString(upperLeftX)), Isis::Pvl::Replace); upperLeftY = maxY; - mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerY", upperLeftY), + mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerY", toString(upperLeftY)), Isis::Pvl::Replace); // Write it in pixel units as well @@ -242,27 +242,27 @@ namespace Isis { // Make sure labels have good units mapGroup.AddKeyword(Isis::PvlKeyword("PixelResolution", - (string) mapGroup["PixelResolution"], + (QString) mapGroup["PixelResolution"], "meters/pixel"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("Scale", - (string) mapGroup["Scale"], + (QString) mapGroup["Scale"], "pixels/degree"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerX", - (string) mapGroup["UpperLeftCornerX"], + (QString) mapGroup["UpperLeftCornerX"], "meters"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerY", - (string) mapGroup["UpperLeftCornerY"], + (QString) mapGroup["UpperLeftCornerY"], "meters"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("EquatorialRadius", - (string) mapGroup["EquatorialRadius"], + (QString) mapGroup["EquatorialRadius"], "meters"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("PolarRadius", - (string) mapGroup["PolarRadius"], + (QString) mapGroup["PolarRadius"], "meters"), Isis::Pvl::Replace); // Add the mapper from pixel coordinates to projection coordinates @@ -273,7 +273,7 @@ namespace Isis { Displacement(upperLeftY, Displacement::Meters)); } catch(IException &e) { - string msg = "Unable to create projection"; + QString msg = "Unable to create projection"; if(label.FileName() != "") msg += " from file [" + label.FileName() + "]"; IException finalError(IException::Unknown, msg, _FILEINFO_); finalError.append(errors); @@ -332,9 +332,9 @@ namespace Isis { pixelResolution = (2.0 * Isis::PI * localRadius) / (360.0 * scale); } // Write out the scale and resolution with units and truescale latitude - mapGroup.AddKeyword(Isis::PvlKeyword("PixelResolution", pixelResolution, "meters/pixel"), + mapGroup.AddKeyword(Isis::PvlKeyword("PixelResolution", toString(pixelResolution), "meters/pixel"), Isis::Pvl::Replace); - mapGroup.AddKeyword(Isis::PvlKeyword("Scale", scale, "pixels/degree"), Isis::Pvl::Replace); + mapGroup.AddKeyword(Isis::PvlKeyword("Scale", toString(scale), "pixels/degree"), Isis::Pvl::Replace); //mapGroup.AddKeyword(Isis::PvlKeyword ("TrueScaleLatitude", trueScaleLat), // Isis::Pvl::Replace); @@ -478,36 +478,36 @@ namespace Isis { // Set the upper left corner and add to the labels double upperLeftX = minX; - mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerX", upperLeftX), + mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerX", toString(upperLeftX)), Isis::Pvl::Replace); double upperLeftY = maxY; - mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerY", upperLeftY), + mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerY", toString(upperLeftY)), Isis::Pvl::Replace); // Make sure labels have good units mapGroup.AddKeyword(Isis::PvlKeyword("PixelResolution", - (string) mapGroup["PixelResolution"], + (QString) mapGroup["PixelResolution"], "meters/pixel"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("Scale", - (string) mapGroup["Scale"], + (QString) mapGroup["Scale"], "pixels/degree"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerX", - (string) mapGroup["UpperLeftCornerX"], + (QString) mapGroup["UpperLeftCornerX"], "meters"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerY", - (string) mapGroup["UpperLeftCornerY"], + (QString) mapGroup["UpperLeftCornerY"], "meters"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("EquatorialRadius", - (string) mapGroup["EquatorialRadius"], + (QString) mapGroup["EquatorialRadius"], "meters"), Isis::Pvl::Replace); mapGroup.AddKeyword(Isis::PvlKeyword("PolarRadius", - (string) mapGroup["PolarRadius"], + (QString) mapGroup["PolarRadius"], "meters"), Isis::Pvl::Replace); // Add the mapper from pixel coordinates to projection coordinates @@ -518,7 +518,7 @@ namespace Isis { Displacement(upperLeftY, Displacement::Meters)); } catch(IException &e) { - string msg = "Unable to create projection"; + QString msg = "Unable to create projection"; if(label.FileName() != "") msg += " from file [" + label.FileName() + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } @@ -568,7 +568,7 @@ namespace Isis { Displacement(upperLeftY, Displacement::Meters)); } catch (IException &e) { - string msg = "Unable to initialize cube projection"; + QString msg = "Unable to initialize cube projection"; if(label.FileName() != "") msg += " from file [" + label.FileName() + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/ProjectionFactory/ProjectionFactory.truth b/isis/src/base/objs/ProjectionFactory/ProjectionFactory.truth index 0cb9e11fe7..0c92429108 100644 --- a/isis/src/base/objs/ProjectionFactory/ProjectionFactory.truth +++ b/isis/src/base/objs/ProjectionFactory/ProjectionFactory.truth @@ -1,4 +1,4 @@ -Unit test for Isis::ProjectionFactory +Unit test for ProjectionFactory Test for missing pixel resolution ... **ERROR** Unable to initialize cube projection. **ERROR** PVL Keyword [PixelResolution] does not exist in [Group = Mapping]. diff --git a/isis/src/base/objs/ProjectionFactory/unitTest.cpp b/isis/src/base/objs/ProjectionFactory/unitTest.cpp index cebdcff9ea..647159d747 100644 --- a/isis/src/base/objs/ProjectionFactory/unitTest.cpp +++ b/isis/src/base/objs/ProjectionFactory/unitTest.cpp @@ -6,46 +6,47 @@ #include "Projection.h" #include "Preference.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - void doit(Isis::Pvl & lab); - void doit2(Isis::Pvl & lab); + void doit(Pvl & lab); + void doit2(Pvl & lab); try { - cout << "Unit test for Isis::ProjectionFactory" << endl; + cout << "Unit test for ProjectionFactory" << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 3396190.0); - mapGroup += Isis::PvlKeyword("PolarRadius", 3376200.0); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup = lab.FindGroup("Mapping"); + mapGroup += PvlKeyword("EquatorialRadius", toString(3396190.0)); + mapGroup += PvlKeyword("PolarRadius", toString(3376200.0)); - mapGroup += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); + mapGroup += PvlKeyword("LatitudeType", "Planetographic"); + mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup += PvlKeyword("LongitudeDomain", toString(360)); - mapGroup += Isis::PvlKeyword("ProjectionName", "SimpleCylindrical"); - mapGroup += Isis::PvlKeyword("CenterLongitude", 220.0); + mapGroup += PvlKeyword("ProjectionName", "SimpleCylindrical"); + mapGroup += PvlKeyword("CenterLongitude", toString(220.0)); cout << "Test for missing pixel resolution ... " << endl; doit(lab); doit2(lab); - mapGroup += Isis::PvlKeyword("PixelResolution", 2000.0); + mapGroup += PvlKeyword("PixelResolution", toString(2000.0)); cout << "Test for missing upper left X ... " << endl; doit(lab); - mapGroup += Isis::PvlKeyword("UpperLeftCornerX", -18000.0); + mapGroup += PvlKeyword("UpperLeftCornerX", toString(-18000.0)); cout << "Test for missing upper left Y ... " << endl; doit(lab); - mapGroup += Isis::PvlKeyword("UpperLeftCornerY", 2062000.0); + mapGroup += PvlKeyword("UpperLeftCornerY", toString(2062000.0)); cout << "Testing conversion from image to ground ... " << endl; - Isis::Projection *proj = Isis::ProjectionFactory::CreateFromCube(lab); + Projection *proj = ProjectionFactory::CreateFromCube(lab); proj->SetWorld(245.0, 355.0); cout << setprecision(14); cout << "Latitude: " << proj->Latitude() << endl; @@ -61,16 +62,16 @@ int main(int argc, char *argv[]) { cout << "Testing missing ground range on create method ... " << endl; doit2(lab); - mapGroup += Isis::PvlKeyword("MinimumLatitude", 10.8920539924144); - mapGroup += Isis::PvlKeyword("MaximumLatitude", 34.7603960060206); - mapGroup += Isis::PvlKeyword("MinimumLongitude", 219.72432466275); - mapGroup += Isis::PvlKeyword("MaximumLongitude", 236.186050244411); + mapGroup += PvlKeyword("MinimumLatitude", toString(10.8920539924144)); + mapGroup += PvlKeyword("MaximumLatitude", toString(34.7603960060206)); + mapGroup += PvlKeyword("MinimumLongitude", toString(219.72432466275)); + mapGroup += PvlKeyword("MaximumLongitude", toString(236.186050244411)); mapGroup.DeleteKeyword("UpperLeftCornerX"); mapGroup.DeleteKeyword("UpperLeftCornerY"); cout << "Testing create method ... " << endl; int lines, samples; - proj = Isis::ProjectionFactory::CreateForCube(lab, samples, lines); + proj = ProjectionFactory::CreateForCube(lab, samples, lines); cout << "Lines: " << lines << endl; cout << "Samples: " << samples << endl; cout << "UpperLeftX: " << (double) mapGroup["UpperLeftCornerX"] << endl; @@ -78,24 +79,24 @@ int main(int argc, char *argv[]) { cout << endl; cout << "Testing create method with existing cube labels" << endl; - mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerX", -16000.0), Isis::Pvl::Replace); - mapGroup.AddKeyword(Isis::PvlKeyword("UpperLeftCornerY", 2060000.0), Isis::Pvl::Replace); - - Isis::Pvl lab2; - Isis::PvlObject icube("IsisCube"); - Isis::PvlObject core("Core"); - Isis::PvlGroup dims("Dimensions"); - dims += Isis::PvlKeyword("Lines", 400); - dims += Isis::PvlKeyword("Samples", 600); + mapGroup.AddKeyword(PvlKeyword("UpperLeftCornerX", toString(-16000.0)), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("UpperLeftCornerY", toString(2060000.0)), Pvl::Replace); + + Pvl lab2; + PvlObject icube("IsisCube"); + PvlObject core("Core"); + PvlGroup dims("Dimensions"); + dims += PvlKeyword("Lines", toString(400)); + dims += PvlKeyword("Samples", toString(600)); core.AddGroup(dims); icube.AddObject(core); icube.AddGroup(mapGroup); lab2.AddObject(icube); - proj = Isis::ProjectionFactory::CreateForCube(lab2, samples, lines); + proj = ProjectionFactory::CreateForCube(lab2, samples, lines); cout << "Lines: " << lines << endl; cout << "Samples: " << samples << endl; - mapGroup = lab2.FindGroup("Mapping", Isis::Pvl::Traverse); + mapGroup = lab2.FindGroup("Mapping", Pvl::Traverse); cout << "UpperLeftX: " << (double) mapGroup["UpperLeftCornerX"] << endl; cout << "UpperLeftY: " << (double) mapGroup["UpperLeftCornerY"] << endl; cout << endl; @@ -103,27 +104,27 @@ int main(int argc, char *argv[]) { cout << "Label results" << endl; cout << lab2 << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } -void doit(Isis::Pvl &lab) { +void doit(Pvl &lab) { try { - Isis::ProjectionFactory::CreateFromCube(lab); + ProjectionFactory::CreateFromCube(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; } -void doit2(Isis::Pvl &lab) { +void doit2(Pvl &lab) { try { int lines, samples; - Isis::ProjectionFactory::CreateForCube(lab, samples, lines); + ProjectionFactory::CreateForCube(lab, samples, lines); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; diff --git a/isis/src/base/objs/PushFrameCamera/unitTest.cpp b/isis/src/base/objs/PushFrameCamera/unitTest.cpp index 2666c4c716..1c106d0b46 100644 --- a/isis/src/base/objs/PushFrameCamera/unitTest.cpp +++ b/isis/src/base/objs/PushFrameCamera/unitTest.cpp @@ -47,7 +47,7 @@ class MyCamera : public PushFrameCamera { int main() { Preference::Preferences(true); - string inputFile = "$mgs/testData/ab102401.lev2.cub"; + QString inputFile = "$mgs/testData/ab102401.lev2.cub"; Pvl pvl(inputFile); MyCamera cam(pvl); diff --git a/isis/src/base/objs/Pvl/Pvl.cpp b/isis/src/base/objs/Pvl/Pvl.cpp index 59177b19d6..d9fe7fac31 100644 --- a/isis/src/base/objs/Pvl/Pvl.cpp +++ b/isis/src/base/objs/Pvl/Pvl.cpp @@ -45,7 +45,7 @@ namespace Isis { * * @param file The file containing the pvl formatted information */ - Pvl::Pvl(const std::string &file) : Isis::PvlObject("Root") { + Pvl::Pvl(const QString &file) : Isis::PvlObject("Root") { Init(); Read(file); } @@ -73,16 +73,16 @@ namespace Isis { * * @throws Isis::iException::Io */ - void Pvl::Read(const std::string &file) { + void Pvl::Read(const QString &file) { // Expand the filename Isis::FileName temp(file); p_filename = temp.expanded(); // Open the file ifstream istm; - istm.open(p_filename.c_str(), std::ios::in); + istm.open(p_filename.toAscii().data(), std::ios::in); if(!istm) { - string message = Message::FileOpen(temp.expanded()); + QString message = Message::FileOpen(temp.expanded()); throw IException(IException::Io, message, _FILEINFO_); } @@ -92,12 +92,12 @@ namespace Isis { } catch(IException &e) { istm.close(); - string message = "Unable to read PVL file [" + temp.expanded() + "]"; + QString message = "Unable to read PVL file [" + temp.expanded() + "]"; throw IException(e, IException::Unknown, message, _FILEINFO_); } catch(...) { istm.close(); - string message = "Unable to read PVL file [" + temp.expanded() + "]"; + QString message = "Unable to read PVL file [" + temp.expanded() + "]"; throw IException(IException::Unknown, message, _FILEINFO_); } istm.close(); @@ -113,7 +113,7 @@ namespace Isis { * * @throws Isis::iException::Io */ - void Pvl::Write(const std::string &file) { + void Pvl::Write(const QString &file) { // Expand the filename Isis::FileName temp(file); @@ -126,11 +126,11 @@ namespace Isis { // Open the file ofstream ostm; - string tempName(temp.expanded()); - ostm.open(tempName.c_str(), std::ios::out); + QString tempName(temp.expanded()); + ostm.open(tempName.toAscii().data(), std::ios::out); ostm.seekp(0, std::ios::beg); if(!ostm) { - string message = Isis::Message::FileCreate(temp.expanded()); + QString message = Isis::Message::FileCreate(temp.expanded()); throw IException(IException::Io, message, _FILEINFO_); } @@ -141,12 +141,12 @@ namespace Isis { } catch(IException &e) { ostm.close(); - string message = "Unable to write PVL to file [" + temp.expanded() + "]"; + QString message = "Unable to write PVL to file [" + temp.expanded() + "]"; throw IException(e, IException::Io, message, _FILEINFO_); } catch(...) { ostm.close(); - string message = "Unable to write PVL to file [" + temp.expanded() + "]"; + QString message = "Unable to write PVL to file [" + temp.expanded() + "]"; throw IException(IException::Io, message, _FILEINFO_); } @@ -167,7 +167,7 @@ namespace Isis { * * @throws Isis::iException::Io */ - void Pvl::Append(const std::string &file) { + void Pvl::Append(const QString &file) { // Set up for opening and writing Isis::FileName temp(file); @@ -180,11 +180,11 @@ namespace Isis { // Open the file ofstream ostm; - string tempName(temp.expanded()); - ostm.open(tempName.c_str(), std::ios::app); + QString tempName(temp.expanded()); + ostm.open(tempName.toAscii().data(), std::ios::app); ostm.seekp(0, std::ios::end); if(!ostm) { - string message = Message::FileOpen(temp.expanded()); + QString message = Message::FileOpen(temp.expanded()); throw IException(IException::Io, message, _FILEINFO_); } @@ -195,7 +195,7 @@ namespace Isis { } catch(...) { ostm.close(); - string message = "Unable to append PVL infomation to file [" + + QString message = "Unable to append PVL infomation to file [" + temp.expanded() + "]"; throw IException(IException::Io, message, _FILEINFO_); } @@ -217,7 +217,7 @@ namespace Isis { } - void Pvl::SetFormatTemplate(const std::string &file) { + void Pvl::SetFormatTemplate(const QString &file) { if(p_internalTemplate) delete p_formatTemplate; p_internalTemplate = true; p_formatTemplate = new Isis::Pvl(file); @@ -249,10 +249,10 @@ namespace Isis { Isis::Pvl newTemp; for(int i = 0; i < outTemplate.Keywords(); i++) { if(outTemplate[i].IsNamed("Isis:PvlTemplate:File")) { - string filename = outTemplate[i]; + QString filename = outTemplate[i]; Isis::FileName file(filename); if(!file.fileExists()) { - string message = "Could not open the template file [" + filename + "]"; + QString message = "Could not open the template file [" + filename + "]"; throw IException(IException::Io, message, _FILEINFO_); } Isis::Pvl include(file.expanded()); @@ -412,7 +412,7 @@ namespace Isis { if(readKeyword == errorKeywords[errorKey]) { is.seekg(beforeKeywordPos, ios::beg); - string msg = "Unexpected ["; + QString msg = "Unexpected ["; msg += readKeyword.Name(); msg += "] in PVL Object [ROOT]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -522,7 +522,7 @@ namespace Isis { for(int i=0; i>(std::istream &is, Pvl &pvl); @@ -144,10 +144,10 @@ namespace Isis { if(p_internalTemplate) delete p_formatTemplate; }; - void Read(const std::string &file); + void Read(const QString &file); - void Write(const std::string &file); - void Append(const std::string &file); + void Write(const QString &file); + void Append(const QString &file); /** * Sets the terminator used to signify the end of the PVL @@ -155,7 +155,7 @@ namespace Isis { * * @param term The user-defined terminator */ - void SetTerminator(const std::string &term) { + void SetTerminator(const QString &term) { p_terminator = term; }; /** @@ -164,12 +164,12 @@ namespace Isis { * * @return The terminator used by the Pvl object. */ - std::string Terminator() const { + QString Terminator() const { return p_terminator; }; void SetFormatTemplate(Isis::Pvl &temp); - void SetFormatTemplate(const std::string &filename); + void SetFormatTemplate(const QString &filename); const Pvl &operator=(const Pvl &other); @@ -179,7 +179,7 @@ namespace Isis { private: void Init(); bool p_internalTemplate; - std::string p_terminator; /** 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -93,10 +93,10 @@ namespace Isis { * @return The PvlKeyword object. * @throws IException The keyword doesn't exist. */ - const Isis::PvlKeyword &PvlContainer::FindKeyword(const std::string &name) const { + const Isis::PvlKeyword &PvlContainer::FindKeyword(const QString &name) const { ConstPvlKeywordIterator key = FindKeyword(name, Begin(), End()); if(key == End()) { - string msg = "PVL Keyword [" + name + "] does not exist in [" + + QString msg = "PVL Keyword [" + name + "] does not exist in [" + Type() + " = " + Name() + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -110,10 +110,10 @@ namespace Isis { * @param name The name of the keyword to remove. * @throws iException::Pvl Keyword doesn't exist. */ - void PvlContainer::DeleteKeyword(const std::string &name) { + void PvlContainer::DeleteKeyword(const QString &name) { PvlKeywordIterator key = FindKeyword(name, Begin(), End()); if(key == End()) { - string msg = "PVL Keyword [" + name + "] does not exist in [" + + QString msg = "PVL Keyword [" + name + "] does not exist in [" + Type() + " = " + Name() + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -130,7 +130,7 @@ namespace Isis { */ void PvlContainer::DeleteKeyword(const int index) { if(index >= (int)p_keywords.size() || index < 0) { - string msg = "The specified index is out of bounds in PVL [" + + QString msg = "The specified index is out of bounds in PVL [" + Type() + " = " + Name() + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -172,7 +172,7 @@ namespace Isis { * @param name The name of the keyword to check for. * @return True if the keyword exists, false if it doesn't. */ - bool PvlContainer::HasKeyword(const std::string &name) const { + bool PvlContainer::HasKeyword(const QString &name) const { ConstPvlKeywordIterator key = FindKeyword(name, Begin(), End()); if(key == End()) return false; return true; @@ -187,7 +187,7 @@ namespace Isis { */ PvlKeyword &PvlContainer::operator[](const int index) { if(index < 0 || index >= (int)p_keywords.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } return *(p_keywords.begin() + index); @@ -202,7 +202,7 @@ namespace Isis { */ const Isis::PvlKeyword &PvlContainer::operator[](const int index) const { if(index < 0 || index >= (int)p_keywords.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } return *(p_keywords.begin() + index); @@ -276,10 +276,10 @@ namespace Isis { // Include files take precedence over all other objects and groups for(int i = 0; i < outTemplate.Keywords(); i++) { if(outTemplate[i].IsNamed("Isis:PvlTemplate:File")) { - string filename = outTemplate[i]; + QString filename = outTemplate[i]; Isis::FileName file(filename); if(!file.fileExists()) { - string message = "Could not open the template file [" + filename + "]"; + QString message = "Could not open the template file [" + filename + "]"; throw IException(IException::Io, message, _FILEINFO_); } Isis::Pvl include(file.expanded()); @@ -298,7 +298,7 @@ namespace Isis { outTemplate = newTemp; // Figure out the longest keyword - unsigned int width = 0; + int width = 0; for(int i = 0; i < container.Keywords(); i++) { if(container[i].Name().length() > width) width = container[i].Name().length(); } @@ -364,7 +364,7 @@ namespace Isis { * @param end The ending iterator. * @return The keyword index. */ - PvlContainer::PvlKeywordIterator PvlContainer::FindKeyword(const std::string &name, + PvlContainer::PvlKeywordIterator PvlContainer::FindKeyword(const QString &name, PvlContainer::PvlKeywordIterator beg, PvlContainer::PvlKeywordIterator end) { PvlKeyword temp(name); @@ -379,7 +379,7 @@ namespace Isis { * @param end The ending iterator. * @return The keyword index. */ - PvlContainer::ConstPvlKeywordIterator PvlContainer::FindKeyword(const std::string &name, + PvlContainer::ConstPvlKeywordIterator PvlContainer::FindKeyword(const QString &name, PvlContainer::ConstPvlKeywordIterator beg, PvlContainer::ConstPvlKeywordIterator end) const { PvlKeyword temp(name); @@ -413,23 +413,23 @@ namespace Isis { int iTmplKeySize = Keywords(); for(int i=0; i=0; j--) { PvlKeyword & pvlKwrd = pPvlCont[j]; - string sKeyName = pvlKwrd.Name(); + QString sKeyName = pvlKwrd.Name(); if(sTmplKeyName == sKeyName) { pPvlTmplKwrd.ValidateKeyword(pvlKwrd, sValueType); pPvlCont.DeleteKeyword(pvlKwrd.Name()); diff --git a/isis/src/base/objs/PvlContainer/PvlContainer.h b/isis/src/base/objs/PvlContainer/PvlContainer.h index ae6c674dcf..249bad4069 100644 --- a/isis/src/base/objs/PvlContainer/PvlContainer.h +++ b/isis/src/base/objs/PvlContainer/PvlContainer.h @@ -62,20 +62,20 @@ namespace Isis { */ class PvlContainer { public: - PvlContainer(const std::string &type); - PvlContainer(const std::string &type, const std::string &name); + PvlContainer(const QString &type); + PvlContainer(const QString &type, const QString &name); PvlContainer(const PvlContainer &other); //! Set the name of the container. - void SetName(const std::string &name) { + void SetName(const QString &name) { p_name.SetValue(name); }; /** * Returns the container name. * @return The container name. */ - inline std::string Name() const { - return (std::string) p_name; + inline QString Name() const { + return (QString) p_name; }; /** * Returns whether the given string is equal to the container name or not. @@ -83,14 +83,14 @@ namespace Isis { * @return True if the name and string are the same, false if they are * not. */ - bool IsNamed(const std::string &match) const { - return PvlKeyword::StringEqual(match, (std::string)p_name); + bool IsNamed(const QString &match) const { + return PvlKeyword::StringEqual(match, (QString)p_name); } /** * Returns the container type. * @return The container type. */ - inline std::string Type() const { + inline QString Type() const { return p_name.Name(); }; /** @@ -125,13 +125,13 @@ namespace Isis { AddKeyword(keyword); }; - PvlKeyword &FindKeyword(const std::string &name); + PvlKeyword &FindKeyword(const QString &name); /** * When you use the [] operator with a (string) name, it will call the * FindKeyword() method. * @param name The name of the keyword to find. */ - PvlKeyword &operator[](const std::string &name) { + PvlKeyword &operator[](const QString &name) { return FindKeyword(name); }; PvlKeyword &operator[](const int index); @@ -142,17 +142,17 @@ namespace Isis { * @param name The name of the keyword to find. */ PvlKeyword &operator[](const char *name) { - return operator[](std::string(name)); + return operator[](QString(name)); }; - const PvlKeyword &FindKeyword(const std::string &name) const; + const PvlKeyword &FindKeyword(const QString &name) const; /** * When you use the [] operator with a (string) name, it will call the * FindKeyword() method. * @param name The name of the keyword to find. */ - const PvlKeyword &operator[](const std::string &name) const { + const PvlKeyword &operator[](const QString &name) const { return FindKeyword(name); }; const PvlKeyword &operator[](const int index) const; @@ -163,10 +163,10 @@ namespace Isis { * @param name The name of the keyword to find. */ PvlKeyword operator[](const char *name) const { - return operator[](std::string(name)); + return operator[](QString(name)); }; - bool HasKeyword(const std::string &name) const; + bool HasKeyword(const QString &name) const; //! The keyword iterator. typedef QList::iterator PvlKeywordIterator; @@ -174,11 +174,11 @@ namespace Isis { typedef QList::const_iterator ConstPvlKeywordIterator; - PvlKeywordIterator FindKeyword(const std::string &name, + PvlKeywordIterator FindKeyword(const QString &name, PvlKeywordIterator beg, PvlKeywordIterator end); - ConstPvlKeywordIterator FindKeyword(const std::string &name, + ConstPvlKeywordIterator FindKeyword(const QString &name, ConstPvlKeywordIterator beg, ConstPvlKeywordIterator end) const; @@ -217,7 +217,7 @@ namespace Isis { return p_keywords.end(); }; - void DeleteKeyword(const std::string &name); + void DeleteKeyword(const QString &name); void DeleteKeyword(const int index); bool CleanDuplicateKeywords(); @@ -227,7 +227,7 @@ namespace Isis { * DeleteKeyword() method. * @param name The name of the keyword to remove. */ - void operator-= (const std::string &name) { + void operator-= (const QString &name) { DeleteKeyword(name); }; /** @@ -243,7 +243,7 @@ namespace Isis { * was not initialized using a file, this string is empty. * @return The filename. */ - std::string FileName() const { + QString FileName() const { return p_filename; }; @@ -276,11 +276,11 @@ namespace Isis { inline int Comments() const { return p_name.Comments(); }; - std::string Comment(const int index) const { + QString Comment(const int index) const { return p_name.Comment(index); } - void AddComment(const std::string &comment) { + void AddComment(const QString &comment) { p_name.AddComment(comment); } @@ -294,7 +294,7 @@ namespace Isis { const PvlContainer &operator=(const PvlContainer &other); protected: - std::string p_filename; /** + +#include "IString.h" + #include "PvlContainer.h" #include "Preference.h" + +using namespace Isis; using namespace std; + int main() { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::PvlKeyword dog("DOG", 5.2, "meters"); - Isis::PvlKeyword cat("CATTLE"); + PvlKeyword dog("DOG", toString(5.2), "meters"); + PvlKeyword cat("CATTLE"); cat = "Meow"; cat.AddComment("Cats shed"); - Isis::PvlContainer ani("Animals"); + PvlContainer ani("Animals"); ani += dog; ani += cat; ani.AddComment("/* Pets are cool */"); @@ -30,7 +36,7 @@ int main() { cout << ani << endl; cout << "Test inserter ..." << endl; - Isis::PvlKeyword monkey("Orangutan", "gross"); + PvlKeyword monkey("Orangutan", "gross"); ani.AddKeyword(dog, ani.Begin()); ani.AddKeyword(monkey, ani.Begin()); cout << ani << endl; @@ -38,11 +44,11 @@ int main() { // This is testing reallocation caused by adds, // was a problem when using std::vector cout << endl << "Test reallocation ..." << endl; - Isis::PvlKeyword * ptr1 = &ani["DOG"]; + PvlKeyword * ptr1 = &ani["DOG"]; for (int i = 0; i < 250; i++) - ani += Isis::PvlKeyword("Test_keyword", i); + ani += PvlKeyword("Test_keyword", toString(i)); - Isis::PvlKeyword * ptr2 = &ani["DOG"]; + PvlKeyword * ptr2 = &ani["DOG"]; if (ptr1 == ptr2) cout << "Pointer to DOG is equivalent" << endl; else diff --git a/isis/src/base/objs/PvlEditDialog/PvlEditDialog.cpp b/isis/src/base/objs/PvlEditDialog/PvlEditDialog.cpp index 1ceac0d070..37e92b9061 100644 --- a/isis/src/base/objs/PvlEditDialog/PvlEditDialog.cpp +++ b/isis/src/base/objs/PvlEditDialog/PvlEditDialog.cpp @@ -30,7 +30,7 @@ namespace Isis { fstream input; // open as input from pvl file - input.open(pvl.FileName().c_str(), ios::in); + input.open(pvl.FileName().toAscii().data(), ios::in); string output; // read first line of input and write as first output line @@ -60,7 +60,7 @@ namespace Isis { vLayout->addLayout(buttonLayout); setLayout(vLayout); - QString titleBar = "Pvl File: " + QString::fromStdString(pvl.FileName()) ; + QString titleBar = "Pvl File: " + QString(pvl.FileName()) ; setWindowTitle(titleBar); // Add functionality to buttons @@ -106,7 +106,7 @@ namespace Isis { } catch(IException &e) { // catch errors in Pvl format when populating pvl object - QString message = e.toString().ToQt(); + QString message = e.toString(); QMessageBox::warning((QWidget *)parent(), "Error", message); return; } @@ -121,13 +121,13 @@ namespace Isis { filter); if(!pvlFile.isEmpty()) { // convert QString to std::string needed to open file stream - string saveFile = pvlFile.toStdString(); + QString saveFile = pvlFile; try { pvl.Write(saveFile); } catch(IException &e) { // report exception(s) to mesage box - QString message = e.toString().ToQt(); + QString message = e.toString(); QMessageBox::warning((QWidget *)parent(), "Error", message); return; } diff --git a/isis/src/base/objs/PvlFormat/PvlFormat.cpp b/isis/src/base/objs/PvlFormat/PvlFormat.cpp index 4a4e58fc63..17991c5021 100644 --- a/isis/src/base/objs/PvlFormat/PvlFormat.cpp +++ b/isis/src/base/objs/PvlFormat/PvlFormat.cpp @@ -21,8 +21,8 @@ */ #include "IException.h" -#include "Message.h" #include "IString.h" +#include "Message.h" #include "FileName.h" #include "PvlKeyword.h" #include "TextFile.h" @@ -47,9 +47,9 @@ namespace Isis { * used for output of PvlKeywords in Normal Isis format. * * @param file A file name with keyword=type. Where KEYWORD is the name of a - * keyword in this PvlKeyword and TYPE is one of [string | integer | float ] + * keyword in this PvlKeyword and TYPE is one of [QString | integer | float ] */ - PvlFormat::PvlFormat(const std::string &file) { + PvlFormat::PvlFormat(const QString &file) { Init(); Add(file); } @@ -57,10 +57,10 @@ namespace Isis { /* * Constructs a PvlFormat using the specified pre populated Pvl map of keyword - * name (std::string) vs keyword type (KeywordType). + * name (QString) vs keyword type (KeywordType). * * @param keywordType A Pvl with keyword=type. Where keyword is the name of a - * keyword in a PvlKeyword and type is one of [string | integer | float ] + * keyword in a PvlKeyword and type is one of [QString | integer | float ] */ PvlFormat::PvlFormat(Pvl &keywordType) { Init(); @@ -78,10 +78,10 @@ namespace Isis { /* * Add the contents of a file to the keyword type mapping. The file should - * contain KEYWORD=TYPE (one per line), where TYPE is one of the strings + * contain KEYWORD=TYPE (one per line), where TYPE is one of the QStrings * KeywordType can convert. */ - void PvlFormat::Add(const std::string &file) { + void PvlFormat::Add(const QString &file) { p_keywordMapFile = file; // Open the file and internalize it into the Pvl map @@ -90,7 +90,7 @@ namespace Isis { Add(pvl); } catch(IException &e) { - string msg; + QString msg; msg += "Unable to open or read keyword to type mapping file ["; msg += file + "]"; throw IException(e, IException::Programmer, msg, _FILEINFO_); @@ -100,16 +100,14 @@ namespace Isis { /* * Add the contents of a Pvl to the keyword type mapping. The pvl should - * contain KEYWORD=TYPE, where TYPE is one of the strings KeywordType can + * contain KEYWORD=TYPE, where TYPE is one of the QStrings KeywordType can * convert. */ void PvlFormat::Add(Pvl &pvl) { for(int i = 0; i < pvl.Keywords(); ++i) { PvlKeyword &key = pvl[i]; - IString name = key.Name(); - name.UpCase(); - IString type = key[0]; - type.UpCase(); + QString name = key.Name().toUpper(); + QString type = key[0].toUpper(); PvlKeyword newKey(name, type); for(int j = 1; j < key.Size(); ++j) newKey.AddValue(key[j]); // Make sure we don't duplicate Keys @@ -127,8 +125,7 @@ namespace Isis { * @param keyword The PvlKeyword to have its type returned */ KeywordType PvlFormat::Type(const PvlKeyword &keyword) { - IString name = keyword.Name(); - name.UpCase(); + QString name = keyword.Name().toUpper(); if(p_keywordMap.HasKeyword(name)) { PvlKeyword &key = p_keywordMap.FindKeyword(name); return ToKeywordType(key[0]); @@ -146,12 +143,11 @@ namespace Isis { * available in keyword map return -1. */ int PvlFormat::Accuracy(const PvlKeyword &keyword) { - IString name = keyword.Name(); - name.UpCase(); + QString name = keyword.Name().toUpper(); if(p_keywordMap.HasKeyword(name)) { PvlKeyword &key = p_keywordMap.FindKeyword(name); if(key.Size() > 1) { - return (int)key[1]; + return toInt(key[1]); } } return -1; @@ -164,9 +160,9 @@ namespace Isis { * @param keyword The PvlKeyword to be formatted * @param num Use the ith value of the keyword */ - std::string PvlFormat::FormatValue(const PvlKeyword &keyword, int num) { + QString PvlFormat::FormatValue(const PvlKeyword &keyword, int num) { - string val; + QString val; val.clear(); // Find out if the units are the same for all values @@ -177,7 +173,7 @@ namespace Isis { return "Null"; } - // Create a Null value if the requested index is an empty string + // Create a Null value if the requested index is an empty QString if(keyword[num].size() == 0) { val += "Null"; } @@ -221,7 +217,7 @@ namespace Isis { * * @param keyword The PvlContainer being closed. */ - std::string PvlFormat::FormatName(const PvlKeyword &keyword) { + QString PvlFormat::FormatName(const PvlKeyword &keyword) { return keyword.Name(); } @@ -232,7 +228,7 @@ namespace Isis { * @param name The text used to signify the end of a container * @param keyword The PvlContainer being closed. */ - std::string PvlFormat::FormatEnd(const std::string name, + QString PvlFormat::FormatEnd(const QString name, const PvlKeyword &keyword) { return "End_" + FormatName(keyword); }; @@ -244,14 +240,14 @@ namespace Isis { * * @param value The PvlKeyword value to be quoted if necessary. */ - std::string PvlFormat::AddQuotes(const std::string value) { - std::string val = value; + QString PvlFormat::AddQuotes(const QString value) { + QString val = value; bool needQuotes = false; // find out if we need quotes and what kind of quotes might already exist char existingQuoteType = '\0'; - for(unsigned int pos = 0; !needQuotes && pos < val.size(); pos++) { + for(int pos = 0; !needQuotes && pos < val.size(); pos++) { // check for values indicating we need quotes, if we have a sequence // it should already be properly quoted... if(pos == 0) { diff --git a/isis/src/base/objs/PvlFormat/PvlFormat.h b/isis/src/base/objs/PvlFormat/PvlFormat.h index d27afd3802..cf90d12ec9 100644 --- a/isis/src/base/objs/PvlFormat/PvlFormat.h +++ b/isis/src/base/objs/PvlFormat/PvlFormat.h @@ -51,11 +51,10 @@ namespace Isis { * @param type The string to be converted. * @return The corresponding KeywordType enum. */ - inline KeywordType ToKeywordType(const std::string type) { + inline KeywordType ToKeywordType(const QString type) { - IString t(type); - t.Remove("_- \r\n\f\t\v\"\'"); - t.UpCase(); + QString t(type); + t = t.remove(QRegExp("[\\w_-\"'")).toUpper(); if(t == "STRING") return StringKeyword; else if(t == "BOOL") return BoolKeyword; @@ -122,11 +121,11 @@ namespace Isis { public: PvlFormat(); - PvlFormat(const std::string &file); + PvlFormat(const QString &file); PvlFormat(Pvl &keymap); virtual ~PvlFormat() {}; - void Add(const std::string &file); + void Add(const QString &file); void Add(Pvl &keymap); /** @@ -151,12 +150,12 @@ namespace Isis { return p_charLimit; }; - virtual std::string FormatValue(const PvlKeyword &keyword, + virtual QString FormatValue(const PvlKeyword &keyword, int valueIndex = 0); - virtual std::string FormatName(const PvlKeyword &keyword); - virtual std::string FormatEnd(const std::string name, + virtual QString FormatName(const PvlKeyword &keyword); + virtual QString FormatEnd(const QString name, const PvlKeyword &keyword); - virtual std::string FormatEOL() { + virtual QString FormatEOL() { return "\n"; } @@ -165,10 +164,10 @@ namespace Isis { protected: - virtual std::string AddQuotes(const std::string value); + virtual QString AddQuotes(const QString value); bool IsSingleUnit(const PvlKeyword &keyword); - std::string p_keywordMapFile; + QString p_keywordMapFile; Pvl p_keywordMap; //! Maximum number of characters on a single line of a keyword value. diff --git a/isis/src/base/objs/PvlFormat/PvlFormat.truth b/isis/src/base/objs/PvlFormat/PvlFormat.truth index 85c4b2eb5a..865d45b261 100644 --- a/isis/src/base/objs/PvlFormat/PvlFormat.truth +++ b/isis/src/base/objs/PvlFormat/PvlFormat.truth @@ -1,14 +1,14 @@ mystring = stringval mystring = "string val" myint = 12345 -myfloat = 1.234567e+93 +myfloat = 12345.67e+89 myarray = (12345, "a short string", 1.234) myarray = {12345, "a short string", 1.234} Group = Group1 mystring = stringval mystring = "string val" myint = 12345 - myfloat = 1.234567e+93 + myfloat = 12345.67e+89 myarray = (12345,"a short string",1.234) End_Group Object = Object1 @@ -16,7 +16,7 @@ Object = Object1 mystring = stringval mystring = "string val" myint = 12345 - myfloat = 1.234567e+93 + myfloat = 12345.67e+89 myarray = (12345,"a short string",1.234) End_Object @@ -24,7 +24,7 @@ Object = Object1 mystring = stringval mystring = "string val" myint = 12345 - myfloat = 1.234567e+93 + myfloat = 12345.67e+89 myarray = (12345,"a short string",1.234) End_Group End_Object diff --git a/isis/src/base/objs/PvlFormat/unitTest.cpp b/isis/src/base/objs/PvlFormat/unitTest.cpp index 7f5c86afac..7981bcd77f 100644 --- a/isis/src/base/objs/PvlFormat/unitTest.cpp +++ b/isis/src/base/objs/PvlFormat/unitTest.cpp @@ -20,12 +20,12 @@ int main() { } { - Isis::PvlKeyword key("myint", 12345); + Isis::PvlKeyword key("myint", "12345"); cout << key << endl; } { - Isis::PvlKeyword key("myfloat", 12345.67e+89); + Isis::PvlKeyword key("myfloat", "12345.67e+89"); cout << key << endl; } @@ -45,8 +45,8 @@ int main() { Isis::PvlGroup grp("Group1"); grp += Isis::PvlKeyword("mystring", "stringval"); grp += Isis::PvlKeyword("mystring", "string val"); - grp += Isis::PvlKeyword("myint", 12345); - grp += Isis::PvlKeyword("myfloat", 12345.67e+89); + grp += Isis::PvlKeyword("myint", "12345"); + grp += Isis::PvlKeyword("myfloat", "12345.67e+89"); grp += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); cout << grp << endl; } @@ -57,8 +57,8 @@ int main() { Isis::PvlGroup grp("Group1"); grp += Isis::PvlKeyword("mystring", "stringval"); grp += Isis::PvlKeyword("mystring", "string val"); - grp += Isis::PvlKeyword("myint", 12345); - grp += Isis::PvlKeyword("myfloat", 12345.67e+89); + grp += Isis::PvlKeyword("myint", "12345"); + grp += Isis::PvlKeyword("myfloat", "12345.67e+89"); grp += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); Isis::PvlObject obj("Object1"); obj.AddGroup(grp); @@ -66,8 +66,8 @@ int main() { Isis::PvlObject obj2("Object2"); obj2 += Isis::PvlKeyword("mystring", "stringval"); obj2 += Isis::PvlKeyword("mystring", "string val"); - obj2 += Isis::PvlKeyword("myint", 12345); - obj2 += Isis::PvlKeyword("myfloat", 12345.67e+89); + obj2 += Isis::PvlKeyword("myint", "12345"); + obj2 += Isis::PvlKeyword("myfloat", "12345.67e+89"); obj2 += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); obj.AddObject(obj2); cout << obj << endl; diff --git a/isis/src/base/objs/PvlFormatPds/PvlFormatPds.cpp b/isis/src/base/objs/PvlFormatPds/PvlFormatPds.cpp index a8799988f6..6ac91e47b6 100644 --- a/isis/src/base/objs/PvlFormatPds/PvlFormatPds.cpp +++ b/isis/src/base/objs/PvlFormatPds/PvlFormatPds.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include "IException.h" #include "Message.h" #include "IString.h" @@ -51,14 +53,14 @@ namespace Isis { * @param file A file name with keyword=type. Where KEYWORD is the name of a * keyword and TYPE is one of [string | integer | float | ...] */ - PvlFormatPds::PvlFormatPds(const std::string &file) : PvlFormat(file) { + PvlFormatPds::PvlFormatPds(const QString &file) : PvlFormat(file) { Init(); } /* * Constructs a PvlFormatPds using the specified pre populated map of keyword name - * (std::string) vs keyword type (KeywordType). + * (QString) vs keyword type (KeywordType). * * @param keywordType A map with keyword, type. Where keyword is the name of a * keyword in a PvlKeyword and type is one of [string | integer | float ] @@ -79,13 +81,12 @@ namespace Isis { * @param keyword The PvlKeyword to be formatted * @param num Use the ith value of the keyword */ - std::string PvlFormatPds::FormatValue(const PvlKeyword &keyword, int num) { + QString PvlFormatPds::FormatValue(const PvlKeyword &keyword, int num) { - IString name = keyword.Name(); - name.UpCase(); + QString name = keyword.Name().toUpper(); if(name == "OBJECT" || (name == "GROUP")) { - IString val = (string)keyword; - return val.UpCase(); + QString val = (QString)keyword; + return val.toUpper(); } // Find out what type this keyword is @@ -140,10 +141,9 @@ namespace Isis { * the if portion of the code already * adds quotes automatically */ - std::string PvlFormatPds::FormatString(const PvlKeyword &keyword, int num) { + QString PvlFormatPds::FormatString(const PvlKeyword &keyword, int num) { - IString val; - val.clear(); + QString val; bool singleUnit = false; // Create a Null value if the value index is greater than the number of values @@ -152,8 +152,7 @@ namespace Isis { } // Handle PDS special values "N/A" "NULL" "UNK" - IString tmp = keyword[num]; - tmp.UpCase(); + QString tmp = keyword[num][0].toUpper(); if((tmp == "N/A") || (tmp == "NULL") || (tmp == "UNK")) { val += "\"" + tmp + "\""; } @@ -170,7 +169,7 @@ namespace Isis { // Add the units to this value if((!singleUnit) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // For now PDS units are case sensitive, so we should not UpCase them // unit.UpCase(); val += " <" + unit + ">"; @@ -188,7 +187,7 @@ namespace Isis { // Add the units to the end if all values have the same units if((singleUnit) && (num == keyword.Size() - 1) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // For now PDS units are case sensitive, so we should not UpCase them // unit.UpCase(); val += " <" + unit + ">"; @@ -204,10 +203,10 @@ namespace Isis { * @param keyword The PvlKeyword to be formatted * @param num Use the ith value of the keyword */ - std::string PvlFormatPds::FormatReal(const PvlKeyword &keyword, int num, - int places) { + QString PvlFormatPds::FormatReal(const PvlKeyword &keyword, int num, + int places) { - IString val; + QString val; val.clear(); bool singleUnit = false; @@ -222,15 +221,14 @@ namespace Isis { } // Handle PDS special values "N/A" "NULL" "UNK" - IString tmp = keyword[num]; - tmp.UpCase(); + QString tmp = keyword[num].toUpper(); if((tmp == "N/A") || (tmp == "NULL") || (tmp == "UNK")) { val += "\"" + tmp + "\""; } else if(places >= 0) { stringstream out; - out << setiosflags(ios::fixed) << setprecision(places) << (double)keyword[num]; - val += out.str(); + out << setiosflags(ios::fixed) << setprecision(places) << toDouble((QString)keyword[num]); + val += out.str().c_str(); } else { val += keyword[num]; @@ -238,7 +236,7 @@ namespace Isis { // Add the units to this value if((!singleUnit) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -255,7 +253,7 @@ namespace Isis { // Add the units to the end if all values have the same units if((singleUnit) && (num == keyword.Size() - 1) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -270,9 +268,9 @@ namespace Isis { * @param keyword The PvlKeyword to be formatted * @param num Use the ith value of the keyword */ - std::string PvlFormatPds::FormatEnum(const PvlKeyword &keyword, int num) { + QString PvlFormatPds::FormatEnum(const PvlKeyword &keyword, int num) { - IString val; + QString val; val.clear(); bool singleUnit = false; @@ -287,8 +285,7 @@ namespace Isis { } // Handle PDS special values "N/A" "NULL" "UNK" - IString tmp = keyword[num]; - tmp.UpCase(); + QString tmp = keyword[num].toUpper(); if((tmp == "N/A") || (tmp == "NULL") || (tmp == "UNK")) { val += "\"" + tmp + "\""; } @@ -298,7 +295,7 @@ namespace Isis { // Add the units to this value if((!singleUnit) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -315,7 +312,7 @@ namespace Isis { // Add the units to the end if all values have the same units if((singleUnit) && (num == keyword.Size() - 1) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -335,9 +332,9 @@ namespace Isis { * the if portion of the code already * adds quotes automatically */ - std::string PvlFormatPds::FormatUnknown(const PvlKeyword &keyword, int num) { + QString PvlFormatPds::FormatUnknown(const PvlKeyword &keyword, int num) { - IString val; + QString val; val.clear(); bool singleUnit = false; @@ -347,8 +344,7 @@ namespace Isis { } // Handle PDS special values "N/A" "NULL" "UNK" - IString tmp = keyword[num]; - tmp.UpCase(); + QString tmp = keyword[num].toUpper(); if((tmp == "N/A") || (tmp == "NULL") || (tmp == "UNK")) { val += "\"" + tmp + "\""; } @@ -365,7 +361,7 @@ namespace Isis { // Add the units to this value if((!singleUnit) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -382,7 +378,7 @@ namespace Isis { // Add the units to the end if all values have the same units if((singleUnit) && (num == keyword.Size() - 1) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -397,9 +393,9 @@ namespace Isis { * @param keyword The PvlKeyword to be formatted * @param num Use the ith value of the keyword */ - std::string PvlFormatPds::FormatInteger(const PvlKeyword &keyword, int num, int bytes) { + QString PvlFormatPds::FormatInteger(const PvlKeyword &keyword, int num, int bytes) { - IString val; + QString val; val.clear(); bool singleUnit = false; @@ -414,8 +410,7 @@ namespace Isis { } // Handle PDS special values "N/A" "NULL" "UNK" - IString tmp = keyword[num]; - tmp.UpCase(); + QString tmp = keyword[num].toUpper(); if((tmp == "N/A") || (tmp == "NULL") || (tmp == "UNK")) { val += "\"" + tmp + "\""; } @@ -425,7 +420,7 @@ namespace Isis { // Add the units to this value if((!singleUnit) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -442,7 +437,7 @@ namespace Isis { // Add the units to the end if all values have the same units if((singleUnit) && (num == keyword.Size() - 1) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -457,9 +452,9 @@ namespace Isis { * @param keyword The PvlKeyword to be formatted * @param num Use the ith value of the keyword */ - std::string PvlFormatPds::FormatBinary(const PvlKeyword &keyword, int num, int bits) { + QString PvlFormatPds::FormatBinary(const PvlKeyword &keyword, int num, int bits) { - IString val; + QString val; val.clear(); bool singleUnit = false; @@ -475,14 +470,13 @@ namespace Isis { } // Handle PDS special values "N/A" "NULL" "UNK" - IString tmp = keyword[num]; - tmp.UpCase(); + QString tmp = keyword[num].toUpper(); if((tmp == "N/A") || (tmp == "NULL") || (tmp == "UNK")) { val += "\"" + tmp + "\""; } else { tmp.clear(); - BigInt value = (BigInt)keyword[num]; + BigInt value = toBigInt((QString)keyword[num]); string binDig = "01"; do { tmp = binDig[value % 2] + tmp; @@ -491,13 +485,13 @@ namespace Isis { while(value); ss << right << setfill('0') << setw(bits) << tmp; - tmp = ss.str(); + tmp = ss.str().c_str(); val += "2#" + tmp + "#"; } // Add the units to this value if((!singleUnit) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -514,7 +508,7 @@ namespace Isis { // Add the units to the end if all values have the same units if((singleUnit) && (num == keyword.Size() - 1) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -531,9 +525,9 @@ namespace Isis { */ - std::string PvlFormatPds::FormatHex(const PvlKeyword &keyword, int num, int bytes) { + QString PvlFormatPds::FormatHex(const PvlKeyword &keyword, int num, int bytes) { - IString val; + QString val; val.clear(); bool singleUnit = false; @@ -548,30 +542,29 @@ namespace Isis { } // Handle PDS special values "N/A" "NULL" "UNK" - IString tmp = keyword[num]; - tmp.UpCase(); + QString tmp = keyword[num].toUpper(); if((tmp == "N/A") || (tmp == "NULL") || (tmp == "UNK")) { val += "\"" + tmp + "\""; } else { stringstream ss; if(bytes == 2) { - ss << hex << (unsigned short int)(int)keyword[num]; + ss << hex << (unsigned short int)toInt((QString)keyword[num]); } else if(bytes == 4) { - ss << hex << (unsigned int)(int)keyword[num]; + ss << hex << (unsigned int)toInt((QString)keyword[num]); } else { - ss << hex << (BigInt)keyword[num]; + ss << hex << toBigInt((QString)keyword[num]); } - IString h = ss.str(); - h.UpCase(); + QString h = ss.str().c_str(); + h = h.toUpper(); val += "16#" + h + "#"; } // Add the units to this value if((!singleUnit) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -588,7 +581,7 @@ namespace Isis { // Add the units to the end if all values have the same units if((singleUnit) && (num == keyword.Size() - 1) && (keyword.Unit(num).size() > 0)) { - IString unit = keyword.Unit(num); + QString unit = keyword.Unit(num); // unit.UpCase(); val += " <" + unit + ">"; } @@ -603,9 +596,9 @@ namespace Isis { * @param keyword The PvlKeyword to be formatted * @param num Use the ith value of the keyword */ - std::string PvlFormatPds::FormatBool(const PvlKeyword &keyword, int num) { + QString PvlFormatPds::FormatBool(const PvlKeyword &keyword, int num) { - IString val; + QString val; val.clear(); // Create a Null value if the value index is greater than the number of values @@ -619,8 +612,8 @@ namespace Isis { } // Handle PDS special values "N/A" "NULL" "UNK" - IString tmp = keyword[num]; - tmp.UpCase(); + QString tmp = keyword[num]; + tmp = tmp.toUpper(); if((tmp == "N/A") || (tmp == "NULL") || (tmp == "UNK")) { val += "\"" + tmp + "\""; } @@ -648,9 +641,9 @@ namespace Isis { * * @param keyword The keyword (i.e., the Object or Group) */ - std::string PvlFormatPds::FormatName(const PvlKeyword &keyword) { - IString text = keyword.Name(); - text.UpCase(); + QString PvlFormatPds::FormatName(const PvlKeyword &keyword) { + QString text = keyword.Name(); + text = text.toUpper(); return text; }; @@ -661,13 +654,12 @@ namespace Isis { * @param name A string representing the end text. * @param keyword The keyword (i.e., the Object or Group) that is ending */ - std::string PvlFormatPds::FormatEnd(const std::string name, + QString PvlFormatPds::FormatEnd(const QString name, const PvlKeyword &keyword) { - IString left = name; - left.UpCase(); + QString left = name.toUpper(); left += " = "; - IString right = (string)keyword; - right.UpCase(); + QString right = (QString)keyword; + right = right.toUpper(); return left + right; }; @@ -682,14 +674,14 @@ namespace Isis { * the first character of the * string is " or ' */ - std::string PvlFormatPds::AddQuotes(const std::string value) { + QString PvlFormatPds::AddQuotes(const QString value) { - std::string val = value; + QString val = value; bool quoteValue = true; bool singleQuoteValue = false; - if(val.find(" ") != std::string::npos) { - if(val.find("\"") != std::string::npos) { + if(val.contains(" ")) { + if(val.contains("\"")) { singleQuoteValue = true; quoteValue = false; } diff --git a/isis/src/base/objs/PvlFormatPds/PvlFormatPds.h b/isis/src/base/objs/PvlFormatPds/PvlFormatPds.h index 5f2b700c3e..9d31cf0439 100644 --- a/isis/src/base/objs/PvlFormatPds/PvlFormatPds.h +++ b/isis/src/base/objs/PvlFormatPds/PvlFormatPds.h @@ -61,30 +61,30 @@ namespace Isis { public: PvlFormatPds(); - PvlFormatPds(const std::string &file); + PvlFormatPds(const QString &file); PvlFormatPds(Pvl &keymap); virtual ~PvlFormatPds() {}; - virtual std::string FormatValue(const PvlKeyword &keyword, + virtual QString FormatValue(const PvlKeyword &keyword, int valueIndex = 0); - virtual std::string FormatName(const PvlKeyword &keyword); - virtual std::string FormatEnd(const std::string name, + virtual QString FormatName(const PvlKeyword &keyword); + virtual QString FormatEnd(const QString name, const PvlKeyword &keyword); - virtual std::string FormatEOL() { + virtual QString FormatEOL() { return "\015\012"; } protected: - virtual std::string AddQuotes(const std::string value); + virtual QString AddQuotes(const QString value); - std::string FormatString(const PvlKeyword &keyword, int num); - std::string FormatInteger(const PvlKeyword &keyword, int num, int bytes); - std::string FormatReal(const PvlKeyword &keyword, int num, int precision); - std::string FormatEnum(const PvlKeyword &keyword, int num); - std::string FormatBinary(const PvlKeyword &keyword, int num, int bytes); - std::string FormatHex(const PvlKeyword &keyword, int num, int bytes); - std::string FormatBool(const PvlKeyword &keyword, int num); - std::string FormatUnknown(const PvlKeyword &keyword, int num); + QString FormatString(const PvlKeyword &keyword, int num); + QString FormatInteger(const PvlKeyword &keyword, int num, int bytes); + QString FormatReal(const PvlKeyword &keyword, int num, int precision); + QString FormatEnum(const PvlKeyword &keyword, int num); + QString FormatBinary(const PvlKeyword &keyword, int num, int bytes); + QString FormatHex(const PvlKeyword &keyword, int num, int bytes); + QString FormatBool(const PvlKeyword &keyword, int num); + QString FormatUnknown(const PvlKeyword &keyword, int num); private: void Init(); diff --git a/isis/src/base/objs/PvlFormatPds/unitTest.cpp b/isis/src/base/objs/PvlFormatPds/unitTest.cpp index 23af5ba59b..ddcb07b7d5 100644 --- a/isis/src/base/objs/PvlFormatPds/unitTest.cpp +++ b/isis/src/base/objs/PvlFormatPds/unitTest.cpp @@ -1,5 +1,7 @@ #include +#include + #include "Pvl.h" #include "PvlKeyword.h" #include "PvlGroup.h" @@ -10,252 +12,254 @@ #include "PvlFormatPds.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main() { - Isis::Preference::Preferences(true); + Preference::Preferences(true); try { - Isis::PvlFormatPds *pdsFormatter; + PvlFormatPds *pdsFormatter; // Create a temp file for the keyword to type map { - Isis::FileName fname = Isis::FileName::createTempFile("tempPvlFormatPDSunitTest_.tmp"); - std::string pdsFile = fname.expanded(); + FileName fname = FileName::createTempFile("tempPvlFormatPDSunitTest_.tmp"); + QString pdsFile = fname.expanded(); ofstream out; - out.open(pdsFile.c_str(), std::ios::out); + out.open(pdsFile.toAscii().data(), std::ios::out); { - Isis::PvlKeyword key("skey", "string"); + PvlKeyword key("skey", "string"); out << key << endl; } { - Isis::PvlKeyword key("ikey", "integer"); + PvlKeyword key("ikey", "integer"); out << key << endl; } { - Isis::PvlKeyword key("fkey2", "rEaL"); - key.AddValue(2); + PvlKeyword key("fkey2", "rEaL"); + key.AddValue(toString(2)); out << key << endl; } { - Isis::PvlKeyword key("bkey", "bool"); + PvlKeyword key("bkey", "bool"); out << key << endl; } { - Isis::PvlKeyword key("fkey0", "real"); - key.AddValue(0); + PvlKeyword key("fkey0", "real"); + key.AddValue(toString(0)); out << key << endl; } { - Isis::PvlKeyword key("fkey", "real"); + PvlKeyword key("fkey", "real"); out << key << endl; } { - Isis::PvlKeyword key("ekey", "enum"); + PvlKeyword key("ekey", "enum"); out << key << endl; } { - Isis::PvlKeyword key("hkey0", "hEX"); + PvlKeyword key("hkey0", "hEX"); out << key << endl; } { - Isis::PvlKeyword key("hkey2", "hEX"); - key.AddValue(2); + PvlKeyword key("hkey2", "hEX"); + key.AddValue(toString(2)); out << key << endl; } { - Isis::PvlKeyword key("hkey4", "hEX"); - key.AddValue(4); + PvlKeyword key("hkey4", "hEX"); + key.AddValue(toString(4)); out << key << endl; } { - Isis::PvlKeyword key("binkey", "binary"); - key.AddValue(7); + PvlKeyword key("binkey", "binary"); + key.AddValue(toString(7)); out << key << endl; } { - Isis::PvlKeyword key("binkey16", "binary"); - key.AddValue(16); + PvlKeyword key("binkey16", "binary"); + key.AddValue(toString(16)); out << key << endl; } { - Isis::PvlKeyword key("intkeyarray", "integer"); + PvlKeyword key("intkeyarray", "integer"); out << key << endl; } { - Isis::PvlKeyword key("dblkeyarray", "rEaL"); - key.AddValue(2); + PvlKeyword key("dblkeyarray", "rEaL"); + key.AddValue(toString(2)); out << key << endl; } { - Isis::PvlKeyword key("wrapword", "string"); + PvlKeyword key("wrapword", "string"); out << key << endl; } { - Isis::PvlKeyword key("array", "integer"); + PvlKeyword key("array", "integer"); out << key << endl; } out.close(); - pdsFormatter = new Isis::PvlFormatPds(pdsFile); - remove(pdsFile.c_str()); + pdsFormatter = new PvlFormatPds(pdsFile); + QFile::remove(pdsFile); } // Test Keywords { - Isis::PvlKeyword key("skey", "somestringval"); + PvlKeyword key("skey", "somestringval"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("skey", "string val", "chars"); + PvlKeyword key("skey", "string val", "chars"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("sNAstring", "N/A"); + PvlKeyword key("sNAstring", "N/A"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("sUNKquote", "\"UNK\""); + PvlKeyword key("sUNKquote", "\"UNK\""); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("ssinglequote", "\'NA\'"); + PvlKeyword key("ssinglequote", "\'NA\'"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("notinmap", "junk string"); + PvlKeyword key("notinmap", "junk string"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("myint", 12345); + PvlKeyword key("myint", "12345"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("myfloat", -12345.67e+89, "degrees"); + PvlKeyword key("myfloat", toString(-12345.67e+89), "degrees"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("fkey", -12345.6789); + PvlKeyword key("fkey", toString(-12345.6789)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("fkey0", -9876.543); + PvlKeyword key("fkey0", toString(-9876.543)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("fkey0", -9876.543e-99); + PvlKeyword key("fkey0", toString(-9876.543e-99)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("fkey2", 0.123456); + PvlKeyword key("fkey2", toString(0.123456)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("fkey2", 0.123456, "goofys"); - key.AddValue(987.123, "goofys"); + PvlKeyword key("fkey2", toString(0.123456), "goofys"); + key.AddValue(toString(987.123), "goofys"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("fkey2", 0.123456, "goofys"); - key.AddValue(987.123); + PvlKeyword key("fkey2", toString(0.123456), "goofys"); + key.AddValue(toString(987.123)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("ekey", "unsigned"); + PvlKeyword key("ekey", "unsigned"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("myarray", "(12345,\"a short string\",1.234)"); + PvlKeyword key("myarray", "(12345,\"a short string\",1.234)"); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("hkey0", (Isis::BigInt)0x123456789abcdeffLL); + PvlKeyword key("hkey0", toString((BigInt)0x123456789abcdeffLL)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("hkey2", 0x7a8b); + PvlKeyword key("hkey2", toString(0x7a8b)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("hkey4", 0x1a2b3c4d); + PvlKeyword key("hkey4", toString(0x1a2b3c4d)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("binkey", 0xA); + PvlKeyword key("binkey", toString(0xA)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("binkey16", 0xffff); + PvlKeyword key("binkey16", toString(0xffff)); cout << key << endl; key.SetFormat(pdsFormatter); cout << key << pdsFormatter->FormatEOL(); } { - Isis::PvlKeyword key("intkeyarray", 1); + PvlKeyword key("intkeyarray", toString(1)); key.AddValue("NULL"); key.AddValue("3"); key.AddValue("NULL"); @@ -265,7 +269,7 @@ int main() { } { - Isis::PvlKeyword key("intkeyarray", 1, "m"); + PvlKeyword key("intkeyarray", toString(1), "m"); key.AddValue("NULL", "m"); key.AddValue("3", "m"); key.AddValue("N/A"); @@ -276,7 +280,7 @@ int main() { } { - Isis::PvlKeyword key("dblkeyarray", 1.01); + PvlKeyword key("dblkeyarray", toString(1.01)); key.AddValue("NULL"); key.AddValue("3.4"); key.AddValue("UNK"); @@ -288,15 +292,15 @@ int main() { // Test Groups { - Isis::PvlGroup grp("Group1"); - grp += Isis::PvlKeyword("skey", "stringval"); - grp += Isis::PvlKeyword("mystring", "string val"); - grp += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - grp += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - grp += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - grp += Isis::PvlKeyword("myint", 12345); - grp += Isis::PvlKeyword("myfloat", 12345.67e+89); - grp += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + PvlGroup grp("Group1"); + grp += PvlKeyword("skey", "stringval"); + grp += PvlKeyword("mystring", "string val"); + grp += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + grp += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + grp += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + grp += PvlKeyword("myint", toString(12345)); + grp += PvlKeyword("myfloat", toString(12345.67e+89)); + grp += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); cout << "=============================== Before" << endl; cout << grp << endl; grp.SetFormat(pdsFormatter); @@ -307,37 +311,37 @@ int main() { // Test Objects { - Isis::PvlGroup grp("Group1"); - grp += Isis::PvlKeyword("skey", "stringval"); - grp += Isis::PvlKeyword("mystring", "string val"); - grp += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - grp += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - grp += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - grp += Isis::PvlKeyword("myint", 12345); - grp += Isis::PvlKeyword("myfloat", 12345.67e+89); - grp += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); - Isis::PvlObject obj("Object1"); + PvlGroup grp("Group1"); + grp += PvlKeyword("skey", "stringval"); + grp += PvlKeyword("mystring", "string val"); + grp += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + grp += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + grp += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + grp += PvlKeyword("myint", toString(12345)); + grp += PvlKeyword("myfloat", toString(12345.67e+89)); + grp += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + PvlObject obj("Object1"); obj.AddGroup(grp); - Isis::PvlObject obj2("Object2"); - obj2 += Isis::PvlKeyword("skey", "stringval"); - obj2 += Isis::PvlKeyword("mystring", "string val"); - obj2 += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - obj2 += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - obj2 += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - obj2 += Isis::PvlKeyword("myint", 12345); - obj2 += Isis::PvlKeyword("myfloat", 12345.67e+89); - obj2 += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + PvlObject obj2("Object2"); + obj2 += PvlKeyword("skey", "stringval"); + obj2 += PvlKeyword("mystring", "string val"); + obj2 += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + obj2 += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + obj2 += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + obj2 += PvlKeyword("myint", toString(12345)); + obj2 += PvlKeyword("myfloat", toString(12345.67e+89)); + obj2 += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); obj.AddObject(obj2); - obj += Isis::PvlKeyword("skey", "stringval"); - obj += Isis::PvlKeyword("mystring", "string val"); - obj += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - obj += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - obj += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - obj += Isis::PvlKeyword("myint", 12345); - obj += Isis::PvlKeyword("myfloat", 12345.67e+89); - obj += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + obj += PvlKeyword("skey", "stringval"); + obj += PvlKeyword("mystring", "string val"); + obj += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + obj += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + obj += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + obj += PvlKeyword("myint", toString(12345)); + obj += PvlKeyword("myfloat", toString(12345.67e+89)); + obj += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); cout << "=============================== Before" << endl; @@ -350,81 +354,81 @@ int main() { // Test Pvl { - Isis::Pvl pvl; - - Isis::PvlObject obj("Object1"); - - Isis::PvlGroup grp("Group1"); - grp += Isis::PvlKeyword("skey", "stringval"); - grp += Isis::PvlKeyword("mystring", "string val"); - grp += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - grp += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - grp += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - grp += Isis::PvlKeyword("myint", 12345); - grp += Isis::PvlKeyword("myfloat", 12345.67e+89); - grp += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + Pvl pvl; + + PvlObject obj("Object1"); + + PvlGroup grp("Group1"); + grp += PvlKeyword("skey", "stringval"); + grp += PvlKeyword("mystring", "string val"); + grp += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + grp += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + grp += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + grp += PvlKeyword("myint", toString(12345)); + grp += PvlKeyword("myfloat", toString(12345.67e+89)); + grp += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); obj.AddGroup(grp); - Isis::PvlObject obj2("Object2"); - obj2 += Isis::PvlKeyword("skey", "stringval"); - obj2 += Isis::PvlKeyword("mystring", "string val"); - obj2 += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - obj2 += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - obj2 += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - obj2 += Isis::PvlKeyword("myint", 12345); - obj2 += Isis::PvlKeyword("myfloat", 12345.67e+89); - obj2 += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); - obj2 += Isis::PvlKeyword("binkey16", 0x01f0); + PvlObject obj2("Object2"); + obj2 += PvlKeyword("skey", "stringval"); + obj2 += PvlKeyword("mystring", "string val"); + obj2 += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + obj2 += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + obj2 += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + obj2 += PvlKeyword("myint", toString(12345)); + obj2 += PvlKeyword("myfloat", toString(12345.67e+89)); + obj2 += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + obj2 += PvlKeyword("binkey16", toString(0x01f0)); obj.AddObject(obj2); - obj += Isis::PvlKeyword("skey", "stringval"); - obj += Isis::PvlKeyword("mystring", "string val"); - obj += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - obj += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - obj += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - obj += Isis::PvlKeyword("myint", 12345); - obj += Isis::PvlKeyword("myfloat", 12345.67e+89); - obj += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); - - pvl += Isis::PvlKeyword("skey", "stringval"); - pvl += Isis::PvlKeyword("mystring", "string val"); - pvl += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - pvl += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - pvl += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - pvl += Isis::PvlKeyword("myint", 12345); - pvl += Isis::PvlKeyword("myfloat", 12345.67e+89); - pvl += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + obj += PvlKeyword("skey", "stringval"); + obj += PvlKeyword("mystring", "string val"); + obj += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + obj += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + obj += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + obj += PvlKeyword("myint", toString(12345)); + obj += PvlKeyword("myfloat", toString(12345.67e+89)); + obj += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + + pvl += PvlKeyword("skey", "stringval"); + pvl += PvlKeyword("mystring", "string val"); + pvl += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + pvl += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + pvl += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + pvl += PvlKeyword("myint", toString(12345)); + pvl += PvlKeyword("myfloat", toString(12345.67e+89)); + pvl += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); pvl.AddObject(obj); - Isis::PvlGroup grp2("Group2"); - grp2 += Isis::PvlKeyword("skey", "stringval"); - grp2 += Isis::PvlKeyword("mystring", "string val"); - grp2 += Isis::PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set - grp2 += Isis::PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes - grp2 += Isis::PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes - grp2 += Isis::PvlKeyword("myint", 12345); - grp2 += Isis::PvlKeyword("myfloat", 12345.67e+89); - grp2 += Isis::PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); - grp2 += Isis::PvlKeyword("binkey16", 0x8001); - grp2 += Isis::PvlKeyword("wrapword", "The quick brown fox jumped over the lazy duck. " + PvlGroup grp2("Group2"); + grp2 += PvlKeyword("skey", "stringval"); + grp2 += PvlKeyword("mystring", "string val"); + grp2 += PvlKeyword("sNULLstring", "NULL"); // should add quotes after format set + grp2 += PvlKeyword("sUNKquote", "\"UNK\""); // should not add more quotes + grp2 += PvlKeyword("sNAsingle", "\'N/A\'"); // should not add more quotes + grp2 += PvlKeyword("myint", toString(12345)); + grp2 += PvlKeyword("myfloat", toString(12345.67e+89)); + grp2 += PvlKeyword("myarray", "(12345,\"a short string\",1.234)"); + grp2 += PvlKeyword("binkey16", toString(0x8001)); + grp2 += PvlKeyword("wrapword", "The quick brown fox jumped over the lazy duck. " "Repunzel Repunzel let down your hair. The little toy dog is covered with dust," " but sturdy and staunch he stands; and the little toy soldier is red with rust."); - Isis::PvlKeyword key(Isis::PvlKeyword("array", 12345)); - key.AddValue(67890); - key.AddValue(12345); - key.AddValue(67890); - key.AddValue(12345); - key.AddValue(67890); - key.AddValue(12345); - key.AddValue(67890); - key.AddValue(12345); - key.AddValue(67890); - key.AddValue(12345); - key.AddValue(67890); - key.AddValue(12345); - key.AddValue(67890); - key.AddValue(12345); + PvlKeyword key(PvlKeyword("array", toString(12345))); + key.AddValue(toString(67890)); + key.AddValue(toString(12345)); + key.AddValue(toString(67890)); + key.AddValue(toString(12345)); + key.AddValue(toString(67890)); + key.AddValue(toString(12345)); + key.AddValue(toString(67890)); + key.AddValue(toString(12345)); + key.AddValue(toString(67890)); + key.AddValue(toString(12345)); + key.AddValue(toString(67890)); + key.AddValue(toString(12345)); + key.AddValue(toString(67890)); + key.AddValue(toString(12345)); grp2 += key; pvl.AddGroup(grp2); @@ -438,7 +442,7 @@ int main() { } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } diff --git a/isis/src/base/objs/PvlGroup/PvlGroup.cpp b/isis/src/base/objs/PvlGroup/PvlGroup.cpp index 437e212ed7..5e70e195d4 100644 --- a/isis/src/base/objs/PvlGroup/PvlGroup.cpp +++ b/isis/src/base/objs/PvlGroup/PvlGroup.cpp @@ -32,7 +32,7 @@ namespace Isis { * Creates a PvlGroup object with a name. * @param name The group name. */ - PvlGroup::PvlGroup(const std::string &name) : + PvlGroup::PvlGroup(const QString &name) : Isis::PvlContainer("Group", name) { } @@ -69,7 +69,7 @@ namespace Isis { is.seekg(beforeKeywordPos, ios::beg); - string msg = "Expected PVL keyword named [Group], found keyword named ["; + QString msg = "Expected PVL keyword named [Group], found keyword named ["; msg += readKeyword.Name(); msg += "] when reading PVL"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -85,7 +85,7 @@ namespace Isis { is.seekg(beforeKeywordPos, ios::beg); - string msg = "Expected a single value for group name, found [("; + QString msg = "Expected a single value for group name, found [("; for(int i = 0; i < readKeyword.Size(); i++) { if(i != 0) msg += ", "; @@ -118,7 +118,7 @@ namespace Isis { is.seekg(beforeKeywordPos, ios::beg); - string msg = "Unexpected ["; + QString msg = "Unexpected ["; msg += readKeyword.Name(); msg += "] in Group ["; msg += result.Name(); @@ -142,7 +142,7 @@ namespace Isis { is.seekg(beforeKeywordPos, ios::beg); - string msg = "Group [" + result.Name(); + QString msg = "Group [" + result.Name(); msg += "] EndGroup not found before end of file when reading PVL"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -221,7 +221,7 @@ namespace Isis { { // Group cannot be empty - needs to have a keyword if(pPvlGrp.Keywords() <= 0) { - string sErrMsg = "Group \"" + pPvlGrp.Name() + "\" has no Keywords\n"; + QString sErrMsg = "Group \"" + pPvlGrp.Name() + "\" has no Keywords\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } diff --git a/isis/src/base/objs/PvlGroup/PvlGroup.h b/isis/src/base/objs/PvlGroup/PvlGroup.h index dc3360ce08..6325121653 100644 --- a/isis/src/base/objs/PvlGroup/PvlGroup.h +++ b/isis/src/base/objs/PvlGroup/PvlGroup.h @@ -55,7 +55,7 @@ namespace Isis { class PvlGroup : public Isis::PvlContainer { public: PvlGroup(); - PvlGroup(const std::string &name); + PvlGroup(const QString &name); PvlGroup(const PvlGroup &other); //! Validate a Group comparing with the Template Group diff --git a/isis/src/base/objs/PvlGroup/unitTest.cpp b/isis/src/base/objs/PvlGroup/unitTest.cpp index fba2c68421..4da9be4361 100644 --- a/isis/src/base/objs/PvlGroup/unitTest.cpp +++ b/isis/src/base/objs/PvlGroup/unitTest.cpp @@ -11,7 +11,7 @@ using namespace Isis; int main() { Isis::Preference::Preferences(true); - Isis::PvlKeyword dog("DOG", 5.2, "meters"); + Isis::PvlKeyword dog("DOG", toString(5.2), "meters"); Isis::PvlKeyword cat("CATTLE"); cat = "Meow"; cat.AddComment("Cats shed"); @@ -113,7 +113,7 @@ int main() { // PvlGroup to be Validated PvlGroup pvlGrp("Point_errormagnitude"); - PvlKeyword pvlKwrd("LessThan", 2.5); + PvlKeyword pvlKwrd("LessThan", toString(2.5)); try { pvlTmplGrp.ValidateGroup(pvlGrp); @@ -127,19 +127,19 @@ int main() { // Test Repeated values try { pvlKwrd.Clear(); - PvlKeyword pvlKwrd("LessThan", 2.5); + PvlKeyword pvlKwrd("LessThan", toString(2.5)); pvlGrp += pvlKwrd; pvlKwrd.Clear(); - pvlKwrd = PvlKeyword("GreaterThan", 3.5); + pvlKwrd = PvlKeyword("GreaterThan", toString(3.5)); pvlGrp += pvlKwrd; pvlKwrd.Clear(); - pvlKwrd = PvlKeyword("GreaterThan", 4.4545); + pvlKwrd = PvlKeyword("GreaterThan", toString(4.4545)); pvlGrp += pvlKwrd; pvlKwrd.Clear(); - pvlKwrd = PvlKeyword("GreaterThan", 100.8988095); + pvlKwrd = PvlKeyword("GreaterThan", toString(100.8988095)); pvlGrp += pvlKwrd; pvlTmplGrp.ValidateGroup(pvlGrp); @@ -154,11 +154,11 @@ int main() { // Test for unvalidated elements try { pvlKwrd.Clear(); - PvlKeyword pvlKwrd("Less123Than", 2.5); + PvlKeyword pvlKwrd("Less123Than", toString(2.5)); pvlGrp += pvlKwrd; pvlKwrd.Clear(); - pvlKwrd = PvlKeyword("GreaterThan", 3.5); + pvlKwrd = PvlKeyword("GreaterThan", toString(3.5)); pvlGrp += pvlKwrd; pvlTmplGrp.ValidateGroup(pvlGrp); diff --git a/isis/src/base/objs/PvlKeyword/PvlKeyword.cpp b/isis/src/base/objs/PvlKeyword/PvlKeyword.cpp index a298dce8ee..9d7f66ca6c 100644 --- a/isis/src/base/objs/PvlKeyword/PvlKeyword.cpp +++ b/isis/src/base/objs/PvlKeyword/PvlKeyword.cpp @@ -22,6 +22,7 @@ #include "IsisDebug.h" +#include #include #include "PvlKeyword.h" @@ -44,7 +45,7 @@ namespace Isis { * * @param name The keyword name */ - PvlKeyword::PvlKeyword(const std::string &name) { + PvlKeyword::PvlKeyword(QString name) { Init(); SetName(name); } @@ -58,8 +59,8 @@ namespace Isis { * @param value The keyword values. * @param unit The units the values are given in. */ - PvlKeyword::PvlKeyword(const std::string &name, const Isis::IString value, - const std::string unit) { + PvlKeyword::PvlKeyword(QString name, QString value, + QString unit) { Init(); SetName(name); AddValue(value, unit); @@ -114,10 +115,10 @@ namespace Isis { * @return bool True if the value is null, false if it's * not. */ - bool PvlKeyword::IsNull(const int index) const { + bool PvlKeyword::IsNull(int index) const { if(Size() == 0) return true; if(index < 0 || index >= (int)p_values.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } if(StringEqual("NULL", p_values[index])) return true; @@ -132,11 +133,10 @@ namespace Isis { * * @param name The new keyword name. */ - void PvlKeyword::SetName(const std::string &name) { - IString final(name); - final.Trim("\n\r\t\f\v\b "); - if(final.find_first_of("\n\r\t\f\v\b ") != std::string::npos) { - string msg = "[" + name + "] is invalid. Keyword name cannot "; + void PvlKeyword::SetName(QString name) { + QString final = name.trimmed(); + if(final.contains(QRegExp("\\s"))) { + QString msg = "[" + name + "] is invalid. Keyword name cannot "; msg += "contain whitespace."; throw IException(IException::User, msg, _FILEINFO_); } @@ -147,8 +147,9 @@ namespace Isis { } if(final != "") { - p_name = new char[final.size() + 1]; - strncpy(p_name, final.c_str(), final.size() + 1); + QByteArray finalAscii = final.toAscii(); + p_name = new char[finalAscii.size() + 1]; + strncpy(p_name, finalAscii.data(), final.size() + 1); } } @@ -158,7 +159,7 @@ namespace Isis { * If no current value exists, this method sets the given value * to the PvlKeyword. Otherwise, it clears any existing values * and resets to the value given using AddValue(). Defaults to - * unit = "" (empty string). + * unit = "" (empty QString). * * @param value New value to be assigned. * @param unit Units of measurement corresponding to the value. @@ -167,7 +168,7 @@ namespace Isis { * @see operator= * @see operator+= */ - void PvlKeyword::SetValue(const Isis::IString value, const std::string unit) { + void PvlKeyword::SetValue(QString value, QString unit) { Clear(); AddValue(value, unit); } @@ -178,9 +179,9 @@ namespace Isis { * * @param units New units to be assigned. */ - void PvlKeyword::SetUnits(const IString &units) { + void PvlKeyword::SetUnits(QString units) { if(!p_units) { - p_units = new std::vector(); + p_units = new std::vector(); } p_units->clear(); @@ -199,7 +200,7 @@ namespace Isis { * * @throws Isis::iException::Programmer - Given value must exist */ - void PvlKeyword::SetUnits(const IString &value, const IString &units) { + void PvlKeyword::SetUnits(QString value, QString units) { bool found = false; int i = -1; @@ -211,7 +212,7 @@ namespace Isis { if(found) { if(!p_units) { - p_units = new std::vector(p_values.size()); + p_units = new std::vector(p_values.size()); } else { p_units->resize(p_values.size()); @@ -234,7 +235,7 @@ namespace Isis { * * Overwrites the '=' operator to add a new value using AddValue(). Like * SetValue(), this method clears any previously existing values and resets to - * the given value with unit = "" (empty string). + * the given value with unit = "" (empty QString). * * @param value The value to be added. * @return PvlKeyword& Reference to PvlKeyword object. @@ -243,7 +244,7 @@ namespace Isis { * @see SetValue() * @see operator+= */ - PvlKeyword &PvlKeyword::operator=(const Isis::IString value) { + PvlKeyword &PvlKeyword::operator=(QString value) { Clear(); AddValue(value); return *this; @@ -255,7 +256,7 @@ namespace Isis { * If no current value exists, this method sets the given value. * Otherwise, it retains any current values and adds the value * given to the array of values for this PvlKeyword object. - * Defaults to unit = "" (empty string). + * Defaults to unit = "" (empty QString). * * @param value New value to be assigned. * @param unit Units of measurement corresponding to the value. @@ -264,12 +265,12 @@ namespace Isis { * @see operator= * @see operator+= */ - void PvlKeyword::AddValue(const Isis::IString value, const std::string unit) { + void PvlKeyword::AddValue(QString value, QString unit) { p_values.append(value); if(unit != "") { if(!p_units) { - p_units = new std::vector(p_values.size()); + p_units = new std::vector(p_values.size()); } else { p_units->resize(p_values.size()); @@ -287,7 +288,7 @@ namespace Isis { * * Overwrites the '+=' operators to add a new value. Like * AddValue(), this method keeps any previously existing values - * and adds the new value with unit = "" (empty string) to the + * and adds the new value with unit = "" (empty QString) to the * array of values for this PvlKeyword object. * * @param value The new value. @@ -297,7 +298,7 @@ namespace Isis { * @see SetValue() * @see operator= */ - PvlKeyword &PvlKeyword::operator+=(const Isis::IString value) { + PvlKeyword &PvlKeyword::operator+=(QString value) { AddValue(value); return *this; } @@ -314,7 +315,7 @@ namespace Isis { PvlKeyword::operator QString() const { - return QString::fromStdString((std::string) operator[](0)); + return operator[](0); } @@ -330,12 +331,13 @@ namespace Isis { * * @see const operator[] */ - Isis::IString &PvlKeyword::operator[](const int index) { + QString &PvlKeyword::operator[](int index) { if(index < 0 || index >= (int)p_values.size()) { - string msg = (Message::ArraySubscriptNotInRange(index)) + - "for Keyword [" + string(p_name) + "]"; + QString msg = (Message::ArraySubscriptNotInRange(index)) + + "for Keyword [" + toString(p_name) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } + return p_values[index]; } @@ -351,9 +353,9 @@ namespace Isis { * * @see operator[] */ - const Isis::IString &PvlKeyword::operator[](const int index) const { + const QString &PvlKeyword::operator[](int index) const { if(index < 0 || index >= (int)p_values.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } return p_values[index]; @@ -365,14 +367,14 @@ namespace Isis { * index = 0. * * @param index The index of the unit. - * @return string The unit at the index. + * @return QString The unit at the index. * @throws iException ArraySubscriptNotInRange (index) Index out of bounds. */ - string PvlKeyword::Unit(const int index) const { + QString PvlKeyword::Unit(int index) const { if(!p_units) return ""; if(index < 0 || index >= (int)p_units->size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } return (*p_units)[index]; @@ -387,9 +389,9 @@ namespace Isis { * @see AddComments() * @see ClearComments() */ - void PvlKeyword::AddComment(const std::string &comment) { + void PvlKeyword::AddComment(QString comment) { if(!p_comments) { - p_comments = new std::vector(); + p_comments = new std::vector(); } if(comment.size() == 0) { @@ -421,11 +423,11 @@ namespace Isis { * @see AddComments() * @see ClearComments() */ - void PvlKeyword::AddCommentWrapped(const std::string &comment) { + void PvlKeyword::AddCommentWrapped(QString comment) { IString cmt = comment; - string token = cmt.Token(" "); + IString token = cmt.Token(" "); while(cmt != "") { - string temp = token; + IString temp = token; token = cmt.Token(" "); int length = temp.size() + token.size() + 1; while((length < 72) && (token.size() > 0)) { @@ -433,9 +435,9 @@ namespace Isis { token = cmt.Token(" "); length = temp.size() + token.size() + 1; } - AddComment(temp); + AddComment(temp.c_str()); } - if(token.size() != 0) AddComment(token); + if(token.size() != 0) AddComment(token.c_str()); } //! Clears the current comments. @@ -449,14 +451,14 @@ namespace Isis { /** * Return a comment at the specified index. * @param index The index of the comment. - * @return string The comment at the index. + * @return QString The comment at the index. * @throws iException ArraySubscriptNotInRange (index) Index out of bounds. */ - string PvlKeyword::Comment(const int index) const { + QString PvlKeyword::Comment(int index) const { if(!p_comments) return ""; if(index < 0 || index >= (int)p_comments->size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } return (*p_comments)[index]; @@ -466,10 +468,10 @@ namespace Isis { * Checks if the value needs to be converted to PVL or iPVL and returns it in * the correct format. * @param value The value to be converted. - * @return string The value in its proper format (iPVL or + * @return QString The value in its proper format (iPVL or * PVL). */ - string PvlKeyword::Reform(const std::string &value) const { + QString PvlKeyword::Reform(const QString &value) const { #if 0 static bool firstTime = true; static bool iPVL = true; @@ -478,7 +480,7 @@ namespace Isis { Isis::PvlGroup &g = Isis::Preference::Preferences().FindGroup( "UserInterface", Isis::Pvl::Traverse); - Isis::IString s = (string) g["PvlFormat"]; + Isis::IString s = (QString) g["PvlFormat"]; s.UpCase(); if(s == "PVL") iPVL = false; } @@ -491,25 +493,25 @@ namespace Isis { /** * Converts a value to iPVL format. * @param value The value to be converted. - * @return string The value in iPVL format. + * @return QString The value in iPVL format. */ - string PvlKeyword::ToIPvl(const std::string &value) const { - string out; + QString PvlKeyword::ToIPvl(const QString &value) const { + QString out; bool upcase = true; bool lastlower = true; - for(unsigned int i = 0; i < value.size(); i++) { - if((lastlower) && (isupper(value[i]))) upcase = true; + for(int i = 0; i < value.size(); i++) { + if((lastlower) && (value[i].isUpper())) upcase = true; if(value[i] == '_') { upcase = true; } else if(upcase) { - out += toupper(value[i]); + out += value[i].toUpper(); lastlower = false; upcase = false; } else { - out += tolower(value[i]); - if(islower(value[i])) lastlower = true; + out += value[i].toLower(); + if(value[i].isLower()) lastlower = true; upcase = false; } } @@ -519,37 +521,37 @@ namespace Isis { /** * Converts a value to PVL format. * @param value The value to be converted. - * @return string The value in PVL format. + * @return QString The value in PVL format. */ - string PvlKeyword::ToPvl(const std::string &value) const { - string out; + QString PvlKeyword::ToPvl(const QString &value) const { + QString out; bool lastlower = false; - for(unsigned int i = 0; i < value.size(); i++) { - if((lastlower) && (isupper(value[i]))) out += "_"; + for(int i = 0; i < value.size(); i++) { + if((lastlower) && (value[i].isUpper())) out += "_"; if(value[i] == '_') { out += "_"; lastlower = false; } else { - out += toupper(value[i]); - if(islower(value[i])) lastlower = true; + out += value[i].toUpper(); + if(value[i].isLower()) lastlower = true; } } return out; } /** - * Checks to see if two strings are equal. Each is converted to uppercase + * Checks to see if two QStrings are equal. Each is converted to uppercase * and removed of underscores and whitespaces. - * @param string1 The first string - * @param string2 The second string + * @param QString1 The first QString + * @param QString2 The second QString * @return bool True or false, depending on whether - * the string values are equal. + * the QString values are equal. */ - bool PvlKeyword::StringEqual(const std::string &string1, - const std::string &string2) { - Isis::IString s1(string1); - Isis::IString s2(string2); + bool PvlKeyword::StringEqual(const QString &QString1, + const QString &QString2) { + Isis::IString s1(QString1); + Isis::IString s2(QString2); s1.ConvertWhiteSpace(); s2.ConvertWhiteSpace(); @@ -566,20 +568,20 @@ namespace Isis { /** * Checks to see if a value with a specified index is equivalent to another - * string. - * @param string1 The string to compare the value to. + * QString. + * @param QString1 The QString to compare the value to. * @param index The index of the existing value. - * @return bool True if the two strings are equivalent, + * @return bool True if the two QStrings are equivalent, * false if they're not. * @throws iException ArraySubscriptNotInRange (index) Index out of bounds. */ - bool PvlKeyword::IsEquivalent(const std::string &string1, int index) const { + bool PvlKeyword::IsEquivalent(QString QString1, int index) const { if(index < 0 || index >= (int)p_values.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } - return StringEqual(p_values[index], string1); + return StringEqual(p_values[index], QString1); } /** @@ -588,12 +590,12 @@ namespace Isis { * @return PvlKeyword& Reference to PvlKeyword object. */ PvlKeyword &PvlKeyword::operator=(Isis::PvlSequence &seq) { - this->Clear(); + Clear(); for(int i = 0; i < seq.Size(); i++) { - string temp = "("; + QString temp = "("; for(int j = 0; j < (int)seq[i].size(); j++) { - string val = seq[i][j]; - if(val.find(" ") != std::string::npos) { + QString val = seq[i][j]; + if(val.contains(" ")) { temp += "\"" + val + "\""; } else { @@ -623,7 +625,7 @@ namespace Isis { * @see operator<< */ ostream &PvlKeyword::WriteWithWrap(std::ostream &os, - const std::string &textToWrite, + const QString &textToWrite, int startColumn, PvlFormat &format) const { @@ -640,18 +642,18 @@ namespace Isis { standards are referenced in separate sections. 12.5.3.1 Implementation of String Values - A text string read in from a label is reassembled into a string of characters. - The way in which the string is broken into lines in a label does not affect the - format of the string after it has been reassembled. The following rules are used - when reading text strings: If a format effector or a sequence of - format effectors is encountered within a text string, + A text QString read in from a label is reassembled into a QString of characters. + The way in which the QString is broken into lines in a label does not affect the + format of the QString after it has been reassembled. The following rules are used + when reading text QStrings: If a format effector or a sequence of + format effectors is encountered within a text QString, the effector (or sequence of effectors) is replaced by a single space character, unless the last character is a hyphen (dash) character. Any spacing characters at the end of the line are removed and any spacing characters at the beginning of the following line are removed. This - allows a text string in a label to appear with the left and right - margins set at arbitrary points without changing the string value. For - example, the following two strings are the same: "To be or + allows a text QString in a label to appear with the left and right + margins set at arbitrary points without changing the QString value. For + example, the following two QStrings are the same: "To be or not to be" and "To be or not to be" @@ -659,38 +661,38 @@ namespace Isis { (dash) character, the hyphen is removed with any spacing characters at the beginning of the following line. This follows the standard convention in English of using a hyphen to break a word across lines. - For example, the following two strings are the same: + For example, the following two QStrings are the same: "The planet Jupiter is very big" and "The planet Jupi- ter is very big" Control codes, other than the horizontal tabulation character and - format effectors, appearing within a text string are removed. + format effectors, appearing within a text QString are removed. */ /* We will be adding a condition for human-readable purposes: - If a quoted string of text does not fit on the current line, + If a quoted QString of text does not fit on the current line, but will fit on the next line, use the next line. */ // Position set - string remainingText = textToWrite; + QString remainingText = textToWrite; int spaceForText = format.CharLimit() - 1 - format.FormatEOL().length() - startColumn; - // find quote positions to better determine which line to put the - // string on. Data structure: vector< startPos, endPos > where + // indexOf quote positions to better determine which line to put the + // QString on. Data structure: vector< startPos, endPos > where // remainingText[startPos] and remainingText[endPos] must both be quotes. vector< pair > quotedAreas; int quoteStart = -1; // if its an array, indent subsequent lines 1 more - if(textToWrite[0] == '(' || textToWrite[0] == '"') { + if(textToWrite.count() > 0 && (textToWrite[0] == '(' || textToWrite[0] == '"')) { startColumn ++; } /* Standard 12.3.3.1 -> - A quoted text string may not contain the quotation mark, which is reserved - to be the text string delimiter. + A quoted text QString may not contain the quotation mark, which is reserved + to be the text QString delimiter. So we don't have to worry about escaped quotes. */ @@ -701,16 +703,16 @@ namespace Isis { quoteStartEnds.push_back(pair('<', '>')); // clean up any EOL characters, they mustn't interfere, remove sections of - // multiple spaces (make them into one), and find quoted areas - for(unsigned int pos = 0; pos < remainingText.size(); pos++) { - // remove \r and \n from string + // multiple spaces (make them into one), and indexOf quoted areas + for(int pos = 0; pos < remainingText.size(); pos++) { + // remove \r and \n from QString if(remainingText[pos] == '\n' || remainingText[pos] == '\r') { - if(pos != remainingText.length() - 1) { - remainingText = remainingText.substr(0, pos) + - remainingText.substr(pos + 1); + if(pos != remainingText.size() - 1) { + remainingText = remainingText.mid(0, pos) + + remainingText.mid(pos + 1); } else { - remainingText = remainingText.substr(0, pos); + remainingText = remainingText.mid(0, pos); } } @@ -719,8 +721,8 @@ namespace Isis { while(pos > 0 && remainingText[pos-1] == ' ' && remainingText[pos] == ' ') { - remainingText = remainingText.substr(0, pos) + - remainingText.substr(pos + 1); + remainingText = remainingText.mid(0, pos) + + remainingText.mid(pos + 1); } } @@ -764,18 +766,18 @@ namespace Isis { int printedSoFar = 0; // while we have something to write, keep going - while(!remainingText.empty()) { + while(!remainingText.isEmpty()) { // search backwards for the last space or comma *in the limit* (80 chars) int lastSpacePosition = charsLeft; // if everything fits into our remaining space, consider the last - // spot in the string to be printed still the split position. + // spot in the QString to be printed still the split position. if(lastSpacePosition >= (int)remainingText.length()) { lastSpacePosition = remainingText.length(); } else { // Everything does not fit; use good space for mediocre splits (inside - // quoted strings), and excellent space for good splits (between array + // quoted QStrings), and excellent space for good splits (between array // values for example) int goodSpace = -1; int excellentSpace = -1; @@ -835,28 +837,28 @@ namespace Isis { // we found a space or comma in our limit, write to that chatacter // and repeat the loop if(lastSpacePosition >= 0) { - os << remainingText.substr(0, lastSpacePosition); + os << remainingText.mid(0, lastSpacePosition); - remainingText = remainingText.substr(lastSpacePosition); + remainingText = remainingText.mid(lastSpacePosition); printedSoFar += lastSpacePosition; } - // we failed to find a space or a comma in our limit, + // we failed to indexOf a space or a comma in our limit, // use a hyphen (-) else { - os << remainingText.substr(0, charsLeft - 1); + os << remainingText.mid(0, charsLeft - 1); os << "-"; - remainingText = remainingText.substr(charsLeft - 1); + remainingText = remainingText.mid(charsLeft - 1); printedSoFar += charsLeft - 1; } // we wrote as much as possible, do a newline and repeat - if(!remainingText.empty()) { + if(!remainingText.isEmpty()) { os << format.FormatEOL(); WriteSpaces(os, startColumn); // dont allow spaces to begin the next line inside what we're printing if(remainingText[0] == ' ') { - remainingText = remainingText.substr(1); + remainingText = remainingText.mid(1); printedSoFar += 1; } } @@ -913,8 +915,8 @@ namespace Isis { */ std::istream &operator>>(std::istream &is, PvlKeyword &result) { result = PvlKeyword(); - string line; - IString keywordString; + QString line; + QString keywordString; bool keywordDone = false; bool multiLineComment = false; @@ -928,8 +930,8 @@ namespace Isis { // We read an empty line (failed to read next non-empty line) // and didnt complete our keyword, essentially we hit the implicit // keyword named "End" - if(line.empty() && !is.good()) { - if(keywordString.empty() || + if(line.isEmpty() && !is.good()) { + if(keywordString.isEmpty() || keywordString[keywordString.size()-1] == '\n') { line = "End"; @@ -955,8 +957,8 @@ namespace Isis { if(line[1] == '*') { multiLineComment = true; - keywordString += line.substr(0, 2); - line = IString(line.substr(2)).Trim(" \r\n\t"); + keywordString += line.mid(0, 2); + line = line.mid(2).trimmed(); } } } @@ -964,22 +966,20 @@ namespace Isis { if(multiLineComment) { comment = true; - if(line.find("/*") != string::npos) { + if(line.contains("/*")) { IString msg = "Error when reading a pvl: Cannot have ['/*'] inside a " "multi-line comment"; throw IException(IException::Unknown, msg, _FILEINFO_); } - if(line.find("*/") != string::npos) { + if(line.contains("*/")) { multiLineComment = false; - line = IString( - line.substr(0, line.find("*/")) - ).Trim(" \r\n\t") + " */"; + line = line.mid(0, line.indexOf("*/")).trimmed() + " */"; } } - if(line.empty()) { + if(line.isEmpty()) { continue; } // comment line @@ -988,12 +988,12 @@ namespace Isis { continue; } // first line of keyword data - else if(keywordString.empty()) { + else if(keywordString.isEmpty()) { keywordString = line; } // concatenation else if(!comment && keywordString[keywordString.size()-1] == '-') { - keywordString = keywordString.substr(0, keywordString.size() - 1) + line; + keywordString = keywordString.mid(0, keywordString.size() - 1) + line; } // Non-commented and non-concatenation -> put in the space else { @@ -1004,9 +1004,9 @@ namespace Isis { continue; } - std::vector< std::string > keywordComments; - std::string keywordName; - std::vector< std::pair > keywordValues; + std::vector< QString > keywordComments; + QString keywordName; + std::vector< std::pair > keywordValues; bool attemptedRead = false; @@ -1024,7 +1024,7 @@ namespace Isis { is.seekg(beforeLine, ios::beg); - string msg = "Unable to read PVL keyword ["; + QString msg = "Unable to read PVL keyword ["; msg += keywordString; msg += "]"; @@ -1059,13 +1059,13 @@ namespace Isis { if(error) { // skip comments - while(keywordString.find('\n') != string::npos) { - keywordString = keywordString.substr(keywordString.find('\n') + 1); + while(keywordString.contains('\n')) { + keywordString = keywordString.mid(keywordString.indexOf('\n') + 1); } - string msg; + QString msg; - if(keywordString.empty() && !multiLineComment) { + if(keywordString.isEmpty() && !multiLineComment) { msg = "PVL input contains no Pvl Keywords"; } else if(multiLineComment) { @@ -1081,12 +1081,12 @@ namespace Isis { if(!keywordDone) { // skip comments - while(keywordString.find('\n') != string::npos) - keywordString = keywordString.substr(keywordString.find('\n') + 1); + while(keywordString.contains('\n')) + keywordString = keywordString.mid(keywordString.indexOf('\n') + 1); - string msg; + QString msg; - if(keywordString.empty()) { + if(keywordString.isEmpty()) { msg = "Error reading PVL keyword"; } else { @@ -1106,7 +1106,7 @@ namespace Isis { * * @param comments Comments to associate with this keyword */ - void PvlKeyword::AddComments(const std::vector &comments) { + void PvlKeyword::AddComments(const std::vector &comments) { for(unsigned int i = 0; i < comments.size(); i++) { AddComment(comments[i]); } @@ -1119,7 +1119,7 @@ namespace Isis { * keyword (if valid) and its status. * * @param keyword Pvl "#COMMENT\n//COMMENT\nKeyword = (Value1,Value2,...)" - * string + * QString * @param keywordComments Output: Lines of data that are comments * @param keywordName Output: Name of keyword * @param keywordValues Output: vector< pair > @@ -1127,10 +1127,10 @@ namespace Isis { * @return bool false if it is invalid but could become valid given more data, * true if it is a valid keyword and successful */ - bool PvlKeyword::ReadCleanKeyword(std::string keyword, - std::vector< std::string > &keywordComments, - std::string &keywordName, - std::vector< std::pair > &keywordValues) { + bool PvlKeyword::ReadCleanKeyword(QString keyword, + std::vector< QString > &keywordComments, + QString &keywordName, + std::vector< std::pair > &keywordValues) { // Reset outputs keywordComments.clear(); keywordName = ""; @@ -1140,13 +1140,13 @@ namespace Isis { bool explicitIncomplete = false; // Possible (known) comment starts in pvl - IString comments[] = { + QString comments[] = { "#", "//" }; // Need more data if nothing is here! - if(keyword.empty()) return 0; + if(keyword.isEmpty()) return 0; /* Step 1: Read Comments @@ -1165,33 +1165,32 @@ namespace Isis { */ // While we have newlines, we have comments - while(keyword.find("\n") != string::npos) { + while(keyword.contains("\n")) { // Make sure we strip data every loop of comment types; otherwise we // have no comment and need to error out. bool noneStripped = true; // Check every comment type now and make sure this line (it isn't the last // line since a newline exists) starts in a comment - string keywordStart = keyword.substr(0, 2); + QString keywordStart = keyword.mid(0, 2); // Handle multi-line comments if(keywordStart == "/*") { noneStripped = false; bool inComment = true; - while(inComment && keyword.find("*/") != string::npos) { + while(inComment && keyword.contains("*/")) { // Correct the */ to make sure it has a \n after it, // without this we risk an infinite loop - size_t closePos = keyword.find("*/\n"); + int closePos = keyword.indexOf("*/\n"); - if(closePos == string::npos) { - closePos = keyword.find("*/") + 2; - keyword = keyword.substr(0, closePos) + "\n" + - keyword.substr(closePos); + if(closePos == -1) { + closePos = keyword.indexOf("*/") + 2; + keyword = keyword.mid(0, closePos) + "\n" + + keyword.mid(closePos); } - string comment = keyword.substr(0, keyword.find("\n")); - comment = IString(comment).Trim(" \r\n\t"); + QString comment = keyword.mid(0, keyword.indexOf("\n")).trimmed(); // Set these to true if too small, false if not (they need if // cant currently fit). @@ -1202,53 +1201,51 @@ namespace Isis { bool needsEnd = (commentEndPos < 0); bool needsEndSpace = comment.size() < 3; - // Needs are currently set based on string size, apply real logic + // Needs are currently set based on QString size, apply real logic // to test for character sequences (try to convert them from false // to true). if(!needsStart) { - needsStart = (comment.substr(0, 2) != "/*"); + needsStart = (comment.mid(0, 2) != "/*"); } if(!needsEnd) { - needsEnd = (comment.substr(commentEndPos, 2) != "*/"); + needsEnd = (comment.mid(commentEndPos, 2) != "*/"); } if(!needsStartSpace) { - needsStartSpace = (comment.substr(0, 3) != "/* "); + needsStartSpace = (comment.mid(0, 3) != "/* "); } if(!needsEndSpace) { - needsEndSpace = (comment.substr(commentEndPos - 1, 3) != " */"); + needsEndSpace = (comment.mid(commentEndPos - 1, 3) != " */"); } if(needsStart) { comment = "/* " + comment; } else if(needsStartSpace) { - comment = "/* " + comment.substr(2); + comment = "/* " + comment.mid(2); } if(needsEnd) { comment = comment + " */"; } else if(needsEndSpace) { - comment = comment.substr(0, comment.size() - 2) + " */";; + comment = comment.mid(0, comment.size() - 2) + " */";; } inComment = needsEnd; keywordComments.push_back(comment); - if(keyword.find("\n") != string::npos) { - keyword = IString( - keyword.substr(keyword.find("\n") + 1) - ).Trim(" \r\n\t"); + if(keyword.contains("\n")) { + keyword = keyword.mid(keyword.indexOf("\n") + 1).trimmed(); } // Check for another comment start if(!inComment) { if(keyword.size() >= 2) - keywordStart = keyword.substr(0, 2); + keywordStart = keyword.mid(0, 2); inComment = (keywordStart == "/*"); } @@ -1256,9 +1253,9 @@ namespace Isis { // So we have a bunch of multi-line commands... make them the same size // Find longest - unsigned int longest = 0; + int longest = 0; for(unsigned int index = 0; index < keywordComments.size(); index++) { - IString comment = keywordComments[index]; + QString comment = keywordComments[index]; if(comment.size() > longest) longest = comment.size(); @@ -1266,11 +1263,11 @@ namespace Isis { // Now make all the sizes match longest for(unsigned int index = 0; index < keywordComments.size(); index++) { - IString comment = keywordComments[index]; + QString comment = keywordComments[index]; while(comment.size() < longest) { // This adds a space to the end of the comment - comment = comment.substr(0, comment.size() - 2) + " */"; + comment = comment.mid(0, comment.size() - 2) + " */"; } keywordComments[index] = comment; @@ -1280,38 +1277,36 @@ namespace Isis { // Search for single line comments for(unsigned int commentType = 0; - commentType < sizeof(comments) / sizeof(IString); + commentType < sizeof(comments) / sizeof(QString); commentType++) { - if(keywordStart.find(comments[commentType]) == 0) { + if(keywordStart.startsWith(comments[commentType])) { // Found a comment start; strip this line out and store it as a // comment! - string comment = keyword.substr(0, keyword.find("\n")); - keywordComments.push_back(IString(comment).Trim(" \r\n\t")); + QString comment = keyword.mid(0, keyword.indexOf("\n")); + keywordComments.push_back(comment.trimmed()); noneStripped = false; - if(keyword.find("\n") != string::npos) { - keyword = IString( - keyword.substr(keyword.find("\n") + 1) - ).Trim(" \r\n\t"); + if(keyword.contains("\n")) { + keyword = keyword.mid(keyword.indexOf("\n") + 1).trimmed(); } } } // Does it look like Name=Value/*comm // mment*/ ? - if(noneStripped && keyword.find("/*") != string::npos && - keyword.find("*/") != string::npos) { - IString firstPart = keyword.substr(0, keyword.find("\n")); - IString lastPart = keyword.substr(keyword.find("\n") + 1); + if(noneStripped && keyword.contains("/*") && + keyword.contains("*/")) { + QString firstPart = keyword.mid(0, keyword.indexOf("\n")); + QString lastPart = keyword.mid(keyword.indexOf("\n") + 1); - keyword = firstPart.Trim(" \r\n\t") + " " + lastPart.Trim(" \r\n\t"); + keyword = firstPart.trimmed() + " " + lastPart.trimmed(); noneStripped = false; } if(noneStripped) { - string msg = "Expected a comment in PVL but found ["; + QString msg = "Expected a comment in PVL but found ["; msg += keyword; msg += "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -1319,7 +1314,7 @@ namespace Isis { } // Do we have a keyword at all? - if(keyword.empty()) { + if(keyword.isEmpty()) { return false; // need more data } @@ -1338,7 +1333,7 @@ namespace Isis { // we have taken the name; if nothing remains then it is value-less // and we are done. - if(keyword.empty()) { + if(keyword.isEmpty()) { /* Step 3.1 @@ -1353,16 +1348,16 @@ namespace Isis { // if we don't have an equal, then we have a problem - an invalid symbol. // Our possible remaining formats both are KEYWORD = ... if(keyword[0] != '=') { - string msg = "Expected an assignment [=] when reading PVL, but found ["; + QString msg = "Expected an assignment [=] when reading PVL, but found ["; msg += keyword[0]; msg += "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } - keyword = IString(keyword.substr(1)).Trim(" \t"); + keyword = keyword.mid(1).trimmed(); - if(keyword.empty()) { + if(keyword.isEmpty()) { return false; } @@ -1387,27 +1382,27 @@ namespace Isis { // strip '(' - onetime, this makes every element in the array the same // (except the last) - keyword = IString(keyword.substr(1)).Trim(" \t"); + keyword = keyword.mid(1).trimmed(); // handle empty arrays: KEYWORD = () - if(!keyword.empty() && keyword[0] == closingParen) { + if(!keyword.isEmpty() && keyword[0] == closingParen) { closedProperly = true; } // Each iteration of this loop should consume 1 value in the array, // including the comma, i.e. we should start out with: // 'VALUE,VALUE,...)' until we hit ')' (our exit condition) - while(!keyword.empty() && keyword[0] != closingParen) { + while(!keyword.isEmpty() && keyword[0] != closingParen) { // foundComma delimits the end of this element in the array (remains // false for last value which has no comma at the end) bool foundComma = false; // keyword should be of the format: VALUE ,....) // Read VALUE from it - string nextItem = ReadValue(keyword, explicitIncomplete, extraDelims); + QString nextItem = ReadValue(keyword, explicitIncomplete, extraDelims); - if(!keyword.empty() && keyword[0] == wrongClosingParen) { + if(!keyword.isEmpty() && keyword[0] == wrongClosingParen) { - string msg = "Incorrect array close when reading PVL; expected ["; + QString msg = "Incorrect array close when reading PVL; expected ["; msg += closingParen; msg += "] but found ["; msg += wrongClosingParen; @@ -1418,32 +1413,32 @@ namespace Isis { } // This contains - pair keywordValue; + pair keywordValue; // Store VALUE keywordValue.first = nextItem; // Now there's 2 possibilities: units or no units -> // if we have units, read them - if(!keyword.empty() && keyword[0] == '<') { - string unitsValue = ReadValue(keyword, explicitIncomplete); + if(!keyword.isEmpty() && keyword[0] == '<') { + QString unitsValue = ReadValue(keyword, explicitIncomplete); keywordValue.second = unitsValue; } // Now we should* have a comma, strip it - if(!keyword.empty() && keyword[0] == ',') { + if(!keyword.isEmpty() && keyword[0] == ',') { foundComma = true; - keyword = IString(keyword.substr(1)).Trim(" \t"); + keyword = keyword.mid(1).trimmed(); } - // No comma and nothing more in string - we found + // No comma and nothing more in QString - we found // KEYWORD = (VALUE,VALUE\0 // we need more information to finish this keyword - if(!foundComma && keyword.empty()) { + if(!foundComma && keyword.isEmpty()) { return false; // could become valid later } - bool foundCloseParen = (!keyword.empty() && keyword[0] == closingParen); + bool foundCloseParen = (!keyword.isEmpty() && keyword[0] == closingParen); if(foundCloseParen) { closedProperly = true; @@ -1453,7 +1448,7 @@ namespace Isis { // keyword = (VALUE,VALUE,) // which is unrecoverable if(foundComma && foundCloseParen) { - string msg = "Unexpected close of keyword-value array when reading " + QString msg = "Unexpected close of keyword-value array when reading " "PVL"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -1464,7 +1459,7 @@ namespace Isis { if(explicitIncomplete) return false; // We have (VALUE VALUE - string msg = "Found extra data after ["; + QString msg = "Found extra data after ["; msg += nextItem; msg += "] in array when reading PVL"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -1479,16 +1474,16 @@ namespace Isis { } // Trim off the closing paren - if(!keyword.empty()) { - keyword = IString(keyword.substr(1)).Trim(" \t"); + if(!keyword.isEmpty()) { + keyword = keyword.mid(1).trimmed(); } // Read units here if they exist and apply them // case: (A,B,C) - if(!keyword.empty() && keyword[0] == '<') { - string units = ReadValue(keyword, explicitIncomplete); + if(!keyword.isEmpty() && keyword[0] == '<') { + QString units = ReadValue(keyword, explicitIncomplete); for(unsigned int val = 0; val < keywordValues.size(); val++) { - if(keywordValues[val].second.empty()) { + if(keywordValues[val].second.isEmpty()) { keywordValues[val].second = units; } } @@ -1503,10 +1498,10 @@ namespace Isis { We need to read the single value/unit in the keywordValues array. */ - pair keywordValue; + pair keywordValue; keywordValue.first = ReadValue(keyword, explicitIncomplete); - if(!keyword.empty() && keyword[0] == '<') { + if(!keyword.isEmpty() && keyword[0] == '<') { keywordValue.second = ReadValue(keyword, explicitIncomplete); } @@ -1524,15 +1519,15 @@ namespace Isis { /* See if we have a comment at the end of the keyword... */ - if(!keyword.empty()) { + if(!keyword.isEmpty()) { // if the data left is a comment, we can handle it probably if(keyword[0] == '#' || ((keyword.size() > 1 && keyword[0] == '/') && (keyword[1] == '/' || keyword[1] == '*'))) { keywordComments.push_back(keyword); - if(keyword.size() > 1 && keyword.substr(0, 2) == "/*") { - if(keyword.substr(keyword.size() - 2, 2) != "*/") + if(keyword.size() > 1 && keyword.mid(0, 2) == "/*") { + if(keyword.mid(keyword.size() - 2, 2) != "*/") return false; // need more comment data } @@ -1543,8 +1538,8 @@ namespace Isis { /* If more data remains, it is unrecognized. */ - if(!keyword.empty()) { - string msg = "Keyword has extraneous data ["; + if(!keyword.isEmpty()) { + QString msg = "Keyword has extraneous data ["; msg += keyword; msg += "] at the end"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -1555,16 +1550,16 @@ namespace Isis { } - std::string PvlKeyword::ReadValue(std::string &keyword, bool "eProblem) { + QString PvlKeyword::ReadValue(QString &keyword, bool "eProblem) { std::vector< std::pair > otherDelims; return ReadValue(keyword, quoteProblem, otherDelims); } /** - * This method looks for a data element in the string. A data element is a - * quoted string, a units value, or one value of an array (not including - * units). As an example, each value in the following string is quoted: + * This method looks for a data element in the QString. A data element is a + * quoted QString, a units value, or one value of an array (not including + * units). As an example, each value in the following QString is quoted: * * 'VALUE' '=' ('VALUE','VALUE', 'VALUE' '') * @@ -1573,20 +1568,20 @@ namespace Isis { * * @param keyword Input/Output: The keyword to get the next value from * (DESTRUCTIVE) - * @param quoteProblem Output: The string has an unclosed quote character + * @param quoteProblem Output: The QString has an unclosed quote character * - * @return std::string The stripped out token. + * @return QString The stripped out token. */ - std::string PvlKeyword::ReadValue(std::string &keyword, bool "eProblem, + QString PvlKeyword::ReadValue(QString &keyword, bool "eProblem, const std::vector< std::pair > & otherDelimiters) { - string value = ""; + QString value = ""; - // This method ignores spaces except as delimiters; let's trim the string + // This method ignores spaces except as delimiters; let's trim the QString // to start - keyword = IString(keyword).Trim(" \t"); + keyword = keyword.trimmed(); - if(keyword.empty()) { + if(keyword.isEmpty()) { return ""; } @@ -1595,7 +1590,7 @@ namespace Isis { // PVLs. However, "HELLO WORLD" has an explicit (not implied) double quote. // We do consider <> as quotes. bool impliedQuote = true; - char quoteEnd = ' '; + QChar quoteEnd = ' '; bool keepQuotes = false; if(keyword[0] == '\'' || keyword[0] == '"') { @@ -1620,7 +1615,7 @@ namespace Isis { bool foundImplicitQuote = false; - unsigned int currentPos = 0; + int currentPos = 0; while(!foundImplicitQuote && currentPos != keyword.size()) { for(unsigned int quote = 0; quote < sizeof(implicitQuotes) / sizeof(char); @@ -1645,34 +1640,34 @@ namespace Isis { } } - string startQuote; + QString startQuote; // non-implied delimeters need the opening delimiter ignored. Remember // startQuote in case of error later on we can reconstruct the original - // string. + // QString. if(!impliedQuote) { startQuote += keyword[0]; - keyword = keyword.substr(1); + keyword = keyword.mid(1); } // Do we have a known quote end? - size_t quoteEndPos = keyword.find(quoteEnd); + int quoteEndPos = keyword.indexOf(quoteEnd); - if(quoteEndPos != string::npos) { - value = keyword.substr(0, quoteEndPos); + if(quoteEndPos != -1) { + value = keyword.mid(0, quoteEndPos); // Trim keyword 1 past end delimiter (if end delimiter is last, this - // results in empty string). If the close delimiter is ')' or ',' then + // results in empty QString). If the close delimiter is ')' or ',' then // leave it be however, since we need to preserve that to denote this was // an end of a valuein array keyword. if(!impliedQuote) { - keyword = keyword.substr(quoteEndPos + 1); + keyword = keyword.mid(quoteEndPos + 1); } else { - keyword = keyword.substr(quoteEndPos); + keyword = keyword.mid(quoteEndPos); } // Make sure we dont have padding - keyword = IString(keyword).Trim(" \t"); + keyword = keyword.trimmed(); if(keepQuotes) { value = startQuote + value + quoteEnd; @@ -1683,7 +1678,7 @@ namespace Isis { // implied quotes terminate at end of keyword; otherwise we have a problem // (which is this condition) else if(!impliedQuote) { - // restore the original string + // restore the original QString keyword = startQuote + keyword; quoteProblem = true; @@ -1710,12 +1705,12 @@ namespace Isis { * * @param is The stream to read from * - * @return std::string The first encountered line of data + * @return QString The first encountered line of data */ - std::string PvlKeyword::ReadLine(std::istream &is, bool insideComment) { - IString lineOfData; + QString PvlKeyword::ReadLine(std::istream &is, bool insideComment) { + QString lineOfData; - while(is.good() && lineOfData.empty()) { + while(is.good() && lineOfData.isEmpty()) { // read until \n (works for both \r\n and \n) or */ while(is.good() && @@ -1749,7 +1744,7 @@ namespace Isis { } // Trim off non-visible characters from this line of data - lineOfData = lineOfData.Trim(" \r\n\t"); + lineOfData = lineOfData.trimmed(); // read up to next non-whitespace in input stream while(is.good() && @@ -1795,7 +1790,7 @@ namespace Isis { os << " "; ++startColumn; } - string keyname = tempFormat->FormatName(keyword); + QString keyname = tempFormat->FormatName(keyword); os << keyname; startColumn += keyname.length(); @@ -1813,7 +1808,7 @@ namespace Isis { } // Loop and write each array value - string stringToWrite; + QString stringToWrite; for(int i = 0; i < keyword.Size(); i ++) { stringToWrite += tempFormat->FormatValue(keyword, i); } @@ -1851,7 +1846,7 @@ namespace Isis { } if(other.p_units) { - p_units = new std::vector(*other.p_units); + p_units = new std::vector(*other.p_units); } if(p_comments) { @@ -1860,7 +1855,7 @@ namespace Isis { } if(other.p_comments) { - p_comments = new std::vector(*other.p_comments); + p_comments = new std::vector(*other.p_comments); } p_width = other.p_width; @@ -1882,30 +1877,30 @@ namespace Isis { * @param psValueType - Value Type (positive / negative) for numbers * @param pvlKwrdValue - Template Keyword __Value or __Range to validate keyword's value */ - void PvlKeyword::ValidateKeyword(PvlKeyword & pvlKwrd, std::string psValueType, PvlKeyword* pvlKwrdValue) + void PvlKeyword::ValidateKeyword(PvlKeyword & pvlKwrd, QString psValueType, PvlKeyword* pvlKwrdValue) { int iSize = pvlKwrd.Size(); - string sType = IString::DownCase(p_values[0]); + QString sType = p_values[0].toLower(); // Value type if(psValueType.length()) { - psValueType = IString::DownCase(psValueType); + psValueType = psValueType.toLower(); } double dRangeMin=0, dRangeMax=0; bool bRange = false; bool bValue = false; if(pvlKwrdValue != NULL) { - string sValueName = pvlKwrdValue->Name(); + QString sValueName = pvlKwrdValue->Name(); // Check for Range - if(sValueName.find("__Range") != string::npos ) { - dRangeMin = (*pvlKwrdValue)[0]; - dRangeMax = (*pvlKwrdValue)[1]; + if(sValueName.contains("__Range")) { + dRangeMin = toDouble((*pvlKwrdValue)[0]); + dRangeMax = toDouble((*pvlKwrdValue)[1]); bRange = true; } - else if(sValueName.find("__Value") != string::npos) { + else if(sValueName.contains("__Value")) { bValue = true; } } @@ -1913,36 +1908,36 @@ namespace Isis { // Type integer if(sType == "integer") { for(int i=0; i dRangeMax)) { - string sErrMsg = "\"" +pvlKwrd.Name() +"\" is not in the specified Range"; + QString sErrMsg = "\"" +pvlKwrd.Name() +"\" is not in the specified Range"; throw IException(IException::User, sErrMsg, _FILEINFO_); } if(bValue) { bool bFound = false; for(int j=0; jSize(); j++) { - if(iValue == (int)(*pvlKwrdValue)[j]) { + if(iValue == toInt((*pvlKwrdValue)[j])) { bFound = true; break; } } if(!bFound) { - string sErrMsg = "\"" +pvlKwrd.Name() +"\" has value not in the accepted list"; + QString sErrMsg = "\"" +pvlKwrd.Name() +"\" has value not in the accepted list"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } // Type is specified (positive / negative) if(psValueType.length()) { if((psValueType == "positive" && iValue < 0) || (psValueType == "negative" && iValue >= 0) ) { - string sErrMsg = "\"" +pvlKwrd.Name() +"\" has invalid value"; + QString sErrMsg = "\"" +pvlKwrd.Name() +"\" has invalid value"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } @@ -1954,30 +1949,30 @@ namespace Isis { // Type double if(sType == "double") { for(int i=0; i dRangeMax)) { - string sErrMsg = "\"" +pvlKwrd.Name() +"\" is not in the specified Range"; + QString sErrMsg = "\"" +pvlKwrd.Name() +"\" is not in the specified Range"; throw IException(IException::User, sErrMsg, _FILEINFO_); } if(bValue) { bool bFound = false; for(int j=0; jSize(); j++) { - if(dValue == (double)(*pvlKwrdValue)[j]) { + if(dValue == toDouble((*pvlKwrdValue)[j])) { bFound = true; break; } } if(!bFound) { - string sErrMsg = "\"" +pvlKwrd.Name() +"\" has value not in the accepted list"; + QString sErrMsg = "\"" +pvlKwrd.Name() +"\" has value not in the accepted list"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } // Type is specified (positive / negative) if(psValueType.length()) { if((psValueType == "positive" && dValue < 0) || (psValueType == "negative" && dValue >= 0) ) { - string sErrMsg = "\"" +pvlKwrd.Name() +"\" has invalid value"; + QString sErrMsg = "\"" +pvlKwrd.Name() +"\" has invalid value"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } @@ -1989,9 +1984,9 @@ namespace Isis { // Type boolean if(sType == "boolean") { for(int i=0; iSize(); i++) { - if(sValue == IString::DownCase((*pvlKwrdValue)[i])) { + if(sValue == (*pvlKwrdValue)[i].toLower()) { bValFound = true; break; } } if(!bValFound) { - string sErrMsg = "Wrong Type of value in the Keyword \"" + Name() + "\" \n"; + QString sErrMsg = "Wrong Type of value in the Keyword \"" + Name() + "\" \n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } diff --git a/isis/src/base/objs/PvlKeyword/PvlKeyword.h b/isis/src/base/objs/PvlKeyword/PvlKeyword.h index 4f2d653a9c..a10a262dbf 100644 --- a/isis/src/base/objs/PvlKeyword/PvlKeyword.h +++ b/isis/src/base/objs/PvlKeyword/PvlKeyword.h @@ -26,11 +26,12 @@ #include #include +#include #include #include -#include "IString.h" #include "Constants.h" +#include "IString.h" namespace Isis { class PvlSequence; @@ -94,20 +95,20 @@ namespace Isis { class PvlKeyword { public: PvlKeyword(); - PvlKeyword(const std::string &name); - PvlKeyword(const std::string &name, const Isis::IString value, - const std::string unit = ""); + PvlKeyword(QString name); + PvlKeyword(QString name, QString value, + QString unit = ""); PvlKeyword(const PvlKeyword &other); ~PvlKeyword(); - void SetName(const std::string &name); + void SetName(QString name); /** * Returns the keyword name. * * @return The name of the keyword. */ - std::string Name() const { + QString Name() const { if(p_name) return p_name; else @@ -119,19 +120,19 @@ namespace Isis { * @param name The name of the keyword to compare with this one. * @return True if the names are equal, false if not. */ - bool IsNamed(const std::string &name) const { + bool IsNamed(QString name) const { return StringEqual(name, Name()); }; - void SetValue(const Isis::IString value, const std::string unit = ""); + void SetValue(QString value, QString unit = ""); - void SetUnits(const IString &units); - void SetUnits(const IString &value, const IString &units); + void SetUnits(QString units); + void SetUnits(QString value, QString units); - PvlKeyword &operator=(const Isis::IString value); + PvlKeyword &operator=(QString value); - void AddValue(const Isis::IString value, const std::string unit = ""); - PvlKeyword &operator+=(const Isis::IString value); + void AddValue(QString value, QString unit = ""); + PvlKeyword &operator+=(QString value); //! Returns the number of values stored in this keyword int Size() const { @@ -146,37 +147,33 @@ namespace Isis { //! Returns the first value in this keyword converted to a double operator double() const { - return (double) operator[](0); + return toDouble(operator[](0)); }; //! Returns the first value in this keyword converted to an integer operator int() const { - return (int) operator[](0); + return toInt(operator[](0)); }; //! Returns the first value in this keyword converted to a BigInt operator Isis::BigInt() const { - return (Isis::BigInt) operator[](0); - }; - //! Returns the first value in this keyword converted to a std::string - operator std::string() const { - return (std::string) operator[](0); + return toBigInt(operator[](0)); }; operator QString() const; - const Isis::IString &operator[](const int index) const; - Isis::IString &operator[](const int index); - std::string Unit(const int index = 0) const; + const QString &operator[](int index) const; + QString &operator[](int index); + QString Unit(const int index = 0) const; - void AddComment(const std::string &comment); - void AddCommentWrapped(const std::string &comment); + void AddComment(QString comment); + void AddCommentWrapped(QString comment); - void AddComments(const std::vector &comments); + void AddComments(const std::vector &comments); //! Returns the number of lines of comments associated with this keyword int Comments() const { return (p_comments ? p_comments->size() : 0); }; - std::string Comment(const int index) const; + QString Comment(const int index) const; void ClearComments(); /** @@ -200,7 +197,7 @@ namespace Isis { return !(*this == key); }; - bool IsEquivalent(const std::string &string1, int index = 0) const; + bool IsEquivalent(QString string1, int index = 0) const; /** * The width of the longest keyword name (for formatting) @@ -235,34 +232,34 @@ namespace Isis { void SetFormat(PvlFormat *formatter); PvlFormat *GetFormat(); - static bool StringEqual(const std::string &string1, - const std::string &string2); + static bool StringEqual(const QString &string1, + const QString &string2); - static std::string ReadLine(std::istream &is, bool insideComment); + static QString ReadLine(std::istream &is, bool insideComment); - static bool ReadCleanKeyword(std::string keyword, - std::vector< std::string > &keywordComments, - std::string &keywordName, - std::vector< std::pair > + static bool ReadCleanKeyword(QString keyword, + std::vector< QString > &keywordComments, + QString &keywordName, + std::vector< std::pair > &keywordValues); - static std::string ReadValue(std::string &keyword, bool "eProblem); - static std::string ReadValue(std::string &keyword, bool "eProblem, + static QString ReadValue(QString &keyword, bool "eProblem); + static QString ReadValue(QString &keyword, bool "eProblem, const std::vector< std::pair > & otherDelimiters); const PvlKeyword &operator=(const PvlKeyword &other); //! Validate Keyword for type and required values - void ValidateKeyword(PvlKeyword & pvlKwrd, std::string psValueType="", PvlKeyword* pvlKwrdRange=NULL); + void ValidateKeyword(PvlKeyword & pvlKwrd, QString psValueType="", PvlKeyword* pvlKwrdRange=NULL); protected: - std::string Reform(const std::string &value) const; - std::string ToPvl(const std::string &value) const; - std::string ToIPvl(const std::string &value) const; + QString Reform(const QString &value) const; + QString ToPvl(const QString &value) const; + QString ToIPvl(const QString &value) const; std::ostream &WriteWithWrap(std::ostream &os, - const std::string &textToWrite, + const QString &textToWrite, int startColumn, PvlFormat &format) const; @@ -281,13 +278,13 @@ namespace Isis { * of the time we have one value per keyword so that is what we're * allocating by default with this variable. */ - QVarLengthArray p_values; + QVarLengthArray p_values; //! The units for the values. - std::vector *p_units; + std::vector *p_units; //! The comments for the keyword. - std::vector *p_comments; + std::vector *p_comments; void Init(); diff --git a/isis/src/base/objs/PvlKeyword/unitTest.cpp b/isis/src/base/objs/PvlKeyword/unitTest.cpp index 45286f2dcf..6c1a85f8bf 100644 --- a/isis/src/base/objs/PvlKeyword/unitTest.cpp +++ b/isis/src/base/objs/PvlKeyword/unitTest.cpp @@ -12,7 +12,7 @@ using namespace Isis; int main() { Isis::Preference::Preferences(true); - string keywordsToTry[] = { + QString keywordsToTry[] = { "KEYWORD", "KEYWORD X", "KEYWORD =", @@ -62,12 +62,12 @@ int main() { cout << "----- Testing Basic Read/Write -----" << endl; PvlKeyword keyword; for(unsigned int key = 0; - key < sizeof(keywordsToTry) / sizeof(string); + key < sizeof(keywordsToTry) / sizeof(QString); key++) { - string keywordCpy = keywordsToTry[key]; - while(keywordCpy.find("\n") != string::npos) { - cout << keywordCpy.substr(0, keywordCpy.find("\n") + 1); - keywordCpy = keywordCpy.substr(keywordCpy.find("\n") + 1); + QString keywordCpy = keywordsToTry[key]; + while(keywordCpy.contains("\n")) { + cout << keywordCpy.mid(0, keywordCpy.indexOf("\n") + 1); + keywordCpy = keywordCpy.mid(keywordCpy.indexOf("\n") + 1); } cout << "'" << keywordCpy << "' "; @@ -78,9 +78,9 @@ int main() { cout << "> "; - vector< string > keywordComments; - string keywordName; - vector< pair > keywordValues; + vector< QString > keywordComments; + QString keywordName; + vector< pair > keywordValues; bool result = false; @@ -109,7 +109,7 @@ int main() { for(unsigned int value = 0; value < keywordValues.size(); value++) { cout << " VALUE: " << keywordValues[value].first; - if(!keywordValues[value].second.empty()) { + if(!keywordValues[value].second.isEmpty()) { cout << " <" << keywordValues[value].second << ">"; } @@ -122,7 +122,7 @@ int main() { cout << endl << endl; cout << "----- Testing Stream Read/Write -----" << endl; for(unsigned int key = 0; - key < sizeof(keywordsToTry) / sizeof(string); + key < sizeof(keywordsToTry) / sizeof(QString); key ++) { stringstream stream; PvlKeyword someKey; @@ -131,7 +131,7 @@ int main() { cout << endl << "Output: " << endl; try { - stream.write(keywordsToTry[key].c_str(), keywordsToTry[key].size()); + stream.write(keywordsToTry[key].toAscii().data(), keywordsToTry[key].size()); stream >> someKey; cout << someKey << endl; } @@ -165,9 +165,9 @@ int main() { streamZ >> keyZRead; cout << keyZRead << endl; - Isis::PvlKeyword keyU("ARRAY_TEST", 5.87, "lightyears"); - keyU.AddValue(5465.6, "lightyears"); - keyU.AddValue(574.6, "lightyears"); + Isis::PvlKeyword keyU("ARRAY_TEST", toString(5.87), "lightyears"); + keyU.AddValue("5465.6", "lightyears"); + keyU.AddValue("574.6", "lightyears"); PvlKeyword keyURead; stringstream streamU; @@ -200,18 +200,18 @@ int main() { cout << keyBRead << endl; Isis::PvlKeyword keyW("UGHHHHHHHHHHHH"); - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; - keyW += 59999.0; + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); + keyW += toString(59999.0); PvlKeyword keyWRead; stringstream streamW; @@ -219,25 +219,25 @@ int main() { streamW >> keyWRead; cout << keyWRead << endl; - const Isis::PvlKeyword key("NAME", 5.2, "meters"); + const Isis::PvlKeyword key("NAME", "5.2", "meters"); cout << key << endl; Isis::PvlKeyword key2("KEY"); cout << key2 << endl; - key2 += 5; - key2 += string(""); - key2.AddValue(3.3, "feet"); + key2 += "5"; + key2 += QString(""); + key2.AddValue("3.3", "feet"); key2.AddValue("Hello World!"); - string str = "Hello World! This is a really really long comment that needs to" - " be wrapped onto several different lines to make the PVL file " - "look really pretty!"; + QString str = "Hello World! This is a really really long comment that needs to" + " be wrapped onto several different lines to make the PVL file " + "look really pretty!"; key2.AddCommentWrapped(str); cout << key2 << endl; cout << key2[1] << endl; - key2[1] = 88; + key2[1] = toString(88); cout << key2 << endl; Isis::PvlSequence seq; @@ -270,7 +270,7 @@ int main() { Isis::PvlKeyword cast01("cast1", "I'm being casted"); Isis::PvlKeyword cast02("cast2", "465721"); Isis::PvlKeyword cast03("cast3", "131.2435"); - cout << "string = " << (string)cast01 << endl; + cout << "string = " << (QString)cast01 << endl; cout << "int = " << (int)cast02 << endl; cout << "BigInt = " << (Isis::BigInt)cast02 << endl; cout << "double = " << (double)cast03 << endl; @@ -306,7 +306,7 @@ int main() { try { // Template Keyword PvlKeyword pvlTmplKwrd("KeyName", "integer"); - PvlKeyword pvlKwrd("KeyName", 3); + PvlKeyword pvlKwrd("KeyName", "3"); pvlTmplKwrd.ValidateKeyword(pvlKwrd); pvlKwrd.Clear(); @@ -314,7 +314,7 @@ int main() { pvlTmplKwrd.ValidateKeyword(pvlKwrd); pvlKwrd.Clear(); - pvlKwrd=PvlKeyword("KeyName", 3.5); + pvlKwrd=PvlKeyword("KeyName", toString(3.5)); pvlTmplKwrd.ValidateKeyword(pvlKwrd); } catch(Isis::IException &e) { @@ -324,7 +324,7 @@ int main() { // Test keyword__Type try { PvlKeyword pvlTmplKwrd("KeyName", "integer"); - PvlKeyword pvlKwrd("KeyName", -3); + PvlKeyword pvlKwrd("KeyName", toString(-3)); pvlTmplKwrd.ValidateKeyword(pvlKwrd, "positive"); } catch(Isis::IException &e) { cerr <<"Positive number Expected" << endl; @@ -333,8 +333,8 @@ int main() { // Test keyword__Type try { PvlKeyword pvlTmplKwrd("KeyName", "integer"); - PvlKeyword pvlTmplKwrdRange("KeyName__Range", (0-10)); - PvlKeyword pvlKwrd("KeyName", 11); + PvlKeyword pvlTmplKwrdRange("KeyName__Range", toString(0-10)); + PvlKeyword pvlKwrd("KeyName", toString(11)); pvlTmplKwrd.ValidateKeyword(pvlKwrd, "", &pvlTmplKwrdRange); } catch(Isis::IException &e) { cerr <<"Integer not in the Range. Expected (0-10)" << endl; diff --git a/isis/src/base/objs/PvlObject/PvlObject.cpp b/isis/src/base/objs/PvlObject/PvlObject.cpp index c692632571..a9af2781e1 100644 --- a/isis/src/base/objs/PvlObject/PvlObject.cpp +++ b/isis/src/base/objs/PvlObject/PvlObject.cpp @@ -23,7 +23,7 @@ #include "FileName.h" #include "Pvl.h" #include "IException.h" -#include "IException.h" +#include "IString.h" #include "Message.h" #include "PvlFormat.h" #include "PvlObject.h" @@ -46,7 +46,7 @@ namespace Isis { * * @param name The name of the PvlObject. */ - PvlObject::PvlObject(const std::string &name) : + PvlObject::PvlObject(const QString &name) : Isis::PvlContainer("Object", name) { } @@ -69,7 +69,7 @@ namespace Isis { * * @throws IException */ - Isis::PvlGroup &PvlObject::FindGroup(const std::string &name, + Isis::PvlGroup &PvlObject::FindGroup(const QString &name, PvlObject::FindOptions opts) { vector searchList; searchList.push_back(this); @@ -88,7 +88,7 @@ namespace Isis { searchList.erase(searchList.begin()); } - string msg = "Unable to find PVL group [" + name + "]"; + QString msg = "Unable to find PVL group [" + name + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -104,7 +104,7 @@ namespace Isis { * * @throws IException */ - const Isis::PvlGroup &PvlObject::FindGroup(const std::string &name, + const Isis::PvlGroup &PvlObject::FindGroup(const QString &name, PvlObject::FindOptions opts) const { vector searchList; searchList.push_back(this); @@ -123,7 +123,7 @@ namespace Isis { searchList.erase(searchList.begin()); } - string msg = "Unable to find PVL group [" + name + "]"; + QString msg = "Unable to find PVL group [" + name + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -145,7 +145,7 @@ namespace Isis { * * @throws IException */ - PvlKeyword &PvlObject::FindKeyword(const std::string &kname, + PvlKeyword &PvlObject::FindKeyword(const QString &kname, FindOptions opts) { // Call the parent's version if they don't want to dig deeper @@ -186,7 +186,7 @@ namespace Isis { } // No where else to look for the Keyword so throw an error - string msg = "Unable to find PVL keyword [" + kname + "]"; + QString msg = "Unable to find PVL keyword [" + kname + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -204,7 +204,7 @@ namespace Isis { * * @return True if the Keyword exists False otherwise. */ - bool PvlObject::HasKeyword(const std::string &kname, + bool PvlObject::HasKeyword(const QString &kname, FindOptions opts) const { // Call the parent's version if they don't want to dig deeper @@ -258,7 +258,7 @@ namespace Isis { * * @throws IException */ - PvlObject &PvlObject::FindObject(const std::string &name, + PvlObject &PvlObject::FindObject(const QString &name, PvlObject::FindOptions opts) { vector searchList; searchList.push_back(this); @@ -277,7 +277,7 @@ namespace Isis { searchList.erase(searchList.begin()); } - string msg = "Unable to find PVL object [" + name + "]"; + QString msg = "Unable to find PVL object [" + name + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -293,7 +293,7 @@ namespace Isis { * * @throws IException */ - const PvlObject &PvlObject::FindObject(const std::string &name, + const PvlObject &PvlObject::FindObject(const QString &name, FindOptions opts) const { vector searchList; searchList.push_back(this); @@ -317,7 +317,7 @@ namespace Isis { searchList.erase(searchList.begin()); } - string msg = "Unable to find PVL object [" + name + "]"; + QString msg = "Unable to find PVL object [" + name + "]"; if(p_filename.size() > 0) { msg += " in file [" + p_filename + "]"; @@ -334,10 +334,10 @@ namespace Isis { * * @throws IException */ - void PvlObject::DeleteObject(const std::string &name) { + void PvlObject::DeleteObject(const QString &name) { PvlObjectIterator key = FindObject(name, BeginObject(), EndObject()); if(key == EndObject()) { - string msg = "Unable to find PVL object [" + name + "] in " + Type() + + QString msg = "Unable to find PVL object [" + name + "] in " + Type() + " [" + Name() + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -356,7 +356,7 @@ namespace Isis { */ void PvlObject::DeleteObject(const int index) { if(index >= (int)p_objects.size() || index < 0) { - string msg = "The specified index is out of bounds in PVL " + Type() + + QString msg = "The specified index is out of bounds in PVL " + Type() + " [" + Name() + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -376,10 +376,10 @@ namespace Isis { * * @throws IException */ - void PvlObject::DeleteGroup(const std::string &name) { + void PvlObject::DeleteGroup(const QString &name) { PvlGroupIterator key = FindGroup(name, BeginGroup(), EndGroup()); if(key == EndGroup()) { - string msg = "Unable to find PVL group [" + name + "] in " + Type() + + QString msg = "Unable to find PVL group [" + name + "] in " + Type() + " [" + Name() + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -398,7 +398,7 @@ namespace Isis { */ void PvlObject::DeleteGroup(const int index) { if(index >= (int)p_groups.size() || index < 0) { - string msg = "The specified index is out of bounds in PVL " + Type() + + QString msg = "The specified index is out of bounds in PVL " + Type() + " [" + Name() + "]"; if(p_filename.size() > 0) msg += " in file [" + p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -422,7 +422,7 @@ namespace Isis { */ Isis::PvlGroup &PvlObject::Group(const int index) { if(index < 0 || index >= (int)p_groups.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -441,7 +441,7 @@ namespace Isis { */ const Isis::PvlGroup &PvlObject::Group(const int index) const { if(index < 0 || index >= (int)p_groups.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -459,7 +459,7 @@ namespace Isis { */ PvlObject &PvlObject::Object(const int index) { if(index < 0 || index >= (int)p_objects.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(Isis::IException::Programmer, msg, _FILEINFO_); } @@ -477,7 +477,7 @@ namespace Isis { */ const PvlObject &PvlObject::Object(const int index) const { if(index < 0 || index >= (int)p_objects.size()) { - string msg = Message::ArraySubscriptNotInRange(index); + QString msg = Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -515,10 +515,10 @@ namespace Isis { // Include files take precedence to all other objects and groups for(int i = 0; i < outTemplate.Keywords(); i++) { if(outTemplate[i].IsNamed("Isis:PvlTemplate:File")) { - string filename = outTemplate[i]; + QString filename = outTemplate[i]; Isis::FileName file(filename); if(!file.fileExists()) { - string message = "Could not open the following PVL template file: "; + QString message = "Could not open the following PVL template file: "; message += filename; throw IException(IException::Io, message, _FILEINFO_); } @@ -692,7 +692,7 @@ namespace Isis { is.seekg(beforeKeywordPos, ios::beg); - string msg = "Expected PVL keyword named [Object], found keyword named ["; + QString msg = "Expected PVL keyword named [Object], found keyword named ["; msg += readKeyword.Name(); msg += "]"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -704,7 +704,7 @@ namespace Isis { else { is.seekg(beforeKeywordPos, ios::beg); - string msg = "Expected a single value for PVL object name, found [("; + QString msg = "Expected a single value for PVL object name, found [("; for(int i = 0; i < readKeyword.Size(); i++) { if(i != 0) msg += ", "; @@ -735,7 +735,7 @@ namespace Isis { is.seekg(beforeKeywordPos, ios::beg); - string msg = "Unexpected ["; + QString msg = "Unexpected ["; msg += readKeyword.Name(); msg += "] in PVL Object ["; msg += result.Name(); @@ -779,7 +779,7 @@ namespace Isis { is.seekg(beforeKeywordPos, ios::beg); - string msg = "PVL Object [" + result.Name(); + QString msg = "PVL Object [" + result.Name(); msg += "] EndObject not found before end of file"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -817,7 +817,7 @@ namespace Isis { for(int i=0; i + +#include + #include "PvlSequence.h" #include "Pvl.h" +#include "IString.h" namespace Isis { /** @@ -48,13 +52,13 @@ namespace Isis { * * @param array A string representing an array. */ - PvlSequence &PvlSequence::operator+=(const std::string &array) { + PvlSequence &PvlSequence::operator+=(const QString &array) { std::stringstream str; str << "temp = " << array; Pvl pvl; str >> pvl; PvlKeyword &key = pvl["temp"]; - std::vector temp; + std::vector temp; for(int i = 0; i < key.Size(); i++) { temp.push_back(key[i]); } @@ -68,10 +72,10 @@ namespace Isis { * * @param array vector of strings */ - PvlSequence &PvlSequence::operator+=(std::vector &array) { - std::vector temp; + PvlSequence &PvlSequence::operator+=(std::vector &array) { + std::vector temp; for(int i = 0; i < (int)array.size(); i++) { - temp.push_back(IString(array[i])); + temp.push_back(array[i]); } p_sequence.push_back(temp); return *this; @@ -84,9 +88,9 @@ namespace Isis { * @param array vector of integers */ PvlSequence &PvlSequence::operator+=(std::vector &array) { - std::vector temp; + std::vector temp; for(int i = 0; i < (int)array.size(); i++) { - temp.push_back(IString(array[i])); + temp.push_back(toString(array[i])); } p_sequence.push_back(temp); return *this; @@ -99,9 +103,9 @@ namespace Isis { * @param array vector of doubles */ PvlSequence &PvlSequence::operator+=(std::vector &array) { - std::vector temp; + std::vector temp; for(int i = 0; i < (int)array.size(); i++) { - temp.push_back(IString(array[i])); + temp.push_back(toString(array[i])); } p_sequence.push_back(temp); return *this; diff --git a/isis/src/base/objs/PvlSequence/PvlSequence.h b/isis/src/base/objs/PvlSequence/PvlSequence.h index d91a69297c..ebe4620e86 100644 --- a/isis/src/base/objs/PvlSequence/PvlSequence.h +++ b/isis/src/base/objs/PvlSequence/PvlSequence.h @@ -25,8 +25,10 @@ #define PvlSequence_h #include + +#include + #include "PvlKeyword.h" -#include "IString.h" namespace Isis { /** @@ -69,16 +71,16 @@ namespace Isis { PvlSequence &operator=(PvlKeyword &key); - PvlSequence &operator+=(const std::string &array); + PvlSequence &operator+=(const QString &array); - PvlSequence &operator+=(std::vector &array); + PvlSequence &operator+=(std::vector &array); PvlSequence &operator+=(std::vector &array); PvlSequence &operator+=(std::vector &array); //! Return the ith Array of the sequence - std::vector &operator[](int i) { + std::vector &operator[](int i) { return p_sequence[i]; }; @@ -93,7 +95,7 @@ namespace Isis { }; private: - std::vector > p_sequence; /** > p_sequence; /** + +#include + #include "PvlKeyword.h" #include "PvlSequence.h" #include "Preference.h" +using namespace Isis; + int main(void) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::PvlKeyword key("Key"); - key += std::string("(xyzzy,plover)"); - key += std::string("(2,b,|,^,2,b)"); + PvlKeyword key("Key"); + key += QString("(xyzzy,plover)"); + key += QString("(2,b,|,^,2,b)"); - Isis::PvlSequence seq; + PvlSequence seq; seq = key; - seq += std::string("(a,b,c)"); - seq += std::string("(d,e)"); - seq += std::string("singleton"); + seq += QString("(a,b,c)"); + seq += QString("(d,e)"); + seq += QString("singleton"); - std::vector slist; + std::vector slist; slist.push_back("1"); slist.push_back("2"); seq += slist; diff --git a/isis/src/base/objs/PvlToken/PvlToken.cpp b/isis/src/base/objs/PvlToken/PvlToken.cpp index a37cf5b78b..6e071f758c 100644 --- a/isis/src/base/objs/PvlToken/PvlToken.cpp +++ b/isis/src/base/objs/PvlToken/PvlToken.cpp @@ -31,20 +31,19 @@ namespace Isis { * * @param k Value of the keyword */ - PvlToken::PvlToken(const std::string &k) { + PvlToken::PvlToken(const QString &k) { SetKey(k); ValueClear(); } //! Constructs a Token with NULL for both the keyword and value list. PvlToken::PvlToken() { - key.erase(); ValueClear(); } //! Destroys the Token object PvlToken::~PvlToken() { - key.erase(); + key.clear(); ValueClear(); } @@ -53,31 +52,27 @@ namespace Isis { * * @param k IString to load into the token keyword */ - void PvlToken::SetKey(const std::string &k) { + void PvlToken::SetKey(const QString &k) { key = k; }; /** * Returns the token keyword * - * @return string + * @return QString */ - string PvlToken::GetKey() const { + QString PvlToken::GetKey() const { return key; }; /** * Returns the token keyword in all uppercase characters * - * @return string + * @return QString */ - string PvlToken::GetKeyUpper() const { - string upperkey = key; - for(int i = 0; i < (int)upperkey.size(); i++) { - upperkey[i] = toupper(upperkey[i]); - } - return upperkey; - }; + QString PvlToken::GetKeyUpper() const { + return key.toUpper(); + } //! Removes all elements from the value-vector void PvlToken::ValueClear() { @@ -99,7 +94,7 @@ namespace Isis { * * @param v IString add to the value-vector list */ - void PvlToken::AddValue(const std::string &v) { + void PvlToken::AddValue(const QString &v) { value.push_back(v); } @@ -108,13 +103,13 @@ namespace Isis { * * @param index Zero-based index of vector element to return. Defaults to 0 * - * @return string + * @return QString * * @throws Isis::IException::Programmer */ - string PvlToken::GetValue(const int index) const { + QString PvlToken::GetValue(const int index) const { if((index < 0) || (index >= (int) value.size())) { - string message = Isis::Message::ArraySubscriptNotInRange(index); + QString message = Isis::Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, message, _FILEINFO_); } return value[index]; @@ -125,19 +120,16 @@ namespace Isis { * * @param index Zero-based index of vector element to return. Defaults to 0 * - * @return string + * @return QString * * @throws Isis::IException::Programmer */ - string PvlToken::GetValueUpper(const int index) const { + QString PvlToken::GetValueUpper(int index) const { if((index < 0) || (index >= (int) value.size())) { - string message = Isis::Message::ArraySubscriptNotInRange(index); + QString message = Isis::Message::ArraySubscriptNotInRange(index); throw IException(IException::Programmer, message, _FILEINFO_); } - string upper = value[index]; - for(int i = 0; i < (int)upper.size(); i++) { - upper[i] = toupper(upper[i]); - } - return upper; + + return value[index].toUpper(); } } // end namespace isis diff --git a/isis/src/base/objs/PvlToken/PvlToken.h b/isis/src/base/objs/PvlToken/PvlToken.h index c6b38ef04b..979c4da4ee 100644 --- a/isis/src/base/objs/PvlToken/PvlToken.h +++ b/isis/src/base/objs/PvlToken/PvlToken.h @@ -22,10 +22,11 @@ * http://www.usgs.gov/privacy.html. */ -#include #include #include +#include + namespace Isis { /** * @brief Container for Keyword-value pair @@ -50,27 +51,27 @@ namespace Isis { class PvlToken { private: - std::string key; //!< Storage for the keyword name - std::vector value; /** value; /** &ValueVector() const { + inline const std::vector &ValueVector() const { return value; }; }; diff --git a/isis/src/base/objs/PvlToken/unitTest.cpp b/isis/src/base/objs/PvlToken/unitTest.cpp index de26449261..6af6a75dfc 100644 --- a/isis/src/base/objs/PvlToken/unitTest.cpp +++ b/isis/src/base/objs/PvlToken/unitTest.cpp @@ -3,12 +3,13 @@ #include "IException.h" #include "Preference.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::PvlToken dog("Dog"); + PvlToken dog("Dog"); dog.AddValue("drools"); cout << "Info on dog" << endl; @@ -36,14 +37,14 @@ int main(int argc, char *argv[]) { try { dog.GetValue(-1); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } try { dog.GetValue(1); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } diff --git a/isis/src/base/objs/PvlTokenizer/PvlTokenizer.cpp b/isis/src/base/objs/PvlTokenizer/PvlTokenizer.cpp index 3670fbf381..d6edbfdd7c 100644 --- a/isis/src/base/objs/PvlTokenizer/PvlTokenizer.cpp +++ b/isis/src/base/objs/PvlTokenizer/PvlTokenizer.cpp @@ -19,12 +19,16 @@ * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ +#include "PvlTokenizer.h" + #include #include -#include "PvlTokenizer.h" + +#include + #include "IException.h" -#include "Message.h" #include "IString.h" +#include "Message.h" using namespace std; namespace Isis { @@ -47,19 +51,18 @@ namespace Isis { /** * Loads the Token list from a stream. The loading will be terminated upon * reaching either 1) end-of-stream, or - * 2) a programmer specified terminator string + * 2) a programmer specified terminator QString * * @param stream The input stream to tokenize * - * @param terminator If the tokenizer see's this string as a token in the input + * @param terminator If the tokenizer see's this QString as a token in the input * stream it will cease tokenizing. Defaults to "END" * * @throws Isis::iException::Parse */ - void PvlTokenizer::Load(std::istream &stream, const std::string &terminator) { - Isis::IString upTerminator(terminator); - upTerminator.UpCase(); - string s; + void PvlTokenizer::Load(std::istream &stream, const QString &terminator) { + QString upTerminator(terminator.toUpper()); + QString s; int c; bool newlineFound = false; @@ -150,7 +153,7 @@ namespace Isis { ParseCommaList(t, s); } catch(IException &e) { - string message = Isis::Message::KeywordValueBad(t.GetKey()); + QString message = Isis::Message::KeywordValueBad(t.GetKey()); throw IException(e, IException::Unknown, message, _FILEINFO_); } tokens.push_back(t); @@ -164,7 +167,7 @@ namespace Isis { ParseCommaList(t, s); } catch(IException &e) { - string message = Isis::Message::KeywordValueBad(t.GetKey()); + QString message = Isis::Message::KeywordValueBad(t.GetKey()); throw IException(e, IException::Unknown, message, _FILEINFO_); } tokens.push_back(t); @@ -177,7 +180,7 @@ namespace Isis { s = ReadToDoubleQuote(stream); } catch(IException &e) { - string message = Isis::Message::KeywordValueBad(t.GetKey()); + QString message = Isis::Message::KeywordValueBad(t.GetKey()); throw IException(e, IException::Unknown, message, _FILEINFO_); } t.AddValue(s); @@ -191,7 +194,7 @@ namespace Isis { s = ReadToSingleQuote(stream); } catch(IException &e) { - string message = Isis::Message::KeywordValueBad(t.GetKey()); + QString message = Isis::Message::KeywordValueBad(t.GetKey()); throw IException(IException::Unknown, message, _FILEINFO_); } t.AddValue(s); @@ -212,10 +215,10 @@ namespace Isis { * * @param stream Input stream to read from * - * @return string + * @return QString */ - string PvlTokenizer::ReadComment(std::istream &stream) { - string s; + QString PvlTokenizer::ReadComment(std::istream &stream) { + QString s; int c; c = stream.get(); @@ -240,10 +243,10 @@ namespace Isis { * * @param stream Input stream to read from * - * @return string + * @return QString */ - string PvlTokenizer::ReadToken(std::istream &stream) { - string s; + QString PvlTokenizer::ReadToken(std::istream &stream) { + QString s; int c; c = stream.get(); @@ -286,15 +289,15 @@ namespace Isis { } - string PvlTokenizer::ReadToDoubleQuote(std::istream &stream) { - string s; + QString PvlTokenizer::ReadToDoubleQuote(std::istream &stream) { + QString s; int c; do { c = stream.get(); ValidateCharacter(c); if(c == EOF) { - string message = Isis::Message::MissingDelimiter('"', s); + QString message = Isis::Message::MissingDelimiter('"', s); throw IException(IException::Unknown, message, _FILEINFO_); } else if(c != '"') { @@ -303,35 +306,36 @@ namespace Isis { } while(c != '"'); - std::string::size_type pos = s.find_first_of("\n\r"); - while(pos != std::string::npos) { - Isis::IString first = s.substr(0, pos); + int pos = s.indexOf(QRegExp("[\\n\\r]")); + while(pos != -1) { + QString first = s.mid(0, pos); bool addspace = false; if(first[pos-1] == ' ') addspace = true; - first.TrimTail(" \t\n\r\f\0"); - Isis::IString second = s.substr(pos + 1); + first = first.remove(QRegExp("[\\s]*$")); + QString second = s.mid(pos + 1); if(second[0] == ' ') addspace = true; if(second[0] == '\r') addspace = true; if(second[0] == '\n') addspace = true; - second.TrimHead(" \t\n\r\f\0"); + second = second.remove(QRegExp("^[\\s]*")); if(second[0] == ',') addspace = false; s = first; if(addspace) s += " "; s += second; - pos = s.find_first_of("\n\r"); + + pos = s.indexOf(QRegExp("[\\n\\r]")); } return s; } - string PvlTokenizer::ReadToSingleQuote(std::istream &stream) { - string s; + QString PvlTokenizer::ReadToSingleQuote(std::istream &stream) { + QString s; int c; do { c = stream.get(); ValidateCharacter(c); if(c == EOF) { - string message = Isis::Message::MissingDelimiter('\'', s); + QString message = Isis::Message::MissingDelimiter('\'', s); throw IException(IException::Unknown, message, _FILEINFO_); } else if(c != '\'') { @@ -340,29 +344,29 @@ namespace Isis { } while(c != '\''); - std::string::size_type pos = s.find_first_of("\n\r"); - while(pos != std::string::npos) { - Isis::IString first = s.substr(0, pos); + int pos = s.indexOf(QRegExp("[\\n\\r]")); + while(pos != -1) { + QString first = s.mid(0, pos); bool addspace = false; if(first[pos-1] == ' ') addspace = true; - first.TrimTail(" \t\n\r\f\0"); - Isis::IString second = s.substr(pos + 1); + first = first.remove(QRegExp("[\\s]*$")); + QString second = s.mid(pos + 1); if(second[0] == ' ') addspace = true; if(second[0] == '\r') addspace = true; if(second[0] == '\n') addspace = true; - second.TrimHead(" \t\n\r\f\0"); + second = second.remove(QRegExp("^[\\s]*")); if(second[0] == ',') addspace = false; s = first; if(addspace) s += " "; s += second; - pos = s.find_first_of("\n\r"); + pos = s.indexOf(QRegExp("[\\n\\r]")); } return s; } - string PvlTokenizer::ReadToParen(std::istream &stream) { - string s; + QString PvlTokenizer::ReadToParen(std::istream &stream) { + QString s; int c; int leftParenCount = 1; @@ -370,7 +374,7 @@ namespace Isis { c = stream.get(); ValidateCharacter(c); if(c == EOF) { - string message = Isis::Message::MissingDelimiter(')', s); + QString message = Isis::Message::MissingDelimiter(')', s); throw IException(IException::Unknown, message, _FILEINFO_); } else if(c == '"') { @@ -378,7 +382,7 @@ namespace Isis { s += "\"" + ReadToDoubleQuote(stream) + "\""; } catch(IException &) { - string message = Isis::Message::MissingDelimiter('"', s); + QString message = Isis::Message::MissingDelimiter('"', s); throw IException(IException::Unknown, message, _FILEINFO_); } } @@ -387,7 +391,7 @@ namespace Isis { s += "'" + ReadToSingleQuote(stream) + "'"; } catch(IException &) { - string message = Isis::Message::MissingDelimiter('\'', s); + QString message = Isis::Message::MissingDelimiter('\'', s); throw IException(IException::Unknown, message, _FILEINFO_); } } @@ -405,8 +409,8 @@ namespace Isis { return s; } - string PvlTokenizer::ReadToBrace(std::istream &stream) { - string s; + QString PvlTokenizer::ReadToBrace(std::istream &stream) { + QString s; int c; int leftBraceCount = 1; @@ -414,7 +418,7 @@ namespace Isis { c = stream.get(); ValidateCharacter(c); if(c == EOF) { - string message = Isis::Message::MissingDelimiter('}', s); + QString message = Isis::Message::MissingDelimiter('}', s); throw IException(IException::Unknown, message, _FILEINFO_); } else if(c == '"') { @@ -422,7 +426,7 @@ namespace Isis { s += "\"" + ReadToDoubleQuote(stream) + "\""; } catch(IException &e) { - string message = Isis::Message::MissingDelimiter('"', s); + QString message = Isis::Message::MissingDelimiter('"', s); throw IException(IException::Unknown, message, _FILEINFO_); } } @@ -431,7 +435,7 @@ namespace Isis { s += "'" + ReadToSingleQuote(stream) + "'"; } catch(IException &) { - string message = Isis::Message::MissingDelimiter('\'', s); + QString message = Isis::Message::MissingDelimiter('\'', s); throw IException(IException::Unknown, message, _FILEINFO_); } } @@ -450,17 +454,17 @@ namespace Isis { } /** - * This routine parses a string containing a comma separated list. Each of the + * This routine parses a QString containing a comma separated list. Each of the * items in the list is stored as a value in the Token. * * @param t Token to load the comma separated list * - * @param cl IString containing comma separated list + * @param cl QString containing comma separated list */ - void PvlTokenizer::ParseCommaList(Isis::PvlToken &t, const std::string &cl) { - stringstream stream(cl); + void PvlTokenizer::ParseCommaList(Isis::PvlToken &t, const QString &cl) { + stringstream stream(cl.toAscii().data()); int c; - string s; + QString s; do { SkipWhiteSpace(stream); @@ -483,7 +487,7 @@ namespace Isis { } else if(c == ',') { t.AddValue(s); - s.erase(); + s.clear(); } else if(c != EOF) { s += (char) c; @@ -510,7 +514,7 @@ namespace Isis { if(isspace(c)) return; if(c == '\0') return; - string message = "ASCII data expected but found unprintable (binary) data"; + QString message = "ASCII data expected but found unprintable (binary) data"; throw IException(IException::Unknown, message, _FILEINFO_); } } // end namespace isis diff --git a/isis/src/base/objs/PvlTokenizer/PvlTokenizer.h b/isis/src/base/objs/PvlTokenizer/PvlTokenizer.h index 71562cc839..0a326e8154 100644 --- a/isis/src/base/objs/PvlTokenizer/PvlTokenizer.h +++ b/isis/src/base/objs/PvlTokenizer/PvlTokenizer.h @@ -25,6 +25,8 @@ #include #include "PvlToken.h" +#include + namespace Isis { /** * @brief Construct Token list from a stream @@ -94,21 +96,21 @@ namespace Isis { the stream*/ - std::string ReadComment(std::istream &stream); - std::string ReadToken(std::istream &stream); + QString ReadComment(std::istream &stream); + QString ReadToken(std::istream &stream); bool SkipWhiteSpace(std::istream &stream); - std::string ReadToSingleQuote(std::istream &stream); - std::string ReadToDoubleQuote(std::istream &stream); - std::string ReadToParen(std::istream &stream); - std::string ReadToBrace(std::istream &stream); - void ParseCommaList(Isis::PvlToken &t, const std::string &cl); + QString ReadToSingleQuote(std::istream &stream); + QString ReadToDoubleQuote(std::istream &stream); + QString ReadToParen(std::istream &stream); + QString ReadToBrace(std::istream &stream); + void ParseCommaList(Isis::PvlToken &t, const QString &cl); void ValidateCharacter(int c); public: PvlTokenizer(); ~PvlTokenizer(); - void Load(std::istream &stream, const std::string &terminator = "END"); + void Load(std::istream &stream, const QString &terminator = "END"); void Clear(); std::vector & GetTokenList(); diff --git a/isis/src/base/objs/PvlTokenizer/unitTest.cpp b/isis/src/base/objs/PvlTokenizer/unitTest.cpp index 05362c4307..7c4c5a050b 100644 --- a/isis/src/base/objs/PvlTokenizer/unitTest.cpp +++ b/isis/src/base/objs/PvlTokenizer/unitTest.cpp @@ -4,15 +4,17 @@ #include "IException.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(void) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); //***************************************************************************** // Create Instances of the Tokenizer //***************************************************************************** - Isis::PvlTokenizer tizer; + PvlTokenizer tizer; //***************************************************************************** // Create a stream and load it @@ -39,11 +41,11 @@ int main(void) { try { tizer.Load(os); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } - vector t = tizer.GetTokenList(); + vector t = tizer.GetTokenList(); cout << "TESTING TOKENIZER" << endl; int i, j; @@ -58,7 +60,7 @@ int main(void) { cout << "TESTING TOKENIZER CLEAR" << endl; tizer.Clear(); - vector t2 = tizer.GetTokenList(); + vector t2 = tizer.GetTokenList(); cout << t2.size() << endl << endl; stringstream os2; @@ -67,7 +69,7 @@ int main(void) { try { tizer.Load(os2); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; @@ -78,7 +80,7 @@ int main(void) { try { tizer.Load(os3); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; @@ -89,7 +91,7 @@ int main(void) { try { tizer.Load(os4); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; @@ -100,7 +102,7 @@ int main(void) { try { tizer.Load(os5); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; @@ -111,7 +113,7 @@ int main(void) { try { tizer.Load(os6); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; @@ -122,7 +124,7 @@ int main(void) { try { tizer.Load(os7); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; @@ -133,7 +135,7 @@ int main(void) { try { tizer.Load(os8); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; diff --git a/isis/src/base/objs/PvlTranslationManager/PvlTranslationManager.cpp b/isis/src/base/objs/PvlTranslationManager/PvlTranslationManager.cpp index 5cd981907d..67cacc3efd 100644 --- a/isis/src/base/objs/PvlTranslationManager/PvlTranslationManager.cpp +++ b/isis/src/base/objs/PvlTranslationManager/PvlTranslationManager.cpp @@ -28,7 +28,7 @@ using namespace std; namespace Isis { - PvlTranslationManager::PvlTranslationManager(const std::string &transFile) { + PvlTranslationManager::PvlTranslationManager(const QString &transFile) { AddTable(transFile); } @@ -41,7 +41,7 @@ namespace Isis { * the input label. */ PvlTranslationManager::PvlTranslationManager(Isis::Pvl &inputLabel, - const std::string &transFile) { + const QString &transFile) { p_fLabel = inputLabel; // Internalize the translation table @@ -79,7 +79,7 @@ namespace Isis { * * @return string */ - string PvlTranslationManager::Translate(const std::string nName, int findex) { + QString PvlTranslationManager::Translate(QString nName, int findex) { const Isis::PvlContainer *con; int inst = 0; PvlKeyword grp; @@ -106,7 +106,7 @@ namespace Isis { * @return Isis::PvlKeyword */ Isis::PvlKeyword PvlTranslationManager::DoTranslation( - const std::string nName) { + const QString nName) { const Isis::PvlContainer *con = NULL; Isis::PvlKeyword key; @@ -167,7 +167,7 @@ namespace Isis { * @throws Isis::IException::Programmer */ const PvlKeyword &PvlTranslationManager::InputKeyword( - const std::string nName) const { + const QString nName) const { int instanceNumber = 0; PvlKeyword inputGroupKeyword = InputGroup(nName, instanceNumber); @@ -188,12 +188,12 @@ namespace Isis { } if(anInputGroupFound) { - string msg = "Unable to find input keyword [" + InputKeywordName(nName) + + QString msg = "Unable to find input keyword [" + InputKeywordName(nName) + "] for output name [" + nName + "] in file [" + TranslationTable().FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } else { - string container = ""; + QString container = ""; for(int i = 0; i < InputGroup(nName).Size(); i++) { if(i > 0) container += ","; @@ -201,7 +201,7 @@ namespace Isis { container += InputGroup(nName)[i]; } - string msg = "Unable to find input group [" + container + + QString msg = "Unable to find input group [" + container + "] for output name [" + nName + "] in file [" + TranslationTable().FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -214,7 +214,7 @@ namespace Isis { * * @param nName The output name used to identify the input keyword. */ - bool PvlTranslationManager::InputHasKeyword(const std::string nName) { + bool PvlTranslationManager::InputHasKeyword(const QString nName) { // Set the current position in the input label pvl // by finding the input group corresponding to the output group @@ -239,7 +239,7 @@ namespace Isis { * * @param nName The output name used to identify the input keyword. - bool PvlTranslationManager::InputHasGroup (const std::string nName) { + bool PvlTranslationManager::InputHasGroup (const QString nName) { if (GetContainer (InputGroup(nName)) != NULL) { return true; @@ -291,7 +291,7 @@ namespace Isis { // Create the requsted container and any containers above it and // return a reference to the container // list is an Isis::PvlKeyword with an array of container types an their names - Isis::PvlContainer *PvlTranslationManager::CreateContainer(const std::string nName, + Isis::PvlContainer *PvlTranslationManager::CreateContainer(const QString nName, Isis::Pvl &pvl) { // Get the array of Objects/Groups from the OutputName keyword @@ -302,7 +302,7 @@ namespace Isis { // Look at every pair in the output position for(int c = 0; c < np.Size(); c += 2) { // If this pair is an object - if(np[c].UpCase() == "OBJECT") { + if(np[c].toUpper() == "OBJECT") { // If the object doesn't exist create it if(!obj->HasObject(np[c+1])) { obj->AddObject(np[c+1]); @@ -310,7 +310,7 @@ namespace Isis { obj = &(obj->FindObject(np[c+1])); } // If this pair is a group - else if(np[c].UpCase() == "GROUP") { + else if(np[c].toUpper() == "GROUP") { // If the group doesn't exist create it if(!obj->HasGroup(np[c+1])) { obj->AddGroup(np[c+1]); diff --git a/isis/src/base/objs/PvlTranslationManager/PvlTranslationManager.h b/isis/src/base/objs/PvlTranslationManager/PvlTranslationManager.h index fa9e7505aa..30a42f1a2a 100644 --- a/isis/src/base/objs/PvlTranslationManager/PvlTranslationManager.h +++ b/isis/src/base/objs/PvlTranslationManager/PvlTranslationManager.h @@ -74,10 +74,10 @@ namespace Isis { */ class PvlTranslationManager : public PvlTranslationTable { public: - PvlTranslationManager(const std::string &transFile); + PvlTranslationManager(const QString &transFile); PvlTranslationManager(Isis::Pvl &inputLabel, - const std::string &transFile); + const QString &transFile); PvlTranslationManager(Isis::Pvl &inputLabel, std::istream &transStrm); @@ -87,16 +87,16 @@ namespace Isis { // Attempt to translate the requested output name to output value // using the input name and value/default value - std::string Translate(const std::string nName, int findex = 0); + QString Translate(QString nName, int findex = 0); // Translate all translation table groups which contain "Auto" void Auto(Isis::Pvl &outputLabel); // Return the ith input value associated with a output name - const PvlKeyword &InputKeyword(const std::string nName) const; + const PvlKeyword &InputKeyword(const QString nName) const; // Return true if the input lable contains the translated group and key names - bool InputHasKeyword(const std::string nName); + bool InputHasKeyword(const QString nName); void SetLabel(Isis::Pvl &lab) { p_fLabel = lab; @@ -105,9 +105,9 @@ namespace Isis { Isis::Pvl p_fLabel; //!> fLabel; stringstream trnsStrm; @@ -151,9 +153,9 @@ int main(void) { trnsStrm << "End" << endl; - Isis::PvlTranslationManager transMgr(fLabel, trnsStrm); + PvlTranslationManager transMgr(fLabel, trnsStrm); - cout << "Testing Isis::PvlTranslationManager object" << endl; + cout << "Testing PvlTranslationManager object" << endl; cout << " Testing InputValue member" << endl; cout << " DataFileName = " << transMgr.InputKeyword("DataFileName")[0] << endl; @@ -164,14 +166,14 @@ int main(void) { try { transMgr.InputKeyword("BadGroup"); } - catch(Isis::IException &e) { + catch(IException &e) { cerr << " "; e.print(); } try { transMgr.InputKeyword("GoodGroupBadKey"); } - catch(Isis::IException &e) { + catch(IException &e) { cerr << " "; e.print(); } @@ -184,14 +186,14 @@ int main(void) { try { transMgr.InputKeyword("BadGroup").Unit(); } - catch(Isis::IException &e) { + catch(IException &e) { cerr << " "; e.print(); } try { transMgr.InputKeyword("GoodGroupBadKey").Unit(); } - catch(Isis::IException &e) { + catch(IException &e) { cerr << " "; e.print(); } @@ -204,14 +206,14 @@ int main(void) { try { transMgr.InputKeyword("BadGroup").Size(); } - catch(Isis::IException &e) { + catch(IException &e) { cerr << " "; e.print(); } try { transMgr.InputKeyword("GoodGroupBadKey").Size(); } - catch(Isis::IException &e) { + catch(IException &e) { cerr << " "; e.print(); } @@ -234,13 +236,13 @@ int main(void) { cout << endl; cout << " Testing Auto member" << endl; - Isis::Pvl pvl; + Pvl pvl; transMgr.Auto(pvl); cout << pvl << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } diff --git a/isis/src/base/objs/PvlTranslationTable/PvlTranslationTable.cpp b/isis/src/base/objs/PvlTranslationTable/PvlTranslationTable.cpp index 1b0deb81cd..db963aee1d 100644 --- a/isis/src/base/objs/PvlTranslationTable/PvlTranslationTable.cpp +++ b/isis/src/base/objs/PvlTranslationTable/PvlTranslationTable.cpp @@ -23,9 +23,8 @@ #include #include -#include "IString.h" -#include "IException.h" #include "IException.h" +#include "IString.h" #include "Message.h" #include "Pvl.h" #include "PvlTranslationTable.h" @@ -64,7 +63,7 @@ namespace Isis { * * @throws IException::Io */ - void PvlTranslationTable::AddTable(const std::string &transFile) { + void PvlTranslationTable::AddTable(const QString &transFile) { p_trnsTbl.Read(FileName(transFile).expanded()); } @@ -82,7 +81,7 @@ namespace Isis { PvlGroup currGrp = p_trnsTbl.Group(i); if(!currGrp.HasKeyword("InputKey")) { - string message = "Unable to find InputKey for group [" + QString message = "Unable to find InputKey for group [" + currGrp.Name() + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::User, message, _FILEINFO_); @@ -90,17 +89,17 @@ namespace Isis { // pair< name, size > of acceptable keywords. // A size of -1 means non-zero size. - vector< pair > validKeywords; - - validKeywords.push_back(pair("Translation", 2)); - validKeywords.push_back(pair("OutputName", 1)); - validKeywords.push_back(pair("InputGroup", -1)); - validKeywords.push_back(pair("InputPosition", -1)); - validKeywords.push_back(pair("OutputPosition", -1)); - validKeywords.push_back(pair("Auto", 0)); - validKeywords.push_back(pair("Optional", 0)); - validKeywords.push_back(pair("InputKey", 1)); - validKeywords.push_back(pair("InputDefault", -1)); + vector< pair > validKeywords; + + validKeywords.push_back(pair("Translation", 2)); + validKeywords.push_back(pair("OutputName", 1)); + validKeywords.push_back(pair("InputGroup", -1)); + validKeywords.push_back(pair("InputPosition", -1)); + validKeywords.push_back(pair("OutputPosition", -1)); + validKeywords.push_back(pair("Auto", 0)); + validKeywords.push_back(pair("Optional", 0)); + validKeywords.push_back(pair("InputKey", 1)); + validKeywords.push_back(pair("InputDefault", -1)); for(int j = 0; j < currGrp.Keywords(); j++) { bool validKeyword = false; @@ -136,14 +135,14 @@ namespace Isis { // if we had an error report it if(!validKeyword) { if(!keywordSizeMismatch) { - string message = "Keyword [" + currKey.Name(); + QString message = "Keyword [" + currKey.Name(); message += "] is not a valid keyword."; message += " Error in file [" + p_trnsTbl.FileName() + "]" ; throw IException(IException::User, message, _FILEINFO_); } else { - string message = "Keyword [" + currKey.Name(); + QString message = "Keyword [" + currKey.Name(); message += "] does not have the correct number of elements."; message += " Error in file [" + p_trnsTbl.FileName() + "]" ; @@ -162,14 +161,14 @@ namespace Isis { * * @param fValue The input value to be translated * - * @return string The translated string + * @return QString The translated QString * * @throws iException::Programmer */ - string PvlTranslationTable::Translate(const std::string nName, - const std::string fValue) const { + QString PvlTranslationTable::Translate(const QString nName, + const QString fValue) const { if(!p_trnsTbl.HasGroup(nName)) { - string msg = "Unable to find translation group [" + + QString msg = "Unable to find translation group [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -178,13 +177,13 @@ namespace Isis { const PvlGroup &tgrp = p_trnsTbl.FindGroup(nName); // If no input value was passed in search using the input default - string tmpFValue = fValue; - if(tmpFValue.empty()) { + QString tmpFValue = fValue; + if(tmpFValue.isEmpty()) { if(tgrp.HasKeyword("InputDefault")) { - tmpFValue = (string) tgrp["InputDefault"]; + tmpFValue = (QString) tgrp["InputDefault"]; } else { - string msg = "No value or default value to translate for "; + QString msg = "No value or default value to translate for "; msg += "translation group ["; msg += nName; msg += "] in file [" + p_trnsTbl.FileName() + "]"; @@ -199,11 +198,11 @@ namespace Isis { while(it != tgrp.End()) { const PvlKeyword &key = *it; - if((string) key[1] == tmpFValue) { + if((QString) key[1] == tmpFValue) { return key[0]; } - else if((string) key[1] == "*") { - if((string) key[0] == "*") { + else if((QString) key[1] == "*") { + if((QString) key[0] == "*") { return tmpFValue; } else { @@ -214,8 +213,8 @@ namespace Isis { it = tgrp.FindKeyword("Translation", it + 1, tgrp.End()); } - string msg = "Unable to find a translation value for [" + - nName + ", " + Isis::IString(fValue) + "] in file [" + + QString msg = "Unable to find a translation value for [" + + nName + ", " + fValue + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -229,15 +228,15 @@ namespace Isis { * @param inst The occurence number of the "InputGroup" keyword * (first one is zero) * - * @return string The input group name + * @return QString The input group name * * @throws iException::Programmer */ - PvlKeyword PvlTranslationTable::InputGroup(const std::string nName, + PvlKeyword PvlTranslationTable::InputGroup(const QString nName, const int inst) const { if(!p_trnsTbl.HasGroup(nName)) { - string msg = "Unable to find translation group [" + + QString msg = "Unable to find translation group [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -265,8 +264,8 @@ namespace Isis { // This check is to prevent backtracking to the old "value,value" way of // doing translation file input groups for the new keyword. Flag it // immediately to give a good error message. - if(result.Size() == 1 && result[0].find(",") != string::npos) { - IString msg = "Keyword [InputPosition] cannot have a comma [,] in "; + if(result.Size() == 1 && result[0].contains(",")) { + QString msg = "Keyword [InputPosition] cannot have a comma [,] in "; msg += " the value ["; msg += result[0]; msg += "]"; @@ -287,7 +286,7 @@ namespace Isis { /* Error if no containers were listed if(!foundLegalInputGroup) { - IString msg = "No input position found for translation ["; + QString msg = "No input position found for translation ["; msg += nName; msg += "] in translation file ["; msg += p_trnsTbl.FileName(); @@ -305,14 +304,14 @@ namespace Isis { * * @param nName The output name to be used to search the translation table. * - * @return string The input keyword name + * @return QString The input keyword name * * @throws iException::Programmer */ - string PvlTranslationTable::InputKeywordName(const std::string nName) const { + QString PvlTranslationTable::InputKeywordName(const QString nName) const { if(!p_trnsTbl.HasGroup(nName)) { - string msg = "Unable to find translation group [" + + QString msg = "Unable to find translation group [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -329,14 +328,14 @@ namespace Isis { * * @param nName The output name to be used to search the translation table. * - * @return string The input default value + * @return QString The input default value * * @throws iException::Programmer */ - string PvlTranslationTable::InputDefault(const std::string nName) const { + QString PvlTranslationTable::InputDefault(const QString nName) const { if(!p_trnsTbl.HasGroup(nName)) { - string msg = "Unable to find translation group [" + + QString msg = "Unable to find translation group [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -347,9 +346,9 @@ namespace Isis { return ""; } - bool PvlTranslationTable::IsAuto(const std::string nName) { + bool PvlTranslationTable::IsAuto(const QString nName) { if(!p_trnsTbl.HasGroup(nName)) { - string msg = "Unable to find translation group [" + nName + + QString msg = "Unable to find translation group [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -360,9 +359,9 @@ namespace Isis { return false; } - bool PvlTranslationTable::IsOptional(const std::string nName) { + bool PvlTranslationTable::IsOptional(const QString nName) { if(!p_trnsTbl.HasGroup(nName)) { - string msg = "Unable to find translation group [" + nName + + QString msg = "Unable to find translation group [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -374,16 +373,16 @@ namespace Isis { } Isis::PvlKeyword &PvlTranslationTable::OutputPosition( - const std::string nName) { + const QString nName) { if(!p_trnsTbl.HasGroup(nName)) { - string msg = "Unable to find translation group [" + + QString msg = "Unable to find translation group [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } Isis::PvlGroup &tgrp = p_trnsTbl.FindGroup(nName); if(!tgrp.HasKeyword("OutputPosition")) { - string msg = "Unable to find translation keyword [OutputPostion] in [" + + QString msg = "Unable to find translation keyword [OutputPostion] in [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -393,9 +392,9 @@ namespace Isis { } - string PvlTranslationTable::OutputName(const std::string nName) { + QString PvlTranslationTable::OutputName(const QString nName) { if(!p_trnsTbl.HasGroup(nName)) { - string msg = "Unable to find translation group [" + nName + + QString msg = "Unable to find translation group [" + nName + "] in file [" + p_trnsTbl.FileName() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/PvlTranslationTable/PvlTranslationTable.h b/isis/src/base/objs/PvlTranslationTable/PvlTranslationTable.h index b4a3b3fef3..792100e727 100644 --- a/isis/src/base/objs/PvlTranslationTable/PvlTranslationTable.h +++ b/isis/src/base/objs/PvlTranslationTable/PvlTranslationTable.h @@ -134,20 +134,20 @@ namespace Isis { ~PvlTranslationTable() { }; // Return the associated input group from the trans table - PvlKeyword InputGroup(const std::string nName, const int inst = 0) const; + PvlKeyword InputGroup(const QString nName, const int inst = 0) const; // Return the associated input keyword name from the trans table - std::string InputKeywordName(const std::string nName) const; + QString InputKeywordName(const QString nName) const; // Return the associated input default value from the trans table - std::string InputDefault(const std::string nName) const; + QString InputDefault(const QString nName) const; // Translate a single input value associated with a output name to a output value - std::string Translate(const std::string nName, const std::string fValue = "") const; + QString Translate(const QString nName, const QString fValue = "") const; // Add more table entries to the translation table data void AddTable(std::istream &transStm); - void AddTable(const std::string &transFile); + void AddTable(const QString &transFile); protected: Pvl &TranslationTable() { @@ -157,10 +157,10 @@ namespace Isis { return p_trnsTbl; } - bool IsAuto(const std::string nName); - bool IsOptional(const std::string nName); - PvlKeyword &OutputPosition(const std::string nName); - std::string OutputName(const std::string nName); + bool IsAuto(const QString nName); + bool IsOptional(const QString nName); + PvlKeyword &OutputPosition(const QString nName); + QString OutputName(const QString nName); private: Pvl p_trnsTbl; diff --git a/isis/src/base/objs/QtExporter/QtExporter.cpp b/isis/src/base/objs/QtExporter/QtExporter.cpp index 950f7f63b8..0e900c3e4d 100644 --- a/isis/src/base/objs/QtExporter/QtExporter.cpp +++ b/isis/src/base/objs/QtExporter/QtExporter.cpp @@ -7,6 +7,7 @@ #include "ExportDescription.h" #include "FileName.h" #include "IException.h" +#include "IString.h" using namespace Isis; @@ -17,7 +18,7 @@ namespace Isis { * * @param format The format to export to */ - QtExporter::QtExporter(IString format) : ImageExporter() { + QtExporter::QtExporter(QString format) : ImageExporter() { m_qimage = NULL; m_format = format; @@ -113,7 +114,7 @@ namespace Isis { // the following if statement does it informally. m_qimage->setPixel(s, l, dn); if (!m_qimage->valid(s, l)) { - IString msg = "QT has detected your file size as exceeding 2GB."; + QString msg = "QT has detected your file size as exceeding 2GB."; msg += " While your image might be under 2GB, your image labels are more"; msg += " than likely pushing the file size over 2GB."; throw IException(IException::User, msg, _FILEINFO_); @@ -178,10 +179,10 @@ namespace Isis { // The return status is wrong for JPEG images, so the code will always // continue - if (!m_qimage->save(outputName.expanded().c_str(), m_format.c_str(), + if (!m_qimage->save(outputName.expanded(), m_format.toAscii().data(), quality)) { - IString err = "Unable to save [" + outputName.expanded() + + QString err = "Unable to save [" + outputName.expanded() + "] to the disk"; throw IException(IException::Programmer, err, _FILEINFO_); } @@ -202,8 +203,8 @@ namespace Isis { BigInt size = samples * lines * bands; if (size >= maxSize) { - IString gigaBytes = size / (1024.0 * 1024.0 * 1024.0); - IString msg = "Cube exceeds max size of 2GB. Qimage cannot support "; + QString gigaBytes = toString(size / (1024.0 * 1024.0 * 1024.0)); + QString msg = "Cube exceeds max size of 2GB. Qimage cannot support "; msg += "that much raw data. Your cube is " + gigaBytes + " GB."; throw IException(IException::User, msg, _FILEINFO_); } @@ -217,12 +218,12 @@ namespace Isis { * * @return True if supported in Qt, false otherwise */ - bool QtExporter::canWriteFormat(IString format) { + bool QtExporter::canWriteFormat(QString format) { bool supported = false; QList list = QImageWriter::supportedImageFormats(); QList::Iterator it = list.begin(); while (it != list.end() && !supported) { - if (*it == QString(format.c_str())) supported = true; + if (*it == QString(format)) supported = true; it++; } return supported; diff --git a/isis/src/base/objs/QtExporter/QtExporter.h b/isis/src/base/objs/QtExporter/QtExporter.h index 7a3aa992b6..f9ddf836d6 100644 --- a/isis/src/base/objs/QtExporter/QtExporter.h +++ b/isis/src/base/objs/QtExporter/QtExporter.h @@ -26,6 +26,8 @@ #include "ImageExporter.h" +#include "Constants.h" + class QImage; namespace Isis { @@ -55,7 +57,7 @@ namespace Isis { */ class QtExporter : public ImageExporter { public: - QtExporter(IString format); + QtExporter(QString format); virtual ~QtExporter(); virtual void setGrayscale(ExportDescription &desc); @@ -64,7 +66,7 @@ namespace Isis { virtual void write(FileName outputName, int quality=100); - static bool canWriteFormat(IString format); + static bool canWriteFormat(QString format); protected: virtual void writeGrayscale(vector &in) const; @@ -78,7 +80,7 @@ namespace Isis { QImage *m_qimage; //! The lowercase abbreviated format of the output image. - IString m_format; + QString m_format; }; }; diff --git a/isis/src/base/objs/QtImporter/unitTest.cpp b/isis/src/base/objs/QtImporter/unitTest.cpp index 8682629918..15df0880b7 100644 --- a/isis/src/base/objs/QtImporter/unitTest.cpp +++ b/isis/src/base/objs/QtImporter/unitTest.cpp @@ -26,7 +26,7 @@ int main(int argc, char *argv[]) { cout << "Clean-up" << endl; delete importer; - remove(outputName.expanded().c_str()); + remove(outputName.expanded().toAscii().data()); cout << endl << "Done" << endl; } diff --git a/isis/src/base/objs/RadarCamera/unitTest.cpp b/isis/src/base/objs/RadarCamera/unitTest.cpp index b207ef7247..bd845a173b 100644 --- a/isis/src/base/objs/RadarCamera/unitTest.cpp +++ b/isis/src/base/objs/RadarCamera/unitTest.cpp @@ -47,7 +47,7 @@ class MyCamera : public RadarCamera { int main() { Preference::Preferences(true); - string inputFile = "$mgs/testData/ab102401.lev2.cub"; + QString inputFile = "$mgs/testData/ab102401.lev2.cub"; Pvl pvl(inputFile); MyCamera cam(pvl); diff --git a/isis/src/base/objs/RadarSlantRangeMap/RadarSlantRangeMap.cpp b/isis/src/base/objs/RadarSlantRangeMap/RadarSlantRangeMap.cpp index f526bcb9b0..37a7345f21 100644 --- a/isis/src/base/objs/RadarSlantRangeMap/RadarSlantRangeMap.cpp +++ b/isis/src/base/objs/RadarSlantRangeMap/RadarSlantRangeMap.cpp @@ -201,14 +201,14 @@ namespace Isis { seq = keyword; for(int i = 0; i < seq.Size(); i++) { // TODO: Test array size to be 4 if not throw error - std::vector array = seq[i]; + std::vector array = seq[i]; double et; - utc2et_c(array[0].c_str(), &et); + utc2et_c(array[0].toAscii().data(), &et); p_time.push_back(et); - p_a0.push_back(array[1].ToDouble()); - p_a1.push_back(array[2].ToDouble()); - p_a2.push_back(array[3].ToDouble()); - p_a3.push_back(array[4].ToDouble()); + p_a0.push_back(toDouble(array[1])); + p_a1.push_back(toDouble(array[2])); + p_a2.push_back(toDouble(array[3])); + p_a3.push_back(toDouble(array[4])); // TODO: Test that times are ordered if not throw error // Make the mrf2isis program sort them if necessary } diff --git a/isis/src/base/objs/Ransac/Ransac.h b/isis/src/base/objs/Ransac/Ransac.h index bd05a42e35..caf69d52fd 100644 --- a/isis/src/base/objs/Ransac/Ransac.h +++ b/isis/src/base/objs/Ransac/Ransac.h @@ -1,4 +1,4 @@ -#if !defined(Ransac_h) +#ifndef Ransac_h #define Ransac_h #include diff --git a/isis/src/base/objs/Reduce/Reduce.cpp b/isis/src/base/objs/Reduce/Reduce.cpp index 684a158e88..006f68902f 100644 --- a/isis/src/base/objs/Reduce/Reduce.cpp +++ b/isis/src/base/objs/Reduce/Reduce.cpp @@ -97,16 +97,16 @@ namespace Isis { // Information will be added to it if the Mapping or Instrument // groups are deleted from the output image label PvlGroup resultsGrp("Results"); - resultsGrp += PvlKeyword("InputLines", miInputLines); - resultsGrp += PvlKeyword("InputSamples", miInputSamples); - resultsGrp += PvlKeyword("StartingLine", miStartLine); - resultsGrp += PvlKeyword("StartingSample", miStartSample); - resultsGrp += PvlKeyword("EndingLine", miEndLine); - resultsGrp += PvlKeyword("EndingSample", miEndSample); - resultsGrp += PvlKeyword("LineIncrement", mdLineScale); - resultsGrp += PvlKeyword("SampleIncrement", mdSampleScale); - resultsGrp += PvlKeyword("OutputLines", miOutputSamples); - resultsGrp += PvlKeyword("OutputSamples", miOutputLines); + resultsGrp += PvlKeyword("InputLines", toString(miInputLines)); + resultsGrp += PvlKeyword("InputSamples", toString(miInputSamples)); + resultsGrp += PvlKeyword("StartingLine", toString(miStartLine)); + resultsGrp += PvlKeyword("StartingSample", toString(miStartSample)); + resultsGrp += PvlKeyword("EndingLine", toString(miEndLine)); + resultsGrp += PvlKeyword("EndingSample", toString(miEndSample)); + resultsGrp += PvlKeyword("LineIncrement", toString(mdLineScale)); + resultsGrp += PvlKeyword("SampleIncrement", toString(mdSampleScale)); + resultsGrp += PvlKeyword("OutputLines", toString(miOutputSamples)); + resultsGrp += PvlKeyword("OutputSamples", toString(miOutputLines)); Isis::SubArea subArea; subArea.SetSubArea(mInCube->getLineCount(), mInCube->getSampleCount(), miStartLine, miStartSample, diff --git a/isis/src/base/objs/Reduce/Reduce.h b/isis/src/base/objs/Reduce/Reduce.h index 2e02b9eb7f..7723003f69 100644 --- a/isis/src/base/objs/Reduce/Reduce.h +++ b/isis/src/base/objs/Reduce/Reduce.h @@ -8,8 +8,6 @@ #include -using namespace std; - namespace Isis { /** * @brief Reduce the pixel dimensions of an image @@ -99,7 +97,7 @@ namespace Isis { public: //! Constructor Average(Isis::Cube *pInCube, double pdSampleScale, double pdLineScale, - double pdValidPer, string psReplaceMode) + double pdValidPer, QString psReplaceMode) : Reduce(pInCube, pdSampleScale, pdLineScale){ mdValidPer = pdValidPer; msReplaceMode = psReplaceMode; @@ -110,7 +108,7 @@ namespace Isis { private: mutable double mdValidPer; //!< Valid Percentage - string msReplaceMode;//!< Replace Mode (scale/total) + QString msReplaceMode;//!< Replace Mode (scale/total) mutable double *mdIncTab; mutable double *mdSum; mutable double *mdNpts; diff --git a/isis/src/base/objs/Reduce/unitTest.cpp b/isis/src/base/objs/Reduce/unitTest.cpp index 53062efc91..9c0bbb9405 100644 --- a/isis/src/base/objs/Reduce/unitTest.cpp +++ b/isis/src/base/objs/Reduce/unitTest.cpp @@ -21,7 +21,7 @@ void IsisMain() { Preference::Preferences(true); ProcessByLine p; UserInterface &ui = Application::GetUserInterface(); - vector bands; + vector bands; p.SetInputCube("FROM"); Cube icube; @@ -59,6 +59,6 @@ void IsisMain() { p.Finalize(); icube.close(); - QFile::remove(ui.GetFileName("TO").c_str()); - QFile::remove(ui.GetFileName("TO2").c_str()); + QFile::remove(ui.GetFileName("TO")); + QFile::remove(ui.GetFileName("TO2")); } diff --git a/isis/src/base/objs/ReseauDistortionMap/ReseauDistortionMap.cpp b/isis/src/base/objs/ReseauDistortionMap/ReseauDistortionMap.cpp index 800f60f52c..668e6e8ac5 100644 --- a/isis/src/base/objs/ReseauDistortionMap/ReseauDistortionMap.cpp +++ b/isis/src/base/objs/ReseauDistortionMap/ReseauDistortionMap.cpp @@ -41,7 +41,7 @@ namespace Isis { * @throws Isis::IException::User - There are not the same amount of master and * refined reseaus */ - ReseauDistortionMap::ReseauDistortionMap(Camera *parent, Pvl &labels, const std::string &fname) : + ReseauDistortionMap::ReseauDistortionMap(Camera *parent, Pvl &labels, const QString &fname) : CameraDistortionMap(parent, 1.0) { // Set up distortion coefficients Pvl mast(fname); @@ -60,8 +60,8 @@ namespace Isis { throw IException(IException::User, msg, _FILEINFO_); } for(int i = 0; i < p_numRes; i++) { - p_mlines.push_back(mline[i]); - p_msamps.push_back(msamp[i]); + p_mlines.push_back(toDouble(mline[i])); + p_msamps.push_back(toDouble(msamp[i])); } p_pixelPitch = parent->PixelPitch(); @@ -74,8 +74,8 @@ namespace Isis { throw IException(IException::User, msg, _FILEINFO_); } for(int i = 0; i < p_numRes; i++) { - p_rlines.push_back(rline[i]); - p_rsamps.push_back(rsamp[i]); + p_rlines.push_back(toDouble(rline[i])); + p_rsamps.push_back(toDouble(rsamp[i])); } if(p_mlines.size() != p_rlines.size()) { string msg = "The number of master reseaus and refined reseaus"; diff --git a/isis/src/base/objs/ReseauDistortionMap/ReseauDistortionMap.h b/isis/src/base/objs/ReseauDistortionMap/ReseauDistortionMap.h index fda308b74c..c58b0598ab 100644 --- a/isis/src/base/objs/ReseauDistortionMap/ReseauDistortionMap.h +++ b/isis/src/base/objs/ReseauDistortionMap/ReseauDistortionMap.h @@ -42,7 +42,7 @@ namespace Isis { */ class ReseauDistortionMap : public CameraDistortionMap { public: - ReseauDistortionMap(Camera *parent, Pvl &labels, const std::string &fname); + ReseauDistortionMap(Camera *parent, Pvl &labels, const QString &fname); virtual bool SetFocalPlane(const double dx, const double dy); diff --git a/isis/src/base/objs/SampleManager/unitTest.cpp b/isis/src/base/objs/SampleManager/unitTest.cpp index d1e187d7b9..7d71407fac 100644 --- a/isis/src/base/objs/SampleManager/unitTest.cpp +++ b/isis/src/base/objs/SampleManager/unitTest.cpp @@ -2,17 +2,20 @@ #include #include -#include "Preference.h" -#include "IException.h" #include "Cube.h" +#include "IException.h" +#include "IString.h" +#include "Preference.h" #include "SampleManager.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); - string fname = "$base/testData/isisTruth.cub"; + QString fname = "$base/testData/isisTruth.cub"; Isis::Cube cube; cube.open(fname); diff --git a/isis/src/base/objs/Sensor/unitTest.cpp b/isis/src/base/objs/Sensor/unitTest.cpp index e482819111..55e7476815 100644 --- a/isis/src/base/objs/Sensor/unitTest.cpp +++ b/isis/src/base/objs/Sensor/unitTest.cpp @@ -58,9 +58,9 @@ int main(int argc, char *argv[]) { Isis::PvlGroup kern("Kernels"); Isis::FileName f("$base/testData/kernels"); - string dir = f.expanded() + "/"; + QString dir = f.expanded() + "/"; - kern += Isis::PvlKeyword("NaifFrameCode", -94031); + kern += Isis::PvlKeyword("NaifFrameCode", "-94031"); kern += Isis::PvlKeyword("LeapSecond", dir + "naif0007.tls"); kern += Isis::PvlKeyword("SpacecraftClock", dir + "MGS_SCLKSCET.00045.tsc"); kern += Isis::PvlKeyword("TargetPosition", dir + "de405.bsp"); @@ -197,7 +197,7 @@ int main(int argc, char *argv[]) { Isis::PvlGroup kern2("Kernels"); - kern2 += Isis::PvlKeyword("NaifFrameCode", -94031); + kern2 += Isis::PvlKeyword("NaifFrameCode", "-94031"); kern2 += Isis::PvlKeyword("LeapSecond", dir + "naif0007.tls"); kern2 += Isis::PvlKeyword("SpacecraftClock", dir + "MGS_SCLKSCET.00045.tsc"); diff --git a/isis/src/base/objs/SerialNumber/SerialNumber.cpp b/isis/src/base/objs/SerialNumber/SerialNumber.cpp index 9c42971bda..3e125b2d8b 100644 --- a/isis/src/base/objs/SerialNumber/SerialNumber.cpp +++ b/isis/src/base/objs/SerialNumber/SerialNumber.cpp @@ -29,9 +29,9 @@ namespace Isis { * * @return Calculated SerialNumber or FileName */ - std::string SerialNumber::Compose(Pvl &label, bool def2filename) { + QString SerialNumber::Compose(Pvl &label, bool def2filename) { - std::string sn; + QString sn; try { PvlGroup snGroup = FindSerialTranslation(label); sn = CreateSerialNumber(snGroup, (int)snGroup["ObservationKeys"]); @@ -40,8 +40,8 @@ namespace Isis { if(def2filename) { // Try to return the filename if it exists in the label, otherwise use // "Unknown" as a last resort. - std::string snTemp = label.FileName(); - if(!snTemp.empty()) { + QString snTemp = label.FileName(); + if(!snTemp.isEmpty()) { sn = FileName(snTemp).name(); } else { @@ -64,7 +64,7 @@ namespace Isis { * * @return Calculated SerialNumber or FileName */ - std::string SerialNumber::Compose(Cube &cube, bool def2filename) { + QString SerialNumber::Compose(Cube &cube, bool def2filename) { return Compose(*cube.getLabel(), def2filename); } @@ -77,7 +77,7 @@ namespace Isis { * * @return Calculated SerialNumber or FileName */ - std::string SerialNumber::Compose(const std::string &filename, bool def2filename) { + QString SerialNumber::Compose(const QString &filename, bool def2filename) { Pvl p(filename); return Compose(p, def2filename); } @@ -93,16 +93,16 @@ namespace Isis { static PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); // Get the mission name - static std::string missionTransFile = (std::string) dataDir["base"] + "/translations/MissionName2DataDir.trn"; + static QString missionTransFile = (QString) dataDir["base"] + "/translations/MissionName2DataDir.trn"; static PvlTranslationManager missionXlater(missionTransFile); missionXlater.SetLabel(label); - std::string mission = missionXlater.Translate("MissionName"); + QString mission = missionXlater.Translate("MissionName"); // Get the instrument name - static std::string instTransFile = (std::string) dataDir["base"] + "/translations/Instruments.trn"; + static QString instTransFile = (QString) dataDir["base"] + "/translations/Instruments.trn"; static PvlTranslationManager instrumentXlater(instTransFile); instrumentXlater.SetLabel(label); - std::string instrument = instrumentXlater.Translate("InstrumentName"); + QString instrument = instrumentXlater.Translate("InstrumentName"); // We want to use this instrument's translation manager. It's much faster for // SerialNumberList if we keep the translation manager in memory, so re-reading @@ -111,24 +111,24 @@ namespace Isis { // needs to have the mission name and the instrument name. // Create the static map to keep the translation managers in memory - static std::map missionTranslators; + static std::map missionTranslators; // Determine the key for this translation manager - must have both mission and instrument - std::string key = mission + "_" + instrument; + QString key = mission + "_" + instrument; // Try to find an existing translation manager with the key - std::map::iterator translationIterator = missionTranslators.find(key); + std::map::iterator translationIterator = missionTranslators.find(key); // If we don't succeed, create one if(translationIterator == missionTranslators.end()) { // Get the file - FileName snFile((std::string) dataDir[mission] + "/translations/" + + FileName snFile((QString) dataDir[mission] + "/translations/" + instrument + "SerialNumber????.trn"); snFile = snFile.highestVersion(); // use the translation file to generate keywords missionTranslators.insert( - std::pair(key, PvlTranslationManager(snFile.expanded())) + std::pair(key, PvlTranslationManager(snFile.expanded())) ); translationIterator = missionTranslators.find(key); @@ -138,7 +138,7 @@ namespace Isis { translationIterator->second.Auto(outLabel); PvlGroup snGroup = outLabel.FindGroup("SerialNumberKeywords"); - snGroup += PvlKeyword("ObservationKeys", snGroup.Keywords()); + snGroup += PvlKeyword("ObservationKeys", toString(snGroup.Keywords())); return snGroup; } @@ -150,10 +150,10 @@ namespace Isis { * @param snGroup A PvlGroup containing the keywords to concatenate * @param keys the number of strings to contatenate */ - std::string SerialNumber::CreateSerialNumber(PvlGroup &snGroup, int keys) { - std::string sn = snGroup["Keyword1"][0]; + QString SerialNumber::CreateSerialNumber(PvlGroup &snGroup, int keys) { + QString sn = snGroup["Keyword1"][0]; for(int i = 2; i <= keys; i++) { - IString keyword = "Keyword" + (IString)i; + QString keyword = QString("Keyword%1").arg(i); sn += "/" + snGroup[keyword][0]; } return sn; @@ -171,8 +171,8 @@ namespace Isis { * * @return Calculated SerialNumber or FileName */ - std::string SerialNumber::ComposeObservation(const std::string &sn, SerialNumberList &list, bool def2filename) { - std::string filename = list.FileName(sn); + QString SerialNumber::ComposeObservation(const QString &sn, SerialNumberList &list, bool def2filename) { + QString filename = list.FileName(sn); return ObservationNumber::Compose(filename, def2filename); } } diff --git a/isis/src/base/objs/SerialNumber/SerialNumber.h b/isis/src/base/objs/SerialNumber/SerialNumber.h index 61e137395b..503a91981e 100644 --- a/isis/src/base/objs/SerialNumber/SerialNumber.h +++ b/isis/src/base/objs/SerialNumber/SerialNumber.h @@ -88,17 +88,17 @@ namespace Isis { virtual ~SerialNumber(); - static std::string Compose(Pvl &label, bool def2filename = false); + static QString Compose(Pvl &label, bool def2filename = false); - static std::string Compose(Cube &cube, bool def2filename = false); + static QString Compose(Cube &cube, bool def2filename = false); - static std::string Compose(const std::string &filename, bool def2filename = false); + static QString Compose(const QString &filename, bool def2filename = false); - static std::string ComposeObservation(const std::string &sn, SerialNumberList &list, bool def2filename = false); + static QString ComposeObservation(const QString &sn, SerialNumberList &list, bool def2filename = false); protected: - static std::string CreateSerialNumber(PvlGroup &snGroup, int key); + static QString CreateSerialNumber(PvlGroup &snGroup, int key); private: diff --git a/isis/src/base/objs/SerialNumber/unitTest.cpp b/isis/src/base/objs/SerialNumber/unitTest.cpp index 40e028edd0..c57f4863b6 100644 --- a/isis/src/base/objs/SerialNumber/unitTest.cpp +++ b/isis/src/base/objs/SerialNumber/unitTest.cpp @@ -6,37 +6,39 @@ #include "Cube.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::PvlGroup g("Instrument"); - g += Isis::PvlKeyword("SpacecraftName", "MySpacecraft"); - g += Isis::PvlKeyword("InstrumentId", "MyInstrumentId"); - g += Isis::PvlKeyword("SpacecraftClockCount", "987654321"); + PvlGroup g("Instrument"); + g += PvlKeyword("SpacecraftName", "MySpacecraft"); + g += PvlKeyword("InstrumentId", "MyInstrumentId"); + g += PvlKeyword("SpacecraftClockCount", "987654321"); - Isis::PvlObject o("IsisCube"); + PvlObject o("IsisCube"); o.AddGroup(g); - Isis::Pvl p; + Pvl p; p.AddObject(o); - std::cout << Isis::SerialNumber::Compose(p) << std::endl; + cout << SerialNumber::Compose(p) << endl; - p.FindGroup("Instrument", Isis::Pvl::Traverse).DeleteKeyword("InstrumentId"); - std::cout << Isis::SerialNumber::Compose(p) << std::endl; + p.FindGroup("Instrument", Pvl::Traverse).DeleteKeyword("InstrumentId"); + cout << SerialNumber::Compose(p) << endl; - Isis::Cube cube; + Cube cube; cube.open("$base/testData/isisTruth.cub"); - std::cout << Isis::SerialNumber::Compose(cube, true) << std::endl; + cout << SerialNumber::Compose(cube, true) << endl; - Isis::FileName file("$lo/testData/3133_h1.cub"); - Isis::Pvl p1(file.expanded()); + FileName file("$lo/testData/3133_h1.cub"); + Pvl p1(file.expanded()); - std::cout << Isis::SerialNumber::Compose(p1) << std::endl; + cout << SerialNumber::Compose(p1) << endl; - std::cout << std::endl << "Testing ObservationKeys" << std::endl; + cout << endl << "Testing ObservationKeys" << endl; - std::cout << Isis::ObservationNumber::Compose(p1) << std::endl; + cout << ObservationNumber::Compose(p1) << endl; return (0); } diff --git a/isis/src/base/objs/SerialNumberList/SerialNumberList.cpp b/isis/src/base/objs/SerialNumberList/SerialNumberList.cpp index 45d0faef62..965b80b6e1 100644 --- a/isis/src/base/objs/SerialNumberList/SerialNumberList.cpp +++ b/isis/src/base/objs/SerialNumberList/SerialNumberList.cpp @@ -32,7 +32,7 @@ namespace Isis { * @history 2009-11-05 Jeannie Walldren - Modified number * of maximum steps for Progress flag */ - SerialNumberList::SerialNumberList(const std::string &listfile, bool checkTarget, Progress *progress) { + SerialNumberList::SerialNumberList(const QString &listfile, bool checkTarget, Progress *progress) { p_checkTarget = checkTarget; p_target.clear(); try { @@ -50,7 +50,7 @@ namespace Isis { } } catch(IException &e) { - std::string msg = "Can't open or invalid file list [" + listfile + "]"; + QString msg = "Can't open or invalid file list [" + listfile + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } } @@ -69,10 +69,10 @@ namespace Isis { * * @param sn - serial number */ - void SerialNumberList::Delete(const std::string &sn) + void SerialNumberList::Delete(const QString &sn) { int index = SerialNumberIndex(sn); - std::string sFileName = FileName(sn); + QString sFileName = FileName(sn); // Delete the reference to this serial number in the // vector and the maps @@ -101,14 +101,14 @@ namespace Isis { * if p_checkTarget is True. If def2filename is True, * check for Mapping group if Target does not exist. */ - void SerialNumberList::Add(const std::string &filename, bool def2filename) { + void SerialNumberList::Add(const QString &filename, bool def2filename) { Pvl p(Isis::FileName(filename).expanded()); PvlObject cubeObj = p.FindObject("IsisCube"); try { // Test the target name if desired if (p_checkTarget) { - IString target; + QString target; PvlGroup targetGroup; if (cubeObj.HasGroup("Instrument")) { targetGroup = cubeObj.FindGroup("Instrument"); @@ -119,41 +119,41 @@ namespace Isis { targetGroup = cubeObj.FindGroup("Mapping"); } else { - std::string msg = "Unable to find Instrument or Mapping group in "; + QString msg = "Unable to find Instrument or Mapping group in "; msg += filename + " for comparing target"; throw IException(IException::User, msg, _FILEINFO_); } } else { // No Instrument group - std::string msg = "Unable to find Instrument group in " + filename; + QString msg = "Unable to find Instrument group in " + filename; msg += " for comparing target"; throw IException(IException::User, msg, _FILEINFO_); } target = targetGroup["TargetName"][0]; - target.UpCase(); - if (p_target.empty()) { + target = target.toUpper(); + if (p_target.isEmpty()) { p_target = target; } else if (p_target != target) { - std::string msg = "Target name of [" + target + "] from file ["; + QString msg = "Target name of [" + target + "] from file ["; msg += filename + "] does not match [" + p_target + "]"; throw IException(IException::User, msg, _FILEINFO_); } } // Create the SN - std::string sn = SerialNumber::Compose(p, def2filename); - std::string on = ObservationNumber::Compose(p, def2filename); + QString sn = SerialNumber::Compose(p, def2filename); + QString on = ObservationNumber::Compose(p, def2filename); if(sn == "Unknown") { - std::string msg = "Invalid serial number [Unknown] from file ["; + QString msg = "Invalid serial number [Unknown] from file ["; msg += filename + "]"; throw IException(IException::User, msg, _FILEINFO_); } else if(HasSerialNumber(sn)) { int index = SerialNumberIndex(sn); - std::string msg = "Duplicate, serial number [" + sn + "] from files ["; + QString msg = "Duplicate, serial number [" + sn + "] from files ["; msg += SerialNumberList::FileName(sn) + "] and [" + FileName(index) + "]."; throw IException(IException::User, msg, _FILEINFO_); } @@ -162,11 +162,11 @@ namespace Isis { nextpair.serialNumber = sn; nextpair.observationNumber = on; p_pairs.push_back(nextpair); - p_serialMap.insert(std::pair(sn, (int)(p_pairs.size() - 1))); - p_fileMap.insert(std::pair(nextpair.filename, (int)(p_pairs.size() - 1))); + p_serialMap.insert(std::pair(sn, (int)(p_pairs.size() - 1))); + p_fileMap.insert(std::pair(nextpair.filename, (int)(p_pairs.size() - 1))); } catch(IException &e) { - std::string msg = "File [" + Isis::FileName(filename).expanded() + + QString msg = "File [" + Isis::FileName(filename).expanded() + "] can not be added to "; msg += "serial number list"; throw IException(e, IException::User, msg, _FILEINFO_); @@ -176,7 +176,7 @@ namespace Isis { void SerialNumberList::Add(const char *serialNumber, const char *filename) { - Add((std::string)serialNumber, (std::string)filename); + Add((QString)serialNumber, (QString)filename); } @@ -190,14 +190,14 @@ namespace Isis { * * @internal */ - void SerialNumberList::Add(const std::string &serialNumber, const std::string &filename) { + void SerialNumberList::Add(const QString &serialNumber, const QString &filename) { Pvl p(Isis::FileName(filename).expanded()); PvlObject cubeObj = p.FindObject("IsisCube"); try { // Test the target name if desired if (p_checkTarget) { - IString target; + QString target; PvlGroup targetGroup; if (cubeObj.HasGroup("Instrument")) { targetGroup = cubeObj.FindGroup("Instrument"); @@ -208,33 +208,33 @@ namespace Isis { targetGroup = cubeObj.FindGroup("Mapping"); } else { - std::string msg = "Unable to find Instrument or Mapping group in "; + QString msg = "Unable to find Instrument or Mapping group in "; msg += filename + " for comparing target"; throw IException(IException::User, msg, _FILEINFO_); } } target = targetGroup["TargetName"][0]; - target.UpCase(); - if (p_target.empty()) { + target = target.toUpper(); + if (p_target.isEmpty()) { p_target = target; } else if (p_target != target) { - std::string msg = "Target name of [" + target + "] from file ["; + QString msg = "Target name of [" + target + "] from file ["; msg += filename + "] does not match [" + p_target + "]"; throw IException(IException::User, msg, _FILEINFO_); } } - std::string observationNumber = "Unknown"; + QString observationNumber = "Unknown"; if (serialNumber == "Unknown") { - std::string msg = "Invalid serial number [Unknown] from file ["; + QString msg = "Invalid serial number [Unknown] from file ["; msg += filename + "]"; throw IException(IException::User, msg, _FILEINFO_); } else if (HasSerialNumber(serialNumber)) { int index = SerialNumberIndex(serialNumber); - std::string msg = "Duplicate, serial number [" + serialNumber + "] from files ["; + QString msg = "Duplicate, serial number [" + serialNumber + "] from files ["; msg += SerialNumberList::FileName(serialNumber) + "] and [" + FileName(index) + "]."; throw IException(IException::User, msg, _FILEINFO_); } @@ -243,11 +243,11 @@ namespace Isis { nextpair.serialNumber = serialNumber; nextpair.observationNumber = observationNumber; p_pairs.push_back(nextpair); - p_serialMap.insert(std::pair(serialNumber, (int)(p_pairs.size() - 1))); - p_fileMap.insert(std::pair(nextpair.filename, (int)(p_pairs.size() - 1))); + p_serialMap.insert(std::pair(serialNumber, (int)(p_pairs.size() - 1))); + p_fileMap.insert(std::pair(nextpair.filename, (int)(p_pairs.size() - 1))); } catch(IException &e) { - std::string msg = "File [" + Isis::FileName(filename).expanded() + + QString msg = "File [" + Isis::FileName(filename).expanded() + "] can not be added to "; msg += "serial number list"; throw IException(e, IException::User, msg, _FILEINFO_); @@ -263,25 +263,12 @@ namespace Isis { * * @return bool */ - bool SerialNumberList::HasSerialNumber(const std::string &sn) { + bool SerialNumberList::HasSerialNumber(QString sn) { if(p_serialMap.find(sn) == p_serialMap.end()) return false; return true; } - /** - * Determines whether or not the requested serial number exists - * in the list - * - * @param sn The serial number to be checked for - * - * @return bool - */ - bool SerialNumberList::HasSerialNumber(QString sn) { - return HasSerialNumber(sn.toStdString()); - } - - /** * How many serial number / filename combos are in the list * @@ -297,16 +284,16 @@ namespace Isis { * * @param sn The serial number of the desired filename * - * @return std::string The filename matching the input serial + * @return QString The filename matching the input serial * number */ - std::string SerialNumberList::FileName(const std::string &sn) { + QString SerialNumberList::FileName(const QString &sn) { if(HasSerialNumber(sn)) { int index = p_serialMap.find(sn)->second; return p_pairs[index].filename; } else { - std::string msg = "Requested serial number [" + sn + "] "; + QString msg = "Requested serial number [" + sn + "] "; msg += "does not exist in the list"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -317,16 +304,16 @@ namespace Isis { * * @param filename The filename to be matched * - * @return std::string The serial number corresponding to the + * @return QString The serial number corresponding to the * input filename * * @internal * @history 2007-06-04 Tracie Sucharski - Expand filename to include full * path before searching list. */ - std::string SerialNumberList::SerialNumber(const std::string &filename) { + QString SerialNumberList::SerialNumber(const QString &filename) { if(p_fileMap.find(Isis::FileName(filename).expanded()) == p_fileMap.end()) { - std::string msg = "Requested filename [" + + QString msg = "Requested filename [" + Isis::FileName(filename).expanded() + "]"; msg += "does not exist in the list"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -340,15 +327,15 @@ namespace Isis { * * @param index The index of the desired serial number * - * @return std::string The serial number returned + * @return QString The serial number returned */ - std::string SerialNumberList::SerialNumber(int index) { + QString SerialNumberList::SerialNumber(int index) { if(index >= 0 && index < (int) p_pairs.size()) { return p_pairs[index].serialNumber; } else { - IString num = IString(index); - std::string msg = "Index [" + (std::string) num + "] is invalid"; + QString num = QString(index); + QString msg = "Index [" + (QString) num + "] is invalid"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -358,15 +345,15 @@ namespace Isis { * * @param index The index of the desired observation number * - * @return std::string The observation number returned + * @return QString The observation number returned */ - std::string SerialNumberList::ObservationNumber(int index) { + QString SerialNumberList::ObservationNumber(int index) { if(index >= 0 && index < (int) p_pairs.size()) { return p_pairs[index].observationNumber; } else { - IString num = IString(index); - std::string msg = "Index [" + (std::string) num + "] is invalid"; + QString num = QString(index); + QString msg = "Index [" + (QString) num + "] is invalid"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -378,12 +365,12 @@ namespace Isis { * * @return int The index of the serial number */ - int SerialNumberList::SerialNumberIndex(const std::string &sn) { + int SerialNumberList::SerialNumberIndex(const QString &sn) { if(HasSerialNumber(sn)) { return p_serialMap.find(sn)->second; } else { - std::string msg = "Requested serial number [" + sn + "] "; + QString msg = "Requested serial number [" + sn + "] "; msg += "does not exist in the list"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -401,11 +388,11 @@ namespace Isis { * @internal @history 2007-07-11 Stuart Sides - Fixed bug where * the correct index was not returned. */ - int SerialNumberList::FileNameIndex(const std::string &filename) { + int SerialNumberList::FileNameIndex(const QString &filename) { - std::map::iterator pos; + std::map::iterator pos; if((pos = p_fileMap.find(Isis::FileName(filename).expanded())) == p_fileMap.end()) { - std::string msg = "Requested filename [" + + QString msg = "Requested filename [" + Isis::FileName(filename).expanded() + "]"; msg += "does not exist in the list"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -418,15 +405,15 @@ namespace Isis { * * @param index The index of the desired filename * - * @return std::string The filename at the given index + * @return QString The filename at the given index */ - std::string SerialNumberList::FileName(int index) { + QString SerialNumberList::FileName(int index) { if(index >= 0 && index < (int) p_pairs.size()) { return p_pairs[index].filename; } else { - IString num = IString(index); - std::string msg = "Index [" + (std::string) num + "] is invalid"; + QString num = toString(index); + QString msg = "Index [" + num + "] is invalid"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -438,11 +425,11 @@ namespace Isis { * @param on The observation number of the possible serial * number * - * @return vector The list of possible serial + * @return vector The list of possible serial * numbers matching the input observation number */ - std::vector SerialNumberList::PossibleSerialNumbers(const std::string &on) { - std::vector numbers; + std::vector SerialNumberList::PossibleSerialNumbers(const QString &on) { + std::vector numbers; for(unsigned index = 0; index < p_pairs.size(); index++) { if(p_pairs[index].observationNumber == on) { numbers.push_back(p_pairs[index].serialNumber); @@ -452,7 +439,7 @@ namespace Isis { return numbers; } else { - std::string msg = "Requested observation number [" + on + "] "; + QString msg = "Requested observation number [" + on + "] "; msg += "does not exist in the list"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/SerialNumberList/SerialNumberList.h b/isis/src/base/objs/SerialNumberList/SerialNumberList.h index 1a46132565..780cf3fa68 100644 --- a/isis/src/base/objs/SerialNumberList/SerialNumberList.h +++ b/isis/src/base/objs/SerialNumberList/SerialNumberList.h @@ -28,10 +28,8 @@ #include #include "Progress.h" - class QString; - namespace Isis { /** * @brief Serial Number list generator @@ -89,44 +87,43 @@ namespace Isis { class SerialNumberList { public: SerialNumberList(bool checkTarget = true); - SerialNumberList(const std::string &list, bool checkTarget = true, + SerialNumberList(const QString &list, bool checkTarget = true, Progress *progress = NULL); virtual ~SerialNumberList(); - void Add(const std::string &filename, bool def2filename = false); - void Add(const std::string &serialNumber, const std::string &filename); + void Add(const QString &filename, bool def2filename = false); + void Add(const QString &serialNumber, const QString &filename); void Add(const char *serialNumber, const char *filename); - bool HasSerialNumber(const std::string &sn); bool HasSerialNumber(QString sn); //!< Delete a serial number off of the list - void Delete(const std::string &sn); + void Delete(const QString &sn); int Size() const; - std::string FileName(const std::string &sn); - std::string FileName(int index); - std::string SerialNumber(const std::string &filename); - std::string SerialNumber(int index); - std::string ObservationNumber(int index); + QString FileName(const QString &sn); + QString FileName(int index); + QString SerialNumber(const QString &filename); + QString SerialNumber(int index); + QString ObservationNumber(int index); - int SerialNumberIndex(const std::string &sn); - int FileNameIndex(const std::string &filename); + int SerialNumberIndex(const QString &sn); + int FileNameIndex(const QString &filename); - std::vector PossibleSerialNumbers(const std::string &on); + std::vector PossibleSerialNumbers(const QString &on); protected: struct Pair { - std::string filename; - std::string serialNumber; - std::string observationNumber; + QString filename; + QString serialNumber; + QString observationNumber; }; std::vector p_pairs; - std::map p_serialMap; - std::map p_fileMap; + std::map p_serialMap; + std::map p_fileMap; bool p_checkTarget; - std::string p_target; + QString p_target; }; }; diff --git a/isis/src/base/objs/SerialNumberList/unitTest.cpp b/isis/src/base/objs/SerialNumberList/unitTest.cpp index e343e453cf..e13ba027d4 100644 --- a/isis/src/base/objs/SerialNumberList/unitTest.cpp +++ b/isis/src/base/objs/SerialNumberList/unitTest.cpp @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) { snl.Add("$lo/testData/3133_h1.cub"); } catch(Isis::IException &e) { - QString error = e.toString().ToQt().replace(QRegExp("(\\[[^\\]]*/)([^\\]]*)"), "[.../\\2"); + QString error = e.toString().replace(QRegExp("(\\[[^\\]]*/)([^\\]]*)"), "[.../\\2"); cerr << error.toStdString() << endl; } diff --git a/isis/src/base/objs/SessionLog/SessionLog.cpp b/isis/src/base/objs/SessionLog/SessionLog.cpp index 2f16a75c57..3eba6b491e 100644 --- a/isis/src/base/objs/SessionLog/SessionLog.cpp +++ b/isis/src/base/objs/SessionLog/SessionLog.cpp @@ -31,10 +31,10 @@ namespace Isis { SessionLog::SessionLog() { // Grab the user preferences for logging Isis::PvlGroup &slog = Isis::Preference::Preferences().FindGroup("SessionLog"); - p_termOutput = Isis::IString((string)slog["TerminalOutput"]).UpCase() == "ON"; - p_fileOutput = Isis::IString((string)slog["FileOutput"]).UpCase() == "ON"; - p_outputFile = (string) slog["FileName"]; - p_access = Isis::IString((string) slog["FileAccess"]).UpCase(); + p_termOutput = ((QString)slog["TerminalOutput"]).toUpper() == "ON"; + p_fileOutput = ((QString)slog["FileOutput"]).toUpper() == "ON"; + p_outputFile = (QString) slog["FileName"]; + p_access = ((QString) slog["FileAccess"]).toUpper(); // Add root this->AddObject(Isis::iApp->History()); diff --git a/isis/src/base/objs/SessionLog/SessionLog.h b/isis/src/base/objs/SessionLog/SessionLog.h index a84fc6b824..81aa2eaa28 100644 --- a/isis/src/base/objs/SessionLog/SessionLog.h +++ b/isis/src/base/objs/SessionLog/SessionLog.h @@ -1,4 +1,4 @@ -#if !defined(SessionLog_h) +#ifndef SessionLog_h #define SessionLog_h /** * @file @@ -67,8 +67,8 @@ namespace Isis { bool p_termOutput; bool p_fileOutput; - std::string p_outputFile; - std::string p_access; + QString p_outputFile; + QString p_access; static SessionLog *p_log; diff --git a/isis/src/base/objs/SessionLog/unitTest.cpp b/isis/src/base/objs/SessionLog/unitTest.cpp index 82cb1cc350..e62e3adac4 100644 --- a/isis/src/base/objs/SessionLog/unitTest.cpp +++ b/isis/src/base/objs/SessionLog/unitTest.cpp @@ -7,26 +7,27 @@ #include "IException.h" #include "Pvl.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); - Isis::PvlGroup &g = Isis::Preference::Preferences().FindGroup("SessionLog"); + Preference::Preferences(true); + PvlGroup &g = Preference::Preferences().FindGroup("SessionLog"); g["TerminalOutput"] = "On"; try { - Isis::PvlGroup results("Results");; + PvlGroup results("Results");; results.AddComment("// This is an example of the results group"); - results += Isis::PvlKeyword("Average", 13.5, "Meters"); + results += PvlKeyword("Average", toString(13.5), "Meters"); results[0].AddComment("// Average size of a rock"); - Isis::Pvl error; - Isis::PvlGroup temp("Error"); - temp += Isis::PvlKeyword("Program", "ratio"); - temp += Isis::PvlKeyword("Class", "I/O ERROR"); - temp += Isis::PvlKeyword("Status", -1); - temp += Isis::PvlKeyword("Message", "Unable to open file"); - temp += Isis::PvlKeyword("File", "unitTest.cpp"); - temp += Isis::PvlKeyword("Line", 501); + Pvl error; + PvlGroup temp("Error"); + temp += PvlKeyword("Program", "ratio"); + temp += PvlKeyword("Class", "I/O ERROR"); + temp += PvlKeyword("Status", toString(-1)); + temp += PvlKeyword("Message", "Unable to open file"); + temp += PvlKeyword("File", "unitTest.cpp"); + temp += PvlKeyword("Line", toString(501)); error.AddGroup(temp); char **s_argv; s_argv = new char*[10]; @@ -42,28 +43,28 @@ int main(int argc, char *argv[]) { int s_argc = 4; try { - Isis::Application app(s_argc, (char**)s_argv); - Isis::SessionLog &log = Isis::SessionLog::TheLog(true); + Application app(s_argc, (char**)s_argv); + SessionLog &log = SessionLog::TheLog(true); log.AddResults(results); std::cout << log << std::endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } try { - Isis::Application app(s_argc, (char**)s_argv); - Isis::SessionLog &log = Isis::SessionLog::TheLog(true); + Application app(s_argc, (char**)s_argv); + SessionLog &log = SessionLog::TheLog(true); log.AddResults(results); log.AddError(error); std::cout << log << std::endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } diff --git a/isis/src/base/objs/Shade/Shade.truth b/isis/src/base/objs/Shade/Shade.truth index fc316b20ba..3026818455 100644 --- a/isis/src/base/objs/Shade/Shade.truth +++ b/isis/src/base/objs/Shade/Shade.truth @@ -9,7 +9,7 @@ End_Object Object = NormalizationModel Group = Algorithm Name = Shade - Albedo = 0.0690507 + Albedo = .0690507 End_Group End_Object End diff --git a/isis/src/base/objs/Shade/unitTest.cpp b/isis/src/base/objs/Shade/unitTest.cpp index 06a569567c..efff920217 100644 --- a/isis/src/base/objs/Shade/unitTest.cpp +++ b/isis/src/base/objs/Shade/unitTest.cpp @@ -28,7 +28,7 @@ int main() { PvlGroup algn("Algorithm"); algn += PvlKeyword("Name", "Shade"); - algn += PvlKeyword("Albedo", .0690507); + algn += PvlKeyword("Albedo", ".0690507"); PvlObject on("NormalizationModel"); on.AddGroup(algn); diff --git a/isis/src/base/objs/ShadeAtm/unitTest.cpp b/isis/src/base/objs/ShadeAtm/unitTest.cpp index e2a70706b9..f54a6d0b3f 100644 --- a/isis/src/base/objs/ShadeAtm/unitTest.cpp +++ b/isis/src/base/objs/ShadeAtm/unitTest.cpp @@ -31,14 +31,14 @@ int main() { PvlGroup alga("Algorithm"); alga += PvlKeyword("Name", "Anisotropic1"); - alga += PvlKeyword("Bha", 0.85); + alga += PvlKeyword("Bha", "0.85"); PvlObject oa("AtmosphericModel"); oa.AddGroup(alga); PvlGroup algn("Algorithm"); algn += PvlKeyword("Name", "ShadeAtm"); - algn += PvlKeyword("Albedo", 0.0690507); + algn += PvlKeyword("Albedo", "0.0690507"); PvlObject on("NormalizationModel"); on.AddGroup(algn); diff --git a/isis/src/base/objs/ShapeModel/ShapeModel.cpp b/isis/src/base/objs/ShapeModel/ShapeModel.cpp index b87e4b54d6..727ccd3109 100644 --- a/isis/src/base/objs/ShapeModel/ShapeModel.cpp +++ b/isis/src/base/objs/ShapeModel/ShapeModel.cpp @@ -56,7 +56,7 @@ namespace Isis { * Initialize the ShapeModel private variables. */ void ShapeModel::Initialize() { - m_name = new IString(); + m_name = new QString(); m_surfacePoint = new SurfacePoint(); m_hasIntersection = false; m_hasNormal = false; @@ -320,7 +320,7 @@ namespace Isis { /** Set the shape name * */ - void ShapeModel::setName(const IString name) { + void ShapeModel::setName(QString name) { *m_name = name; } @@ -328,7 +328,7 @@ namespace Isis { /** Get the shape name * */ - IString ShapeModel::name() const{ + QString ShapeModel::name() const{ return *m_name; } diff --git a/isis/src/base/objs/ShapeModel/ShapeModel.h b/isis/src/base/objs/ShapeModel/ShapeModel.h index ee1fa628c3..35531f00f0 100644 --- a/isis/src/base/objs/ShapeModel/ShapeModel.h +++ b/isis/src/base/objs/ShapeModel/ShapeModel.h @@ -26,9 +26,10 @@ template class QVector; +class QString; + namespace Isis { class Distance; - class IString; class Latitude; class Longitude; class Pvl; @@ -107,7 +108,7 @@ namespace Isis { virtual Distance localRadius(const Latitude &lat, const Longitude &lon) = 0; // Get shape name - IString name() const; + QString name() const; // Set m_hasIntersection void setHasIntersection(bool b); @@ -124,7 +125,7 @@ namespace Isis { void setNormal(const std::vector); // Set shape name - void setName(const IString name); + void setName(QString name); void calculateEllipsoidalSurfaceNormal(); @@ -139,7 +140,7 @@ namespace Isis { bool m_hasIntersection; //!< indicates good intersection exists bool m_hasNormal; //!< indicates normal has been computed std::vector m_normal; //!< Local normal of current intersection point - IString *m_name; + QString *m_name; SurfacePoint *m_surfacePoint; //!< Current intersection point Target *m_target; diff --git a/isis/src/base/objs/ShapeModel/unitTest.cpp b/isis/src/base/objs/ShapeModel/unitTest.cpp index 28584c0ee1..ebc036086d 100644 --- a/isis/src/base/objs/ShapeModel/unitTest.cpp +++ b/isis/src/base/objs/ShapeModel/unitTest.cpp @@ -51,7 +51,7 @@ using namespace Isis; class MyShape : public ShapeModel { public: MyShape(Target *target, Pvl &lab) : ShapeModel (target, lab) { - setName(IString("Test")); + setName("Test"); } bool intersectSurface(std::vector observerPos, @@ -132,11 +132,11 @@ class MyShape : public ShapeModel { class MyEllipse : public ShapeModel { public: MyEllipse(Target *target) : ShapeModel (target) { - setName(IString("Ellipsoid")); + setName("Ellipsoid"); } MyEllipse() : ShapeModel() { - setName(IString("DefaultConstructor")); + setName("DefaultConstructor"); } bool intersectSurface(std::vector observerPos, @@ -197,7 +197,7 @@ class MyEllipse : public ShapeModel { int main() { Preference::Preferences(true); - string inputFile = "$mgs/testData/ab102401.cub"; + QString inputFile = "$mgs/testData/ab102401.cub"; Cube cube; cube.open(inputFile); Camera *c = cube.getCamera(); diff --git a/isis/src/base/objs/ShapeModelFactory/ShapeModelFactory.cpp b/isis/src/base/objs/ShapeModelFactory/ShapeModelFactory.cpp index f4111a263f..38cc994bbc 100644 --- a/isis/src/base/objs/ShapeModelFactory/ShapeModelFactory.cpp +++ b/isis/src/base/objs/ShapeModelFactory/ShapeModelFactory.cpp @@ -53,7 +53,7 @@ namespace Isis { // bool planeTarget = false; // shape model file name - IString shapeModelFilenames = ""; + QString shapeModelFilenames = ""; // TODO: We differentiate between "Elevation" and "Shape" models on the // labels, but we assign either one to the shapeModelFilename. Do we @@ -64,11 +64,11 @@ namespace Isis { } else if (kernelsPvlGroup.HasKeyword("ElevationModel") && !kernelsPvlGroup["ElevationModel"].IsNull()) {//&& - shapeModelFilenames = (string) kernelsPvlGroup["ElevationModel"]; + shapeModelFilenames = (QString) kernelsPvlGroup["ElevationModel"]; } else if (kernelsPvlGroup.HasKeyword("ShapeModel") && !kernelsPvlGroup["ShapeModel"].IsNull()) {//&& - shapeModelFilenames = (string) kernelsPvlGroup["ShapeModel"]; + shapeModelFilenames = (QString) kernelsPvlGroup["ShapeModel"]; } // Create shape model @@ -89,10 +89,10 @@ namespace Isis { Isis::Cube shapeModelCube; try { // first, try to open the shape model file as an Isis3 cube - shapeModelCube.open(shapeModelFilenames, "r" ); + shapeModelCube.open(FileName(shapeModelFilenames).expanded(), "r" ); } catch (IException &e) { - IString msg = "Shape file" + shapeModelFilenames + " does not exist or is not an Isis cube"; + IString msg = "Shape file " + shapeModelFilenames + " does not exist or is not an Isis cube"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } @@ -107,13 +107,13 @@ namespace Isis { shapeModel = new DemShape(target, pvl); } catch (IException &e) { - IString msg = "Shape model cube must be an Isis DEM file, meaning it must " \ + QString msg = "Shape model cube must be an Isis DEM file, meaning it must " \ "be map-projected. This cube is NOT map projected."; throw IException(IException::User, msg, _FILEINFO_); } } catch (IException &e) { - IString msg = "Failed opening shape file" + shapeModelFilenames; + IString msg = "Failed opening shape file " + shapeModelFilenames; throw IException(e, IException::Unknown, msg, _FILEINFO_); } } diff --git a/isis/src/base/objs/ShapeModelFactory/ShapeModelFactory.truth b/isis/src/base/objs/ShapeModelFactory/ShapeModelFactory.truth index c463661205..345df90af4 100644 --- a/isis/src/base/objs/ShapeModelFactory/ShapeModelFactory.truth +++ b/isis/src/base/objs/ShapeModelFactory/ShapeModelFactory.truth @@ -13,12 +13,12 @@ Unit test for Isis::ShapeModel Shape model is Ellipsoid Testing nonexistent file for shape model dem -**ERROR** Failed opening shape fileNotAFile. -**ERROR** Shape fileNotAFile does not exist or is not an Isis cube. +**ERROR** Failed opening shape file NotAFile. +**ERROR** Shape file NotAFile does not exist or is not an Isis cube. **I/O ERROR** Unable to open [NotAFile]. Testing Isis cube file for dem that is not map projected -**ERROR** Failed opening shape file/usgs/cpkgs/isis3/data/mgs/testData/ab102401.cub. +**ERROR** Failed opening shape file /usgs/cpkgs/isis3/data/mgs/testData/ab102401.cub. **USER ERROR** Shape model cube must be an Isis DEM file, meaning it must be map-projected. This cube is NOT map projected. Testing a dem that's not equatorial cylindrical diff --git a/isis/src/base/objs/ShapeModelFactory/unitTest.cpp b/isis/src/base/objs/ShapeModelFactory/unitTest.cpp index 45c7e06e53..c06f025770 100644 --- a/isis/src/base/objs/ShapeModelFactory/unitTest.cpp +++ b/isis/src/base/objs/ShapeModelFactory/unitTest.cpp @@ -35,10 +35,10 @@ int main() { FileName f("$base/testData/kernels"); FileName f2("$base/dems"); FileName f3("$mgs/testData"); - string dir = f.expanded() + "/"; - string dir2 = f2.expanded() + "/"; - string dir3 = f3.expanded() + "/"; - kern1 += PvlKeyword("NaifFrameCode", -94031); + QString dir = f.expanded() + "/"; + QString dir2 = f2.expanded() + "/"; + QString dir3 = f3.expanded() + "/"; + kern1 += PvlKeyword("NaifFrameCode", toString(-94031)); kern1 += PvlKeyword("LeapSecond", dir + "naif0007.tls"); kern1 += PvlKeyword("SpacecraftClock", dir + "MGS_SCLKSCET.00045.tsc"); kern1 += PvlKeyword("TargetPosition", dir + "de405.bsp"); @@ -48,14 +48,14 @@ int main() { kern1 += PvlKeyword("InstrumentPosition", dir + "moc.bsp"); kern1 += PvlKeyword("InstrumentPointing", dir + "moc.bc"); kern1 += PvlKeyword("Frame", ""); - kern1 += PvlKeyword("NaifBodyCode", 499); + kern1 += PvlKeyword("NaifBodyCode", toString(499)); // Time Setup double startTime = -69382819.0; double endTime = -69382512.0; double slope = (endTime - startTime) / (10 - 1); - kern1 += PvlKeyword("StartPadding", slope); - kern1 += PvlKeyword("EndPadding", slope); + kern1 += PvlKeyword("StartPadding", toString(slope)); + kern1 += PvlKeyword("EndPadding", toString(slope)); Pvl lab1; lab1.AddGroup(inst1); @@ -162,7 +162,7 @@ int main() { // Test demshape with ShapeModel keyword cout << endl << " Testing dem shape..." << endl; - string inputFile = "$ISIS3DATA/mgs/testData/ab102401.cub"; + QString inputFile = "$ISIS3DATA/mgs/testData/ab102401.cub"; Cube cube; cube.open(inputFile); Camera *c = cube.getCamera(); diff --git a/isis/src/base/objs/SimpleCylindrical/SimpleCylindrical.cpp b/isis/src/base/objs/SimpleCylindrical/SimpleCylindrical.cpp index ea6425d17e..33065b01b1 100644 --- a/isis/src/base/objs/SimpleCylindrical/SimpleCylindrical.cpp +++ b/isis/src/base/objs/SimpleCylindrical/SimpleCylindrical.cpp @@ -60,7 +60,7 @@ namespace Isis { // Compute the default value if allowed and needed if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = (m_minimumLongitude + m_maximumLongitude) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } // Get the center longitude, convert to radians, adjust for longitude @@ -70,7 +70,7 @@ namespace Isis { if (m_longitudeDirection == PositiveWest) m_centerLongitude *= -1.0; } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } } @@ -99,18 +99,18 @@ namespace Isis { /** * Returns the name of the map projection, "SimpleCylindrical" * - * @return string Name of projection, "SimpleCylindrical" + * @return QString Name of projection, "SimpleCylindrical" */ - string SimpleCylindrical::Name() const { + QString SimpleCylindrical::Name() const { return "SimpleCylindrical"; } /** * Returns the version of the map projection * - * @return std::string Version number + * @return std::QString Version number */ - string SimpleCylindrical::Version() const { + QString SimpleCylindrical::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/SimpleCylindrical/SimpleCylindrical.h b/isis/src/base/objs/SimpleCylindrical/SimpleCylindrical.h index 7db0fbc38c..1020c282fc 100644 --- a/isis/src/base/objs/SimpleCylindrical/SimpleCylindrical.h +++ b/isis/src/base/objs/SimpleCylindrical/SimpleCylindrical.h @@ -86,8 +86,8 @@ namespace Isis { ~SimpleCylindrical(); bool operator==(const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; bool IsEquatorialCylindrical(); bool SetGround(const double lat, const double lon); diff --git a/isis/src/base/objs/SimpleCylindrical/unitTest.cpp b/isis/src/base/objs/SimpleCylindrical/unitTest.cpp index 097b0e16ba..ee41d03cb0 100644 --- a/isis/src/base/objs/SimpleCylindrical/unitTest.cpp +++ b/isis/src/base/objs/SimpleCylindrical/unitTest.cpp @@ -5,38 +5,40 @@ #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "UNIT TEST FOR SimpleCylindrical" << endl << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGrp = lab.FindGroup("Mapping"); - mapGrp += Isis::PvlKeyword("EquatorialRadius", 1.0); - mapGrp += Isis::PvlKeyword("PolarRadius", 1.0); - mapGrp += Isis::PvlKeyword("LatitudeType", "Planetocentric"); - mapGrp += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGrp += Isis::PvlKeyword("LongitudeDomain", 180); - mapGrp += Isis::PvlKeyword("MinimumLatitude", -90.0); - mapGrp += Isis::PvlKeyword("MaximumLatitude", 90.0); - mapGrp += Isis::PvlKeyword("MinimumLongitude", -180.0); - mapGrp += Isis::PvlKeyword("MaximumLongitude", 180.0); - mapGrp += Isis::PvlKeyword("ProjectionName", "SimpleCylindrical"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGrp = lab.FindGroup("Mapping"); + mapGrp += PvlKeyword("EquatorialRadius", toString(1.0)); + mapGrp += PvlKeyword("PolarRadius", toString(1.0)); + mapGrp += PvlKeyword("LatitudeType", "Planetocentric"); + mapGrp += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGrp += PvlKeyword("LongitudeDomain", toString(180)); + mapGrp += PvlKeyword("MinimumLatitude", toString(-90.0)); + mapGrp += PvlKeyword("MaximumLatitude", toString(90.0)); + mapGrp += PvlKeyword("MinimumLongitude", toString(-180.0)); + mapGrp += PvlKeyword("MaximumLongitude", toString(180.0)); + mapGrp += PvlKeyword("ProjectionName", "SimpleCylindrical"); cout << "Test missing center longitude keyword ..." << endl; try { - Isis::SimpleCylindrical p(lab); + SimpleCylindrical p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; try { - mapGrp += Isis::PvlKeyword("CenterLongitude", -90.0); - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); + mapGrp += PvlKeyword("CenterLongitude", toString(-90.0)); + Projection &p = *ProjectionFactory::Create(lab); cout << "Test SetGround method ... " << endl; cout << std::setprecision(16); @@ -67,7 +69,7 @@ int main(int argc, char *argv[]) { cout << "Maximum Y: " << maxY << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; @@ -75,15 +77,15 @@ int main(int argc, char *argv[]) { cout << "Testing default option ... " << endl; mapGrp.DeleteKeyword("CenterLongitude"); - Isis::SimpleCylindrical p2(lab, true); + SimpleCylindrical p2(lab, true); cout << lab << endl; cout << endl; cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -96,7 +98,7 @@ int main(int argc, char *argv[]) { cout << tmp3 << endl; cout << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/Sinusoidal/Sinusoidal.cpp b/isis/src/base/objs/Sinusoidal/Sinusoidal.cpp index cc3fe52dad..213f2e4384 100644 --- a/isis/src/base/objs/Sinusoidal/Sinusoidal.cpp +++ b/isis/src/base/objs/Sinusoidal/Sinusoidal.cpp @@ -61,7 +61,7 @@ namespace Isis { // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = (m_minimumLongitude + m_maximumLongitude) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } // Get the center longitude @@ -72,7 +72,7 @@ namespace Isis { if (m_longitudeDirection == PositiveWest) m_centerLongitude *= -1.0; } catch(IException &e) { - string message = "Invalid label group [Mapping]"; + QString message = "Invalid label group [Mapping]"; throw IException(e, IException::Io, message, _FILEINFO_); } } @@ -101,9 +101,9 @@ namespace Isis { /** * Returns the name of the map projection, "Sinusoidal" * - * @return string Name of projection, "Sinusoidal" + * @return QString Name of projection, "Sinusoidal" */ - string Sinusoidal::Name() const { + QString Sinusoidal::Name() const { return "Sinusoidal"; } @@ -111,9 +111,9 @@ namespace Isis { * Returns the version of the map projection * * - * @return string Version number + * @return QString Version number */ - string Sinusoidal::Version() const { + QString Sinusoidal::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/Sinusoidal/Sinusoidal.h b/isis/src/base/objs/Sinusoidal/Sinusoidal.h index 1d17705c3b..a67293394e 100644 --- a/isis/src/base/objs/Sinusoidal/Sinusoidal.h +++ b/isis/src/base/objs/Sinusoidal/Sinusoidal.h @@ -90,8 +90,8 @@ namespace Isis { ~Sinusoidal(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; bool SetGround(const double lat, const double lon); bool SetCoordinate(const double x, const double y); diff --git a/isis/src/base/objs/Sinusoidal/unitTest.cpp b/isis/src/base/objs/Sinusoidal/unitTest.cpp index 9c39b3ba97..9a996d5839 100644 --- a/isis/src/base/objs/Sinusoidal/unitTest.cpp +++ b/isis/src/base/objs/Sinusoidal/unitTest.cpp @@ -5,40 +5,42 @@ #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "Unit Test For Sinusodial" << endl << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 1.0); - mapGroup += Isis::PvlKeyword("PolarRadius", 1.0); - mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); - mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 180); - mapGroup += Isis::PvlKeyword("MinimumLatitude", -90.0); - mapGroup += Isis::PvlKeyword("MaximumLatitude", 90.0); - mapGroup += Isis::PvlKeyword("MinimumLongitude", -180.0); - mapGroup += Isis::PvlKeyword("MaximumLongitude", 180.0); - mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup = lab.FindGroup("Mapping"); + mapGroup += PvlKeyword("EquatorialRadius", toString(1.0)); + mapGroup += PvlKeyword("PolarRadius", toString(1.0)); + mapGroup += PvlKeyword("LatitudeType", "Planetocentric"); + mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup += PvlKeyword("LongitudeDomain", toString(180)); + mapGroup += PvlKeyword("MinimumLatitude", toString(-90.0)); + mapGroup += PvlKeyword("MaximumLatitude", toString(90.0)); + mapGroup += PvlKeyword("MinimumLongitude", toString(-180.0)); + mapGroup += PvlKeyword("MaximumLongitude", toString(180.0)); + mapGroup += PvlKeyword("ProjectionName", "Sinusoidal"); cout << "Test missing center longitude keyword ..." << endl; try { - Isis::Sinusoidal p(lab); + Sinusoidal p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLongitude", -90.0); + mapGroup += PvlKeyword("CenterLongitude", toString(-90.0)); try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); - // Isis::Sinusoidal p(lab); + Projection &p = *ProjectionFactory::Create(lab); + // Sinusoidal p(lab); cout << "Test SetGround method ... " << endl; cout << std::setprecision(16); @@ -69,7 +71,7 @@ int main(int argc, char *argv[]) { cout << "Maximum Y: " << maxY << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; @@ -77,15 +79,15 @@ int main(int argc, char *argv[]) { cout << "Test default computation ... " << endl; mapGroup.DeleteKeyword("CenterLongitude"); - Isis::Sinusoidal p2(lab, true); + Sinusoidal p2(lab, true); cout << lab << endl; cout << endl; cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -103,7 +105,7 @@ int main(int argc, char *argv[]) { cout << " USGS Professional Paper 1395 by John P. Snyder" << endl; cout << " Pages 365-366" << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/SmtkMatcher/SmtkMatcher.cpp b/isis/src/base/objs/SmtkMatcher/SmtkMatcher.cpp index 2cc2ddf0b7..175caa95a7 100644 --- a/isis/src/base/objs/SmtkMatcher/SmtkMatcher.cpp +++ b/isis/src/base/objs/SmtkMatcher/SmtkMatcher.cpp @@ -44,7 +44,7 @@ namespace Isis { } /** Construct with Gruen definintions file */ - SmtkMatcher::SmtkMatcher(const std::string ®def) : m_lhCube(0), + SmtkMatcher::SmtkMatcher(const QString ®def) : m_lhCube(0), m_rhCube(0), m_gruen(0), m_offImage(0), @@ -55,7 +55,7 @@ namespace Isis { } /** Construct with Gruen definintions file and camera objects */ - SmtkMatcher::SmtkMatcher(const std::string ®def, Cube *lhCube, + SmtkMatcher::SmtkMatcher(const QString ®def, Cube *lhCube, Cube *rhCube) : m_lhCube(lhCube), m_rhCube(rhCube), m_gruen(0), m_offImage(0), @@ -90,9 +90,9 @@ namespace Isis { * * @param regdef Gruen definitions Pvl file */ - void SmtkMatcher::setGruenDef(const std::string ®def) { + void SmtkMatcher::setGruenDef(const QString ®def) { Pvl reg(regdef); - m_gruen = auto_ptr (new Gruen(reg)); // Deallocation automatic + m_gruen = std::auto_ptr (new Gruen(reg)); // Deallocation automatic return; } @@ -144,7 +144,7 @@ namespace Isis { * @param pattern Set the file pattern of the output cube search * chips. */ - void SmtkMatcher::setWriteSubsearchChipPattern(const std::string &fileptrn) { + void SmtkMatcher::setWriteSubsearchChipPattern(const QString &fileptrn) { validate(); m_gruen->WriteSubsearchChips(fileptrn); } @@ -236,20 +236,20 @@ namespace Isis { bool valid(true); if (!spnt.isValid()) { - cout << "Point status is invalid!\n"; + std::cout << "Point status is invalid!\n"; valid = false; } // Is valid in left image? if (!inCube(lhCamera(), spnt.getLeft())) { - cout << "Left point (" << spnt.getLeft().getLine() << "," + std::cout << "Left point (" << spnt.getLeft().getLine() << "," << spnt.getLeft().getSample() << ") is invalid!\n"; valid = false; } // Is valud in right image? if (!inCube(rhCamera(), spnt.getRight())) { - cout << "Right point (" << spnt.getRight().getLine() << "," + std::cout << "Right point (" << spnt.getRight().getLine() << "," << spnt.getRight().getSample() << ") is invalid!\n"; valid = false; } @@ -355,7 +355,7 @@ namespace Isis { // Test if the left point is defined. This will throw an error if this // situation occurs if (!lpg.getPoint().isValid()) { - string mess = "Left point is not defined which is required"; + QString mess = "Left point is not defined which is required"; throw IException(IException::Programmer, mess, _FILEINFO_); } @@ -535,7 +535,7 @@ namespace Isis { if (!m_rhCube) isGood = false; if (!m_gruen.get()) isGood = false; if ((!isGood) && throwError) { - std::string mess = "Images/match algorithm not initialized!"; + QString mess = "Images/match algorithm not initialized!"; throw IException(IException::Programmer, mess, _FILEINFO_); } return (isGood); diff --git a/isis/src/base/objs/SmtkMatcher/SmtkMatcher.h b/isis/src/base/objs/SmtkMatcher/SmtkMatcher.h index 60a27e465f..006a750935 100644 --- a/isis/src/base/objs/SmtkMatcher/SmtkMatcher.h +++ b/isis/src/base/objs/SmtkMatcher/SmtkMatcher.h @@ -1,4 +1,4 @@ -#if !defined(SmtkMatcher_h) +#ifndef SmtkMatcher_h #define SmtkMatcher_h /** @@ -54,13 +54,13 @@ namespace Isis { class SmtkMatcher { public: SmtkMatcher(); - SmtkMatcher(const std::string ®def); - SmtkMatcher(const std::string ®def, Cube *lhImage, Cube *rhImage); + SmtkMatcher(const QString ®def); + SmtkMatcher(const QString ®def, Cube *lhImage, Cube *rhImage); SmtkMatcher(Cube *lhImage, Cube *rhImage); ~SmtkMatcher(); void setImages(Cube *lhImage, Cube *rhImage); - void setGruenDef(const std::string ®def); + void setGruenDef(const QString ®def); bool isValid(const Coordinate &pnt); bool isValid(const SmtkPoint &spnt); @@ -83,7 +83,7 @@ class SmtkMatcher { return (m_gruen->FitChip()); } - void setWriteSubsearchChipPattern(const std::string &fileptrn = "SmtkMatcher"); + void setWriteSubsearchChipPattern(const QString &fileptrn = "SmtkMatcher"); SmtkQStackIter FindSmallestEV(SmtkQStack &stack); SmtkQStackIter FindExpDistEV(SmtkQStack &stack, const double &seedsample, diff --git a/isis/src/base/objs/SmtkMatcher/SmtkPoint.h b/isis/src/base/objs/SmtkMatcher/SmtkPoint.h index 686ef4beb6..4b0ce5119a 100644 --- a/isis/src/base/objs/SmtkMatcher/SmtkPoint.h +++ b/isis/src/base/objs/SmtkMatcher/SmtkPoint.h @@ -1,4 +1,4 @@ -#if !defined(SmtkPoint_h) +#ifndef SmtkPoint_h #define SmtkPoint_h /** diff --git a/isis/src/base/objs/SmtkMatcher/SmtkStack.h b/isis/src/base/objs/SmtkMatcher/SmtkStack.h index 1ffa43f861..9c1d56643c 100644 --- a/isis/src/base/objs/SmtkMatcher/SmtkStack.h +++ b/isis/src/base/objs/SmtkMatcher/SmtkStack.h @@ -1,4 +1,4 @@ -#if !defined(SmtkStack_h) +#ifndef SmtkStack_h #define SmtkStack_h /** diff --git a/isis/src/base/objs/SpecialPixel/SpecialPixel.h b/isis/src/base/objs/SpecialPixel/SpecialPixel.h index 3177eab242..9cfb985d2f 100644 --- a/isis/src/base/objs/SpecialPixel/SpecialPixel.h +++ b/isis/src/base/objs/SpecialPixel/SpecialPixel.h @@ -1,4 +1,4 @@ -#if !defined(SpecialPixel_h) +#ifndef SpecialPixel_h #define SpecialPixel_h /** * @file @@ -25,8 +25,10 @@ #include #include #include -#include "IString.h" +#include + #include "IException.h" +#include "IString.h" namespace Isis { @@ -353,18 +355,18 @@ namespace Isis { * * @return string The name of the pixel type */ - inline std::string PixelToString(double d) { + inline QString PixelToString(double d) { if(Isis::IsSpecial(d)) { - if(Isis::IsNullPixel(d)) return std::string("Null"); - if(Isis::IsLrsPixel(d)) return std::string("Lrs"); - if(Isis::IsHrsPixel(d)) return std::string("Hrs"); - if(Isis::IsHisPixel(d)) return std::string("His"); - if(Isis::IsLisPixel(d)) return std::string("Lis"); - return std::string("Invalid"); + if(Isis::IsNullPixel(d)) return "Null"; + if(Isis::IsLrsPixel(d)) return "Lrs"; + if(Isis::IsHrsPixel(d)) return "Hrs"; + if(Isis::IsHisPixel(d)) return "His"; + if(Isis::IsLisPixel(d)) return "Lis"; + return "Invalid"; } QString result; - return result.setNum(d, 'g', 8).toStdString(); + return result.setNum(d, 'g', 8); } /** * Takes the name of the pixel type as a string and returns a @@ -374,12 +376,11 @@ namespace Isis { * * @return double Pixel value */ - inline double StringToPixel(const std::string &str) { + inline double StringToPixel(const QString &str) { - IString s(str); - s.UpCase(); + QString s = str.toUpper(); - std::vector legal; + QStringList legal; legal.push_back("NULL"); legal.push_back("HRS"); legal.push_back("LRS"); @@ -387,27 +388,27 @@ namespace Isis { legal.push_back("LIS"); int matches = 0; for(int i = 0; i < (int) legal.size(); i++) { - if(legal[i].substr(0, s.size()) == s) { + if(legal[i].mid(0, s.size()) == s) { matches++; } } if(matches > 1) { - std::string msg = "Input [" + str + "] is not a unique abbreviation. Use " + s + "I or " + s + "R."; + QString msg = "Input [" + str + "] is not a unique abbreviation. Use " + s + "I or " + s + "R."; throw IException(IException::User, msg, _FILEINFO_); } if(matches == 0) { try { - return s.ToDouble(); + return toDouble(s); } catch(IException &e) { - std::string msg = "Input [" + str + "] does not appear to be a legal special pixel abbreviation or double value."; + QString msg = "Input [" + str + "] does not appear to be a legal special pixel abbreviation or double value."; throw IException(e, IException::User, msg, _FILEINFO_); } } if(s[0] == 'N') return Null; - if(s.substr(0, 2) == "HR") return Hrs; - if(s.substr(0, 2) == "LR") return Lrs; - if(s.substr(0, 2) == "HI") return His; + if(s.mid(0, 2) == "HR") return Hrs; + if(s.mid(0, 2) == "LR") return Lrs; + if(s.mid(0, 2) == "HI") return His; else return Lis;//(s.substr(0,2) == "LI") } diff --git a/isis/src/base/objs/SpecialPixel/SpecialPixel.truth b/isis/src/base/objs/SpecialPixel/SpecialPixel.truth index 73af934861..942fe92a80 100644 --- a/isis/src/base/objs/SpecialPixel/SpecialPixel.truth +++ b/isis/src/base/objs/SpecialPixel/SpecialPixel.truth @@ -107,7 +107,7 @@ Isis::Lis to String: Lis 1.5 to String: 1.5 -6.0 to String: -6 -Testing StringToPixel(string): +Testing StringToPixel(QString): NuLl to Pixel: -1.797693134862315e+308 lrs to Pixel: -1.797693134862315e+308 Hrs to Pixel: -1.797693134862316e+308 @@ -118,7 +118,7 @@ LIS to Pixel: -1.797693134862315e+308 -6.0 to Pixel: -6 -6 to Pixel: -6 -Testing unique value shortcut for StringToPixel(string): +Testing unique value shortcut for StringToPixel(QString): Nul to Pixel: -1.797693134862315e+308 N to Pixel: -1.797693134862315e+308 Lr to Pixel: -1.797693134862315e+308 @@ -126,7 +126,7 @@ Hr to Pixel: -1.797693134862316e+308 Hi to Pixel: -1.797693134862316e+308 Li to Pixel: -1.797693134862315e+308 -Testing illegal shortcuts/expressions for StringToPixel(string): +Testing illegal shortcuts/expressions for StringToPixel(QString): **USER ERROR** Input [Nl] does not appear to be a legal special pixel abbreviation or double value. **ERROR** Failed to convert string [NL] to a double. **USER ERROR** Input [Nulll] does not appear to be a legal special pixel abbreviation or double value. diff --git a/isis/src/base/objs/SpecialPixel/unitTest.cpp b/isis/src/base/objs/SpecialPixel/unitTest.cpp index cbef7efcfd..b949e33030 100644 --- a/isis/src/base/objs/SpecialPixel/unitTest.cpp +++ b/isis/src/base/objs/SpecialPixel/unitTest.cpp @@ -1,10 +1,13 @@ #include #include #include "IException.h" +#include "IString.h" #include "SpecialPixel.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); @@ -181,8 +184,8 @@ int main(int argc, char *argv[]) { cout << "-6.0 to String:\t\t" << Isis::PixelToString(d) << endl; cout << endl; - cout << "Testing StringToPixel(string):" << endl; - string s = "NuLl"; + cout << "Testing StringToPixel(QString):" << endl; + QString s = "NuLl"; cout << "NuLl to Pixel:\t\t" << Isis::StringToPixel(s) << endl; s = "lrs"; cout << "lrs to Pixel:\t\t" << Isis::StringToPixel(s) << endl; @@ -201,7 +204,7 @@ int main(int argc, char *argv[]) { cout << Isis::PixelToString(d) << " to Pixel:\t" << Isis::StringToPixel(Isis::PixelToString(d)) << endl; cout << endl; - cout << "Testing unique value shortcut for StringToPixel(string):" << endl; + cout << "Testing unique value shortcut for StringToPixel(QString):" << endl; s = "Nul"; cout << "Nul to Pixel:\t\t" << Isis::StringToPixel(s) << endl; s = "N"; @@ -216,7 +219,7 @@ int main(int argc, char *argv[]) { cout << "Li to Pixel:\t\t" << Isis::StringToPixel(s) << endl; cout << endl; - cout << "Testing illegal shortcuts/expressions for StringToPixel(string):" << endl; + cout << "Testing illegal shortcuts/expressions for StringToPixel(QString):" << endl; try { s = "Nl"; Isis::StringToPixel(s); diff --git a/isis/src/base/objs/Spice/LightTimeCorrectionState.cpp b/isis/src/base/objs/Spice/LightTimeCorrectionState.cpp index 47418d23ef..46f7d72500 100644 --- a/isis/src/base/objs/Spice/LightTimeCorrectionState.cpp +++ b/isis/src/base/objs/Spice/LightTimeCorrectionState.cpp @@ -121,7 +121,7 @@ namespace Isis { bool LightTimeCorrectionState::checkAberrationCorrection(int ikCode, Spice *spice) { try { - std::string ikernKey = "INS" + IString(ikCode) + "_LIGHTTIME_CORRECTION"; + QString ikernKey = "INS" + toString(ikCode) + "_LIGHTTIME_CORRECTION"; QString abcorr = spice->getString(ikernKey); m_abcorr = abcorr; return (true); @@ -196,15 +196,15 @@ namespace Isis { QString abcorr(""); // Retrieve list of loaded SPKs from Kernel object - std::vector spks = kernels.getKernelList("SPK"); - for ( unsigned int k = 0 ; k < spks.size() ; k++ ) { - std::string spkFile = spks[k]; + QStringList spks = kernels.getKernelList("SPK"); + for ( int k = 0 ; k < spks.size() ; k++ ) { + QString spkFile = spks[k]; SpiceChar ktype[32]; SpiceChar source[128]; SpiceInt handle; SpiceBoolean found; // Get info on SPK kernel mainly the NAIF handle for comment parsing - (void) kinfo_c(spkFile.c_str(), sizeof(ktype), sizeof(source), ktype, + (void) kinfo_c(spkFile.toAscii().data(), sizeof(ktype), sizeof(source), ktype, source, &handle, &found); if (found == SPICETRUE) { // SPK is open so read and parse all the comments. @@ -267,8 +267,8 @@ namespace Isis { Spice *spice) { try { - std::string ikernKey = "INS" + IString(ikCode) + "_SWAP_OBSERVER_TARGET"; - std::string value = spice->getString(ikernKey).UpCase(); + QString ikernKey = "INS" + toString(ikCode) + "_SWAP_OBSERVER_TARGET"; + QString value = spice->getString(ikernKey).toUpper(); m_swapObserverTarget = ("TRUE" == value); } catch (IException &ie) { @@ -319,8 +319,8 @@ namespace Isis { Spice *spice) { try { - std::string ikernKey = "INS" + IString(ikCode) + "_LT_SURFACE_CORRECT"; - std::string value = spice->getString(ikernKey).UpCase(); + QString ikernKey = "INS" + toString(ikCode) + "_LT_SURFACE_CORRECT"; + QString value = spice->getString(ikernKey).toUpper(); m_sc_to_surf_ltcorr = ("TRUE" == value); } catch (IException &ie) { diff --git a/isis/src/base/objs/Spice/SpacecraftPosition.cpp b/isis/src/base/objs/Spice/SpacecraftPosition.cpp index 9da31ef36f..5aab1f0554 100644 --- a/isis/src/base/objs/Spice/SpacecraftPosition.cpp +++ b/isis/src/base/objs/Spice/SpacecraftPosition.cpp @@ -111,9 +111,9 @@ namespace Isis { * * @param correction Type of stellar aberration correction to apply */ - void SpacecraftPosition::SetAberrationCorrection(const std::string &correction) { + void SpacecraftPosition::SetAberrationCorrection(const QString &correction) { SpicePosition::SetAberrationCorrection(correction); // Checks for validity - m_abcorr.setAberrationCorrection(QString::fromStdString(correction)); + m_abcorr.setAberrationCorrection(correction); } @@ -122,8 +122,8 @@ namespace Isis { * * @author 2012-10-29 Kris Becker */ - std::string SpacecraftPosition::GetAberrationCorrection() const { - return (m_abcorr.getAberrationCorrection().toStdString()); + QString SpacecraftPosition::GetAberrationCorrection() const { + return (m_abcorr.getAberrationCorrection()); } /** diff --git a/isis/src/base/objs/Spice/SpacecraftPosition.h b/isis/src/base/objs/Spice/SpacecraftPosition.h index d293228680..2fbb919fbd 100644 --- a/isis/src/base/objs/Spice/SpacecraftPosition.h +++ b/isis/src/base/objs/Spice/SpacecraftPosition.h @@ -85,8 +85,8 @@ namespace Isis { double getRadiusLightTime() const; static double getDistanceLightTime(const Distance &distance); - virtual void SetAberrationCorrection(const std::string &correction); - virtual std::string GetAberrationCorrection() const; + virtual void SetAberrationCorrection(const QString &correction); + virtual QString GetAberrationCorrection() const; virtual void SetEphemerisTimeSpice(); diff --git a/isis/src/base/objs/Spice/Spice.cpp b/isis/src/base/objs/Spice/Spice.cpp index 91e9290a90..7a859ff216 100644 --- a/isis/src/base/objs/Spice/Spice.cpp +++ b/isis/src/base/objs/Spice/Spice.cpp @@ -104,7 +104,7 @@ namespace Isis { // Initialize members m_solarLongitude = new Longitude; m_et = NULL; - m_kernels = new QVector; + m_kernels = new QVector; m_target = new Target(this, lab); m_startTime = new iTime; @@ -140,14 +140,14 @@ namespace Isis { // Get the time padding first if (kernels.HasKeyword("StartPadding")) { - *m_startTimePadding = kernels["StartPadding"][0]; + *m_startTimePadding = toDouble(kernels["StartPadding"][0]); } else { *m_startTimePadding = 0.0; } if (kernels.HasKeyword("EndPadding")) { - *m_endTimePadding = kernels["EndPadding"][0]; + *m_endTimePadding = toDouble(kernels["EndPadding"][0]); } else { *m_endTimePadding = 0.0; @@ -207,16 +207,16 @@ namespace Isis { // // Use spkbodycode to read body position from spk - string trykey = "NaifIkCode"; + QString trykey = "NaifIkCode"; if (kernels.HasKeyword("NaifFrameCode")) trykey = "NaifFrameCode"; - *m_ikCode = (int) kernels[trykey]; + *m_ikCode = toInt(kernels[trykey][0]); *m_spkCode = *m_ikCode / 1000; *m_sclkCode = *m_spkCode; *m_ckCode = *m_ikCode; if (!m_target->isSky()) { - IString radiiKey = "BODY" + IString((BigInt) m_target->naifBodyCode()) + "_RADII"; + QString radiiKey = "BODY" + toString(m_target->naifBodyCode()) + "_RADII"; std::vector radii(3,Distance()); radii[0] = Distance(getDouble(radiiKey, 0), Distance::Kilometers); radii[1] = Distance(getDouble(radiiKey, 1), Distance::Kilometers); @@ -261,8 +261,8 @@ namespace Isis { &found); if (!found) { - IString naifTarget = "IAU_" + IString(m_target->name()).UpCase(); - namfrm_c(naifTarget.c_str(), &frameCode); + QString naifTarget = "IAU_" + QString(m_target->name()).toUpper(); + namfrm_c(naifTarget.toAscii().data(), &frameCode); if (frameCode == 0) { string msg = "Can not find NAIF BODY_FRAME_CODE for target [" + IString(m_target->name()) + "]"; @@ -297,7 +297,7 @@ namespace Isis { // Check to see if we have nadir pointing that needs to be computed & // See if we have table blobs to load - if (kernels["TargetPosition"][0].UpCase() == "TABLE") { + if (kernels["TargetPosition"][0].toUpper() == "TABLE") { Table t("SunPosition", lab.FileName(), lab); m_sunPosition->LoadCache(t); @@ -326,7 +326,7 @@ namespace Isis { // 2009-03-18 Tracie Sucharski - Removed test for old keywords, any files // with the old keywords should be re-run through spiceinit. - if (kernels["InstrumentPointing"][0].UpCase() == "NADIR") { + if (kernels["InstrumentPointing"][0].toUpper() == "NADIR") { if (m_instrumentRotation) { delete m_instrumentRotation; m_instrumentRotation = NULL; @@ -334,7 +334,7 @@ namespace Isis { m_instrumentRotation = new SpiceRotation(*m_ikCode, *m_spkBodyCode); } - else if (IString((std::string)kernels["InstrumentPointing"]).UpCase() == "TABLE") { + else if (kernels["InstrumentPointing"][0].toUpper() == "TABLE") { Table t("InstrumentPointing", lab.FileName(), lab); m_instrumentRotation->LoadCache(t); } @@ -345,7 +345,7 @@ namespace Isis { _FILEINFO_); } - if (IString((std::string)kernels["InstrumentPosition"]).UpCase() == "TABLE") { + if (kernels["InstrumentPosition"][0].toUpper() == "TABLE") { Table t("InstrumentPosition", lab.FileName(), lab); m_instrumentPosition->LoadCache(t); } @@ -373,12 +373,12 @@ namespace Isis { if (IString(key[i]).UpCase() == "TABLE" && noTables) continue; FileName file(key[i]); if (!file.fileExists()) { - string msg = "Spice file does not exist [" + file.expanded() + "]"; + QString msg = "Spice file does not exist [" + file.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } - string fileName(file.expanded()); - furnsh_c(fileName.c_str()); - m_kernels->push_back((string)key[i]); + QString fileName(file.expanded()); + furnsh_c(fileName.toAscii().data()); + m_kernels->push_back((QString)key[i]); } NaifStatus::CheckErrors(); @@ -483,8 +483,8 @@ namespace Isis { // Unload the kernels (TODO: Can this be done faster) for (int i = 0; m_kernels && i < m_kernels->size(); i++) { FileName file(m_kernels->at(i)); - string fileName(file.expanded()); - unload_c(fileName.c_str()); + QString fileName(file.expanded()); + unload_c(fileName.toAscii().data()); } if (m_kernels != NULL) { @@ -603,8 +603,8 @@ namespace Isis { // Unload the kernels (TODO: Can this be done faster) for (int i = 0; i < m_kernels->size(); i++) { FileName file(m_kernels->at(i)); - string fileName(file.expanded()); - unload_c(fileName.c_str()); + QString fileName(file.expanded()); + unload_c(fileName.toAscii().data()); } m_kernels->clear(); @@ -868,7 +868,7 @@ namespace Isis { * * @throw Isis::iException::Io - "Can not find key in instrument kernels */ - SpiceInt Spice::getInteger(const IString &key, int index) { + SpiceInt Spice::getInteger(const QString &key, int index) { return readValue(key, SpiceIntType, index).toInt(); } @@ -882,7 +882,7 @@ namespace Isis { * * @throw Isis::iException::Io - "Can not find key in instrument kernels." */ - SpiceDouble Spice::getDouble(const IString &key, int index) { + SpiceDouble Spice::getDouble(const QString &key, int index) { return readValue(key, SpiceDoubleType, index).toDouble(); } @@ -893,19 +893,19 @@ namespace Isis { * Use this when possible because naif calls (such as scs2e_c) cannot be * called when not using naif. */ - iTime Spice::getClockTime(IString clockValue, int sclkCode) { + iTime Spice::getClockTime(QString clockValue, int sclkCode) { if (sclkCode == -1) { sclkCode = naifSclkCode(); } iTime result; - IString key = "CLOCK_ET_" + IString(sclkCode) + "_" + clockValue; + QString key = "CLOCK_ET_" + toString(sclkCode) + "_" + clockValue; QVariant storedClockTime = getStoredResult(key, SpiceDoubleType); if (storedClockTime.isNull()) { SpiceDouble timeOutput; - scs2e_c(sclkCode, clockValue.c_str(), &timeOutput); + scs2e_c(sclkCode, clockValue.toAscii().data(), &timeOutput); storedClockTime = timeOutput; storeResult(key, SpiceDoubleType, timeOutput); } @@ -926,7 +926,7 @@ namespace Isis { * @param type The naif value's primitive type * @param index The index into the naif keyword array to read */ - QVariant Spice::readValue(IString key, SpiceValueType type, int index) { + QVariant Spice::readValue(QString key, SpiceValueType type, int index) { QVariant result; if (m_usingNaif) { @@ -941,25 +941,25 @@ namespace Isis { if (type == SpiceDoubleType) { SpiceDouble kernelValue; - gdpool_c(key.c_str(), (SpiceInt)index, 1, + gdpool_c(key.toAscii().data(), (SpiceInt)index, 1, &numValuesRead, &kernelValue, &found); result = kernelValue; } else if (type == SpiceStringType) { char kernelValue[512]; - gcpool_c(key.c_str(), (SpiceInt)index, 1, sizeof(kernelValue), + gcpool_c(key.toAscii().data(), (SpiceInt)index, 1, sizeof(kernelValue), &numValuesRead, kernelValue, &found); result = kernelValue; } else if (type == SpiceIntType) { SpiceInt kernelValue; - gipool_c(key.c_str(), (SpiceInt)index, 1, &numValuesRead, + gipool_c(key.toAscii().data(), (SpiceInt)index, 1, &numValuesRead, &kernelValue, &found); result = (int)kernelValue; } if (!found) { - string msg = "Can not find [" + key + "] in text kernels"; + QString msg = "Can not find [" + key + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -980,7 +980,7 @@ namespace Isis { } - void Spice::storeResult(IString name, SpiceValueType type, QVariant value) { + void Spice::storeResult(QString name, SpiceValueType type, QVariant value) { if (type == SpiceDoubleType) { EndianSwapper swapper("LSB"); @@ -995,7 +995,7 @@ namespace Isis { } - QVariant Spice::getStoredResult(IString name, SpiceValueType type) { + QVariant Spice::getStoredResult(QString name, SpiceValueType type) { bool wasDouble = false; if (type == SpiceDoubleType) { @@ -1016,7 +1016,7 @@ namespace Isis { } - void Spice::storeValue(IString key, int index, SpiceValueType type, + void Spice::storeValue(QString key, int index, SpiceValueType type, QVariant value) { if (!m_naifKeywords->HasKeyword(key)) { m_naifKeywords->AddKeyword(PvlKeyword(key)); @@ -1029,16 +1029,16 @@ namespace Isis { } if (type == SpiceByteCodeType) { - storedKey[index] = IString(value.toByteArray().toHex().data()); + storedKey[index] = QString(value.toByteArray().toHex().data()); } else if (type == SpiceStringType) { storedKey[index] = value.toString(); } else if (type == SpiceDoubleType) { - storedKey[index] = value.toDouble(); + storedKey[index] = toString(value.toDouble()); } else if (type == SpiceIntType) { - storedKey[index] = value.toInt(); + storedKey[index] = toString(value.toInt()); } else { IString msg = "Unable to store variant in labels for key [" + key + "]"; @@ -1047,7 +1047,7 @@ namespace Isis { } - QVariant Spice::readStoredValue(IString key, SpiceValueType type, + QVariant Spice::readStoredValue(QString key, SpiceValueType type, int index) { // Read from PvlObject that is our naif keywords QVariant result; @@ -1057,17 +1057,16 @@ namespace Isis { try { if (type == SpiceDoubleType) { - result = (double)storedKeyword[index]; + result = toDouble(storedKeyword[index]); } else if (type == SpiceStringType) { - result = QString::fromStdString(storedKeyword[index]); + result = storedKeyword[index]; } else if (type == SpiceByteCodeType || SpiceStringType) { - result = QByteArray( - string(storedKeyword[index]).c_str()); + result = storedKeyword[index].toAscii(); } else if (type == SpiceIntType) { - result = (int)storedKeyword[index]; + result = toInt(storedKeyword[index]); } } catch(IException &) { @@ -1088,7 +1087,7 @@ namespace Isis { * * @throw Isis::IException::Io - "Can not find key in instrument kernels." */ - IString Spice::getString(const IString &key, int index) { + QString Spice::getString(const QString &key, int index) { return readValue(key, SpiceStringType, index).toString(); } @@ -1201,7 +1200,7 @@ namespace Isis { * * @return string */ - IString Spice::targetName() const { + QString Spice::targetName() const { return m_target->name(); } diff --git a/isis/src/base/objs/Spice/Spice.h b/isis/src/base/objs/Spice/Spice.h index 6980165bb4..b8b751d764 100644 --- a/isis/src/base/objs/Spice/Spice.h +++ b/isis/src/base/objs/Spice/Spice.h @@ -281,13 +281,13 @@ namespace Isis { void subSolarPoint(double &lat, double &lon); Target *target() const; - IString targetName() const; + QString targetName() const; - iTime getClockTime(IString clockValue, + iTime getClockTime(QString clockValue, int sclkCode = -1); - SpiceDouble getDouble(const IString &key, int index = 0); - SpiceInt getInteger(const IString &key, int index = 0); - IString getString(const IString &key, int index = 0); + SpiceDouble getDouble(const QString &key, int index = 0); + SpiceInt getInteger(const QString &key, int index = 0); + QString getString(const QString &key, int index = 0); SpicePosition *sunPosition() const; SpicePosition *instrumentPosition() const; @@ -318,14 +318,14 @@ namespace Isis { SpiceByteCodeType //!< SpiceByteCode type }; - QVariant readValue(IString key, SpiceValueType type, int index = 0); + QVariant readValue(QString key, SpiceValueType type, int index = 0); - void storeResult(IString name, SpiceValueType type, QVariant value); - QVariant getStoredResult(IString name, SpiceValueType type); + void storeResult(QString name, SpiceValueType type, QVariant value); + QVariant getStoredResult(QString name, SpiceValueType type); - void storeValue(IString key, int index, SpiceValueType type, + void storeValue(QString key, int index, SpiceValueType type, QVariant value); - QVariant readStoredValue(IString key, SpiceValueType type, int index); + QVariant readStoredValue(QString key, SpiceValueType type, int index); // Leave these protected so that inheriting classes don't // have to convert between double and spicedouble @@ -353,7 +353,7 @@ namespace Isis { Longitude *m_solarLongitude; //!< Body rotation solar longitude value iTime *m_et; //!< Ephemeris time (read NAIF documentation for a detailed description) - QVector * m_kernels; //!< Vector containing kernels filenames + QVector * m_kernels; //!< Vector containing kernels filenames Target *m_target; //!< Target of the observation // cache stuff diff --git a/isis/src/base/objs/Spice/getSpkAbCorrState.hpp b/isis/src/base/objs/Spice/getSpkAbCorrState.hpp index 7182c01b36..7377d68b2c 100644 --- a/isis/src/base/objs/Spice/getSpkAbCorrState.hpp +++ b/isis/src/base/objs/Spice/getSpkAbCorrState.hpp @@ -50,15 +50,15 @@ namespace Isis { abcorr = ""; // Retrieve list of loaded SPKs from Kernel object - std::vector spks = kernels.getKernelList("SPK"); - for ( unsigned int k = 0 ; k < spks.size() ; k++ ) { - std::string spkFile = spks[k]; + QStringList spks = kernels.getKernelList("SPK"); + for ( int k = 0 ; k < spks.size() ; k++ ) { + QString spkFile = spks[k]; SpiceChar ktype[32]; SpiceChar source[128]; SpiceInt handle; SpiceBoolean found; // Get info on SPK kernel mainly the NAIF handle for comment parsing - kinfo_c(spkFile.c_str(), sizeof(ktype), sizeof(source), ktype, + kinfo_c(spkFile.toAscii().data(), sizeof(ktype), sizeof(source), ktype, source, &handle, &found); if (found == SPICETRUE) { // SPK is open so read and parse all the comments. diff --git a/isis/src/base/objs/Spice/unitTest.cpp b/isis/src/base/objs/Spice/unitTest.cpp index 78d0f2e927..081f5dd990 100644 --- a/isis/src/base/objs/Spice/unitTest.cpp +++ b/isis/src/base/objs/Spice/unitTest.cpp @@ -62,15 +62,15 @@ class MySpice : public Spice { cout << endl; } - int MyInteger(string key) { + int MyInteger(QString key) { return getInteger(key, 0); } - double MyDouble(string key) { + double MyDouble(QString key) { return getDouble(key, 0); } - string MyString(string key) { + QString MyString(QString key) { return getString(key, 0); } @@ -109,8 +109,8 @@ int main(int argc, char *argv[]) { PvlGroup kern("Kernels"); FileName f("$base/testData/kernels"); - string dir = f.expanded() + "/"; - kern += PvlKeyword("NaifFrameCode", -94031); + QString dir = f.expanded() + "/"; + kern += PvlKeyword("NaifFrameCode", "-94031"); kern += PvlKeyword("LeapSecond", dir + "naif0007.tls"); kern += PvlKeyword("SpacecraftClock", dir + "MGS_SCLKSCET.00045.tsc"); kern += PvlKeyword("TargetPosition", dir + "de405.bsp"); @@ -126,8 +126,8 @@ int main(int argc, char *argv[]) { double endTime = -69382512.0; double slope = (endTime - startTime) / (10 - 1); - kern += PvlKeyword("StartPadding", slope); - kern += PvlKeyword("EndPadding", slope); + kern += PvlKeyword("StartPadding", toString(slope)); + kern += PvlKeyword("EndPadding", toString(slope)); Pvl lab; lab.AddGroup(inst); diff --git a/isis/src/base/objs/SpicePosition/SpicePosition.cpp b/isis/src/base/objs/SpicePosition/SpicePosition.cpp index b8f5e8d4f3..a31ec53086 100644 --- a/isis/src/base/objs/SpicePosition/SpicePosition.cpp +++ b/isis/src/base/objs/SpicePosition/SpicePosition.cpp @@ -176,8 +176,8 @@ namespace Isis { * parameters options in the NAIF spkezX functions. * */ - void SpicePosition::SetAberrationCorrection(const std::string &correction) { - QString abcorr(correction.c_str()); + void SpicePosition::SetAberrationCorrection(const QString &correction) { + QString abcorr(correction); abcorr.remove(QChar(' ')); abcorr = abcorr.toUpper(); QStringList validAbcorr; @@ -185,10 +185,10 @@ namespace Isis { << "XLT" << "XLT+S" << "XCN" << "XCN+S"; if (validAbcorr.indexOf(abcorr) >= 0) { - p_aberrationCorrection = abcorr.toStdString(); + p_aberrationCorrection = abcorr; } else { - std::string msg = "Invalid abberation correction [" + correction + "]"; + QString msg = "Invalid abberation correction [" + correction + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -203,7 +203,7 @@ namespace Isis { * * @author 2012-10-29 Kris Becker */ - std::string SpicePosition::GetAberrationCorrection() const { + QString SpicePosition::GetAberrationCorrection() const { return (p_aberrationCorrection); } @@ -287,17 +287,17 @@ namespace Isis { void SpicePosition::LoadCache(double startTime, double endTime, int size) { // Make sure cache isn't already loaded if(p_source == Memcache || p_source == HermiteCache) { - std::string msg = "A SpicePosition cache has already been created"; + QString msg = "A SpicePosition cache has already been created"; throw IException(IException::Programmer, msg, _FILEINFO_); } if(startTime > endTime) { - std::string msg = "Argument startTime must be less than or equal to endTime"; + QString msg = "Argument startTime must be less than or equal to endTime"; throw IException(IException::Programmer, msg, _FILEINFO_); } if((startTime != endTime) && (size == 1)) { - std::string msg = "Cache size must be more than 1 if startTime endTime differ"; + QString msg = "Cache size must be more than 1 if startTime endTime differ"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -363,19 +363,19 @@ namespace Isis { // Make sure cache isn't alread loaded if(p_source == Memcache || p_source == HermiteCache) { - std::string msg = "A SpicePosition cache has already been created"; + QString msg = "A SpicePosition cache has already been created"; throw IException(IException::Programmer, msg, _FILEINFO_); } // Load the full cache time information from the label if available if(table.Label().HasKeyword("SpkTableStartTime")) { - p_fullCacheStartTime = table.Label().FindKeyword("SpkTableStartTime")[0]; + p_fullCacheStartTime = toDouble(table.Label().FindKeyword("SpkTableStartTime")[0]); } if(table.Label().HasKeyword("SpkTableEndTime")) { - p_fullCacheEndTime = table.Label().FindKeyword("SpkTableEndTime")[0]; + p_fullCacheEndTime = toDouble(table.Label().FindKeyword("SpkTableEndTime")[0]); } if(table.Label().HasKeyword("SpkTableOriginalSize")) { - p_fullCacheSize = table.Label().FindKeyword("SpkTableOriginalSize")[0]; + p_fullCacheSize = toDouble(table.Label().FindKeyword("SpkTableOriginalSize")[0]); } @@ -412,7 +412,7 @@ namespace Isis { p_hasVelocity = false; } else { - std::string msg = "Expecting four or seven fields in the SpicePosition table"; + QString msg = "Expecting four or seven fields in the SpicePosition table"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -476,7 +476,7 @@ namespace Isis { * p_source and will be read by LoadCache(Table). * @history 2011-01-05 Debbie A. Cook - Added PolyFunction */ - Table SpicePosition::Cache(const std::string &tableName) { + Table SpicePosition::Cache(const QString &tableName) { if (p_source == PolyFunctionOverHermiteConstant) { LineCache(tableName); // TODO Figure out how to get the tolerance -- for now hard code .01 @@ -588,7 +588,7 @@ namespace Isis { */ void SpicePosition::CacheLabel(Table &table) { // determine type of table to return - std::string tabletype = ""; + QString tabletype = ""; if(p_source == Memcache) { tabletype = "Linear"; @@ -605,15 +605,15 @@ namespace Isis { // Write original time coverage if(p_fullCacheStartTime != 0) { table.Label() += PvlKeyword("SpkTableStartTime"); - table.Label()["SpkTableStartTime"].AddValue(p_fullCacheStartTime); + table.Label()["SpkTableStartTime"].AddValue(toString(p_fullCacheStartTime)); } if(p_fullCacheEndTime != 0) { table.Label() += PvlKeyword("SpkTableEndTime"); - table.Label()["SpkTableEndTime"].AddValue(p_fullCacheEndTime); + table.Label()["SpkTableEndTime"].AddValue(toString(p_fullCacheEndTime)); } if(p_fullCacheSize != 0) { table.Label() += PvlKeyword("SpkTableOriginalSize"); - table.Label()["SpkTableOriginalSize"].AddValue(p_fullCacheSize); + table.Label()["SpkTableOriginalSize"].AddValue(toString(p_fullCacheSize)); } } @@ -632,13 +632,13 @@ namespace Isis { * @history 2012-01-25 Debbie A. Cook - Modified error checking for p_source * to allow all function sources (>=HermiteCache) */ - Table SpicePosition::LineCache(const std::string &tableName) { + Table SpicePosition::LineCache(const QString &tableName) { // Apply the function and fill the caches if(p_source >= HermiteCache) ReloadCache(); if(p_source != Memcache) { - std::string msg = "Only cached positions can be returned as a line cache of positions and time"; + QString msg = "Only cached positions can be returned as a line cache of positions and time"; throw IException(IException::Programmer, msg, _FILEINFO_); } // Load the table and return it to caller @@ -665,7 +665,7 @@ namespace Isis { // Make sure source is a function if(p_source < HermiteCache) { - std::string msg = "The SpicePosition has not yet been fit to a function"; + QString msg = "The SpicePosition has not yet been fit to a function"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -717,7 +717,7 @@ namespace Isis { * from the polynomial function. * */ - Table SpicePosition::LoadHermiteCache(const std::string &tableName) { + Table SpicePosition::LoadHermiteCache(const QString &tableName) { // find the first and last time values double firstTime = p_fullCacheStartTime; double lastTime = p_fullCacheEndTime; @@ -736,7 +736,7 @@ namespace Isis { // Make sure a polynomial function is already loaded if(p_source != PolyFunction) { - std::string msg = "A SpicePosition polynomial function has not been created yet"; + QString msg = "A SpicePosition polynomial function has not been created yet"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1093,7 +1093,7 @@ namespace Isis { int coordIndex = partialVar; // if(coeffIndex > 2) { -// std::string msg = "SpicePosition only supports up to a 2nd order fit for the spacecraft position"; +// QString msg = "SpicePosition only supports up to a 2nd order fit for the spacecraft position"; // throw IException(IException::Programmer, msg, _FILEINFO_); // } // @@ -1181,7 +1181,7 @@ namespace Isis { return p_velocity; } else { - std::string msg = "No velocity vector available"; + QString msg = "No velocity vector available"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -1861,16 +1861,16 @@ namespace Isis { * if applicable */ void SpicePosition::computeStateVector(double et, int target, int observer, - const std::string &refFrame, - const std::string &abcorr, + const QString &refFrame, + const QString &abcorr, double state[6], bool &hasVelocity, double &lightTime) const { // First try getting the entire state (including the velocity vector) hasVelocity = true; lightTime = 0.0; - spkez_c((SpiceInt) target, (SpiceDouble) et, refFrame.c_str(), - abcorr.c_str(), (SpiceInt) observer, state, &lightTime); + spkez_c((SpiceInt) target, (SpiceDouble) et, refFrame.toAscii().data(), + abcorr.toAscii().data(), (SpiceInt) observer, state, &lightTime); // If Naif fails attempting to get the entire state, assume the velocity vector is // not available and just get the position. First turn off Naif error reporting and @@ -1880,8 +1880,8 @@ namespace Isis { if ( spfailure ) { hasVelocity = false; lightTime = 0.0; - spkezp_c((SpiceInt) target, (SpiceDouble) et, refFrame.c_str(), - abcorr.c_str(), (SpiceInt) observer, state, &lightTime); + spkezp_c((SpiceInt) target, (SpiceDouble) et, refFrame.toAscii().data(), + abcorr.toAscii().data(), (SpiceInt) observer, state, &lightTime); } return; diff --git a/isis/src/base/objs/SpicePosition/SpicePosition.h b/isis/src/base/objs/SpicePosition/SpicePosition.h index a8eea1ab5f..7f35872c62 100644 --- a/isis/src/base/objs/SpicePosition/SpicePosition.h +++ b/isis/src/base/objs/SpicePosition/SpicePosition.h @@ -190,8 +190,8 @@ namespace Isis { void SetTimeBias(double timeBias); double GetTimeBias() const; - virtual void SetAberrationCorrection(const std::string &correction); - virtual std::string GetAberrationCorrection() const; + virtual void SetAberrationCorrection(const QString &correction); + virtual QString GetAberrationCorrection() const; double GetLightTime() const; const std::vector &SetEphemerisTime(double et); @@ -221,13 +221,13 @@ namespace Isis { void LoadCache(double time); void LoadCache(Table &table); - Table LineCache(const std::string &tableName); - Table LoadHermiteCache(const std::string &tableName); + Table LineCache(const QString &tableName); + Table LoadHermiteCache(const QString &tableName); void ReloadCache(); void ReloadCache(Table &table); - Table Cache(const std::string &tableName); + Table Cache(const QString &tableName); //! Is this position cached bool IsCached() const { @@ -292,8 +292,8 @@ namespace Isis { int getTargetCode() const; double getAdjustedEphemerisTime() const; void computeStateVector(double et, int target, int observer, - const std::string &refFrame, - const std::string &abcorr, + const QString &refFrame, + const QString &abcorr, double state[6], bool &hasVelocity, double &lightTime) const; void setStateVector(const double state[6], const bool &hasVelocity); @@ -312,7 +312,7 @@ namespace Isis { int p_observerCode; //!< observer body code double p_timeBias; //!< iTime bias when reading kernels - std::string p_aberrationCorrection; //!< Light time correction to apply + QString p_aberrationCorrection; //!< Light time correction to apply double p_et; //!< Current ephemeris time std::vector p_coordinate; //!< J2000 position at time et diff --git a/isis/src/base/objs/SpicePosition/unitTest.cpp b/isis/src/base/objs/SpicePosition/unitTest.cpp index ad3bdd6ea8..2ee8304ada 100644 --- a/isis/src/base/objs/SpicePosition/unitTest.cpp +++ b/isis/src/base/objs/SpicePosition/unitTest.cpp @@ -1,34 +1,37 @@ #include #include -#include "SpicePosition.h" + #include "FileName.h" +#include "IString.h" #include "Preference.h" +#include "SpicePosition.h" #include "Table.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << setprecision(8); cout << "Unit test for SpicePosition" << endl; // Test case is taken from moc red wide angle image ab102401 // sn = MGS/561812335:32/MOC-WA/RED - Isis::FileName f("$base/testData/kernels"); - string dir = f.expanded() + "/"; - string moc(dir + "moc.bsp"); - string de(dir + "de405.bsp"); - string pck(dir + "pck00006.tpc"); - furnsh_c(moc.c_str()); - furnsh_c(de.c_str()); - furnsh_c(pck.c_str()); + FileName f("$base/testData/kernels"); + QString dir = f.expanded() + "/"; + QString moc(dir + "moc.bsp"); + QString de(dir + "de405.bsp"); + QString pck(dir + "pck00006.tpc"); + furnsh_c(moc.toAscii().data()); + furnsh_c(de.toAscii().data()); + furnsh_c(pck.toAscii().data()); double startTime = -69382819.0; double endTime = -69382512.0; double slope = (endTime - startTime) / (10 - 1); - Isis::SpicePosition pos(-94, 499); + SpicePosition pos(-94, 499); // Normal testing (no cache) cout << "Testing without cache ... " << endl; @@ -58,8 +61,8 @@ int main(int argc, char *argv[]) { // Test table options cout << "Testing tables ... " << endl; - Isis::Table tab = pos.Cache("Test"); - Isis::SpicePosition pos2(-94, 499); + Table tab = pos.Cache("Test"); + SpicePosition pos2(-94, 499); pos2.LoadCache(tab); for(int i = 0; i < 10; i++) { double t = startTime + (double) i * slope; @@ -96,7 +99,7 @@ int main(int argc, char *argv[]) { // Now use LineCache method cout << "Testing line cache..." << endl; tab = pos.LineCache("Test2"); - Isis::SpicePosition pos3(-94, 499); + SpicePosition pos3(-94, 499); pos3.LoadCache(tab); for (int i=0; i<10; i++) { @@ -125,30 +128,30 @@ int main(int argc, char *argv[]) { // Test Hermite input cout << "Testing Hermite function input ..." << endl; - Isis::SpicePosition pos4(-94, 499); + SpicePosition pos4(-94, 499); // Build a Hermite table - Isis::TableRecord record; + TableRecord record; // add x,y,z position labels to record - Isis::TableField x("J2000X", Isis::TableField::Double); - Isis::TableField y("J2000Y", Isis::TableField::Double); - Isis::TableField z("J2000Z", Isis::TableField::Double); + TableField x("J2000X", TableField::Double); + TableField y("J2000Y", TableField::Double); + TableField z("J2000Z", TableField::Double); record += x; record += y; record += z; // add x,y,z velocity labels to record - Isis::TableField vx("J2000XV", Isis::TableField::Double); - Isis::TableField vy("J2000YV", Isis::TableField::Double); - Isis::TableField vz("J2000ZV", Isis::TableField::Double); + TableField vx("J2000XV", TableField::Double); + TableField vy("J2000YV", TableField::Double); + TableField vz("J2000ZV", TableField::Double); record += vx; record += vy; record += vz; // add time label to record - Isis::TableField t("ET", Isis::TableField::Double); + TableField t("ET", TableField::Double); record += t; // create input table with 6 nodes - Isis::Table table("InitialHermite", record); + Table table("InitialHermite", record); record[0] = -1728.9713397204; record[1] = -1562.6465460511; record[2] = 2691.9864927899; @@ -199,13 +202,13 @@ int main(int argc, char *argv[]) { table += record; // Add table label - table.Label() += Isis::PvlKeyword("CacheType", "HermiteSpline"); - table.Label() += Isis::PvlKeyword("SpkTableStartTime"); - table.Label()["SpkTableStartTime"].AddValue(-69382819.360519); - table.Label() += Isis::PvlKeyword("SpkTableEndTime"); - table.Label()["SpkTableEndTime"].AddValue(-69382512.160519); - table.Label() += Isis::PvlKeyword("SpkTableOriginalSize"); - table.Label()["SpkTableOriginalSize"].AddValue(769); + table.Label() += PvlKeyword("CacheType", "HermiteSpline"); + table.Label() += PvlKeyword("SpkTableStartTime"); + table.Label()["SpkTableStartTime"].AddValue(toString(-69382819.360519)); + table.Label() += PvlKeyword("SpkTableEndTime"); + table.Label()["SpkTableEndTime"].AddValue(toString(-69382512.160519)); + table.Label() += PvlKeyword("SpkTableOriginalSize"); + table.Label()["SpkTableOriginalSize"].AddValue(toString(769)); // Load table into the object pos4.LoadCache(table); @@ -240,7 +243,7 @@ int main(int argc, char *argv[]) { abcPos3.push_back(0.0); abcPos3.push_back(0.0); pos4.SetPolynomial(abcPos1, abcPos2, abcPos3, - Isis::SpicePosition::PolyFunctionOverHermiteConstant); + SpicePosition::PolyFunctionOverHermiteConstant); cout << "Source = " << pos.GetSource() << endl; for(int i = 0; i < 10; i++) { @@ -258,8 +261,8 @@ int main(int argc, char *argv[]) { cout << "Test fitting polynomial function over Hermite to new Hermite" << endl; // Fit new Hermite using existing Hermite and polynomial - Isis::Table table2 = pos4.Cache("OutputHermite"); - Isis::SpicePosition pos5(-94, 499); + Table table2 = pos4.Cache("OutputHermite"); + SpicePosition pos5(-94, 499); // Load table2 into the object pos5.LoadCache(table2); diff --git a/isis/src/base/objs/SpiceRotation/SpiceRotation.cpp b/isis/src/base/objs/SpiceRotation/SpiceRotation.cpp index 86b6491e58..a04eecf1b9 100644 --- a/isis/src/base/objs/SpiceRotation/SpiceRotation.cpp +++ b/isis/src/base/objs/SpiceRotation/SpiceRotation.cpp @@ -94,15 +94,15 @@ namespace Isis { p_fullCacheSize = 0; // Determine the axis for the velocity vector - std::string key = "INS" + Isis::IString(frameCode) + "_TRANSX"; + QString key = "INS" + toString(frameCode) + "_TRANSX"; SpiceDouble transX[2]; SpiceInt number; SpiceBoolean found; //Read starting at element 1 (skipping element 0) - gdpool_c(key.c_str(), 1, 2, &number, transX, &found); + gdpool_c(key.toAscii().data(), 1, 2, &number, transX, &found); if(!found) { - std::string msg = "Cannot find [" + key + "] in text kernels"; + QString msg = "Cannot find [" + key + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -239,23 +239,23 @@ namespace Isis { // Check for valid arguments if(size <= 0) { - std::string msg = "Argument cacheSize must not be less or equal to zero"; + QString msg = "Argument cacheSize must not be less or equal to zero"; throw IException(IException::Programmer, msg, _FILEINFO_); } if(startTime > endTime) { - std::string msg = "Argument startTime must be less than or equal to endTime"; + QString msg = "Argument startTime must be less than or equal to endTime"; throw IException(IException::Programmer, msg, _FILEINFO_); } if((startTime != endTime) && (size == 1)) { - std::string msg = "Cache size must be more than 1 if startTime endTime differ"; + QString msg = "Cache size must be more than 1 if startTime endTime differ"; throw IException(IException::Programmer, msg, _FILEINFO_); } // Make sure cache isn't already loaded if(p_source == Memcache) { - std::string msg = "A SpiceRotation cache has already been created"; + QString msg = "A SpiceRotation cache has already been created"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -336,7 +336,7 @@ namespace Isis { if(table.Label().HasKeyword("TimeDependentFrames")) { PvlKeyword labelTimeFrames = table.Label()["TimeDependentFrames"]; for(int i = 0; i < labelTimeFrames.Size(); i++) { - p_timeFrames.push_back(labelTimeFrames[i]); + p_timeFrames.push_back(toInt(labelTimeFrames[i])); } } else { @@ -349,12 +349,12 @@ namespace Isis { p_constantFrames.clear(); for(int i = 0; i < labelConstantFrames.Size(); i++) { - p_constantFrames.push_back(labelConstantFrames[i]); + p_constantFrames.push_back(toInt(labelConstantFrames[i])); } PvlKeyword labelConstantRotation = table.Label()["ConstantRotation"]; for(int i = 0; i < labelConstantRotation.Size(); i++) { - p_TC.push_back(labelConstantRotation[i]); + p_TC.push_back(toDouble(labelConstantRotation[i])); } } else { @@ -364,13 +364,13 @@ namespace Isis { // Load the full cache time information from the label if available if(table.Label().HasKeyword("CkTableStartTime")) { - p_fullCacheStartTime = table.Label().FindKeyword("CkTableStartTime")[0]; + p_fullCacheStartTime = toDouble(table.Label().FindKeyword("CkTableStartTime")[0]); } if(table.Label().HasKeyword("CkTableEndTime")) { - p_fullCacheEndTime = table.Label().FindKeyword("CkTableEndTime")[0]; + p_fullCacheEndTime = toDouble(table.Label().FindKeyword("CkTableEndTime")[0]); } if(table.Label().HasKeyword("CkTableOriginalSize")) { - p_fullCacheSize = table.Label().FindKeyword("CkTableOriginalSize")[0]; + p_fullCacheSize = toInt(table.Label().FindKeyword("CkTableOriginalSize")[0]); } int recFields = table[0].Fields(); @@ -461,7 +461,7 @@ namespace Isis { if(degree == 0 && p_cacheAv.size() > 0) p_hasAngularVelocity = true; } else { - std::string msg = "Expecting either three, five, or eight fields in the SpiceRotation table"; + QString msg = "Expecting either three, five, or eight fields in the SpiceRotation table"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -528,7 +528,7 @@ namespace Isis { } } else { //(p_source < PolyFunction) - std::string msg = "The SpiceRotation has not yet been fit to a function"; + QString msg = "The SpiceRotation has not yet been fit to a function"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -549,13 +549,13 @@ namespace Isis { * * @param tableName Name of the table to create and return */ - Table SpiceRotation::LineCache(const std::string &tableName) { + Table SpiceRotation::LineCache(const QString &tableName) { // Apply the function and fill the caches if(p_source >= PolyFunction) ReloadCache(); if(p_source != Memcache) { - std::string msg = "Only cached rotations can be returned as a line cache of quaternions and time"; + QString msg = "Only cached rotations can be returned as a line cache of quaternions and time"; throw IException(IException::Programmer, msg, _FILEINFO_); } // Load the table and return it to caller @@ -580,7 +580,7 @@ namespace Isis { * * @param tableName Name of the table to create and return */ - Table SpiceRotation::Cache(const std::string &tableName) { + Table SpiceRotation::Cache(const QString &tableName) { // First handle conversion of PolyFunctionOverSpiceConstant // by converting it to the full Memcache and try to downsize it if (p_source == PolyFunctionOverSpice) { @@ -679,7 +679,7 @@ namespace Isis { } else { // throw an error -- should not get here -- invalid Spice Source - std::string msg = "To create table source of data must be either Memcache or PolyFunction"; + QString msg = "To create table source of data must be either Memcache or PolyFunction"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -700,7 +700,7 @@ namespace Isis { table.Label() += PvlKeyword("TimeDependentFrames"); for(int i = 0; i < (int) p_timeFrames.size(); i++) { - table.Label()["TimeDependentFrames"].AddValue(p_timeFrames[i]); + table.Label()["TimeDependentFrames"].AddValue(toString(p_timeFrames[i])); } } @@ -708,28 +708,28 @@ namespace Isis { table.Label() += PvlKeyword("ConstantFrames"); for(int i = 0; i < (int) p_constantFrames.size(); i++) { - table.Label()["ConstantFrames"].AddValue(p_constantFrames[i]); + table.Label()["ConstantFrames"].AddValue(toString(p_constantFrames[i])); } table.Label() += PvlKeyword("ConstantRotation"); for(int i = 0; i < (int) p_TC.size(); i++) { - table.Label()["ConstantRotation"].AddValue(p_TC[i]); + table.Label()["ConstantRotation"].AddValue(toString(p_TC[i])); } } // Write original time coverage if(p_fullCacheStartTime != 0) { table.Label() += PvlKeyword("CkTableStartTime"); - table.Label()["CkTableStartTime"].AddValue(p_fullCacheStartTime); + table.Label()["CkTableStartTime"].AddValue(toString(p_fullCacheStartTime)); } if(p_fullCacheEndTime != 0) { table.Label() += PvlKeyword("CkTableEndTime"); - table.Label()["CkTableEndTime"].AddValue(p_fullCacheEndTime); + table.Label()["CkTableEndTime"].AddValue(toString(p_fullCacheEndTime)); } if(p_fullCacheSize != 0) { table.Label() += PvlKeyword("CkTableOriginalSize"); - table.Label()["CkTableOriginalSize"].AddValue(p_fullCacheSize); + table.Label()["CkTableOriginalSize"].AddValue(toString(p_fullCacheSize)); } NaifStatus::CheckErrors(); } @@ -860,7 +860,7 @@ namespace Isis { if(p_source == PolyFunction) { // Nothing to do return; -// std::string msg = "Rotation already fit to a polynomial -- spiceint first to refit"; +// QString msg = "Rotation already fit to a polynomial -- spiceint first to refit"; // throw IException(IException::User,msg,_FILEINFO_); } @@ -1288,7 +1288,7 @@ namespace Isis { */ void SpiceRotation::SetAxes(int axis1, int axis2, int axis3) { if(axis1 < 1 || axis2 < 1 || axis3 < 1 || axis1 > 3 || axis2 > 3 || axis3 > 3) { - std::string msg = "A rotation axis is outside the valid range of 1 to 3"; + QString msg = "A rotation axis is outside the valid range of 1 to 3"; throw IException(IException::Programmer, msg, _FILEINFO_); } p_axis1 = axis1; @@ -1414,7 +1414,7 @@ namespace Isis { // Don't read type 5 ck here if(ic[2] == 5) break; if(ic[2] != 3) { - std::string msg = "Time fetching method only works on type 3 and 5 ck"; + QString msg = "Time fetching method only works on type 3 and 5 ck"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1431,7 +1431,7 @@ namespace Isis { // Check for a gap in the time coverage by making sure the time span of the observation does not // cross a segment unless the next segment starts where the current one ends if(observationSpansToNextSegment && currentTime > segStartEt) { - std::string msg = "Observation crosses segment boundary--unable to interpolate pointing"; + QString msg = "Observation crosses segment boundary--unable to interpolate pointing"; throw IException(IException::Programmer, msg, _FILEINFO_); } if(observEnd > segStopEt) { @@ -1491,7 +1491,7 @@ namespace Isis { } } else if(count == 0 && p_source != Nadir && p_minimizeCache == Yes) { - std::string msg = "No camera kernels loaded...Unable to determine time cache to downsize"; + QString msg = "No camera kernels loaded...Unable to determine time cache to downsize"; throw IException(IException::User, msg, _FILEINFO_); } @@ -1515,7 +1515,7 @@ namespace Isis { // No time cache was initialized -- throw an error if(p_fullCacheSize < 1) { - std::string msg = "Time cache not available -- rerun spiceinit"; + QString msg = "Time cache not available -- rerun spiceinit"; throw IException(IException::User, msg, _FILEINFO_); } @@ -1557,7 +1557,7 @@ namespace Isis { break; } - std::string msg = "The frame" + IString((int) frameCodes[frmidx]) + " is not supported by Naif"; + QString msg = "The frame" + toString((int) frameCodes[frmidx]) + " is not supported by Naif"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1577,7 +1577,7 @@ namespace Isis { break; } - std::string msg = "The ck rotation from frame " + IString(frameCodes[frmidx]) + " can not be found" + QString msg = "The ck rotation from frame " + toString(frameCodes[frmidx]) + " can not be found" + " due to no pointing available at requested time or a problem with the frame"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1585,7 +1585,7 @@ namespace Isis { else if(type == TK) { tkfram_((SpiceInt *) &typid, (double *) matrix, &nextFrame, (logical *) &found); if(!found) { - std::string msg = "The tk rotation from frame " + IString(frameCodes[frmidx]) + " can not be found"; + QString msg = "The tk rotation from frame " + toString(frameCodes[frmidx]) + " can not be found"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -1600,8 +1600,8 @@ namespace Isis { } else { - std::string msg = "The frame " + IString(frameCodes[frmidx]) + - " has a type " + IString(type) + " not supported by your version of Naif Spicelib." + + QString msg = "The frame " + toString(frameCodes[frmidx]) + + " has a type " + toString(type) + " not supported by your version of Naif Spicelib." + "You need to update."; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -1708,7 +1708,7 @@ namespace Isis { // Make sure the angles have been fit to polynomials if(p_source < PolyFunction) { - std::string msg = "The SpiceRotation pointing angles must be fit to polynomials in order to compute angular velocity"; + QString msg = "The SpiceRotation pointing angles must be fit to polynomials in order to compute angular velocity"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/base/objs/SpiceRotation/SpiceRotation.h b/isis/src/base/objs/SpiceRotation/SpiceRotation.h index cffb111f37..34055f3a2c 100644 --- a/isis/src/base/objs/SpiceRotation/SpiceRotation.h +++ b/isis/src/base/objs/SpiceRotation/SpiceRotation.h @@ -246,11 +246,11 @@ namespace Isis { void LoadCache(Table &table); - Table LineCache(const std::string &tableName); + Table LineCache(const QString &tableName); void ReloadCache(); - Table Cache(const std::string &tableName); + Table Cache(const QString &tableName); void CacheLabel(Table &table); void LoadTimeCache(); diff --git a/isis/src/base/objs/SpiceRotation/unitTest.cpp b/isis/src/base/objs/SpiceRotation/unitTest.cpp index 703fcc2477..6a9aa42cf5 100644 --- a/isis/src/base/objs/SpiceRotation/unitTest.cpp +++ b/isis/src/base/objs/SpiceRotation/unitTest.cpp @@ -19,25 +19,25 @@ int main(int argc, char *argv[]) { // Test case is taken from moc red wide angle image ab102401 // sn = MGS/561812335:32/MOC-WA/RED Isis::FileName f("$base/testData/kernels"); - string dir = f.expanded() + "/"; - string naif(dir + "naif0007.tls"); - string mgs(dir + "MGS_SCLKSCET.00045.tsc"); - string mocti(dir + "moc13.ti"); - string mocbc(dir + "moc.bc"); - string mocbsp(dir + "moc.bsp"); - string de(dir + "de405.bsp"); - string pck(dir + "pck00006.tpc"); - //string mocadd(dir+"mocAddendum.ti"); - string mocspice(dir + "mocSpiceRotationUnitTest.ti"); - furnsh_c(naif.c_str()); - furnsh_c(mgs.c_str()); - furnsh_c(mocti.c_str()); - furnsh_c(mocbc.c_str()); - furnsh_c(mocbsp.c_str()); - furnsh_c(de.c_str()); - furnsh_c(pck.c_str()); -// furnsh_c(mocadd.c_str()); - furnsh_c(mocspice.c_str()); + QString dir = f.expanded() + "/"; + QString naif(dir + "naif0007.tls"); + QString mgs(dir + "MGS_SCLKSCET.00045.tsc"); + QString mocti(dir + "moc13.ti"); + QString mocbc(dir + "moc.bc"); + QString mocbsp(dir + "moc.bsp"); + QString de(dir + "de405.bsp"); + QString pck(dir + "pck00006.tpc"); + //QString mocadd(dir+"mocAddendum.ti"); + QString mocspice(dir + "mocSpiceRotationUnitTest.ti"); + furnsh_c(naif.toAscii().data()); + furnsh_c(mgs.toAscii().data()); + furnsh_c(mocti.toAscii().data()); + furnsh_c(mocbc.toAscii().data()); + furnsh_c(mocbsp.toAscii().data()); + furnsh_c(de.toAscii().data()); + furnsh_c(pck.toAscii().data()); +// furnsh_c(mocadd.toAscii().data()); + furnsh_c(mocspice.toAscii().data()); double startTime = -69382819.0; double endTime = -69382512.0; diff --git a/isis/src/base/objs/StandardDeviationOperator/StandardDeviationOperator.h b/isis/src/base/objs/StandardDeviationOperator/StandardDeviationOperator.h index 59def97031..019b363020 100644 --- a/isis/src/base/objs/StandardDeviationOperator/StandardDeviationOperator.h +++ b/isis/src/base/objs/StandardDeviationOperator/StandardDeviationOperator.h @@ -1,4 +1,4 @@ -#if !defined(StandardDeviationOperator_h) +#ifndef StandardDeviationOperator_h #define StandardDeviationOperator_h /** * @file diff --git a/isis/src/base/objs/StandardDeviationOperator/unitTest.cpp b/isis/src/base/objs/StandardDeviationOperator/unitTest.cpp index 7f173783c4..6032a6895b 100644 --- a/isis/src/base/objs/StandardDeviationOperator/unitTest.cpp +++ b/isis/src/base/objs/StandardDeviationOperator/unitTest.cpp @@ -18,21 +18,21 @@ int main() { try { PvlGroup op("Operator"); op += PvlKeyword("Name", "StandardDeviation"); - op += PvlKeyword("DeltaLine", 100); - op += PvlKeyword("DeltaSamp", 100); - op += PvlKeyword("Samples", 15); - op += PvlKeyword("Lines", 15); - op += PvlKeyword("MinimumDN", 0.0); - op += PvlKeyword("MaximumDN", 1.0); - op += PvlKeyword("MinimumInterest", 0.01); + op += PvlKeyword("DeltaLine", "100"); + op += PvlKeyword("DeltaSamp", "100"); + op += PvlKeyword("Samples", "15"); + op += PvlKeyword("Lines", "15"); + op += PvlKeyword("MinimumDN", "0.0"); + op += PvlKeyword("MaximumDN", "1.0"); + op += PvlKeyword("MinimumInterest", "0.01"); PvlGroup opv("ValidMeasure"); - opv += PvlKeyword("MinDN", 0.0); - opv += PvlKeyword("MaxDN", 1.0); - opv += PvlKeyword("MinEmission", 15.0); - opv += PvlKeyword("MaxEmission", 25.0); - opv += PvlKeyword("MinIncidence", 0.0); - opv += PvlKeyword("MaxIncidence", 135.0); + opv += PvlKeyword("MinDN", "0.0"); + opv += PvlKeyword("MaxDN", "1.0"); + opv += PvlKeyword("MinEmission", "15.0"); + opv += PvlKeyword("MaxEmission", "25.0"); + opv += PvlKeyword("MinIncidence", "0.0"); + opv += PvlKeyword("MaxIncidence", "135.0"); PvlObject o("InterestOperator"); o.AddGroup(op); diff --git a/isis/src/base/objs/Stretch/Stretch.cpp b/isis/src/base/objs/Stretch/Stretch.cpp index 8a4e606cfd..a1583d0a82 100644 --- a/isis/src/base/objs/Stretch/Stretch.cpp +++ b/isis/src/base/objs/Stretch/Stretch.cpp @@ -21,6 +21,9 @@ */ #include + +#include + #include "Stretch.h" #include "Histogram.h" #include "IString.h" @@ -154,25 +157,27 @@ namespace Isis { * @return std::pair of doubles where first is the first input and * second is the first output */ - std::pair Stretch::NextPair(Isis::IString &pairs) { + std::pair Stretch::NextPair(QString &pairs) { std::pair io; + io.first = Null; + io.second = Null; - // do input side - Isis::IString temp = pairs.Token(":"); - temp.Trim(" \t\r\n\v\f"); - io.first = temp.ToDouble(); + pairs = pairs.simplified().trimmed(); - // do output side but first check for empty string - if(pairs.length() == 0) { - throw IException(IException::User, "Invalid stretch pairs [" + - pairs + "]", _FILEINFO_); - } - pairs.TrimHead(" \t\r\n\v\f"); - temp = pairs.Token(" \t\r\n\v\f"); - io.second = temp.ToDouble(); + if (pairs.contains(":")) { + QStringList pairList = pairs.split(" "); - // trim so p will return empty if it should - pairs.TrimHead(" \t\r\n\v\f"); + QString firstPair = pairList.takeFirst(); + + QStringList firstPairValues = firstPair.split(":"); + + if (firstPairValues.count() == 2) { + io.first = toDouble(firstPairValues.first()); + io.second = toDouble(firstPairValues.last()); + + pairs = pairList.join(" "); + } + } return io; } @@ -188,23 +193,25 @@ namespace Isis { * * @throws Isis::IException::User - invalid stretch pair */ - void Stretch::Parse(const std::string &pairs) { + void Stretch::Parse(const QString &pairs) { // Zero out the stretch arrays p_input.clear(); p_output.clear(); p_pairs = 0; - Isis::IString p(pairs); std::pair pear; - p.TrimHead(" \t\r\n\v\f"); + QString p = pairs.simplified().trimmed(); + p.replace(QRegExp("[\\s]*:"), ":"); + p.replace(QRegExp(":[\\s]*"), ":"); + QStringList pairList = p.split(" ", QString::SkipEmptyParts); + try { - while(p.size() > 0) { - pear = Stretch::NextPair(p); + foreach(QString singlePair, pairList) { + pear = Stretch::NextPair(singlePair); Stretch::AddPair(pear.first, pear.second); } } - catch(IException &e) { throw IException(e, IException::User, "Invalid stretch pairs [" + pairs + "]", _FILEINFO_); } @@ -223,20 +230,19 @@ namespace Isis { * * @throws Isis::IException::User - invalid stretch pair */ - void Stretch::Parse(const std::string &pairs, const Isis::Histogram *hist) { + void Stretch::Parse(const QString &pairs, const Isis::Histogram *hist) { // Zero out the stretch arrays p_input.clear(); p_output.clear(); p_pairs = 0; - Isis::IString p(pairs); + QString p(pairs); std::pair pear; // need to save the input dn values in order to // to detect collisions std::vector converted; - p.TrimHead(" \t\r\n\v\f"); try { while(p.size() > 0) { pear = Stretch::NextPair(p); @@ -274,15 +280,15 @@ namespace Isis { * * @return string The stretch pair as a string */ - string Stretch::Text() const { + QString Stretch::Text() const { if(p_pairs < 0) return ""; - Isis::IString p(""); + QString p(""); for(int i = 0; i < p_pairs; i++) { - p += Isis::IString(p_input[i]) + ":" + Isis::IString(p_output[i]) + " "; + p += toString(p_input[i]) + ":" + toString(p_output[i]) + " "; } - return p.TrimTail(" "); + return p.trimmed(); } /** @@ -329,7 +335,7 @@ namespace Isis { * @param grpName - The group name to get the input and output * keywords from */ - void Stretch::Load(std::string &file, std::string &grpName) { + void Stretch::Load(QString &file, QString &grpName) { Pvl pvl(file); Load(pvl, grpName); } @@ -348,17 +354,17 @@ namespace Isis { * @param grpName - The group name to get the input and output * keywords from */ - void Stretch::Load(Isis::Pvl &pvl, std::string &grpName) { + void Stretch::Load(Isis::Pvl &pvl, QString &grpName) { PvlGroup grp = pvl.FindGroup(grpName, Isis::PvlObject::Traverse); PvlKeyword inputs = grp.FindKeyword("Input"); PvlKeyword outputs = grp.FindKeyword("Output"); if(inputs.Size() != outputs.Size()) { - std::string msg = "Invalid Pvl file: The number of Input values must equal the number of Output values"; + QString msg = "Invalid Pvl file: The number of Input values must equal the number of Output values"; throw IException(IException::User, msg, _FILEINFO_); } for(int i = 0; i < inputs.Size(); i++) { - AddPair(inputs[i], outputs[i]); + AddPair(toDouble(inputs[i]), toDouble(outputs[i])); } } @@ -373,19 +379,19 @@ namespace Isis { * stretch pairs into. The group will contain * two keywords, Input, and Output. */ - void Stretch::Save(std::string &file, std::string &grpName) { + void Stretch::Save(QString &file, QString &grpName) { Pvl p; Save(p, grpName); p.Write(file); } - void Stretch::Save(Isis::Pvl &pvl, std::string &grpName) { + void Stretch::Save(Isis::Pvl &pvl, QString &grpName) { PvlGroup *grp = new PvlGroup(grpName); PvlKeyword inputs("Input"); PvlKeyword outputs("Output"); for(int i = 0; i < Pairs(); i++) { - inputs.AddValue(Input(i)); - outputs.AddValue(Output(i)); + inputs.AddValue(toString(Input(i))); + outputs.AddValue(toString(Output(i))); } grp->AddKeyword(inputs); grp->AddKeyword(outputs); diff --git a/isis/src/base/objs/Stretch/Stretch.h b/isis/src/base/objs/Stretch/Stretch.h index 6059f7f355..144bb41251 100644 --- a/isis/src/base/objs/Stretch/Stretch.h +++ b/isis/src/base/objs/Stretch/Stretch.h @@ -88,7 +88,7 @@ namespace Isis { double p_minimum; //! NextPair(Isis::IString &pairs); + std::pair NextPair(QString &pairs); public: Stretch(); @@ -160,17 +160,17 @@ namespace Isis { p_maximum = value; } - void Load(Pvl &pvl, std::string &grpName); - void Save(Pvl &pvl, std::string &grpName); - void Load(std::string &file, std::string &grpName); - void Save(std::string &file, std::string &grpName); + void Load(Pvl &pvl, QString &grpName); + void Save(Pvl &pvl, QString &grpName); + void Load(QString &file, QString &grpName); + void Save(QString &file, QString &grpName); double Map(const double value) const; - void Parse(const std::string &pairs); - void Parse(const std::string &pairs, const Isis::Histogram *hist); + void Parse(const QString &pairs); + void Parse(const QString &pairs, const Isis::Histogram *hist); - std::string Text() const; + QString Text() const; //! Returns the number of stretch pairs int Pairs() const { diff --git a/isis/src/base/objs/Stretch/unitTest.cpp b/isis/src/base/objs/Stretch/unitTest.cpp index 9d47be6cf5..05fba2d851 100644 --- a/isis/src/base/objs/Stretch/unitTest.cpp +++ b/isis/src/base/objs/Stretch/unitTest.cpp @@ -1,15 +1,20 @@ #include + +#include + #include "SpecialPixel.h" #include "Stretch.h" #include "IException.h" #include "Preference.h" #include "Histogram.h" +using namespace Isis; using namespace std; + int main() { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - Isis::Stretch s; + Stretch s; s.AddPair(0.0, 1.0); s.AddPair(0.25, 50.0); @@ -35,11 +40,11 @@ int main() { s.SetHrs(5.0); - cout << "Stretch(Null): " << s.Map(Isis::NULL8) << endl; - cout << "Stretch(Lis): " << s.Map(Isis::LOW_INSTR_SAT8) << endl; - cout << "Stretch(Lrs): " << s.Map(Isis::LOW_REPR_SAT8) << endl; - cout << "Stretch(His): " << s.Map(Isis::HIGH_INSTR_SAT8) << endl; - cout << "Stretch(Hrs): " << s.Map(Isis::HIGH_REPR_SAT8) << endl; + cout << "Stretch(Null): " << s.Map(NULL8) << endl; + cout << "Stretch(Lis): " << s.Map(LOW_INSTR_SAT8) << endl; + cout << "Stretch(Lrs): " << s.Map(LOW_REPR_SAT8) << endl; + cout << "Stretch(His): " << s.Map(HIGH_INSTR_SAT8) << endl; + cout << "Stretch(Hrs): " << s.Map(HIGH_REPR_SAT8) << endl; cout << endl; cout << "Stretch(-0.1): " << s.Map(-0.1) << endl; @@ -60,7 +65,7 @@ int main() { try { s.AddPair(1.0, 200.0); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } @@ -72,22 +77,22 @@ int main() { try { s.Parse("0:0 50:0 49:255 255:255"); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } try { s.Parse("-5xyzzy:0 50:0 100:255 255:255"); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } // test the Parse for when inputs are %'s cout << endl << "Testing new Parse that takes %'s for input side of pairs" << endl; - Isis::Histogram temp(0.0, 100.0, 101); - Isis::Histogram *h = &temp; + Histogram temp(0.0, 100.0, 101); + Histogram *h = &temp; for(double i = 0.0; i <= 100.0; i++) { h->AddData(&i, 1); } @@ -99,7 +104,7 @@ int main() { try { s.Parse("0:0 50:0 49:255 100:255", h); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } @@ -107,7 +112,7 @@ int main() { try { s.Parse("-5:10", h); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } @@ -115,7 +120,7 @@ int main() { try { s.Parse("121:215", h); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } @@ -123,30 +128,30 @@ int main() { try { s.Parse("-5xyzzy:0 50:0 100:255", h); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } try { s.ClearPairs(); - std::string fname = "unitTest.pvl"; - std::string grp = "Pairs"; + QString fname = "unitTest.pvl"; + QString grp = "Pairs"; s.Load(fname, grp); for(int i = 0; i < s.Pairs(); i++) { std::cout << s.Input(i) << ", " << s.Output(i) << std::endl; } std::cout << "testing save" << std::endl; - std::string output = "saveTest.pvl"; + QString output = "saveTest.pvl"; s.Save(output, grp); s.ClearPairs(); s.Load(output, grp); for(int i = 0; i < s.Pairs(); i++) { std::cout << s.Input(i) << ", " << s.Output(i) << std::endl; } - remove(output.c_str()); + QFile::remove(output); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } @@ -160,7 +165,7 @@ int main() { std::cout << s.Input(i) << ", " << s.Output(i) << std::endl; } - Isis::Stretch sCopy; + Stretch sCopy; sCopy.CopyPairs(s); std::cout << "copy stretch pairs" << std::endl; for(int i = 0; i < s.Pairs(); i++) { diff --git a/isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.cpp b/isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.cpp index fd2e3d33ca..8b4a06f8d6 100644 --- a/isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.cpp +++ b/isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.cpp @@ -73,8 +73,8 @@ namespace Isis { const geos::geom::Envelope *polyBoundBox = multiPoly->getEnvelopeInternal(); // Call the parents standardTests member - std::string msg = StandardTests(multiPoly, polyBoundBox); - if(!msg.empty()) { + QString msg = StandardTests(multiPoly, polyBoundBox); + if(!msg.isEmpty()) { return points; } @@ -141,7 +141,7 @@ namespace Isis { } } else { - std::string msg = "PVL for StripSeeder must contain [XSpacing] in ["; + QString msg = "PVL for StripSeeder must contain [XSpacing] in ["; msg += pvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -154,13 +154,13 @@ namespace Isis { } } else { - std::string msg = "PVL for StripSeeder must contain [YSpacing] in ["; + QString msg = "PVL for StripSeeder must contain [YSpacing] in ["; msg += pvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } } catch(IException &e) { - std::string msg = "Improper format for PolygonSeeder PVL [" + pvl.FileName() + "]"; + QString msg = "Improper format for PolygonSeeder PVL [" + pvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -174,14 +174,14 @@ namespace Isis { } } - PvlGroup StripPolygonSeeder::PluginParameters(std::string grpName) { + PvlGroup StripPolygonSeeder::PluginParameters(QString grpName) { PvlGroup pluginInfo(grpName); PvlKeyword name("Name", Algorithm()); - PvlKeyword minThickness("MinimumThickness", MinimumThickness()); - PvlKeyword minArea("MinimumArea", MinimumArea()); - PvlKeyword xSpac("XSpacing", p_Xspacing); - PvlKeyword ySpac("YSpacing", p_Yspacing); + PvlKeyword minThickness("MinimumThickness", toString(MinimumThickness())); + PvlKeyword minArea("MinimumArea", toString(MinimumArea())); + PvlKeyword xSpac("XSpacing", toString(p_Xspacing)); + PvlKeyword ySpac("YSpacing", toString(p_Yspacing)); pluginInfo.AddKeyword(name); pluginInfo.AddKeyword(minThickness); diff --git a/isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.h b/isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.h index 4aa9a1e7fd..41a2c8607c 100644 --- a/isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.h +++ b/isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.h @@ -60,7 +60,7 @@ namespace Isis { * @history 2010-04-15 Eric Hyer - Now updates parent's invalidInput * variable (see PolygonSeeder) * @history 2010-04-20 Christopher Austin - adapted for generic/unitless - * seeding + * seeding * @history 2010-05-05 Christopher Austin - Fixed major bug where the strip * was not a strip. */ @@ -73,7 +73,7 @@ namespace Isis { std::vector Seed(const geos::geom::MultiPolygon *mp); - virtual PvlGroup PluginParameters(std::string grpName); + virtual PvlGroup PluginParameters(QString grpName); protected: virtual void Parse(Pvl &pvl); diff --git a/isis/src/base/objs/StripPolygonSeeder/unitTest.cpp b/isis/src/base/objs/StripPolygonSeeder/unitTest.cpp index e8f0959507..914d35866a 100644 --- a/isis/src/base/objs/StripPolygonSeeder/unitTest.cpp +++ b/isis/src/base/objs/StripPolygonSeeder/unitTest.cpp @@ -30,10 +30,10 @@ int main() { if(!alg.HasKeyword("Name")) { cout << "Test without subgrid" << endl; alg += PvlKeyword("Name", "Strip"); - alg += PvlKeyword("MinimumThickness", 0.3); - alg += PvlKeyword("MinimumArea", 10); - alg += PvlKeyword("XSpacing", 1500); - alg += PvlKeyword("YSpacing", 1500); + alg += PvlKeyword("MinimumThickness", toString(0.3)); + alg += PvlKeyword("MinimumArea", toString(10)); + alg += PvlKeyword("XSpacing", toString(1500)); + alg += PvlKeyword("YSpacing", toString(1500)); } PvlObject o("AutoSeed"); @@ -74,13 +74,13 @@ int main() { Isis::Pvl maplab; maplab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = maplab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); - mapGroup += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapGroup += Isis::PvlKeyword("EquatorialRadius", (QString)radii["EquatorialRadius"]); + mapGroup += Isis::PvlKeyword("PolarRadius", (QString)radii["PolarRadius"]); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", toString(360)); + mapGroup += Isis::PvlKeyword("CenterLatitude", "0"); + mapGroup += Isis::PvlKeyword("CenterLongitude", "0"); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); Projection *proj = Isis::ProjectionFactory::Create(maplab); @@ -151,13 +151,13 @@ int main() { Isis::Pvl maplab; maplab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = maplab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); - mapGroup += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapGroup += Isis::PvlKeyword("EquatorialRadius", (QString)radii["EquatorialRadius"]); + mapGroup += Isis::PvlKeyword("PolarRadius", (QString)radii["PolarRadius"]); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", toString(360)); + mapGroup += Isis::PvlKeyword("CenterLatitude", toString(0)); + mapGroup += Isis::PvlKeyword("CenterLongitude", toString(0)); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); Projection *proj = Isis::ProjectionFactory::Create(maplab); diff --git a/isis/src/base/objs/SubArea/SubArea.cpp b/isis/src/base/objs/SubArea/SubArea.cpp index 7f91ad2510..c4e8868cff 100644 --- a/isis/src/base/objs/SubArea/SubArea.cpp +++ b/isis/src/base/objs/SubArea/SubArea.cpp @@ -166,9 +166,9 @@ namespace Isis { Projection &proj = *icube->getProjection(); proj.SetWorld(p_ss - 0.5, p_sl - 0.5); PvlGroup &mapgroup = inlabel.FindObject("IsisCube").FindGroup("Mapping", Pvl::Traverse); - mapgroup.AddKeyword(PvlKeyword("UpperLeftCornerX", proj.XCoord()), + mapgroup.AddKeyword(PvlKeyword("UpperLeftCornerX", toString(proj.XCoord())), Pvl::Replace); - mapgroup.AddKeyword(PvlKeyword("UpperLeftCornerY", proj.YCoord()), + mapgroup.AddKeyword(PvlKeyword("UpperLeftCornerY", toString(proj.YCoord())), Pvl::Replace); } @@ -176,13 +176,13 @@ namespace Isis { // mapping scale and resolution. if(p_linc == p_sinc && p_linc != 1.0) { PvlGroup &mapgroup = inlabel.FindObject("IsisCube").FindGroup("Mapping", Pvl::Traverse); - string pixresUnit = mapgroup["PixelResolution"].Unit(); - double pixres = mapgroup["PixelResolution"]; - mapgroup["PixelResolution"] = pixres * p_linc; + QString pixresUnit = mapgroup["PixelResolution"].Unit(); + double pixres = toDouble(mapgroup["PixelResolution"][0]); + mapgroup["PixelResolution"] = toString(pixres * p_linc); mapgroup["PixelResolution"].SetUnits(pixresUnit); - string scaleUnit = mapgroup["Scale"].Unit(); + QString scaleUnit = mapgroup["Scale"].Unit(); double scale = mapgroup["Scale"]; - mapgroup["Scale"] = scale / p_linc; + mapgroup["Scale"] = toString(scale / p_linc); mapgroup["Scale"].SetUnits(scaleUnit); } diff --git a/isis/src/base/objs/SubArea/unitTest.cpp b/isis/src/base/objs/SubArea/unitTest.cpp index 5cdb8c2629..f0bcb1a4ff 100644 --- a/isis/src/base/objs/SubArea/unitTest.cpp +++ b/isis/src/base/objs/SubArea/unitTest.cpp @@ -25,7 +25,7 @@ void IsisMain() { int onl, ons; p1.SetInputCube("FROM1"); - string from1 = ui.GetFileName("FROM1"); + QString from1 = ui.GetFileName("FROM1"); Cube inomapcube; inomapcube.open(from1); inl = inomapcube.getLineCount(); @@ -41,16 +41,16 @@ void IsisMain() { Cube *onomapcube = p1.SetOutputCube("TO", ons, onl, 1); PvlGroup results("Results"); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); SubArea s; s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); @@ -75,7 +75,7 @@ void IsisMain() { p1.EndProcess(); cout << "Output cube label: " << endl << endl; - string file = ui.GetFileName("TO"); + QString file = ui.GetFileName("TO"); Pvl label(file); cout << label.FindObject("IsisCube").FindObject("Core").FindGroup("Dimensions") << endl << endl; if(label.FindObject("IsisCube").HasGroup("Instrument")) { @@ -101,16 +101,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); onomapcube = p2.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&inomapcube, onomapcube, results); @@ -147,16 +147,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); onomapcube = p3.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&inomapcube, onomapcube, results); @@ -197,16 +197,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); onomapcube = p4.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&inomapcube, onomapcube, results); @@ -243,16 +243,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); onomapcube = p5.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&inomapcube, onomapcube, results); @@ -285,7 +285,7 @@ void IsisMain() { ProcessByLine p6; p6.SetInputCube("FROM2"); - string from2 = ui.GetFileName("FROM2"); + QString from2 = ui.GetFileName("FROM2"); Cube imapcube; imapcube.open(from2); inl = imapcube.getLineCount(); @@ -300,16 +300,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); Cube *omapcube = p6.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&imapcube, omapcube, results); @@ -357,16 +357,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); omapcube = p7.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&imapcube, omapcube, results); @@ -403,16 +403,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); omapcube = p8.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&imapcube, omapcube, results); @@ -453,16 +453,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); omapcube = p9.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&imapcube, omapcube, results); @@ -499,16 +499,16 @@ void IsisMain() { ons = (int)ceil((double)(es - ss + 1) / sinc); omapcube = p10.SetOutputCube("TO", ons, onl, 1); - results += PvlKeyword("InputLines", inl); - results += PvlKeyword("InputSamples", ins); - results += PvlKeyword("StartingLine", sl); - results += PvlKeyword("StartingSample", ss); - results += PvlKeyword("EndingLine", el); - results += PvlKeyword("EndingSample", es); - results += PvlKeyword("LineIncrement", linc); - results += PvlKeyword("SampleIncrement", sinc); - results += PvlKeyword("OutputLines", onl); - results += PvlKeyword("OutputSamples", ons); + results += PvlKeyword("InputLines", toString(inl)); + results += PvlKeyword("InputSamples", toString(ins)); + results += PvlKeyword("StartingLine", toString(sl)); + results += PvlKeyword("StartingSample", toString(ss)); + results += PvlKeyword("EndingLine", toString(el)); + results += PvlKeyword("EndingSample", toString(es)); + results += PvlKeyword("LineIncrement", toString(linc)); + results += PvlKeyword("SampleIncrement", toString(sinc)); + results += PvlKeyword("OutputLines", toString(onl)); + results += PvlKeyword("OutputSamples", toString(ons)); s.SetSubArea(inl, ins, sl, ss, el, es, linc, sinc); s.UpdateLabel(&imapcube, omapcube, results); diff --git a/isis/src/base/objs/Table/Table.cpp b/isis/src/base/objs/Table/Table.cpp index 4b39ba6040..40cb4eb271 100644 --- a/isis/src/base/objs/Table/Table.cpp +++ b/isis/src/base/objs/Table/Table.cpp @@ -44,7 +44,7 @@ namespace Isis { * @param tableName Name of the Table to be read * @param rec Name of the TableRecord to be read into the Table */ - Table::Table(const std::string &tableName, Isis::TableRecord &rec) : + Table::Table(const QString &tableName, Isis::TableRecord &rec) : Blob(tableName, "Table") { p_assoc = Table::None; p_blobPvl += Isis::PvlKeyword("Records", 0); @@ -65,7 +65,7 @@ namespace Isis { * * @param tableName Name of the Table to be read */ - Table::Table(const std::string &tableName) : + Table::Table(const QString &tableName) : Isis::Blob(tableName, "Table") { p_assoc = Table::None; } @@ -84,7 +84,7 @@ namespace Isis { * * @see Blob::Read() */ - Table::Table(const std::string &tableName, const std::string &file) : + Table::Table(const QString &tableName, const QString &file) : Blob(tableName, "Table") { p_assoc = Table::None; Read(file); @@ -105,7 +105,7 @@ namespace Isis { * * @see Blob::Read() */ - Table::Table(const std::string &tableName, const std::string &file, + Table::Table(const QString &tableName, const QString &file, const Pvl &fileHeader) : Blob(tableName, "Table") { p_assoc = Table::None; Read(file, fileHeader); @@ -272,10 +272,10 @@ namespace Isis { // } // Temporary substitution? if (RecordSize() < rec.RecordSize()) { - IString msg = "Unable to add the given record with size = [" - + IString(rec.RecordSize()) + " bytes] to to Isis Table [" + QString msg = "Unable to add the given record with size = [" + + toString(rec.RecordSize()) + " bytes] to to Isis Table [" + p_blobName + "] with record size = [" - + IString(RecordSize()) + " bytes]. Added record size can " + + toString(RecordSize()) + " bytes]. Added record size can " "not exceed table record size."; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -329,8 +329,8 @@ namespace Isis { p_record = rec; if (p_blobPvl.HasKeyword("Association")) { - Isis::IString temp = (string) p_blobPvl["Association"]; - temp.UpCase(); + QString temp = (QString) p_blobPvl["Association"]; + temp = temp.toUpper(); if (temp == "SAMPLES") p_assoc = Table::Samples; if (temp == "LINES") p_assoc = Table::Lines; if (temp == "BANDS") p_assoc = Table::Bands; @@ -359,7 +359,7 @@ namespace Isis { (streampos)(rec * RecordSize()); stream.seekg(sbyte, std::ios::beg); if (!stream.good()) { - string msg = "Error preparing to read record [" + Isis::IString(rec + 1) + + QString msg = "Error preparing to read record [" + toString(rec + 1) + "] from Table [" + p_blobName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -367,8 +367,8 @@ namespace Isis { char *buf = new char[RecordSize()]; stream.read(buf, RecordSize()); if (!stream.good()) { - string msg = "Error reading record [" + Isis::IString(rec + 1) + - "] from Table [" + p_blobName + "]"; + QString msg = "Error reading record [" + toString(rec + 1) + + "] from Table [" + p_blobName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -379,14 +379,14 @@ namespace Isis { //! Virtual Function to prepare labels for writing void Table::WriteInit() { - p_blobPvl["Records"] = Records(); + p_blobPvl["Records"] = toString(Records()); p_nbytes = Records() * RecordSize(); if (Isis::IsLsb()) { - p_blobPvl["ByteOrder"] = Isis::IString(Isis::ByteOrderName(Isis::Lsb)); + p_blobPvl["ByteOrder"] = Isis::ByteOrderName(Isis::Lsb); } else { - p_blobPvl["ByteOrder"] = Isis::IString(Isis::ByteOrderName(Isis::Msb)); + p_blobPvl["ByteOrder"] = Isis::ByteOrderName(Isis::Msb); } if (p_blobPvl.HasKeyword("Association")) { diff --git a/isis/src/base/objs/Table/Table.h b/isis/src/base/objs/Table/Table.h index c4076f0368..cfb9197a6c 100644 --- a/isis/src/base/objs/Table/Table.h +++ b/isis/src/base/objs/Table/Table.h @@ -87,10 +87,10 @@ namespace Isis { }; // Constructors and Destructors - Table(const std::string &tableName, TableRecord &rec); - Table(const std::string &tableName);// Only use this constructor for reading in an existing table - Table(const std::string &tableName, const std::string &file); - Table(const std::string &tableName, const std::string &file, + Table(const QString &tableName, TableRecord &rec); + Table(const QString &tableName);// Only use this constructor for reading in an existing table + Table(const QString &tableName, const QString &file); + Table(const QString &tableName, const QString &file, const Pvl &fileHeader); Table(const Table &other); Table &operator=(const Isis::Table &other); diff --git a/isis/src/base/objs/Table/Table.truth b/isis/src/base/objs/Table/Table.truth index 5a6e7f105a30ec1b64c5cd2e89de07ae46e7b310..51208866f6695eb542480e783f9f5c5c8c3ee5bc 100644 GIT binary patch delta 128 zcmeCaT#wv$(|=<@kw=A{Ou7U$=bmSpDVfrPkFxE7ONvdB#qWVMEoTytIPleoW^>FCWfY#oLstwoCbQPoF1M~8HSAu#2IBF98MEG6D%qwA7i}B z0a3xgFnKZ486Fr1L{H9Vw&Vsepm_2MW?L2zd$IzHu82=&UTRQkaehu|NoIZ?NSJ|P zvI2`a7la8S!Rj1~3sRFyf)YzI^Fd-@Jh`7m4q4q=7AtnJ1Ovn5=PcH25cXsxRyZ@3 V)shn;%D})dc^az=!r8Z2bpUZOCq)1N diff --git a/isis/src/base/objs/Table/unitTest.cpp b/isis/src/base/objs/Table/unitTest.cpp index f2361fca42..95913e2431 100644 --- a/isis/src/base/objs/Table/unitTest.cpp +++ b/isis/src/base/objs/Table/unitTest.cpp @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) { cout << (double) t2[i][j] << "\t"; } else if (j == 2) { - cout << std::string(t2[i][j]) << "\t"; + cout << QString(t2[i][j]) << "\t"; } } cout << endl; @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { cout << (double) t3[i][j] << "\t"; } else if (j == 2) { - cout << std::string(t3[i][j]) << "\t"; + cout << QString(t3[i][j]) << "\t"; } } cout << endl; @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) { cout << (double) t4[i][j] << "\t"; } else if (j == 2) { - cout << std::string(t4[i][j]) << "\t"; + cout << QString(t4[i][j]) << "\t"; } } cout << endl; @@ -132,12 +132,12 @@ int main(int argc, char *argv[]) { remove("tTest"); cout << "InstrumentPointing Table..." << endl; - string name1 = "InstrumentPointing"; + QString name1 = "InstrumentPointing"; Table instPoint(name1, "truth.cub"); for(int i = 0; i < instPoint.Records(); i++) { for(int j = 0; j < instPoint[i].Fields(); j++) { if(instPoint[i][j].isText()) { - cout << (string)instPoint[i][j] << ", "; + cout << (QString)instPoint[i][j] << ", "; } else if(instPoint[i][j].isDouble()) { cout << (double)instPoint[i][j] << ", "; @@ -147,12 +147,12 @@ int main(int argc, char *argv[]) { } cout << endl; cout << "Camera Statistics Table..." << endl; - string name2 = "CameraStatistics"; + QString name2 = "CameraStatistics"; Table camStats(name2, "truth.cub"); for(int i = 0; i < camStats.Records(); i++) { for(int j = 0; j < camStats[i].Fields(); j++) { if(camStats[i][j].isText()) { - cout << (string)camStats[i][j] << ", "; + cout << (QString)camStats[i][j] << ", "; } else if(camStats[i][j].isDouble()) { cout << (double)camStats[i][j] << ", "; diff --git a/isis/src/base/objs/TableField/TableField.cpp b/isis/src/base/objs/TableField/TableField.cpp index 64373a6bdb..3b78ba9ad4 100644 --- a/isis/src/base/objs/TableField/TableField.cpp +++ b/isis/src/base/objs/TableField/TableField.cpp @@ -38,7 +38,7 @@ namespace Isis { * @param size The size of the field. This is the number of values for a * single table entry. Defaults to 1. */ - TableField::TableField(const std::string &name, TableField::Type type, + TableField::TableField(const QString &name, TableField::Type type, int size) { m_name = name; m_type = type; @@ -73,30 +73,30 @@ namespace Isis { * @throws IException::Programmer - Invalid field type */ TableField::TableField(PvlGroup &field) { - m_name = (string) field["Name"]; + m_name = (QString) field["Name"]; m_size = (int) field["Size"]; - if ((string) field["Type"] == "Integer") { + if ((QString) field["Type"] == "Integer") { m_type = TableField::Integer; m_bytes = 4 * m_size; m_ivalues.resize(m_size); } - else if ((string) field["Type"] == "Double") { + else if ((QString) field["Type"] == "Double") { m_type = TableField::Double; m_bytes = 8 * m_size; m_dvalues.resize(m_size); } - else if ((string) field["Type"] == "Text") { + else if ((QString) field["Type"] == "Text") { m_type = TableField::Text; m_bytes = 1 * m_size; m_svalue.resize(m_size); } - else if ((string) field["Type"] == "Real") { + else if ((QString) field["Type"] == "Real") { m_type = TableField::Real; m_bytes = 4 * m_size; m_rvalues.resize(m_size); } else { - string msg = "Field [" + m_name + "] has invalid type."; + QString msg = "Field [" + m_name + "] has invalid type."; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -110,7 +110,7 @@ namespace Isis { * * @return @b string Name of TableField */ - std::string TableField::name() const { + QString TableField::name() const { return m_name; } @@ -203,11 +203,11 @@ namespace Isis { */ TableField::operator int() const { if (m_type != TableField::Integer) { - string msg = "Field [" + m_name + "] is not Integer."; + QString msg = "Field [" + m_name + "] is not Integer."; throw IException(IException::Programmer, msg, _FILEINFO_); } if (m_ivalues.size() > 1) { - string msg = "Field [" + m_name + "] has multiple Integer values. " + QString msg = "Field [" + m_name + "] has multiple Integer values. " "Use std::vector()."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -232,11 +232,11 @@ namespace Isis { */ TableField::operator double() const { if (m_type != TableField::Double) { - string msg = "Field [" + m_name + "] is not a Double."; + QString msg = "Field [" + m_name + "] is not a Double."; throw IException(IException::Programmer, msg, _FILEINFO_); } if (m_dvalues.size() > 1) { - string msg = "Field [" + m_name + "] has multiple Double values. " + QString msg = "Field [" + m_name + "] has multiple Double values. " "Use std::vector()."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -261,11 +261,11 @@ namespace Isis { */ TableField::operator float() const { if (m_type != TableField::Real) { - string msg = "Field [" + m_name + "] is not Real."; + QString msg = "Field [" + m_name + "] is not Real."; throw IException(IException::Programmer, msg, _FILEINFO_); } if (m_rvalues.size() > 1) { - string msg = "Field [" + m_name + "] has multiple Real values. " + QString msg = "Field [" + m_name + "] has multiple Real values. " "Use std::vector()."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -278,20 +278,20 @@ namespace Isis { * * TableField field("Field 1", FieldType::Text, 9); * // The following lines are equivalent - * string value = std::string(field); - * string value = (string) field; + * string value = QString(field); + * string value = (QString) field; * * * @return @b string The value of the field. * * @throws IException::Programmer - Field is not a string */ - TableField::operator std::string() const { + TableField::operator QString() const { if (m_type != TableField::Text) { - string msg = "Field [" + m_name + "] is not Text."; + QString msg = "Field [" + m_name + "] is not Text."; throw IException(IException::Programmer, msg, _FILEINFO_); } - return m_svalue; + return QString(m_svalue.toAscii().data()); } /** @@ -308,7 +308,7 @@ namespace Isis { */ TableField::operator std::vector() const { if (m_type != TableField::Integer) { - string msg = "Field [" + m_name + "] is not an Integer array."; + QString msg = "Field [" + m_name + "] is not an Integer array."; throw IException(IException::Programmer, msg, _FILEINFO_); } return m_ivalues; @@ -328,7 +328,7 @@ namespace Isis { */ TableField::operator std::vector() const { if (m_type != TableField::Double) { - string msg = "Field [" + m_name + "] is not a Double array."; + QString msg = "Field [" + m_name + "] is not a Double array."; throw IException(IException::Programmer, msg, _FILEINFO_); } return m_dvalues; @@ -348,7 +348,7 @@ namespace Isis { */ TableField::operator std::vector() const { if (m_type != TableField::Real) { - string msg = "Field [" + m_name + "] is not a Real array."; + QString msg = "Field [" + m_name + "] is not a Real array."; throw IException(IException::Programmer, msg, _FILEINFO_); } return m_rvalues; @@ -365,13 +365,13 @@ namespace Isis { */ void TableField::operator=(const int value) { if (m_type != TableField::Integer) { - string msg = "Unable to set field to the given int value. Field [" + QString msg = "Unable to set field to the given int value. Field [" + m_name + "] Type is not Integer."; throw IException(IException::Programmer, msg, _FILEINFO_); } if (m_size > 1) { - string msg = "Unable to set field to the given int value. " - "Field [" + m_name + "] has [" + IString(m_size) + "] " + QString msg = "Unable to set field to the given int value. " + "Field [" + m_name + "] has [" + toString(m_size) + "] " "Integer values. Use operator=(vector)."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -389,13 +389,13 @@ namespace Isis { */ void TableField::operator=(const double value) { if (m_type != TableField::Double) { - string msg = "Unable to set field to the given double value. Field [" + QString msg = "Unable to set field to the given double value. Field [" + m_name + "] Type is not Double."; throw IException(IException::Programmer, msg, _FILEINFO_); } if (m_size > 1) { - string msg = "Unable to set field to the given double value. " - "Field [" + m_name + "] has [" + IString(m_size) + "] " + QString msg = "Unable to set field to the given double value. " + "Field [" + m_name + "] has [" + toString(m_size) + "] " "Double values. Use operator=(vector)."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -413,13 +413,13 @@ namespace Isis { */ void TableField::operator=(const float value) { if (m_type != TableField::Real) { - string msg = "Unable to set field to the given float value. Field [" + QString msg = "Unable to set field to the given float value. Field [" + m_name + "] Type is not Real."; throw IException(IException::Programmer, msg, _FILEINFO_); } if (m_size > 1) { - string msg = "Unable to set field to the given float value. " - "Field [" + m_name + "] has [" + IString(m_size) + "] " + QString msg = "Unable to set field to the given float value. " + "Field [" + m_name + "] has [" + toString(m_size) + "] " "Real values. Use operator=(vector)."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -433,28 +433,28 @@ namespace Isis { * * @throws IException::Programmer - Field is not a string */ - void TableField::operator=(const std::string &value) { - QString val = QString::fromStdString(value); + void TableField::operator=(const QString &value) { + QString val = value; if (m_type != TableField::Text) { - string msg = "Unable to set field to the given string value. Field [" - + m_name + "] Type is not Text."; + QString msg = "Unable to set field to the given string value. Field [" + + m_name + "] Type is not Text."; throw IException(IException::Programmer, msg, _FILEINFO_); } if (m_size < (int) val.size()) {// automos with tracking ??? for (int i = m_size; i < val.size(); i++) { // if the extra characters are not spaces or nulls, throw an erro if (val[i] != ' ' && val[i] != '\0') { - string msg = "Unable to set the Text TableField to the given string. " - "The number of bytes allowed for this field value [" - + IString(m_size) + "] is less than the length of the " - "given string [" + value + "]."; + QString msg = "Unable to set the Text TableField to the given string. " + "The number of bytes allowed for this field value [" + + toString(m_size) + "] is less than the length of the " + "given string [" + value + "]."; throw IException(IException::Unknown, msg, _FILEINFO_); } } // if the extra characters are spaces and nulls, concatenate the string val.resize(m_size); } - m_svalue = val.toStdString(); + m_svalue = val; } /** @@ -468,14 +468,14 @@ namespace Isis { */ void TableField::operator=(const std::vector &values) { if (m_type != TableField::Integer) { - string msg = "Unable to set field to the given vector of int values. " - "Field [" + m_name + "] Type is not Integer."; + QString msg = "Unable to set field to the given vector of int values. " + "Field [" + m_name + "] Type is not Integer."; throw IException(IException::Programmer, msg, _FILEINFO_); } else if ((int) values.size() != m_size) { - string msg = "Unable to set field to the given vector of int values. " + QString msg = "Unable to set field to the given vector of int values. " "Field [" + m_name + "] values has size [" - + IString(m_size) + "]."; + + toString(m_size) + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } m_ivalues = values; @@ -492,14 +492,14 @@ namespace Isis { */ void TableField::operator=(const std::vector &values) { if (m_type != TableField::Double) { - string msg = "Unable to set field to the given vector of double values. " - "Field [" + m_name + "] Type is not Double."; + QString msg = "Unable to set field to the given vector of double values. " + "Field [" + m_name + "] Type is not Double."; throw IException(IException::Programmer, msg, _FILEINFO_); } else if ((int) values.size() != m_size) { - string msg = "Unable to set field to the given vector of double values. " - "Field [" + m_name + "] values has size [" - + IString(m_size) + "]."; + QString msg = "Unable to set field to the given vector of double values. " + "Field [" + m_name + "] values has size [" + + toString(m_size) + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } m_dvalues = values; @@ -517,14 +517,14 @@ namespace Isis { */ void TableField::operator=(const std::vector &values) { if (m_type != TableField::Real) { - string msg = "Unable to set field to the given vector of float values. " - "Field [" + m_name + "] Type is not Real."; + QString msg = "Unable to set field to the given vector of float values. " + "Field [" + m_name + "] Type is not Real."; throw IException(IException::Programmer, msg, _FILEINFO_); } else if ((int) values.size() != m_size) { - string msg = "Unable to set field to the given vector of float values. " - "Field [" + m_name + "] values has size [" - + IString(m_size) + "]."; + QString msg = "Unable to set field to the given vector of float values. " + "Field [" + m_name + "] values has size [" + + toString(m_size) + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } m_rvalues = values; @@ -590,7 +590,7 @@ namespace Isis { */ void TableField::operator=(const char *buf) { if (m_type != TableField::Text) { - string msg = "Field [" + m_name + "] is not Text."; + QString msg = "Unable to set field to the given string value. Field [" + m_name + "] Type is not Text."; throw IException(IException::Programmer, msg, _FILEINFO_); } m_svalue = buf; @@ -617,7 +617,7 @@ namespace Isis { else if (m_type == TableField::Real) { group += PvlKeyword("Type", "Real"); } - group += PvlKeyword("Size", m_size); + group += PvlKeyword("Size", toString(m_size)); return group; } diff --git a/isis/src/base/objs/TableField/TableField.h b/isis/src/base/objs/TableField/TableField.h index 787aae2463..5c1588675c 100644 --- a/isis/src/base/objs/TableField/TableField.h +++ b/isis/src/base/objs/TableField/TableField.h @@ -22,9 +22,10 @@ * http://www.usgs.gov/privacy.html. */ -#include #include +#include + namespace Isis { class PvlGroup; /** @@ -77,11 +78,11 @@ namespace Isis { }; //Constructors and Destructor - TableField(const std::string &name, Type type, int size = 1); + TableField(const QString &name, Type type, int size = 1); TableField(PvlGroup &field); ~TableField(); - std::string name() const; + QString name() const; Type type() const; bool isInteger() const; bool isDouble() const; @@ -93,7 +94,7 @@ namespace Isis { operator int() const; operator double() const; operator float() const; - operator std::string() const; + operator QString() const; operator std::vector() const; operator std::vector() const; operator std::vector() const; @@ -101,7 +102,7 @@ namespace Isis { void operator=(const int value); void operator=(const double value); void operator=(const float value); - void operator=(const std::string &value); + void operator=(const QString &value); void operator=(const std::vector &values); void operator=(const std::vector &values); void operator=(const std::vector &value); @@ -111,7 +112,7 @@ namespace Isis { PvlGroup pvlGroup(); private: - std::string m_name; //!< Field name + QString m_name; //!< Field name Type m_type; //!< Field value type int m_size; /**< Field size. This is the number of values per field entry of the table.*/ @@ -125,7 +126,7 @@ namespace Isis { std::vector m_rvalues; /**< Vector containing Real field values. If the field Type is not Real, this vector will be empty.*/ - std::string m_svalue; /**< String containing text value of field. + QString m_svalue; /**< String containing text value of field. If the field Type is not Text, this string will be empty.*/ }; diff --git a/isis/src/base/objs/TableField/unitTest.cpp b/isis/src/base/objs/TableField/unitTest.cpp index d42e6bd365..202a90b53c 100644 --- a/isis/src/base/objs/TableField/unitTest.cpp +++ b/isis/src/base/objs/TableField/unitTest.cpp @@ -52,8 +52,8 @@ int main(int argc, char *argv[]) { cout << "IsReal = " << textField.isReal() << endl; cout << "Size = " << textField.size() << endl; cout << "Bytes = " << textField.bytes() << endl; - textField = (string) "Bah humbug"; - cout << "Value = " << (string)textField << endl; + textField = (QString) "Bah humbug"; + cout << "Value = " << (QString)textField << endl; g = textField.pvlGroup(); cout << g << endl; cout << "----------------------------------------" << endl << endl; @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) { group1 += PvlKeyword("name", "Test"); group1 += PvlKeyword("type", "Integer"); - group1 += PvlKeyword("size", 20); + group1 += PvlKeyword("size", toString(20)); TableField intVectorField20(group1); g = intVectorField20.pvlGroup(); @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) { group2 += PvlKeyword("name", "Test"); group2 += PvlKeyword("type", "Double"); - group2 += PvlKeyword("size", 20); + group2 += PvlKeyword("size", toString(20)); TableField dblVectorField20(group2); g = dblVectorField20.pvlGroup(); @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) { group3 += PvlKeyword("name", "Test"); group3 += PvlKeyword("type", "Text"); - group3 += PvlKeyword("size", 20); + group3 += PvlKeyword("size", toString(20)); TableField textField20(group3); g = textField20.pvlGroup(); @@ -177,7 +177,7 @@ int main(int argc, char *argv[]) { group4 += PvlKeyword("name", "Test"); group4 += PvlKeyword("type", "Real"); - group4 += PvlKeyword("size", 20); + group4 += PvlKeyword("size", toString(20)); TableField realVectorField20(group4); g = realVectorField20.pvlGroup(); @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) { group5 += PvlKeyword("name", "Test"); group5 += PvlKeyword("type", "BLAH"); - group5 += PvlKeyword("size", 20); + group5 += PvlKeyword("size", toString(20)); TableField unknownTypeField(group5); g = unknownTypeField.pvlGroup(); @@ -207,7 +207,7 @@ int main(int argc, char *argv[]) { group6 += PvlKeyword("name", "Test"); group6 += PvlKeyword("type", "Integer"); - group6 += PvlKeyword("size", -7.3); + group6 += PvlKeyword("size", toString(-7.3)); TableField invalidSizeField(group6); g = invalidSizeField.pvlGroup(); @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) { cout << endl; cout << " operator std::string() " << endl; try { - cout << std::string(realSingletonField); // try to cast a non-Text type + cout << QString(realSingletonField); // try to cast a non-Text type } catch (IException e) { e.print(); @@ -334,7 +334,7 @@ int main(int argc, char *argv[]) { cout << endl; cout << " operator=(const std::string &value)" << endl; try { - dblSingletonField = std::string("Error"); // try to set Double type to non-double value + dblSingletonField = "Error"; // try to set Double type to non-double value } catch (IException e) { e.print(); diff --git a/isis/src/base/objs/TableRecord/TableRecord.cpp b/isis/src/base/objs/TableRecord/TableRecord.cpp index 9fe164939b..9b0473d7b0 100644 --- a/isis/src/base/objs/TableRecord/TableRecord.cpp +++ b/isis/src/base/objs/TableRecord/TableRecord.cpp @@ -73,7 +73,7 @@ namespace Isis { * @throws Isis::IException::Programmer - The field does not exist in the * record */ - TableField &TableRecord::operator[](const std::string &field) { + TableField &TableRecord::operator[](const QString &field) { Isis::IString upTemp = field; upTemp.UpCase(); for (int i = 0; i < (int)p_fields.size(); i++) { @@ -82,7 +82,7 @@ namespace Isis { if (upTemp == upField) return p_fields[i]; } - string msg = "Field [" + field + "] does not exist in record"; + QString msg = "Field [" + field + "] does not exist in record"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -134,10 +134,10 @@ namespace Isis { } } else if (field.isText()) { - string val = (string)field; + QString val = (QString)field; for (int i = 0; i < field.size(); i++) { if (i < (int)val.length()) { - buf[sbyte] = val[i]; + buf[sbyte] = val[i].toAscii(); } else { buf[sbyte] = 0; diff --git a/isis/src/base/objs/TableRecord/TableRecord.h b/isis/src/base/objs/TableRecord/TableRecord.h index 8554231ed8..e594307471 100644 --- a/isis/src/base/objs/TableRecord/TableRecord.h +++ b/isis/src/base/objs/TableRecord/TableRecord.h @@ -61,7 +61,7 @@ namespace Isis { void operator+=(Isis::TableField &field); TableField &operator[](const int field); - TableField &operator[](const std::string &field); + TableField &operator[](const QString &field); int Fields() const; int RecordSize() const; diff --git a/isis/src/base/objs/Target/Target.cpp b/isis/src/base/objs/Target/Target.cpp index edd8e2476b..fd9a575453 100644 --- a/isis/src/base/objs/Target/Target.cpp +++ b/isis/src/base/objs/Target/Target.cpp @@ -58,15 +58,15 @@ namespace Isis { PvlGroup &kernels = lab.FindGroup("Kernels", Pvl::Traverse); PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - m_name = new IString; + m_name = new QString; *m_name = inst["TargetName"][0]; - string trykey = "NaifIkCode"; + QString trykey = "NaifIkCode"; if (kernels.HasKeyword("NaifFrameCode")) trykey = "NaifFrameCode"; - if (name().UpCase() == "SKY") { + if (name().toUpper() == "SKY") { m_radii[0] = m_radii[1] = m_radii[2] = Distance(1000.0, Distance::Meters); m_sky = true; - int ikCode = (int) kernels[trykey]; + int ikCode = toInt(kernels[trykey][0]); *m_bodyCode = ikCode / 1000; // Check for override in kernel group if (kernels.HasKeyword("NaifSpkCode")) @@ -159,7 +159,7 @@ namespace Isis { SpiceInt Target::lookupNaifBodyCode() const { SpiceInt code; SpiceBoolean found; - bodn2c_c(m_name->c_str(), &code, &found); + bodn2c_c(m_name->toAscii().data(), &code, &found); if (!found) { IString msg = "Could not convert Target [" + *m_name + "] to NAIF code"; @@ -182,7 +182,7 @@ namespace Isis { //! Return target name - IString Target::name() const { + QString Target::name() const { return *m_name; } diff --git a/isis/src/base/objs/Target/Target.h b/isis/src/base/objs/Target/Target.h index eb549fb470..149c9e3fd1 100644 --- a/isis/src/base/objs/Target/Target.h +++ b/isis/src/base/objs/Target/Target.h @@ -29,9 +29,10 @@ #include "naif/SpiceZfc.h" #include "naif/SpiceZmc.h" +class QString; + namespace Isis { class Distance; - class IString; class Pvl; class ShapeModel; class Spice; @@ -55,7 +56,7 @@ namespace Isis { void init(); bool isSky() const; SpiceInt naifBodyCode() const; - IString name() const; + QString name() const; std::vector radii() const; void restoreShape(); void setShapeEllipsoid(); @@ -70,7 +71,7 @@ namespace Isis { labels. Otherwise, if the target is sky, it's the SPK code and if not sky then it's calculated by the NaifBodyCode() method.*/ - IString *m_name; //!< Name of the target + QString *m_name; //!< Name of the target std::vector m_radii; //!< The radii of the target ShapeModel *m_originalShape; //!< The shape model of the target ShapeModel *m_shape; //!< The shape model of the target diff --git a/isis/src/base/objs/Target/unitTest.cpp b/isis/src/base/objs/Target/unitTest.cpp index e8e6301ac8..9dd328a4d9 100644 --- a/isis/src/base/objs/Target/unitTest.cpp +++ b/isis/src/base/objs/Target/unitTest.cpp @@ -29,6 +29,8 @@ #include "Preference.h" /** + * @file + * * This application tests the Target class. * * @author 2012-03-20 Debbie A. Cook @@ -66,9 +68,9 @@ int main(int argc, char *argv[]) { PvlGroup kern1("Kernels"); FileName f("$base/testData/kernels"); FileName f2("$base/dems"); - string dir = f.expanded() + "/"; - string dir2 = f2.expanded() + "/"; - kern1 += PvlKeyword("NaifFrameCode", -94031); + QString dir = f.expanded() + "/"; + QString dir2 = f2.expanded() + "/"; + kern1 += PvlKeyword("NaifFrameCode", toString(-94031)); kern1 += PvlKeyword("LeapSecond", dir + "naif0007.tls"); kern1 += PvlKeyword("SpacecraftClock", dir + "MGS_SCLKSCET.00045.tsc"); kern1 += PvlKeyword("TargetPosition", dir + "de405.bsp"); @@ -80,7 +82,7 @@ int main(int argc, char *argv[]) { kern1 += PvlKeyword("Frame", ""); PvlGroup kern2("Kernels"); - kern2 += PvlKeyword("NaifIkCode", -94031); + kern2 += PvlKeyword("NaifIkCode", toString(-94031)); kern2 += PvlKeyword("LeapSecond", dir + "naif0007.tls"); kern2 += PvlKeyword("SpacecraftClock", dir + "MGS_SCLKSCET.00045.tsc"); kern2 += PvlKeyword("TargetPosition", dir + "de405.bsp"); @@ -90,7 +92,7 @@ int main(int argc, char *argv[]) { kern2 += PvlKeyword("InstrumentPosition", dir + "moc.bsp"); kern2 += PvlKeyword("InstrumentPointing", dir + "moc.bc"); kern2 += PvlKeyword("Frame", ""); - kern2 += PvlKeyword("NaifBodyCode", 499); + kern2 += PvlKeyword("NaifBodyCode", toString(499)); PvlGroup kern3 = kern2; kern3 += PvlKeyword("ShapeModel", dir2 + "molaMarsPlanetaryRadius0005.cub"); @@ -100,8 +102,8 @@ int main(int argc, char *argv[]) { double endTime = -69382512.0; double slope = (endTime - startTime) / (10 - 1); - kern1 += PvlKeyword("StartPadding", slope); - kern1 += PvlKeyword("EndPadding", slope); + kern1 += PvlKeyword("StartPadding", toString(slope)); + kern1 += PvlKeyword("EndPadding", toString(slope)); Pvl lab1; lab1.AddGroup(inst1); diff --git a/isis/src/base/objs/TextFile/TextFile.cpp b/isis/src/base/objs/TextFile/TextFile.cpp index 9da70a137f..cbc227402a 100644 --- a/isis/src/base/objs/TextFile/TextFile.cpp +++ b/isis/src/base/objs/TextFile/TextFile.cpp @@ -54,7 +54,7 @@ namespace Isis { * @param extension Extension to be added to filename (added only if not * already on filename). Defaults to "" */ - TextFile::TextFile(const std::string &filename, + TextFile::TextFile(const QString &filename, const char *openmode, const char *extension) { SetComment(); SetNewLine(); @@ -85,8 +85,8 @@ namespace Isis { * true=filter, false=return any line read from * fileDefaults to true */ - TextFile::TextFile(const std::string &filename, const char *openmode, - std::vector &lines, const int &maxLinesToReadWrite, + TextFile::TextFile(const QString &filename, const char *openmode, + std::vector &lines, const int &maxLinesToReadWrite, const bool skipComments) { SetComment(); SetNewLine(); @@ -123,10 +123,9 @@ namespace Isis { * fileDefaults to true */ TextFile::TextFile(const char *filename, const char *openmode, - std::vector &lines, const int &maxLinesToReadWrite, + std::vector &lines, const int &maxLinesToReadWrite, const bool skipComments) { - string FileName = filename; - TextFile(FileName, openmode, lines, maxLinesToReadWrite, skipComments); + TextFile(QString(filename), openmode, lines, maxLinesToReadWrite, skipComments); } /** @@ -154,8 +153,8 @@ namespace Isis { * true=filter, false=return any line read from * fileDefaults to true */ - TextFile::TextFile(const std::string &filename, const char *openmode, - std::string *lines, const int &maxLinesToReadWrite, + TextFile::TextFile(const QString &filename, const char *openmode, + QString *lines, const int &maxLinesToReadWrite, const bool skipComments) { SetComment(); SetNewLine(); @@ -193,10 +192,9 @@ namespace Isis { * fileDefaults to true */ TextFile::TextFile(const char *filename, const char *openmode, - std::string *lines, const int &maxLinesToReadWrite, + QString *lines, const int &maxLinesToReadWrite, const bool skipComments) { - string FileName = filename; - TextFile(FileName, openmode, lines, maxLinesToReadWrite, skipComments); + TextFile(QString(filename), openmode, lines, maxLinesToReadWrite, skipComments); } @@ -232,7 +230,7 @@ namespace Isis { * @throws Isis::IException::Io - output file already exists * @throws Isis::IException::Io - unable to open file */ - void TextFile::Open(const std::string &filename, const char *openmode, + void TextFile::Open(const QString &filename, const char *openmode, const char *extension) { // Open (filename [,openmode] [, with_extension ]) // default openmode = 'input' @@ -243,8 +241,8 @@ namespace Isis { // Don't open if it already is if(p_stream.is_open()) { - string message = "TextFile:Open:-> Already opened with this object: [" - + string(openmode) + "]:[" + p_filename + "]"; + QString message = "TextFile:Open:-> Already opened with this object: [" + + QString(openmode) + "]:[" + p_filename + "]"; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -273,45 +271,45 @@ namespace Isis { p_openmode = 4; } else { - string message = "TextFile::-> Unknown openmode: (input, output, overwrite, append):[" - + string(openmode) + "]:[" + p_filename + "]"; + QString message = "TextFile::-> Unknown openmode: (input, output, overwrite, append):[" + + QString(openmode) + "]:[" + p_filename + "]"; throw IException(IException::Programmer, message, _FILEINFO_); } // Input if(p_openmode == 1) { - p_stream.open(p_filename.c_str(), fstream::in); + p_stream.open(p_filename.toAscii().data(), fstream::in); } // Output else if(p_openmode == 2) { // first check if file already exists if(filenameTmp.fileExists() && QFileInfo(filenameTmp.toString()).size() > 0) { - string message = "TextFile:Open: -> Output file already exists [" - + string(openmode) + "]:[" + p_filename + "]"; + QString message = "TextFile:Open: -> Output file already exists [" + + QString(openmode) + "]:[" + p_filename + "]"; throw IException(IException::Io, message, _FILEINFO_); } - p_stream.open(p_filename.c_str(), fstream::in | fstream::out | fstream::trunc); + p_stream.open(p_filename.toAscii().data(), fstream::in | fstream::out | fstream::trunc); p_stream.clear(); } // Overwrite else if(p_openmode == 3) { - p_stream.open(p_filename.c_str(), fstream::in | fstream::out | fstream::trunc); + p_stream.open(p_filename.toAscii().data(), fstream::in | fstream::out | fstream::trunc); } // Append else if(p_openmode == 4) { // Open in append if it does exist, otherwise, open in overwrite mode if(filenameTmp.fileExists()) { - p_stream.open(p_filename.c_str(), fstream::in | fstream::out | fstream::ate); + p_stream.open(p_filename.toAscii().data(), fstream::in | fstream::out | fstream::ate); } else { - p_stream.open(p_filename.c_str(), fstream::in | fstream::out | fstream::trunc); + p_stream.open(p_filename.toAscii().data(), fstream::in | fstream::out | fstream::trunc); } } if(!p_stream.is_open()) { - string message = "TextFile:Open:-> Unable to open: [" - + string(openmode) + "]:[" + p_filename + "]"; + QString message = "TextFile:Open:-> Unable to open: [" + + QString(openmode) + "]:[" + p_filename + "]"; throw IException(IException::Io, message, _FILEINFO_); } } @@ -322,7 +320,7 @@ namespace Isis { } else { if(bailIfNotOpen) { - string message = "TextFile::-> File not open: [" + p_filename + "]"; + QString message = "TextFile::-> File not open: [" + p_filename + "]"; throw IException(IException::Programmer, message, _FILEINFO_); } else { @@ -349,10 +347,10 @@ namespace Isis { } // vector array - void TextFile::GetFile(std::vector &lines, const int &maxLinesToRead, + void TextFile::GetFile(std::vector &lines, const int &maxLinesToRead, const bool skipComments) { OpenChk(true); - string line; + QString line; int lineCount = 0; while(GetLine(line, skipComments)) { if(maxLinesToRead > 0) { @@ -365,10 +363,10 @@ namespace Isis { } // string array - void TextFile::GetFile(std::string *lines, const int &maxLinesToRead, + void TextFile::GetFile(QString *lines, const int &maxLinesToRead, const bool skipComments) { OpenChk(true); - string line; + QString line; int lineCount = 0; while(GetLine(line, skipComments)) { if(maxLinesToRead > 0) { @@ -385,7 +383,7 @@ namespace Isis { } // vector array - void TextFile::PutFile(std::vector &lines, const int &maxLinesToWrite) { + void TextFile::PutFile(std::vector &lines, const int &maxLinesToWrite) { OpenChk(true); for(int lineCount = 0; lineCount < (int) lines.size(); lineCount++) { if(maxLinesToWrite > 0) { @@ -398,7 +396,7 @@ namespace Isis { } // string array - void TextFile::PutFile(const std::string *lines, const int &maxLinesToWrite) { + void TextFile::PutFile(const QString *lines, const int &maxLinesToWrite) { OpenChk(true); int lineCount = 0; while(true) { @@ -426,7 +424,7 @@ namespace Isis { * * @return bool */ - bool TextFile::GetLine(std::string &line, bool skipComments) { + bool TextFile::GetLine(QString &line, bool skipComments) { return (p_GetLine(line, skipComments)); } @@ -440,7 +438,7 @@ namespace Isis { * @return bool */ bool TextFile::GetLine(bool skipComments) { - string line; + QString line; return (p_GetLine(line, skipComments)); } @@ -452,7 +450,7 @@ namespace Isis { * * @return bool */ - bool TextFile::GetLineNoFilter(std::string &line) { + bool TextFile::GetLineNoFilter(QString &line) { return (p_GetLine(line, false)); } @@ -463,7 +461,7 @@ namespace Isis { * @return bool */ bool TextFile::GetLineNoFilter() { - string line; + QString line; return (p_GetLine(line, false)); } @@ -478,13 +476,15 @@ namespace Isis { * * @throws Isis::IException::Io - error reading text file */ - bool TextFile::p_GetLine(std::string &line, bool chkComment) { + bool TextFile::p_GetLine(QString &line, bool chkComment) { OpenChk(true); line = ""; // Try to read the next line - getline(p_stream, line); + std::string lineStdString; + getline(p_stream, lineStdString); + line = lineStdString.c_str(); // Check for end of file if(p_stream.eof()) { @@ -494,7 +494,7 @@ namespace Isis { // See if an error occured if(!p_stream.good()) { line = ""; - string message = "TextFile:GetLine: -> Error reading text file: [" + QString message = "TextFile:GetLine: -> Error reading text file: [" + p_filename + "]"; throw IException(IException::Io, message, _FILEINFO_); } @@ -502,9 +502,9 @@ namespace Isis { // See if we have a comment and if we need to ignore if(chkComment) { if(p_commentString.length()) { - std::string::size_type locComment = line.find(p_commentString, 0); - if(locComment != string::npos) { - unsigned int afterWhiteSpace = line.find_first_not_of(" \t\v\b\a", 0); + int locComment = line.indexOf(p_commentString); + if(locComment != -1) { + int afterWhiteSpace = line.indexOf(QRegExp("[^\\s]")); if((locComment == 0) || (locComment == afterWhiteSpace)) { return p_GetLine(line, chkComment); } @@ -521,8 +521,8 @@ namespace Isis { * * @param line IString to be written to file. Defaults to "" */ - void TextFile::PutLine(const std::string &line) { - PutLine(line.c_str()); + void TextFile::PutLine(const QString &line) { + PutLine(line.toAscii().data()); } /** @@ -543,12 +543,12 @@ namespace Isis { // See if an error occured if(!p_stream.good()) { if(p_openmode != 1) { - string message = "TextFile:PutLine: -> Error writing text file: [" + QString message = "TextFile:PutLine: -> Error writing text file: [" + p_filename + "]"; throw IException(IException::Io, message, _FILEINFO_); } else { - string message = + QString message = "TextFile:PutLine: -> Attempt to write to INPUT - Read Only text file: [" + p_filename + "]"; throw IException(IException::Programmer, message, _FILEINFO_); @@ -562,7 +562,7 @@ namespace Isis { * * @param line IString to be written to file.Defaults to "" */ - void TextFile::PutLineComment(const std::string &line) { + void TextFile::PutLineComment(const QString &line) { PutLine(p_commentString + line); } @@ -573,11 +573,11 @@ namespace Isis { * @param line Char string to be written to file.Defaults to "" */ void TextFile::PutLineComment(const char *line) { - PutLine(p_commentString + string(line)); + PutLine(p_commentString + QString(line)); } - string TextFile::GetComment() { + QString TextFile::GetComment() { return(p_commentString); } @@ -595,7 +595,7 @@ namespace Isis { } - string TextFile::GetNewLine() { + QString TextFile::GetNewLine() { return(p_newLineString); } diff --git a/isis/src/base/objs/TextFile/TextFile.h b/isis/src/base/objs/TextFile/TextFile.h index d71ea56a66..aa7248cb3e 100644 --- a/isis/src/base/objs/TextFile/TextFile.h +++ b/isis/src/base/objs/TextFile/TextFile.h @@ -25,6 +25,8 @@ #include #include +#include + namespace Isis { /** * @brief Provides access to sequential ASCII stream I/O @@ -55,41 +57,41 @@ namespace Isis { std::fstream p_stream; //!< File stream handle int p_openmode; /**< openmode of file: Input, Output, Overwrite, Append*/ - std::string p_filename; //!< FileName of the opened file. - std::string p_commentString; /**< 'comment' string used by GetLine and + QString p_filename; //!< FileName of the opened file. + QString p_commentString; /**< 'comment' string used by GetLine and PutLineComment*/ - std::string p_newLineString; /**< 'newline' string used by PutLine and + QString p_newLineString; /**< 'newline' string used by PutLine and PutLineComment*/ - bool p_GetLine(std::string &line, bool chkComment); + bool p_GetLine(QString &line, bool chkComment); public: // Constructors and destructors TextFile(); // implied open file - TextFile(const std::string &filename, const char *openmode = "input", + TextFile(const QString &filename, const char *openmode = "input", const char *extension = ""); // implied getFile/putFile TextFile(const char *filename, const char *openmode, - std::vector &lines, + std::vector &lines, const int &maxLinesToReadWrite = 0, const bool skipComments = true); - TextFile(const std::string &filename, - const char *openmode, std::vector &lines, + TextFile(const QString &filename, + const char *openmode, std::vector &lines, const int &maxLinesToReadWrite = 0, const bool skipComments = true); TextFile(const char *filename, - const char *openmode, std::string *lines, + const char *openmode, QString *lines, const int &maxLinesToReadWrite, const bool skipComments = true); - TextFile(const std::string &filename, - const char *openmode, std::string *lines, + TextFile(const QString &filename, + const char *openmode, QString *lines, const int &maxLinesToReadWrite, const bool skipComments = true); ~TextFile(); - void Open(const std::string &filename, const char *openmode = "input", + void Open(const QString &filename, const char *openmode = "input", const char *extension = ""); void Open(const char *filename, const char *openmode = "input", const char *extension = ""); @@ -99,30 +101,30 @@ namespace Isis { void Rewind(); void Close(); - void GetFile(std::vector &lines, + void GetFile(std::vector &lines, const int &maxLinesToRead = 0, const bool skipComments = true); - void GetFile(std::string *lines, const int &maxLinesToRead, + void GetFile(QString *lines, const int &maxLinesToRead, const bool skipComments = true); - void PutFile(std::vector &lines, + void PutFile(std::vector &lines, const int &maxLinesToWrite = 0); - void PutFile(const std::string *lines, const int &maxLinesToWrite); + void PutFile(const QString *lines, const int &maxLinesToWrite); - bool GetLine(std::string &line, const bool skipComments = true); - bool GetLineNoFilter(std::string &line); + bool GetLine(QString &line, const bool skipComments = true); + bool GetLineNoFilter(QString &line); bool GetLine(const bool skipComments = true); bool GetLineNoFilter(); - void PutLine(const std::string &line); + void PutLine(const QString &line); void PutLine(const char *line = ""); - void PutLineComment(const std::string &line); + void PutLineComment(const QString &line); void PutLineComment(const char *line = ""); - std::string GetComment(); - std::string GetNewLine(); + QString GetComment(); + QString GetNewLine(); void SetComment(const char *commentString = "#"); void SetNewLine(const char *newLineString = "\n"); diff --git a/isis/src/base/objs/TextFile/TextFile.truth b/isis/src/base/objs/TextFile/TextFile.truth index dc591de24b..d4ff128052 100644 --- a/isis/src/base/objs/TextFile/TextFile.truth +++ b/isis/src/base/objs/TextFile/TextFile.truth @@ -4,9 +4,9 @@ Unit test for TextFile 2) Read file $temporary/TextFile.tmp into vector -3) Create / Overwrite file $temporary/TextFile.tmp with prefilled string array +3) Create / Overwrite file $temporary/TextFile.tmp with prefilled QString array -4) Read file $temporary/TextFile.tmp into string array +4) Read file $temporary/TextFile.tmp into QString array 5) Overwrite file $temporary/TextFile.tmp @@ -20,27 +20,21 @@ Unit test for TextFile a) Try to open non-existent file **I/O ERROR** TextFile:Open:-> Unable to open: [Input]:[./NoSuchDir/TextFile.tmp]. - b) Try open as output to pre-existing file **I/O ERROR** TextFile:Open: -> Output file already exists [Output]:[./TextFile.tmp]. - c) Open file with bad open mode **PROGRAMMER ERROR** TextFile::-> Unknown openmode: (input, output, overwrite, append):[xxxInputxxx]:[./TextFile.tmp]. - d) Try to write to Input - Read Only file **PROGRAMMER ERROR** TextFile:PutLine: -> Attempt to write to INPUT - Read Only text file: [./TextFile.tmp]. - e) Try to Write to a closed file **PROGRAMMER ERROR** TextFile::-> File not open: [./TextFile.tmp]. - f) Try to Read from a closed file **PROGRAMMER ERROR** TextFile::-> File not open: [./TextFile.tmp]. - testing GetLine for files that do not end in a newline: Passed this file has no newline chars in it! diff --git a/isis/src/base/objs/TextFile/unitTest.cpp b/isis/src/base/objs/TextFile/unitTest.cpp index db53b6d6c7..bef4b220ed 100644 --- a/isis/src/base/objs/TextFile/unitTest.cpp +++ b/isis/src/base/objs/TextFile/unitTest.cpp @@ -12,16 +12,16 @@ using namespace Isis; int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); - void ReportError(IString err); + void ReportError(QString err); cout << "Unit test for TextFile" << endl << endl; // ---------------------------------------------------------------------------------- - string testFile = "$temporary/TextFile.tmp"; + QString testFile = "$temporary/TextFile.tmp"; // setup test data - string testLines[21]; + QString testLines[21]; // setup line test data testLines[0] = "# 0 zero line"; @@ -53,14 +53,14 @@ int main(int argc, char *argv[]) { streamsize numBytes = 0; streamsize numBytesFiltered = 0; - vector testLinesVector; + vector testLinesVector; for(int i = 0; i <= 19; i++) { numBytes += testLines[i].length() + strlen("\n"); testLineBytes[i] = numBytes; testLinesVector.push_back(testLines[i]); - int locComment = testLines[i].find("#", 0); - if((locComment != (int) string::npos) && (locComment != 1)) { + int locComment = testLines[i].indexOf("#", 0); + if((locComment != -1) && (locComment != 1)) { numBytesFiltered += testLines[i].length() + strlen("\n"); } } @@ -91,14 +91,14 @@ int main(int argc, char *argv[]) { cout << "2) Read file " << testFile << " into vector" << endl; try { - vector linesIn; + vector linesIn; // read entire file, filter comments Isis::TextFile g(testFile, "input", linesIn); int chkVectorSize = 0; // chk num bytes read for(int i = 0; i < (int) linesIn.size(); i++) { - chkVectorSize += string(linesIn[i]).length() + strlen("\n"); + chkVectorSize += QString(linesIn[i]).length() + strlen("\n"); } if(chkVectorSize != numBytesFiltered) { cout << " *** Failed Size Test Filtered *** " << endl; @@ -136,14 +136,14 @@ int main(int argc, char *argv[]) { // ---------------------------------------------------------------------------------- - cout << "3) Create / Overwrite file " << testFile << " with prefilled string array" << endl; + cout << "3) Create / Overwrite file " << testFile << " with prefilled QString array" << endl; try { // write first four lines Isis::TextFile p(testFile, "overwrite", testLines, 4); if(p.Size() != testLineBytes[4]) { // chk num bytes - cout << " *** Failed Size Test WRITE sense NULL in string array*** " << endl; + cout << " *** Failed Size Test WRITE sense NULL in QString array*** " << endl; cout << "Calc bytes = " << testLineBytes[4] << " methodSize = " << p.Size() << endl; } @@ -156,20 +156,20 @@ int main(int argc, char *argv[]) { // ---------------------------------------------------------------------------------- - cout << "4) Read file " << testFile << " into string array" << endl; + cout << "4) Read file " << testFile << " into QString array" << endl; try { - // prefill string array to nonnull, set last element to null + // prefill QString array to nonnull, set last element to null // the read file call below will not specify howmany lines to read - // so TextFile will stop filling string array when it encounters a null in output array + // so TextFile will stop filling QString array when it encounters a null in output array - string linesIn[4] = {" ", " ", " ", ""}; + QString linesIn[4] = {" ", " ", " ", ""}; Isis::TextFile g(testFile, "input", linesIn, 0, false); // read entire file unfiltered for(int i = 0; i <= 2; i++) { // chk orig data against data read if(linesIn[i] != testLines[i]) { - cout << " *** Failed Compare Test READ sense NULL in string array*** " << endl; + cout << " *** Failed Compare Test READ sense NULL in QString array*** " << endl; break; } } @@ -206,7 +206,7 @@ int main(int argc, char *argv[]) { f.PutLine("# 0 zero line\n"); // char output f.SetNewLine(); // reset default append new line - f.SetComment(); // reset default comment string + f.SetComment(); // reset default comment QString f.PutLineComment(" 1 first line"); // char output f.PutLineComment(" 2 second line"); // char output @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) { try { Isis::TextFile f(testFile, "Input"); - string line; + QString line; for(int i = 0; i <= 12; i++) { // chk each file line against internal array f.GetLineNoFilter(line); @@ -327,7 +327,7 @@ int main(int argc, char *argv[]) { f.Rewind(); // set input ptr back to beginning f.SetComment("/*"); // set comment to '/*' - string lastLine; + QString lastLine; while(f.GetLine(line)) { // read file's 12 lines lastLine = line; @@ -379,7 +379,7 @@ int main(int argc, char *argv[]) { f.Rewind(); // set ptr back to begining - string(line); + QString(line); // re-read file to line 3 for(int i = 1; i <= 3; i++) { // to chk replacement f.GetLineNoFilter(line); @@ -494,14 +494,14 @@ int main(int argc, char *argv[]) { // create file that doesn't end in a newline and then test GetLine FILE *fp; FileName testFileName(testFile); - fp = fopen(testFileName.expanded().c_str(), "w"); + fp = fopen(testFileName.expanded().toAscii().data(), "w"); fprintf(fp, "this file has no newline chars in it!"); //???SEG FAULT HERE!!!!!!! fclose(fp); TextFile tf; tf.Open(testFile); - string fileContents = ""; - string line = ""; + QString fileContents = ""; + QString line = ""; while(tf.GetLine(line, true)) { fileContents += line; line = ""; @@ -511,7 +511,7 @@ int main(int argc, char *argv[]) { // call to getline returned false. fileContents += line; - string passed = "Failed"; + QString passed = "Failed"; if(fileContents != "") passed = "Passed"; @@ -523,61 +523,19 @@ int main(int argc, char *argv[]) { cout << "11) Remove temp file -> " << testFile << " <-\n" << endl; - if(std::remove(testFileName.expanded().c_str())) { // cleanup tmp file + if(std::remove(testFileName.expanded().toAscii().data())) { // cleanup tmp file cout << "*** Failed to remove tmp file: " << testFile << endl; } } /** * Reports error messages from Isis:iException without full paths of filenames - * @param err Error string of iException + * @param err Error QString of iException * @author Jeannie Walldren * @internal * @history 2011-08-05 Jeannie Backer - Copied from Cube class. */ -void ReportError(IString err) { - IString report = ""; // report will be modified error message - IString errorLine = ""; // read message one line at a time - FileName expandedfile; - while(err != "") { - // pull off first line - errorLine = err.Token("\n"); - while(errorLine != "") { - size_t openBrace = errorLine.find('['); - if(openBrace != string::npos) { - // if open brace is found, look to see if a filename is inside (indicated by '/') - if(errorLine.at(openBrace + 1) == '/') { - // add message up to - report += errorLine.Token("["); - // and including [ - report += "["; - // read entire path into FileName object - expandedfile = errorLine.Token("]"); - // only keep the name of the immediate directory - IString path = expandedfile.originalPath(); - while (path.find("/") != string::npos) { - path.Token("/"); - } - // only report immediate directory and file name, (rather than fully - // expanded path since this may differ on each system - report += "../" + path + "/" + expandedfile.name(); - report += "]"; - } - else { - // not a filename inside braces, add message up to and including ] - report += errorLine.Token("]"); - report += "]"; - continue; - } - } - else { - // no more braces are found, add rest of error message - report += errorLine; - break; - } - } - report += "\n"; - } - cout << report << endl; +void ReportError(QString err) { + cout << err.replace(QRegExp("\\[[^\\]*\\]"), "[]") << endl; } diff --git a/isis/src/base/objs/TiffExporter/TiffExporter.cpp b/isis/src/base/objs/TiffExporter/TiffExporter.cpp index 1221c4b7e7..8d9cb52999 100644 --- a/isis/src/base/objs/TiffExporter/TiffExporter.cpp +++ b/isis/src/base/objs/TiffExporter/TiffExporter.cpp @@ -5,6 +5,7 @@ #include "Buffer.h" #include "FileName.h" #include "IException.h" +#include "IString.h" using namespace Isis; @@ -63,7 +64,7 @@ namespace Isis { */ void TiffExporter::write(FileName outputName, int quality) { // Open the output image - m_image = TIFFOpen(outputName.expanded().c_str(), "w"); + m_image = TIFFOpen(outputName.expanded().toAscii().data(), "w"); if (m_image == NULL) { throw IException(IException::Programmer, @@ -113,7 +114,7 @@ namespace Isis { break; default: throw IException(IException::Programmer, - "Invalid pixel type for data [" + IString(type) + "]", + "Invalid pixel type for data [" + toString(type) + "]", _FILEINFO_); } } @@ -139,7 +140,7 @@ namespace Isis { * * @return True if "tiff", false otherwise */ - bool TiffExporter::canWriteFormat(IString format) { + bool TiffExporter::canWriteFormat(QString format) { return format == "tiff"; } }; diff --git a/isis/src/base/objs/TiffExporter/TiffExporter.h b/isis/src/base/objs/TiffExporter/TiffExporter.h index 4e6db9fde5..12397a7cbc 100644 --- a/isis/src/base/objs/TiffExporter/TiffExporter.h +++ b/isis/src/base/objs/TiffExporter/TiffExporter.h @@ -55,7 +55,7 @@ namespace Isis { virtual void write(FileName outputName, int quality=100); - static bool canWriteFormat(IString format); + static bool canWriteFormat(QString format); protected: virtual void createBuffer(); diff --git a/isis/src/base/objs/TiffImporter/TiffImporter.cpp b/isis/src/base/objs/TiffImporter/TiffImporter.cpp index 51318c6ca9..a23c78e678 100644 --- a/isis/src/base/objs/TiffImporter/TiffImporter.cpp +++ b/isis/src/base/objs/TiffImporter/TiffImporter.cpp @@ -13,7 +13,7 @@ namespace Isis { TiffImporter::TiffImporter(FileName inputName) : ImageImporter(inputName) { // Open the TIFF image m_image = NULL; - if ((m_image = TIFFOpen(inputName.expanded().c_str(), "r")) == NULL) { + if ((m_image = TIFFOpen(inputName.expanded().toAscii().data(), "r")) == NULL) { throw IException(IException::Programmer, "Could not open incoming image", _FILEINFO_); } diff --git a/isis/src/base/objs/TiffImporter/unitTest.cpp b/isis/src/base/objs/TiffImporter/unitTest.cpp index 5b965009c0..33dde121fc 100644 --- a/isis/src/base/objs/TiffImporter/unitTest.cpp +++ b/isis/src/base/objs/TiffImporter/unitTest.cpp @@ -1,7 +1,10 @@ #include +#include + #include "FileName.h" #include "IException.h" +#include "IString.h" #include "Preference.h" #include "TiffImporter.h" @@ -26,7 +29,7 @@ int main(int argc, char *argv[]) { cout << "Clean-up" << endl; delete importer; - remove(outputName.expanded().c_str()); + QFile::remove(outputName.expanded()); cout << endl << "Done" << endl; } diff --git a/isis/src/base/objs/TileManager/TileManager.h b/isis/src/base/objs/TileManager/TileManager.h index 98c865a58d..947d872f07 100644 --- a/isis/src/base/objs/TileManager/TileManager.h +++ b/isis/src/base/objs/TileManager/TileManager.h @@ -1,4 +1,4 @@ -#if !defined(TileManager_h) +#ifndef TileManager_h #define TileManager_h /** * @file diff --git a/isis/src/base/objs/TileManager/unitTest.cpp b/isis/src/base/objs/TileManager/unitTest.cpp index 07ce87102b..340ffd1677 100644 --- a/isis/src/base/objs/TileManager/unitTest.cpp +++ b/isis/src/base/objs/TileManager/unitTest.cpp @@ -6,28 +6,30 @@ #include "TileManager.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - string fname = "IsisTileUnitTest"; + QString fname = "IsisTileUnitTest"; const int ns = 254; const int nl = 300; const int nb = 2; // Allocate a cube - Isis::Cube *cube = new Isis::Cube; + Cube *cube = new Cube; try { cube->setDimensions(ns, nl, nb); cube->create(fname); } - catch(Isis::IException &e) { + catch(IException &e) { delete cube; e.print(); } // Create a tile buffer for the cube with default size (128,128) - Isis::TileManager tile(*cube); + TileManager tile(*cube); cout << "tiles = " << tile.Tiles() << endl; // Get each tile and output the sample, line and band of the upper left corner @@ -41,7 +43,7 @@ int main(int argc, char *argv[]) { } // Create a tile buffer for the cube with (91,113) - Isis::TileManager tile2(*cube, 91, 113); + TileManager tile2(*cube, 91, 113); // Get each tile and output the sample, line and band of the upper left corner cout << "Coordinates of upper left pixel in each 91 x 113 tile" << endl; diff --git a/isis/src/base/objs/Topo/unitTest.cpp b/isis/src/base/objs/Topo/unitTest.cpp index 87b50ba25c..3bea0ab04c 100644 --- a/isis/src/base/objs/Topo/unitTest.cpp +++ b/isis/src/base/objs/Topo/unitTest.cpp @@ -29,8 +29,8 @@ int main() { PvlGroup algn("Algorithm"); algn += PvlKeyword("Name", "Topo"); - algn += PvlKeyword("Albedo", 0.0690507); - algn += PvlKeyword("Incref", 30.0); + algn += PvlKeyword("Albedo", "0.0690507"); + algn += PvlKeyword("Incref", "30.0"); PvlObject on("NormalizationModel"); on.AddGroup(algn); diff --git a/isis/src/base/objs/TopoAtm/unitTest.cpp b/isis/src/base/objs/TopoAtm/unitTest.cpp index b1a7738ebb..a5b1ccf248 100644 --- a/isis/src/base/objs/TopoAtm/unitTest.cpp +++ b/isis/src/base/objs/TopoAtm/unitTest.cpp @@ -30,15 +30,15 @@ int main() { PvlGroup alga("Algorithm"); alga += PvlKeyword("Name", "Anisotropic1"); - alga += PvlKeyword("Bha", 0.85); + alga += PvlKeyword("Bha", "0.85"); PvlObject oa("AtmosphericModel"); oa.AddGroup(alga); PvlGroup algn("Algorithm"); algn += PvlKeyword("Name", "TopoAtm"); - algn += PvlKeyword("Albedo", 0.0690507); - algn += PvlKeyword("Incref", 30.0); + algn += PvlKeyword("Albedo", "0.0690507"); + algn += PvlKeyword("Incref", "30.0"); PvlObject on("NormalizationModel"); on.AddGroup(algn); diff --git a/isis/src/base/objs/TransverseMercator/TransverseMercator.cpp b/isis/src/base/objs/TransverseMercator/TransverseMercator.cpp index 3d62538210..428d44f8f4 100644 --- a/isis/src/base/objs/TransverseMercator/TransverseMercator.cpp +++ b/isis/src/base/objs/TransverseMercator/TransverseMercator.cpp @@ -62,14 +62,14 @@ namespace Isis { // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLongitude"))) { double lon = (m_minimumLongitude + m_maximumLongitude) / 2.0; - mapGroup += PvlKeyword("CenterLongitude", lon); + mapGroup += PvlKeyword("CenterLongitude", toString(lon)); } // Compute and write the default center latitude if allowed and // necessary if ((allowDefaults) && (!mapGroup.HasKeyword("CenterLatitude"))) { double lat = (m_minimumLatitude + m_maximumLatitude) / 2.0; - mapGroup += PvlKeyword("CenterLatitude", lat); + mapGroup += PvlKeyword("CenterLatitude", toString(lat)); } // Get the center longitude & latitude @@ -117,7 +117,7 @@ namespace Isis { // Get the scale factor if ((allowDefaults) && (!mapGroup.HasKeyword("ScaleFactor"))) { - mapGroup += PvlKeyword("ScaleFactor", 1.0); + mapGroup += PvlKeyword("ScaleFactor", toString(1.0)); } m_scalefactor = mapGroup["ScaleFactor"]; } @@ -154,7 +154,7 @@ namespace Isis { * * @return string Name of projection, "TransverseMercator" */ - string TransverseMercator::Name() const { + QString TransverseMercator::Name() const { return "TransverseMercator"; } @@ -164,7 +164,7 @@ namespace Isis { * * @return string Version number */ - string TransverseMercator::Version() const { + QString TransverseMercator::Version() const { return "1.0"; } diff --git a/isis/src/base/objs/TransverseMercator/TransverseMercator.h b/isis/src/base/objs/TransverseMercator/TransverseMercator.h index f4a21223ff..d71a61e1bf 100644 --- a/isis/src/base/objs/TransverseMercator/TransverseMercator.h +++ b/isis/src/base/objs/TransverseMercator/TransverseMercator.h @@ -74,8 +74,8 @@ namespace Isis { ~TransverseMercator(); bool operator== (const Projection &proj); - std::string Name() const; - std::string Version() const; + QString Name() const; + QString Version() const; bool SetGround(const double lat, const double lon); bool SetCoordinate(const double x, const double y); diff --git a/isis/src/base/objs/TransverseMercator/unitTest.cpp b/isis/src/base/objs/TransverseMercator/unitTest.cpp index eb04a45156..00594b64e2 100644 --- a/isis/src/base/objs/TransverseMercator/unitTest.cpp +++ b/isis/src/base/objs/TransverseMercator/unitTest.cpp @@ -1,67 +1,71 @@ #include #include + + #include "TransverseMercator.h" #include "IException.h" #include "ProjectionFactory.h" #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); cout << "UNIT TEST FOR TransverseMercator" << endl << endl; cout << "Part 1: Sphere..." << endl; - Isis::Pvl lab; - lab.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup = lab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", 1.0); - mapGroup += Isis::PvlKeyword("PolarRadius", 1.0); - mapGroup += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 180); - mapGroup += Isis::PvlKeyword("MinimumLatitude", -70.0); - mapGroup += Isis::PvlKeyword("MaximumLatitude", 70.0); - mapGroup += Isis::PvlKeyword("MinimumLongitude", -90.0); - mapGroup += Isis::PvlKeyword("MaximumLongitude", -60.0); - mapGroup += Isis::PvlKeyword("ProjectionName", "TransverseMercator"); + Pvl lab; + lab.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup = lab.FindGroup("Mapping"); + mapGroup += PvlKeyword("EquatorialRadius", toString(1.0)); + mapGroup += PvlKeyword("PolarRadius", toString(1.0)); + mapGroup += PvlKeyword("LatitudeType", "Planetographic"); + mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup += PvlKeyword("LongitudeDomain", toString(180)); + mapGroup += PvlKeyword("MinimumLatitude", toString(-70.0)); + mapGroup += PvlKeyword("MaximumLatitude", toString(70.0)); + mapGroup += PvlKeyword("MinimumLongitude", toString(-90.0)); + mapGroup += PvlKeyword("MaximumLongitude", toString(-60.0)); + mapGroup += PvlKeyword("ProjectionName", "TransverseMercator"); cout << "Test missing center longitude keyword ..." << endl; try { - Isis::TransverseMercator p(lab); + TransverseMercator p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLongitude", -75.0); + mapGroup += PvlKeyword("CenterLongitude", toString(-75.0)); cout << "Test missing center latitude keyword..." << endl; try { - Isis::TransverseMercator p(lab); + TransverseMercator p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("CenterLatitude", 0.0); + mapGroup += PvlKeyword("CenterLatitude", toString(0.0)); cout << "Test missing scale factor keyword..." << endl; try { - Isis::TransverseMercator p(lab); + TransverseMercator p(lab); } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl; - mapGroup += Isis::PvlKeyword("ScaleFactor", 1.0); + mapGroup += PvlKeyword("ScaleFactor", toString(1.0)); try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab); - // Isis::TransMercator p(lab); + Projection &p = *ProjectionFactory::Create(lab); + // TransMercator p(lab); cout << "Test SetGround method ... " << endl; cout << std::setprecision(9); @@ -92,7 +96,7 @@ int main(int argc, char *argv[]) { cout << "Maximum Y: " << maxY << endl; cout << endl; - Isis::Projection *s = &p; + Projection *s = &p; cout << "Test Name and comparision method ... " << endl; cout << "Name: " << s->Name() << endl; cout << "operator== " << (*s == *s) << endl; @@ -102,7 +106,7 @@ int main(int argc, char *argv[]) { mapGroup.DeleteKeyword("CenterLongitude"); mapGroup.DeleteKeyword("CenterLatitude"); mapGroup.DeleteKeyword("ScaleFactor"); - Isis::TransverseMercator p2(lab, true); + TransverseMercator p2(lab, true); cout << lab << endl; cout << endl; @@ -111,33 +115,33 @@ int main(int argc, char *argv[]) { cout << " USGS Professional Paper 1395 by John P. Snyder" << endl; cout << " Pages 268-269" << endl << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } cout << endl << "Part 2: Ellipsoid..." << endl; - Isis::Pvl lab2; - lab2.AddGroup(Isis::PvlGroup("Mapping")); - Isis::PvlGroup &mapGroup2 = lab2.FindGroup("Mapping"); - mapGroup2 += Isis::PvlKeyword("EquatorialRadius", 6378206.4); - mapGroup2 += Isis::PvlKeyword("PolarRadius", 6356583.8); - mapGroup2 += Isis::PvlKeyword("LatitudeType", "Planetographic"); - mapGroup2 += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup2 += Isis::PvlKeyword("LongitudeDomain", 180); - mapGroup2 += Isis::PvlKeyword("MinimumLatitude", -70.0); - mapGroup2 += Isis::PvlKeyword("MaximumLatitude", 70.0); - mapGroup2 += Isis::PvlKeyword("MinimumLongitude", -90.0); - mapGroup2 += Isis::PvlKeyword("MaximumLongitude", -60.0); - mapGroup2 += Isis::PvlKeyword("ProjectionName", "TransverseMercator"); - mapGroup2 += Isis::PvlKeyword("CenterLongitude", -75.0); - mapGroup2 += Isis::PvlKeyword("CenterLatitude", 0.0); - mapGroup2 += Isis::PvlKeyword("ScaleFactor", 0.9996); + Pvl lab2; + lab2.AddGroup(PvlGroup("Mapping")); + PvlGroup &mapGroup2 = lab2.FindGroup("Mapping"); + mapGroup2 += PvlKeyword("EquatorialRadius", toString(6378206.4)); + mapGroup2 += PvlKeyword("PolarRadius", toString(6356583.8)); + mapGroup2 += PvlKeyword("LatitudeType", "Planetographic"); + mapGroup2 += PvlKeyword("LongitudeDirection", "PositiveEast"); + mapGroup2 += PvlKeyword("LongitudeDomain", toString(180)); + mapGroup2 += PvlKeyword("MinimumLatitude", toString(-70.0)); + mapGroup2 += PvlKeyword("MaximumLatitude", toString(70.0)); + mapGroup2 += PvlKeyword("MinimumLongitude", toString(-90.0)); + mapGroup2 += PvlKeyword("MaximumLongitude", toString(-60.0)); + mapGroup2 += PvlKeyword("ProjectionName", "TransverseMercator"); + mapGroup2 += PvlKeyword("CenterLongitude", toString(-75.0)); + mapGroup2 += PvlKeyword("CenterLatitude", toString(0.0)); + mapGroup2 += PvlKeyword("ScaleFactor", toString(0.9996)); cout << endl; try { - Isis::Projection &p = *Isis::ProjectionFactory::Create(lab2); - // Isis::TransMercator p(lab); + Projection &p = *ProjectionFactory::Create(lab2); + // TransMercator p(lab); cout << "Test SetGround method ... " << endl; cout << std::setprecision(9); @@ -170,9 +174,9 @@ int main(int argc, char *argv[]) { cout << "Testing Mapping() methods ... " << endl; - Isis::Pvl tmp1; - Isis::Pvl tmp2; - Isis::Pvl tmp3; + Pvl tmp1; + Pvl tmp2; + Pvl tmp3; tmp1.AddGroup(p.Mapping()); tmp2.AddGroup(p.MappingLatitudes()); tmp3.AddGroup(p.MappingLongitudes()); @@ -190,7 +194,7 @@ int main(int argc, char *argv[]) { cout << " USGS Professional Paper 1395 by John P. Snyder" << endl; cout << " Pages 269-270" << endl; } - catch(Isis::IException &e) { + catch(IException &e) { e.print(); } } diff --git a/isis/src/base/objs/UniversalGroundMap/UniversalGroundMap.cpp b/isis/src/base/objs/UniversalGroundMap/UniversalGroundMap.cpp index fa889bacd1..c45b3f5396 100644 --- a/isis/src/base/objs/UniversalGroundMap/UniversalGroundMap.cpp +++ b/isis/src/base/objs/UniversalGroundMap/UniversalGroundMap.cpp @@ -65,7 +65,7 @@ namespace Isis { } catch (IException &secondError) { p_projection = NULL; - std::string msg = "Could not create camera or projection for [" + + QString msg = "Could not create camera or projection for [" + pvl.FileName() + "]"; IException realError(IException::Unknown, msg, _FILEINFO_); realError.append(firstError); diff --git a/isis/src/base/objs/UserInterface/UserInterface.cpp b/isis/src/base/objs/UserInterface/UserInterface.cpp index 9992dd77c8..05d935cc39 100644 --- a/isis/src/base/objs/UserInterface/UserInterface.cpp +++ b/isis/src/base/objs/UserInterface/UserInterface.cpp @@ -49,7 +49,7 @@ namespace Isis { * * @param argv[] Array of arguments */ - UserInterface::UserInterface(const std::string &xmlfile, int &argc, + UserInterface::UserInterface(const QString &xmlfile, int &argc, char *argv[]) : IsisAml::IsisAml(xmlfile) { p_interactive = false; @@ -117,7 +117,7 @@ namespace Isis { } // Check for special tokens (those beginning with a dash) - vector< string > options; + vector< QString > options; options.push_back("-GUI"); options.push_back("-NOGUI"); options.push_back("-BATCHLIST"); @@ -138,12 +138,12 @@ namespace Isis { // Use an initial pass to find conflicting parameters for(unsigned int currArgument = 1; currArgument < (unsigned) argc; currArgument ++) { - string paramName; - vector< string > paramValue; + QString paramName; + vector< QString > paramValue; GetNextParameter(currArgument, paramName, paramValue); - paramName = ((IString) paramName).UpCase(); + paramName = paramName.toUpper(); // -LAST needs to be evaluated first to prevent incorrect errors from IsisAml if(paramName == "-LAST") { @@ -153,14 +153,14 @@ namespace Isis { } for(unsigned int currArgument = 1; currArgument < (unsigned) argc; currArgument ++) { - string paramName; - vector< string > paramValue; + QString paramName; + vector< QString > paramValue; GetNextParameter(currArgument, paramName, paramValue); // we now have a name,value pair if(paramName[0] == '-') { - paramName = ((IString) paramName).UpCase(); + paramName = paramName.toUpper(); // Prevent double handling of conflicting parameters handled in first pass if(paramName == "-LAST") { @@ -168,7 +168,7 @@ namespace Isis { } if(paramValue.size() > 1) { - string msg = "Invalid value for reserve parameter [" + QString msg = "Invalid value for reserve parameter [" + paramName + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -178,10 +178,10 @@ namespace Isis { for(int option = 0; option < (int) options.size(); option ++) { // If our option starts with the parameter name so far, this is it - if(options[option].find(paramName) == 0) { + if(options[option].startsWith(paramName)) { if(matchOption >= 0) { - string msg = "Ambiguous Reserve Parameter [" - + paramName + "]. Please clarify."; + QString msg = "Ambiguous Reserve Parameter [" + + paramName + "]. Please clarify."; throw IException(IException::User, msg, _FILEINFO_); } @@ -190,10 +190,10 @@ namespace Isis { } if(matchOption < 0) { - string msg = "Invalid Reserve Parameter Option [" - + paramName + "]. Choices are "; + QString msg = "Invalid Reserve Parameter Option [" + + paramName + "]. Choices are "; - IString msgOptions; + QString msgOptions; for(int option = 0; option < (int) options.size() - 1; option ++) { // Make sure not to show -PID as an option if(options[option].compare("-PID") != 0) { @@ -218,7 +218,7 @@ namespace Isis { usedDashLast = true; } - IString realValue = ""; + QString realValue = ""; if(paramValue.size()) realValue = paramValue[0]; @@ -240,7 +240,7 @@ namespace Isis { // Can't use the batchlist with the gui, save, last or restore option if(BatchListSize() != 0 && (p_interactive || usedDashLast || p_saveFile != "")) { - string msg = + QString msg = "-BATCHLIST cannot be used with -GUI, -SAVE, -RESTORE, "; msg += "or -LAST"; throw IException(IException::User, msg, _FILEINFO_); @@ -248,7 +248,7 @@ namespace Isis { // Must use batchlist if using errorlist or onerror=continue if((BatchListSize() == 0) && (!p_abortOnError || p_errList != "")) { - string msg = + QString msg = "-ERRLIST and -ONERROR=continue cannot be used without "; msg += " the -BATCHLIST option"; throw IException(IException::User, msg, _FILEINFO_); @@ -265,19 +265,19 @@ namespace Isis { * @param value Resulting array of parameter values (usually just 1 element) */ void UserInterface::GetNextParameter(unsigned int &curPos, - std::string &name, std::vector< std::string > &value) { - IString paramName = p_cmdline[curPos]; - IString paramValue = ""; + QString &name, std::vector< QString > &value) { + QString paramName = p_cmdline[curPos]; + QString paramValue = ""; // we need to split name and value, they can either be in 1, 2 or 3 arguments, // try to see if "=" is end of argument to distinguish. Some options have no // "=" and they are value-less (-gui for example). - if(paramName.find("=") == string::npos) { + if(!paramName.contains("=")) { // This looks value-less, but lets make sure // the next argument is not an equals sign by // itself if(curPos < p_cmdline.size() - 2) { - if(string(p_cmdline[curPos + 1]).compare("=") == 0) { + if(QString(p_cmdline[curPos + 1]).compare("=") == 0) { paramValue = p_cmdline[curPos + 2]; // increment extra to skip 2 elements next time around @@ -286,8 +286,8 @@ namespace Isis { } } // = is end of parameter, next item must be value - else if(paramName.find("=") == paramName.size() - 1) { - paramName = paramName.substr(0, paramName.size() - 1); + else if(paramName.endsWith("=")) { + paramName = paramName.mid(0, paramName.size() - 1); if(curPos + 1 < p_cmdline.size()) { paramValue = p_cmdline[curPos + 1]; @@ -297,17 +297,17 @@ namespace Isis { curPos ++ ; } // we found "=" in the middle - else if(paramName.find("=") != 0) { - string parameterLiteral = p_cmdline[curPos]; + else if(paramName.indexOf("=") > 0) { + QString parameterLiteral = p_cmdline[curPos]; paramName - = parameterLiteral.substr(0, parameterLiteral.find("=")); - paramValue = parameterLiteral.substr(parameterLiteral.find("=") - + 1); + = parameterLiteral.mid(0, parameterLiteral.indexOf("=")); + paramValue = parameterLiteral.mid(parameterLiteral.indexOf("=") + + 1); } // We found "=" at the beginning - did we find "appname param =value" ? else { // parameters can not start with "=" - string msg = "Unknown parameter [" + string(p_cmdline[curPos]) + QString msg = "Unknown parameter [" + QString(p_cmdline[curPos]) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -316,21 +316,21 @@ namespace Isis { value.clear(); // read arrays out of paramValue - paramValue = paramValue.Trim(" "); + paramValue = paramValue.trimmed(); if(paramValue.length() > 0 && paramValue[0] != '(') { // We dont have an array... if they escaped // an open paren, undo their escape // escape: \( result: ( - if(paramValue.length() > 1 && paramValue.substr(0, 2).compare( - "\\(") == 0) { - paramValue = paramValue.substr(1); + if(paramValue.length() > 1 && paramValue.mid(0, 2) == + "\\(") { + paramValue = paramValue.mid(1); } // escape: \\( result: \( else if(paramValue.length() > 2 - && paramValue.substr(0, 4).compare("\\\\(") == 0) { - paramValue = paramValue.substr(1); + && paramValue.mid(0, 4) == "\\\\(") { + paramValue = paramValue.mid(1); } value.push_back(paramValue); @@ -347,21 +347,21 @@ namespace Isis { * @param arrayString Parameter value containing an array of * format (a,b,c) * - * @return std::vector Values in the array string + * @return std::vector Values in the array QString */ - std::vector< std::string > UserInterface::ReadArray(IString arrayString) { - std::vector< std::string > values; + std::vector< QString > UserInterface::ReadArray(QString arrayString) { + std::vector< QString > values; bool inDoubleQuotes = false; bool inSingleQuotes = false; bool arrayClosed = false; bool nextElementStarted = false; - IString currElement = ""; + QString currElement = ""; - for(unsigned int strPos = 0; strPos < arrayString.size(); strPos ++) { + for(int strPos = 0; strPos < arrayString.size(); strPos ++) { if(strPos == 0) { if(arrayString[strPos] != '(') { - string msg = "Invalid array format [" + arrayString + "]"; + QString msg = "Invalid array format [" + arrayString + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -369,21 +369,21 @@ namespace Isis { } // take literally anything that is escaped and not quoted - if(arrayString[strPos] == '\\' && strPos + 1 < arrayString.size()) { + if(arrayString[strPos] == '\\' && strPos + 1 < (int)arrayString.size()) { currElement += arrayString[strPos+1]; strPos ++; continue; } // ends in a backslash?? else if(arrayString[strPos] == '\\') { - string msg = "Invalid array format [" + arrayString + "]"; + QString msg = "Invalid array format [" + arrayString + "]"; throw IException(IException::User, msg, _FILEINFO_); } - // not in quoted part of string + // not in quoted part of QString if(!inDoubleQuotes && !inSingleQuotes) { if(arrayClosed) { - string msg = "Invalid array format [" + arrayString + "]"; + QString msg = "Invalid array format [" + arrayString + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -415,7 +415,7 @@ namespace Isis { bool onlyWhite = true; int closingPos = strPos + 1; - for(unsigned int pos = strPos; + for(int pos = strPos; onlyWhite && arrayString[pos] != ',' && arrayString[pos] != ')' && pos < arrayString.size(); pos++) { closingPos ++; @@ -451,7 +451,7 @@ namespace Isis { if(!arrayClosed || currElement != "") { - string msg = "Invalid array format [" + arrayString + "]"; + QString msg = "Invalid array format [" + arrayString + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -464,8 +464,8 @@ namespace Isis { * @param name "-OPTIONNAME" * @param value Value of the option, if supplied (-name=value) */ - void UserInterface::EvaluateOption(const std::string name, - const std::string value) { + void UserInterface::EvaluateOption(const QString name, + const QString value) { Preference &p = Preference::Preferences(); if(name == "-GUI") { @@ -479,7 +479,7 @@ namespace Isis { } else if(name == "-LAST") { PvlGroup &grp = p.FindGroup("UserInterface", Isis::Pvl::Traverse); - IString histFile = grp["HistoryPath"][0] + "/" + FileName( + QString histFile = grp["HistoryPath"][0] + "/" + FileName( p_progName).name() + ".par"; LoadHistory(histFile); @@ -490,7 +490,7 @@ namespace Isis { else if(name == "-WEBHELP") { Isis::PvlGroup &pref = Isis::Preference::Preferences().FindGroup( "UserInterface"); - string command = pref["GuiHelpBrowser"]; + QString command = pref["GuiHelpBrowser"]; command += " $ISISROOT/doc/Application/presentation/Tabbed/"; command += FileName(p_progName).name() + "/" + FileName( p_progName).name() + ".html"; @@ -517,7 +517,7 @@ namespace Isis { } else { PvlKeyword key(ParamName(k, j)); - string def = ParamDefault(k, j); + QString def = ParamDefault(k, j); for(int l = 0; l < ParamListSize(k, j); l ++) { if(ParamListValue(k, j, l) == def) key.AddValue("*" + def); @@ -533,7 +533,7 @@ namespace Isis { else { Pvl param; param.SetTerminator(""); - string key = value; + QString key = value; for(int k = 0; k < NumGroups(); k ++) { for(int j = 0; j < NumParams(k); j ++) { if(ParamName(k, j) == key) { @@ -662,31 +662,31 @@ namespace Isis { exit(0); } else if(name == "-PID") { - p_parentId = IString(value).ToInteger(); + p_parentId = toInt(value); } else if(name == "-ERRLIST") { p_errList = value; if(value == "") { - string msg = "-ERRLIST expects a file name"; + QString msg = "-ERRLIST expects a file name"; throw IException(IException::User, msg, _FILEINFO_); } if(FileName(p_errList).fileExists()) { - remove(p_errList.c_str()); + QFile::remove(p_errList); } } else if(name == "-ONERROR") { - if(IString(value).UpCase() == "CONTINUE") { + if(value.toUpper() == "CONTINUE") { p_abortOnError = false; } - else if(IString(value).UpCase() == "ABORT") { + else if(value.toUpper() == "ABORT") { p_abortOnError = true; } else { - string + QString msg = "[" + value + "] is an invalid value for -ONERROR, options are ABORT or CONTINUE"; @@ -705,7 +705,7 @@ namespace Isis { p.Load(value); } else if(name == "-LOG") { - if(value.empty()) { + if(value.isEmpty()) { p.FindGroup("SessionLog")["FileOutput"].SetValue("On"); } else { @@ -719,7 +719,7 @@ namespace Isis { // Can't have a parent id and the gui if(p_parentId > 0 && p_interactive) { - string msg = "-GUI and -PID are incompatible arguments"; + QString msg = "-GUI and -PID are incompatible arguments"; throw IException(IException::Unknown, msg, _FILEINFO_); } } @@ -733,14 +733,14 @@ namespace Isis { * columns in the batchlist file to 10. * @throws Isis::IException::User - The batchlist does not contain any data */ - void UserInterface::LoadBatchList(const std::string file) { + void UserInterface::LoadBatchList(const QString file) { // Read in the batch list TextFile temp; try { temp.Open(file); } catch (IException &e) { - string msg = "The batchlist file [" + file + QString msg = "The batchlist file [" + file + "] could not be opened"; throw IException(IException::User, msg, _FILEINFO_); } @@ -748,42 +748,42 @@ namespace Isis { p_batchList.resize(temp.LineCount()); for(int i = 0; i < temp.LineCount(); i ++) { - IString t; + QString t; temp.GetLine(t); // Convert tabs to spaces but leave tabs inside quotes alone - t.Replace("\t", " ", true); + t = IString(t).Replace("\t", " ", true).ToQt(); - t.Compress(); - t.Trim(" "); + t = IString(t).Compress().ToQt().trimmed(); // Allow " ," " , " or ", " as a valid single seperator - t.Replace(" ,", ",", true); - t.Replace(", ", ",", true); + t = IString(t).Replace(" ,", ",", true).ToQt(); + t = IString(t).Replace(", ", ",", true).ToQt(); // Convert all spaces to "," the use "," as delimiter - t.Replace(" ", ",", true); + t = IString(t).Replace(" ", ",", true).ToQt(); int j = 0; - IString token = t.Token(","); - while(token != "") { + QStringList tokens = t.split(","); + + foreach(QString token, tokens) { // removes quotes from tokens. NOTE: also removes escaped quotes. - token = token.Remove("\"'"); + token = token.remove(QRegExp("[\"']")); p_batchList[i].push_back(token); - token = t.Token(","); j ++ ; } + p_batchList[i].resize(j); // Every row in the batchlist must have the same number of columns if(i == 0) continue; if(p_batchList[i - 1].size() != p_batchList[i].size()) { - string msg = + QString msg = "The number of columns must be constant in batchlist"; throw IException(IException::User, msg, _FILEINFO_); } } // The batchlist cannot be empty if(p_batchList.size() < 1) { - string msg = "The list file [" + file + QString msg = "The list file [" + file + "] does not contain any data"; throw IException(IException::User, msg, _FILEINFO_); } @@ -800,7 +800,7 @@ namespace Isis { * history file * @throws Isis::iException::User - Parameter history file does not exist */ - void UserInterface::LoadHistory(const std::string file) { + void UserInterface::LoadHistory(const QString file) { Isis::FileName hist(file); if(hist.fileExists()) { try { @@ -810,9 +810,9 @@ namespace Isis { if(g >= 0 && lab.Group(g).IsNamed("UserParameters")) { Isis::PvlGroup &up = lab.Group(g); for(int k = 0; k < up.Keywords(); k ++) { - string keyword = up[k].Name(); + QString keyword = up[k].Name(); - vector values; + vector values; for(int i = 0; i < up[k].Size(); i++) { values.push_back(up[k][i]); @@ -847,8 +847,8 @@ namespace Isis { Isis::PvlGroup &up = obj.Group(g); if(up.IsNamed("UserParameters")) { for(int k = 0; k < up.Keywords(); k ++) { - string keyword = up[k].Name(); - string value = up[k][0]; + QString keyword = up[k].Name(); + QString value = up[k][0]; PutAsString(keyword, value); } } @@ -857,18 +857,18 @@ namespace Isis { } } - /*string msg = "[" + hist.expanded() + + /*QString msg = "[" + hist.expanded() + "] does not contain any parameters to restore"; throw Isis::iException::Message( Isis::iException::User, msg, _FILEINFO_ );*/ } catch(...) { - string msg = "The history file [" + file + QString msg = "The history file [" + file + "] is corrupt, please fix or delete this file"; throw IException(IException::User, msg, _FILEINFO_); } } else { - string msg = "The history file [" + file + "] does not exist"; + QString msg = "The history file [" + file + "] does not exist"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -914,7 +914,7 @@ namespace Isis { hist.AddGroup(cmdLine.FindGroup("UserParameters")); // See if we have exceeded history length - while(hist.Groups() > (int) grp["HistoryLength"][0]) { + while(hist.Groups() > toInt(grp["HistoryLength"][0])) { hist.DeleteGroup("UserParameters"); } @@ -945,8 +945,8 @@ namespace Isis { cout << p_progName << " "; for(unsigned int currArgument = 1; currArgument < p_cmdline.size(); currArgument ++) { - string paramName; - vector< string > paramValue; + QString paramName; + vector< QString > paramValue; try { GetNextParameter(currArgument, paramName, paramValue); @@ -957,21 +957,22 @@ namespace Isis { for(unsigned int value = 0; value < paramValue.size(); value ++) { IString thisValue = paramValue[value]; - string token = thisValue.Token("$"); - IString newValue; + QString token = thisValue.Token("$").ToQt(); + + QString newValue; while(thisValue != "") { newValue += token; try { - int j = IString(thisValue.substr(0, 1)).ToInteger() - 1; + int j = toInt(thisValue.substr(0, 1).c_str()) - 1; newValue += p_batchList[i][j]; thisValue.replace(0, 1, ""); - token = thisValue.Token("$"); + token = thisValue.Token("$").ToQt(); } catch (IException &e) { // Let the variable be parsed by the application newValue += "$"; - token = thisValue.Token("$"); + token = thisValue.Token("$").ToQt(); } } @@ -1021,11 +1022,11 @@ namespace Isis { void UserInterface::SetErrorList(int i) { if(p_errList != "") { std::ofstream os; - string fileName(FileName(p_errList).expanded()); - os.open(fileName.c_str(), std::ios::app); + QString fileName(FileName(p_errList).expanded()); + os.open(fileName.toAscii().data(), std::ios::app); if(!os.good()) { - string + QString msg = "Unable to create error list [" + p_errList + "] Disk may be full or directory permissions not writeable"; @@ -1055,9 +1056,9 @@ namespace Isis { * This method returns the filename where the debugging info is * stored when the "-info" tag is used. * - * @return @b string Name of file containing debugging ingo. + * @return @b QString Name of file containing debugging ingo. */ - std::string UserInterface::GetInfoFileName() { + QString UserInterface::GetInfoFileName() { return p_infoFileName; } } // end namespace isis diff --git a/isis/src/base/objs/UserInterface/UserInterface.h b/isis/src/base/objs/UserInterface/UserInterface.h index e36540181f..555882de12 100644 --- a/isis/src/base/objs/UserInterface/UserInterface.h +++ b/isis/src/base/objs/UserInterface/UserInterface.h @@ -129,7 +129,7 @@ namespace Isis { class UserInterface : public IsisAml { public: - UserInterface(const std::string &xmlfile, int &argc, char *argv[]); + UserInterface(const QString &xmlfile, int &argc, char *argv[]); ~UserInterface(); /** @@ -183,7 +183,7 @@ namespace Isis { void SetErrorList(int i); bool GetInfoFlag(); - std::string GetInfoFileName(); + QString GetInfoFileName(); private: std::vector p_cmdline; /**< This variable will contain argv.*/ @@ -191,28 +191,28 @@ namespace Isis { is running or not.*/ void LoadCommandLine(int argc, char *argv[]); - void LoadBatchList(const std::string file); - void LoadHistory(const std::string file); - void EvaluateOption(const std::string name, const std::string value); + void LoadBatchList(const QString file); + void LoadHistory(const QString file); + void EvaluateOption(const QString name, const QString value); void GetNextParameter(unsigned int &curPos, - std::string &name, std::vector &value); - std::vector ReadArray(IString arrayString); + QString &name, std::vector &value); + std::vector ReadArray(QString arrayString); //! Boolean value representing whether to abort or continue on error bool p_abortOnError; - std::string p_saveFile; //!< FileName to save last history to - std::string p_progName; //!< Name of program to run + QString p_saveFile; //!< FileName to save last history to + QString p_progName; //!< Name of program to run //!FileName to write batchlist line that caused error on - std::string p_errList; + QString p_errList; //!Vector of batchlist data - std::vector > p_batchList; + std::vector > p_batchList; bool p_interactive; /**< Boolean value representing whether the program is interactive or not.*/ bool p_info; //!< Boolean value representing if its in debug mode. - std::string p_infoFileName; //!< FileName to save debugging info + QString p_infoFileName; //!< FileName to save debugging info Gui *p_gui; //!< Pointer to the gui object }; }; diff --git a/isis/src/base/objs/UserInterface/unitTest.cpp b/isis/src/base/objs/UserInterface/unitTest.cpp index 7362a545dc..b32d6a674e 100644 --- a/isis/src/base/objs/UserInterface/unitTest.cpp +++ b/isis/src/base/objs/UserInterface/unitTest.cpp @@ -1,9 +1,12 @@ #include + #include "UserInterface.h" #include "IException.h" +#include "IString.h" #include "Preference.h" #include "FileName.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { @@ -11,8 +14,8 @@ int main(int argc, char *argv[]) { cout << "Unit test for Isis::UserInterface ..." << endl; - Isis::IString unitTestXml = Isis::FileName("unitTest.xml").expanded(); - string highpass = Isis::FileName("$ISISROOT/src/base/apps/highpass/highpass.xml").expanded(); + QString unitTestXml = Isis::FileName("unitTest.xml").expanded(); + QString highpass = Isis::FileName("$ISISROOT/src/base/apps/highpass/highpass.xml").expanded(); char *myArgv[15];// = {"unitTest", "from=input.cub", "to=output.cub"}; for(int i = 0; i < 15; i++) @@ -76,7 +79,7 @@ int main(int argc, char *argv[]) { strcpy(myArgv[myArgc ++], "3"); Isis::UserInterface ui(highpass, myArgc, myArgv); - vector vals; + vector vals; cout << "FROM: " << ui.GetAsString("FROM") << endl; cout << "TO: "; ui.GetAsString("TO", vals); @@ -104,7 +107,7 @@ int main(int argc, char *argv[]) { strcpy(myArgv[myArgc ++], "3"); Isis::UserInterface ui(highpass, myArgc, myArgv); - vector vals; + vector vals; cout << "FROM: " << ui.GetAsString("FROM") << endl; cout << "TO: " << endl; ui.GetAsString("TO", vals); @@ -130,7 +133,7 @@ int main(int argc, char *argv[]) { strcpy(myArgv[myArgc ++], "3"); Isis::UserInterface ui(highpass, myArgc, myArgv); - vector vals; + vector vals; cout << "FROM: " << ui.GetAsString("FROM") << endl; cout << "TO: " << endl; ui.GetAsString("TO", vals); @@ -162,7 +165,7 @@ int main(int argc, char *argv[]) { strcpy(myArgv[myArgc ++], "3"); Isis::UserInterface ui(highpass, myArgc, myArgv); - vector vals; + vector vals; cout << "FROM: " << ui.GetAsString("FROM") << endl; cout << "TO: " << ui.GetAsString("TO") << endl; cout << "GUI: " << ui.IsInteractive() << endl; @@ -256,7 +259,7 @@ int main(int argc, char *argv[]) { strcpy(myArgv[myArgc ++], "3"); Isis::UserInterface ui(highpass, myArgc, myArgv); - vector vals; + vector vals; cout << "FROM: " << ui.GetAsString("FROM") << endl; cout << "TO: " << ui.GetAsString("TO") << endl; cout << "GUI: " << ui.IsInteractive() << endl; diff --git a/isis/src/base/objs/VecFilter/VecFilter.cpp b/isis/src/base/objs/VecFilter/VecFilter.cpp index 466c533f49..2407bc60be 100644 --- a/isis/src/base/objs/VecFilter/VecFilter.cpp +++ b/isis/src/base/objs/VecFilter/VecFilter.cpp @@ -132,7 +132,7 @@ namespace Isis { * @return vector - Resulting vector after highpass */ vector VecFilter::HighPass(vector pdInVector1, vector pdInVector2, - vector piValidPntsVector, int piMaxPoints, const IString & psMode) + vector piValidPntsVector, int piMaxPoints, const QString & psMode) { vector dOutVector; diff --git a/isis/src/base/objs/VecFilter/VecFilter.h b/isis/src/base/objs/VecFilter/VecFilter.h index 5474351ec7..ba693d3877 100644 --- a/isis/src/base/objs/VecFilter/VecFilter.h +++ b/isis/src/base/objs/VecFilter/VecFilter.h @@ -21,7 +21,7 @@ */ #include -#include "IString.h" +#include namespace Isis { /** @@ -49,7 +49,7 @@ namespace Isis { std::vector LowPass(std::vector invec, int boxsize); std::vector HighPass(std::vector invec1, std::vector invec2); std::vector HighPass(std::vector pdInVector1, std::vector pdInVector2, - std::vector piValidPntsVector, int piMaxPoints, const IString & psMode="SUBTRACT"); + std::vector piValidPntsVector, int piMaxPoints, const QString & psMode="SUBTRACT"); private: }; diff --git a/isis/src/base/objs/iTime/iTime.cpp b/isis/src/base/objs/iTime/iTime.cpp index 7f329fb28e..a05b143cb5 100644 --- a/isis/src/base/objs/iTime/iTime.cpp +++ b/isis/src/base/objs/iTime/iTime.cpp @@ -51,12 +51,12 @@ namespace Isis { * @param time A time string formatted in standard UTC or similar format. * Example:"2000/12/31 23:59:01.6789" or "2000-12-31T23:59:01.6789" */ - iTime::iTime(const std::string &time) { + iTime::iTime(const QString &time) { LoadLeapSecondKernel(); // Convert the time string to a double ephemeris time SpiceDouble et; - str2et_c(time.c_str(), &et); + str2et_c(time.toAscii().data(), &et); p_et = et; @@ -74,12 +74,12 @@ namespace Isis { * @param time A time string formatted in standard UTC or similar format. * Example:"2000/12/31 23:59:01.6789" or "2000-12-31T23:59:01.6789" */ - void iTime::operator=(const std::string &time) { + void iTime::operator=(const QString &time) { LoadLeapSecondKernel(); // Convert the time string to a double ephemeris time SpiceDouble et; - str2et_c(time.c_str(), &et); + str2et_c(time.toAscii().data(), &et); p_et = et; @@ -200,9 +200,8 @@ namespace Isis { * * @return string */ - string iTime::YearString() const { - Isis::IString sYear(Year()); - return sYear; + QString iTime::YearString() const { + return toString(Year()); } /** @@ -223,9 +222,8 @@ namespace Isis { * * @return string */ - string iTime::MonthString() const { - Isis::IString sMonth(Month()); - return sMonth; + QString iTime::MonthString() const { + return toString(Month()); } /** @@ -246,9 +244,8 @@ namespace Isis { * * @return string */ - string iTime::DayString() const { - Isis::IString sDay(Day()); - return sDay; + QString iTime::DayString() const { + return toString(Day()); } /** @@ -269,9 +266,8 @@ namespace Isis { * * @return string */ - string iTime::HourString() const { - Isis::IString sHour(Hour()); - return sHour; + QString iTime::HourString() const { + return toString(Hour()); } /** @@ -292,9 +288,8 @@ namespace Isis { * * @return string */ - string iTime::MinuteString() const { - Isis::IString sMinute(Minute()); - return sMinute; + QString iTime::MinuteString() const { + return toString(Minute()); } /** @@ -315,15 +310,16 @@ namespace Isis { * * @return string */ - string iTime::SecondString() const { + QString iTime::SecondString() const { ostringstream osec; osec.setf(ios::fixed); osec << setprecision(8) << Second(); - IString sSeconds(osec.str()); - sSeconds.TrimTail("0"); - sSeconds.TrimTail("."); - if(sSeconds.empty()) sSeconds = "0"; - return (sSeconds); + QString sSeconds(osec.str().c_str()); + sSeconds = sSeconds.remove(QRegExp("(\\.0*|0*)$")); + + if(sSeconds.isEmpty()) sSeconds = "0"; + + return sSeconds; } /** @@ -344,9 +340,8 @@ namespace Isis { * * @return string */ - string iTime::DayOfYearString() const { - Isis::IString sDayOfYear(DayOfYear()); - return sDayOfYear; + QString iTime::DayOfYearString() const { + return toString(DayOfYear()); } /** @@ -368,9 +363,8 @@ namespace Isis { * * @return string */ - string iTime::EtString() const { - Isis::IString sEt(p_et); - return sEt; + QString iTime::EtString() const { + return toString(p_et); } /** @@ -378,8 +372,8 @@ namespace Isis { * * @return string The internalized time, in UTC format */ - string iTime::UTC() const { - string utc = YearString() + "-" ; + QString iTime::UTC() const { + QString utc = YearString() + "-" ; if(Month() < 10) utc += "0" + MonthString() + "-"; else utc += MonthString() + "-"; @@ -405,11 +399,11 @@ namespace Isis { p_et = 0.0; } - void iTime::setUtc(IString utcString) { + void iTime::setUtc(QString utcString) { LoadLeapSecondKernel(); double et; - utc2et_c(utcString.c_str(), &et); + utc2et_c(utcString.toAscii().data(), &et); setEt(et); } @@ -426,12 +420,12 @@ namespace Isis { // Get the leap second kernel file open Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); - string baseDir = dataDir["Base"]; + QString baseDir = dataDir["Base"]; baseDir += "/kernels/lsk/"; FileName leapSecond(baseDir + "naif????.tls"); - string leapSecondName(leapSecond.highestVersion().expanded()); - furnsh_c(leapSecondName.c_str()); + QString leapSecondName(leapSecond.highestVersion().expanded()); + furnsh_c(leapSecondName.toAscii().data()); p_lpInitialized = true; } @@ -450,14 +444,14 @@ namespace Isis { * The time is based on the system time, so it is only as * accurate as the local system clock. * - * @return std::string The Current GMT + * @return QString The Current GMT */ - std::string iTime::CurrentGMT() { + QString iTime::CurrentGMT() { time_t startTime = time(NULL); struct tm *tmbuf = gmtime(&startTime); char timestr[80]; strftime(timestr, 80, "%Y-%m-%dT%H:%M:%S", tmbuf); - return (std::string) timestr; + return (QString) timestr; } @@ -466,13 +460,13 @@ namespace Isis { * This time is taken directly from the system clock, so * if the system clock is off, this will be, too. * - * @return std::string The cutrrent local time + * @return QString The cutrrent local time */ - std::string iTime::CurrentLocalTime() { + QString iTime::CurrentLocalTime() { time_t startTime = time(NULL); struct tm *tmbuf = localtime(&startTime); char timestr[80]; strftime(timestr, 80, "%Y-%m-%dT%H:%M:%S", tmbuf); - return (std::string) timestr; + return (QString) timestr; } } // end namespace isis diff --git a/isis/src/base/objs/iTime/iTime.h b/isis/src/base/objs/iTime/iTime.h index 21730b7f08..f7ae34dc83 100644 --- a/isis/src/base/objs/iTime/iTime.h +++ b/isis/src/base/objs/iTime/iTime.h @@ -30,8 +30,9 @@ #include "FileName.h" +class QString; + namespace Isis { - class IString; /** * @brief Parse and return pieces of a time string @@ -72,7 +73,7 @@ namespace Isis { public: // constructor iTime(); - iTime(const std::string &time); + iTime(const QString &time); /** * Constructs a iTime object and initializes it to the time from the argument. @@ -89,7 +90,7 @@ namespace Isis { // destructor ~iTime() {}; - void operator=(const std::string &time); + void operator=(const QString &time); void operator=(const char *time); void operator=(const double time); @@ -105,21 +106,21 @@ namespace Isis { friend iTime operator +(const double &secondsToAdd, iTime time); // Return the year - std::string YearString() const; + QString YearString() const; int Year() const; - std::string MonthString() const; + QString MonthString() const; int Month() const; - std::string DayString() const; + QString DayString() const; int Day() const; - std::string HourString() const; + QString HourString() const; int Hour() const; - std::string MinuteString() const; + QString MinuteString() const; int Minute() const; - std::string SecondString() const; + QString SecondString() const; double Second() const; - std::string DayOfYearString() const; + QString DayOfYearString() const; int DayOfYear() const; - std::string EtString() const; + QString EtString() const; /** * Returns the ephemeris time (TDB) representation of the time as a double @@ -128,12 +129,12 @@ namespace Isis { return p_et; } - std::string UTC() const; - static std::string CurrentGMT(); - static std::string CurrentLocalTime(); + QString UTC() const; + static QString CurrentGMT(); + static QString CurrentLocalTime(); void setEt(double et); - void setUtc(IString utcString); + void setUtc(QString utcString); private: double p_et; /**= member + Test of iTime operator>= member 94781765.307363 >= 94781765.307363 = 1 94781765.307363 >= 94781765.307413 = 0 94781765.307363 >= 94781765.306963 = 1 - Test of Isis::iTime operator<= member + Test of iTime operator<= member 94781765.307363 <= 94781765.307363 = 1 94781765.307363 <= 94781765.307413 = 1 94781765.307363 <= 94781765.306963 = 0 - Test of Isis::iTime operator> member + Test of iTime operator> member 94781765.307363 > 94781765.307363 = 0 94781765.307363 > 94781765.307413 = 0 94781765.307363 > 94781765.306963 = 1 - Test of Isis::iTime operator< member + Test of iTime operator< member 94781765.307363 < 94781765.307363 = 0 94781765.307363 < 94781765.307413 = 1 94781765.307363 < 94781765.306963 = 0 - Test of Isis::iTime operator!= member + Test of iTime operator!= member 94781765.307363 != 94781765.307363 = 0 94781765.307363 != 94781765.307413 = 1 - Test of Isis::iTime operator== member + Test of iTime operator== member 94781765.307363 == 94781765.307363 = 1 94781765.307363 == 94781765.307413 = 0 diff --git a/isis/src/base/objs/iTime/unitTest.cpp b/isis/src/base/objs/iTime/unitTest.cpp index b3732e3da6..29c3cc1b96 100644 --- a/isis/src/base/objs/iTime/unitTest.cpp +++ b/isis/src/base/objs/iTime/unitTest.cpp @@ -5,17 +5,19 @@ #include "Preference.h" +using namespace Isis; using namespace std; + int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); - cout << "Unit test for Isis::iTime" << endl; + cout << "Unit test for iTime" << endl; try { cout << setprecision(9); - string test = "2003/01/02 12:15:01.1234"; - Isis::iTime *time = new Isis::iTime(test); + QString test = "2003/01/02 12:15:01.1234"; + iTime *time = new iTime(test); cout << " Test of date = " << test << endl; cout << " Year = " << time->YearString() << endl; cout << " Year = " << time->Year() << endl; @@ -35,7 +37,7 @@ int main(int argc, char *argv[]) { cout << " Et = " << time->Et() << endl; cout << " UTC = " << time->UTC() << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } @@ -44,8 +46,8 @@ int main(int argc, char *argv[]) { try { cout << endl; cout << setprecision(9); - string test = "2000-12-31T23:59:01.6789"; - Isis::iTime time; + QString test = "2000-12-31T23:59:01.6789"; + iTime time; time = test; cout << " Test of date = " << test << endl; cout << " Year = " << time.YearString() << endl; @@ -67,7 +69,7 @@ int main(int argc, char *argv[]) { cout << " UTC = " << time.UTC() << endl; saveEt = time.Et(); } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } @@ -75,7 +77,7 @@ int main(int argc, char *argv[]) { try { cout << endl; cout << setprecision(9); - Isis::iTime time(saveEt); + iTime time(saveEt); cout << " Test of date = " << time.EtString() << endl; cout << " Year = " << time.YearString() << endl; cout << " Year = " << time.Year() << endl; @@ -95,7 +97,7 @@ int main(int argc, char *argv[]) { cout << " Et = " << time.Et() << endl; cout << " UTC = " << time.UTC() << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } @@ -103,42 +105,42 @@ int main(int argc, char *argv[]) { try { cout << endl; cout << setprecision(9); - cout << " Test of Isis::iTime operator>= member" << endl; - string test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t1 = new Isis::iTime(test); + cout << " Test of iTime operator>= member" << endl; + QString test = "2003/01/02 12:15:01.1234"; + iTime *t1 = new iTime(test); test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t2 = new Isis::iTime(test); + iTime *t2 = new iTime(test); cout << " " << t1->EtString() << " >= " << t2->EtString() << " = "; cout << (*t1 >= *t2) << endl; - Isis::iTime *t3 = new Isis::iTime("2003/01/02 12:15:01.12345"); + iTime *t3 = new iTime("2003/01/02 12:15:01.12345"); cout << " " << t1->EtString() << " >= " << t3->EtString() << " = "; cout << (*t1 >= *t3) << endl; - Isis::iTime *t4 = new Isis::iTime("2003/01/02 12:15:01.1230"); + iTime *t4 = new iTime("2003/01/02 12:15:01.1230"); cout << " " << t1->EtString() << " >= " << t4->EtString() << " = "; cout << (*t1 >= *t4) << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } try { cout << endl; cout << setprecision(9); - cout << " Test of Isis::iTime operator<= member" << endl; - string test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t1 = new Isis::iTime(test); + cout << " Test of iTime operator<= member" << endl; + QString test = "2003/01/02 12:15:01.1234"; + iTime *t1 = new iTime(test); test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t2 = new Isis::iTime(test); + iTime *t2 = new iTime(test); cout << " " << t1->EtString() << " <= " << t2->EtString() << " = "; cout << (*t1 <= *t2) << endl; - Isis::iTime *t3 = new Isis::iTime("2003/01/02 12:15:01.12345"); + iTime *t3 = new iTime("2003/01/02 12:15:01.12345"); cout << " " << t1->EtString() << " <= " << t3->EtString() << " = "; cout << (*t1 <= *t3) << endl; - Isis::iTime *t4 = new Isis::iTime("2003/01/02 12:15:01.1230"); + iTime *t4 = new iTime("2003/01/02 12:15:01.1230"); cout << " " << t1->EtString() << " <= " << t4->EtString() << " = "; cout << (*t1 <= *t4) << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } @@ -146,78 +148,78 @@ int main(int argc, char *argv[]) { try { cout << endl; cout << setprecision(9); - cout << " Test of Isis::iTime operator> member" << endl; - string test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t1 = new Isis::iTime(test); + cout << " Test of iTime operator> member" << endl; + QString test = "2003/01/02 12:15:01.1234"; + iTime *t1 = new iTime(test); test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t2 = new Isis::iTime(test); + iTime *t2 = new iTime(test); cout << " " << t1->EtString() << " > " << t2->EtString() << " = "; cout << (*t1 > *t2) << endl; - Isis::iTime *t3 = new Isis::iTime("2003/01/02 12:15:01.12345"); + iTime *t3 = new iTime("2003/01/02 12:15:01.12345"); cout << " " << t1->EtString() << " > " << t3->EtString() << " = "; cout << (*t1 > *t3) << endl; - Isis::iTime *t4 = new Isis::iTime("2003/01/02 12:15:01.1230"); + iTime *t4 = new iTime("2003/01/02 12:15:01.1230"); cout << " " << t1->EtString() << " > " << t4->EtString() << " = "; cout << (*t1 > *t4) << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } try { cout << endl; cout << setprecision(9); - cout << " Test of Isis::iTime operator< member" << endl; - string test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t1 = new Isis::iTime(test); + cout << " Test of iTime operator< member" << endl; + QString test = "2003/01/02 12:15:01.1234"; + iTime *t1 = new iTime(test); test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t2 = new Isis::iTime(test); + iTime *t2 = new iTime(test); cout << " " << t1->EtString() << " < " << t2->EtString() << " = "; cout << (*t1 < *t2) << endl; - Isis::iTime *t3 = new Isis::iTime("2003/01/02 12:15:01.12345"); + iTime *t3 = new iTime("2003/01/02 12:15:01.12345"); cout << " " << t1->EtString() << " < " << t3->EtString() << " = "; cout << (*t1 < *t3) << endl; - Isis::iTime *t4 = new Isis::iTime("2003/01/02 12:15:01.1230"); + iTime *t4 = new iTime("2003/01/02 12:15:01.1230"); cout << " " << t1->EtString() << " < " << t4->EtString() << " = "; cout << (*t1 < *t4) << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } try { cout << endl; cout << setprecision(9); - cout << " Test of Isis::iTime operator!= member" << endl; - string test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t1 = new Isis::iTime(test); + cout << " Test of iTime operator!= member" << endl; + QString test = "2003/01/02 12:15:01.1234"; + iTime *t1 = new iTime(test); test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t2 = new Isis::iTime(test); + iTime *t2 = new iTime(test); cout << " " << t1->EtString() << " != " << t2->EtString() << " = "; cout << (*t1 != *t2) << endl; - Isis::iTime *t3 = new Isis::iTime("2003/01/02 12:15:01.12345"); + iTime *t3 = new iTime("2003/01/02 12:15:01.12345"); cout << " " << t1->EtString() << " != " << t3->EtString() << " = "; cout << (*t1 != *t3) << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } try { cout << endl; cout << setprecision(9); - cout << " Test of Isis::iTime operator== member" << endl; - string test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t1 = new Isis::iTime(test); + cout << " Test of iTime operator== member" << endl; + QString test = "2003/01/02 12:15:01.1234"; + iTime *t1 = new iTime(test); test = "2003/01/02 12:15:01.1234"; - Isis::iTime *t2 = new Isis::iTime(test); + iTime *t2 = new iTime(test); cout << " " << t1->EtString() << " == " << t2->EtString() << " = "; cout << (*t1 == *t2) << endl; - Isis::iTime *t3 = new Isis::iTime("2003/01/02 12:15:01.12345"); + iTime *t3 = new iTime("2003/01/02 12:15:01.12345"); cout << " " << t1->EtString() << " == " << t3->EtString() << " = "; cout << (*t1 == *t3) << endl; } - catch(Isis::IException &error) { + catch(IException &error) { error.print(); } diff --git a/isis/src/cassini/apps/ciss2isis/ciss2isis.cpp b/isis/src/cassini/apps/ciss2isis/ciss2isis.cpp index 9ecf455d24..13dc47cf07 100644 --- a/isis/src/cassini/apps/ciss2isis/ciss2isis.cpp +++ b/isis/src/cassini/apps/ciss2isis/ciss2isis.cpp @@ -2,7 +2,7 @@ #include "Isis.h" -#include +#include #include #include @@ -34,8 +34,8 @@ void CreateStretchPairs(); void FixDns(Buffer &buf); void TranslateCassIssLabels(FileName &labelFile, Cube *ocube); //Global variables -string compressionType; -string dataConversionType; +QString compressionType; +QString dataConversionType; double flightSoftware; Stretch stretch; int sumMode; @@ -59,7 +59,7 @@ void IsisMain() { //Checks if in file is rdr if(label.HasObject("IMAGE_MAP_PROJECTION")) { - string msg = "[" + in.name() + "] appears to be an rdr file."; + QString msg = "[" + in.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -101,7 +101,7 @@ void IsisMain() { //Adjust Table-encoded values from 8 bit back to 12 bit. PvlGroup &inst = outputLabel->FindGroup("Instrument", Pvl::Traverse); double biasStripMean = inst.FindKeyword("BiasStripMean"); - inst.FindKeyword("BiasStripMean").SetValue(stretch.Map(biasStripMean)); + inst.FindKeyword("BiasStripMean").SetValue(toString(stretch.Map(biasStripMean))); inst.FindKeyword("BiasStripMean").AddComment("BiasStripMean value converted back to 12 bit."); p.Progress()->SetText("Image was converted using 12-to-8 bit table. \nConverting prefix pixels back to 12 bit and saving line prefix data..."); } @@ -119,12 +119,12 @@ void IsisMain() { int roo = *(header + 50 + vicarLabelBytes) / 32 % 2; //**** THIS MAY NEED TO BE CHANGED, // SEE BOTTOM OF THIS FILE FOR IN DEPTH COMMENTS ON READOUTORDER PvlGroup &inst = ocube->getLabel()->FindGroup("Instrument", Pvl::Traverse); - inst.AddKeyword(PvlKeyword("ReadoutOrder", roo)); + inst.AddKeyword(PvlKeyword("ReadoutOrder", toString(roo))); p.EndProcess(); // PROCESS 2 : Do 8 bit to 12 bit conversion for image ==============================================// ProcessByLine p2; - string ioFile = ui.GetFileName("TO"); + QString ioFile = ui.GetFileName("TO"); CubeAttributeInput att; p2.SetInputCube(ioFile, att, ReadWrite); //if ConversionType == 12Bit or 8LSB, only save off overclocked pixels @@ -209,20 +209,19 @@ vector ConvertLinePrefixPixels(unsigned char *data) { void CreateStretchPairs() { // Set up the strech for the 8 to 12 bit conversion from file PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); - IString missionDir = (string) dataDir["Cassini"]; + QString missionDir = (QString) dataDir["Cassini"]; FileName *lutFile = new FileName(missionDir + "/calibration/lut/lut.tab"); CisscalFile *stretchPairs = new CisscalFile(lutFile->expanded()); // Create the stretch pairs - double temp1 = 0, temp2 = 0; + double temp1 = 0; stretch.ClearPairs(); for(int i = 0; i < stretchPairs->LineCount(); i++) { - IString line; + QString line; stretchPairs->GetLine(line); //assigns value to line - line = line.TrimTail(", \t\n\r"); - while(line.size() > 0) { - line = line.TrimHead(", \t"); - temp2 = line.Token(", \t\n\r").ToDouble(); - stretch.AddPair(temp1, temp2); + line = line.simplified(); + + foreach (QString value, line.split(QRegExp("[\\s,]"), QString::SkipEmptyParts)) { + stretch.AddPair(temp1, toDouble(value)); temp1++; } } @@ -271,7 +270,7 @@ void FixDns(Buffer &buf) { void TranslateCassIssLabels(FileName &labelFile, Cube *ocube) { // Get the directory where the CISS translation tables are. PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); - IString missionDir = (string) dataDir["Cassini"]; + QString missionDir = (QString) dataDir["Cassini"]; FileName transFile(missionDir + "/translations/cassiniIss.trn"); // Get the translation manager ready @@ -284,29 +283,29 @@ void TranslateCassIssLabels(FileName &labelFile, Cube *ocube) { //Add needed keywords that are not in translation table to cube's instrument group PvlGroup &inst = outputLabel->FindGroup("Instrument", Pvl::Traverse); - string scc = inputLabel.FindKeyword("SPACECRAFT_CLOCK_CNT_PARTITION"); - scc += "/" + (string) inputLabel.FindKeyword("SPACECRAFT_CLOCK_START_COUNT"); + QString scc = inputLabel.FindKeyword("SPACECRAFT_CLOCK_CNT_PARTITION"); + scc += "/" + (QString) inputLabel.FindKeyword("SPACECRAFT_CLOCK_START_COUNT"); inst.AddKeyword(PvlKeyword("SpacecraftClockCount", scc)); //Add units of measurement to keywords from translation table double exposureDuration = inst.FindKeyword("ExposureDuration"); - inst.FindKeyword("ExposureDuration").SetValue(exposureDuration, "Milliseconds"); + inst.FindKeyword("ExposureDuration").SetValue(toString(exposureDuration), "Milliseconds"); int gainModeId = inst.FindKeyword("GainModeId"); - inst.FindKeyword("GainModeId").SetValue(gainModeId, "ElectronsPerDN"); + inst.FindKeyword("GainModeId").SetValue(toString(gainModeId), "ElectronsPerDN"); PvlKeyword opticsTemp = inst.FindKeyword("OpticsTemperature"); inst.FindKeyword("OpticsTemperature").SetValue(opticsTemp[0]); inst.FindKeyword("OpticsTemperature").AddValue(opticsTemp[1], "DegreesCelcius"); double instDataRate = inst.FindKeyword("InstrumentDataRate"); - inst.FindKeyword("InstrumentDataRate").SetValue(instDataRate, "KilobitsPerSecond"); + inst.FindKeyword("InstrumentDataRate").SetValue(toString(instDataRate), "KilobitsPerSecond"); // initialize global variables - dataConversionType = (string) inst.FindKeyword("DataConversionType"); + dataConversionType = (QString) inst.FindKeyword("DataConversionType"); sumMode = inst.FindKeyword("SummingMode"); - compressionType = (string) inst.FindKeyword("CompressionType"); - IString fsw((string) inst.FindKeyword("FlightSoftwareVersionId")); + compressionType = (QString) inst.FindKeyword("CompressionType"); + IString fsw((QString) inst.FindKeyword("FlightSoftwareVersionId")); if(fsw == "Unknown") { flightSoftware = 0.0; } @@ -315,25 +314,25 @@ void TranslateCassIssLabels(FileName &labelFile, Cube *ocube) { } // Remove the trailing 'Z' in some pds labels - IString sUpdateTime = inst.FindKeyword("StartTime")[0]; - sUpdateTime.Trim("Zz"); + QString sUpdateTime = inst.FindKeyword("StartTime")[0]; + sUpdateTime.remove(QRegExp("[Zz]")); inst.FindKeyword("StartTime").SetValue(sUpdateTime); sUpdateTime = inst.FindKeyword("StopTime")[0]; - sUpdateTime.Trim("Zz"); + sUpdateTime.remove(QRegExp("[Zz]")); inst.FindKeyword("StopTime").SetValue(sUpdateTime); sUpdateTime = inst.FindKeyword("ImageTime")[0]; - sUpdateTime.Trim("Zz"); + sUpdateTime.remove(QRegExp("[Zz]")); inst.FindKeyword("ImageTime").SetValue(sUpdateTime); // create BandBin group - IString filter = inputLabel.FindKeyword("FilterName")[0] + "/" + + QString filter = inputLabel.FindKeyword("FilterName")[0] + "/" + inputLabel.FindKeyword("FilterName")[1]; - string instrumentID = inst.FindKeyword("InstrumentId"); - string cameraAngleDefs; + QString instrumentID = inst.FindKeyword("InstrumentId"); + QString cameraAngleDefs; if(instrumentID.at(3) == 'N') { cameraAngleDefs = missionDir + "/translations/narrowAngle.def"; } @@ -348,25 +347,24 @@ void TranslateCassIssLabels(FileName &labelFile, Cube *ocube) { int numLines = cameraAngle.LineCount(); bool foundfilter = false; for(int i = 0; i < numLines; i++) { - IString line; + QString line; cameraAngle.GetLine(line, true); - IString token = line.Token(" "); - if(token == filter) { - line = line.Trim(" "); - center = line.Token(" "); - line = line.Trim(" "); - width = line.Token(" "); + + QStringList tokens = line.simplified().split(" "); + if(tokens.count() > 2 && tokens.first() == filter) { + center = toDouble(tokens[1]); + width = toDouble(tokens[2]); foundfilter = true; break; } } PvlGroup bandBin("BandBin"); bandBin += PvlKeyword("FilterName", filter); - bandBin += PvlKeyword("OriginalBand", 1); + bandBin += PvlKeyword("OriginalBand", "1"); if(foundfilter) { - bandBin += PvlKeyword("Center", center); - bandBin += PvlKeyword("Width", width); + bandBin += PvlKeyword("Center", toString(center)); + bandBin += PvlKeyword("Width", toString(width)); } else { PvlGroup msgGrp("Warnings"); @@ -380,13 +378,13 @@ void TranslateCassIssLabels(FileName &labelFile, Cube *ocube) { PvlGroup kerns("Kernels"); if(instrumentID == "ISSNA") { - kerns += PvlKeyword("NaifFrameCode", -82360); + kerns += PvlKeyword("NaifFrameCode", "-82360"); } else if(instrumentID == "ISSWA") { - kerns += PvlKeyword("NaifFrameCode", -82361); + kerns += PvlKeyword("NaifFrameCode", "-82361"); } else { - string msg = "CISS2ISIS only imports Cassini ISS narrow "; + QString msg = "CISS2ISIS only imports Cassini ISS narrow "; msg += "angle or wide angle images"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/cassini/apps/cisscal/DarkCurrent.cpp b/isis/src/cassini/apps/cisscal/DarkCurrent.cpp index cc4dbbb2ed..547612c81e 100644 --- a/isis/src/cassini/apps/cisscal/DarkCurrent.cpp +++ b/isis/src/cassini/apps/cisscal/DarkCurrent.cpp @@ -57,20 +57,20 @@ namespace Isis { p_flightSoftware = cissLab.FlightSoftwareVersion(); p_gainMode = cissLab.GainModeId(); p_narrow = cissLab.NarrowAngle(); - p_sum = cissLab.SummingMode(); + p_sum = toString(cissLab.SummingMode()); if(cissLab.ReadoutCycleIndex() == "Unknown") { p_readoutIndex = -999; } else { - p_readoutIndex = cissLab.ReadoutCycleIndex().ToInteger(); + p_readoutIndex = toInt(cissLab.ReadoutCycleIndex()); } if(p_compType == "NotCompressed") { p_compRatio = 1.0; } else { - p_compRatio = cissLab.CompressionRatio().ToDouble(); + p_compRatio = toDouble(cissLab.CompressionRatio()); } if(cissLab.DelayedReadoutFlag() == "No") { @@ -96,7 +96,7 @@ namespace Isis { p_readoutOrder = cissLab.ReadoutOrder(); - switch(p_sum.ToInteger()) { + switch(toInt(p_sum)) { case 1: p_lines = 1024; break; @@ -260,7 +260,7 @@ namespace Isis { if(p_flightSoftware == "Unknown") { fsw = 0.0; } - else fsw = p_flightSoftware.ToDouble(); + else fsw = toDouble(p_flightSoftware); double linetime; double tlm = p_telemetryRate / 8; @@ -1025,10 +1025,10 @@ namespace Isis { void DarkCurrent::FindDarkFiles() { // Get the directory where the CISS darkcurrent directory is PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); - IString missionDir = (string) dataDir["Cassini"]; - IString darkDir(missionDir + "/calibration/darkcurrent/"); + QString missionDir = (QString) dataDir["Cassini"]; + QString darkDir(missionDir + "/calibration/darkcurrent/"); - IString instrumentId(""); + QString instrumentId(""); if(p_narrow) { instrumentId += "nac"; @@ -1037,8 +1037,8 @@ namespace Isis { else { instrumentId += "wac"; } - IString instModeId(""); - if(p_sum.ToInteger() > 1) { + QString instModeId(""); + if(toInt(p_sum) > 1) { instModeId = instModeId + "sum" + p_sum; } else { @@ -1210,16 +1210,14 @@ namespace Isis { CisscalFile *biasDist = new CisscalFile(p_bdpath.expanded()); vector samp, bias_distortion; for(int i = 0; i < biasDist->LineCount(); i++) { - IString line; + QString line; biasDist->GetLine(line); //assigns value to line - line = line.ConvertWhiteSpace(); - line = line.Compress(); - line = line.TrimHead(" "); + line = line.simplified().trimmed(); if(line == "") { break; } - samp.push_back(line.Token(" ").ToDouble()); - bias_distortion.push_back(line.Trim(" ").ToDouble()); + samp.push_back(toDouble(line.split(" ").first())); + bias_distortion.push_back(toDouble(line.split(" ")[1])); } biasDist->Close(); for(int i = 0; i < 21; i++) { diff --git a/isis/src/cassini/apps/cisscal/DarkCurrent.h b/isis/src/cassini/apps/cisscal/DarkCurrent.h index 7053b0a916..eb098c9d78 100644 --- a/isis/src/cassini/apps/cisscal/DarkCurrent.h +++ b/isis/src/cassini/apps/cisscal/DarkCurrent.h @@ -22,12 +22,10 @@ * http://www.usgs.gov/privacy.html. */ -#include +#include #include #include "FileName.h" -using namespace std; - namespace Isis { class CissLabels; /** @@ -43,7 +41,7 @@ namespace Isis { * @internal * @history 2008-11-05 Jeannie Walldren - Original Version * @history 2009-01-26 Jeannie Walldren - Changed declarations of 2 - * dimensional vectors + * dimensional std::vectors * @history 2009-05-27 Jeannie Walldren - Added p_flightSoftware variable. * Updated ComputeLineTime() code with algorithm from * the new version of linetime.pro in idl cisscal 3.6. @@ -57,7 +55,7 @@ namespace Isis { DarkCurrent(CissLabels &cissLab); ~DarkCurrent() {}; //!< Empty Destructor - vector > ComputeDarkDN(); + std::vector > ComputeDarkDN(); //! Retrieves the name of the bias distortion table FileName BiasDistortionTable() { return p_bdpath; @@ -72,8 +70,8 @@ namespace Isis { double ComputeLineTime(int lline); void FindDarkFiles(); void ComputeTimeArrays(); - vector > MakeDarkArray(); - vector > MakeManyLineDark(Brick &darkBrick); + std::vector > MakeDarkArray(); + std::vector > MakeManyLineDark(Brick &darkBrick); int p_lines; //!< Number of lines in the image. @@ -84,21 +82,21 @@ namespace Isis { //LABEL VARIABLES int p_btsm; //!< Value dependent upon PvlKeyword DelayedReadoutFlag. Valid values are: "No"=0, "Yes"=1, "Unknown"=-1. Called "botsim" or "btsm" in IDL code. double p_compRatio; //!< Value of PvlKeyword CompressionRatio from the labels of the image. Called "ratio" in IDL code. - string p_compType; //!< Value of PvlKeyword CompressionType from the labels of the image. Called "comp" in IDL code. - string p_dataConvType; //!< Value of PvlKeyword DataConversionType from the labels of the image. Called "conv" in IDL code. + QString p_compType; //!< Value of PvlKeyword CompressionType from the labels of the image. Called "comp" in IDL code. + QString p_dataConvType; //!< Value of PvlKeyword DataConversionType from the labels of the image. Called "conv" in IDL code. double p_expDur; //!< Value of PvlKeyword ExposureDuration from the labels of the image. Called "exposure" or "time" in IDL code. - IString p_flightSoftware; //!< Value of PvlKeyword FlightSoftwareVersion from the labels of the image. Called "fsw" in IDL code. + QString p_flightSoftware; //!< Value of PvlKeyword FlightSoftwareVersion from the labels of the image. Called "fsw" in IDL code. int p_gainMode; //!< Value of PvlKeyword GainModeId from the labels of the image. double p_instDataRate; //!< Value of PvlKeyword InstrumentDataRate from the labels of the image. bool p_narrow; //!< Indicates whether the image is from a narrow-angle camera int p_readoutIndex; //!< Value of PvlKeyword InstrumentDataRate from the labels of the image. Called "rdind" or "roindex" in IDL code. int p_readoutOrder; //!< Value of PvlKeyword ReadoutOrder from the labels of the image. Valid values are: NAC first = 0, WAC first = 1. Called "roo" in IDL code. - IString p_sum; //!< Summing mode, as found in the labels of the image. This integer is created as an IString so that it may be added to a string. Called "sum" in IDL code. + QString p_sum; //!< Summing mode, as found in the labels of the image. This integer is created as an QString so that it may be added to a QString. Called "sum" in IDL code. int p_telemetryRate; //!< Telemetry rate of the image in packets per second. This is dependent on the range of the instrument data rate. Called "cdsr" in IDL code. - vector > p_startTime; //!< Array of start times for each pixel of the image. - vector > p_endTime; //!< Array of end times for each pixel of the image. - vector > p_duration; //!< Array of durations for each pixel of the image. + std::vector > p_startTime; //!< Array of start times for each pixel of the image. + std::vector > p_endTime; //!< Array of end times for each pixel of the image. + std::vector > p_duration; //!< Array of durations for each pixel of the image. }; }; #endif diff --git a/isis/src/cassini/apps/cisscal/cisscal.cpp b/isis/src/cassini/apps/cisscal/cisscal.cpp index a22e0bd99f..edce84c402 100644 --- a/isis/src/cassini/apps/cisscal/cisscal.cpp +++ b/isis/src/cassini/apps/cisscal/cisscal.cpp @@ -4,7 +4,7 @@ #include #include //unique #include // unique -#include +#include #include #include #include "Brick.h" @@ -48,8 +48,8 @@ namespace gbl { void DNtoElectrons(); void FindShutterOffset(); void DivideByAreaPixel(); - void FindEfficiencyFactor(string fluxunits); - IString GetCalibrationDirectory(string calibrationType); + void FindEfficiencyFactor(QString fluxunits); + QString GetCalibrationDirectory(QString calibrationType); //global variables CissLabels *cissLab; @@ -443,14 +443,13 @@ void gbl::CreateBitweightStretch(FileName bitweightTable) { double stretch1 = 0, stretch2; gbl::stretch.ClearPairs(); for(int i = 0; i < stretchPairs->LineCount(); i++) { - IString line; + QString line; stretchPairs->GetLine(line); - line.ConvertWhiteSpace();//convert all \n, \r, \t to spaces - line.Compress();//compresses multiple spaces into single space - line = line.TrimTail(" ");//removes space from end of line - while(line.size() > 0) { - line = line.TrimHead(" ");//removes space before number, if there is one - stretch2 = line.Token(", ").ToDouble();//grabs number before comma or space + line = line.simplified().trimmed(); + + QStringList tokens = line.split(QRegExp("[, ]"), QString::SkipEmptyParts); + foreach (QString token, tokens) { + stretch2 = toDouble(token); gbl::stretch.AddPair(stretch1, stretch2); stretch1 = stretch1 + 1.0; } @@ -476,7 +475,7 @@ void gbl::CreateBitweightStretch(FileName bitweightTable) { */ FileName gbl::FindBitweightFile() { // Get the directory where the CISS bitweight directory is - IString bitweightName; + QString bitweightName; if(gbl::cissLab->NarrowAngle()) { bitweightName += "nac"; @@ -484,7 +483,7 @@ FileName gbl::FindBitweightFile() { else { bitweightName += "wac"; } - IString gainState(gbl::cissLab->GainState()); + QString gainState(toString(gbl::cissLab->GainState())); bitweightName = bitweightName + "g" + gainState; if(gbl::cissLab->FrontOpticsTemp() < -5.0) { @@ -522,14 +521,14 @@ void gbl::ComputeBias() { gbl::calgrp += PvlKeyword("BiasSubtractionPerformed", "Yes"); gbl::calgrp.FindKeyword("BiasSubtractionPerformed").AddComment("Bias Subtraction Parameters"); - IString fsw(gbl::cissLab->FlightSoftwareVersion()); + QString fsw(gbl::cissLab->FlightSoftwareVersion()); double flightSoftwareVersion; if(fsw == "Unknown") { flightSoftwareVersion = 0.0;// cassimg_readlabels.pro sets this to 1.3, we treat this as 1.2??? } else { - flightSoftwareVersion = fsw.ToDouble(); + flightSoftwareVersion = toDouble(fsw); } // check overclocked pixels exist if(gbl::cissLab->CompressionType() != "Lossy") { @@ -576,7 +575,7 @@ void gbl::ComputeBias() { gbl::bias.resize(1); gbl::bias[0] = gbl::cissLab->BiasStripMean(); } - gbl::calgrp += PvlKeyword("NumberOfOverclocks", gbl::numberOfOverclocks); + gbl::calgrp += PvlKeyword("NumberOfOverclocks", toString(gbl::numberOfOverclocks)); return; } @@ -671,7 +670,7 @@ void gbl::Linearize() { // The correction is then performed as DN'=DN*Cdn // Where Cdn is an interpolation for C from the tabulated values - IString lut; + QString lut; int gainState = gbl::cissLab->GainState(); if(gbl::cissLab->NarrowAngle()) { switch(gainState) { @@ -727,12 +726,12 @@ void gbl::Linearize() { TextFile *pairs = new TextFile(linearLUT.expanded()); for(int i = 0; i < pairs->LineCount(); i++) { - IString line; + QString line; pairs->GetLine(line, true); - line.ConvertWhiteSpace(); - line.Compress(); - DN_VALS.push_back(line.Token(" ").ToDouble()); - C_VALS.push_back(line.Trim(" ").ToDouble()); + line = line.simplified(); + QStringList tokens = line.split(" "); + DN_VALS.push_back(toDouble(tokens.takeFirst())); + C_VALS.push_back(toDouble(tokens.takeFirst())); } pairs->Close(); @@ -806,7 +805,7 @@ void gbl::FindDustRingParameters() { // No mottle correct for summation mode other than 1 if(gbl::cissLab->SummingMode() != 1) { gbl::mottleCorrection = false; - gbl::calgrp += PvlKeyword("MottleCorrectionPerformed", "No: Summing mode is " + IString(gbl::cissLab->SummingMode())); + gbl::calgrp += PvlKeyword("MottleCorrectionPerformed", "No: Summing mode is " + toString(gbl::cissLab->SummingMode())); gbl::calgrp += PvlKeyword("MottleFile", "Not applicable: No mottle correction"); gbl::calgrp += PvlKeyword("EffectiveWavelengthFile", "Not applicable: No mottle correction"); gbl::calgrp += PvlKeyword("StrengthFactor", "Not applicable: No mottle correction"); @@ -825,7 +824,7 @@ void gbl::FindDustRingParameters() { } // Mottling correction for full images after 2003-286T10:28:04 - gbl::mottleFile = (gbl::GetCalibrationDirectory("dustring") + "nac_mottle_1444733393.full.cub"); + gbl::mottleFile = (gbl::GetCalibrationDirectory("duString") + "nac_mottle_1444733393.full.cub"); if(!gbl::mottleFile.fileExists()) { // mottle file not found, stop calibration throw IException(IException::Io, "Unable to calibrate image. MottleFile ***" @@ -853,28 +852,30 @@ void gbl::FindDustRingParameters() { } gbl::calgrp += PvlKeyword("EffectiveWavelengthFile", effectiveWavelength.expanded()); CisscalFile *effwlDB = new CisscalFile(effectiveWavelength.expanded()); - IString col1, col2, col3, col4, col5; + QString col1, col2, col3, col4, col5; double effwl; for(int i = 0; i < effwlDB->LineCount(); i++) { - IString line; + QString line; effwlDB->GetLine(line); - line = line.ConvertWhiteSpace(); - line = line.Compress(); - col1 = line.Token(" "); + line = line.simplified(); + + QStringList cols = line.split(" "); + + col1 = cols.takeFirst(); if(col1 == gbl::cissLab->FilterName()[0]) { - col2 = line.Token(" "); + col2 = cols.takeFirst(); if(col2 == gbl::cissLab->FilterName()[1]) { - col3 = line.Token(" "); // central wavelength of filter combo - col4 = line.Token(" "); // full-width at half-maximum (FWHM) of filter combo - col5 = line.Token(" "); // effective wavelength + col3 = cols.takeFirst(); // central wavelength of filter combo + col4 = cols.takeFirst(); // full-width at half-maximum (FWHM) of filter combo + col5 = cols.takeFirst(); // effective wavelength if(col5 == "") { // Couldn't find a match in the database gbl::calgrp.FindKeyword("MottleCorrectionPerformed").SetValue("Yes: EffectiveWavelengthFile contained no factor for filter combination, used strengthFactor of 1.0"); gbl::strengthFactor = 1.0; } else { - effwl = col5.ToDouble(); - gbl::calgrp += PvlKeyword("EffectiveWavelength", effwl); + effwl = toDouble(col5); + gbl::calgrp += PvlKeyword("EffectiveWavelength", toString(effwl)); gbl::strengthFactor = 1.30280 - 0.000717552 * effwl; } break; @@ -959,7 +960,7 @@ void gbl::FindDustRingParameters() { } } } - gbl::calgrp += PvlKeyword("StrengthFactor", gbl::strengthFactor); + gbl::calgrp += PvlKeyword("StrengthFactor", toString(gbl::strengthFactor)); return; } @@ -992,7 +993,7 @@ FileName gbl::FindFlatFile() { // Find the best-match flat file // Choose a nominal optics temp name as per ISSCAL - IString frontOpticsTemp(""); + QString frontOpticsTemp(""); if(gbl::cissLab->FrontOpticsTemp() < -5.0) { frontOpticsTemp += "m10"; } @@ -1004,31 +1005,26 @@ FileName gbl::FindFlatFile() { } // Require match for instrument, temperature range name, Filter1, filter2 CisscalFile *slopeDB = new CisscalFile(slopeDatabaseName.expanded()); - IString col1, col2, col3, col4, col5, col6, col7, col8; + QString col1, col2, col3, col4, col5, col6, col7, col8; for(int i = 0; i < slopeDB->LineCount(); i++) { - IString line; + QString line; slopeDB->GetLine(line); //assigns value to line - line = line.ConvertWhiteSpace(); - line = line.Compress(true); - col1 = line.Token(" "); - col1.Trim("'"); + line = line.simplified(); + QStringList cols = line.split(" "); + cols.replaceInStrings(QRegExp("(^'|'$)"), ""); + + col1 = cols.takeFirst(); if(col1 == gbl::cissLab->InstrumentId()) { - col2 = line.Token(" "); - col2.Trim("'"); + col2 = cols.takeFirst(); if((col2 == frontOpticsTemp) || (gbl::cissLab->WideAngle())) { - col3 = line.Token(" "); - col3.Trim("'"); + col3 = cols.takeFirst(); if(col3 == gbl::cissLab->FilterName()[0]) { - col4 = line.Token(" "); - col4.Trim("'"); + col4 = cols.takeFirst(); if(col4 == gbl::cissLab->FilterName()[1]) { - col5 = line.Token(" "); - col5.Trim("'"); // col5 = gainstate (not used) - col6 = line.Token(" "); - col6.Trim("'"); // col6 = antiblooming state (not used) - col7 = line.Token(" "); - col7.Trim("'"); // col7 = file number (not used) - col8 = line.Trim(" "); // col8 = slope file name + col5 = cols.takeFirst();// col5 = gainstate (not used) + col6 = cols.takeFirst();// col6 = antiblooming state (not used) + col7 = cols.takeFirst();// col7 = file number (not used) + col8 = cols.takeFirst();// col8 = slope file name break; } else { @@ -1058,11 +1054,11 @@ FileName gbl::FindFlatFile() { _FILEINFO_); } //Column 8 contains version of slopefile from which our flatfiles are derived - int j = col8.find("."); + int j = col8.indexOf("."); //attatch version number to "flat" by skipping // the first 5 characters("SLOPE") and skipping // any thing after "." ("IMG") - col8 = "flat" + col8.substr(5, (j - 5) + 1); + col8 = "flat" + col8.mid(5, (j - 5) + 1); flatFile = (gbl::GetCalibrationDirectory("slope/flat") + col8 + gbl::cissLab->InstrumentModeId() + ".cub"); gbl::calgrp += PvlKeyword("FlatFile", flatFile.expanded()); @@ -1144,7 +1140,7 @@ void gbl::DNtoElectrons() { _FILEINFO_); } } - gbl::calgrp += PvlKeyword("TrueGain", gbl::trueGain); + gbl::calgrp += PvlKeyword("TrueGain", toString(gbl::trueGain)); return; } @@ -1168,7 +1164,7 @@ void gbl::FindShutterOffset() { gbl::calgrp += PvlKeyword("DividedByExposureTime", "Yes"); gbl::divideByExposure = true; // Define whereabouts of shutter offset files - IString offsetFileName(""); + QString offsetFileName(""); if(gbl::cissLab->NarrowAngle()) { offsetFileName += (gbl::GetCalibrationDirectory("offset") + "nacfm_so_"); } @@ -1233,9 +1229,9 @@ void gbl::DivideByAreaPixel() { // it was expressed in IDL as the following: // [gbl::sumFactor = (gbl::incube->getSampleCount()/1024.0)*(gbl::incube->getLineCount()/1024.0);] gbl::sumFactor = 1 / pow(gbl::cissLab->SummingMode(), 2.0); - gbl::calgrp += PvlKeyword("SolidAngle", gbl::solidAngle); - gbl::calgrp += PvlKeyword("OpticsArea", gbl::opticsArea); - gbl::calgrp += PvlKeyword("SumFactor", gbl::sumFactor); + gbl::calgrp += PvlKeyword("SolidAngle", toString(gbl::solidAngle)); + gbl::calgrp += PvlKeyword("OpticsArea", toString(gbl::opticsArea)); + gbl::calgrp += PvlKeyword("SumFactor", toString(gbl::sumFactor)); return; } @@ -1273,7 +1269,7 @@ void gbl::DivideByAreaPixel() { * method is not far off from the I/F method. */ -void gbl::FindEfficiencyFactor(string fluxunits) { +void gbl::FindEfficiencyFactor(QString fluxunits) { gbl::calgrp += PvlKeyword("DividedByEfficiency", "Yes"); gbl::calgrp += PvlKeyword("EfficiencyFactorMethod", fluxunits); @@ -1283,9 +1279,9 @@ void gbl::FindEfficiencyFactor(string fluxunits) { // find system transmission file (T0*T1*T2*QE) FileName transfile(gbl::GetCalibrationDirectory("efficiency/systrans") - + gbl::cissLab->InstrumentId().DownCase() - + gbl::cissLab->FilterName()[0].DownCase() - + gbl::cissLab->FilterName()[1].DownCase() + "_systrans.tab"); + + gbl::cissLab->InstrumentId().toLower() + + gbl::cissLab->FilterName()[0].toLower() + + gbl::cissLab->FilterName()[1].toLower() + "_systrans.tab"); if(!transfile.fileExists()) { // transmission file not found, stop calibration throw IException(IException::Io, "Unable to calibrate image. TransmissionFile ***" @@ -1297,16 +1293,14 @@ void gbl::FindEfficiencyFactor(string fluxunits) { vector wavelengthT, transmittedFlux; double x, y; for(int i = 0; i < trans->LineCount(); i++) { - IString line; + QString line; trans->GetLine(line); //assigns value to line - line = line.ConvertWhiteSpace(); - line = line.Compress(); - line = line.TrimHead(" "); + line = line.simplified().trimmed(); if(line == "") { break; } - x = line.Token(" ").ToDouble(); - y = line.Token(" ").ToDouble(); + x = toDouble(line.split(" ")[0]); + y = toDouble(line.split(" ")[1]); wavelengthT.push_back(x); transmittedFlux.push_back(y); } @@ -1342,16 +1336,14 @@ void gbl::FindEfficiencyFactor(string fluxunits) { CisscalFile *qeCorr = new CisscalFile(qecorrfile.expanded()); vector wavelengthQE, qecorrection; for(int i = 0; i < qeCorr->LineCount(); i++) { - IString line; + QString line; qeCorr->GetLine(line); //assigns value to line - line = line.ConvertWhiteSpace(); - line = line.Compress(); - line = line.TrimHead(" "); + line = line.simplified().trimmed(); if(line == "") { break; } - x = line.Token(" ").ToDouble(); - y = line.Trim(" ").ToDouble(); + x = toDouble(line.split(" ").first()); + y = toDouble(line.split(" ").last()); wavelengthQE.push_back(x); qecorrection.push_back(y); lambda.push_back(x); @@ -1370,7 +1362,7 @@ void gbl::FindEfficiencyFactor(string fluxunits) { // these variables will be defined in the if-statement - IString units; + QString units; double minlam, maxlam; vector fluxproduct1, fluxproduct2; @@ -1451,22 +1443,20 @@ void gbl::FindEfficiencyFactor(string fluxunits) { "Unable to calibrate image using I/F. Solar Distance calculated is less than or equal to 0.", _FILEINFO_); } - gbl::calgrp += PvlKeyword("SolarDistance", distFromSun); + gbl::calgrp += PvlKeyword("SolarDistance", toString(distFromSun)); // read spectral file to find wavelength and flux CisscalFile *spectral = new CisscalFile(specfile.expanded()); vector wavelengthF, flux; for(int i = 0; i < spectral->LineCount(); i++) { - IString line; + QString line; spectral->GetLine(line); //assigns value to line - line = line.ConvertWhiteSpace(); - line = line.Compress(); - line = line.TrimHead(" "); + line = line.simplified().trimmed(); if(line == "") { break; } - x = line.Token(" ").ToDouble() / angstromsToNm; - y = line.Trim(" ").ToDouble() * angstromsToNm; + x = toDouble(line.split(" ").first()) / angstromsToNm; + y = toDouble(line.split(" ").last()) * angstromsToNm; wavelengthF.push_back(x); flux.push_back(y); lambda.push_back(x); @@ -1521,8 +1511,8 @@ void gbl::FindEfficiencyFactor(string fluxunits) { spline2.AddData(lambda, fluxproduct2); gbl::efficiencyFactor = spline1.BoolesRule(spline1.DomainMinimum(), spline1.DomainMaximum()); double efficiency = spline2.BoolesRule(spline2.DomainMinimum(), spline2.DomainMaximum()); - gbl::calgrp += PvlKeyword("EfficiencyFactor", gbl::efficiencyFactor, units); - gbl::calgrp += PvlKeyword("TotalEfficiency", efficiency); + gbl::calgrp += PvlKeyword("EfficiencyFactor", toString(gbl::efficiencyFactor), units); + gbl::calgrp += PvlKeyword("TotalEfficiency", toString(efficiency)); // Cannot divide by 0.0 if(gbl::efficiencyFactor == 0) { @@ -1553,8 +1543,8 @@ void gbl::FindEfficiencyFactor(string fluxunits) { * available. */ void gbl::FindCorrectionFactors() { - string filter1 = gbl::cissLab->FilterName()[0]; - string filter2 = gbl::cissLab->FilterName()[1]; + QString filter1 = gbl::cissLab->FilterName()[0]; + QString filter2 = gbl::cissLab->FilterName()[1]; // check if polarized filters if(filter1 == "IRP0" || filter1 == "P120" || filter1 == "P60" || filter1 == "P0" || filter2 == "IRP90" || filter2 == "IRP0") { @@ -1569,26 +1559,26 @@ void gbl::FindCorrectionFactors() { gbl::calgrp += PvlKeyword("PolarizationFactorFile", polarizationFactorFile.expanded()); CisscalFile *polFact = new CisscalFile(polarizationFactorFile.expanded()); gbl::polarizationFactor = 0.0; - IString col1, col2, col3, col4; + QString col1, col2, col3, col4; for(int i = 0; i < polFact->LineCount(); i++) { - IString line; + QString line; polFact->GetLine(line); //assigns value to line - line = line.ConvertWhiteSpace(); - line = line.Compress(); - col1 = line.Token(" "); + line = line.simplified().trimmed(); + QStringList cols = line.split(" "); + col1 = cols.takeFirst(); if(col1 == gbl::cissLab->InstrumentId()) { - col2 = line.Token(" "); + col2 = cols.takeFirst(); if(col2 == gbl::cissLab->FilterName()[0]) { - col3 = line.Token(" "); + col3 = cols.takeFirst(); if(col3 == gbl::cissLab->FilterName()[1]) { - col4 = line.Trim(" "); + col4 = cols.takeFirst(); if(col4 == "") { gbl::polarizationFactor = 1.0; // dividing by polarization factor of 1.0 implies this correction is not performed gbl::calgrp.FindKeyword("PolarizationFactorPerformed").SetValue("No: PolarizationFactorFile contained no factor for filter combination"); } else { - gbl::polarizationFactor = col4.ToDouble(); + gbl::polarizationFactor = toDouble(col4); } break; } @@ -1621,7 +1611,7 @@ void gbl::FindCorrectionFactors() { filter2 = "CL2"; } } - gbl::calgrp += PvlKeyword("PolarizationFactor", gbl::polarizationFactor); + gbl::calgrp += PvlKeyword("PolarizationFactor", toString(gbl::polarizationFactor)); } else { @@ -1640,26 +1630,26 @@ void gbl::FindCorrectionFactors() { gbl::calgrp += PvlKeyword("CorrectionFactorFile", correctionFactorFile.expanded()); CisscalFile *corrFact = new CisscalFile(correctionFactorFile.expanded()); gbl::correctionFactor = 0.0; - IString col1, col2, col3, col4; + QString col1, col2, col3, col4; for(int i = 0; i < corrFact->LineCount(); i++) { - IString line; + QString line; corrFact->GetLine(line); //assigns value to line - line = line.ConvertWhiteSpace(); - line = line.Compress(); - col1 = line.Token(" "); + line = line.simplified().trimmed(); + QStringList cols = line.split(" "); + col1 = cols.takeFirst(); if(col1 == gbl::cissLab->InstrumentId()) { - col2 = line.Token(" "); + col2 = cols.takeFirst(); if(col2 == filter1) { - col3 = line.Token(" "); + col3 = cols.takeFirst(); if(col3 == filter2) { - col4 = line.Trim(" "); + col4 = cols.takeFirst(); if(col4 == "") { gbl::correctionFactor = 1.0; // dividing by correction factor of 1.0 implies this correction is not performed gbl::calgrp.FindKeyword("CorrectionFactorPerformed").SetValue("No: CorrectionFactorFile contained no factor for filter combination"); } else { - gbl::correctionFactor = col4.ToDouble(); + gbl::correctionFactor = toDouble(col4); } break; } @@ -1683,13 +1673,13 @@ void gbl::FindCorrectionFactors() { // dividing by correction factor of 1.0 implies this correction is not performed gbl::calgrp.FindKeyword("CorrectionFactorPerformed").SetValue("No: CorrectionFactorFile contained no factor for filter combination"); } - gbl::calgrp += PvlKeyword("CorrectionFactor", gbl::correctionFactor); + gbl::calgrp += PvlKeyword("CorrectionFactor", toString(gbl::correctionFactor)); return; } //=====End Correction Factor Methods=============================================================// /** - * This method returns an IString containing the path of a + * This method returns an QString containing the path of a * Cassini calibration directory * * @param calibrationType @@ -1698,10 +1688,10 @@ void gbl::FindCorrectionFactors() { * @internal * @history 2008-11-05 Jeannie Walldren - Original version */ -IString gbl::GetCalibrationDirectory(string calibrationType) { +QString gbl::GetCalibrationDirectory(QString calibrationType) { // Get the directory where the CISS calibration directories are. PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); - IString missionDir = (string) dataDir["Cassini"]; + QString missionDir = (QString) dataDir["Cassini"]; return missionDir + "/calibration/" + calibrationType + "/"; } diff --git a/isis/src/cassini/apps/vims2isis/vims2isis.cpp b/isis/src/cassini/apps/vims2isis/vims2isis.cpp index 73ea59c407..b2225d6960 100644 --- a/isis/src/cassini/apps/vims2isis/vims2isis.cpp +++ b/isis/src/cassini/apps/vims2isis/vims2isis.cpp @@ -1,5 +1,10 @@ #include "Isis.h" +#include +#include + +#include + #include "Brick.h" #include "EndianSwapper.h" #include "FileName.h" @@ -12,9 +17,6 @@ #include "Table.h" #include "UserInterface.h" -#include -#include - using namespace std; using namespace Isis; @@ -28,7 +30,7 @@ typedef struct { enum VimsType { VIS, IR }; -void ReadVimsBIL(std::string inFile, const PvlKeyword &suffixItems, std::string outFile); +void ReadVimsBIL(QString inFile, const PvlKeyword &suffixItems, QString outFile); void TranslateVimsLabels(Pvl &pdsLab, Cube *vimscube, VimsType vType); void ProcessCube(Buffer &in, Buffer &out); void ProcessBands(Pvl &pdsLab, Cube *vimscube, VimsType vtype); @@ -45,7 +47,7 @@ void IsisMain() { //Checks if in file is rdr if(lab.HasObject("IMAGE_MAP_PROJECTION")) { - string msg = "[" + in.name() + "] appears to be an rdr file."; + QString msg = "[" + in.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -53,18 +55,16 @@ void IsisMain() { //Make sure it is a vims cube try { PvlObject qube(lab.FindObject("QUBE")); - IString id; - id = (string)qube["INSTRUMENT_ID"]; - id.ConvertWhiteSpace(); - id.Compress(); - id.Trim(" "); + QString id; + id = (QString)qube["INSTRUMENT_ID"]; + id = id.simplified().trimmed(); if(id != "VIMS") { - string msg = "Invalid INSTRUMENT_ID [" + id + "]"; + QString msg = "Invalid INSTRUMENT_ID [" + id + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } } catch(IException &e) { - string msg = "Input file [" + in.expanded() + + QString msg = "Input file [" + in.expanded() + "] does not appear to be " + "in VIMS EDR/RDR format"; throw IException(IException::Io, msg, _FILEINFO_); @@ -74,7 +74,7 @@ void IsisMain() { Pvl pdsLab(in.expanded()); // It's VIMS, let's figure out if it has the suffix data or not - if((int)lab.FindObject("QUBE")["SUFFIX_ITEMS"][0] == 0) { + if(toInt(lab.FindObject("QUBE")["SUFFIX_ITEMS"][0]) == 0) { // No suffix data, we can use processimportpds ProcessImportPds p; @@ -135,8 +135,8 @@ void IsisMain() { Application::Log(status); //Clean up - string tmp(tempname.expanded()); - remove(tmp.c_str()); + QString tmp(tempname.expanded()); + QFile::remove(tmp); } /** @@ -155,9 +155,9 @@ void IsisMain() { * @param inFileName FileName of the input file * @param outFile FileName of the output file */ -void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::string outFile) { +void ReadVimsBIL(QString inFileName, const PvlKeyword &suffixItems, QString outFile) { Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); - string transDir = (string) dataDir["Base"]; + QString transDir = (QString) dataDir["Base"]; Pvl pdsLabel(inFileName); Isis::FileName transFile(transDir + "/" + "translations/pdsQube.trn"); @@ -178,9 +178,9 @@ void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::str sideplaneVisTable.SetAssociation(Table::Lines); sideplaneIrTable.SetAssociation(Table::Lines); - Isis::IString str; + QString str; str = pdsXlater.Translate("CoreBitsPerPixel"); - int bitsPerPixel = str.ToInteger(); + int bitsPerPixel = toInt(str); str = pdsXlater.Translate("CorePixelType"); PixelType pixelType = Isis::Real; @@ -209,8 +209,8 @@ void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::str pixelType = Isis::UnsignedInteger; } else { - string msg = "Invalid PixelType and BitsPerPixel combination [" + str + - ", " + Isis::IString(bitsPerPixel) + "]"; + QString msg = "Invalid PixelType and BitsPerPixel combination [" + str + + ", " + toString(bitsPerPixel) + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -218,21 +218,21 @@ void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::str Isis::ByteOrder byteOrder = Isis::ByteOrderEnumeration(str); str = pdsXlater.Translate("CoreSamples", 0); - int ns = str.ToInteger(); + int ns = toInt(str); str = pdsXlater.Translate("CoreLines", 2); - int nl = str.ToInteger(); + int nl = toInt(str); str = pdsXlater.Translate("CoreBands", 1); - int nb = str.ToInteger(); + int nb = toInt(str); std::vector baseList; std::vector multList; str = pdsXlater.Translate("CoreBase"); baseList.clear(); - baseList.push_back(str.ToDouble()); + baseList.push_back(toDouble(str)); str = pdsXlater.Translate("CoreMultiplier"); multList.clear(); - multList.push_back(str.ToDouble()); + multList.push_back(toDouble(str)); Cube outCube; outCube.setPixelType(Isis::Real); @@ -245,16 +245,16 @@ void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::str char *in = new char [readBytes]; // Set up an Isis::EndianSwapper object - Isis::IString tok(Isis::ByteOrderName(byteOrder)); - tok.UpCase(); + QString tok(Isis::ByteOrderName(byteOrder)); + tok = tok.toUpper(); Isis::EndianSwapper swapper(tok); ifstream fin; // Open input file Isis::FileName inFile(inFileName); - fin.open(inFileName.c_str(), ios::in | ios::binary); + fin.open(inFileName.toAscii().data(), ios::in | ios::binary); if(!fin.is_open()) { - string msg = "Cannot open input file [" + inFileName + "]"; + QString msg = "Cannot open input file [" + inFileName + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -267,9 +267,9 @@ void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::str // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + inFileName + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(fileHeaderBytes) + "]" ; + QString msg = "Cannot read file [" + inFileName + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(fileHeaderBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -296,9 +296,9 @@ void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::str fin.read(in, readBytes); if(!fin.good()) { - string msg = "Cannot read file [" + inFileName + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(readBytes) + "]" ; + QString msg = "Cannot read file [" + inFileName + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(readBytes) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -334,10 +334,10 @@ void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::str out.SetBasePosition(1, line + 1, band + 1); outCube.write(out); - if((int)suffixItems[0] != 0) { + if(toInt(suffixItems[0]) != 0) { pos = fin.tellg(); - char *sideplaneData = new char[4*(int)suffixItems[0]]; - fin.read(sideplaneData, 4 * (int)suffixItems[0]); + char *sideplaneData = new char[4*toInt(suffixItems[0])]; + fin.read(sideplaneData, 4 * toInt(suffixItems[0])); int suffixData = (int)swapper.Int((int *)sideplaneData); record[0] = line + 1; record[1] = band + 1; @@ -369,22 +369,22 @@ void ReadVimsBIL(std::string inFileName, const PvlKeyword &suffixItems, std::str // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + inFileName + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(4) + "]" ; + QString msg = "Cannot read file [" + inFileName + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(4) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } } } // End band loop - int backplaneSize = (int)suffixItems[1] * (4 * (ns + (int)suffixItems[0])); + int backplaneSize = toInt(suffixItems[1]) * (4 * (ns + toInt(suffixItems[0]))); fin.seekg(backplaneSize, ios_base::cur); // Check the last io if(!fin.good()) { - string msg = "Cannot read file [" + inFileName + "]. Position [" + - Isis::IString((int)pos) + "]. Byte count [" + - Isis::IString(4 * (4 * ns + 4)) + "]" ; + QString msg = "Cannot read file [" + inFileName + "]. Position [" + + toString((int)pos) + "]. Byte count [" + + toString(4 * (4 * ns + 4)) + "]" ; throw IException(IException::Io, msg, _FILEINFO_); } @@ -449,13 +449,13 @@ void ProcessBands(Pvl &pdsLab, Cube *vimsCube, VimsType vtype) { PvlGroup bandbin("BandBin"); PvlKeyword originalBand("OriginalBand"); for(int i = vims.mi32OrigBandStart; i <= vims.mi32OrigBinEnd; i++) { - originalBand.AddValue(i); + originalBand.AddValue(toString(i)); } bandbin += originalBand; PvlKeyword center("Center"); PvlGroup bbin(qube.FindGroup("BandBin")); for(int i = vims.mi32BandCenterStart; i < vims.mi32BandCenterEnd; i++) { - center += (string) bbin["BandBinCenter"][i]; + center += (QString) bbin["BandBinCenter"][i]; } bandbin += center; @@ -463,7 +463,7 @@ void ProcessBands(Pvl &pdsLab, Cube *vimsCube, VimsType vtype) { //Create the Kernels Group PvlGroup kern("Kernels"); - kern += PvlKeyword("NaifFrameCode", vims.mi32NaifFrameCode); + kern += PvlKeyword("NaifFrameCode", toString(vims.mi32NaifFrameCode)); vimsCube->putGroup(kern); } @@ -485,7 +485,7 @@ void ProcessBands(Pvl &pdsLab, Cube *vimsCube, VimsType vtype) { void TranslateVimsLabels(Pvl &pdsLab, Cube *vimscube, VimsType vType) { Isis::PvlGroup &dataDir = Isis::Preference::Preferences().FindGroup("DataDirectory"); - string transDir = (string) dataDir["Cassini"]; + QString transDir = (QString) dataDir["Cassini"]; Isis::FileName transFile(transDir + "/" + "translations/vimsPds.trn"); PvlObject qube(pdsLab.FindObject("Qube")); @@ -499,16 +499,16 @@ void TranslateVimsLabels(Pvl &pdsLab, Cube *vimscube, VimsType vType) { PvlGroup &inst = outputLabel.FindGroup("Instrument", Pvl::Traverse); //trim start and stop time - string strTime = inst.FindKeyword("StartTime")[0]; - inst.FindKeyword("StartTime").SetValue((string)((IString)strTime).Trim("Z")); - strTime = (string)qube["StopTime"]; - inst.FindKeyword("StopTime").SetValue((string)((IString)strTime).Trim("Z")); + QString strTime = inst.FindKeyword("StartTime")[0]; + inst.FindKeyword("StartTime").SetValue(strTime.remove("Z")); + strTime = (QString)qube["StopTime"]; + inst.FindKeyword("StopTime").SetValue(strTime.remove("Z")); if(vType == IR) { - inst += PvlKeyword("SamplingMode", (string)qube["SamplingModeId"][0]); + inst += PvlKeyword("SamplingMode", (QString)qube["SamplingModeId"][0]); } else { - inst += PvlKeyword("SamplingMode", (string)qube["SamplingModeId"][1]); + inst += PvlKeyword("SamplingMode", (QString)qube["SamplingModeId"][1]); } if(vType == VIS) { inst += PvlKeyword("Channel", "VIS"); @@ -523,10 +523,10 @@ void TranslateVimsLabels(Pvl &pdsLab, Cube *vimscube, VimsType vType) { inst += expDuration; if(vType == IR) { - inst += PvlKeyword("GainMode", (string)qube["GainModeId"][0]); + inst += PvlKeyword("GainMode", (QString)qube["GainModeId"][0]); } else { - inst += PvlKeyword("GainMode", (string)qube["GainModeId"][1]); + inst += PvlKeyword("GainMode", (QString)qube["GainModeId"][1]); } vimscube->putGroup(inst); diff --git a/isis/src/cassini/apps/vims2map/vims2map.cpp b/isis/src/cassini/apps/vims2map/vims2map.cpp index 18c867414a..b6505fa2e1 100644 --- a/isis/src/cassini/apps/vims2map/vims2map.cpp +++ b/isis/src/cassini/apps/vims2map/vims2map.cpp @@ -19,8 +19,8 @@ void PrintMap(); void rasterizeVims(Isis::Buffer &in); std::vector vimsValues; -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["PrintMap"] = (void *) PrintMap; return helper; } @@ -45,8 +45,8 @@ void IsisMain() { FileList list; list.read(ui.GetFileName("FROMLIST")); if(list.size() < 1) { - string msg = "The list file [" + ui.GetFileName("FROMLIST") + - "does not contain any data"; + QString msg = "The list file [" + ui.GetFileName("FROMLIST") + + "does not contain any data"; throw IException(IException::User, msg, _FILEINFO_); } @@ -57,7 +57,7 @@ void IsisMain() { double maxlon = 0; PvlGroup camGrp; PvlGroup bandBinGrp; - string lastBandString; + QString lastBandString; //Loop thru each file in the FROMLIST for (int i = 0; i < list.size(); i++) { @@ -69,14 +69,14 @@ void IsisMain() { // Make sure it is not the sky if (incam->target()->isSky()) { - string msg = "The image [" + list[i].toString() + - "] is targeting the sky, use skymap instead."; + QString msg = "The image [" + list[i].toString() + + "] is targeting the sky, use skymap instead."; throw IException(IException::User, msg, _FILEINFO_); } // Make sure all the bands for all the files match if(i > 1 && atts0.bandsString() != lastBandString) { - string msg = "The Band numbers for all the files do not match."; + QString msg = "The Band numbers for all the files do not match."; throw IException(IException::User, msg, _FILEINFO_); } else { @@ -110,10 +110,10 @@ void IsisMain() { } } //end for list.size - camGrp.AddKeyword(PvlKeyword("MinimumLatitude", minlat), Pvl::Replace); - camGrp.AddKeyword(PvlKeyword("MaximumLatitude", maxlat), Pvl::Replace); - camGrp.AddKeyword(PvlKeyword("MinimumLongitude", minlon), Pvl::Replace); - camGrp.AddKeyword(PvlKeyword("MaximumLongitude", maxlon), Pvl::Replace); + camGrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(minlat)), Pvl::Replace); + camGrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(maxlat)), Pvl::Replace); + camGrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(minlon)), Pvl::Replace); + camGrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(maxlon)), Pvl::Replace); // We want to delete the keywords we just added if the user wants the range @@ -145,22 +145,22 @@ void IsisMain() { // If the user decided to enter a ground range then override if(ui.WasEntered("MINLON")) { userGrp.AddKeyword(PvlKeyword("MinimumLongitude", - ui.GetDouble("MINLON")), Pvl::Replace); + toString(ui.GetDouble("MINLON"))), Pvl::Replace); } if(ui.WasEntered("MAXLON")) { userGrp.AddKeyword(PvlKeyword("MaximumLongitude", - ui.GetDouble("MAXLON")), Pvl::Replace); + toString(ui.GetDouble("MAXLON"))), Pvl::Replace); } if(ui.WasEntered("MINLAT")) { userGrp.AddKeyword(PvlKeyword("MinimumLatitude", - ui.GetDouble("MINLAT")), Pvl::Replace); + toString(ui.GetDouble("MINLAT"))), Pvl::Replace); } if(ui.WasEntered("MAXLAT")) { userGrp.AddKeyword(PvlKeyword("MaximumLatitude", - ui.GetDouble("MAXLAT")), Pvl::Replace); + toString(ui.GetDouble("MAXLAT"))), Pvl::Replace); } // If they want the res. from the mapfile, delete it from the camera so @@ -189,7 +189,7 @@ void IsisMain() { // If the user decided to enter a resolution then override if(ui.GetString("PIXRES") == "MPP") { userGrp.AddKeyword(PvlKeyword("PixelResolution", - ui.GetDouble("RESOLUTION")), + toString(ui.GetDouble("RESOLUTION"))), Pvl::Replace); if(userGrp.HasKeyword("Scale")) { userGrp.DeleteKeyword("Scale"); @@ -197,7 +197,7 @@ void IsisMain() { } else if(ui.GetString("PIXRES") == "PPD") { userGrp.AddKeyword(PvlKeyword("Scale", - ui.GetDouble("RESOLUTION")), + toString(ui.GetDouble("RESOLUTION"))), Pvl::Replace); if(userGrp.HasKeyword("PixelResolution")) { userGrp.DeleteKeyword("PixelResolution"); @@ -209,36 +209,36 @@ void IsisMain() { if(incam->IntersectsLongitudeDomain(userMap)) { if(ui.GetString("LONSEAM") == "AUTO") { if((int) userGrp["LongitudeDomain"] == 360) { - userGrp.AddKeyword(PvlKeyword("LongitudeDomain", 180), + userGrp.AddKeyword(PvlKeyword("LongitudeDomain", toString(180)), Pvl::Replace); if(incam->IntersectsLongitudeDomain(userMap)) { // Its looks like a global image so switch back to the // users preference - userGrp.AddKeyword(PvlKeyword("LongitudeDomain", 360), + userGrp.AddKeyword(PvlKeyword("LongitudeDomain", toString(360)), Pvl::Replace); } } else { - userGrp.AddKeyword(PvlKeyword("LongitudeDomain", 360), + userGrp.AddKeyword(PvlKeyword("LongitudeDomain", toString(360)), Pvl::Replace); if(incam->IntersectsLongitudeDomain(userMap)) { // Its looks like a global image so switch back to the // users preference - userGrp.AddKeyword(PvlKeyword("LongitudeDomain", 180), + userGrp.AddKeyword(PvlKeyword("LongitudeDomain", toString(180)), Pvl::Replace); } } // Make the target info match the new longitude domain double minlat, maxlat, minlon, maxlon; incam->GroundRange(minlat, maxlat, minlon, maxlon, userMap); - userGrp.AddKeyword(PvlKeyword("MinimumLatitude", minlat), Pvl::Replace); - userGrp.AddKeyword(PvlKeyword("MaximumLatitude", maxlat), Pvl::Replace); - userGrp.AddKeyword(PvlKeyword("MinimumLongitude", minlon), Pvl::Replace); - userGrp.AddKeyword(PvlKeyword("MaximumLongitude", maxlon), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MinimumLatitude", toString(minlat)), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MaximumLatitude", toString(maxlat)), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MinimumLongitude", toString(minlon)), Pvl::Replace); + userGrp.AddKeyword(PvlKeyword("MaximumLongitude", toString(maxlon)), Pvl::Replace); } else if(ui.GetString("LONSEAM") == "ERROR") { - string msg = "The image [" + ui.GetFileName("FROM") + "] crosses the " + + QString msg = "The image [" + ui.GetFileName("FROM") + "] crosses the " + "longitude seam"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/cassini/apps/vimscal/vimscal.cpp b/isis/src/cassini/apps/vimscal/vimscal.cpp index 0f582afa4e..422b41d040 100644 --- a/isis/src/cassini/apps/vimscal/vimscal.cpp +++ b/isis/src/cassini/apps/vimscal/vimscal.cpp @@ -3,6 +3,8 @@ #include #include +#include + #include "Camera.h" #include "EndianSwapper.h" #include "IException.h" @@ -29,7 +31,7 @@ map< pair, double > lineBasedDarkCorrections; vector specificEnergyCorrections; //! list of temp files that need deleted -vector tempFiles; +vector tempFiles; //! solar remove coefficient double solarRemoveCoefficient; @@ -48,7 +50,7 @@ void calculateSolarRemove(Cube *, ProcessByLine *); void calibrate(vector &in, vector &out); -IString createCroppedFile(Cube *icube, IString cubeFileName, bool flatFile = false); +QString createCroppedFile(Cube *icube, QString cubeFileName, bool flatFile = false); void GetOffsets(const Pvl &lab, int &finalSampOffset, int &finalLineOffset); // This is the results group @@ -80,12 +82,12 @@ void IsisMain() { } if(!isVims) { - IString msg = "The input cube [" + IString(ui.GetAsString("FROM")) + "] is not a Cassini VIMS cube"; + QString msg = "The input cube [" + QString(ui.GetAsString("FROM")) + "] is not a Cassini VIMS cube"; throw IException(IException::User, msg, _FILEINFO_); } if(icube->getLabel()->FindObject("IsisCube").HasGroup("AlphaCube")) { - IString msg = "The input cube [" + IString(ui.GetAsString("FROM")) + "] has had its dimensions modified and can not be calibrated"; + QString msg = "The input cube [" + QString(ui.GetAsString("FROM")) + "] has had its dimensions modified and can not be calibrated"; throw IException(IException::User, msg, _FILEINFO_); } @@ -107,7 +109,7 @@ void IsisMain() { p.EndProcess(); for(unsigned int i = 0; i < tempFiles.size(); i++) { - remove(tempFiles[i].c_str()); + QFile::remove(tempFiles[i]); } tempFiles.clear(); @@ -187,7 +189,7 @@ void calculateSolarRemove(Cube *icube, ProcessByLine *p) { cam = icube->getCamera(); } catch(IException &e) { - IString msg = "Unable to create a camera model from [" + + QString msg = "Unable to create a camera model from [" + icube->getFileName() + "]. Please run " "spiceinit on this file"; throw IException(e, IException::Unknown, msg, _FILEINFO_); @@ -242,7 +244,7 @@ void calculateSolarRemove(Cube *icube, ProcessByLine *p) { if(solarRemoveCoefficient < 0) { solarRemoveCoefficient = 81.595089; /* - string msg = "Unable to project image at four corners, center of edges or "; + QString msg = "Unable to project image at four corners, center of edges or "; msg += "at center. The solar distance can not be calculated, try using"; msg += " [UNITS=SPECENERGY] on ["; msg += icube->FileName() + "]"; @@ -253,7 +255,7 @@ void calculateSolarRemove(Cube *icube, ProcessByLine *p) { bool vis = (icube->getLabel()-> FindGroup("Instrument", Pvl::Traverse)["Channel"][0] != "IR"); - IString attributes; + QString attributes; // vis is bands 1-96, ir is bands 97-352 in this calibration file if(vis) { @@ -290,13 +292,13 @@ void calculateSpecificEnergy(Cube *icube) { } if(vis) { - coefficient /= (double)inst["ExposureDuration"][1] / 1000.0; + coefficient /= toDouble(inst["ExposureDuration"][1]) / 1000.0; } else { - coefficient /= ((double)inst["ExposureDuration"][0]) / 1000.0 - 0.004; + coefficient /= (toDouble(inst["ExposureDuration"][0])) / 1000.0 - 0.004; } - IString specEnergyFile = "$cassini/calibration/vims/"; + QString specEnergyFile = "$cassini/calibration/vims/"; if(vis) { specEnergyFile += "vis_perf_v????.cub"; @@ -305,7 +307,7 @@ void calculateSpecificEnergy(Cube *icube) { specEnergyFile += "ir_perf_v????.cub"; } - IString waveCalFile = "$cassini/calibration/vims/wavecal_v????.cub"; + QString waveCalFile = "$cassini/calibration/vims/wavecal_v????.cub"; FileName specEnergyFileName(specEnergyFile); specEnergyFileName = specEnergyFileName.highestVersion(); @@ -381,7 +383,7 @@ void calculateVisDarkCurrent(Cube *icube) { // This is the dark current corrections for VIS bool hires = ((inst["SamplingMode"][0] == "HIGH") || (inst["SamplingMode"][0] == "HI-RES")); - IString calFile = "$cassini/calibration/vims/vis_"; + QString calFile = "$cassini/calibration/vims/vis_"; if(hires) { calFile += "hires"; @@ -401,9 +403,9 @@ void calculateVisDarkCurrent(Cube *icube) { EndianSwapper swapper("LSB"); - FILE *calFilePtr = fopen(calFile.c_str(), "r"); + FILE *calFilePtr = fopen(calFile.toAscii().data(), "r"); - double visExposure = inst["ExposureDuration"][1]; + double visExposure = toDouble(inst["ExposureDuration"][1]); int sampleOffset, lineOffset; GetOffsets(*icube->getLabel(), sampleOffset, lineOffset); @@ -423,7 +425,7 @@ void calculateVisDarkCurrent(Cube *icube) { if(fread(&calData, sizeof(calData), 1, calFilePtr) != 1) { // error! - string msg = "Error reading file [" + calFile + "]"; + QString msg = "Error reading file [" + calFile + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -611,7 +613,7 @@ void chooseFlatFile(Cube *icube, ProcessByLine *p) { bool vis = (inst["Channel"][0] != "IR"); bool hires = ((inst["SamplingMode"][0] == "HIGH") || (inst["SamplingMode"][0] == "HI-RES")); - IString calFile = "$cassini/calibration/vims/flatfield/"; + QString calFile = "$cassini/calibration/vims/flatfield/"; if(vis) { calFile += "vis_"; @@ -643,9 +645,9 @@ void chooseFlatFile(Cube *icube, ProcessByLine *p) { * @param icube * @param cubeFileName * - * @return IString + * @return QString */ -IString createCroppedFile(Cube *icube, IString cubeFileName, bool flatFile) { +QString createCroppedFile(Cube *icube, QString cubeFileName, bool flatFile) { int sampOffset = 1; int lineOffset = 1; @@ -654,11 +656,11 @@ IString createCroppedFile(Cube *icube, IString cubeFileName, bool flatFile) { } - IString appArgs = "from=" + cubeFileName + " "; - appArgs += "sample=" + IString(sampOffset) + " "; - appArgs += "line=" + IString(lineOffset) + " "; - appArgs += "nsamples=" + IString(icube->getSampleCount()) + " "; - appArgs += "nlines=" + IString(icube->getLineCount()) + " "; + QString appArgs = "from=" + cubeFileName + " "; + appArgs += "sample=" + toString(sampOffset) + " "; + appArgs += "line=" + toString(lineOffset) + " "; + appArgs += "nsamples=" + toString(icube->getSampleCount()) + " "; + appArgs += "nlines=" + toString(icube->getLineCount()) + " "; FileName tempFile("$TEMPORARY/tmp_" + FileName(cubeFileName).baseName() + "_" + FileName(icube->getFileName()).name()); @@ -685,7 +687,7 @@ void GetOffsets(const Pvl &lab, int &finalSampOffset, int &finalLineOffset) { finalSampOffset = sampOffset; finalLineOffset = lineOffset; - string samplingMode = IString((string)inst ["SamplingMode"]).UpCase(); + QString samplingMode = QString(inst["SamplingMode"]).toUpper(); if(vis) { if(samplingMode == "NORMAL") { finalSampOffset = sampOffset - 1; @@ -696,7 +698,7 @@ void GetOffsets(const Pvl &lab, int &finalSampOffset, int &finalLineOffset) { finalLineOffset = (3 * (lineOffset + swathLength / 2)) - swathLength / 2; } else { - string msg = "Unsupported sampling mode [" + samplingMode + "]"; + QString msg = "Unsupported sampling mode [" + samplingMode + "]"; throw IException(IException::Io, msg, _FILEINFO_); } } @@ -710,11 +712,11 @@ void GetOffsets(const Pvl &lab, int &finalSampOffset, int &finalLineOffset) { finalLineOffset = lineOffset - 1; } else if(samplingMode == "NYQUIST") { - string msg = "Cannot process NYQUIST (undersampled) mode "; + QString msg = "Cannot process NYQUIST (undersampled) mode "; throw IException(IException::Unknown, msg, _FILEINFO_); } else { - string msg = "Unsupported sampling mode [" + samplingMode + "]"; + QString msg = "Unsupported sampling mode [" + samplingMode + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } } diff --git a/isis/src/cassini/objs/CissLabels/CissLabels.cpp b/isis/src/cassini/objs/CissLabels/CissLabels.cpp index 1c4cd0feec..1887c314e9 100644 --- a/isis/src/cassini/objs/CissLabels/CissLabels.cpp +++ b/isis/src/cassini/objs/CissLabels/CissLabels.cpp @@ -22,7 +22,7 @@ namespace Isis { * * @param file Name of Cassini ISS file */ - CissLabels::CissLabels(const string &file) { + CissLabels::CissLabels(const QString &file) { Pvl lab(file); Init(lab); } @@ -57,32 +57,32 @@ namespace Isis { void CissLabels::ReadLabels(Pvl &lab) { // Get values out of the instrument group PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - p_ABflag = (string) inst["AntiBloomingStateFlag"]; //valid values: On, Off, Unknown + p_ABflag = (QString) inst["AntiBloomingStateFlag"]; //valid values: On, Off, Unknown p_biasStripMean = (double) inst["BiasStripMean"]; //valid values: real numbers - p_compressionRatio = (string) inst["CompressionRatio"]; //valid values: NotCompressed or real number - p_compressionType = (string) inst["CompressionType"]; //valid values: Lossy, Lossless, NotCompressed - p_dataConversionType = (string) inst["DataConversionType"]; //valid values: 12Bit, 8LSB, Table - p_delayedReadoutFlag = (string) inst["DelayedReadoutFlag"]; //valid values: Yes, No, Unknown + p_compressionRatio = (QString) inst["CompressionRatio"]; //valid values: NotCompressed or real number + p_compressionType = (QString) inst["CompressionType"]; //valid values: Lossy, Lossless, NotCompressed + p_dataConversionType = (QString) inst["DataConversionType"]; //valid values: 12Bit, 8LSB, Table + p_delayedReadoutFlag = (QString) inst["DelayedReadoutFlag"]; //valid values: Yes, No, Unknown p_exposureDuration = (double) inst["ExposureDuration"]; //valid values: real numbers - p_flightSoftwareVersion = (string) inst["FlightSoftwareVersionId"]; //valid values: Unknown, 1.2, 1.3, 1.4 + p_flightSoftwareVersion = (QString) inst["FlightSoftwareVersionId"]; //valid values: Unknown, 1.2, 1.3, 1.4 p_gainModeId = (int) inst["GainModeId"]; //valid values: 12, 29, 95, 215 p_gainState = (int) inst["GainState"]; //valid values: 0, 1, 2, 3 p_instrumentDataRate = (double) inst["InstrumentDataRate"]; //valid values: 60.9, 121.9, 182.8, 243.7, 304.6, 365.6, -999.0 - p_instrumentModeId = (string) inst["InstrumentModeId"]; //valid values: Full, Sum2, Sum4 - p_instrumentId = (string) inst["InstrumentId"]; //valid values: ISSNA, ISSWA - p_readoutCycleIndex = (string) inst["ReadoutCycleIndex"]; //valid values: Unknown or integers 0-15 + p_instrumentModeId = (QString) inst["InstrumentModeId"]; //valid values: Full, Sum2, Sum4 + p_instrumentId = (QString) inst["InstrumentId"]; //valid values: ISSNA, ISSWA + p_readoutCycleIndex = (QString) inst["ReadoutCycleIndex"]; //valid values: Unknown or integers 0-15 p_readoutOrder = (int) inst["ReadoutOrder"]; //valid values: 0 or 1 - p_shutterModeId = (string) inst["ShutterModeId"]; //valid values: BothSim, NacOnly, WacOnly + p_shutterModeId = (QString) inst["ShutterModeId"]; //valid values: BothSim, NacOnly, WacOnly p_summingMode = (int) inst["SummingMode"]; //valid values: 1, 2, 4 - p_frontOpticsTemp = inst["OpticsTemperature"][0].ToDouble(); //valid values: real numbers + p_frontOpticsTemp = toDouble(inst["OpticsTemperature"][0]); //valid values: real numbers // Get values out of the archive group PvlGroup &arch = lab.FindGroup("Archive", Pvl::Traverse); p_imageNumber = (double) arch["ImageNumber"]; // Get values out of the bandbin group PvlGroup &bandbin = lab.FindGroup("BandBin", Pvl::Traverse); - IString filter = (string) bandbin["FilterName"]; - p_filter.push_back(filter.Token("/")); - p_filter.push_back(filter); + IString filter = (QString) bandbin["FilterName"]; + p_filter.push_back(filter.Token("/").ToQt()); + p_filter.push_back(filter.ToQt()); } diff --git a/isis/src/cassini/objs/CissLabels/CissLabels.h b/isis/src/cassini/objs/CissLabels/CissLabels.h index 3f6961dc7d..2c0f790c0e 100644 --- a/isis/src/cassini/objs/CissLabels/CissLabels.h +++ b/isis/src/cassini/objs/CissLabels/CissLabels.h @@ -24,7 +24,9 @@ #include #include -#include "IString.h" + +#include + namespace Isis { class Pvl; /** @@ -46,7 +48,7 @@ namespace Isis { class CissLabels { public: CissLabels(Pvl &lab); - CissLabels(const std::string &file); + CissLabels(const QString &file); //! Destroys the CissLabels object ~CissLabels() {}; @@ -102,12 +104,12 @@ namespace Isis { * Finds the ratio of the expected image size to the actual * size. Valid values include any real number or * "NotCompressed". This method returns an - * @b Isis::IString so that values other than + * @b QString so that values other than * "NotCompressed" may be converted to @b double. * - * @returns @b IString CompressionRatio + * @returns @b QString CompressionRatio */ - inline IString CompressionRatio() const { + inline QString CompressionRatio() const { return p_compressionRatio; }; @@ -120,9 +122,9 @@ namespace Isis { * "Lossless" (a.k.a Rice), or "Lossy" (a.k.a. Discrete Cosine * Transform). * - * @returns @b IString CompressionType + * @returns @b QString CompressionType */ - inline IString CompressionType() const { + inline QString CompressionType() const { return p_compressionType; }; @@ -135,9 +137,9 @@ namespace Isis { * "Table" (converted using look-up table), or "8LSB" (kept the * 8 least significant bits only). * - * @returns @b IString DataConversionType + * @returns @b QString DataConversionType */ - inline IString DataConversionType() const { + inline QString DataConversionType() const { return p_dataConversionType; }; @@ -149,9 +151,9 @@ namespace Isis { * performing a readout. Valid values include "Yes", "No", or * "Unknown". * - * @returns @b IString DelayedReadoutFlag + * @returns @b QString DelayedReadoutFlag */ - inline IString DelayedReadoutFlag() const { + inline QString DelayedReadoutFlag() const { return p_delayedReadoutFlag; }; @@ -194,9 +196,9 @@ namespace Isis { * * * - * @returns @b vector @b \ The optical filter names. + * @returns @b vector @b \ The optical filter names. */ - std::vector FilterName() const { + std::vector FilterName() const { return p_filter; }; @@ -222,12 +224,12 @@ namespace Isis { * * Retrieves the flight software version used for this image. * Valid values include 1.2, 1.3, 1.4, or "Unknown". This - * method returns an @b Isis::IString so that any value other + * method returns an @b QString so that any value other * than "Unknown" may be converted to @b double. * - * @returns @b IString FlightSoftwareVersion + * @returns @b QString FlightSoftwareVersion */ - inline IString FlightSoftwareVersion() const { + inline QString FlightSoftwareVersion() const { return p_flightSoftwareVersion; }; @@ -312,9 +314,9 @@ namespace Isis { * (also called "NAC" or "narrow-angle") or "ISSWA" (also * called "WAC" or "wide-angle"). * - * @returns @b IString InstrumentId + * @returns @b QString InstrumentId */ - inline IString InstrumentId() const { + inline QString InstrumentId() const { return p_instrumentId; }; @@ -332,8 +334,8 @@ namespace Isis { * @returns @b double lower-cased InstrumentModeId * @see SummingMode() */ - inline IString InstrumentModeId() { - return p_instrumentModeId.DownCase(); + inline QString InstrumentModeId() { + return p_instrumentModeId.toLower(); }; @@ -342,13 +344,13 @@ namespace Isis { * * Finds the index associated with the image in the Readout * Cycle table. Valid values are "Unknown" or in the range - * 0-15. This method returns an @b Isis::IString so that any + * 0-15. This method returns an @b QString so that any * value not equal to "Unknown" may be converted to * @b int. * - * @returns @b IString ReadoutCycleIndex + * @returns @b QString ReadoutCycleIndex */ - inline IString ReadoutCycleIndex() const { + inline QString ReadoutCycleIndex() const { return p_readoutCycleIndex; }; @@ -378,9 +380,9 @@ namespace Isis { * "BothSim", "NacOnly", "WacOnly", * or "Unknown". * - * @returns @b IString ShutterModeId + * @returns @b QString ShutterModeId */ - inline IString ShutterModeId() const { + inline QString ShutterModeId() const { return p_shutterModeId; }; @@ -422,7 +424,7 @@ namespace Isis { //! Value of the PDS keyword AntiBloomingFlag in the cube's labels - std::string p_ABflag; + QString p_ABflag; //! Indicates whether anti-blooming state flag on bool p_antiblooming; //! Value of the PDS keyword BiasStripMean in the cube's labels @@ -430,21 +432,21 @@ namespace Isis { //! Indicates whether camera is narrow-angle bool p_cissNA; //! Value of the PDS keyword CompressionRatio in the cube's labels - IString p_compressionRatio; + QString p_compressionRatio; //! Value of the PDS keyword CompressionType in the cube's labels - IString p_compressionType; + QString p_compressionType; //! Value of the PDS keyword DataConversionType in the cube's labels - IString p_dataConversionType; + QString p_dataConversionType; //! Value of the PDS keyword DelayedReadoutFlag in the cube's labels - IString p_delayedReadoutFlag; + QString p_delayedReadoutFlag; //! Value of the PDS keyword ExposureDuration in the cube's labels double p_exposureDuration; //! Two-element array of optical filters used for this image - std::vector p_filter; + std::vector p_filter; //! Two-element array of filter indices corresponding to optical filters std::vector p_filterIndex; //! Value of the PDS keyword FlightSoftwareVersion in the cube's labels - IString p_flightSoftwareVersion; + QString p_flightSoftwareVersion; //! Value of the PDS keyword OpticsTemperature[0] in the cube's labels double p_frontOpticsTemp; //! Value of the PDS keyword GainModeId in the cube's labels @@ -456,15 +458,15 @@ namespace Isis { //! Value of the PDS keyword ImageTime in the cube's labels double p_instrumentDataRate; //! Value of the PDS keyword InstrumentId in the cube's labels - IString p_instrumentId; + QString p_instrumentId; //! Value of the PDS keyword InstrumentModeId in the cube's labels - IString p_instrumentModeId; + QString p_instrumentModeId; //! Value of the PDS keyword ReadoutCycleIndex in the cube's labels - IString p_readoutCycleIndex; + QString p_readoutCycleIndex; //! Value of the PDS keyword ReadoutOrder in the cube's labels int p_readoutOrder; //! Value of the PDS keyword ShutterModeId in the cube's labels - IString p_shutterModeId; + QString p_shutterModeId; //! Value of the PDS keyword SummingMode in the cube's labels int p_summingMode; }; diff --git a/isis/src/cassini/objs/CisscalFile/CisscalFile.cpp b/isis/src/cassini/objs/CisscalFile/CisscalFile.cpp index 3cda006729..7c196a5cb3 100644 --- a/isis/src/cassini/objs/CisscalFile/CisscalFile.cpp +++ b/isis/src/cassini/objs/CisscalFile/CisscalFile.cpp @@ -56,7 +56,7 @@ namespace Isis { * @param extension Extension to be added to filename (added only if not * already on filename). Defaults to "" */ - CisscalFile::CisscalFile(const string &filename, const char *openmode, + CisscalFile::CisscalFile(const QString &filename, const char *openmode, const char *extension): TextFile(filename, openmode, extension) { p_begindataFound = false; } @@ -74,10 +74,13 @@ namespace Isis { * @throws Isis::iException::Io "Error reading text file" * @see GetLine() */ - bool CisscalFile::p_GetLine(string &line) { + bool CisscalFile::p_GetLine(QString &line) { OpenChk(true); // Try to read the next line - getline(p_stream, line); + std::string lineTmp; + getline(p_stream, lineTmp); + line = lineTmp.c_str(); + // Check for end of file if(p_stream.eof()) { line = ""; @@ -86,13 +89,13 @@ namespace Isis { // See if an error occured if(!p_stream.good()) { line = ""; - string message = "TextFile:GetLine: -> Error reading text file: [" - + p_filename + "]"; + QString message = "TextFile:GetLine: -> Error reading text file: [" + + p_filename + "]"; throw IException(IException::Io, message, _FILEINFO_); } // Search for tag "\begindata" if it was not already found by recursively using this method if(!p_begindataFound) { - if(line.find("\\begindata") == string::npos) { + if(!line.contains("\\begindata")) { return p_GetLine(line); } p_begindataFound = true; @@ -119,7 +122,7 @@ namespace Isis { * @throws Isis::iException::Io "Error reading text file" * @see p_GetLine() */ - bool CisscalFile::GetLine(string &line) { + bool CisscalFile::GetLine(QString &line) { return p_GetLine(line); } diff --git a/isis/src/cassini/objs/CisscalFile/CisscalFile.h b/isis/src/cassini/objs/CisscalFile/CisscalFile.h index 75f2ba46d6..678e443f20 100644 --- a/isis/src/cassini/objs/CisscalFile/CisscalFile.h +++ b/isis/src/cassini/objs/CisscalFile/CisscalFile.h @@ -22,9 +22,12 @@ * http://www.usgs.gov/privacy.html. */ -#include #include + +#include + #include "TextFile.h" + namespace Isis { /** * @brief Extends TextFile to handle Cassini ISS @@ -45,16 +48,16 @@ namespace Isis { */ class CisscalFile : public TextFile { public: - CisscalFile(const std::string &filename, const char *openmode = "input", + CisscalFile(const QString &filename, const char *openmode = "input", const char *extension = ""); //!> Destructor closes the text file. ~CisscalFile() { TextFile::Close(); }; - bool GetLine(std::string &line); + bool GetLine(QString &line); protected: bool p_begindataFound; //!> Flag variable indicates whether the tag "\begindata" has been found. - bool p_GetLine(std::string &line); + bool p_GetLine(QString &line); }; }; #endif diff --git a/isis/src/cassini/objs/CisscalFile/unitTest.cpp b/isis/src/cassini/objs/CisscalFile/unitTest.cpp index c650acf42c..6a95ba43c6 100644 --- a/isis/src/cassini/objs/CisscalFile/unitTest.cpp +++ b/isis/src/cassini/objs/CisscalFile/unitTest.cpp @@ -21,6 +21,8 @@ #include #include +#include + #include "CisscalFile.h" #include "FileName.h" #include "IException.h" @@ -43,9 +45,9 @@ int main(int argc, char *argv[]) { // ---------------------------------------------------------------------------------- - string testFile = "$temporary/CisscalFile.tmp"; + QString testFile = "$temporary/CisscalFile.tmp"; // setup test data - string testLines[8]; + QString testLines[8]; // setup line test data testLines[0] = "PDS_VERSION_ID = PDS3"; @@ -60,7 +62,7 @@ int main(int argc, char *argv[]) { // calc cumulative byte counts for each line - to check CisscalFile.Size() streamsize numBytes = 0; streamsize numBytesFiltered = 0; - vector testLinesVector; + vector testLinesVector; for(int i = 0; i <= 7; i++) { numBytes += testLines[i].length() + strlen("\n"); @@ -77,7 +79,7 @@ int main(int argc, char *argv[]) { try { Isis::CisscalFile f(testFile); bool lineFound = false; - string line; + QString line; // data line 1 lineFound = f.GetLine(line); if (!lineFound) { @@ -146,7 +148,7 @@ int main(int argc, char *argv[]) { } //----------------------------------------------------------------------------------- cout << "2) Remove temp file -> " << testFile << " <-" << endl; - if (remove(FileName(testFile).expanded().c_str())) { + if (!QFile::remove(FileName(testFile).expanded())) { cout << "*** Failed to remove tmp file: " << testFile << endl; } return 0; diff --git a/isis/src/cassini/objs/IssNACamera/IssNACamera.cpp b/isis/src/cassini/objs/IssNACamera/IssNACamera.cpp index 6198dc90df..bb0462ccc7 100644 --- a/isis/src/cassini/objs/IssNACamera/IssNACamera.cpp +++ b/isis/src/cassini/objs/IssNACamera/IssNACamera.cpp @@ -50,7 +50,7 @@ namespace Isis { try { PvlGroup bandBin = lab.FindGroup("BandBin", Pvl::Traverse); QString key = QString("INS%1_%2_FOCAL_LENGTH"). - arg(naifIkCode()).arg(bandBin["FilterName"][0].c_str()); + arg(naifIkCode()).arg(bandBin["FilterName"][0]); key = key.replace("/", "_"); focalLength = getDouble(key); } @@ -64,7 +64,7 @@ namespace Isis { IException finalError(IException::Unknown, QString("Unable to find a focal length for the requested Cassini ISS NA " "filter combination [%1] or the default focal length") - .arg(bandBin["FilterName"][0].c_str()), + .arg(bandBin["FilterName"][0]), _FILEINFO_); finalError.append(firstException); finalError.append(secondException); @@ -75,12 +75,12 @@ namespace Isis { NaifStatus::CheckErrors(); SetFocalLength(focalLength); SetPixelPitch(); - instrumentRotation()->SetFrame(Spice::getInteger("INS_" + (IString)(int)naifIkCode() + "_FRAME_ID")); + instrumentRotation()->SetFrame(Spice::getInteger("INS_" + toString(naifIkCode()) + "_FRAME_ID")); // Get the start time in et PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); - double et = iTime((string)inst["StartTime"]).Et(); + double et = iTime((QString)inst["StartTime"]).Et(); // divide exposure duration keyword value by 1000 to convert to seconds double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0; @@ -98,11 +98,11 @@ namespace Isis { // Setup focal plane map CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); - focalMap->SetDetectorOrigin(Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_BORESIGHT_SAMPLE"), - Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_BORESIGHT_LINE")); + focalMap->SetDetectorOrigin(Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"), + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE")); // Setup distortion map - double k1 = Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_K1"); + double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1"); new RadialDistortionMap(this, k1); // Setup the ground and sky map diff --git a/isis/src/cassini/objs/IssNACamera/unitTest.cpp b/isis/src/cassini/objs/IssNACamera/unitTest.cpp index a5ce28544c..a7bb64867d 100644 --- a/isis/src/cassini/objs/IssNACamera/unitTest.cpp +++ b/isis/src/cassini/objs/IssNACamera/unitTest.cpp @@ -64,9 +64,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/cassini/objs/IssWACamera/IssWACamera.cpp b/isis/src/cassini/objs/IssWACamera/IssWACamera.cpp index e8eff2cf90..9906505adb 100644 --- a/isis/src/cassini/objs/IssWACamera/IssWACamera.cpp +++ b/isis/src/cassini/objs/IssWACamera/IssWACamera.cpp @@ -45,19 +45,19 @@ namespace Isis { NaifStatus::CheckErrors(); PvlGroup bandBin = lab.FindGroup("BandBin", Pvl::Traverse); // Get the camera characteristics - IString key = string("INS" + (IString)(int)naifIkCode() + "_") + (string)bandBin["FilterName"] + "_FOCAL_LENGTH"; - key = key.Convert("/", '_'); + QString key = "INS" + toString(naifIkCode()) + "_" + bandBin["FilterName"][0] + "_FOCAL_LENGTH"; + key = key.replace("/", "_"); double focalLength = Spice::getDouble(key); SetFocalLength(focalLength); SetPixelPitch(); - instrumentRotation()->SetFrame(Spice::getInteger("INS_" + (IString)(int)naifIkCode() + "_FRAME_ID")); + instrumentRotation()->SetFrame(Spice::getInteger("INS_" + toString(naifIkCode()) + "_FRAME_ID")); // Get the start time in et PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); - double et = iTime((string)inst["StartTime"]).Et(); + double et = iTime((QString)inst["StartTime"]).Et(); // divide exposure duration keyword value by 1000 to convert to seconds double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0; @@ -75,11 +75,11 @@ namespace Isis { // Setup focal plane map CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); - focalMap->SetDetectorOrigin(Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_BORESIGHT_SAMPLE"), - Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_BORESIGHT_LINE")); + focalMap->SetDetectorOrigin(Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"), + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE")); // Setup distortion map - double k1 = Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_K1"); + double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1"); new RadialDistortionMap(this, k1); // Setup the ground and sky map diff --git a/isis/src/cassini/objs/IssWACamera/IssWACamera.h b/isis/src/cassini/objs/IssWACamera/IssWACamera.h index 4ef97a022a..bf04551d73 100644 --- a/isis/src/cassini/objs/IssWACamera/IssWACamera.h +++ b/isis/src/cassini/objs/IssWACamera/IssWACamera.h @@ -43,7 +43,7 @@ namespace Isis { * @history 2007-07-10 Steven Koechle - Removed hardcoding of NAIF * Instrument number * @history 2007-07-11 Steven Koechle - casted NaifIkCode to int before - * IString to fix problem on Linux 32bit + * QString to fix problem on Linux 32bit * @history 2008-08-08 Steven Lambright Now using the new LoadCache(...) * method instead of CreateCache(...). * @history 2009-01-22 Kris Becker Added new frame rotation to the CK frame diff --git a/isis/src/cassini/objs/IssWACamera/unitTest.cpp b/isis/src/cassini/objs/IssWACamera/unitTest.cpp index b4548e73b3..b486409583 100644 --- a/isis/src/cassini/objs/IssWACamera/unitTest.cpp +++ b/isis/src/cassini/objs/IssWACamera/unitTest.cpp @@ -62,9 +62,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/cassini/objs/VimsCamera/VimsCamera.cpp b/isis/src/cassini/objs/VimsCamera/VimsCamera.cpp index a5ef8e759d..374d653e6e 100644 --- a/isis/src/cassini/objs/VimsCamera/VimsCamera.cpp +++ b/isis/src/cassini/objs/VimsCamera/VimsCamera.cpp @@ -58,7 +58,7 @@ namespace Isis { NaifStatus::CheckErrors(); PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); - string channel = (string) inst ["Channel"]; + QString channel = (QString) inst ["Channel"]; // Set Frame mounting @@ -66,7 +66,7 @@ namespace Isis { //LoadFrameMounting ("CASSINI_SC_COORD","CASSINI_VIMS_V"); SetFocalLength(143.0); - if(IString((string)inst["SamplingMode"]).UpCase() == "NORMAL") { + if(QString((QString)inst["SamplingMode"]).toUpper() == "NORMAL") { SetPixelPitch(3 * .024); } else { @@ -81,26 +81,28 @@ namespace Isis { } // Get the start time in et - IString stime = (string) inst ["NativeStartTime"]; - string intTime = stime.Token("."); + QString stime = inst ["NativeStartTime"][0]; + QString intTime = stime.split(".").first(); + stime = stime.split(".").last(); double etStart = getClockTime(intTime).Et(); // Add 2 seconds to either side of time range because the time are for IR // channel, the VIS may actually start integrating before NATIVE_START_TIME. // This insures the cache is large enough. - etStart += stime.ToDouble() / 15959.0 - 2.; + etStart += toDouble(stime) / 15959.0 - 2.; // Get the end time in et - IString etime = (string) inst ["NativeStopTime"]; - intTime = etime.Token("."); + QString etime = (QString) inst ["NativeStopTime"]; + intTime = etime.split(".").first(); + etime = etime.split(".").last(); double etStop = getClockTime(intTime).Et(); // Add 2 seconds to either side of time range because the time are for IR // channel, the VIS may actually start integrating before NATIVE_START_TIME. // This insures the cache is large enough. - etStop += stime.ToDouble() / 15959.0 + 2.; + etStop += toDouble(stime) / 15959.0 + 2.; // Setup detector map new CameraDetectorMap(this); diff --git a/isis/src/cassini/objs/VimsCamera/VimsGroundMap.cpp b/isis/src/cassini/objs/VimsCamera/VimsGroundMap.cpp index 68c15b35a0..b7b7fc89ed 100644 --- a/isis/src/cassini/objs/VimsCamera/VimsGroundMap.cpp +++ b/isis/src/cassini/objs/VimsCamera/VimsGroundMap.cpp @@ -137,24 +137,25 @@ namespace Isis { PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); // Vis or IR - p_channel = (string) inst ["Channel"]; + p_channel = (QString) inst ["Channel"]; // Get the start time in et - IString stime = (string) inst ["NativeStartTime"]; - string intTime = stime.Token("."); + QString stime = (QString) inst ["NativeStartTime"]; + QString intTime = stime.split(".").first(); + stime = stime.split(".").last(); p_etStart = p_camera->getClockTime(intTime).Et(); - p_etStart += stime.ToDouble() / 15959.0; + p_etStart += toDouble(stime) / 15959.0; //---------------------------------------------------------------------- // Because of inaccuracy with the 15 Mhz clock, the IR exposure and // interline delay need to be adjusted. //---------------------------------------------------------------------- p_irExp = (double) inst ["ExposureDuration"] / 1000.; - p_visExp = (double) inst ["ExposureDuration"][1] / 1000.; + p_visExp = toDouble(inst ["ExposureDuration"][1]) / 1000.; p_interlineDelay = (double) inst ["InterlineDelayDuration"] / 1000.; // Get summation mode - string sampMode = IString((string)inst ["SamplingMode"]).UpCase(); + QString sampMode = QString((QString)inst ["SamplingMode"]).toUpper(); // Get sample/line offsets int sampOffset = inst ["XOffset"]; diff --git a/isis/src/cassini/objs/VimsCamera/VimsGroundMap.h b/isis/src/cassini/objs/VimsCamera/VimsGroundMap.h index 263a1a77ca..fe7540ff30 100644 --- a/isis/src/cassini/objs/VimsCamera/VimsGroundMap.h +++ b/isis/src/cassini/objs/VimsCamera/VimsGroundMap.h @@ -107,7 +107,7 @@ namespace Isis { double p_xBore; //!< X boresight double p_yBore; //!< Y boresight - std::string p_channel; /**< Channel keyword value from the instrument group of the labels. + QString p_channel; /**< Channel keyword value from the instrument group of the labels. Possible values are IR or VIS */ double p_visExp; //!< VIS exposure duration, divided by 1000 double p_irExp; //!< IR exposure duration, divided by 1000 diff --git a/isis/src/cassini/objs/VimsCamera/VimsSkyMap.cpp b/isis/src/cassini/objs/VimsCamera/VimsSkyMap.cpp index 6f5d4c1273..9195cbf2ca 100644 --- a/isis/src/cassini/objs/VimsCamera/VimsSkyMap.cpp +++ b/isis/src/cassini/objs/VimsCamera/VimsSkyMap.cpp @@ -69,25 +69,26 @@ namespace Isis { PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); // Vis or IR - p_channel = (string) inst ["Channel"]; + p_channel = (QString) inst ["Channel"]; // Get the start time in et - IString stime = (string) inst ["NativeStartTime"]; - string intTime = stime.Token("."); + QString stime = (QString) inst ["NativeStartTime"]; + QString intTime = stime.split(".").first(); + stime = stime.split(".").last(); p_etStart = p_camera->getClockTime(intTime).Et(); - p_etStart += stime.ToDouble() / 15959.0; + p_etStart += toDouble(stime) / 15959.0; //---------------------------------------------------------------------- // Because of inaccuracy with the 15 Mhz clock, the IR exposure and // interline delay need to be adjusted. //---------------------------------------------------------------------- p_irExp = (double) inst ["ExposureDuration"] / 1000.; - p_visExp = (double) inst ["ExposureDuration"][1] / 1000.; + p_visExp = toDouble(inst ["ExposureDuration"][1]) / 1000.; p_interlineDelay = (double) inst ["InterlineDelayDuration"] / 1000.; // Get summation mode - string sampMode = IString((string)inst ["SamplingMode"]).UpCase(); + QString sampMode = QString((QString)inst ["SamplingMode"]).toUpper(); // Get sample/line offsets int sampOffset = inst ["XOffset"]; @@ -107,7 +108,7 @@ namespace Isis { //tack on _HR or _NY for other summing modes. // Get the directory for the unit vector files. PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); - IString vecDir = (string) dataDir["Cassini"] + "/unitVectors/"; + QString vecDir = (QString) dataDir["Cassini"] + "/unitVectors/"; FileName vectorFile; if(p_channel == "VIS") { @@ -157,8 +158,8 @@ namespace Isis { } ifstream fin; - string vectorFileName(vectorFile.expanded()); - fin.open(vectorFileName.c_str(), ios::in | ios::binary); + QString vectorFileName(vectorFile.expanded()); + fin.open(vectorFileName.toAscii().data(), ios::in | ios::binary); if(!fin.is_open()) { string msg = "Can't open unit vector file"; throw IException(IException::Io, msg, _FILEINFO_); diff --git a/isis/src/cassini/objs/VimsCamera/VimsSkyMap.h b/isis/src/cassini/objs/VimsCamera/VimsSkyMap.h index f2e6c76161..b62fa41f61 100644 --- a/isis/src/cassini/objs/VimsCamera/VimsSkyMap.h +++ b/isis/src/cassini/objs/VimsCamera/VimsSkyMap.h @@ -76,7 +76,7 @@ namespace Isis { double p_interlineDelay; /**< InterlineDelayDuration keyword value from the instrument group of the labels, divided by 1000 */ - std::string p_channel; /**< Channel keyword value from the instrument group of the labels. + QString p_channel; /**< Channel keyword value from the instrument group of the labels. Possible values are IR or VIS */ double p_visExp; //!< VIS exposure duration, divided by 1000 double p_irExp; //!< IR exposure duration, divided by 1000 diff --git a/isis/src/clementine/apps/clem2isis/clem2isis.cpp b/isis/src/clementine/apps/clem2isis/clem2isis.cpp index b2294c6ab9..e2b71c4026 100644 --- a/isis/src/clementine/apps/clem2isis/clem2isis.cpp +++ b/isis/src/clementine/apps/clem2isis/clem2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "pds.h" #include "ProcessByLine.h" @@ -33,26 +33,24 @@ void IsisMain() { try { Pvl lab(in.expanded()); projected = lab.HasObject("IMAGE_MAP_PROJECTION"); - IString id; - id = (string)lab["DATA_SET_ID"]; - id.ConvertWhiteSpace(); - id.Compress(); - id.Trim(" "); - if(id.find("CLEM") == string::npos) { - string msg = "Invalid DATA_SET_ID [" + id + "]"; + QString id; + id = (QString)lab["DATA_SET_ID"]; + id = id.simplified().trimmed(); + if(!id.contains("CLEM")) { + QString msg = "Invalid DATA_SET_ID [" + id + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } } catch(IException &e) { - string msg = "Input file [" + in.expanded() + - "] does not appear to be " + - "in Clementine EDR format"; + QString msg = "Input file [" + in.expanded() + + "] does not appear to be " + + "in Clementine EDR format"; throw IException(IException::Unknown, msg, _FILEINFO_); } //Checks if in file is rdr if(projected) { - string msg = "[" + in.name() + "] appears to be an rdr file."; + QString msg = "[" + in.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -60,8 +58,8 @@ void IsisMain() { //Decompress the file long int lines = 0; long int samps = 0; - IString filename = in.expanded(); - pdsi = PDSR((char *)filename.c_str(), &lines, &samps); + QString filename = in.expanded(); + pdsi = PDSR(filename.toAscii().data(), &lines, &samps); ProcessByLine p; CubeAttributeOutput cubeAtt("+unsignedByte+1.0:254.0"); @@ -102,7 +100,7 @@ void TranslateLabels(FileName in, Cube *ocube) { PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); // Transfer the instrument group to the output cube - IString transDir = (string) dataDir["clementine1"]; + QString transDir = (QString) dataDir["clementine1"]; FileName transFile(transDir + "/translations/clementine.trn"); Pvl pdsLab(in.expanded()); @@ -116,47 +114,47 @@ void TranslateLabels(FileName in, Cube *ocube) { PvlGroup inst = outputLabel->FindGroup("Instrument", Pvl::Traverse); PvlKeyword &startTime = inst.FindKeyword("StartTime"); - startTime.SetValue(startTime[0].substr(0, startTime[0].size() - 1)); + startTime.SetValue(startTime[0].mid(0, startTime[0].size() - 1)); // Old PDS labels used keyword INSTRUMENT_COMPRESSION_TYPE & PDS Labels now use ENCODING_TYPE if(pdsLab.FindObject("Image").HasKeyword("InstrumentCompressionType")) { - inst += PvlKeyword("EncodingFormat", (string) pdsLab.FindObject("Image")["InstrumentCompressionType"]); + inst += PvlKeyword("EncodingFormat", (QString) pdsLab.FindObject("Image")["InstrumentCompressionType"]); } else { - inst += PvlKeyword("EncodingFormat", (string) pdsLab.FindObject("Image")["EncodingType"]); + inst += PvlKeyword("EncodingFormat", (QString) pdsLab.FindObject("Image")["EncodingType"]); } - if(((string)inst["InstrumentId"]) == "HIRES") { - inst += PvlKeyword("MCPGainModeID", (string)pdsLab["MCP_Gain_Mode_ID"], ""); + if(((QString)inst["InstrumentId"]) == "HIRES") { + inst += PvlKeyword("MCPGainModeID", (QString)pdsLab["MCP_Gain_Mode_ID"], ""); } ocube->putGroup(inst); PvlGroup bBin = outputLabel->FindGroup("BandBin", Pvl::Traverse); - std::string filter = pdsLab["FilterName"]; + QString filter = pdsLab["FilterName"]; if(filter != "F") { //Band Bin group double center = pdsLab["CenterFilterWavelength"]; center /= 1000.0; - bBin.FindKeyword("Center").SetValue(center, "micrometers"); + bBin.FindKeyword("Center").SetValue(toString(center), "micrometers"); } double width = pdsLab["Bandwidth"]; width /= 1000.0; - bBin.FindKeyword("Width").SetValue(width, "micrometers"); + bBin.FindKeyword("Width").SetValue(toString(width), "micrometers"); ocube->putGroup(bBin); //Kernel group PvlGroup kern("Kernels"); - if(((string)inst["InstrumentId"]) == "HIRES") { + if(((QString)inst["InstrumentId"]) == "HIRES") { kern += PvlKeyword("NaifFrameCode", "-40001"); } - if(((string)inst["InstrumentId"]) == "UVVIS") { + if(((QString)inst["InstrumentId"]) == "UVVIS") { kern += PvlKeyword("NaifFrameCode", "-40002"); } - if(((string)inst["InstrumentId"]) == "NIR") { + if(((QString)inst["InstrumentId"]) == "NIR") { kern += PvlKeyword("NaifFrameCode", "-40003"); } - if(((string)inst["InstrumentId"]) == "LWIR") { + if(((QString)inst["InstrumentId"]) == "LWIR") { kern += PvlKeyword("NaifFrameCode", "-40004"); } ocube->putGroup(kern); diff --git a/isis/src/clementine/apps/clemhirescal/clemhirescal.cpp b/isis/src/clementine/apps/clemhirescal/clemhirescal.cpp index 89ffdbbe42..2d65607247 100644 --- a/isis/src/clementine/apps/clemhirescal/clemhirescal.cpp +++ b/isis/src/clementine/apps/clemhirescal/clemhirescal.cpp @@ -25,14 +25,14 @@ void IsisMain() { // Check for filter type of A-D Pvl *label = input->getLabel(); - IString wave = (string)label->FindGroup("BandBin", Pvl::Traverse)["FilterName"]; + QString wave = (QString)label->FindGroup("BandBin", Pvl::Traverse)["FilterName"]; if((wave != "A") && (wave != "B") && (wave != "C") && (wave != "D")) { - string message = "Invalid FilterName [" + wave + "], can only handle A-D filters"; + QString message = "Invalid FilterName [" + wave + "], can only handle A-D filters"; throw IException(IException::Unknown, message, _FILEINFO_); } // Determine and load calibration flat field file - wave.DownCase(); - IString flatFile("$Clementine1/calibration/hires/lh" + + wave = wave.toLower(); + QString flatFile("$Clementine1/calibration/hires/lh" + wave + "_flat.cub"); CubeAttributeInput cubeAtt; p.SetInputCube(flatFile, cubeAtt); @@ -40,7 +40,7 @@ void IsisMain() { // Check the offset mode for validity int index = label->FindGroup("Instrument", Pvl::Traverse)["OffsetModeID"]; if(index < 0 || index > 5) { - string message = "Invalid OffsetModeID, can only handle offests 0-5"; + QString message = "Invalid OffsetModeID, can only handle offests 0-5"; throw IException(IException::Unknown, message, _FILEINFO_); } @@ -53,7 +53,7 @@ void IsisMain() { // Clementine HIRES camera: Robinson, Malart, White, page 17 UserInterface &ui = Application::GetUserInterface(); if(ui.GetString("KFROM").compare("COMPUTED") == 0) { - wave.UpCase(); + wave = wave.toUpper(); int MCP = label->FindGroup("Instrument", Pvl::Traverse)["MCPGainModeID"]; // Two possible MCP gains for filter A if(wave == "A") { @@ -64,7 +64,7 @@ void IsisMain() { abscoef = 0.00089; } else { - string message = "Image is not one of supported MCP Gain Mode IDs, enter your own K value"; + QString message = "Image is not one of supported MCP Gain Mode IDs, enter your own K value"; throw IException(IException::Unknown, message, _FILEINFO_); } } @@ -80,13 +80,13 @@ void IsisMain() { abscoef = 0.00097; } else { - string message = "Image is not one of supported MCP Gain Mode IDs, enter your own K value"; + QString message = "Image is not one of supported MCP Gain Mode IDs, enter your own K value"; throw IException(IException::User, message, _FILEINFO_); } } // Other filters not supported for preset K value else { - string message = "Image is of filter [" + wave + "], not supported type A or D, enter your own K value"; + QString message = "Image is of filter [" + wave + "], not supported type A or D, enter your own K value"; throw IException(IException::User, message, _FILEINFO_); } } diff --git a/isis/src/clementine/apps/clemnircal/clemnircal.cpp b/isis/src/clementine/apps/clemnircal/clemnircal.cpp index 57c90e5446..fda90ff903 100644 --- a/isis/src/clementine/apps/clemnircal/clemnircal.cpp +++ b/isis/src/clementine/apps/clemnircal/clemnircal.cpp @@ -47,17 +47,17 @@ void IsisMain() { Cube *ocube = p.SetOutputCube("TO"); Cube *ffcube, *ofcube, *afcube, *dccube, *biascube, *bpcube; - IString filter = (string)(icube->getGroup("BandBin"))["FilterName"]; - filter = filter.DownCase(); - IString productID = (string)(icube->getGroup("Archive"))["ProductID"]; - IString orbit = productID.substr(productID.find('.') + 1, productID.length() - 1); + QString filter = (QString)(icube->getGroup("BandBin"))["FilterName"]; + filter = filter.toLower(); + QString productID = (QString)(icube->getGroup("Archive"))["ProductID"]; + QString orbit = productID.mid(productID.indexOf('.') + 1, productID.length() - 1); // If hemisphere code greater than 'I' set to 'n' else set to 's' - char hemisphereCode = (productID[productID.find('.')-1] > 'I') ? 'n' : 's'; - IString compressionType = (string)(icube->getGroup("Instrument"))["EncodingFormat"]; + char hemisphereCode = (productID[productID.indexOf('.')-1] > 'I') ? 'n' : 's'; + QString compressionType = (QString)(icube->getGroup("Instrument"))["EncodingFormat"]; offsetModeID = (icube->getGroup("Instrument"))["OffsetModeID"]; int gainModeID = (icube->getGroup("Instrument"))["GainModeID"]; - IString gainModeIDStr = gainModeID; + QString gainModeIDStr = toString(gainModeID); double exposureDuration = (double)(icube->getGroup("Instrument"))["ExposureDuration"]; optimalExposureDuration = (exposureDuration * 0.984675) + 0.233398; cryocoolerDuration = (icube->getGroup("Instrument"))["CryocoolerDuration"]; @@ -66,7 +66,7 @@ void IsisMain() { ffcube = p.SetInputCube("FFFILE"); } else { - string fffileLoc = "$clementine1/calibration/nir/"; + QString fffileLoc = "$clementine1/calibration/nir/"; fffileLoc += "newnir_flat_" + filter + ".cub"; CubeAttributeInput cubeAtt; ffcube = p.SetInputCube(fffileLoc, cubeAtt); @@ -76,34 +76,35 @@ void IsisMain() { ofcube = p.SetInputCube("OFFILE"); } else { - string fffileLoc = "$clementine1/calibration/nir/nirorbitflats/"; + QString fffileLoc = "$clementine1/calibration/nir/nirorbitflats/"; fffileLoc += "nir_orbflat_" + orbit + "_" + filter + ".cub"; CubeAttributeInput cubeAtt; ofcube = p.SetInputCube(fffileLoc, cubeAtt); } - string afFileTableLoc = ""; + QString afFileTableLoc = ""; if(ui.WasEntered("AFFILE")) { afcube = p.SetInputCube("AFFILE"); } else { - string affileLoc; + QString affileLoc; afFileTableLoc = "$clementine1/calibration/nir/nir.addflats.dat"; TextFile aFFileTable(afFileTableLoc); int numLines = aFFileTable.LineCount(); for(int i = 0; i < numLines; i++) { - IString line; + QString line; aFFileTable.GetLine(line, true); - line = line.Compress(); - if(orbit.compare(line.Token(" ")) == 0 && - filter.compare(line.Token(" ")) == 0 && - gainModeID == (int)line.Token(" ") && - offsetModeID == (int)line.Token(" ") && - (int)exposureDuration == (int)line.Token(" ") && - hemisphereCode == line.Token(" ")[0]) { - line.Token(" "); // strip unused data - affileLoc = line.Token(" "); + line = line.simplified(); + QStringList tokens = line.split(" "); + if(tokens.count() > 6 && orbit == tokens.takeFirst() && + filter == tokens.takeFirst() && + gainModeID == toInt(tokens.takeFirst()) && + offsetModeID == toInt(tokens.takeFirst()) && + (int)exposureDuration == toInt(tokens.takeFirst()) && + QString(hemisphereCode) == tokens.takeFirst()) { + tokens.takeFirst(); + affileLoc = tokens.takeFirst(); break; } } @@ -112,15 +113,15 @@ void IsisMain() { affileLoc = "zeros.cub"; } - IString gainFactorDef = "$clementine1/calibration/nir/"; + QString gainFactorDef = "$clementine1/calibration/nir/"; gainFactorDef += "clemnircal.def"; Pvl gainFactorData(gainFactorDef); - IString group = "GainModeID"; - group += (IString)gainModeID; + QString group = "GainModeID"; + group += toString(gainModeID); if(!gainFactorData.HasGroup(group)) { - IString err = "The Gain Factor for Gain Mode ID ["; - err += gainModeID; + QString err = "The Gain Factor for Gain Mode ID ["; + err += toString(gainModeID); err += "] could not be found in clemnircal.def"; throw IException(IException::Programmer, err, _FILEINFO_); } @@ -128,8 +129,8 @@ void IsisMain() { gainFactor = (gainFactorData.FindGroup(group))["GAIN"]; if(abs(gainFactor) < DBL_EPSILON) { - IString err = "The Gain Factor for Gain Mode ID ["; - err += gainModeID; + QString err = "The Gain Factor for Gain Mode ID ["; + err += toString(gainModeID); err += "] can not be zero."; throw IException(IException::Programmer, err, _FILEINFO_); } @@ -143,7 +144,7 @@ void IsisMain() { dccube = p.SetInputCube("DCFILE"); } else { - string dcfileLoc = "$clementine1/calibration/nir/"; + QString dcfileLoc = "$clementine1/calibration/nir/"; if(compressionType.compare("CLEM-JPEG-0") == 0) { dcfileLoc += "dark_nir_cmp0.cub"; @@ -160,7 +161,7 @@ void IsisMain() { biascube = p.SetInputCube("BIASFILE"); } else { - string biasfileLoc = "$clementine1/calibration/nir/"; + QString biasfileLoc = "$clementine1/calibration/nir/"; if(compressionType.compare("CLEM-JPEG-0") == 0) { biasfileLoc += "bias_nir_cmp0.cub"; @@ -177,7 +178,7 @@ void IsisMain() { bpcube = p.SetInputCube("BPFILE"); } else { - string bpfileLoc = "$clementine1/calibration/nir/"; + QString bpfileLoc = "$clementine1/calibration/nir/"; if(compressionType.compare("CLEM-JPEG-0") == 0) { bpfileLoc += "badpix_nir_cmp0.v3.cub"; } @@ -190,12 +191,12 @@ void IsisMain() { } // We need thermal data - IString thermTbl = "$clementine1/calibration/nir/"; + QString thermTbl = "$clementine1/calibration/nir/"; thermTbl += "nir" + filter + ".therm.dat"; TextFile thermTable(thermTbl); int numLines = thermTable.LineCount(); - IString line; + QString line; for(int i = 0; i < numLines; i++) { thermTable.GetLine(line); @@ -203,25 +204,25 @@ void IsisMain() { // I'm adding a space to every line and using Compress() to remove any extras. Compress() is // necessary in order to ensure data integrity from line to line also. line = " " + line; - line = line.Compress(); - line.Token(" "); // There's an initial space that needs removed + line = line.simplified().trimmed(); + QStringList tokens = line.split(" "); - if((int)orbit == (int)line.Token(" ")) { // if orbits match, get data - cryonorm = (double)line.Token(" "); - numCoefficients = (int)line.Token(" "); + if(toInt(orbit) == toInt(tokens.takeFirst())) { // if orbits match, get data + cryonorm = toDouble(tokens.takeFirst()); + numCoefficients = toInt(tokens.takeFirst()); // Read in coefficients - thermBgCoefficients.push_back((double)line.Token(" ")); + thermBgCoefficients.push_back(toDouble(tokens.takeFirst())); for(int iCoeff = 0; iCoeff < numCoefficients; iCoeff ++) { - thermBgCoefficients.push_back((double)line.Token(" ")); + thermBgCoefficients.push_back(toDouble(tokens.takeFirst())); } break; } } if(numCoefficients == 0) { - IString err = "The orbit [" + orbit + "] could not be located in the thermal corrections table [" + thermTbl + "]."; + QString err = "The orbit [" + orbit + "] could not be located in the thermal corrections table [" + thermTbl + "]."; throw IException(IException::Unknown, err, _FILEINFO_); } @@ -241,15 +242,15 @@ void IsisMain() { calgrp += PvlKeyword("ThermalCorrectionTable", thermTbl); calgrp += PvlKeyword("AdditiveFileTable", afFileTableLoc); - calgrp += PvlKeyword("DigitalOffset", digitalOffset); - calgrp += PvlKeyword("GlobalBias", globalBias); - calgrp += PvlKeyword("GlobalDarkCoefficient", globalDarkCoefficient); - calgrp += PvlKeyword("V", vConstant); + calgrp += PvlKeyword("DigitalOffset", toString(digitalOffset)); + calgrp += PvlKeyword("GlobalBias", toString(globalBias)); + calgrp += PvlKeyword("GlobalDarkCoefficient", toString(globalDarkCoefficient)); + calgrp += PvlKeyword("V", toString(vConstant)); //Calculated in processing routine - calgrp += PvlKeyword("GainFactor", gainFactor); - calgrp += PvlKeyword("AbsoluteCoefficient", absoluteCoefficient); - calgrp += PvlKeyword("CryoNorm", cryonorm); - calgrp += PvlKeyword("OptimalExposureDuration", optimalExposureDuration); + calgrp += PvlKeyword("GainFactor", toString(gainFactor)); + calgrp += PvlKeyword("AbsoluteCoefficient", toString(absoluteCoefficient)); + calgrp += PvlKeyword("CryoNorm", toString(cryonorm)); + calgrp += PvlKeyword("OptimalExposureDuration", toString(optimalExposureDuration)); ocube->putGroup(calgrp); p.EndProcess(); diff --git a/isis/src/clementine/apps/clemuvviscal/clemuvviscal.cpp b/isis/src/clementine/apps/clemuvviscal/clemuvviscal.cpp index 188668524d..aa4809ad3f 100644 --- a/isis/src/clementine/apps/clemuvviscal/clemuvviscal.cpp +++ b/isis/src/clementine/apps/clemuvviscal/clemuvviscal.cpp @@ -52,14 +52,14 @@ void IsisMain() { dccube = p.SetInputCube("DCFILE"); } else { - string dcfileloc = "$clementine1/calibration/uvvis/"; + QString dcfileloc = "$clementine1/calibration/uvvis/"; dcfileloc += "dark_5_15_96.cub"; CubeAttributeInput cubeAtt; dccube = p.SetInputCube(dcfileloc, cubeAtt); } - IString filter = (string)(icube->getGroup("BandBin"))["FilterName"]; - filter = filter.DownCase(); + QString filter = (QString)(icube->getGroup("BandBin"))["FilterName"]; + filter = filter.toLower(); Cube *ffcube; if(ui.WasEntered("FFFILE")) { @@ -71,13 +71,13 @@ void IsisMain() { // check to see if cube is compressed or uncompressed if(compressRatio == 1.0) { - string fffileLoc = "$clementine1/calibration/uvvis/"; + QString fffileLoc = "$clementine1/calibration/uvvis/"; fffileLoc += "lu" + filter + "_uncomp_flat_long.cub"; CubeAttributeInput cubeAtt; ffcube = p.SetInputCube(fffileLoc, cubeAtt); } else { - string fffileLoc = "$clementine1/calibration/uvvis/"; + QString fffileLoc = "$clementine1/calibration/uvvis/"; fffileLoc += "lu" + filter + "_comp_flat_long.cub"; CubeAttributeInput cubeAtt; ffcube = p.SetInputCube(fffileLoc, cubeAtt); @@ -86,9 +86,9 @@ void IsisMain() { Cube *ocube = p.SetOutputCube("TO"); - avgFF = uvvisDef.FindGroup("Filter" + filter.UpCase())["AVGFF"]; - cr = uvvisDef.FindGroup("Filter" + filter.UpCase())["CO"]; - gain = uvvisDef.FindGroup(IString("GainModeID") + IString(icube->getGroup("Instrument")["GainModeID"][0]))["GAIN"]; + avgFF = uvvisDef.FindGroup("Filter" + filter.toUpper())["AVGFF"]; + cr = uvvisDef.FindGroup("Filter" + filter.toUpper())["CO"]; + gain = uvvisDef.FindGroup(QString("GainModeID") + QString(icube->getGroup("Instrument")["GainModeID"][0]))["GAIN"]; useDcconst = ui.WasEntered("DCCONST"); if(useDcconst) { @@ -102,7 +102,7 @@ void IsisMain() { exposureDuration = icube->getGroup("Instrument")["ExposureDuration"]; offsetModeID = icube->getGroup("Instrument")["OffsetModeID"]; - if(((string)icube->getGroup("Instrument")["FocalPlaneTemperature"]).compare("UNK") == 0) { + if(((QString)icube->getGroup("Instrument")["FocalPlaneTemperature"]).compare("UNK") == 0) { //if FocalPlaneTemp is unknown set it to zero focalPlaneTemp = 0.0; } @@ -123,12 +123,12 @@ void IsisMain() { if(ui.GetBoolean("TCOR") || abs(focalPlaneTemp) <= DBL_EPSILON) { // Temperature correction requires the use of the mission phase // (PRELAUNCH, EARTH, LUNAR) and the product ID. - string productID = (string)(icube->getGroup("Archive")["ProductID"]); - char missionPhase = ((string)((icube->getGroup("Archive"))["MissionPhase"])).at(0); - string n1substring(productID.substr(productID.find('.') + 1, productID.length() - 1)); - string n2substring(productID.substr(4, productID.find('.') - 1)); - int n1 = atoi(n1substring.c_str()); - int n2 = atoi(n2substring.c_str()); + QString productID = (QString)(icube->getGroup("Archive")["ProductID"]); + QChar missionPhase = ((QString)((icube->getGroup("Archive"))["MissionPhase"])).at(0); + QString n1subQString(productID.mid(productID.indexOf('.') + 1, productID.length() - 1)); + QString n2subQString(productID.mid(4, productID.indexOf('.') - 5)); + int n1 = toInt(n1subQString); + int n2 = toInt(n2subQString); int phase = 0; if(missionPhase == 'L') { @@ -167,25 +167,25 @@ void IsisMain() { calgrp += PvlKeyword("DarkCurrentFile", dccube->getFileName()); } else { - calgrp += PvlKeyword("DarkCurrentConstant", dcconst); + calgrp += PvlKeyword("DarkCurrentConstant", toString(dcconst)); } - calgrp += PvlKeyword("CorrectedFocalPlaneTemp", focalPlaneTemp); - calgrp += PvlKeyword("C1", avgFF); - calgrp += PvlKeyword("C2", C2); - calgrp += PvlKeyword("C3", C3); - calgrp += PvlKeyword("C4", C4); - calgrp += PvlKeyword("C5", C5); - calgrp += PvlKeyword("CR", cr); - calgrp += PvlKeyword("FrameTransferTimePerRow", cr); - calgrp += PvlKeyword("Gain", gain); - calgrp += PvlKeyword("CorrectedExposureDuration", correctedExposureDuration); - calgrp += PvlKeyword("ConvertToRadiance", conv); - - calgrp += PvlKeyword("ACO", ACO); - calgrp += PvlKeyword("BCO", BCO); - calgrp += PvlKeyword("CCO", CCO); - calgrp += PvlKeyword("DCO", DCO); + calgrp += PvlKeyword("CorrectedFocalPlaneTemp", toString(focalPlaneTemp)); + calgrp += PvlKeyword("C1", toString(avgFF)); + calgrp += PvlKeyword("C2", toString(C2)); + calgrp += PvlKeyword("C3", toString(C3)); + calgrp += PvlKeyword("C4", toString(C4)); + calgrp += PvlKeyword("C5", toString(C5)); + calgrp += PvlKeyword("CR", toString(cr)); + calgrp += PvlKeyword("FrameTransferTimePerRow", toString(cr)); + calgrp += PvlKeyword("Gain", toString(gain)); + calgrp += PvlKeyword("CorrectedExposureDuration", toString(correctedExposureDuration)); + calgrp += PvlKeyword("ConvertToRadiance", toString(conv)); + + calgrp += PvlKeyword("ACO", toString(ACO)); + calgrp += PvlKeyword("BCO", toString(BCO)); + calgrp += PvlKeyword("CCO", toString(CCO)); + calgrp += PvlKeyword("DCO", toString(DCO)); ocube->putGroup(calgrp); p.EndProcess(); @@ -304,7 +304,7 @@ void UvVisCal(std::vector< Isis::Buffer * > &in, std::vector< Isis::Buffer * > & * in a loss in precision. We believe this makes the lookup table inaccurate. */ void FixTemp(int imgID) { - string table = "$clementine1/calibration/uvvis/uvvisTemperature.tbl"; + QString table = "$clementine1/calibration/uvvis/uvvisTemperature.tbl"; Table t("FocalPlaneTemperatures", table); float currID = t[0]["ImageID"]; int currIndex = 0; diff --git a/isis/src/clementine/objs/HiresCamera/HiresCamera.cpp b/isis/src/clementine/objs/HiresCamera/HiresCamera.cpp index b4e54bb658..367f72d427 100644 --- a/isis/src/clementine/objs/HiresCamera/HiresCamera.cpp +++ b/isis/src/clementine/objs/HiresCamera/HiresCamera.cpp @@ -47,8 +47,8 @@ namespace Isis { HiresCamera::HiresCamera(Pvl &lab) : FramingCamera(lab) { NaifStatus::CheckErrors(); // Get the camera characteristics - IString filter = (string)(lab.FindGroup("BandBin", Pvl::Traverse))["FilterName"]; - filter = filter.UpCase(); + QString filter = (QString)(lab.FindGroup("BandBin", Pvl::Traverse))["FilterName"]; + filter = filter.toUpper(); SetFocalLength(); SetPixelPitch(); @@ -57,7 +57,7 @@ namespace Isis { PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); // set variables startTime and exposureDuration - double time = iTime((string)inst["StartTime"]).Et(); + double time = iTime((QString)inst["StartTime"]).Et(); // divide exposure duration keyword value by 1000 to convert to seconds double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0; @@ -80,9 +80,9 @@ namespace Isis { CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); focalMap->SetDetectorOrigin( - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"), - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE")); // Setup distortion map diff --git a/isis/src/clementine/objs/HiresCamera/unitTest.cpp b/isis/src/clementine/objs/HiresCamera/unitTest.cpp index cad200864a..176fd9e5f5 100644 --- a/isis/src/clementine/objs/HiresCamera/unitTest.cpp +++ b/isis/src/clementine/objs/HiresCamera/unitTest.cpp @@ -62,9 +62,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/clementine/objs/LwirCamera/LwirCamera.cpp b/isis/src/clementine/objs/LwirCamera/LwirCamera.cpp index a0ab57f120..8acf2a35a7 100644 --- a/isis/src/clementine/objs/LwirCamera/LwirCamera.cpp +++ b/isis/src/clementine/objs/LwirCamera/LwirCamera.cpp @@ -49,8 +49,8 @@ namespace Isis { NaifStatus::CheckErrors(); // Get the camera characteristics - IString filter = (string)(lab.FindGroup("BandBin", Pvl::Traverse))["FilterName"]; - filter = filter.UpCase(); + QString filter = (QString)(lab.FindGroup("BandBin", Pvl::Traverse))["FilterName"]; + filter = filter.toUpper(); SetFocalLength(); SetPixelPitch(); @@ -59,7 +59,7 @@ namespace Isis { PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); // set variables startTime and exposureDuration - double time = iTime((string)inst["StartTime"]).Et(); + double time = iTime((QString)inst["StartTime"]).Et(); // divide exposure duration keyword value by 1000 to convert to seconds double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0; @@ -82,9 +82,9 @@ namespace Isis { CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); focalMap->SetDetectorOrigin( - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"), - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE")); // Setup distortion map diff --git a/isis/src/clementine/objs/LwirCamera/unitTest.cpp b/isis/src/clementine/objs/LwirCamera/unitTest.cpp index bfc601c313..099f6d7ebe 100644 --- a/isis/src/clementine/objs/LwirCamera/unitTest.cpp +++ b/isis/src/clementine/objs/LwirCamera/unitTest.cpp @@ -62,9 +62,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/clementine/objs/NirCamera/NirCamera.cpp b/isis/src/clementine/objs/NirCamera/NirCamera.cpp index bc84bceea2..4a15a511a3 100644 --- a/isis/src/clementine/objs/NirCamera/NirCamera.cpp +++ b/isis/src/clementine/objs/NirCamera/NirCamera.cpp @@ -46,8 +46,8 @@ namespace Isis { NirCamera::NirCamera(Pvl &lab) : FramingCamera(lab) { NaifStatus::CheckErrors(); // Get the camera characteristics - IString filter = (string)(lab.FindGroup("BandBin", Pvl::Traverse))["FilterName"]; - filter = filter.UpCase(); + QString filter = (QString)(lab.FindGroup("BandBin", Pvl::Traverse))["FilterName"]; + filter = filter.toUpper(); if(filter.compare("A") == 0) { SetFocalLength(2548.2642 * 0.038); @@ -74,7 +74,7 @@ namespace Isis { PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); // set variables startTime and exposureDuration - double et = iTime((string)inst["StartTime"]).Et(); + double et = iTime((QString)inst["StartTime"]).Et(); // divide exposure duration keyword value by 1000 to convert to seconds double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0; @@ -97,9 +97,9 @@ namespace Isis { CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); focalMap->SetDetectorOrigin( - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"), - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE")); // Setup distortion map diff --git a/isis/src/clementine/objs/NirCamera/unitTest.cpp b/isis/src/clementine/objs/NirCamera/unitTest.cpp index c10d80a5ce..1c1d5857eb 100644 --- a/isis/src/clementine/objs/NirCamera/unitTest.cpp +++ b/isis/src/clementine/objs/NirCamera/unitTest.cpp @@ -62,9 +62,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/clementine/objs/UvvisCamera/UvvisCamera.cpp b/isis/src/clementine/objs/UvvisCamera/UvvisCamera.cpp index f1f827f8bb..4162d2ea84 100644 --- a/isis/src/clementine/objs/UvvisCamera/UvvisCamera.cpp +++ b/isis/src/clementine/objs/UvvisCamera/UvvisCamera.cpp @@ -51,7 +51,7 @@ namespace Isis { PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); // set variables startTime and exposureDuration - double time = iTime((string)inst["StartTime"]).Et(); + double time = iTime((QString)inst["StartTime"]).Et(); // divide exposure duration keyword value by 1000 to convert to seconds double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0; @@ -66,9 +66,9 @@ namespace Isis { CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); focalMap->SetDetectorOrigin( - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"), - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE")); // Setup distortion map diff --git a/isis/src/clementine/objs/UvvisCamera/UvvisCamera.h b/isis/src/clementine/objs/UvvisCamera/UvvisCamera.h index b8ea524ecf..7605a373d4 100644 --- a/isis/src/clementine/objs/UvvisCamera/UvvisCamera.h +++ b/isis/src/clementine/objs/UvvisCamera/UvvisCamera.h @@ -40,7 +40,7 @@ namespace Isis { * * @internal * @history 2007-01-11 Tracie Sucharski - Original version. - * @history 2007-01-30 Elizabeth Ribelin - Renamed String to IString and + * @history 2007-01-30 Elizabeth Ribelin - Renamed String to QString and * Time to iTime. * @history 2007-07-10 Steven Lambright - Added unitTest. Read boresight * from addendum. Added time to 1/2 exposure diff --git a/isis/src/clementine/objs/UvvisCamera/unitTest.cpp b/isis/src/clementine/objs/UvvisCamera/unitTest.cpp index bd254a1be6..f94e4d7455 100644 --- a/isis/src/clementine/objs/UvvisCamera/unitTest.cpp +++ b/isis/src/clementine/objs/UvvisCamera/unitTest.cpp @@ -65,9 +65,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/control/apps/autoseed/autoseed.cpp b/isis/src/control/apps/autoseed/autoseed.cpp index 6ac0aa892a..62a05ad258 100644 --- a/isis/src/control/apps/autoseed/autoseed.cpp +++ b/isis/src/control/apps/autoseed/autoseed.cpp @@ -122,7 +122,7 @@ void IsisMain() { // Get seed domain for unit conversion, no keyword == XY SeedDomain seedDomain = XY; if(seedDef.HasKeyword("SeedDomain", Pvl::Traverse)) { - IString domain = (std::string) seedDef.FindKeyword("SeedDomain", Pvl::Traverse); + IString domain = (QString) seedDef.FindKeyword("SeedDomain", Pvl::Traverse); if(unusedDefKeywords.HasKeyword("SeedDomain")) unusedDefKeywords.DeleteKeyword("SeedDomain"); @@ -144,18 +144,18 @@ void IsisMain() { // This is used inside the seeding algorithms. // Note: Should this be an option to include this in the program? PvlGroup inst = cubeLab.FindGroup("Instrument", Pvl::Traverse); - string target = inst["TargetName"]; + QString target = inst["TargetName"]; PvlGroup radii = Projection::TargetRadii(target); Isis::Pvl maplab; maplab.AddGroup(Isis::PvlGroup("Mapping")); Isis::PvlGroup &mapGroup = maplab.FindGroup("Mapping"); - mapGroup += Isis::PvlKeyword("EquatorialRadius", (string)radii["EquatorialRadius"]); - mapGroup += Isis::PvlKeyword("PolarRadius", (string)radii["PolarRadius"]); + mapGroup += Isis::PvlKeyword("EquatorialRadius", (QString)radii["EquatorialRadius"]); + mapGroup += Isis::PvlKeyword("PolarRadius", (QString)radii["PolarRadius"]); mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric"); mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast"); - mapGroup += Isis::PvlKeyword("LongitudeDomain", 360); - mapGroup += Isis::PvlKeyword("CenterLatitude", 0); - mapGroup += Isis::PvlKeyword("CenterLongitude", 0); + mapGroup += Isis::PvlKeyword("LongitudeDomain", toString(360)); + mapGroup += Isis::PvlKeyword("CenterLatitude", toString(0)); + mapGroup += Isis::PvlKeyword("CenterLongitude", toString(0)); mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal"); //PolygonSeeder *seeder = PolygonSeederFactory::Create(seedDef); @@ -190,11 +190,11 @@ void IsisMain() { int stats_noOverlap = 0; int stats_tolerance = 0; - map gMaps; + map gMaps; for(int sn = 0; sn < serialNumbers.Size(); ++sn) { // Create the UGM for the cube associated with this SN Pvl lab = Pvl(serialNumbers.FileName(sn)); - gMaps.insert(std::pair + gMaps.insert(std::pair (serialNumbers.SerialNumber(sn), new UniversalGroundMap(lab))); } @@ -220,7 +220,7 @@ void IsisMain() { for(int i = 0 ; i < precnet.GetNumPoints(); i ++) { ControlPoint *cp = precnet.GetPoint(i); ControlMeasure *cm = cp->GetRefMeasure(); - IString c = serialNumbers.FileName(cm->GetCubeSerialNumber()); + QString c = serialNumbers.FileName(cm->GetCubeSerialNumber()); Pvl cubepvl(c); Camera *cam = CameraFactory::Create(cubepvl); cam->SetImage(cm->GetSample(), cm->GetLine()); @@ -350,7 +350,7 @@ void IsisMain() { for(unsigned int point = 0; point < seed.size(); ++point) { ControlPoint *controlpt = new ControlPoint(); - controlpt->SetId(QString::fromStdString(pointId.Next())); + controlpt->SetId(pointId.Next()); controlpt->SetType(ControlPoint::Free); // Create a measurment at this point for each image in the overlap area @@ -361,7 +361,7 @@ void IsisMain() { UniversalGroundMap *gmap = gMaps[(*overlaps[ov])[sn]]; if(!gmap) { - std::string msg = "Unable to create a Universal Ground for Serial Number ["; + QString msg = "Unable to create a Universal Ground for Serial Number ["; msg += (*overlaps[ov])[sn] + "] The associated image is more than "; msg += "likely missing from your FROMLIST."; throw IException(IException::User, msg, _FILEINFO_); @@ -392,7 +392,7 @@ void IsisMain() { // Check the DNs with the cube, Note: this is costly to do if(hasDNRestriction) { Cube cube; - string c = serialNumbers.FileName((*overlaps[ov])[sn]); + QString c = serialNumbers.FileName((*overlaps[ov])[sn]); cube.open(c); Isis::Brick brick(1, 1, 1, cube.getPixelType()); brick.SetBasePosition((int)gmap->Camera()->Sample(), (int)gmap->Camera()->Line(), (int)gmap->Camera()->Band()); @@ -455,16 +455,16 @@ void IsisMain() { //Log the ERRORS file if(ui.WasEntered("ERRORS") && errorNum > 0) { - string errorname = ui.GetFileName("ERRORS"); + QString errorname = ui.GetFileName("ERRORS"); std::ofstream errorsfile; - errorsfile.open(errorname.c_str()); + errorsfile.open(errorname.toAscii().data()); errorsfile << errors.str(); errorsfile.close(); } // Make sure the control network is not empty if(cnet.GetNumPoints() == 0) { - string msg = "The ouput control network is empty. This is likely due"; + QString msg = "The ouput control network is empty. This is likely due"; msg += " to the input cubes failing to overlap."; throw IException(IException::User, msg, _FILEINFO_); } @@ -474,8 +474,8 @@ void IsisMain() { // create SeedDef group and add to print.prt PvlGroup pluginInfo = seeder->PluginParameters("SeedDefinition"); - pluginInfo.AddKeyword(PvlKeyword("MaxIncidence", maxIncidence)); - pluginInfo.AddKeyword(PvlKeyword("MaxEmission", maxEmission)); + pluginInfo.AddKeyword(PvlKeyword("MaxIncidence", toString(maxIncidence))); + pluginInfo.AddKeyword(PvlKeyword("MaxEmission", toString(maxEmission))); Application::Log(pluginInfo); // inform user of any unused (invalid) keywords found in the def file @@ -493,10 +493,10 @@ void IsisMain() { } // create Results group and add to print.prt - PvlKeyword cpCountKeyword("ControlPointCount", IString(cpCount)); - PvlKeyword msCountKeyword("ControlMeasureCount", IString(msCount)); - PvlKeyword cpIgnoredCountKeyword("ControlPointsIgnored", IString(cpIgnoredCount)); - PvlKeyword cmIgnoredCountKeyword("ControlMeasuresIgnored", IString(cmIgnoredCount)); + PvlKeyword cpCountKeyword("ControlPointCount", toString(cpCount)); + PvlKeyword msCountKeyword("ControlMeasureCount", toString(msCount)); + PvlKeyword cpIgnoredCountKeyword("ControlPointsIgnored", toString(cpIgnoredCount)); + PvlKeyword cmIgnoredCountKeyword("ControlMeasuresIgnored", toString(cmIgnoredCount)); PvlGroup resultsGrp("Results"); resultsGrp.AddKeyword(cpCountKeyword); diff --git a/isis/src/control/apps/cnet2mat/cnet2mat.cpp b/isis/src/control/apps/cnet2mat/cnet2mat.cpp index 45c05f7f72..ddf5476bee 100644 --- a/isis/src/control/apps/cnet2mat/cnet2mat.cpp +++ b/isis/src/control/apps/cnet2mat/cnet2mat.cpp @@ -23,8 +23,8 @@ using namespace Isis; void IsisMain() { - std::map fscMap; - std::map snMap; + std::map fscMap; + std::map snMap; UserInterface &ui = Application::GetUserInterface(); @@ -32,10 +32,10 @@ void IsisMain() { SerialNumberList snl(ui.GetFileName("LIST3")); for (int f = 0; f < list2.size(); f++) { - IString currFile(list2[f].toString()); + QString currFile(list2[f].toString()); Pvl lab(currFile); PvlObject qube(lab.FindObject("QUBE")); - string fsc; + QString fsc; if(qube.HasKeyword("IMAGE_NUMBER")) { fsc = qube.FindKeyword("IMAGE_NUMBER")[0]; } @@ -43,13 +43,13 @@ void IsisMain() { fsc = qube.FindKeyword("IMAGE_ID")[0]; } else { - string msg = "Unable to find keyword [\"IMAGE_NUMBER\" or \"IMAGE_ID\"] in file ["; + QString msg = "Unable to find keyword [\"IMAGE_NUMBER\" or \"IMAGE_ID\"] in file ["; msg += fsc + "]"; throw IException(IException::User, msg, _FILEINFO_); } - IString sn(snl.SerialNumber(f)); - fscMap.insert(std::pair(f, fsc)); - snMap.insert(std::pair(sn, f)); + QString sn(snl.SerialNumber(f)); + fscMap.insert(std::pair(f, fsc)); + snMap.insert(std::pair(sn, f)); } ControlNet cnet(ui.GetFileName("CNET")); @@ -63,38 +63,38 @@ void IsisMain() { TextFile mpFile(ui.GetFileName("MATCH"), "Overwrite", ""); ostringstream str; - IString textLine; + QString textLine; textLine = "Matchpoint total = "; - textLine += IString(mpTotal); + textLine += toString(mpTotal); mpFile.PutLine(textLine); str.clear(); str.str(""); str.width(40); str.setf(ios::left); str << "Point ID"; - textLine = str.str(); + textLine = str.str().c_str(); str.clear(); str.str(""); str.width(7); str.setf(ios::left); str << "FSC"; - textLine += str.str(); + textLine += str.str().c_str(); str.clear(); str.str(""); str.width(8); str.setf(ios::left); str << "LINE"; - textLine += str.str(); + textLine += str.str().c_str(); str.clear(); str.str(""); str.width(5); str.setf(ios::left); str << "SAMP"; - textLine += str.str(); + textLine += str.str().c_str(); str.clear(); @@ -102,14 +102,14 @@ void IsisMain() { str.width(14); str.setf(ios::left); str << "CLASS"; - textLine += str.str(); + textLine += str.str().c_str(); str.clear(); str.str(""); str.width(8); str.setf(ios::left); str << "DIAMETER"; - textLine += str.str(); + textLine += str.str().c_str(); mpFile.PutLine(textLine); @@ -128,17 +128,17 @@ void IsisMain() { formatter.width(30); formatter.setf(ios::left); formatter << currPoint->GetId() << " "; - textLine = formatter.str(); + textLine = formatter.str().c_str(); //Set FSC formatter.clear(); formatter.str(""); formatter.width(12); formatter.setf(ios::right); - string sn = currMeas->GetCubeSerialNumber(); - string fsc = fscMap[snMap[sn]]; + QString sn = currMeas->GetCubeSerialNumber(); + QString fsc = fscMap[snMap[sn]]; formatter << fsc << " "; - textLine += formatter.str(); + textLine += formatter.str().c_str(); //Set Line formatter.clear(); @@ -148,7 +148,7 @@ void IsisMain() { formatter.setf(ios::fixed); formatter.precision(2); formatter << currMeas->GetLine() << " "; - textLine += formatter.str(); + textLine += formatter.str().c_str(); //Set Sample formatter.clear(); @@ -158,10 +158,10 @@ void IsisMain() { formatter.setf(ios::fixed); formatter.precision(2); formatter << currMeas->GetSample() << " "; - textLine += formatter.str(); + textLine += formatter.str().c_str(); //Set Class - string ptClass; + QString ptClass; ControlMeasure::MeasureType mType = currMeas->GetType(); if(currMeas->IsIgnored() || currPoint->IsIgnored()) { @@ -195,7 +195,7 @@ void IsisMain() { diam = currMeas->GetDiameter(); } formatter << diam; - textLine += formatter.str(); + textLine += formatter.str().c_str(); mpFile.PutLine(textLine); } diff --git a/isis/src/control/apps/cnetadd/cnetadd.cpp b/isis/src/control/apps/cnetadd/cnetadd.cpp index 9382852465..54c8887d77 100644 --- a/isis/src/control/apps/cnetadd/cnetadd.cpp +++ b/isis/src/control/apps/cnetadd/cnetadd.cpp @@ -48,7 +48,7 @@ using namespace Isis; void setControlPointLatLon(SerialNumberList &snl, ControlNet &cnet); QList getValidPoints(Cube &cube, STRtree &coordTree); -std::map< std::string, SurfacePoint > g_surfacePoints; +std::map< QString, SurfacePoint > g_surfacePoints; QMap< QString, QSet > g_modifications; @@ -84,7 +84,7 @@ void IsisMain() { inNet.SetUserName(Application::UserName()); inNet.SetModifiedDate(iTime::CurrentLocalTime()); //This should be done in ControlNet's Write fn - std::string retrievalOpt = ui.GetString("RETRIEVAL"); + QString retrievalOpt = ui.GetString("RETRIEVAL"); PvlKeyword duplicates("DupSerialNumbers"); if (retrievalOpt == "REFERENCE") { FileList list1(ui.GetFileName("FROMLIST")); @@ -101,7 +101,7 @@ void IsisMain() { // Check for duplicate SNs within the addlist for (int j = i + 1; j < addSerials.Size(); j++) { if (addSerials.SerialNumber(i) == addSerials.SerialNumber(j)) { - std::string msg = "Add list files [" + addSerials.FileName(i) + "] and ["; + QString msg = "Add list files [" + addSerials.FileName(i) + "] and ["; msg += addSerials.FileName(j) + "] share the same serial number."; throw IException(IException::User, msg, _FILEINFO_); } @@ -118,7 +118,7 @@ void IsisMain() { SurfacePoint surfacePoint = point->GetBestSurfacePoint(); if (!surfacePoint.Valid()) { - std::string msg = "Unable to retreive lat/lon from Control Point ["; + QString msg = "Unable to retreive lat/lon from Control Point ["; msg += point->GetId() + "]. RETREIVAL=POINT cannot be used unless "; msg += "all Control Points have Latitude/Longitude keywords."; throw IException(IException::User, msg, _FILEINFO_); @@ -162,7 +162,7 @@ void IsisMain() { Cube cube; cube.open(addList[img].toString()); Pvl *cubepvl = cube.getLabel(); - std::string sn = SerialNumber::Compose(*cubepvl); + QString sn = SerialNumber::Compose(*cubepvl); Camera *cam = cube.getCamera(); // Loop through all the control points @@ -278,7 +278,7 @@ void IsisMain() { // Set up the output file for writing std::ofstream out_stream; - out_stream.open(pointList.expanded().c_str(), std::ios::out); + out_stream.open(pointList.expanded().toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); //Start writing from beginning of file QList modifiedPointsList = g_modifications.keys(); @@ -324,7 +324,7 @@ void IsisMain() { const QList snList = inNet.GetCubeSerials(); for (int i = 0; i < snList.size(); i++) { - IString sn = snList[i]; + QString sn = snList[i]; if (addSerials.HasSerialNumber(sn)) toList.Add(addSerials.FileName(sn)); @@ -374,7 +374,7 @@ void setControlPointLatLon(SerialNumberList &snl, ControlNet &cnet) { g_surfacePoints[point->GetId()] = cube->getCamera()->GetSurfacePoint(); } catch (IException &e) { - std::string msg = "Unable to create camera for cube file ["; + QString msg = "Unable to create camera for cube file ["; msg += snl.FileName(cm->GetCubeSerialNumber()) + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } @@ -393,7 +393,7 @@ QList getValidPoints(Cube &cube, STRtree &coordTree) { cube.read(poly); } catch (IException &e) { - std::string msg = "Footprintinit must be run prior to running cnetadd"; + QString msg = "Footprintinit must be run prior to running cnetadd"; msg += " with POLYGON=TRUE for cube [" + cube.getFileName() + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } diff --git a/isis/src/control/apps/cnetcheck/cnetcheck.cpp b/isis/src/control/apps/cnetcheck/cnetcheck.cpp index 450259a650..e31f065e51 100644 --- a/isis/src/control/apps/cnetcheck/cnetcheck.cpp +++ b/isis/src/control/apps/cnetcheck/cnetcheck.cpp @@ -39,41 +39,35 @@ #include "UserInterface.h" using namespace Isis; -using std::cerr; -using std::cout; -using std::endl; -using std::ofstream; -using std::set; -using std::string; -using std::stringstream; - -QMap< IString, set > constructPointSets( - set &index, ControlNet innet); -QVector< set > findIslands( - set &index, - QMap< IString, set > adjCubes); +using namespace std; + +QMap< QString, set > constructPointSets( + set &index, ControlNet innet); +QVector< set > findIslands( + set &index, + QMap< QString, set > adjCubes); QList< ControlCubeGraphNode * > checkSerialList( SerialNumberList * serialNumbers, ControlNet * controlNet); void writeOutput(SerialNumberList num2cube, - string filename, - set sns, - QMap< IString, set > cps); + QString filename, + set sns, + QMap< QString, set > cps); double getControlFitness(const ControlCubeGraphNode * node, double tolerance, Cube * cube); void noLatLonCheck(ControlNet &cnet, CubeManager &manager, Progress &progress, bool ignore, SerialNumberList &num2cube, - set &noLatLonSerialNumbers, - QMap< IString, set > &noLatLonControlPoints); + set &noLatLonSerialNumbers, + QMap< QString, set > &noLatLonControlPoints); -string buildRow(SerialNumberList &serials, string sn); -string buildRow(SerialNumberList &serials, string sn, set &cps); -string buildRow(SerialNumberList &serials, string sn, double value); -void outputRow(ofstream &outStream, string rowText); +QString buildRow(SerialNumberList &serials, QString sn); +QString buildRow(SerialNumberList &serials, QString sn, set &cps); +QString buildRow(SerialNumberList &serials, QString sn, double value); +void outputRow(ofstream &outStream, QString rowText); -IString g_delimiter; +QString g_delimiter; // Main program @@ -83,7 +77,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); ControlNet innet(ui.GetFileName("CNET")); - IString prefix(ui.GetString("PREFIX")); + QString prefix(ui.GetString("PREFIX")); bool ignore = ui.GetBoolean("IGNORE"); // Set the character to separate the entries @@ -102,9 +96,9 @@ void IsisMain() { // Sets up the list of serial numbers for FileList inlist(ui.GetFileName("FROMLIST")); - set inListNums; - QMap netSerialNumCount; - QVector listedSerialNumbers; + set inListNums; + QMap netSerialNumCount; + QVector listedSerialNumbers; SerialNumberList num2cube; if (inlist.size() > 0) { @@ -115,24 +109,24 @@ void IsisMain() { for (int index = 0; index < inlist.size(); index++) { num2cube.Add(inlist[index].toString()); - IString st = num2cube.SerialNumber(inlist[index].toString()); + QString st = num2cube.SerialNumber(inlist[index].toString()); inListNums.insert(st); listedSerialNumbers.push_back(st); // Used with nonListedSerialNumbers progress.CheckStatus(); } - QVector nonListedSerialNumbers; + QVector nonListedSerialNumbers; - set singleMeasureSerialNumbers; - QMap< IString, set > singleMeasureControlPoints; + set singleMeasureSerialNumbers; + QMap< QString, set > singleMeasureControlPoints; - QMap< IString, set > duplicateControlPoints; + QMap< QString, set > duplicateControlPoints; - set noLatLonSerialNumbers; - QMap< IString, set > noLatLonControlPoints; - set latlonchecked; + set noLatLonSerialNumbers; + QMap< QString, set > noLatLonControlPoints; + set latlonchecked; - QMap< IString, int > cubeMeasureCount; + QMap< QString, int > cubeMeasureCount; // Manage cubes used in NOLATLON CubeManager cbman; @@ -157,7 +151,7 @@ void IsisMain() { // Checks of the ControlPoint has only 1 Measure if (controlpt->GetNumValidMeasures() == 1) { - IString sn = controlpt->GetMeasure(0)->GetCubeSerialNumber(); + QString sn = controlpt->GetMeasure(0)->GetCubeSerialNumber(); singleMeasureSerialNumbers.insert(sn); singleMeasureControlPoints[sn].insert(controlpt->GetId()); @@ -173,7 +167,7 @@ void IsisMain() { if (ignore && controlms->IsIgnored()) continue; controlMeasures.append(controlms); - IString currentsn = controlms->GetCubeSerialNumber(); + QString currentsn = controlms->GetCubeSerialNumber(); // Records how many times a cube is in the ControlNet cubeMeasureCount[currentsn]++; @@ -211,21 +205,21 @@ void IsisMain() { // Checks/detects islands - set index; - QMap< IString, set > adjCubes = constructPointSets(index, innet); - QVector< set > islands = findIslands(index, adjCubes); + set index; + QMap< QString, set > adjCubes = constructPointSets(index, innet); + QVector< set > islands = findIslands(index, adjCubes); // Output islands in the file-by-file format // Islands that have no cubes listed in the input list will // not be shown. for (int i = 0; i < (int)islands.size(); i++) { - IString name(FileName(prefix + "Island." + IString(i + 1)).expanded()); + QString name(FileName(prefix + "Island." + toString(i + 1)).expanded()); ofstream out_stream; - out_stream.open(name.c_str(), std::ios::out); + out_stream.open(name.toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); //Start writing from beginning of file bool hasList = false; - for (set::iterator island = islands[i].begin(); + for (set::iterator island = islands[i].begin(); island != islands[i].end(); island++) { if (num2cube.HasSerialNumber(*island)) { @@ -237,7 +231,7 @@ void IsisMain() { out_stream.close(); if (!hasList) { - remove(name.c_str()); + remove(name.toAscii().data()); } } @@ -247,7 +241,7 @@ void IsisMain() { stringstream ss(stringstream::in | stringstream::out); - results.AddKeyword(PvlKeyword("Islands", IString((BigInt)islands.size()))); + results.AddKeyword(PvlKeyword("Islands", toString((BigInt)islands.size()))); ss << endl << "----------------------------------------" \ "----------------------------------------" << endl; if (islands.size() == 1) { @@ -264,9 +258,9 @@ void IsisMain() { if (ui.GetBoolean("SINGLEMEASURE") && singleMeasureSerialNumbers.size() > 0) { results.AddKeyword( - PvlKeyword("SingleMeasure", IString((BigInt)singleMeasureSerialNumbers.size()))); + PvlKeyword("SingleMeasure", toString((BigInt)singleMeasureSerialNumbers.size()))); - IString name(FileName(prefix + "SinglePointCubes.txt").expanded()); + QString name(FileName(prefix + "SinglePointCubes.txt").expanded()); writeOutput(num2cube, name, singleMeasureSerialNumbers, singleMeasureControlPoints); @@ -282,9 +276,9 @@ void IsisMain() { if (ui.GetBoolean("NOLATLON") && noLatLonSerialNumbers.size() > 0) { results.AddKeyword( - PvlKeyword("NoLatLonCubes", IString((BigInt)noLatLonSerialNumbers.size()))); + PvlKeyword("NoLatLonCubes", toString((BigInt)noLatLonSerialNumbers.size()))); - IString name(FileName(prefix + "NoLatLon.txt").expanded()); + QString name(FileName(prefix + "NoLatLon.txt").expanded()); writeOutput(num2cube, name, noLatLonSerialNumbers, noLatLonControlPoints); @@ -298,20 +292,20 @@ void IsisMain() { } // Perform Low Coverage check if it was selected - IString coverageOp = "LowCoverage"; + QString coverageOp = "LowCoverage"; int failedCoverageCheck = 0; - if (ui.GetBoolean(IString(coverageOp).UpCase())) { + if (ui.GetBoolean(QString(coverageOp).toUpper())) { QList< ControlCubeGraphNode * > nodes = innet.GetCubeGraphNodes(); if (nodes.size() > 0) { - IString name(FileName(prefix + coverageOp + ".txt").expanded()); + QString name(FileName(prefix + coverageOp + ".txt").expanded()); ofstream out_stream; - out_stream.open(name.c_str(), std::ios::out); + out_stream.open(name.toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); // Start writing from file beginning double tolerance = ui.GetDouble("TOLERANCE"); foreach (ControlCubeGraphNode * node, nodes) { - IString sn = node->getSerialNumber(); + QString sn = node->getSerialNumber(); if (num2cube.HasSerialNumber(sn)) { // Create a convex hull @@ -338,21 +332,21 @@ void IsisMain() { "coverages, are listed in [" << FileName(name).name() << "]" << endl; results.AddKeyword( - PvlKeyword(coverageOp, IString((BigInt) failedCoverageCheck))); + PvlKeyword(coverageOp, toString((BigInt) failedCoverageCheck))); } } // At this point, inListNums is the list of cubes NOT included in the // ControlNet, and inListNums are their those cube's serial numbers. if (ui.GetBoolean("NOCONTROL") && !inListNums.empty()) { - results.AddKeyword(PvlKeyword("NoControl", IString((BigInt)inListNums.size()))); + results.AddKeyword(PvlKeyword("NoControl", toString((BigInt)inListNums.size()))); - IString name(FileName(prefix + "NoControl.txt").expanded()); + QString name(FileName(prefix + "NoControl.txt").expanded()); ofstream out_stream; - out_stream.open(name.c_str(), std::ios::out); + out_stream.open(name.toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); //Start writing from beginning of file - for (set::iterator sn = inListNums.begin(); + for (set::iterator sn = inListNums.begin(); sn != inListNums.end(); sn++) { outputRow(out_stream, buildRow(num2cube, *sn)); @@ -373,18 +367,18 @@ void IsisMain() { // cube in the input list. if (ui.GetBoolean("NOCUBE") && nonListedSerialNumbers.size() > 0) { results.AddKeyword( - PvlKeyword("NoCube", IString((BigInt)nonListedSerialNumbers.size()))); + PvlKeyword("NoCube", toString((BigInt)nonListedSerialNumbers.size()))); - IString name(FileName(prefix + "NoCube.txt").expanded()); + QString name(FileName(prefix + "NoCube.txt").expanded()); ofstream out_stream; - out_stream.open(name.c_str(), std::ios::out); + out_stream.open(name.toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); //Start writing from beginning of file for (int sn = 0; sn < (int)nonListedSerialNumbers.size(); sn++) { int validMeasureCount = innet.getGraphNode( nonListedSerialNumbers[sn])->getValidMeasures().size(); - string rowText = nonListedSerialNumbers[sn] + " (Valid Measures: " + - IString(validMeasureCount) + ")"; + QString rowText = nonListedSerialNumbers[sn] + " (Valid Measures: " + + toString(validMeasureCount) + ")"; outputRow(out_stream, rowText); } @@ -404,8 +398,8 @@ void IsisMain() { // At this point cubeMeasureCount should be equal to the number of // ControlMeasures associated with each serial number. if (ui.GetBoolean("SINGLECUBE")) { - set singleMeasureCubes; - for (QMap::iterator cube = cubeMeasureCount.begin(); + set singleMeasureCubes; + for (QMap::iterator cube = cubeMeasureCount.begin(); cube != cubeMeasureCount.end(); cube++) { if (cube.value() == 1) { @@ -415,14 +409,14 @@ void IsisMain() { if (singleMeasureCubes.size() > 0) { results.AddKeyword( - PvlKeyword("SingleCube", IString((BigInt)singleMeasureCubes.size()))); + PvlKeyword("SingleCube", toString((BigInt)singleMeasureCubes.size()))); - IString name(FileName(prefix + "SingleCube.txt").expanded()); + QString name(FileName(prefix + "SingleCube.txt").expanded()); ofstream out_stream; - out_stream.open(name.c_str(), std::ios::out); + out_stream.open(name.toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); //Start writing from beginning of file - for (set::iterator sn = singleMeasureCubes.begin(); + for (set::iterator sn = singleMeasureCubes.begin(); sn != singleMeasureCubes.end(); sn++) { outputRow(out_stream, buildRow(num2cube, *sn)); @@ -443,7 +437,7 @@ void IsisMain() { ss << "----------------------------------------" \ "----------------------------------------" << endl << endl; - string log = ss.str(); + QString log = ss.str().c_str(); Application::Log(results); if (ui.IsInteractive()) { @@ -457,9 +451,9 @@ void IsisMain() { // Links cubes to other cubes it shares control points with -QMap< IString, set > constructPointSets(set & index, +QMap< QString, set > constructPointSets(set & index, ControlNet innet) { - QMap< IString, set > adjPoints; + QMap< QString, set > adjPoints; bool ignore = Application::GetUserInterface().GetBoolean("IGNORE"); for (int cp = 0; cp < innet.GetNumPoints(); cp++) { @@ -473,7 +467,7 @@ QMap< IString, set > constructPointSets(set & index, for (int cm1 = 0; cm1 < controlpt->GetNumMeasures(); cm1++) { if (ignore && controlpt->IsIgnored()) continue; - IString sn = controlpt->GetMeasure(cm1)->GetCubeSerialNumber(); + QString sn = controlpt->GetMeasure(cm1)->GetCubeSerialNumber(); index.insert(sn); for (int cm2 = 0; cm2 < controlpt->GetNumMeasures(); cm2++) { if (ignore && controlpt->GetMeasure(cm2)->IsIgnored()) continue; @@ -491,15 +485,15 @@ QMap< IString, set > constructPointSets(set & index, // Uses a depth-first search to construct the islands -QVector< set > findIslands(set & index, - QMap< IString, set > adjCubes) { - QVector< set > islands; +QVector< set > findIslands(set & index, + QMap< QString, set > adjCubes) { + QVector< set > islands; while(index.size() != 0) { - set connectedSet; + set connectedSet; - QStack str_stack; - set::iterator first = index.begin(); + QStack str_stack; + set::iterator first = index.begin(); str_stack.push(*first); // Depth search @@ -508,9 +502,9 @@ QVector< set > findIslands(set & index, connectedSet.insert(str_stack.top()); // Find the first connected unvisited node - IString nextNode = ""; - set neighbors = adjCubes[str_stack.top()]; - for (set::iterator i = neighbors.begin(); + QString nextNode = ""; + set neighbors = adjCubes[str_stack.top()]; + for (set::iterator i = neighbors.begin(); i != neighbors.end(); i++) { if (index.count(*i) == 1) { @@ -539,15 +533,15 @@ QVector< set > findIslands(set & index, // Writes the list of cubes [ SerialNumber, FileName, ControlPoints ] to the output file -void writeOutput(SerialNumberList num2cube, string filename, - set sns, QMap< IString, set > cps) { +void writeOutput(SerialNumberList num2cube, QString filename, + set sns, QMap< QString, set > cps) { // Set up the output file for writing ofstream out_stream; - out_stream.open(filename.c_str(), std::ios::out); + out_stream.open(filename.toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); //Start writing from beginning of file - for (set::iterator sn = sns.begin(); + for (set::iterator sn = sns.begin(); sn != sns.end(); sn++) { outputRow(out_stream, buildRow(num2cube, *sn, cps[*sn])); @@ -578,7 +572,7 @@ double getControlFitness(const ControlCubeGraphNode * node, double tolerance, Cu // Calculate the area of the convex hull double convexArea = convexHull->getArea(); - IString sn = node->getSerialNumber(); + QString sn = node->getSerialNumber(); double cubeArea = cube->getSampleCount() * cube->getLineCount(); controlFitness = convexArea / cubeArea; @@ -596,8 +590,8 @@ double getControlFitness(const ControlCubeGraphNode * node, double tolerance, Cu void noLatLonCheck(ControlNet &cnet, CubeManager &manager, Progress &progress, bool ignore, SerialNumberList &num2cube, - set &noLatLonSerialNumbers, - QMap< IString, set > &noLatLonControlPoints) { + set &noLatLonSerialNumbers, + QMap< QString, set > &noLatLonControlPoints) { // Set calculating progress QList graphNodes = cnet.GetCubeGraphNodes(); @@ -609,7 +603,7 @@ void noLatLonCheck(ControlNet &cnet, CubeManager &manager, Progress &progress, for (int sn = 0; sn < graphNodes.size(); sn++) { ControlCubeGraphNode *graphNode = graphNodes[sn]; - IString serialNumber = graphNode->getSerialNumber(); + QString serialNumber = graphNode->getSerialNumber(); if (num2cube.HasSerialNumber(serialNumber)) { Cube *cube = manager.OpenCube(num2cube.FileName(serialNumber)); @@ -650,18 +644,18 @@ void noLatLonCheck(ControlNet &cnet, CubeManager &manager, Progress &progress, } -string buildRow(SerialNumberList &serials, string sn) { - string cubeName = serials.HasSerialNumber(sn) ? +QString buildRow(SerialNumberList &serials, QString sn) { + QString cubeName = serials.HasSerialNumber(sn) ? FileName(serials.FileName(sn)).expanded() : "UnknownFilename"; return cubeName + g_delimiter + sn; } -string buildRow(SerialNumberList &serials, string sn, set &cps) { - string rowText = buildRow(serials, sn); +QString buildRow(SerialNumberList &serials, QString sn, set &cps) { + QString rowText = buildRow(serials, sn); // Control Points where the cube was found to have the issue - for (set::iterator cp = cps.begin(); cp != cps.end(); cp++) { + for (set::iterator cp = cps.begin(); cp != cps.end(); cp++) { rowText += g_delimiter + *cp; } @@ -669,12 +663,12 @@ string buildRow(SerialNumberList &serials, string sn, set &cps) { } -string buildRow(SerialNumberList &serials, string sn, double value) { - return buildRow(serials, sn) + g_delimiter + IString(value); +QString buildRow(SerialNumberList &serials, QString sn, double value) { + return buildRow(serials, sn) + g_delimiter + toString(value); } -void outputRow(ofstream &outStream, string rowText) { +void outputRow(ofstream &outStream, QString rowText) { outStream << rowText << "\n"; } diff --git a/isis/src/control/apps/cnetdiff/cnetdiff.cpp b/isis/src/control/apps/cnetdiff/cnetdiff.cpp index b6d696fc24..83b54acb34 100644 --- a/isis/src/control/apps/cnetdiff/cnetdiff.cpp +++ b/isis/src/control/apps/cnetdiff/cnetdiff.cpp @@ -22,7 +22,7 @@ using namespace std; using namespace Isis; bool filesMatch; -IString differenceReason; +QString differenceReason; PvlGroup tolerances; PvlGroup ignorekeys; @@ -127,14 +127,14 @@ void Compare(LatestControlNetFile *net1, LatestControlNetFile *net2) { if(net1NumPts != net2NumPts) { differenceReason = "The number of control points in the networks, [" + - IString(net1NumPts) + "] and [" + - IString(net2NumPts) + ", differ"; + toString(net1NumPts) + "] and [" + + toString(net2NumPts) + ", differ"; filesMatch = false; return; } - IString id1 = net1Obj["NetworkId"][0]; - IString id2 = net2Obj["NetworkId"][0]; + QString id1 = net1Obj["NetworkId"][0]; + QString id2 = net2Obj["NetworkId"][0]; if(id1 != id2) { differenceReason = "The network IDs [" + @@ -144,8 +144,8 @@ void Compare(LatestControlNetFile *net1, LatestControlNetFile *net2) { return; } - IString target1 = net1Obj["TargetName"][0]; - IString target2 = net2Obj["TargetName"][0]; + QString target1 = net1Obj["TargetName"][0]; + QString target2 = net2Obj["TargetName"][0]; if(target1 != target2) { differenceReason = "The targets [" + @@ -175,7 +175,7 @@ void Compare(LatestControlNetFile *net1, LatestControlNetFile *net2) { void Compare(const PvlObject &point1Pvl, const PvlObject &point2Pvl) { // both names must be at least equal, should be named ControlPoint if(point1Pvl.Name() != point2Pvl.Name()) { - IString msg = "The control points' CreatePvlOject method returned an " + QString msg = "The control points' CreatePvlOject method returned an " "unexpected result"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -183,8 +183,8 @@ void Compare(const PvlObject &point1Pvl, const PvlObject &point2Pvl) { if(point1Pvl.Groups() != point2Pvl.Groups()) { filesMatch = false; differenceReason = "The number of control measures, [" + - IString(point1Pvl.Groups()) + "] and [" + - IString(point2Pvl.Groups()) + "] does not match"; + toString(point1Pvl.Groups()) + "] and [" + + toString(point2Pvl.Groups()) + "] does not match"; } // Start by comparing top level control point keywords. @@ -247,7 +247,7 @@ void CompareGroups(const PvlContainer &pvl1, const PvlContainer &pvl2) { void CompareKeywords(const PvlKeyword &pvl1, const PvlKeyword &pvl2) { if(pvl1.Name().compare(pvl2.Name()) != 0) { - IString msg = "CompareKeywords should always be called with keywords that " + QString msg = "CompareKeywords should always be called with keywords that " "have the same name"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -261,7 +261,7 @@ void CompareKeywords(const PvlKeyword &pvl1, const PvlKeyword &pvl2) { if(tolerances.HasKeyword(pvl1.Name()) && tolerances[pvl1.Name()].Size() > 1 && pvl1.Size() != tolerances[pvl1.Name()].Size()) { - string msg = "Size of value '" + pvl1.Name() + "' does not match with "; + QString msg = "Size of value '" + pvl1.Name() + "' does not match with "; msg += "its number of tolerances in the DIFF file."; throw IException(IException::User, msg, _FILEINFO_); } @@ -269,16 +269,16 @@ void CompareKeywords(const PvlKeyword &pvl1, const PvlKeyword &pvl2) { if(ignorekeys.HasKeyword(pvl1.Name()) && ignorekeys[pvl1.Name()].Size() > 1 && pvl1.Size() != ignorekeys[pvl1.Name()].Size()) { - string msg = "Size of value '" + pvl1.Name() + "' does not match with "; + QString msg = "Size of value '" + pvl1.Name() + "' does not match with "; msg += "its number of ignore keys in the DIFF file."; throw IException(IException::User, msg, _FILEINFO_); } for(int i = 0; i < pvl1.Size() && filesMatch; i++) { - IString val1 = pvl1[i]; - IString val2 = pvl2[i]; - IString unit1 = pvl1.Unit(i); - IString unit2 = pvl2.Unit(i); + QString val1 = pvl1[i]; + QString val2 = pvl2[i]; + QString unit1 = pvl1.Unit(i); + QString unit2 = pvl2.Unit(i); int ignoreIndex = 0; if(ignorekeys.HasKeyword(pvl1.Name()) && ignorekeys[pvl1.Name()].Size() > 1) { @@ -289,37 +289,37 @@ void CompareKeywords(const PvlKeyword &pvl1, const PvlKeyword &pvl2) { if(!ignorekeys.HasKeyword(pvl1.Name()) || ignorekeys[pvl1.Name()][ignoreIndex] == "false") { - if(!unit1.Equal(unit2)) { + if(unit1.toLower() != unit2.toLower()) { filesMatch = false; differenceReason = "Value '" + pvl1.Name() + "': units do not match."; return; } double tolerance = 0.0; - double difference = abs((double)val1 - (double)val2); + double difference = abs(toDouble(val1) - toDouble(val2)); if(tolerances.HasKeyword(pvl1.Name())) { - tolerance = (tolerances[pvl1.Name()].Size() == 1) ? - tolerances[pvl1.Name()][0] : tolerances[pvl1.Name()][i]; + tolerance = toDouble((tolerances[pvl1.Name()].Size() == 1) ? + tolerances[pvl1.Name()][0] : tolerances[pvl1.Name()][i]); } if(difference > tolerance) { filesMatch = false; if(pvl1.Size() == 1) { differenceReason = "Value [" + pvl1.Name() + "] difference is " + - IString(difference); + toString(difference); } else { differenceReason = "Value [" + pvl1.Name() + "] at index " + - IString(i) + ": difference is " + IString(difference); + toString(i) + ": difference is " + toString(difference); } - differenceReason += " (values are [" + IString(val1) + "] and [" + - IString(val2) + "], tolerance is [" + IString(tolerance) + "])"; + differenceReason += " (values are [" + val1 + "] and [" + + val2 + "], tolerance is [" + toString(tolerance) + "])"; } } } catch(IException &e) { - if(!val1.Equal(val2)) { + if(val1.toLower() != val2.toLower()) { filesMatch = false; differenceReason = "Value '" + pvl1.Name() + "': values do not match."; } diff --git a/isis/src/control/apps/cnetedit/cnetedit.cpp b/isis/src/control/apps/cnetedit/cnetedit.cpp index c54b7bb52b..12e732cde2 100644 --- a/isis/src/control/apps/cnetedit/cnetedit.cpp +++ b/isis/src/control/apps/cnetedit/cnetedit.cpp @@ -35,9 +35,9 @@ using namespace Isis; bool shouldDelete(ControlPoint *point); // Mutator methods -void ignorePoint(ControlNet &cnet, ControlPoint *point, string cause); +void ignorePoint(ControlNet &cnet, ControlPoint *point, QString cause); void ignoreMeasure(ControlNet &cnet, ControlPoint *point, - ControlMeasure *measure, string cause); + ControlMeasure *measure, QString cause); void deletePoint(ControlNet &cnet, int cp); void deleteMeasure(ControlPoint *point, int cm); @@ -59,25 +59,25 @@ void ignoreMeasures(ControlNet &cnet, void lockMeasures(ControlNet &cnet, QMap< QString, QSet * > &editMeasures); -void checkAllMeasureValidity(ControlNet &cnet, string cubeList); +void checkAllMeasureValidity(ControlNet &cnet, QString cubeList); // Validity test MeasureValidationResults validateMeasure(const ControlMeasure *measure, Cube *cube, Camera *camera); // Logging helpers -void logResult(QMap *pointsLog, string pointId, string cause); -void logResult(QMap *measuresLog, - string pointId, string serial, string cause); -PvlObject createLog(string label, QMap *pointsMap); -PvlObject createLog(string label, - QMap *pointsMap, QMap *measuresMap); +void logResult(QMap *pointsLog, QString pointId, QString cause); +void logResult(QMap *measuresLog, + QString pointId, QString serial, QString cause); +PvlObject createLog(QString label, QMap *pointsMap); +PvlObject createLog(QString label, + QMap *pointsMap, QMap *measuresMap); void PrintTemp(); void EditDefFile(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper["PrintTemp"] = (void *) PrintTemp; helper["EditDefFile"] = (void *) EditDefFile; return helper; @@ -93,11 +93,11 @@ bool retainRef; bool keepLog; bool ignoreAll; -QMap *ignoredPoints; -QMap *ignoredMeasures; -QMap *retainedReferences; -QMap *editLockedPoints; -QMap *editLockedMeasures; +QMap *ignoredPoints; +QMap *ignoredMeasures; +QMap *retainedReferences; +QMap *editLockedPoints; +QMap *editLockedMeasures; ControlNetValidMeasure *validator; @@ -137,7 +137,7 @@ void IsisMain() { ControlPointList *cpList = NULL; if (ui.WasEntered("POINTLIST") && cnet.GetNumPoints() > 0) { processPoints = true; - string pointlistFileName = ui.GetFileName("POINTLIST"); + QString pointlistFileName = ui.GetFileName("POINTLIST"); cpList = new ControlPointList((FileName) pointlistFileName); } @@ -146,7 +146,7 @@ void IsisMain() { SerialNumberList *cubeSnl = NULL; if (ui.WasEntered("CUBELIST") && cnet.GetNumPoints() > 0) { processCubes = true; - string ignorelistFileName = ui.GetFileName("CUBELIST"); + QString ignorelistFileName = ui.GetFileName("CUBELIST"); cubeSnl = new SerialNumberList(ignorelistFileName); } @@ -159,8 +159,8 @@ void IsisMain() { QFile file(ui.GetFileName("MEASURELIST")); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - string msg = "Unable to open MEASURELIST [" + - file.fileName().toStdString() + "]"; + QString msg = "Unable to open MEASURELIST [" + + file.fileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -170,7 +170,7 @@ void IsisMain() { QString line = in.readLine(); QStringList results = line.split(","); if (results.size() < 2) { - string msg = "Line " + IString(lineNumber) + " in the MEASURELIST does " + QString msg = "Line " + QString(lineNumber) + " in the MEASURELIST does " "not contain a Point ID and a cube filename separated by a comma"; throw IException(IException::User, msg, _FILEINFO_); } @@ -178,9 +178,9 @@ void IsisMain() { if (!editMeasures->contains(results[0])) editMeasures->insert(results[0], new QSet); - FileName cubeName(results[1].toStdString()); - string sn = SerialNumber::Compose(cubeName.expanded()); - (*editMeasures)[results[0]]->insert(QString::fromStdString(sn)); + FileName cubeName(results[1]); + QString sn = SerialNumber::Compose(cubeName.expanded()); + (*editMeasures)[results[0]]->insert(sn); lineNumber++; } @@ -255,7 +255,7 @@ void IsisMain() { pvlTemplate.ValidatePvl(defFile, pvlResults); if (pvlResults.Groups() > 0 || pvlResults.Keywords() > 0) { Application::Log(pvlResults.Group(0)); - string sErrMsg = "Invalid Deffile\n"; + QString sErrMsg = "Invalid Deffile\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } @@ -264,7 +264,7 @@ void IsisMain() { // User also provided a list of all serial numbers corresponding to every // cube in the control network - string cubeList = ui.GetFileName("FROMLIST"); + QString cubeList = ui.GetFileName("FROMLIST"); checkAllMeasureValidity(cnet, cubeList); // Delete the validator @@ -288,8 +288,8 @@ void IsisMain() { if (keepLog) { Pvl outputLog; - outputLog.AddKeyword(PvlKeyword("PointsDeleted", numPointsDeleted)); - outputLog.AddKeyword(PvlKeyword("MeasuresDeleted", numMeasuresDeleted)); + outputLog.AddKeyword(PvlKeyword("PointsDeleted", toString(numPointsDeleted))); + outputLog.AddKeyword(PvlKeyword("MeasuresDeleted", toString(numMeasuresDeleted))); PvlObject lockedLog = createLog( "EditLocked", editLockedPoints, editLockedMeasures); @@ -305,7 +305,7 @@ void IsisMain() { outputLog.AddObject(ignoredLog); // Write the log - string logFileName = ui.GetFileName("LOG"); + QString logFileName = ui.GetFileName("LOG"); outputLog.Write(logFileName); // Delete the structures keeping track of the ignored points and measures @@ -384,7 +384,7 @@ bool shouldDelete(ControlPoint *point) { * @param point The Control Point we wish to ignore * @param cause A prose description of why the point was ignored (for logging) */ -void ignorePoint(ControlNet &cnet, ControlPoint *point, string cause) { +void ignorePoint(ControlNet &cnet, ControlPoint *point, QString cause) { ControlPoint::Status result = point->SetIgnored(true); logResult(result == ControlPoint::Success ? ignoredPoints : editLockedPoints, @@ -403,7 +403,7 @@ void ignorePoint(ControlNet &cnet, ControlPoint *point, string cause) { * logging) */ void ignoreMeasure(ControlNet &cnet, ControlPoint *point, - ControlMeasure *measure, string cause) { + ControlMeasure *measure, QString cause) { ControlMeasure::Status result = measure->SetIgnored(true); logResult( @@ -479,13 +479,13 @@ void deleteMeasure(ControlPoint *point, int cm) { * @param cnet The Control Network being modified */ void populateLog(ControlNet &cnet, bool ignore) { - ignoredPoints = new QMap; - ignoredMeasures = new QMap; + ignoredPoints = new QMap; + ignoredMeasures = new QMap; - retainedReferences = new QMap; + retainedReferences = new QMap; - editLockedPoints = new QMap; - editLockedMeasures = new QMap; + editLockedPoints = new QMap; + editLockedMeasures = new QMap; Progress progress; progress.SetText("Initializing Log File"); @@ -612,7 +612,7 @@ void unlockCubes(ControlNet &cnet, SerialNumberList &snl) { for (int cm = point->GetNumMeasures() - 1; cm >= 0; cm--) { ControlMeasure *measure = point->GetMeasure(cm); - string serialNumber = measure->GetCubeSerialNumber(); + QString serialNumber = measure->GetCubeSerialNumber(); if (measure->IsEditLocked() && snl.HasSerialNumber(serialNumber)) { measure->SetEditLock(false); } @@ -651,10 +651,10 @@ void ignoreCubes(ControlNet &cnet, SerialNumberList &snl) { ignoreMeasure(cnet, point, measure, "EditLocked measure skipped"); } - string serialNumber = measure->GetCubeSerialNumber(); + QString serialNumber = measure->GetCubeSerialNumber(); if (snl.HasSerialNumber(serialNumber)) { - string cause = "Serial Number in CUBELIST"; + QString cause = "Serial Number in CUBELIST"; if (cm == point->IndexOfRefMeasure() && retainRef) { logResult(retainedReferences, point->GetId(), cause); } @@ -696,7 +696,7 @@ void lockCubes(ControlNet &cnet, SerialNumberList &snl) { for (int cm = point->GetNumMeasures() - 1; cm >= 0; cm--) { ControlMeasure *measure = point->GetMeasure(cm); - string serialNumber = measure->GetCubeSerialNumber(); + QString serialNumber = measure->GetCubeSerialNumber(); if (!measure->IsEditLocked() && snl.HasSerialNumber(serialNumber)) { measure->SetEditLock(true); } @@ -717,15 +717,14 @@ void unlockMeasures(ControlNet &cnet, for (int cp = cnet.GetNumPoints() - 1; cp >= 0; cp--) { ControlPoint *point = cnet.GetPoint(cp); - QString id = QString::fromStdString(point->GetId()); + QString id = point->GetId(); if (editMeasures.contains(id)) { QSet *measureSet = editMeasures[id]; for (int cm = point->GetNumMeasures() - 1; cm >= 0; cm--) { ControlMeasure *measure = point->GetMeasure(cm); - QString serialNumber = QString::fromStdString( - measure->GetCubeSerialNumber()); + QString serialNumber = measure->GetCubeSerialNumber(); if (measure->IsEditLocked() && measureSet->contains(serialNumber)) { measure->SetEditLock(false); } @@ -747,7 +746,7 @@ void ignoreMeasures(ControlNet &cnet, for (int cp = cnet.GetNumPoints() - 1; cp >= 0; cp--) { ControlPoint *point = cnet.GetPoint(cp); - QString id = QString::fromStdString(point->GetId()); + QString id = point->GetId(); if (editMeasures.contains(id)) { QSet *measureSet = editMeasures[id]; @@ -760,10 +759,9 @@ void ignoreMeasures(ControlNet &cnet, ignoreMeasure(cnet, point, measure, "EditLocked measure skipped"); } - QString serialNumber = QString::fromStdString( - measure->GetCubeSerialNumber()); + QString serialNumber = measure->GetCubeSerialNumber(); if (measureSet->contains(serialNumber)) { - string cause = "Measure in MEASURELIST"; + QString cause = "Measure in MEASURELIST"; if (cm == point->IndexOfRefMeasure() && retainRef) { logResult(retainedReferences, point->GetId(), cause); } @@ -805,15 +803,14 @@ void lockMeasures(ControlNet &cnet, for (int cp = cnet.GetNumPoints() - 1; cp >= 0; cp--) { ControlPoint *point = cnet.GetPoint(cp); - QString id = QString::fromStdString(point->GetId()); + QString id = point->GetId(); if (editMeasures.contains(id)) { QSet *measureSet = editMeasures[id]; for (int cm = point->GetNumMeasures() - 1; cm >= 0; cm--) { ControlMeasure *measure = point->GetMeasure(cm); - QString serialNumber = QString::fromStdString( - measure->GetCubeSerialNumber()); + QString serialNumber = measure->GetCubeSerialNumber(); if (!measure->IsEditLocked() && measureSet->contains(serialNumber)) { measure->SetEditLock(true); } @@ -833,7 +830,7 @@ void lockMeasures(ControlNet &cnet, * @param cubeList Name of the file containing the list of all Serial Numbers * in the network */ -void checkAllMeasureValidity(ControlNet &cnet, string cubeList) { +void checkAllMeasureValidity(ControlNet &cnet, QString cubeList) { SerialNumberList serialNumbers(cubeList); QList graphNodes = cnet.GetCubeGraphNodes(); @@ -844,13 +841,13 @@ void checkAllMeasureValidity(ControlNet &cnet, string cubeList) { for (int sn = 0; sn < graphNodes.size(); sn++) { ControlCubeGraphNode *graphNode = graphNodes[sn]; - IString serialNumber = graphNode->getSerialNumber(); + QString serialNumber = graphNode->getSerialNumber(); Cube *cube = NULL; Camera *camera = NULL; if (validator->IsCubeRequired()) { if (!serialNumbers.HasSerialNumber(serialNumber)) { - string msg = "Serial Number [" + serialNumber + "] contains no "; + QString msg = "Serial Number [" + serialNumber + "] contains no "; msg += "matching cube in FROMLIST"; throw IException(IException::User, msg, _FILEINFO_); } @@ -863,7 +860,7 @@ void checkAllMeasureValidity(ControlNet &cnet, string cubeList) { camera = cube->getCamera(); } catch (IException &e) { - string msg = "Cannot Create Camera for Image:" + cube->getFileName(); + QString msg = "Cannot Create Camera for Image:" + cube->getFileName(); throw IException(e, IException::User, msg, _FILEINFO_); } } @@ -879,8 +876,8 @@ void checkAllMeasureValidity(ControlNet &cnet, string cubeList) { validateMeasure(measure, cube, camera); if (!results.isValid()) { - string failure = results.toString().toStdString(); - string cause = "Validity Check " + failure; + QString failure = results.toString(); + QString cause = "Validity Check " + failure; if (measure == point->GetRefMeasure() && retainRef) { logResult(retainedReferences, point->GetId(), cause); @@ -942,7 +939,7 @@ MeasureValidationResults validateMeasure(const ControlMeasure *measure, } -void logResult(QMap *pointsLog, string pointId, string cause) { +void logResult(QMap *pointsLog, QString pointId, QString cause) { if (keepLog) { // Label the keyword as the Point ID, and make the cause into the value (*pointsLog)[pointId] = cause; @@ -950,8 +947,8 @@ void logResult(QMap *pointsLog, string pointId, string cause) { } -void logResult(QMap *measuresLog, - string pointId, string serial, string cause) { +void logResult(QMap *measuresLog, + QString pointId, QString serial, QString cause) { if (keepLog) { // Make the keyword label the measure Serial Number, and the cause into the @@ -976,12 +973,12 @@ void logResult(QMap *measuresLog, } -PvlObject createLog(string label, QMap *pointsMap) { +PvlObject createLog(QString label, QMap *pointsMap) { PvlObject pointsLog(label); - QList pointIds = pointsMap->keys(); + QList pointIds = pointsMap->keys(); for (int i = 0; i < pointIds.size(); i++) { - string pointId = pointIds.at(i); + QString pointId = pointIds.at(i); pointsLog.AddKeyword(PvlKeyword(pointId, (*pointsMap)[pointId])); } @@ -989,8 +986,8 @@ PvlObject createLog(string label, QMap *pointsMap) { } -PvlObject createLog(string label, - QMap *pointsMap, QMap *measuresMap) { +PvlObject createLog(QString label, + QMap *pointsMap, QMap *measuresMap) { PvlObject editLog(label); @@ -1031,7 +1028,7 @@ void PrintTemp() { */ void EditDefFile(void) { UserInterface &ui = Application::GetUserInterface(); - string sDefFile = ui.GetAsString("DEFFILE"); + QString sDefFile = ui.GetAsString("DEFFILE"); GuiEditFile::EditFile(ui, sDefFile); } diff --git a/isis/src/control/apps/cnetextract/cnetextract.cpp b/isis/src/control/apps/cnetextract/cnetextract.cpp index 098866a759..7283fde328 100644 --- a/isis/src/control/apps/cnetextract/cnetextract.cpp +++ b/isis/src/control/apps/cnetextract/cnetextract.cpp @@ -30,17 +30,17 @@ using namespace std; using namespace Isis; -void ExtractPointList(ControlNet &outNet, QVector &nonListedPoints); -void ExtractLatLonRange(ControlNet &outNet, QVector nonLatLonPoints, - QVector cannotGenerateLatLonPoints, - QMap sn2filename); +void ExtractPointList(ControlNet &outNet, QVector &nonListedPoints); +void ExtractLatLonRange(ControlNet &outNet, QVector nonLatLonPoints, + QVector cannotGenerateLatLonPoints, + QMap sn2filename); bool NotInLatLonRange(SurfacePoint surfacePt, Latitude minlat, Latitude maxlat, Longitude minlon, Longitude maxlon); void WriteCubeOutList(ControlNet cnet, - QMap sn2file, + QMap sn2file, PvlGroup &summary); -void WriteResults(IString filename, - QVector notExtracted, +void WriteResults(QString filename, + QVector notExtracted, PvlGroup &results); void omit(ControlNet &cnet, int cp); void omit(ControlPoint *point, int cm); @@ -51,7 +51,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); if(!ui.WasEntered("FROMLIST") && ui.WasEntered("TOLIST")) { - std::string msg = "To create a [TOLIST] the [FROMLIST] parameter must be provided."; + QString msg = "To create a [TOLIST] the [FROMLIST] parameter must be provided."; throw IException(IException::User, msg, _FILEINFO_); } @@ -69,7 +69,7 @@ void IsisMain() { if(!(noIgnore || noMeasureless || noSingleMeasure || reference || fixed || noTolerancePoints || pointsEntered || cubePoints || latLon)) { - std::string msg = "At least one filter must be selected ["; + QString msg = "At least one filter must be selected ["; msg += "NOIGNORE,NOMEASURELESS,NOSINGLEMEASURE,REFERENCE,FIXED,TOLERANCE,"; msg += "POINTLIST,CUBES,LATLON]"; throw IException(IException::User, msg, _FILEINFO_); @@ -93,9 +93,9 @@ void IsisMain() { inputMeasures += outNet.GetPoint(cp)->GetNumMeasures(); // Set up the Serial Number to FileName mapping - QMap sn2filename; + QMap sn2filename; for(int cubeIndex = 0; cubeIndex < (int)inList.size(); cubeIndex ++) { - IString sn = SerialNumber::Compose(inList[cubeIndex].toString()); + QString sn = SerialNumber::Compose(inList[cubeIndex].toString()); sn2filename[sn] = inList[cubeIndex].toString(); } @@ -105,30 +105,30 @@ void IsisMain() { progress.CheckStatus(); // Set up vector records of how points/measures are removed - QVector ignoredPoints; - QVector ignoredMeasures; - QVector singleMeasurePoints; - QVector measurelessPoints; - QVector tolerancePoints; - QVector nonReferenceMeasures; - QVector nonFixedPoints; - QVector nonCubePoints; - QVector noCubeMeasures; + QVector ignoredPoints; + QVector ignoredMeasures; + QVector singleMeasurePoints; + QVector measurelessPoints; + QVector tolerancePoints; + QVector nonReferenceMeasures; + QVector nonFixedPoints; + QVector nonCubePoints; + QVector noCubeMeasures; // This is commented out since this does not correspond to any filters or the // documentation of this application. I did not delete the code in case we find // that we need it later. J.Backer 2012-06-22 // -// QVector noMeasurePoints; - QVector nonListedPoints; - QVector nonLatLonPoints; - QVector cannotGenerateLatLonPoints; +// QVector noMeasurePoints; + QVector nonListedPoints; + QVector nonLatLonPoints; + QVector cannotGenerateLatLonPoints; // Set up comparison data - QVector serialNumbers; + QVector serialNumbers; if(cubePoints) { FileList cubeList(ui.GetFileName("CUBELIST")); for(int cubeIndex = 0; cubeIndex < (int)cubeList.size(); cubeIndex ++) { - IString sn = SerialNumber::Compose(cubeList[cubeIndex].toString()); + QString sn = SerialNumber::Compose(cubeList[cubeIndex].toString()); serialNumbers.push_back(sn); } } @@ -187,7 +187,7 @@ void IsisMain() { if(noIgnore && newMeasure->IsIgnored()) { //New error with deleting Reference Measures - IString msg = newPoint->GetId() + "," + newMeasure->GetCubeSerialNumber(); + QString msg = newPoint->GetId() + "," + newMeasure->GetCubeSerialNumber(); if(newPoint->GetRefMeasure() != newMeasure) { omit(newPoint, cm); } @@ -202,7 +202,7 @@ void IsisMain() { } else if(cubeMeasures) { bool hasSerialNumber = false; - std::string serialNum = newMeasure->GetCubeSerialNumber(); + QString serialNum = newMeasure->GetCubeSerialNumber(); for(int sn = 0; sn < serialNumbers.size(); sn ++) { if(serialNumbers[sn] == serialNum) { hasSerialNumber = true; @@ -213,7 +213,7 @@ void IsisMain() { // doesn't have serial number if measure is not associated with cubelist // we need to omit appropriate measures if(!hasSerialNumber) { - string msg = newPoint->GetId() + "," + newMeasure->GetCubeSerialNumber(); + QString msg = newPoint->GetId() + "," + newMeasure->GetCubeSerialNumber(); // if this measure is not reference, omit it // if this measure is a reference, but retainReference is off, omit it if(newPoint->GetRefMeasure() != newMeasure || @@ -320,10 +320,10 @@ void IsisMain() { PvlGroup summary("ResultSummary"); PvlGroup results("Results"); - summary.AddKeyword(PvlKeyword("InputPoints", IString(inputPoints))); - summary.AddKeyword(PvlKeyword("InputMeasures", IString(inputMeasures))); - summary.AddKeyword(PvlKeyword("OutputPoints", IString(outputPoints))); - summary.AddKeyword(PvlKeyword("OutputMeasures", IString(outputMeasures))); + summary.AddKeyword(PvlKeyword("InputPoints", toString(inputPoints))); + summary.AddKeyword(PvlKeyword("InputMeasures", toString(inputMeasures))); + summary.AddKeyword(PvlKeyword("OutputPoints", toString(outputPoints))); + summary.AddKeyword(PvlKeyword("OutputMeasures", toString(outputMeasures))); if (outputPoints != 0) { // Write the filenames associated with outNet @@ -355,43 +355,43 @@ void IsisMain() { if(noIgnore) { - summary.AddKeyword(PvlKeyword("IgnoredPoints", IString((int)ignoredPoints.size()))); - summary.AddKeyword(PvlKeyword("IgnoredMeasures", IString((int)ignoredMeasures.size()))); + summary.AddKeyword(PvlKeyword("IgnoredPoints", toString((int)ignoredPoints.size()))); + summary.AddKeyword(PvlKeyword("IgnoredMeasures", toString((int)ignoredMeasures.size()))); } if(noSingleMeasure) { - summary.AddKeyword(PvlKeyword("SingleMeasurePoints", IString((int)singleMeasurePoints.size()))); + summary.AddKeyword(PvlKeyword("SingleMeasurePoints", toString((int)singleMeasurePoints.size()))); } if(noMeasureless) { - summary.AddKeyword(PvlKeyword("MeasurelessPoints", IString((int)measurelessPoints.size()))); + summary.AddKeyword(PvlKeyword("MeasurelessPoints", toString((int)measurelessPoints.size()))); } if(noTolerancePoints) { - summary.AddKeyword(PvlKeyword("TolerancePoints", IString((int)tolerancePoints.size()))); + summary.AddKeyword(PvlKeyword("TolerancePoints", toString((int)tolerancePoints.size()))); } if(reference) { - summary.AddKeyword(PvlKeyword("NonReferenceMeasures", IString((int)nonReferenceMeasures.size()))); + summary.AddKeyword(PvlKeyword("NonReferenceMeasures", toString((int)nonReferenceMeasures.size()))); } if(fixed) { - summary.AddKeyword(PvlKeyword("NonFixedPoints", IString((int)nonFixedPoints.size()))); + summary.AddKeyword(PvlKeyword("NonFixedPoints", toString((int)nonFixedPoints.size()))); } if(cubePoints) { - summary.AddKeyword(PvlKeyword("NonCubePoints", IString((int)nonCubePoints.size()))); + summary.AddKeyword(PvlKeyword("NonCubePoints", toString((int)nonCubePoints.size()))); } // This is commented out since this does not correspond to any filters or the // documentation of this application. I did not delete the code in case we find // that we need it later. J.Backer 2012-06-22 // // if(noMeasurePoints.size() != 0) { -// summary.AddKeyword(PvlKeyword("NoCubeMeasure", IString((int)noMeasurePoints.size()))); +// summary.AddKeyword(PvlKeyword("NoCubeMeasure", toString((int)noMeasurePoints.size()))); // } if(cubeMeasures) { - summary.AddKeyword(PvlKeyword("NonCubeMeasures", IString((int)noCubeMeasures.size()))); + summary.AddKeyword(PvlKeyword("NonCubeMeasures", toString((int)noCubeMeasures.size()))); } if(pointsEntered) { - summary.AddKeyword(PvlKeyword("NonListedPoints", IString((int)nonListedPoints.size()))); + summary.AddKeyword(PvlKeyword("NonListedPoints", toString((int)nonListedPoints.size()))); } if(latLon) { - summary.AddKeyword(PvlKeyword("LatLonOutOfRange", IString((int)nonLatLonPoints.size()))); - summary.AddKeyword(PvlKeyword("NoLatLonPoints", IString((int)cannotGenerateLatLonPoints.size()))); + summary.AddKeyword(PvlKeyword("LatLonOutOfRange", toString((int)nonLatLonPoints.size()))); + summary.AddKeyword(PvlKeyword("NoLatLonPoints", toString((int)cannotGenerateLatLonPoints.size()))); } outProgress.CheckStatus(); @@ -413,54 +413,54 @@ void IsisMain() { resultsProgress.SetMaximumSteps(11); resultsProgress.CheckStatus(); - std::string prefix = ui.GetString("PREFIX"); + QString prefix = ui.GetString("PREFIX"); if(noIgnore) { - IString namecp = FileName(prefix + "IgnoredPoints.txt").expanded(); + QString namecp = FileName(prefix + "IgnoredPoints.txt").expanded(); WriteResults(namecp, ignoredPoints, results); - IString namecm = FileName(prefix + "IgnoredMeasures.txt").expanded(); + QString namecm = FileName(prefix + "IgnoredMeasures.txt").expanded(); WriteResults(namecm, ignoredMeasures, results); } resultsProgress.CheckStatus(); if(noSingleMeasure) { - IString name = FileName(prefix + "SingleMeasurePoints.txt").expanded(); + QString name = FileName(prefix + "SingleMeasurePoints.txt").expanded(); WriteResults(name, singleMeasurePoints, results); } resultsProgress.CheckStatus(); if(noMeasureless) { - IString name = FileName(prefix + "MeasurelessPoints.txt").expanded(); + QString name = FileName(prefix + "MeasurelessPoints.txt").expanded(); WriteResults(name, measurelessPoints, results); } resultsProgress.CheckStatus(); if(noTolerancePoints) { - IString name = FileName(prefix + "TolerancePoints.txt").expanded(); + QString name = FileName(prefix + "TolerancePoints.txt").expanded(); WriteResults(name, tolerancePoints, results); } resultsProgress.CheckStatus(); if(reference) { - IString name = FileName(prefix + "NonReferenceMeasures.txt").expanded(); + QString name = FileName(prefix + "NonReferenceMeasures.txt").expanded(); WriteResults(name, nonReferenceMeasures, results); } resultsProgress.CheckStatus(); if(fixed) { - IString name = FileName(prefix + "NonFixedPoints.txt").expanded(); + QString name = FileName(prefix + "NonFixedPoints.txt").expanded(); WriteResults(name, nonFixedPoints, results); } resultsProgress.CheckStatus(); if(cubePoints) { - IString name = FileName(prefix + "NonCubePoints.txt").expanded(); + QString name = FileName(prefix + "NonCubePoints.txt").expanded(); WriteResults(name, nonCubePoints, results); } @@ -471,30 +471,30 @@ void IsisMain() { // that we need it later. J.Backer 2012-06-22 // // if(noMeasurePoints.size() != 0) { -// IString name = FileName(prefix + "NoMeasurePoints.txt").expanded(); +// QString name = FileName(prefix + "NoMeasurePoints.txt").expanded(); // WriteResults(name, noMeasurePoints); // } resultsProgress.CheckStatus(); if(cubeMeasures) { - IString name = FileName(prefix + "NonCubeMeasures.txt").expanded(); + QString name = FileName(prefix + "NonCubeMeasures.txt").expanded(); WriteResults(name, noCubeMeasures, results); } resultsProgress.CheckStatus(); if(pointsEntered) { - IString name = FileName(prefix + "NonListedPoints.txt").expanded(); + QString name = FileName(prefix + "NonListedPoints.txt").expanded(); WriteResults(name, nonListedPoints, results); } resultsProgress.CheckStatus(); if(latLon) { - IString namenon = FileName(prefix + "LatLonOutOfRange.txt").expanded(); + QString namenon = FileName(prefix + "LatLonOutOfRange.txt").expanded(); WriteResults(namenon, nonLatLonPoints, results); - IString namegen = FileName(prefix + "NoLatLonPoints.txt").expanded(); + QString namegen = FileName(prefix + "NoLatLonPoints.txt").expanded(); WriteResults(namegen, cannotGenerateLatLonPoints, results); } @@ -519,7 +519,7 @@ void IsisMain() { * reference so that this information could be * accessed in the main program. */ -void ExtractPointList(ControlNet &outNet, QVector &nonListedPoints) { +void ExtractPointList(ControlNet &outNet, QVector &nonListedPoints) { UserInterface &ui = Application::GetUserInterface(); // Use the file list class for functionality @@ -534,9 +534,9 @@ void ExtractPointList(ControlNet &outNet, QVector &nonListedPoints) { // loop through line numbers of POINTLIST until we find a point ID in the // list that matches this control point's ID for(int i = 0; i < (int)listedPoints.size() && !isInList; i++) { - IString pointId = listedPoints[i].toString(); + QString pointId = listedPoints[i].toString(); // isInList is true if these strings are equal - isInList = pointId.Equal(controlpt->GetId()); + isInList = pointId.toLower() == controlpt->GetId().toLower(); } if(!isInList) { nonListedPoints.append(controlpt->GetId()); @@ -558,8 +558,8 @@ void ExtractPointList(ControlNet &outNet, QVector &nonListedPoints) { * due to the inability to calculate the lat/lon for that * point */ -void ExtractLatLonRange(ControlNet &outNet, QVector nonLatLonPoints, - QVector cannotGenerateLatLonPoints, QMap sn2filename) { +void ExtractLatLonRange(ControlNet &outNet, QVector nonLatLonPoints, + QVector cannotGenerateLatLonPoints, QMap sn2filename) { if(outNet.GetNumPoints() == 0) { return; } @@ -602,7 +602,7 @@ void ExtractLatLonRange(ControlNet &outNet, QVector nonLatLonPoints, // Find a cube in the Control Point to get the lat/lon from int cm = 0; - IString sn = ""; + QString sn = ""; Latitude lat; Longitude lon; Distance radius; @@ -614,9 +614,9 @@ void ExtractLatLonRange(ControlNet &outNet, QVector nonLatLonPoints, } // Search for other Control Measures if needed - if(sn.empty()) { + if(sn.isEmpty()) { // Find the Serial Number if it exists - for(int cm = 0; (cm < controlPt->GetNumMeasures()) && sn.empty(); cm ++) { + for(int cm = 0; (cm < controlPt->GetNumMeasures()) && sn.isEmpty(); cm ++) { if(!sn2filename[controlPt->GetReferenceSN()].length() == 0) { sn = controlPt->GetReferenceSN(); } @@ -624,7 +624,7 @@ void ExtractLatLonRange(ControlNet &outNet, QVector nonLatLonPoints, } // Connot fine a cube to get the lat/lon from - if(sn.empty()) { + if(sn.isEmpty()) { cannotGenerateLatLonPoints.push_back(controlPt->GetId()); omit(outNet, cp); } @@ -724,7 +724,7 @@ bool NotInLatLonRange(SurfacePoint surfacePtToTest, Latitude minlat, outRange = !lat.inRange(minlat, maxlat) || !lon.inRange(minlon, maxlon); } catch (IException &e) { - IString msg = "Cannot complete lat/lon range test with given filters"; + QString msg = "Cannot complete lat/lon range test with given filters"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -743,7 +743,7 @@ bool NotInLatLonRange(SurfacePoint surfacePtToTest, Latitude minlat, * to filenames. */ void WriteCubeOutList(ControlNet cnet, - QMap sn2file, + QMap sn2file, PvlGroup &summary) { UserInterface &ui = Application::GetUserInterface(); @@ -754,14 +754,14 @@ void WriteCubeOutList(ControlNet cnet, p.CheckStatus(); } catch(IException &e) { - std::string msg = "Unable to write the output cube list, [TOLIST]."; + QString msg = "Unable to write the output cube list, [TOLIST]."; throw IException(e, IException::User, msg, _FILEINFO_); } - std::set outputsn; + std::set outputsn; for(int cp = 0; cp < cnet.GetNumPoints(); cp ++) { for(int cm = 0; cm < cnet.GetPoint(cp)->GetNumMeasures(); cm ++) { - IString sn = cnet.GetPoint(cp)->GetMeasure(cm)->GetCubeSerialNumber(); + QString sn = cnet.GetPoint(cp)->GetMeasure(cm)->GetCubeSerialNumber(); if (sn2file[sn].length() != 0) { outputsn.insert(sn); } @@ -778,12 +778,12 @@ void WriteCubeOutList(ControlNet cnet, return; } - std::string toList = ui.GetFileName("TOLIST"); + QString toList = ui.GetFileName("TOLIST"); std::ofstream out_stream; - out_stream.open(toList.c_str(), std::ios::out); + out_stream.open(toList.toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); //Start writing from beginning of file - for(std::set::iterator sn = outputsn.begin(); sn != outputsn.end(); sn ++) { + for(std::set::iterator sn = outputsn.begin(); sn != outputsn.end(); sn ++) { // moved the "if" statement to the previous for loop to prevent creating // an empty file //if(!sn2file[(*sn)].length() == 0) { @@ -805,8 +805,8 @@ void WriteCubeOutList(ControlNet cnet, * report. * @param results A reference to the results PvlGroup address. */ -void WriteResults(IString filename, - QVector notExtracted, +void WriteResults(QString filename, + QVector notExtracted, PvlGroup &results) { // if no points or measures are being extracted, // we will not create the filter report. @@ -819,7 +819,7 @@ void WriteResults(IString filename, // Set up the output file for writing std::ofstream out_stream; - out_stream.open(filename.c_str(), std::ios::out); + out_stream.open(filename.toAscii().data(), std::ios::out); out_stream.seekp(0, std::ios::beg); //Start writing from beginning of file out_stream << notExtracted[0]; diff --git a/isis/src/control/apps/cnethist/cnethist.cpp b/isis/src/control/apps/cnethist/cnethist.cpp index 5317e63eed..1d5a5dc8e3 100644 --- a/isis/src/control/apps/cnethist/cnethist.cpp +++ b/isis/src/control/apps/cnethist/cnethist.cpp @@ -1,6 +1,6 @@ #include "Isis.h" -#include +#include #include #include @@ -41,7 +41,7 @@ void IsisMain() { //setup plot tile and axis labels (if any) if(ui.IsInteractive()) { // Set the title for the dialog - string title; + QString title; if(ui.WasEntered("TITLE")) { title = ui.GetString("TITLE"); } @@ -51,26 +51,26 @@ void IsisMain() { // Create the QHistogram, set the title & load the Isis::Histogram into it - plot = new HistogramPlotWindow(title.c_str(), ui.TheGui()); + plot = new HistogramPlotWindow(title.toAscii().data(), ui.TheGui()); // Set the xaxis title if they entered one if(ui.WasEntered("XAXIS")) { - string xaxis(ui.GetString("XAXIS")); - plot->setAxisLabel(QwtPlot::xBottom, xaxis.c_str()); + QString xaxis(ui.GetString("XAXIS")); + plot->setAxisLabel(QwtPlot::xBottom, xaxis.toAscii().data()); } // Set the yLeft axis title if they entered one if(ui.WasEntered("FREQAXIS")) { - string yaxis(ui.GetString("FREQAXIS")); - plot->setAxisLabel(QwtPlot::yLeft, yaxis.c_str()); + QString yaxis(ui.GetString("FREQAXIS")); + plot->setAxisLabel(QwtPlot::yLeft, yaxis); } else { - string yaxis = "Frequencey"; - plot->setAxisLabel(QwtPlot::yLeft, yaxis.c_str()); + QString yaxis = "Frequencey"; + plot->setAxisLabel(QwtPlot::yLeft, yaxis); } - string yaxis = ""; - plot->setAxisLabel(QwtPlot::yRight, yaxis.c_str()); + QString yaxis = ""; + plot->setAxisLabel(QwtPlot::yRight, yaxis); } //open text report file (if any) @@ -79,11 +79,11 @@ void IsisMain() { // Write the results if(!ui.WasEntered("TO")) { - string msg = "The [TO] parameter must be entered"; + QString msg = "The [TO] parameter must be entered"; throw IException(IException::User, msg, _FILEINFO_); } - string outfile = ui.GetFileName("TO"); - fout.open(outfile.c_str()); + QString outfile = ui.GetFileName("TO"); + fout.open(outfile.toAscii().data()); } //loop throught the control nets writing reports and drawing histograms as needed @@ -95,7 +95,7 @@ void IsisMain() { hist = new Histogram(net, &ControlMeasure::GetResidualMagnitude, ui.GetDouble("BIN_WIDTH")); } catch (IException &e) { - string msg = "The follwoing error was thrown while building a histogram from netfile [" + + QString msg = "The follwoing error was thrown while building a histogram from netfile [" + fList[i].expanded() + "]: " +e.toString() + "\n"; if (ui.IsInteractive()) //if in gui mode print the error message to the terminal Application::GuiLog(msg); @@ -161,7 +161,7 @@ void IsisMain() { CubePlotCurve *histCurve = new CubePlotCurve(CubePlotCurve::CubeDN, CubePlotCurve::Percentage); histCurve->setColor(curveColor(i)); - IString baseName = FileName(fList[i]).baseName(); + QString baseName = FileName(fList[i]).baseName(); histCurve->setTitle(baseName); diff --git a/isis/src/control/apps/cnetmerge/cnetmerge.cpp b/isis/src/control/apps/cnetmerge/cnetmerge.cpp index a21b5d1551..f27e69fa35 100644 --- a/isis/src/control/apps/cnetmerge/cnetmerge.cpp +++ b/isis/src/control/apps/cnetmerge/cnetmerge.cpp @@ -15,12 +15,11 @@ #include "IException.h" #include "iTime.h" -using std::string; using namespace Isis; ControlNet * mergeNetworks(FileList &filelist, PvlObject &conflictLog, - IString networkId, IString description); + QString networkId, QString description); void mergeNetwork(ControlNet &baseNet, ControlNet &newNet, PvlObject &cnetLog); ControlPoint * mergePoint( @@ -48,8 +47,8 @@ PvlObject createNetworkLog(ControlNet &cnet); PvlObject createPointLog(ControlPoint *point); PvlGroup createMeasureLog(); -void reportConflict(PvlObject &pointLog, IString conflict); -void reportConflict(PvlGroup &measureLog, IString cn, IString conflict); +void reportConflict(PvlObject &pointLog, QString conflict); +void reportConflict(PvlGroup &measureLog, QString cn, QString conflict); void addLog(PvlObject &conflictLog, PvlObject &cnetLog); void addLog(PvlObject &cnetLog, PvlObject &pointLog, PvlGroup &measureLog); @@ -62,7 +61,7 @@ bool overwriteMissing; bool report; bool mergePoints; -string logName; +QString logName; void IsisMain() { @@ -74,7 +73,7 @@ void IsisMain() { if (ui.WasEntered("BASE")) { // User has chosen an explicit base network - string baseName = ui.GetFileName("BASE"); + QString baseName = ui.GetFileName("BASE"); FileName baseFileName(baseName); // Remove the base network from the list if it is present @@ -101,7 +100,7 @@ void IsisMain() { // Check after taking into account an explicit base network if we have at // least two networks to merge if (filelist.size() < 2) { - string msg = "CLIST [" + ui.GetFileName("CLIST") + "] and BASE [" + + QString msg = "CLIST [" + ui.GetFileName("CLIST") + "] and BASE [" + (ui.WasEntered("BASE") ? ui.GetFileName("BASE") : "Automatic") + "] must total to at least two distinct filenames: " "a base network and a new network"; @@ -159,7 +158,7 @@ void IsisMain() { ControlNet * mergeNetworks(FileList &filelist, PvlObject &conflictLog, - IString networkId, IString description) { + QString networkId, QString description) { if (!mergePoints) { bool hasDuplicates = false; @@ -179,16 +178,16 @@ ControlNet * mergeNetworks(FileList &filelist, PvlObject &conflictLog, PvlObject duplicate("Duplicate"); duplicate.AddKeyword(PvlKeyword("PointId", point->GetId())); duplicate.AddKeyword(PvlKeyword( - "SourceNetwork", pointSources[point->GetId()].toStdString())); + "SourceNetwork", pointSources[point->GetId()])); duplicate.AddKeyword(PvlKeyword("AddNetwork", cnetName.name())); errors.AddObject(duplicate); } else { // User has disallowed merging points, so throw an error - string msg = "Add network [" + cnetName.name() + "] contains " + QString msg = "Add network [" + cnetName.name() + "] contains " "Control Point with ID [" + point->GetId() + "] already " "contained within source network [" + - pointSources[point->GetId()].toStdString() + "]. " + pointSources[point->GetId()] + "]. " "Set DUPLICATEPOINTS=MERGE to merge conflicting Control Points"; throw IException(IException::User, msg, _FILEINFO_); } @@ -204,7 +203,7 @@ ControlNet * mergeNetworks(FileList &filelist, PvlObject &conflictLog, outPvl.AddObject(errors); outPvl.Write(logName); - string msg = "Networks contained duplicate points. See log file [" + + QString msg = "Networks contained duplicate points. See log file [" + FileName(logName).name() + "] for details. " "Set DUPLICATEPOINTS=MERGE to merge conflicting Control Points"; throw IException(IException::User, msg, _FILEINFO_); @@ -234,8 +233,8 @@ ControlNet * mergeNetworks(FileList &filelist, PvlObject &conflictLog, ControlNet newNet(currentCnetFileName.expanded()); // Networks can only be merged if the targets are the same - if (baseNet->GetTarget().DownCase() != newNet.GetTarget().DownCase()) { - string msg = "Input [" + newNet.GetNetworkId() + "] does not target the " + if (baseNet->GetTarget().toLower() != newNet.GetTarget().toLower()) { + QString msg = "Input [" + newNet.GetNetworkId() + "] does not target the " "same target as other Control Network(s)"; throw IException(IException::User, msg, _FILEINFO_); } @@ -488,7 +487,7 @@ PvlGroup createMeasureLog() { } -void reportConflict(PvlObject &pointLog, IString conflict) { +void reportConflict(PvlObject &pointLog, QString conflict) { // Add a point conflict message to the point log if we're reporting these // conflicts to a log file if (report) { @@ -498,7 +497,7 @@ void reportConflict(PvlObject &pointLog, IString conflict) { } -void reportConflict(PvlGroup &measureLog, IString sn, IString conflict) { +void reportConflict(PvlGroup &measureLog, QString sn, QString conflict) { // Add a measure conflict message to the measure log if we're reporting these // conflicts to a log file if (report) { diff --git a/isis/src/control/apps/cnetnewradii/cnetnewradii.cpp b/isis/src/control/apps/cnetnewradii/cnetnewradii.cpp index 90da93bc05..076d5acc20 100644 --- a/isis/src/control/apps/cnetnewradii/cnetnewradii.cpp +++ b/isis/src/control/apps/cnetnewradii/cnetnewradii.cpp @@ -26,7 +26,7 @@ void IsisMain() { ControlNet cnet(ui.GetFileName("CNET")); // Get input DEM cube and get ground map for it - string demFile = ui.GetFileName("MODEL"); + QString demFile = ui.GetFileName("MODEL"); Cube demCube; demCube.open(demFile); UniversalGroundMap *ugm = NULL; @@ -58,7 +58,7 @@ void IsisMain() { newRadiiSource = Apriori; } else { - string msg = "The value for parameter GETLATLON ["; + QString msg = "The value for parameter GETLATLON ["; msg += ui.GetAsString("GETLATLON") + "] must be provided."; throw IException(IException::User, msg, _FILEINFO_); } @@ -67,7 +67,7 @@ void IsisMain() { int numFailures = 0; int numConstrainedFixed = 0; int numLocked = 0; - string failedIDs = ""; + QString failedIDs = ""; for (int i = 0; i < cnet.GetNumPoints() ; i++) { ControlPoint *cp = cnet.GetPoint(i); @@ -137,12 +137,12 @@ void IsisMain() { if (numSuccesses == 0) { if (numConstrainedFixed == 0) { - string msg = "There were no Fixed or Constrained points in this network." + QString msg = "There were no Fixed or Constrained points in this network." " No radii were replaced."; throw IException(IException::User, msg, _FILEINFO_); } else { - string msg = "No valid radii can be calculated. Verify that the DEM [" + + QString msg = "No valid radii can be calculated. Verify that the DEM [" + ui.GetAsString("MODEL") + "] is valid."; throw IException(IException::User, msg, _FILEINFO_); } @@ -153,11 +153,11 @@ void IsisMain() { // Write results to Logs // Summary group is created with the counts of successes and failures PvlGroup summaryGroup = PvlGroup("Summary"); - summaryGroup.AddKeyword(PvlKeyword("Successes", numSuccesses)); - summaryGroup.AddKeyword(PvlKeyword("Failures", numFailures)); + summaryGroup.AddKeyword(PvlKeyword("Successes", toString(numSuccesses))); + summaryGroup.AddKeyword(PvlKeyword("Failures", toString(numFailures))); summaryGroup.AddKeyword(PvlKeyword("NumberFixedConstrainedPoints", - numConstrainedFixed)); - summaryGroup.AddKeyword(PvlKeyword("NumberEditLockedPoints", numLocked)); + toString(numConstrainedFixed))); + summaryGroup.AddKeyword(PvlKeyword("NumberEditLockedPoints", toString(numLocked))); bool errorlog; FileName errorlogFile; diff --git a/isis/src/control/apps/cnetref/CnetRefByEmission.cpp b/isis/src/control/apps/cnetref/CnetRefByEmission.cpp index b206d5ae03..77a65c8cc5 100644 --- a/isis/src/control/apps/cnetref/CnetRefByEmission.cpp +++ b/isis/src/control/apps/cnetref/CnetRefByEmission.cpp @@ -22,7 +22,7 @@ namespace Isis { * @param pPvlDef - Pvl Definition File * @param psSerialNumfile - Serial Number file attached to the ControlNet */ - CnetRefByEmission::CnetRefByEmission(Pvl *pPvlDef, std::string psSerialNumfile) + CnetRefByEmission::CnetRefByEmission(Pvl *pPvlDef, QString psSerialNumfile) : ControlNetValidMeasure(pPvlDef) { ReadSerialNumbers(psSerialNumfile); SetCameraRequiredFlag(true); @@ -79,7 +79,7 @@ namespace Isis { int iRefIndex = -1; if (newPnt->IsReferenceExplicit()) iRefIndex = newPnt->IndexOfRefMeasure(); - IString istrTemp; + QString istrTemp; std::vector pvlGrpVector; std::vector bestEmissionAngle; @@ -92,7 +92,7 @@ namespace Isis { if (!newPnt->IsIgnored() && newPnt->GetType() == ControlPoint::Free && numMeasures > 0 && (iNumMeasuresLocked == 0 || (iNumMeasuresLocked > 0 && bRefLocked))) { int iNumIgnore = 0; - IString istrTemp; + QString istrTemp; double dBestEmissionAngle = 135; for (int measure = 0; measure < numMeasures; ++measure) { @@ -103,7 +103,7 @@ namespace Isis { newMsr->SetChooserName("Application cnetref(Emission)"); } - std::string sn = newMsr->GetCubeSerialNumber(); + QString sn = newMsr->GetCubeSerialNumber(); double dSample = newMsr->GetSample(); double dLine = newMsr->GetLine(); @@ -188,32 +188,32 @@ namespace Isis { else { int iComment = 0; if (numMeasures == 0) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "No Measures in the Point"); } if (newPnt->IsIgnored()) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Point was originally Ignored"); } if (origPnt.GetType() == ControlPoint::Fixed) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Fixed Point"); } else if (newPnt->GetType() == ControlPoint::Constrained) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Constrained Point"); } if (iNumMeasuresLocked > 0 && !bRefLocked) { pvlPointObj += Isis::PvlKeyword("Error", "Point has a Measure with EditLock set to true " "but the Reference is not Locked"); - //std::string message = "Invalid Nearest Resolution Value"; + //QString message = "Invalid Nearest Resolution Value"; //throw Isis::iException::Message(Isis::iException::User, message, _FILEINFO_); bError = true; } @@ -238,11 +238,11 @@ namespace Isis { pvlRefChangeGrp += Isis::PvlKeyword("PrevSerialNumber", origPnt.GetReferenceSN()); pvlRefChangeGrp += Isis::PvlKeyword("PrevEmAngle", - bestEmissionAngle[iRefIndex]); + toString(bestEmissionAngle[iRefIndex])); - istrTemp = IString((int)origPnt.GetMeasure(iRefIndex)->GetSample()); + istrTemp = toString((int)origPnt.GetMeasure(iRefIndex)->GetSample()); istrTemp += ","; - istrTemp += IString((int)origPnt.GetMeasure(iRefIndex)->GetLine()); + istrTemp += toString((int)origPnt.GetMeasure(iRefIndex)->GetLine()); pvlRefChangeGrp += Isis::PvlKeyword("PrevLocation", istrTemp); } else { @@ -252,11 +252,11 @@ namespace Isis { pvlRefChangeGrp += Isis::PvlKeyword("NewSerialNumber", newPnt->GetMeasure(iBestIndex)->GetCubeSerialNumber()); pvlRefChangeGrp += Isis::PvlKeyword("NewLeastEmAngle", - bestEmissionAngle[iBestIndex]); + toString(bestEmissionAngle[iBestIndex])); - istrTemp = IString((int)newPnt->GetMeasure(iBestIndex)->GetSample()); + istrTemp = toString((int)newPnt->GetMeasure(iBestIndex)->GetSample()); istrTemp += ","; - istrTemp += IString((int)newPnt->GetMeasure(iBestIndex)->GetLine()); + istrTemp += toString((int)newPnt->GetMeasure(iBestIndex)->GetLine()); pvlRefChangeGrp += Isis::PvlKeyword("NewLocation", istrTemp); pvlPointObj += pvlRefChangeGrp; @@ -270,9 +270,9 @@ namespace Isis { }// end Point // CnetRef Change Statistics - mStatisticsGrp += Isis::PvlKeyword("PointsModified", iPointsModified); - mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", iRefChanged); - mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", iMeasuresModified); + mStatisticsGrp += Isis::PvlKeyword("PointsModified", toString(iPointsModified)); + mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", toString(iRefChanged)); + mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", toString(iMeasuresModified)); mPvlLog += mStatisticsGrp; } diff --git a/isis/src/control/apps/cnetref/CnetRefByEmission.h b/isis/src/control/apps/cnetref/CnetRefByEmission.h index 65c2041d2c..2794a6b4fe 100644 --- a/isis/src/control/apps/cnetref/CnetRefByEmission.h +++ b/isis/src/control/apps/cnetref/CnetRefByEmission.h @@ -67,7 +67,7 @@ namespace Isis { class CnetRefByEmission : public ControlNetValidMeasure { public: //! Constructor - CnetRefByEmission(Pvl *pPvlDef, std::string msSerialNumfile); + CnetRefByEmission(Pvl *pPvlDef, QString msSerialNumfile); virtual ~CnetRefByEmission() {}; //! Get the Log updated by this object diff --git a/isis/src/control/apps/cnetref/CnetRefByIncidence.cpp b/isis/src/control/apps/cnetref/CnetRefByIncidence.cpp index 2dfb0e34d3..1ddd4a76d3 100644 --- a/isis/src/control/apps/cnetref/CnetRefByIncidence.cpp +++ b/isis/src/control/apps/cnetref/CnetRefByIncidence.cpp @@ -19,7 +19,7 @@ namespace Isis { * @param pPvlDef - Pvl Definition File * @param psSerialNumfile - Serial Number file attached to the ControlNet */ - CnetRefByIncidence::CnetRefByIncidence(Pvl *pPvlDef, std::string psSerialNumfile) + CnetRefByIncidence::CnetRefByIncidence(Pvl *pPvlDef, QString psSerialNumfile) : ControlNetValidMeasure(pPvlDef) { ReadSerialNumbers(psSerialNumfile); SetCameraRequiredFlag(true); @@ -74,7 +74,7 @@ namespace Isis { int iRefIndex = -1; if (newPnt->IsReferenceExplicit()) iRefIndex = newPnt->IndexOfRefMeasure(); - IString istrTemp; + QString istrTemp; std::vector pvlGrpVector; std::vector bestIncidenceAngle; @@ -87,7 +87,7 @@ namespace Isis { if (!newPnt->IsIgnored() && newPnt->GetType() == ControlPoint::Free && numMeasures > 0 && (iNumMeasuresLocked == 0 || (iNumMeasuresLocked > 0 && bRefLocked))) { int iNumIgnore = 0; - IString istrTemp; + QString istrTemp; double dBestIncidenceAngle = 135; for (int measure = 0; measure < numMeasures; ++measure) { @@ -100,7 +100,7 @@ namespace Isis { newMsr->SetChooserName("Application cnetref(Incidence)"); } - std::string sn = newMsr->GetCubeSerialNumber(); + QString sn = newMsr->GetCubeSerialNumber(); double dSample = newMsr->GetSample(); double dLine = newMsr->GetLine(); @@ -185,25 +185,25 @@ namespace Isis { else { int iComment = 0; if (numMeasures == 0) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "No Measures in the Point"); } if (newPnt->IsIgnored()) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Point was originally Ignored"); } if (origPnt.GetType() == ControlPoint::Fixed) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Fixed Point"); } else if (newPnt->GetType() == ControlPoint::Constrained) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Constrained Point"); } @@ -233,11 +233,11 @@ namespace Isis { if (iRefIndex >= 0) { pvlRefChangeGrp += Isis::PvlKeyword("PrevSerialNumber", origPnt.GetMeasure(iRefIndex)->GetCubeSerialNumber()); - pvlRefChangeGrp += Isis::PvlKeyword("PrevIncAngle", bestIncidenceAngle[iRefIndex]); + pvlRefChangeGrp += Isis::PvlKeyword("PrevIncAngle", toString(bestIncidenceAngle[iRefIndex])); - istrTemp = IString((int)origPnt.GetMeasure(iRefIndex)->GetSample()); + istrTemp = toString((int)origPnt.GetMeasure(iRefIndex)->GetSample()); istrTemp += ","; - istrTemp += IString((int)origPnt.GetMeasure(iRefIndex)->GetLine()); + istrTemp += toString((int)origPnt.GetMeasure(iRefIndex)->GetLine()); pvlRefChangeGrp += Isis::PvlKeyword("PrevLocation", istrTemp); } else { @@ -246,11 +246,11 @@ namespace Isis { pvlRefChangeGrp += Isis::PvlKeyword("NewSerialNumber", newPnt->GetMeasure(iBestIndex)->GetCubeSerialNumber()); - pvlRefChangeGrp += Isis::PvlKeyword("NewLeastIncAngle", bestIncidenceAngle[iBestIndex]); + pvlRefChangeGrp += Isis::PvlKeyword("NewLeastIncAngle", toString(bestIncidenceAngle[iBestIndex])); - istrTemp = IString((int)newPnt->GetMeasure(iBestIndex)->GetSample()); + istrTemp = toString((int)newPnt->GetMeasure(iBestIndex)->GetSample()); istrTemp += ","; - istrTemp += IString((int)newPnt->GetMeasure(iBestIndex)->GetLine()); + istrTemp += toString((int)newPnt->GetMeasure(iBestIndex)->GetLine()); pvlRefChangeGrp += Isis::PvlKeyword("NewLocation", istrTemp); pvlPointObj += pvlRefChangeGrp; @@ -264,9 +264,9 @@ namespace Isis { }// end Point // CnetRef Change Statistics - mStatisticsGrp += Isis::PvlKeyword("PointsModified", iPointsModified); - mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", iRefChanged); - mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", iMeasuresModified); + mStatisticsGrp += Isis::PvlKeyword("PointsModified", toString(iPointsModified)); + mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", toString(iRefChanged)); + mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", toString(iMeasuresModified)); mPvlLog += mStatisticsGrp; } diff --git a/isis/src/control/apps/cnetref/CnetRefByIncidence.h b/isis/src/control/apps/cnetref/CnetRefByIncidence.h index 8777b63dbd..33bfd03137 100644 --- a/isis/src/control/apps/cnetref/CnetRefByIncidence.h +++ b/isis/src/control/apps/cnetref/CnetRefByIncidence.h @@ -65,7 +65,7 @@ namespace Isis { class CnetRefByIncidence : public ControlNetValidMeasure { public: //! Constructor - CnetRefByIncidence(Pvl *pPvlDef, std::string msSerialNumfile); + CnetRefByIncidence(Pvl *pPvlDef, QString msSerialNumfile); virtual ~CnetRefByIncidence() {}; //! Get the Log updated by this object diff --git a/isis/src/control/apps/cnetref/CnetRefByResolution.cpp b/isis/src/control/apps/cnetref/CnetRefByResolution.cpp index 53ef2d9c93..43929b030e 100644 --- a/isis/src/control/apps/cnetref/CnetRefByResolution.cpp +++ b/isis/src/control/apps/cnetref/CnetRefByResolution.cpp @@ -27,7 +27,7 @@ namespace Isis { * @param pdMinRes - Min Resolution value * @param pdMaxRes - Max Resolution value */ - CnetRefByResolution::CnetRefByResolution(Pvl *pPvlDef, std::string psSerialNumfile, + CnetRefByResolution::CnetRefByResolution(Pvl *pPvlDef, QString psSerialNumfile, ResolutionType peType, double pdResValue, double pdMinRes, double pdMaxRes) : ControlNetValidMeasure(pPvlDef) { mdResValue = pdResValue; @@ -91,7 +91,7 @@ namespace Isis { int iRefIndex = -1; if (newPnt->IsReferenceExplicit()) iRefIndex = newPnt->IndexOfRefMeasure(); - IString istrTemp; + QString istrTemp; std::vector pvlGrpVector; int iBestIndex = 0; @@ -103,13 +103,13 @@ namespace Isis { if (!newPnt->IsIgnored() && newPnt->GetType() == ControlPoint::Free && numMeasures > 0 && (iNumMeasuresLocked == 0 || (iNumMeasuresLocked > 0 && bRefLocked))) { int iNumIgnore = 0; - IString istrTemp; + QString istrTemp; for (int measure = 0; measure < newPnt->GetNumMeasures(); ++measure) { ControlMeasure *newMsr = newPnt->GetMeasure(measure); bool bMeasureLocked = newMsr->IsEditLocked(); double dSample = newMsr->GetSample(); double dLine = newMsr->GetLine(); - std::string sn = newMsr->GetCubeSerialNumber(); + QString sn = newMsr->GetCubeSerialNumber(); if (!bPntEditLock && !bMeasureLocked) { newMsr->SetDateTime(Application::DateTime()); @@ -202,25 +202,25 @@ namespace Isis { else { int iComment = 0; if (numMeasures == 0) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += QString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "No Measures in the Point"); } if (newPnt->IsIgnored()) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += QString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Point was originally Ignored"); } if (newPnt->GetType() == ControlPoint::Fixed) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += QString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Fixed Point"); } else if (newPnt->GetType() == ControlPoint::Constrained) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += QString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Constrained Point"); } @@ -250,11 +250,11 @@ namespace Isis { if (iRefIndex >= 0) { pvlRefChangeGrp += Isis::PvlKeyword("PrevSerialNumber", origPnt.GetMeasure(iRefIndex)->GetCubeSerialNumber()); - pvlRefChangeGrp += Isis::PvlKeyword("PrevResolution", mdResVector[iRefIndex]); + pvlRefChangeGrp += Isis::PvlKeyword("PrevResolution", toString(mdResVector[iRefIndex])); - istrTemp = IString((int)origPnt.GetMeasure(iRefIndex)->GetSample()); + istrTemp = QString((int)origPnt.GetMeasure(iRefIndex)->GetSample()); istrTemp += ","; - istrTemp += IString((int)origPnt.GetMeasure(iRefIndex)->GetLine()); + istrTemp += QString((int)origPnt.GetMeasure(iRefIndex)->GetLine()); pvlRefChangeGrp += Isis::PvlKeyword("PrevLocation", istrTemp); } else { @@ -263,12 +263,12 @@ namespace Isis { pvlRefChangeGrp += Isis::PvlKeyword("NewSerialNumber", newPnt->GetMeasure(iBestIndex)->GetCubeSerialNumber()); - std::string sKeyName = "NewHighestResolution"; + QString sKeyName = "NewHighestResolution"; if (meType == Low) { sKeyName = "NewLeastResolution"; } else if (meType == Mean) { - pvlRefChangeGrp += Isis::PvlKeyword("MeanResolution", GetMeanResolution()); + pvlRefChangeGrp += Isis::PvlKeyword("MeanResolution", toString(GetMeanResolution())); sKeyName = "NewResolutionNeartoMean"; } else if (meType == Nearest) { @@ -277,11 +277,11 @@ namespace Isis { else if (meType == Range) { sKeyName = "NewResolutionInRange"; } - pvlRefChangeGrp += Isis::PvlKeyword(sKeyName, mdResVector[iBestIndex]); + pvlRefChangeGrp += Isis::PvlKeyword(sKeyName, toString(mdResVector[iBestIndex])); - istrTemp = IString((int)newPnt->GetMeasure(iBestIndex)->GetSample()); + istrTemp = QString((int)newPnt->GetMeasure(iBestIndex)->GetSample()); istrTemp += ","; - istrTemp += IString((int)newPnt->GetMeasure(iBestIndex)->GetLine()); + istrTemp += QString((int)newPnt->GetMeasure(iBestIndex)->GetLine()); pvlRefChangeGrp += Isis::PvlKeyword("NewLocation", istrTemp); pvlPointObj += pvlRefChangeGrp; @@ -296,9 +296,9 @@ namespace Isis { }// end Point // CnetRef Change Statistics - mStatisticsGrp += Isis::PvlKeyword("PointsModified", iPointsModified); - mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", iRefChanged); - mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", iMeasuresModified); + mStatisticsGrp += Isis::PvlKeyword("PointsModified", toString(iPointsModified)); + mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", toString(iRefChanged)); + mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", toString(iMeasuresModified)); mPvlLog += mStatisticsGrp; } diff --git a/isis/src/control/apps/cnetref/CnetRefByResolution.h b/isis/src/control/apps/cnetref/CnetRefByResolution.h index f9e33b34ac..b482e0ccd3 100644 --- a/isis/src/control/apps/cnetref/CnetRefByResolution.h +++ b/isis/src/control/apps/cnetref/CnetRefByResolution.h @@ -76,7 +76,7 @@ namespace Isis { class CnetRefByResolution : public ControlNetValidMeasure { public: //! Constructor - CnetRefByResolution(Pvl *pPvlDef, std::string psSerialNumfile, ResolutionType peType = Low, + CnetRefByResolution(Pvl *pPvlDef, QString psSerialNumfile, ResolutionType peType = Low, double pdResValue = 0, double pdMinRes = 0, double pdMaxRes = 0); virtual ~CnetRefByResolution() {}; diff --git a/isis/src/control/apps/cnetref/cnetref.cpp b/isis/src/control/apps/cnetref/cnetref.cpp index d06960b193..26e84b5deb 100644 --- a/isis/src/control/apps/cnetref/cnetref.cpp +++ b/isis/src/control/apps/cnetref/cnetref.cpp @@ -11,10 +11,10 @@ #include "InterestOperatorFactory.h" #include "InterestOperator.h" #include "IException.h" +#include "IString.h" #include "Progress.h" #include "Pvl.h" -#include using namespace std; using namespace Isis; @@ -22,23 +22,23 @@ using namespace Isis; void ViewDefFile(); void EditDefFile(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["View"] = (void *)ViewDefFile; helper ["Edit"] = (void *)EditDefFile; return helper; } -ResolutionType GetResolutionType(std::string psType); +ResolutionType GetResolutionType(QString psType); void IsisMain() { try { UserInterface &ui = Application::GetUserInterface(); - std::string sSerialNumFile = ui.GetFileName("FROMLIST"); + QString sSerialNumFile = ui.GetFileName("FROMLIST"); // get the Criteria option - std::string sCriteria = ui.GetString("CRITERIA"); + QString sCriteria = ui.GetString("CRITERIA"); // Check format of Pvl DefFile bool bDefFile = false; @@ -52,7 +52,7 @@ void IsisMain() { Application::Log(pvlDefFile->Group(0)); if (pvlDefFile->Group(0).HasKeyword("PixelsFromEdge") && pvlDefFile->Group(0).HasKeyword("MetersFromEdge")) { - string message = "DefFile Error : Cannot have both \"PixelsFromEdge\" && \"MetersFromEdge\"" ; + QString message = "DefFile Error : Cannot have both \"PixelsFromEdge\" && \"MetersFromEdge\"" ; throw IException(IException::User, message, _FILEINFO_); } @@ -66,7 +66,7 @@ void IsisMain() { pvlTemplate.ValidatePvl(*pvlDefFile, pvlResults); if (pvlResults.Groups() > 0 || pvlResults.Keywords() > 0) { Application::Log(pvlResults.Group(0)); - string sErrMsg = "Invalid Deffile\n"; + QString sErrMsg = "Invalid Deffile\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } @@ -87,7 +87,7 @@ void IsisMain() { // Get the output Log file bool bLogFile = false; - string sLogFile; + QString sLogFile; if (ui.WasEntered("LOG")) { sLogFile = ui.GetFileName("LOG"); bLogFile = true; @@ -110,13 +110,13 @@ void IsisMain() { // Process Reference by Resolution else if (sCriteria == "RESOLUTION") { - std::string sType = ui.GetString("TYPE"); + QString sType = ui.GetString("TYPE"); double dResValue = 0; double dMinRes = 0, dMaxRes = 0; if (sType == "NEAREST") { dResValue = ui.GetDouble("RESVALUE"); if (dResValue < 0) { - std::string message = "Invalid Nearest Resolution Value"; + QString message = "Invalid Nearest Resolution Value"; throw IException(IException::User, message, _FILEINFO_); } } @@ -124,7 +124,7 @@ void IsisMain() { dMinRes = ui.GetDouble("MINRES"); dMaxRes = ui.GetDouble("MAXRES"); if (dMinRes < 0 || dMaxRes < 0 || dMinRes > dMaxRes) { - std::string message = "Invalid Resolution Range"; + QString message = "Invalid Resolution Range"; throw IException(IException::User, message, _FILEINFO_); } } @@ -135,10 +135,10 @@ void IsisMain() { // Process Reference by Interest else if (sCriteria == "INTEREST") { if (!bDefFile) { - std::string msg = "Interest Option must have a DefFile"; + QString msg = "Interest Option must have a DefFile"; throw IException(IException::User, msg, _FILEINFO_); } - std::string sOverlapListFile = ""; + QString sOverlapListFile = ""; if (ui.WasEntered("LIMIT")) { if (ui.GetBoolean("LIMIT")) { sOverlapListFile = FileName(ui.GetFileName("OVERLAPLIST")).expanded(); @@ -188,22 +188,22 @@ void IsisMain() { throw; } catch (geos::util::GEOSException *exc) { - string message = "GEOS Exception: " + (IString)exc->what(); + QString message = "GEOS Exception: " + (QString)exc->what(); delete exc; throw IException(IException::User, message, _FILEINFO_); } catch (std::exception const &se) { - string message = "std::exception: " + (IString)se.what(); + QString message = "std::exception: " + (QString)se.what(); throw IException(IException::User, message, _FILEINFO_); } catch (...) { - string message = "Other Error"; + QString message = "Other Error"; throw IException(IException::User, message, _FILEINFO_); } } /** - * Return the enumerated ResolutionType for a given string + * Return the enumerated ResolutionType for a given QString * * @author Sharmila Prasad (6/4/2010) * @@ -211,7 +211,7 @@ void IsisMain() { * * @return ResolutionType */ -ResolutionType GetResolutionType(std::string psType) { +ResolutionType GetResolutionType(QString psType) { if (psType == "LOW") return Low; else if (psType == "HIGH") @@ -250,7 +250,7 @@ void ViewDefFile() { */ void EditDefFile(void) { UserInterface &ui = Application::GetUserInterface(); - string sDefFile = ui.GetAsString("DEFFILE"); + QString sDefFile = ui.GetAsString("DEFFILE"); GuiEditFile::EditFile(ui, sDefFile); } diff --git a/isis/src/control/apps/cnetsplit/cnetsplit.cpp b/isis/src/control/apps/cnetsplit/cnetsplit.cpp index 0fd07b812a..68bb384fcd 100644 --- a/isis/src/control/apps/cnetsplit/cnetsplit.cpp +++ b/isis/src/control/apps/cnetsplit/cnetsplit.cpp @@ -34,9 +34,9 @@ void IsisMain() { if (numOutputFiles > numPoints) { FileName inputNet(ui.GetFileName("CNET")); - string msg = "The number of output files is greater than total number of " - "Control Points in the given Control Network [" - + ui.GetFileName("CNET") + "]."; + QString msg = "The number of output files is greater than total number of " + "Control Points in the given Control Network [" + + ui.GetFileName("CNET") + "]."; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/control/apps/cnetstats/cnetstats.cpp b/isis/src/control/apps/cnetstats/cnetstats.cpp index 102d6f0d4c..d227d6a37d 100644 --- a/isis/src/control/apps/cnetstats/cnetstats.cpp +++ b/isis/src/control/apps/cnetstats/cnetstats.cpp @@ -12,18 +12,18 @@ using namespace Isis; using namespace std; void ReadDefFile(ControlNetFilter & pcNetFilter, Pvl & pvlDefFile); -void (ControlNetFilter::*GetPtr2Filter(const string sFilter)) (const PvlGroup & pvlGrp, bool pbLastFilter); +void (ControlNetFilter::*GetPtr2Filter(const QString sFilter)) (const PvlGroup & pvlGrp, bool pbLastFilter); void IsisMain() { try { // Process all the inputs first, for errors and to satisfy requirements UserInterface &ui = Application::GetUserInterface(); - string sSerialNumFile = ui.GetFileName("FROMLIST"); + QString sSerialNumFile = ui.GetFileName("FROMLIST"); // Get the DefFile - string sDefFile = ""; - string sOutFile = ""; + QString sDefFile = ""; + QString sOutFile = ""; Pvl pvlDefFile; if (ui.WasEntered("DEFFILE")) { sDefFile = ui.GetFileName("DEFFILE"); @@ -50,19 +50,19 @@ void IsisMain() { Application::Log(pvlObj.Group(j)); } } - string sErrMsg = "Invalid Deffile\n"; + QString sErrMsg = "Invalid Deffile\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } // Get the Image Stats File - string sImageFile= ""; + QString sImageFile= ""; if (ui.WasEntered("CREATE_IMAGE_STATS") && ui.GetBoolean("CREATE_IMAGE_STATS")) { sImageFile = ui.GetFileName("IMAGE_STATS_FILE"); } // Get the Point Stats File - string sPointFile=""; + QString sPointFile=""; if (ui.WasEntered("CREATE_POINT_STATS") && ui.GetBoolean("CREATE_POINT_STATS")) { sPointFile = ui.GetFileName("POINT_STATS_FILE"); } @@ -130,13 +130,13 @@ void ReadDefFile(ControlNetFilter & pcNetFilter, Pvl & pvlDefFile) } /** - * Returns the pointer to filter function based on the Group name string + * Returns the pointer to filter function based on the Group name QString * * @author Sharmila Prasad (8/11/2010) * * @return void(ControlNetFilter::*GetPtr2Filter)(const PvlGroup&pvlGrp) */ -void (ControlNetFilter::*GetPtr2Filter(const string psFilter)) (const PvlGroup & pvlGrp, bool pbLastFilter) +void (ControlNetFilter::*GetPtr2Filter(const QString psFilter)) (const PvlGroup & pvlGrp, bool pbLastFilter) { // Point Filters if (psFilter == "Point_PixelShift") { diff --git a/isis/src/control/apps/cnettable/cnettable.cpp b/isis/src/control/apps/cnettable/cnettable.cpp index d778dd2f3a..c1f2994951 100644 --- a/isis/src/control/apps/cnettable/cnettable.cpp +++ b/isis/src/control/apps/cnettable/cnettable.cpp @@ -30,8 +30,8 @@ using namespace std; using namespace Isis; -IString CheckValue(double value); -IString CheckValue(IString value); +QString CheckValue(double value); +QString CheckValue(QString value); void Write(PvlGroup *point, const ControlMeasure &cm); // Allows for column names to be written on the first pass @@ -41,7 +41,7 @@ bool append; TextFile *txt = NULL; // For control measure related data and labels -IString measureInfo; +QString measureInfo; QString measureLabels; void IsisMain() { @@ -165,105 +165,105 @@ void IsisMain() { measureInfo.clear(); measureInfo += cpoint->GetId() + ","; measureInfo += cpoint->GetPointTypeString() + ","; - measureInfo += IString(cpoint->GetChooserName()) + ","; - measureInfo += IString(cpoint->GetDateTime()) + ","; - measureInfo += IString(cpoint->IsEditLocked()) + ","; - measureInfo += IString(cpoint->IsIgnored()) + ","; + measureInfo += QString(cpoint->GetChooserName()) + ","; + measureInfo += QString(cpoint->GetDateTime()) + ","; + measureInfo += toString((int)(cpoint->IsEditLocked())) + ","; + measureInfo += toString((int)(cpoint->IsIgnored())) + ","; - measureInfo += IString(cpoint->GetSurfacePointSourceString()) + ","; - measureInfo += IString(cpoint->GetAprioriSurfacePointSourceFile()) + ","; - measureInfo += IString(cpoint->GetRadiusSourceString()) + ","; - measureInfo += IString(cpoint->GetAprioriRadiusSourceFile()) + ","; + measureInfo += QString(cpoint->GetSurfacePointSourceString()) + ","; + measureInfo += QString(cpoint->GetAprioriSurfacePointSourceFile()) + ","; + measureInfo += QString(cpoint->GetRadiusSourceString()) + ","; + measureInfo += QString(cpoint->GetAprioriRadiusSourceFile()) + ","; SurfacePoint Asp = cpoint->GetAprioriSurfacePoint(); - measureInfo += IString(CheckValue(Asp.GetX().kilometers())) + ","; - measureInfo += IString(CheckValue(Asp.GetY().kilometers())) + ","; - measureInfo += IString(CheckValue(Asp.GetZ().kilometers())) + ","; - measureInfo += IString(CheckValue(Asp.GetXSigma().kilometers())) + ","; - measureInfo += IString(CheckValue(Asp.GetYSigma().kilometers())) + ","; - measureInfo += IString(CheckValue(Asp.GetZSigma().kilometers())) + ","; - measureInfo += IString(CheckValue(Asp.GetLatitude().planetocentric(Angle::Degrees))) + ","; - measureInfo += IString(CheckValue(Asp.GetLongitude().positiveEast(Angle::Degrees))) + ","; - measureInfo += IString(CheckValue(Asp.GetLocalRadius().kilometers())) + ","; - measureInfo += IString(CheckValue(Asp.GetLatSigma().degrees())) + ","; - measureInfo += IString(CheckValue(Asp.GetLonSigma().degrees())) + ","; - measureInfo += IString(CheckValue(Asp.GetLocalRadiusSigma().kilometers())) + ","; - try { measureInfo += IString(CheckValue(Asp.GetLatSigmaDistance().kilometers())) + ","; } + measureInfo += QString(CheckValue(Asp.GetX().kilometers())) + ","; + measureInfo += QString(CheckValue(Asp.GetY().kilometers())) + ","; + measureInfo += QString(CheckValue(Asp.GetZ().kilometers())) + ","; + measureInfo += QString(CheckValue(Asp.GetXSigma().kilometers())) + ","; + measureInfo += QString(CheckValue(Asp.GetYSigma().kilometers())) + ","; + measureInfo += QString(CheckValue(Asp.GetZSigma().kilometers())) + ","; + measureInfo += QString(CheckValue(Asp.GetLatitude().planetocentric(Angle::Degrees))) + ","; + measureInfo += QString(CheckValue(Asp.GetLongitude().positiveEast(Angle::Degrees))) + ","; + measureInfo += QString(CheckValue(Asp.GetLocalRadius().kilometers())) + ","; + measureInfo += QString(CheckValue(Asp.GetLatSigma().degrees())) + ","; + measureInfo += QString(CheckValue(Asp.GetLonSigma().degrees())) + ","; + measureInfo += QString(CheckValue(Asp.GetLocalRadiusSigma().kilometers())) + ","; + try { measureInfo += QString(CheckValue(Asp.GetLatSigmaDistance().kilometers())) + ","; } catch (IException &) { measureInfo += ","; } - try { measureInfo += IString(CheckValue(Asp.GetLonSigmaDistance().kilometers())) + ","; } + try { measureInfo += QString(CheckValue(Asp.GetLonSigmaDistance().kilometers())) + ","; } catch (IException &) { measureInfo += ","; } SurfacePoint sp = cpoint->GetAdjustedSurfacePoint(); - measureInfo += IString(CheckValue(sp.GetX().kilometers())) + ","; - measureInfo += IString(CheckValue(sp.GetY().kilometers())) + ","; - measureInfo += IString(CheckValue(sp.GetZ().kilometers())) + ","; - measureInfo += IString(CheckValue(sp.GetXSigma().kilometers())) + ","; - measureInfo += IString(CheckValue(sp.GetYSigma().kilometers())) + ","; - measureInfo += IString(CheckValue(sp.GetZSigma().kilometers())) + ","; - measureInfo += IString(CheckValue(sp.GetLatitude().planetocentric(Angle::Degrees))) + ","; - measureInfo += IString(CheckValue(sp.GetLongitude().positiveEast(Angle::Degrees))) + ","; - measureInfo += IString(CheckValue(sp.GetLocalRadius().kilometers())) + ","; - measureInfo += IString(CheckValue(sp.GetLatSigma().degrees())) + ","; - measureInfo += IString(CheckValue(sp.GetLonSigma().degrees())) + ","; - measureInfo += IString(CheckValue(sp.GetLocalRadiusSigma().kilometers())) + ","; - try { measureInfo += IString(CheckValue(sp.GetLatSigmaDistance().kilometers())) + ","; } + measureInfo += QString(CheckValue(sp.GetX().kilometers())) + ","; + measureInfo += QString(CheckValue(sp.GetY().kilometers())) + ","; + measureInfo += QString(CheckValue(sp.GetZ().kilometers())) + ","; + measureInfo += QString(CheckValue(sp.GetXSigma().kilometers())) + ","; + measureInfo += QString(CheckValue(sp.GetYSigma().kilometers())) + ","; + measureInfo += QString(CheckValue(sp.GetZSigma().kilometers())) + ","; + measureInfo += QString(CheckValue(sp.GetLatitude().planetocentric(Angle::Degrees))) + ","; + measureInfo += QString(CheckValue(sp.GetLongitude().positiveEast(Angle::Degrees))) + ","; + measureInfo += QString(CheckValue(sp.GetLocalRadius().kilometers())) + ","; + measureInfo += QString(CheckValue(sp.GetLatSigma().degrees())) + ","; + measureInfo += QString(CheckValue(sp.GetLonSigma().degrees())) + ","; + measureInfo += QString(CheckValue(sp.GetLocalRadiusSigma().kilometers())) + ","; + try { measureInfo += QString(CheckValue(sp.GetLatSigmaDistance().kilometers())) + ","; } catch (IException &e) { measureInfo += ","; } - try { measureInfo += IString(CheckValue(sp.GetLonSigmaDistance().kilometers())) + ","; } + try { measureInfo += QString(CheckValue(sp.GetLonSigmaDistance().kilometers())) + ","; } catch (IException &e) { measureInfo += ","; } - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetResidualMagnitude).Minimum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetResidualMagnitude).Maximum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetResidualMagnitude).Average())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetSampleResidual).Minimum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetSampleResidual).Maximum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetLineResidual).Minimum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetLineResidual).Maximum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetSampleShift).Maximum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetSampleShift).Minimum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetSampleShift).Average())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetLineShift).Maximum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetLineShift).Minimum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetLineShift).Average())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetPixelShift).Maximum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetPixelShift).Minimum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( &ControlMeasure::GetPixelShift).Average())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( ControlMeasureLogData::MaximumPixelZScore).Maximum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( ControlMeasureLogData::MinimumPixelZScore).Minimum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( ControlMeasureLogData::GoodnessOfFit).Maximum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( ControlMeasureLogData::GoodnessOfFit).Minimum())) + ","; - measureInfo += IString(CheckValue(cpoint->GetStatistic( + measureInfo += QString(CheckValue(cpoint->GetStatistic( ControlMeasureLogData::GoodnessOfFit).Average())) + ","; // Loop through all measures in controlpoint @@ -299,41 +299,29 @@ void IsisMain() { // This function is meant to check a value, and, if it is a special pixel // return " " instead of the special pixel value. -IString CheckValue(double value) { +QString CheckValue(double value) { if (IsSpecial(value)) { - return IString(""); + return QString(""); } else { - return CheckValue(IString(value)); + return CheckValue(toString(value)); } } -IString CheckValue(IString value) { - if (value == IString(Isis::Null) || - value == IString(Isis::Hrs) || - value == IString(Isis::His) || - value == IString(Isis::Lrs) || - value == IString(Isis::Lis)) { - return IString(""); +QString CheckValue(QString value) { + if (value == toString(Isis::Null) || + value == toString(Isis::Hrs) || + value == toString(Isis::His) || + value == toString(Isis::Lrs) || + value == toString(Isis::Lis) || + value == QString::number(Isis::Null)) { + return QString(""); } else { return value; } } -IString CheckValue(QString value) { - if (value == QString::number(Isis::Null) || - value == QString::number(Isis::Hrs) || - value == QString::number(Isis::His) || - value == QString::number(Isis::Lrs) || - value == QString::number(Isis::Lis)) { - return IString(""); - } - else { - return value.toStdString(); - } -} - // Write each PvlGroup out to file void Write(PvlGroup *point, const ControlMeasure &cm) { @@ -366,12 +354,12 @@ void Write(PvlGroup *point, const ControlMeasure &cm) { // point information for(int i = 0; i < maxCount; i++) { if((*point)[i].Size() == 3) { - output += QString((*point)[i].Name().c_str()) + "X,"; - output += QString((*point)[i].Name().c_str()) + "Y,"; - output += QString((*point)[i].Name().c_str()) + "Z,"; + output += QString((*point)[i].Name()) + "X,"; + output += QString((*point)[i].Name()) + "Y,"; + output += QString((*point)[i].Name()) + "Z,"; } else { - output += QString((*point)[i].Name().c_str()) + ","; + output += QString((*point)[i].Name()) + ","; } } @@ -382,10 +370,10 @@ void Write(PvlGroup *point, const ControlMeasure &cm) { //} - if(errors) output += QString((*point)[maxCount].Name().c_str()); + if(errors) output += QString((*point)[maxCount].Name()); isFirst = false; measureLabels += output; - txt->PutLine(measureLabels.toStdString()); + txt->PutLine(measureLabels); } output.clear(); measureLabels.clear(); @@ -393,7 +381,7 @@ void Write(PvlGroup *point, const ControlMeasure &cm) { QList< QStringList > printableMeasureData = cm.PrintableClassData(); QStringList nameValuePair; foreach (nameValuePair, printableMeasureData) { - output += CheckValue(nameValuePair.at(1)).ToQt() + ","; + output += CheckValue(nameValuePair.at(1)) + ","; } // Write out date values @@ -420,10 +408,10 @@ void Write(PvlGroup *point, const ControlMeasure &cm) { // Meaure info comes first QString pri = ""; - pri += measureInfo.ToQt(); + pri += measureInfo; pri += output; - txt->PutLine(pri.toStdString()); + txt->PutLine(pri); output.clear(); pri.clear(); diff --git a/isis/src/control/apps/cnetwinnow/cnetwinnow.cpp b/isis/src/control/apps/cnetwinnow/cnetwinnow.cpp index 608459cb5a..02030d24d3 100644 --- a/isis/src/control/apps/cnetwinnow/cnetwinnow.cpp +++ b/isis/src/control/apps/cnetwinnow/cnetwinnow.cpp @@ -30,7 +30,7 @@ using namespace std; using namespace Isis; -void cubeConvexHullAndMeasures(IString &serialNum,ControlNet &net, double &area, int &validMeasures, +void cubeConvexHullAndMeasures(QString &serialNum,ControlNet &net, double &area, int &validMeasures, QList *measToIgnor=NULL); @@ -65,14 +65,14 @@ void IsisMain() { //make sure there was some residual data in the control network if (hist.ValidPixels() < 1) { - string msg = "Error no valid residual data found in network [" + ui.GetFileName("CNET") + "]"; + QString msg = "Error no valid residual data found in network [" + ui.GetFileName("CNET") + "]"; throw IException(IException::User, msg, _FILEINFO_); return; } FILE *guiltyFile; char fileName[1028]; - strcpy(fileName,ui.GetString("FILE_PREFIX").data()); + strcpy(fileName,ui.GetString("FILE_PREFIX").toAscii().data()); strcat(fileName,"Guilty.csv"); guiltyFile = fopen(fileName,"w"); if (guiltyFile == NULL) { @@ -82,7 +82,7 @@ void IsisMain() { } FILE *ignoredReport; - strcpy(fileName,ui.GetString("FILE_PREFIX").data()); + strcpy(fileName,ui.GetString("FILE_PREFIX").toAscii().data()); strcat(fileName,"Ignored.csv"); ignoredReport = fopen(fileName,"w"); if (guiltyFile == NULL) { @@ -264,9 +264,9 @@ void IsisMain() { QList hullAndValidMeasures; double area; int validMeasures; - IString serialNum = measGroup[j]->GetCubeSerialNumber(); + QString serialNum = measGroup[j]->GetCubeSerialNumber(); //check to see if the initial stats are already calculated for this image - if (originalCubeStats.contains(serialNum.ToQt())) continue; + if (originalCubeStats.contains(serialNum)) continue; //otherwise do the calculations cubeConvexHullAndMeasures(serialNum,net,area,validMeasures); hullAndValidMeasures.push_back(area); @@ -283,7 +283,7 @@ void IsisMain() { else ableToEditFlag[j] = false; //test fail - IString serialNum = measGroup[j]->GetCubeSerialNumber(); + QString serialNum = measGroup[j]->GetCubeSerialNumber(); cubeConvexHullAndMeasures(serialNum,net,hullArea[j],measNum[j],&measGroup); //get the original values for this cube @@ -358,10 +358,10 @@ void IsisMain() { for( int j=0;jParent()->GetId().ToQt().toStdString().data(), + measGroup[j]->Parent()->GetId().toStdString().data(), serialNumList.FileName(measGroup[j]->GetCubeSerialNumber() - .ToQt().toStdString()).data(), - measGroup[j]->GetCubeSerialNumber().ToQt().toStdString().data(), + ).toAscii().data(), + measGroup[j]->GetCubeSerialNumber().toAscii().data(), measGroup[j]->GetResidualMagnitude(), hullReduction[j]*100.0, measReduction[j]*100.0, @@ -403,7 +403,7 @@ void IsisMain() { -void cubeConvexHullAndMeasures(IString &serialNum,ControlNet &net, double &area, int &validMeasures, +void cubeConvexHullAndMeasures(QString &serialNum,ControlNet &net, double &area, int &validMeasures, QList *measToIgnor) { int i,j,firstIndex=0; diff --git a/isis/src/control/apps/coreg/coreg.cpp b/isis/src/control/apps/coreg/coreg.cpp index fb66e26dd3..12d212b5f0 100644 --- a/isis/src/control/apps/coreg/coreg.cpp +++ b/isis/src/control/apps/coreg/coreg.cpp @@ -26,8 +26,8 @@ using namespace Isis; //helper button functins in the code void helperButtonLog(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonLog"] = (void *) helperButtonLog; return helper; } @@ -40,7 +40,7 @@ void IsisMain() { if(ui.WasEntered("TO")) { if(ui.GetString("TRANSFORM") == "WARP") { if(!ui.WasEntered("ONET")) { - string msg = "A Control Net file must be entered if the TO parameter is "; + QString msg = "A Control Net file must be entered if the TO parameter is "; msg += "entered"; throw IException(IException::User, msg, _FILEINFO_); } @@ -50,7 +50,7 @@ void IsisMain() { // Open the first cube. It will be matched to the second input cube. Cube trans; CubeAttributeInput &attTrans = ui.GetInputAttribute("FROM"); - std::vector bandTrans = attTrans.bands(); + std::vector bandTrans = attTrans.bands(); trans.setVirtualBands(bandTrans); trans.open(ui.GetFileName("FROM"), "r"); @@ -59,7 +59,7 @@ void IsisMain() { // first to this one by attempting to compute a sample/line translation Cube match; CubeAttributeInput &attMatch = ui.GetInputAttribute("MATCH"); - std::vector bandMatch = attMatch.bands(); + std::vector bandMatch = attMatch.bands(); match.setVirtualBands(bandMatch); match.open(ui.GetFileName("MATCH"), "r"); @@ -67,25 +67,25 @@ void IsisMain() { // one band if((trans.getLineCount() != match.getLineCount()) || (trans.getSampleCount() != match.getSampleCount())) { - string msg = "Input Cube Lines and Samples must be equal!"; + QString msg = "Input Cube Lines and Samples must be equal!"; throw IException(IException::User, msg, _FILEINFO_); } if(trans.getBandCount() != 1 || match.getBandCount() != 1) { - string msg = "Input Cubes must have only one band!"; + QString msg = "Input Cubes must have only one band!"; throw IException(IException::User, msg, _FILEINFO_); } // Get serial number - string serialTrans = SerialNumber::Compose(trans, true); - string serialMatch = SerialNumber::Compose(match, true); + QString serialTrans = SerialNumber::Compose(trans, true); + QString serialMatch = SerialNumber::Compose(match, true); // This still precludes band to band registrations. if(serialTrans == serialMatch) { - string sTrans = FileName(trans.getFileName()).name(); - string sMatch = FileName(match.getFileName()).name(); + QString sTrans = FileName(trans.getFileName()).name(); + QString sMatch = FileName(match.getFileName()).name(); if(sTrans == sMatch) { - string msg = "Cube Serial Numbers must be unique - FROM=" + serialTrans + + QString msg = "Cube Serial Numbers must be unique - FROM=" + serialTrans + ", MATCH=" + serialMatch; throw IException(IException::User, msg, _FILEINFO_); } @@ -134,7 +134,7 @@ void IsisMain() { if (match.hasGroup("Instrument")) { PvlGroup inst = match.getGroup("Instrument"); PvlKeyword &targname = inst.FindKeyword("TargetName"); - string targetname = targname; + QString targetname = targname; cn.SetTarget(targetname); } @@ -179,7 +179,7 @@ void IsisMain() { } // Add the measures to a control point - string str = "Row " + IString(r) + " Column " + IString(c); + QString str = "Row " + toString(r) + " Column " + toString(c); ControlPoint * cp = new ControlPoint(str); cp->SetType(ControlPoint::Free); cp->Add(cmTrans); @@ -202,14 +202,14 @@ void IsisMain() { double lMax = (int)(lStats.Maximum() * 100.0) / 100.0; double lDev = (int)(lStats.StandardDeviation() * 100.0) / 100.0; - results += PvlKeyword("SampleMinimum", sMin); - results += PvlKeyword("SampleAverage", sTrans); - results += PvlKeyword("SampleMaximum", sMax); - results += PvlKeyword("SampleStandardDeviation", sDev); - results += PvlKeyword("LineMinimum", lMin); - results += PvlKeyword("LineAverage", lTrans); - results += PvlKeyword("LineMaximum", lMax); - results += PvlKeyword("LineStandardDeviation", lDev); + results += PvlKeyword("SampleMinimum", toString(sMin)); + results += PvlKeyword("SampleAverage", toString(sTrans)); + results += PvlKeyword("SampleMaximum", toString(sMax)); + results += PvlKeyword("SampleStandardDeviation", toString(sDev)); + results += PvlKeyword("LineMinimum", toString(lMin)); + results += PvlKeyword("LineAverage", toString(lTrans)); + results += PvlKeyword("LineMaximum", toString(lMax)); + results += PvlKeyword("LineStandardDeviation", toString(lDev)); Application::Log(results); Pvl arPvl = ar->RegistrationStatistics(); @@ -224,7 +224,7 @@ void IsisMain() { // If none of the points registered, throw an error if(sStats.TotalPixels() < 1) { - string msg = "Coreg was unable to register any points. Check your algorithm definition."; + QString msg = "Coreg was unable to register any points. Check your algorithm definition."; throw IException(IException::User, msg, _FILEINFO_); } @@ -241,9 +241,9 @@ void IsisMain() { // The flatfile is comma seperated and can be imported into an excel // spreadsheet if(ui.WasEntered("FLATFILE")) { - string fFile = FileName(ui.GetFileName("FLATFILE")).expanded(); + QString fFile = FileName(ui.GetFileName("FLATFILE")).expanded(); ofstream os; - os.open(fFile.c_str(), ios::out); + os.open(fFile.toAscii().data(), ios::out); os << "Sample,Line,TranslatedSample,TranslatedLine," << "SampleDifference,LineDifference,GoodnessOfFit" << endl; for(int i = 0; i < cn.GetNumPoints(); i++) { @@ -266,20 +266,20 @@ void IsisMain() { // second input image if(ui.WasEntered("TO")) { if(ui.GetString("TRANSFORM") == "TRANSLATE") { - string params = " from=" + ui.GetFileName("FROM") + + QString params = " from=" + ui.GetFileName("FROM") + " to=" + ui.GetFileName("TO") + - " strans=" + IString(sTrans) + - " ltrans=" + IString(lTrans) + + " strans=" + toString(sTrans) + + " ltrans=" + toString(lTrans) + " interp=" + ui.GetString("INTERP"); ProgramLauncher::RunIsisProgram("translate", params); } else { - string params = " from=" + ui.GetFileName("FROM") + + QString params = " from=" + ui.GetFileName("FROM") + " to=" + ui.GetFileName("TO") + " cube=" + ui.GetFileName("MATCH") + " cnet=" + ui.GetFileName("ONET") + " interp=" + ui.GetString("INTERP") + - " degree=" + IString(ui.GetInteger("DEGREE")); + " degree=" + toString(ui.GetInteger("DEGREE")); ProgramLauncher::RunIsisProgram("warp", params); } } @@ -288,7 +288,7 @@ void IsisMain() { //Helper function to output the regdeft file to log. void helperButtonLog() { UserInterface &ui = Application::GetUserInterface(); - string file(ui.GetFileName("DEFFILE")); + QString file(ui.GetFileName("DEFFILE")); Pvl p; p.Read(file); Application::GuiLog(p); diff --git a/isis/src/control/apps/deltack/deltack.cpp b/isis/src/control/apps/deltack/deltack.cpp index 7806bda1e2..d822e91ad4 100644 --- a/isis/src/control/apps/deltack/deltack.cpp +++ b/isis/src/control/apps/deltack/deltack.cpp @@ -18,12 +18,12 @@ using namespace std; using namespace Isis; -Distance GetRadius(std::string filename, Latitude lat, Longitude lon); +Distance GetRadius(QString filename, Latitude lat, Longitude lon); void IsisMain() { // Create a serial number list UserInterface &ui = Application::GetUserInterface(); - string filename = ui.GetFileName("FROM"); + QString filename = ui.GetFileName("FROM"); SerialNumberList serialNumberList; serialNumberList.Add(filename); @@ -67,7 +67,7 @@ void IsisMain() { if(c.getLabel()->HasKeyword("TargetName", PvlObject::Traverse)) { // c.Label()->FindKeyword("TargetName"); PvlGroup inst = c.getLabel()->FindGroup("Instrument", PvlObject::Traverse); - std::string targetName = inst["TargetName"]; + QString targetName = inst["TargetName"]; cnet.SetTarget(targetName); } c.close(); @@ -132,7 +132,7 @@ void IsisMain() { Table cmatrix = b.Cmatrix(0); // Write out a description in the spice table - std::string deltackComment = "deltackAdjusted = " + Isis::iTime::CurrentLocalTime(); + QString deltackComment = "deltackAdjusted = " + Isis::iTime::CurrentLocalTime(); cmatrix.Label().AddComment(deltackComment); //PvlKeyword description("Description"); //description = "Camera pointing updated via deltack application"; @@ -150,21 +150,21 @@ void IsisMain() { Application::Log(gp); } catch(IException &e) { - string msg = "Unable to update camera pointing for [" + filename + "]"; + QString msg = "Unable to update camera pointing for [" + filename + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } } // Compute the radius at the lat/lon -Distance GetRadius(std::string filename, Latitude lat, Longitude lon) { +Distance GetRadius(QString filename, Latitude lat, Longitude lon) { Pvl lab(filename); Sensor sensor(lab); sensor.SetGround(SurfacePoint(lat, lon, sensor.LocalRadius(lat, lon))); Distance radius = sensor.LocalRadius(); if(!radius.isValid()) { - string msg = "Could not determine radius from DEM at lat/lon ["; - msg += IString(lat.degrees()) + "," + IString(lon.degrees()) + "]"; + QString msg = "Could not determine radius from DEM at lat/lon ["; + msg += toString(lat.degrees()) + "," + toString(lon.degrees()) + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } return radius; diff --git a/isis/src/control/apps/fplanemap/fplanemap.cpp b/isis/src/control/apps/fplanemap/fplanemap.cpp index 6d0d58c37e..1487283044 100644 --- a/isis/src/control/apps/fplanemap/fplanemap.cpp +++ b/isis/src/control/apps/fplanemap/fplanemap.cpp @@ -43,7 +43,7 @@ void IsisMain() { // Open the FROM cube. It must have a camera model associated with it Cube from; CubeAttributeInput &attFrom = ui.GetInputAttribute("FROM"); - vector bandFrom = attFrom.bands(); + vector bandFrom = attFrom.bands(); from.setVirtualBands(bandFrom); from.open(ui.GetFileName("FROM"), "r"); Camera *fcamera = from.getCamera(); @@ -142,14 +142,14 @@ void IsisMain() { } PvlGroup results("Results"); - results += PvlKeyword("PixelPitch", pp, "millimeters"); - results += PvlKeyword("TotalPoints", cn.GetNumPoints()); - results += PvlKeyword("ValidPoints", (BigInt) coords.size()); - results += PvlKeyword("InvalidPoints", badPoint); - if (checkForNulls) results += PvlKeyword("NullDNs", nulls); - results += PvlKeyword("OldPointNotInImage", oldNotInImage); - results += PvlKeyword("NewPointNotInImage", newNotInImage); - results += PvlKeyword("ToleranceExceeded", badTol); + results += PvlKeyword("PixelPitch", toString(pp), "millimeters"); + results += PvlKeyword("TotalPoints", toString(cn.GetNumPoints())); + results += PvlKeyword("ValidPoints", toString((BigInt) coords.size())); + results += PvlKeyword("InvalidPoints", toString(badPoint)); + if (checkForNulls) results += PvlKeyword("NullDNs", toString(nulls)); + results += PvlKeyword("OldPointNotInImage", toString(oldNotInImage)); + results += PvlKeyword("NewPointNotInImage", toString(newNotInImage)); + results += PvlKeyword("ToleranceExceeded", toString(badTol)); // Log it Application::Log(results); @@ -161,9 +161,9 @@ void IsisMain() { // The flatfile is comma seperated and can be imported into an excel // spreadsheet if(ui.WasEntered("TO")) { - string fFile = FileName(ui.GetFileName("TO")).expanded(); + QString fFile = FileName(ui.GetFileName("TO")).expanded(); ofstream os; - os.open(fFile.c_str(), ios::out); + os.open(fFile.toAscii().data(), ios::out); os << "OldSample,OldLine,NewSample,NewLine," << "X,Y,XC,YC,"<< "GoodnessOfFit,Latitude,Longitude" << endl; diff --git a/isis/src/control/apps/jigsaw/jigsaw.cpp b/isis/src/control/apps/jigsaw/jigsaw.cpp index 1053ca0580..e125f07354 100644 --- a/isis/src/control/apps/jigsaw/jigsaw.cpp +++ b/isis/src/control/apps/jigsaw/jigsaw.cpp @@ -15,15 +15,15 @@ void IsisMain() { // Get the control network and image list UserInterface &ui = Application::GetUserInterface(); - std::string cnetFile = ui.GetFileName("CNET"); - std::string cubeList = ui.GetFileName("FROMLIST"); + QString cnetFile = ui.GetFileName("CNET"); + QString cubeList = ui.GetFileName("FROMLIST"); BundleAdjust *b = NULL; // Get the held list if entered and prep for bundle adjustment, to determine which constructor to use if (ui.WasEntered("HELDLIST")) { - std::string heldList = ui.GetFileName("HELDLIST"); + QString heldList = ui.GetFileName("HELDLIST"); b = new BundleAdjust(cnetFile, cubeList, heldList); } else { @@ -31,7 +31,7 @@ void IsisMain() { } //build lists of maximum likelihood estimation model strings and quantiles - QList maxLikeModels; + QList maxLikeModels; QList maxQuan; if ( ui.GetString("MODEL1").compare("NONE") !=0 ) { maxLikeModels.push_back(ui.GetString("MODEL1")); @@ -60,7 +60,7 @@ void IsisMain() { b->SetCKDegree(ui.GetInteger("CKDEGREE")); b->SetSolveCKDegree(ui.GetInteger("CKSOLVEDEGREE")); - std::string camsolve = ui.GetString("CAMSOLVE"); + QString camsolve = ui.GetString("CAMSOLVE"); if (camsolve == "NONE") { b->SetSolveCmatrix(BundleAdjust::None); @@ -84,7 +84,7 @@ void IsisMain() { b->SetSPKDegree(ui.GetInteger("SPKDEGREE")); b->SetSolveSPKDegree(ui.GetInteger("SPKSOLVEDEGREE")); - std::string spsolve = ui.GetString("SPSOLVE"); + QString spsolve = ui.GetString("SPSOLVE"); if(spsolve == "NONE") { b->SetSolveSpacecraftPosition(BundleAdjust::Nothing); } @@ -151,7 +151,7 @@ void IsisMain() { // output options if (ui.WasEntered("FILE_PREFIX")) { - std::string outputfileprefix = ui.GetString("FILE_PREFIX"); + QString outputfileprefix = ui.GetString("FILE_PREFIX"); b->SetOutputFilePrefix(outputfileprefix); } @@ -209,7 +209,7 @@ void IsisMain() { for (int iobj = 0; iobj < c->getLabel()->Objects(); iobj++) { PvlObject obj = c->getLabel()->Object(iobj); if (obj.Name() != "Table") continue; - if (obj["Name"][0] != IString("CameraStatistics")) continue; + if (obj["Name"][0] != QString("CameraStatistics")) continue; c->getLabel()->DeleteObject(iobj); break; } @@ -218,7 +218,7 @@ void IsisMain() { // keyword. if (b->IsHeld(i)) continue; // Don't update held images at all Table cmatrix = b->Cmatrix(i); - std::string jigComment = "Jigged = " + Isis::iTime::CurrentLocalTime(); + QString jigComment = "Jigged = " + Isis::iTime::CurrentLocalTime(); cmatrix.Label().AddComment(jigComment); Table spvector = b->SpVector(i); spvector.Label().AddComment(jigComment); @@ -237,7 +237,7 @@ void IsisMain() { catch(IException &e) { b->ControlNet()->Write(ui.GetFileName("ONET")); - string msg = "Unable to bundle adjust network [" + cnetFile + "]"; + QString msg = "Unable to bundle adjust network [" + cnetFile + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } diff --git a/isis/src/control/apps/mat2cnet/mat2cnet.cpp b/isis/src/control/apps/mat2cnet/mat2cnet.cpp index 12d77616f0..6ab093e5a8 100644 --- a/isis/src/control/apps/mat2cnet/mat2cnet.cpp +++ b/isis/src/control/apps/mat2cnet/mat2cnet.cpp @@ -24,14 +24,14 @@ using namespace std; using namespace Isis; -std::map snMap; +std::map snMap; //std::map fscMap; void IsisMain() { // The following steps can take a significant amount of time, so // set up a progress object, incrementing at 1%, to keep the user informed PvlGroup &uip = Preference::Preferences().FindGroup("UserInterface"); - uip["ProgressBarPercent"] = 1; + uip["ProgressBarPercent"] = "1"; UserInterface &ui = Application::GetUserInterface(); Progress progress; @@ -43,7 +43,7 @@ void IsisMain() { progress.CheckStatus(); if (list2.size() != snl.Size()) { - IString msg = "Invalid input file number of lines. The ISIS2 file list ["; + QString msg = "Invalid input file number of lines. The ISIS2 file list ["; msg += ui.GetAsString("LIST2") + "] must contain the same number of lines "; msg += "as the ISIS3 file list [" + ui.GetAsString("LIST3") + "]"; throw IException(IException::User, msg, _FILEINFO_); @@ -60,7 +60,7 @@ void IsisMain() { // Jeannie Backer 2011-06-30 for (int f = 0; f < list2.size(); f++) { progress.CheckStatus(); - IString currFile(list2[f].toString()); + QString currFile(list2[f].toString()); Pvl lab(currFile); PvlObject qube(lab.FindObject("QUBE")); @@ -78,8 +78,8 @@ void IsisMain() { _FILEINFO_); } - IString sn(snl.SerialNumber(f)); - snMap.insert(std::pair((int)fsc, sn)); + QString sn(snl.SerialNumber(f)); + snMap.insert(std::pair((int)fsc, sn)); } progress.CheckStatus(); @@ -93,15 +93,16 @@ void IsisMain() { // Open the match point file TextFile mpFile(ui.GetFileName("MATCH")); - IString currLine; + QString currLine; int inTotalMeas = 0; // Read the first line with the number of measurments mpFile.GetLine(currLine); - currLine.Token("="); - currLine.Token(" "); + currLine = currLine.simplified(); + currLine.remove(0, currLine.indexOf("=")); + currLine.remove(0, currLine.indexOf(" ")); try { - inTotalMeas = int(currLine); + inTotalMeas = toInt(currLine); } catch (IException &e) { throw IException(e, @@ -114,14 +115,14 @@ void IsisMain() { // Read line 2, the column header line mpFile.GetLine(currLine); - currLine.ConvertWhiteSpace(); - currLine.Compress(); - while (currLine != "") { - IString label = currLine.Token(" "); + currLine = currLine.simplified(); + QStringList tokens = currLine.split(" ", QString::SkipEmptyParts); + while (!tokens.isEmpty()) { + QString label = tokens.takeFirst(); // this line should contain only text labels, double error = 0; try { - error = label; + error = toDouble(label); // if we are able to convert label to a double, we have an error throw IException(IException::User, "Invalid match point file " "header for [" + ui.GetAsString("MATCH") @@ -154,12 +155,12 @@ void IsisMain() { progress.CheckStatus(); } catch (IException &e) { - string msg = "\"Matchpoint total\" keyword at the top of the match point " + QString msg = "\"Matchpoint total\" keyword at the top of the match point " "file ["; - msg += ui.GetAsString("MATCH") + "] equals [" + IString(inTotalMeas); + msg += ui.GetAsString("MATCH") + "] equals [" + toString(inTotalMeas); msg += "] and is likely incorrect. Number of measures in match point file" " exceeds this value at line ["; - msg += IString(line) + "]."; + msg += toString(line) + "]."; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -169,66 +170,70 @@ void IsisMain() { ControlMeasure *cmeasure = new ControlMeasure; // Section the match point line into the important pieces - currLine.ConvertWhiteSpace(); - currLine.Compress(); - IString pid = ""; - IString fsc = ""; + currLine = currLine.simplified(); + QString pid = ""; + QString fsc = ""; double lineNum, sampNum, diam; - string matClass = ""; + QString matClass = ""; try { - pid = currLine.Token(" "); // ID of the point - fsc = currLine.Token(" "); // FSC of the ISIS2 cube - lineNum = currLine.Token(" "); // line number - sampNum = currLine.Token(" "); // sample number - matClass = currLine.Token(" "); // Match Point Class - diam = currLine.Token(" "); // Diameter, in case of a crater + QStringList tokens = currLine.split(" "); + + if (tokens.count() < 6) + throw IException(); + + pid = tokens.takeFirst(); // ID of the point + fsc = tokens.takeFirst(); // FSC of the ISIS2 cube + lineNum = toDouble(tokens.takeFirst()); // line number + sampNum = toDouble(tokens.takeFirst()); // sample number + matClass = tokens.takeFirst(); // Match Point Class + diam = toDouble(tokens.takeFirst()); // Diameter, in case of a crater } catch (IException &e) { - IString msg = "Invalid value(s) in match point file ["; - msg += ui.GetAsString("MATCH") + "] at line [" + IString(line); + QString msg = "Invalid value(s) in match point file ["; + msg += ui.GetAsString("MATCH") + "] at line [" + toString(line); msg += "]. Verify line, sample, diameter values are doubles."; throw IException(e, IException::User, msg, _FILEINFO_); } // Set the coordinate and serial number for this measure cmeasure->SetCoordinate(sampNum, lineNum); - cmeasure->SetCubeSerialNumber(snMap[(int)fsc]); + cmeasure->SetCubeSerialNumber(snMap[toInt(fsc)]); - if (snMap[(int)fsc].empty()) { - std::string msg = "None of the images specified in the ISIS2 file list ["; + if (snMap[toInt(fsc)].isEmpty()) { + QString msg = "None of the images specified in the ISIS2 file list ["; msg += ui.GetAsString("LIST2"); msg += "] have an IMAGE_NUMBER or IMAGE_ID that matches the FSC [" + fsc; msg += "], from the match point file [" + ui.GetAsString("MATCH"); - msg += "] at line [" + IString(line) + "]"; + msg += "] at line [" + toString(line) + "]"; throw IException(IException::User, msg, _FILEINFO_); } bool isReferenceMeasure = false; //Set the Measure Type - if (IString::Equal(matClass, "U")) {//Unmeasured -these are ignored in isis2 + if (matClass.toUpper() == "U") {//Unmeasured -these are ignored in isis2 cmeasure->SetType(ControlMeasure::Candidate); cmeasure->SetIgnored(true); } - else if (IString::Equal(matClass, "T")) { + else if (matClass.toUpper() == "T") { // Truth type, aka reference measure, is no longer a measure type // what this means is it has to be handled by the control point. // So, further down the boolean set here will be used. isReferenceMeasure = true; } - else if (IString::Equal(matClass, "S")) { //SubPixel + else if (matClass.toUpper() == "S") { //SubPixel cmeasure->SetType(ControlMeasure::RegisteredSubPixel); } - else if (IString::Equal(matClass, "M")) { //Measured + else if (matClass.toUpper() == "M") { //Measured cmeasure->SetType(ControlMeasure::RegisteredPixel); } - else if (IString::Equal(matClass, "A")) { //Approximate + else if (matClass.toUpper() == "A") { //Approximate cmeasure->SetType(ControlMeasure::Candidate); } else { - IString msg = "Unknown measurment type [" + matClass + "] "; + QString msg = "Unknown measurment type [" + matClass + "] "; msg += "in match point file [" + ui.GetAsString("MATCH") + "] "; - msg += "at line [" + IString(line) + "]"; + msg += "at line [" + toString(line) + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -265,9 +270,9 @@ void IsisMain() { } } catch (IException &e) { - IString msg = "Invalid match point file [" + ui.GetAsString("MATCH") +"]"; + QString msg = "Invalid match point file [" + ui.GetAsString("MATCH") +"]"; msg += ". Repeated PointID/FSC combination [" + pid + ", " + fsc; - msg += "] in match point file at line [" + IString(line) + "]."; + msg += "] in match point file at line [" + toString(line) + "]."; throw IException(e, IException::User, msg, _FILEINFO_); } } @@ -277,12 +282,12 @@ void IsisMain() { progress.CheckStatus(); } catch (IException &e) { - string msg = "\"Matchpoint total\" keyword at the top of the match point " + QString msg = "\"Matchpoint total\" keyword at the top of the match point " "file ["; - msg += ui.GetAsString("MATCH") + "] equals [" + IString(inTotalMeas); + msg += ui.GetAsString("MATCH") + "] equals [" + toString(inTotalMeas); msg += "] and is likely incorrect. Number of measures in match point file " "exceeds this value at line ["; - msg += IString(line) + "]."; + msg += toString(line) + "]."; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -293,7 +298,7 @@ void IsisMain() { // Open the RAND PPP file if (ui.GetBoolean("INPUTPPP")) { int numRandOnly = 0; - vector randOnlyIDs; + vector randOnlyIDs; TextFile randFile(ui.GetFileName("PPP")); progress.SetText("Converting RAND PPP file"); randFile.GetLine(currLine); @@ -310,10 +315,10 @@ void IsisMain() { progress.CheckStatus(); } catch (IException &e) { - IString msg = "RAND PPP file may not be valid. Line count calculated ["; - msg += IString(inTotalLine) + "] for RAND PPP file ["; + QString msg = "RAND PPP file may not be valid. Line count calculated ["; + msg += toString(inTotalLine) + "] for RAND PPP file ["; msg += ui.GetAsString("PPP") + "] appears invalid at line ["; - msg += IString(line) + "]."; + msg += toString(line) + "]."; throw IException(e, IException::Programmer, msg, _FILEINFO_); } @@ -321,7 +326,7 @@ void IsisMain() { ControlPoint *cpoint = NULL; // if end of valid data, break, stop processing - if (currLine.find("JULIAN") != string::npos) { + if (currLine.contains("JULIAN")) { // Since Progress MaximumSteps was approximated using the number of // lines in the RAND PPP file, we need to subtract the number of lines // left from the Progress steps since the following lines are not going @@ -337,61 +342,61 @@ void IsisMain() { // column 1 = latitude, begins the line and is 24 characters double lat; - IString col1 = currLine.substr(0, 24); + QString col1 = currLine.mid(0, 24); // remove any white space from beginning of string //col1.ConvertWhiteSpace(); //col1.TrimHead(" "); try { // convert to double - lat = col1; + lat = toDouble(col1); } catch (IException &e) { - IString msg = "Invalid value(s) in RAND PPP file ["; - msg += ui.GetAsString("PPP") + "] at line [" + IString(line); + QString msg = "Invalid value(s) in RAND PPP file ["; + msg += ui.GetAsString("PPP") + "] at line [" + toString(line); msg += "]. Verify latitude value is a double."; throw IException(e, IException::User, msg, _FILEINFO_); } // column 2 = longitude, begins at 25th char and is 24 characters double lon; - IString col2 = currLine.substr(24, 24); + QString col2 = currLine.mid(24, 24); // remove any white space from beginning of string //col2.TrimHead(" "); try { // convert to double - lon = col2; + lon = toDouble(col2); } catch (IException &e) { - IString msg = "Invalid value(s) in RAND PPP file ["; - msg += ui.GetAsString("PPP") + "] at line [" + IString(line); + QString msg = "Invalid value(s) in RAND PPP file ["; + msg += ui.GetAsString("PPP") + "] at line [" + toString(line); msg += "]. Verify longitude value is a double."; throw IException(e, IException::User, msg, _FILEINFO_); } // column 3 = radius, begins at 49th char and is 24 characters double rad; - IString col3 = currLine.substr(48, 24); + QString col3 = currLine.mid(48, 24); // remove any white space from beginning of string //col3.TrimHead(" "); try { // convert to double and convert km to meters - rad = col3; + rad = toDouble(col3); rad = rad * 1000; } catch (IException &e) { - IString msg = "Invalid value(s) in RAND PPP file ["; - msg += ui.GetAsString("PPP") + "] at line [" + IString(line); + QString msg = "Invalid value(s) in RAND PPP file ["; + msg += ui.GetAsString("PPP") + "] at line [" + toString(line); msg += "]. Verify radius value is a double."; throw IException(e, IException::User, msg, _FILEINFO_); } // column 4 = point id, begins at 73rd char and is 7 characters - IString pid = currLine.substr(72); + QString pid = currLine.mid(72); // remove any white space from beginning of string - pid.TrimHead(" "); + pid = pid.remove(QRegExp("^ *")); if (pid.length() > 7) { - IString msg = "Invalid value(s) in RAND PPP file ["; - msg += ui.GetAsString("PPP") + "] at line [" + IString(line); + QString msg = "Invalid value(s) in RAND PPP file ["; + msg += ui.GetAsString("PPP") + "] at line [" + toString(line); msg += "]. Point ID [" + pid + "] has more than 7 characters."; throw IException(IException::User, msg, _FILEINFO_); } @@ -429,9 +434,9 @@ void IsisMain() { cpoint->SetEditLock(ui.GetBoolean("POINTLOCK")); } catch (IException &e) { - IString msg = "Unable to set universal ground point to control " + QString msg = "Unable to set universal ground point to control " "network from line ["; - msg += IString(line) + "] of RAND PPP file ["; + msg += toString(line) + "] of RAND PPP file ["; msg += ui.GetAsString("PPP") + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -443,17 +448,17 @@ void IsisMain() { progress.CheckStatus(); } catch (IException &e) { - IString msg = "RAND PPP file may not be valid. Line count calculated ["; - msg += IString(inTotalLine) + "] for RAND PPP file ["; + QString msg = "RAND PPP file may not be valid. Line count calculated ["; + msg += toString(inTotalLine) + "] for RAND PPP file ["; msg += ui.GetAsString("PPP"); - msg += "] appears invalid at line [" + IString(line) + "]."; + msg += "] appears invalid at line [" + toString(line) + "]."; throw IException(e, IException::Programmer, msg, _FILEINFO_); } // Write results to Logs // Summary group is created with the counts of RAND PPP only points PvlGroup summaryGroup = PvlGroup("Summary"); - summaryGroup.AddKeyword(PvlKeyword("RandOnlyPoints", numRandOnly)); + summaryGroup.AddKeyword(PvlKeyword("RandOnlyPoints", toString(numRandOnly))); bool log; FileName logFile; diff --git a/isis/src/control/apps/pointreg/pointreg.cpp b/isis/src/control/apps/pointreg/pointreg.cpp index 1221cfe0ab..f540607d5e 100644 --- a/isis/src/control/apps/pointreg/pointreg.cpp +++ b/isis/src/control/apps/pointreg/pointreg.cpp @@ -54,7 +54,7 @@ class Validation { Skipped }; - Validation(string test, ControlMeasure *held, ControlMeasure *registered, + Validation(QString test, ControlMeasure *held, ControlMeasure *registered, double tolerance) { m_test = test; @@ -96,7 +96,7 @@ class Validation { return m_result == Skipped; } - string resultString() const { + QString resultString() const { switch (m_result) { case Untested: return "Untested"; case Success: return "Success"; @@ -111,7 +111,7 @@ class Validation { m_result = valid ? Success : Failure; } - void skip(string testFailure) { + void skip(QString testFailure) { m_test = testFailure; m_result = Skipped; } @@ -136,14 +136,14 @@ class Validation { setValidity(m_shift <= m_shiftTolerance); } - static string getHeader() { + static QString getHeader() { return "Result,Test,PointID,HeldID,RegisteredID," "Sample,Line,ShiftedSample,ShiftedLine," "ResolutionDifference,ResolutionTolerance," "Shift,ShiftTolerance"; } - string toString() { + QString toString() { stringstream stream; stream << resultString() << "," << m_test << "," << m_pointId << "," << @@ -152,14 +152,14 @@ class Validation { m_shiftSample << "," << m_shiftLine << "," << m_resDiff << "," << m_resTolerance << "," << m_shift << "," << m_shiftTolerance; - return stream.str(); + return stream.str().c_str(); } private: - string m_test; - string m_pointId; - string m_heldId; - string m_registeredId; + QString m_test; + QString m_pointId; + QString m_heldId; + QString m_registeredId; double m_aprioriSample; double m_aprioriLine; @@ -177,7 +177,7 @@ class Validation { void registerPoint(ControlPoint *outPoint, ControlMeasure *patternCM, - string registerMeasures, bool outputFailed); + QString registerMeasures, bool outputFailed); void validatePoint(ControlPoint *point, ControlMeasure *reference, double shiftTolerance); Validation backRegister(ControlMeasure *measure, ControlMeasure *reference, @@ -189,8 +189,8 @@ bool outputValue(ofstream &os, double value); int calcGoodMeasureCount(const ControlPoint *point); void printTemp(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper["PrintTemp"] = (void *) printTemp; return helper; } @@ -222,8 +222,8 @@ void IsisMain() { } // Determine which points/measures to register - string registerPoints = ui.GetString("POINTS"); - string registerMeasures = ui.GetString("MEASURES"); + QString registerPoints = ui.GetString("POINTS"); + QString registerMeasures = ui.GetString("MEASURES"); bool outputFailed = ui.GetBoolean("OUTPUTFAILED"); bool outputIgnored = ui.GetBoolean("OUTPUTIGNORED"); @@ -236,7 +236,7 @@ void IsisMain() { ControlNet outNet(ui.GetFileName("CNET")); if (outNet.GetNumPoints() <= 0) { - std::string msg = "Control network [" + ui.GetFileName("CNET") + "] "; + QString msg = "Control network [" + ui.GetFileName("CNET") + "] "; msg += "contains no points"; throw IException(IException::User, msg, _FILEINFO_); } @@ -255,7 +255,7 @@ void IsisMain() { cubeMgr = new CubeManager; cubeMgr->SetNumOpenCubes(500); - string validate = ui.GetString("VALIDATE"); + QString validate = ui.GetString("VALIDATE"); if (validate != "SKIP") { validator = AutoRegFactory::Create(pvl); @@ -349,10 +349,10 @@ void IsisMain() { // The flatfile is comma seperated and can be imported into an excel // spreadsheet if (ui.WasEntered("FLATFILE")) { - string fFile = FileName(ui.GetFileName("FLATFILE")).expanded(); + QString fFile = FileName(ui.GetFileName("FLATFILE")).expanded(); ofstream os; - os.open(fFile.c_str(), ios::out); + os.open(fFile.toAscii().data(), ios::out); os << "PointId,Filename,MeasureType,Reference,EditLock,Ignore,Registered," << "OriginalMeasurementSample,OriginalMeasurementLine," << @@ -379,18 +379,18 @@ void IsisMain() { const ControlMeasure * cmOrig = inPoint->GetMeasure((QString) cmTrans->GetCubeSerialNumber()); - string pointId = outPoint->GetId(); + QString pointId = outPoint->GetId(); - string fullName = files->FileName(cmTrans->GetCubeSerialNumber()); - string filename = FileName(fullName).baseName(); + QString fullName = files->FileName(cmTrans->GetCubeSerialNumber()); + QString filename = FileName(fullName).baseName(); - string measureType = cmTrans->MeasureTypeToString( + QString measureType = cmTrans->MeasureTypeToString( cmTrans->GetType()); - string reference = outPoint->GetRefMeasure() == cmTrans ? + QString reference = outPoint->GetRefMeasure() == cmTrans ? "true" : "false"; - string editLock = cmTrans->IsEditLocked() ? "true" : "false"; - string ignore = cmTrans->IsIgnored() ? "true" : "false"; - string registered = + QString editLock = cmTrans->IsEditLocked() ? "true" : "false"; + QString ignore = cmTrans->IsIgnored() ? "true" : "false"; + QString registered = !cmOrig->IsRegistered() && cmTrans->IsRegistered() ? "true" : "false"; @@ -439,9 +439,9 @@ void IsisMain() { } if (logFalsePositives) { - string filename = FileName(ui.GetFileName("FALSEPOSITIVES")).expanded(); + QString filename = FileName(ui.GetFileName("FALSEPOSITIVES")).expanded(); ofstream os; - os.open(filename.c_str(), ios::out); + os.open(filename.toAscii().data(), ios::out); os << Validation::getHeader() << endl; for (int i = 0; i < falsePositives->size(); i++) { @@ -452,15 +452,15 @@ void IsisMain() { } PvlGroup pLog("Points"); - pLog += PvlKeyword("Total", outNet.GetNumPoints()); - pLog += PvlKeyword("Ignored", ignored); + pLog += PvlKeyword("Total", toString(outNet.GetNumPoints())); + pLog += PvlKeyword("Ignored", toString(ignored)); Application::Log(pLog); PvlGroup mLog("Measures"); - mLog += PvlKeyword("Locked", locked); - mLog += PvlKeyword("Registered", registered); - mLog += PvlKeyword("NotIntersected", notintersected); - mLog += PvlKeyword("Unregistered", unregistered); + mLog += PvlKeyword("Locked", toString(locked)); + mLog += PvlKeyword("Registered", toString(registered)); + mLog += PvlKeyword("NotIntersected", toString(notintersected)); + mLog += PvlKeyword("Unregistered", toString(unregistered)); Application::Log(mLog); // Log Registration Statistics @@ -514,7 +514,7 @@ void IsisMain() { void registerPoint(ControlPoint *outPoint, ControlMeasure *patternCM, - string registerMeasures, bool outputFailed) { + QString registerMeasures, bool outputFailed) { Cube &patternCube = *cubeMgr->OpenCube( files->FileName(patternCM->GetCubeSerialNumber())); @@ -699,7 +699,7 @@ void validatePoint(ControlPoint *point, ControlMeasure *reference, if (logFalsePositives) { if (!validation.succeeded()) { falsePositives->append( - QString::fromStdString(validation.toString())); + validation.toString()); } } } diff --git a/isis/src/control/apps/seedgrid/seedgrid.cpp b/isis/src/control/apps/seedgrid/seedgrid.cpp index 2b9cbb4eb8..80adcd4e57 100644 --- a/isis/src/control/apps/seedgrid/seedgrid.cpp +++ b/isis/src/control/apps/seedgrid/seedgrid.cpp @@ -20,8 +20,8 @@ void checkLatitude(double minLat, double maxLat); void checkLongitude(double minLon, double maxLon, int lonDomain); void printMap(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper["PrintMap"] = (void *) printMap; return helper; } @@ -35,7 +35,7 @@ void IsisMain() { double equatorialRadius = 0.0; - string spacing = ui.GetString("SPACING"); + QString spacing = ui.GetString("SPACING"); if (spacing == "METER") { Pvl userMap; userMap.Read(ui.GetFileName("MAP")); @@ -43,7 +43,7 @@ void IsisMain() { // Construct a Projection for converting between Lon/Lat and X/Y // TODO: Should this be an option to include this in the program? - string target; + QString target; if (ui.WasEntered("TARGET")) { target = ui.GetString("TARGET"); } @@ -52,7 +52,7 @@ void IsisMain() { ui.PutAsString("TARGET", target); } else { - string msg = "A target must be specified either by the [TARGET] " + QString msg = "A target must be specified either by the [TARGET] " "parameter or included as a value for keyword [TargetName] in the " "projection file"; throw IException(IException::User, msg, _FILEINFO_); @@ -65,17 +65,17 @@ void IsisMain() { PvlGroup radii = Projection::TargetRadii(target); mapGroup.AddKeyword(PvlKeyword("EquatorialRadius", - (string) radii["EquatorialRadius"])); + (QString) radii["EquatorialRadius"])); mapGroup.AddKeyword(PvlKeyword("PolarRadius", - (string) radii["PolarRadius"])); + (QString) radii["PolarRadius"])); } if (!ui.WasEntered("MAP")) { mapGroup.AddKeyword(PvlKeyword("LatitudeType", "Planetocentric")); mapGroup.AddKeyword(PvlKeyword("LongitudeDirection", "PositiveEast")); - mapGroup.AddKeyword(PvlKeyword("LongitudeDomain", 360)); - mapGroup.AddKeyword(PvlKeyword("CenterLatitude", 0)); - mapGroup.AddKeyword(PvlKeyword("CenterLongitude", 0)); + mapGroup.AddKeyword(PvlKeyword("LongitudeDomain", toString(360))); + mapGroup.AddKeyword(PvlKeyword("CenterLatitude", toString(0))); + mapGroup.AddKeyword(PvlKeyword("CenterLongitude", toString(0))); } double minLat = ui.GetDouble("MINLAT"); @@ -84,10 +84,10 @@ void IsisMain() { double maxLon = ui.GetDouble("MAXLON"); checkLatitude(minLat, maxLat); - mapGroup.AddKeyword(PvlKeyword("MinimumLatitude", minLat), Pvl::Replace); - mapGroup.AddKeyword(PvlKeyword("MaximumLatitude", maxLat), Pvl::Replace); - mapGroup.AddKeyword(PvlKeyword("MinimumLongitude", minLon), Pvl::Replace); - mapGroup.AddKeyword(PvlKeyword("MaximumLongitude", maxLon), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("MinimumLatitude", toString(minLat)), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("MaximumLatitude", toString(maxLat)), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("MinimumLongitude", toString(minLon)), Pvl::Replace); + mapGroup.AddKeyword(PvlKeyword("MaximumLongitude", toString(maxLon)), Pvl::Replace); Projection *proj = ProjectionFactory::Create(userMap); @@ -101,13 +101,13 @@ void IsisMain() { double maxY; bool foundRange = proj->XYRange(minX, maxX, minY, maxY); if (!foundRange) { - string msg = "Cannot convert Lat/Long range to an X/Y range"; + QString msg = "Cannot convert Lat/Long range to an X/Y range"; throw IException(IException::User, msg, _FILEINFO_); } // Create the control net to store the points in. cnet.SetTarget(target); - string networkId; + QString networkId; if (ui.WasEntered("NETWORKID")) { networkId = ui.GetString("NETWORKID"); cnet.SetNetworkId(networkId); @@ -123,7 +123,7 @@ void IsisMain() { double xStepSize = ui.GetDouble("XSTEP"); double yStepSize = ui.GetDouble("YSTEP"); - equatorialRadius = mapGroup.FindKeyword("EquatorialRadius")[0]; + equatorialRadius = toDouble(mapGroup.FindKeyword("EquatorialRadius")[0]); Progress gridStatus; @@ -171,18 +171,18 @@ void IsisMain() { else { if (!ui.WasEntered("TARGET")) { - string msg = "A target must be specified by the [TARGET] parameter "; + QString msg = "A target must be specified by the [TARGET] parameter "; msg += "or included as a value for keyword [TargetName] in the projection file"; throw IException(IException::User, msg, _FILEINFO_); } - string target = ui.GetString("TARGET"); + QString target = ui.GetString("TARGET"); PvlGroup radii = Projection::TargetRadii(target); equatorialRadius = radii["EquatorialRadius"]; // Create the control net to store the points in. cnet.SetTarget(target); - string networkId; + QString networkId; if (ui.WasEntered("NETWORKID")) { networkId = ui.GetString("NETWORKID"); cnet.SetNetworkId(networkId); @@ -246,8 +246,8 @@ void IsisMain() { } PvlGroup results("Results"); - results += PvlKeyword("EquatorialRadius", equatorialRadius); - results += PvlKeyword("NumberControlPoints", cnet.GetNumPoints()); + results += PvlKeyword("EquatorialRadius", toString(equatorialRadius)); + results += PvlKeyword("NumberControlPoints", toString(cnet.GetNumPoints())); Application::Log(results); cnet.Write(ui.GetFileName("ONET")); @@ -256,18 +256,18 @@ void IsisMain() { void checkLatitude(double minLat, double maxLat) { if (minLat > maxLat) { - string msg = "MINLAT [" + IString(minLat) + - "] is greater than MAXLAT [" + IString(maxLat) + "]"; + QString msg = "MINLAT [" + toString(minLat) + + "] is greater than MAXLAT [" + toString(maxLat) + "]"; throw IException(IException::User, msg, _FILEINFO_); } if (minLat < -90) { - string msg = "MINLAT [" + IString(minLat) + "] is less than -90"; + QString msg = "MINLAT [" + toString(minLat) + "] is less than -90"; throw IException(IException::User, msg, _FILEINFO_); } if (maxLat > 90) { - string msg = "MAXLAT [" + IString(maxLat) + "] is greater than 90"; + QString msg = "MAXLAT [" + toString(maxLat) + "] is greater than 90"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -276,27 +276,27 @@ void checkLatitude(double minLat, double maxLat) { void checkLongitude(double minLon, double maxLon, int lonDomain) { if (minLon > maxLon) { double suggestedMaxLon = maxLon + lonDomain + (lonDomain - 360); - string msg = "MINLON [" + IString(minLon) + - "] is greater than MAXLON [" + IString(maxLon) + "]. " + - "If you meant to wrap around the [" + IString(lonDomain) + + QString msg = "MINLON [" + toString(minLon) + + "] is greater than MAXLON [" + toString(maxLon) + "]. " + + "If you meant to wrap around the [" + toString(lonDomain) + "] longitude " + "boundary, use a MAXLON of [" + - IString(suggestedMaxLon) + "]"; + toString(suggestedMaxLon) + "]"; throw IException(IException::User, msg, _FILEINFO_); } if (minLon < lonDomain - 360) { - string msg = "MINLON [" + IString(minLon) + - "] is less than [" + IString(lonDomain) + "] domain minimum [" + - IString(lonDomain - 360) + "]"; + QString msg = "MINLON [" + toString(minLon) + + "] is less than [" + toString(lonDomain) + "] domain minimum [" + + toString(lonDomain - 360) + "]"; throw IException(IException::User, msg, _FILEINFO_); } if (maxLon - minLon > 360) { int range = (int) (maxLon - minLon - 1); int loops = range / 360 + 1; - string msg = "The specified longitude range [" + IString(minLon) + - "] to [" + IString(maxLon) + "] seeds that same area of the target [" + - IString(loops) + "] times"; + QString msg = "The specified longitude range [" + toString(minLon) + + "] to [" + toString(maxLon) + "] seeds that same area of the target [" + + toString(loops) + "] times"; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/control/apps/slither/ControlByRow.h b/isis/src/control/apps/slither/ControlByRow.h index 8244e309f4..fd1cbd9759 100644 --- a/isis/src/control/apps/slither/ControlByRow.h +++ b/isis/src/control/apps/slither/ControlByRow.h @@ -235,7 +235,7 @@ namespace Isis { return (computeStats(_rowList.getNth(i))); } catch(IException &oor) { - std::string msg = "Requested value (" + IString(i) + ") not found"; + QString msg = "Requested value (" + toString(i) + ") not found"; throw IException(oor, IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/control/apps/slither/slither.cpp b/isis/src/control/apps/slither/slither.cpp index aa3670be48..819800335a 100644 --- a/isis/src/control/apps/slither/slither.cpp +++ b/isis/src/control/apps/slither/slither.cpp @@ -23,12 +23,12 @@ void IsisMain() { // Get the control point file UserInterface &ui = Application::GetUserInterface(); - string cfile = ui.GetFileName("CONTROL"); + QString cfile = ui.GetFileName("CONTROL"); ControlNet cn(cfile); // Set default type to Cubic spline interpolation NumericalApproximation::InterpType iType(NumericalApproximation::CubicNatural); - string splineType = ui.GetString("SPLINE"); + QString splineType = ui.GetString("SPLINE"); if(splineType == "LINEAR") { iType = NumericalApproximation::Linear; } @@ -47,7 +47,7 @@ void IsisMain() { SlitherTransform transform(*icube, cn, iType, iType); transform.addLineOffset(lineOffset); transform.addSampleOffset(sampleOffset); - string splineDir = ui.GetString("DIRECTION"); + QString splineDir = ui.GetString("DIRECTION"); if(splineDir == "REVERSE") { transform.setReverse(); } @@ -55,9 +55,9 @@ void IsisMain() { // Dump the transform statistics if(ui.WasEntered("RESULTS")) { // Get the control point file - string rFile = FileName(ui.GetFileName("RESULTS")).expanded(); + QString rFile = FileName(ui.GetFileName("RESULTS")).expanded(); ofstream os; - os.open(rFile.c_str(), ios::out); + os.open(rFile.toAscii().data(), ios::out); os << "# Slither Transform Results\n" << "# RunDate: " << iTime::CurrentLocalTime() << endl << "# FROM: " << icube->getFileName() << endl @@ -83,7 +83,7 @@ void IsisMain() { interp = new Interpolator(Interpolator::CubicConvolutionType); } else { - string msg = "Unknown value for INTERP [" + + QString msg = "Unknown value for INTERP [" + ui.GetString("INTERP") + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/control/apps/warp/WarpTransform.cpp b/isis/src/control/apps/warp/WarpTransform.cpp index 2875b3b19a..82f6561a00 100644 --- a/isis/src/control/apps/warp/WarpTransform.cpp +++ b/isis/src/control/apps/warp/WarpTransform.cpp @@ -139,9 +139,9 @@ namespace Isis { PvlGroup WarpTransform::Residuals() { PvlGroup errs("Residuals"); for (int i = 0; i < p_lsqInputLine->Knowns(); i++) { - PvlKeyword p("POINT" + IString(i + 1)); - p += p_lsqInputLine->Residual(i); - p += p_lsqInputSamp->Residual(i); + PvlKeyword p("POINT" + toString(i + 1)); + p += toString(p_lsqInputLine->Residual(i)); + p += toString(p_lsqInputSamp->Residual(i)); errs += p; } return errs; diff --git a/isis/src/control/apps/warp/warp.cpp b/isis/src/control/apps/warp/warp.cpp index 5e1245fdd4..a37d0ebb92 100644 --- a/isis/src/control/apps/warp/warp.cpp +++ b/isis/src/control/apps/warp/warp.cpp @@ -20,14 +20,14 @@ void IsisMain() { // Get the control point file UserInterface &ui = Application::GetUserInterface(); - string cfile = ui.GetFileName("CNET"); + QString cfile = ui.GetFileName("CNET"); ControlNet cn(cfile); std::vector inputLine, inputSample, outputLine, outputSample; for (int i = 0; i < cn.GetNumPoints(); i++) { const ControlPoint *cp = cn.GetPoint(i); if (cp->GetNumMeasures() != 2) { - string msg = "Control points must have exactly 2 control measures"; + QString msg = "Control points must have exactly 2 control measures"; throw IException(IException::User, msg, _FILEINFO_); } if (!cp->IsIgnored()) { @@ -41,7 +41,7 @@ void IsisMain() { // If there are no valid control points, // throw an error if (inputLine.size() < 1) { - string msg = "The specified Control Network is empty."; + QString msg = "The specified Control Network is empty."; throw IException(IException::User, msg, _FILEINFO_); } @@ -52,7 +52,7 @@ void IsisMain() { int onl, ons; if (ui.GetString("OSIZE") == "MATCH") { Cube c; - c.open(IString(ui.GetFileName("CUBE")), "r"); + c.open(ui.GetFileName("CUBE"), "r"); onl = c.getLineCount(); ons = c.getSampleCount(); c.close(); @@ -96,8 +96,8 @@ void IsisMain() { interp = new Interpolator(Interpolator::CubicConvolutionType); } else { - string msg = "Unknow value for INTERP [" + - ui.GetString("INTERP") + "]"; + QString msg = "Unknow value for INTERP [" + + ui.GetString("INTERP") + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/control/objs/BundleAdjust/BundleAdjust.cpp b/isis/src/control/objs/BundleAdjust/BundleAdjust.cpp index 8e0ed29424..7e8cc36544 100644 --- a/isis/src/control/objs/BundleAdjust/BundleAdjust.cpp +++ b/isis/src/control/objs/BundleAdjust/BundleAdjust.cpp @@ -35,7 +35,7 @@ namespace Isis { static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, const char* message) { - std::string errlog; + QString errlog; errlog = "SPARSE: "; errlog += message; @@ -43,8 +43,8 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, PvlGroup gp(errlog); gp += PvlKeyword("File",file); - gp += PvlKeyword("Line_Number", nLineNo); - gp += PvlKeyword("Status", nStatus); + gp += PvlKeyword("Line_Number", toString(nLineNo)); + gp += PvlKeyword("Status", toString(nStatus)); Application::Log(gp); @@ -52,8 +52,8 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, throw IException(IException::Unknown, errlog, _FILEINFO_); } - BundleAdjust::BundleAdjust(const std::string &cnetFile, - const std::string &cubeList, + BundleAdjust::BundleAdjust(const QString &cnetFile, + const QString &cubeList, bool bPrintSummary) { Progress progress; m_bCleanUp = true; @@ -78,9 +78,9 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, m_maxLikelihoodIndex=0; } - BundleAdjust::BundleAdjust(const std::string &cnetFile, - const std::string &cubeList, - const std::string &heldList, + BundleAdjust::BundleAdjust(const QString &cnetFile, + const QString &cubeList, + const QString &heldList, bool bPrintSummary) { Progress progress; m_bCleanUp = true; @@ -187,7 +187,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, delete m_cumPro; } - bool BundleAdjust::ReadSCSigmas(const std::string &scsigmasList) { + bool BundleAdjust::ReadSCSigmas(const QString &scsigmasList) { CSVReader csv; csv.setSkip(20); @@ -195,7 +195,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, csv.read(scsigmasList); } catch (IException &e) { - std::string msg = "Failed to read spacecraft sigmas file"; + QString msg = "Failed to read spacecraft sigmas file"; throw IException(e, IException::Io, msg, _FILEINFO_); } @@ -214,9 +214,9 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, scs.weights.resize(6); for (int j = 0; j < nsigmas; j++) { - std::string str = row[j+2]; + QString str = row[j+2]; - double d = atof(str.c_str()); + double d = atof(str.toAscii().data()); if (d == 0.0) continue; @@ -394,7 +394,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // verify measures exist for all images int nimagesWithInsufficientMeasures = 0; - std::string msg = "Images with one or less measures:\n"; + QString msg = "Images with one or less measures:\n"; int nImages = m_pSnList->Size(); for (int i = 0; i < nImages; i++) { int nMeasures = @@ -404,7 +404,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, continue; nimagesWithInsufficientMeasures++; - msg += m_pSnList->FileName(i) + ": " + IString(nMeasures) + "\n"; + msg += m_pSnList->FileName(i) + ": " + toString(nMeasures) + "\n"; } if ( nimagesWithInsufficientMeasures > 0 ) { throw IException(IException::User, msg, _FILEINFO_); @@ -502,7 +502,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, void BundleAdjust::CheckHeldList() { for (int ih = 0; ih < m_pHeldSnList->Size(); ih++) { if (!(m_pSnList->HasSerialNumber(m_pHeldSnList->SerialNumber(ih)))) { - std::string msg = "Held image [" + m_pHeldSnList->SerialNumber(ih) + QString msg = "Held image [" + m_pHeldSnList->SerialNumber(ih) + "not in FROMLIST"; throw IException(IException::User, msg, _FILEINFO_); } @@ -663,7 +663,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if (m_pHeldSnList->HasSerialNumber(m_pSnList->SerialNumber(isn))) continue; - std::string msg = "Cube file " + m_pSnList->FileName(isn) + QString msg = "Cube file " + m_pSnList->FileName(isn) + " must be held since it is on the same observation as held cube " + m_pHeldSnList->FileName(ih); throw IException(IException::User, msg, _FILEINFO_); @@ -711,7 +711,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // Make sure the degree of the polynomial the user selected for // the camera angles fit is sufficient for the selected CAMSOLVE if (m_nNumberCamAngleCoefSolved > m_nsolveCKDegree + 1) { - std::string msg = "Selected SolveCameraDegree " + IString(m_nsolveCKDegree) + QString msg = "Selected SolveCameraDegree " + toString(m_nsolveCKDegree) + " is not sufficient for the CAMSOLVE"; throw IException(IException::User, msg, _FILEINFO_); } @@ -748,7 +748,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // Make sure the degree of the polynomial the user selected for // the camera position fit is sufficient for the selected CAMSOLVE if (m_nNumberCamPosCoefSolved > m_nsolveSPKDegree + 1) { - std::string msg = "Selected SolveCameraPositionDegree " + IString(m_nsolveSPKDegree) + QString msg = "Selected SolveCameraPositionDegree " + toString(m_nsolveSPKDegree) + " is not sufficient for the CAMSOLVE"; throw IException(IException::User, msg, _FILEINFO_); } @@ -913,7 +913,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // int nImages = Images(); // for (int i = 0; i < nImages; i++) { // if (m_pCnet->Camera(i)->GetCameraType() == 0) { -// std::string msg = "At least one sensor is a frame camera. Spacecraft Option OVERHERMITE is not valid for frame cameras\n"; +// QString msg = "At least one sensor is a frame camera. Spacecraft Option OVERHERMITE is not valid for frame cameras\n"; // throw IException(IException::User, msg, _FILEINFO_); // } // } @@ -1101,7 +1101,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, else if (m_bDeltack && m_nDegreesOfFreedom == 0) m_dSigma0 = dvtpv; else { - std::string msg = "Degrees of Freedom " + IString(m_nDegreesOfFreedom) + QString msg = "Degrees of Freedom " + toString(m_nDegreesOfFreedom) + " is invalid (<= 0)!"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -1203,7 +1203,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, return true; - std::string msg = "Need to return something here, or just change the whole darn thing? ["; + QString msg = "Need to return something here, or just change the whole darn thing? ["; // msg += IString(tol) + "] in less than ["; // msg += IString(m_nMaxIterations) + "] iterations"; throw IException(IException::User, msg, _FILEINFO_); @@ -1299,7 +1299,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if( point->IsRejected() ) { nRejected3DPoints++; -// sprintf(buf, "\tRejected %s - 3D Point %d of %d RejLimit = %lf\n", point.Id().c_str(),nPointIndex,n3DPoints,m_dRejectionLimit); +// sprintf(buf, "\tRejected %s - 3D Point %d of %d RejLimit = %lf\n", point.Id().toAscii().data(),nPointIndex,n3DPoints,m_dRejectionLimit); // m_fp_log << buf; nPointIndex++; @@ -1647,7 +1647,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if( point->IsRejected() ) { nRejected3DPoints++; -// sprintf(buf, "\tRejected %s - 3D Point %d of %d RejLimit = %lf\n", point.Id().c_str(),nPointIndex,n3DPoints,m_dRejectionLimit); +// sprintf(buf, "\tRejected %s - 3D Point %d of %d RejLimit = %lf\n", point.Id().toAscii().data(),nPointIndex,n3DPoints,m_dRejectionLimit); // m_fp_log << buf; nPointIndex++; @@ -2053,7 +2053,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // Distance(apriorisigmas[2], Distance::Meters)); // } // catch (iException &e) { -// std::string msg = "Required target radii not available for converting lat/lon sigmas from meters "; +// QString msg = "Required target radii not available for converting lat/lon sigmas from meters "; // msg += "for control point " + Isis::IString(point->GetId()); // throw iException::Message(iException::Programmer, msg, _FILEINFO_); // } @@ -2349,7 +2349,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // load cholmod triplet if ( !loadCholmodTriplet() ) { - std::string msg = "CHOLMOD: Failed to load Triplet matrix"; + QString msg = "CHOLMOD: Failed to load Triplet matrix"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -2376,7 +2376,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // check for "matrix not positive definite" error if ( m_cm.status == CHOLMOD_NOT_POSDEF ) { - std::string msg = "matrix NOT positive-definite: failure at column " + QString msg = "matrix NOT positive-definite: failure at column " + m_L->minor; throw IException(IException::User, msg, _FILEINFO_); } @@ -2822,7 +2822,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, //Compute the look vector in instrument coordinates based on time of observation and apriori lat/lon/radius if (!(pCamera->GroundMap()->GetXY(point.GetAdjustedSurfacePoint(), &dComputedx, &dComputedy))) { - std::string msg = "Unable to map apriori surface point for measure "; + QString msg = "Unable to map apriori surface point for measure "; msg += measure.GetCubeSerialNumber() + " on point " + point.GetId() + " into focal plane"; throw IException(IException::User, msg, _FILEINFO_); } @@ -3040,7 +3040,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, //Compute the look vector in instrument coordinates based on time of observation and apriori lat/lon/radius if (!(pCamera->GroundMap()->GetXY(point.GetAdjustedSurfacePoint(), &dComputedx, &dComputedy))) { - std::string msg = "Unable to map apriori surface point for measure "; + QString msg = "Unable to map apriori surface point for measure "; msg += measure.GetCubeSerialNumber() + " on point " + point.GetId() + " into focal plane"; throw iException::Message(iException::User, msg, _FILEINFO_); } @@ -3517,7 +3517,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, int zeroColumn = m_pLsq->Solve(Isis::LeastSquares::SPARSE); if (zeroColumn != 0) { - std::string msg; + QString msg; int imageColumns = Observations() * m_nNumImagePartials; if (zeroColumn <= imageColumns) { msg = "Solution matrix has a column of zeros which probably "; @@ -3534,10 +3534,10 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, } } catch (IException &e) { - std::string msg = "Unable to solve in BundleAdjust, "; - msg += "Iteration " + Isis::IString(m_nIteration) + " of "; - msg += Isis::IString(m_nMaxIterations) + ", Sigma0 = "; - msg += Isis::IString(m_dConvergenceThreshold); + QString msg = "Unable to solve in BundleAdjust, "; + msg += "Iteration " + toString(m_nIteration) + " of "; + msg += toString(m_nMaxIterations) + ", Sigma0 = "; + msg += toString(m_dConvergenceThreshold); throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -3582,9 +3582,9 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, sqrt(m_Statsy.SumSquare() / m_Statsy.TotalPixels()) : 0.; } - std::string msg = "Did not converge to Sigma0 criteria ["; - msg += IString(m_dConvergenceThreshold) + "] in less than ["; - msg += IString(m_nMaxIterations) + "] iterations"; + QString msg = "Did not converge to Sigma0 criteria ["; + msg += toString(m_dConvergenceThreshold) + "] in less than ["; + msg += toString(m_nMaxIterations) + "] iterations"; throw IException(IException::User, msg, _FILEINFO_); } @@ -3704,7 +3704,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, //Compute the look vector in instrument coordinates based on time of observation and apriori lat/lon/radius double dComputedx, dComputedy; if (!(pCamera->GroundMap()->GetXY(point->GetAdjustedSurfacePoint(), &dComputedx, &dComputedy))) { - std::string msg = "Unable to map apriori surface point for measure "; + QString msg = "Unable to map apriori surface point for measure "; msg += measure->GetCubeSerialNumber() + " on point " + point->GetId() + " into focal plane"; throw IException(IException::User, msg, _FILEINFO_); } @@ -3910,7 +3910,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, //Compute the look vector in instrument coordinates based on time of observation and apriori lat/lon/radius double dComputedx, dComputedy; if (!(pCamera->GroundMap()->GetXY(point->GetAdjustedSurfacePoint(), &dComputedx, &dComputedy))) { - std::string msg = "Unable to map apriori surface point for measure "; + QString msg = "Unable to map apriori surface point for measure "; msg += measure->GetCubeSerialNumber() + " on point " + point->GetId() + " into focal plane"; throw iException::Message(iException::User, msg, _FILEINFO_); } @@ -4263,7 +4263,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, int nClosetApproaches = 0; -// const char* buf = rPoint.Id().c_str(); +// const char* buf = rPoint.Id().toAscii().data(); // loop over observations (in Astro Terms "measures") int nObservations = rPoint.GetNumMeasures(); @@ -4471,7 +4471,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, (double) rPoint.GetAdjustedSurfacePoint().GetLatitude().radians(), pB); -// printf("%s: %lf %lf %lf\n",rPoint.Id().c_str(), AveragePoint[0],AveragePoint[1],AveragePoint[2]); +// printf("%s: %lf %lf %lf\n",rPoint.Id().toAscii().data(), AveragePoint[0],AveragePoint[1],AveragePoint[2]); // printf(" %lf %lf %lf\n", avglat,avglon,avgrad); // printf(" %lf %lf %lf\n", lat,lon,rad); // printf(" %lf %lf %lf\n",pB[0],pB[1],pB[2]); @@ -4626,8 +4626,8 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dLongCorr = NIC(1); dRadCorr = NIC(2); -// printf("Point %s Corrections\n Latitude: %20.10lf\nLongitude: %20.10lf\n Radius: %20.10lf\n",point->GetId().c_str(),dLatCorr, dLongCorr, dRadCorr); -// std::cout <<"Point " << point->GetId().c_str() << " Corrections\n" << "Latitude: " << dLatCorr << std::endl << "Longitude: " << dLongCorr << std::endl << "Radius: " << dRadCorr << std::endl; +// printf("Point %s Corrections\n Latitude: %20.10lf\nLongitude: %20.10lf\n Radius: %20.10lf\n",point->GetId().toAscii().data(),dLatCorr, dLongCorr, dRadCorr); +// std::cout <<"Point " << point->GetId().toAscii().data() << " Corrections\n" << "Latitude: " << dLatCorr << std::endl << "Longitude: " << dLongCorr << std::endl << "Radius: " << dRadCorr << std::endl; double dLat = point->GetAdjustedSurfacePoint().GetLatitude().degrees(); double dLon = point->GetAdjustedSurfacePoint().GetLongitude().degrees(); @@ -4677,7 +4677,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // (dLon * DEG2RAD), // (dLat * DEG2RAD), // pB); -// printf("%s %lf %lf %lf\n",point->Id().c_str(),pB[0],pB[1],pB[2]); +// printf("%s %lf %lf %lf\n",point->Id().toAscii().data(),pB[0],pB[1],pB[2]); } // end loop over point corrections } @@ -4817,8 +4817,8 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dLongCorr = NIC(1); dRadCorr = NIC(2); -// printf("Point %s Corrections\n Latitude: %20.10lf\nLongitude: %20.10lf\n Radius: %20.10lf\n",point->GetId().c_str(),dLatCorr, dLongCorr, dRadCorr); -// std::cout <<"Point " << point->GetId().c_str() << " Corrections\n" << "Latitude: " << dLatCorr << std::endl << "Longitude: " << dLongCorr << std::endl << "Radius: " << dRadCorr << std::endl; +// printf("Point %s Corrections\n Latitude: %20.10lf\nLongitude: %20.10lf\n Radius: %20.10lf\n",point->GetId().toAscii().data(),dLatCorr, dLongCorr, dRadCorr); +// std::cout <<"Point " << point->GetId().toAscii().data() << " Corrections\n" << "Latitude: " << dLatCorr << std::endl << "Longitude: " << dLongCorr << std::endl << "Radius: " << dRadCorr << std::endl; double dLat = point->GetAdjustedSurfacePoint().GetLatitude().degrees(); double dLon = point->GetAdjustedSurfacePoint().GetLongitude().degrees(); @@ -4868,7 +4868,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // (dLon * DEG2RAD), // (dLat * DEG2RAD), // pB); -// printf("%s %lf %lf %lf\n",point->Id().c_str(),pB[0],pB[1],pB[2]); +// printf("%s %lf %lf %lf\n",point->Id().toAscii().data(),pB[0],pB[1],pB[2]); } // end loop over point corrections } @@ -4930,7 +4930,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, m_Statsrxy.AddData(vx); m_Statsrxy.AddData(vy); -// printf("Point: %s rx: %20.10lf ry: %20.10lf\n",point->Id().c_str(),rx,ry); +// printf("Point: %s rx: %20.10lf ry: %20.10lf\n",point->Id().toAscii().data(),rx,ry); vtpv += vx * vx * dWeight + vy * vy * dWeight; } @@ -4950,7 +4950,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, bounded_vector& weights = m_Point_Weights[nPointIndex]; bounded_vector& corrections = m_Point_Corrections[nPointIndex]; - //printf("Point: %s PointIndex: %d Loop(i): %d\n",point->GetId().c_str(),nPointIndex,i); + //printf("Point: %s PointIndex: %d Loop(i): %d\n",point->GetId().toAscii().data(),nPointIndex,i); //std::cout << weights << std::endl; //std::cout << corrections << std::endl; @@ -5290,7 +5290,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // was it previously rejected? if( measure->IsRejected() ) { - printf("Coming back in: %s\r",point->GetId().c_str()); + printf("Coming back in: %s\r",point->GetId().toAscii().data()); nComingBack++; m_pCnet->DecrementNumberOfRejectedMeasuresInImage(measure->GetCubeSerialNumber()); } @@ -5339,14 +5339,14 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // do we still have sufficient remaining observations for this 3D point? if( ( nMeasures-nRejected ) < 2 ) { point->SetRejected(true); - printf("Rejecting Entire Point: %s\r",point->GetId().c_str()); + printf("Rejecting Entire Point: %s\r",point->GetId().toAscii().data()); } else point->SetRejected(false); // int ndummy = point->GetNumberOfRejectedMeasures(); -// printf("Rejected for point %s = %d\n", point->GetId().c_str(), ndummy); -// printf("%s: %20.10lf %20.10lf*\n",point->GetId().c_str(), rejected->GetSampleResidual(), rejected->GetLineResidual()); +// printf("Rejected for point %s = %d\n", point->GetId().toAscii().data(), ndummy); +// printf("%s: %20.10lf %20.10lf*\n",point->GetId().toAscii().data(), rejected->GetSampleResidual(), rejected->GetLineResidual()); } m_nRejectedObservations = 2*ntotalrejected; @@ -5667,7 +5667,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, (dLon * DEG2RAD), (dLat * DEG2RAD), pB); -// printf("%s %lf %lf %lf\n",point->Id().c_str(),pB[0],pB[1],pB[2]); +// printf("%s %lf %lf %lf\n",point->Id().toAscii().data(),pB[0],pB[1],pB[2]); /* else { // Recompute radius to match updated lat/lon... Should this be removed? ControlMeasure &m = ((*m_pCnet)[i])[0]; @@ -5708,8 +5708,8 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, } //! Return the ith filename in the cube list file given to constructor - std::string BundleAdjust::FileName(int i) { -// std::string serialNumber = (*m_pSnList)[i]; + QString BundleAdjust::FileName(int i) { +// QString serialNumber = (*m_pSnList)[i]; // return m_pSnList->FileName(serialNumber); return m_pSnList->FileName(i); } @@ -5800,16 +5800,16 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, void BundleAdjust::IterationSummary(double avErr, double sigmaXY, double sigmaHat, double sigmaX, double sigmaY) { //Add this iteration to the summary pvl - std::string itlog = "Iteration" + IString(m_nIteration); + QString itlog = "Iteration" + toString(m_nIteration); PvlGroup gp(itlog); - gp += PvlKeyword("MaximumError", m_dError, "pixels"); - gp += PvlKeyword("AverageError", avErr, "pixels"); - gp += PvlKeyword("SigmaXY", sigmaXY, "mm"); + gp += PvlKeyword("MaximumError", toString(m_dError), "pixels"); + gp += PvlKeyword("AverageError", toString(avErr), "pixels"); + gp += PvlKeyword("SigmaXY", toString(sigmaXY), "mm"); // gp += PvlKeyword("SigmaHat", sigmaHat, "mm"); - gp += PvlKeyword("Sigma0", m_dSigma0, "mm"); - gp += PvlKeyword("SigmaX", sigmaX, "mm"); - gp += PvlKeyword("SigmaY", sigmaY, "mm"); + gp += PvlKeyword("Sigma0", toString(m_dSigma0), "mm"); + gp += PvlKeyword("SigmaX", toString(sigmaX), "mm"); + gp += PvlKeyword("SigmaY", toString(sigmaY), "mm"); std::ostringstream ostr; ostr<GetNetworkId().c_str()); + sprintf(buf,"\n Network Id: %s", m_pCnet->GetNetworkId().toAscii().data()); fp_out << buf; - sprintf(buf,"\n Network Description: %s", m_pCnet->Description().c_str()); + sprintf(buf,"\n Network Description: %s", m_pCnet->Description().toAscii().data()); fp_out << buf; - sprintf(buf,"\n Target: %s", m_pCnet->GetTarget().c_str()); + sprintf(buf,"\n Target: %s", m_pCnet->GetTarget().toAscii().data()); fp_out << buf; sprintf(buf,"\n\n Linear Units: kilometers"); fp_out << buf; @@ -6081,7 +6081,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, m_bSolveRadii ? sprintf(buf, "\n RADIUS: ON"): sprintf(buf, "\n RADIUS: OFF"); fp_out << buf; - sprintf(buf,"\n SOLUTION TYPE: %s", m_strSolutionMethod.c_str()); + sprintf(buf,"\n SOLUTION TYPE: %s", m_strSolutionMethod.toAscii().data()); fp_out << buf; m_bErrorPropagation ? sprintf(buf, "\n ERROR PROPAGATION: ON"): sprintf(buf, "\n ERROR PROPAGATION: OFF"); @@ -6295,7 +6295,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, } } catch (IException &e) { - std::string msg = "Faiiled to output residual percentiles for bundleout"; + QString msg = "Faiiled to output residual percentiles for bundleout"; throw IException(e, IException::Io, msg, _FILEINFO_); } try { @@ -6313,7 +6313,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, fp_out << buf; } catch (IException &e) { - std::string msg = "Faiiled to output residual box plot for bundleout"; + QString msg = "Faiiled to output residual box plot for bundleout"; throw IException(e, IException::Io, msg, _FILEINFO_); } } @@ -6344,12 +6344,12 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if (nUsed == nMeasures) sprintf(buf,"%s %5d of %5d %6.3lf %6.3lf %6.3lf\n", - m_pSnList->FileName(i).c_str(), + m_pSnList->FileName(i).toAscii().data(), (nMeasures-nRejectedMeasures), nMeasures, rmsSampleResiduals,rmsLineResiduals,rmsLandSResiduals); else sprintf(buf,"%s %5d of %5d* %6.3lf %6.3lf %6.3lf\n", - m_pSnList->FileName(i).c_str(), + m_pSnList->FileName(i).toAscii().data(), (nMeasures-nRejectedMeasures), nMeasures, rmsSampleResiduals,rmsLineResiduals,rmsLandSResiduals); fp_out << buf; @@ -6363,11 +6363,11 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, */ bool BundleAdjust::OutputWithErrorPropagation() { - std:: string ofname("bundleout.txt"); + QString ofname("bundleout.txt"); if( m_strOutputFilePrefix.length() != 0 ) ofname = m_strOutputFilePrefix + "_" + ofname; - std::ofstream fp_out(ofname.c_str(), std::ios::out); + std::ofstream fp_out(ofname.toAscii().data(), std::ios::out); if (!fp_out) return false; @@ -6447,9 +6447,9 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, coefTWI.push_back(angles.at(2)); } - sprintf(buf, "\nImage Full File Name: %s\n", m_pSnList->FileName(i).c_str()); + sprintf(buf, "\nImage Full File Name: %s\n", m_pSnList->FileName(i).toAscii().data()); fp_out << buf; - sprintf(buf, "\nImage Serial Number: %s\n", m_pSnList->SerialNumber(i).c_str()); + sprintf(buf, "\nImage Serial Number: %s\n", m_pSnList->SerialNumber(i).toAscii().data()); fp_out << buf; sprintf(buf, "\n Image Initial Total Final Initial Final\n" "Parameter Value Correction Value Accuracy Accuracy\n"); @@ -6673,29 +6673,29 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, m_drms_sigmaLat); fp_out << buf; sprintf(buf, " MIN Sigma Latitude(m)%20.8lf at %s\n", - m_dminSigmaLatitude,m_idMinSigmaLatitude.c_str()); + m_dminSigmaLatitude,m_idMinSigmaLatitude.toAscii().data()); fp_out << buf; sprintf(buf, " MAX Sigma Latitude(m)%20.8lf at %s\n\n", - m_dmaxSigmaLatitude,m_idMaxSigmaLatitude.c_str()); + m_dmaxSigmaLatitude,m_idMaxSigmaLatitude.toAscii().data()); fp_out << buf; sprintf(buf, "RMS Sigma Longitude(m)%20.8lf\n", m_drms_sigmaLon); fp_out << buf; sprintf(buf, "MIN Sigma Longitude(m)%20.8lf at %s\n", - m_dminSigmaLongitude,m_idMinSigmaLongitude.c_str()); + m_dminSigmaLongitude,m_idMinSigmaLongitude.toAscii().data()); fp_out << buf; sprintf(buf, "MAX Sigma Longitude(m)%20.8lf at %s\n\n", - m_dmaxSigmaLongitude,m_idMaxSigmaLongitude.c_str()); + m_dmaxSigmaLongitude,m_idMaxSigmaLongitude.toAscii().data()); fp_out << buf; if ( m_bSolveRadii ) { sprintf(buf, " RMS Sigma Radius(m)%20.8lf\n", m_drms_sigmaRad); fp_out << buf; sprintf(buf, " MIN Sigma Radius(m)%20.8lf at %s\n", - m_dminSigmaRadius,m_idMinSigmaRadius.c_str()); + m_dminSigmaRadius,m_idMinSigmaRadius.toAscii().data()); fp_out << buf; sprintf(buf, " MAX Sigma Radius(m)%20.8lf at %s\n", - m_dmaxSigmaRadius,m_idMaxSigmaRadius.c_str()); + m_dmaxSigmaRadius,m_idMaxSigmaRadius.toAscii().data()); fp_out << buf; } else { @@ -6721,7 +6721,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, double dLatInit, dLonInit, dRadiusInit; int nGoodRays; double dResidualRms; - std::string strStatus; + QString strStatus; int nPointIndex = 0; int nPoints = m_pCnet->GetNumPoints(); @@ -6751,7 +6751,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, strStatus = "UNKNOWN"; sprintf(buf, "%16s%15s%5d of %d%6.2lf%16.8lf%16.8lf%16.8lf%16.8lf%16.8lf%16.8lf\n", - point->GetId().c_str(), strStatus.c_str(), nGoodRays, nRays, dResidualRms, dLat, + point->GetId().toAscii().data(), strStatus.toAscii().data(), nGoodRays, nRays, dResidualRms, dLat, dLon, dRadius * 0.001, dSigmaLat, dSigmaLong, dSigmaRadius); fp_out << buf; nPointIndex++; @@ -6802,7 +6802,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, strStatus = "UNKNOWN"; sprintf(buf, " Label: %s\nStatus: %s\n Rays: %d of %d\n", - point->GetId().c_str(), strStatus.c_str(), nGoodRays, nRays); + point->GetId().toAscii().data(), strStatus.toAscii().data(), nGoodRays, nRays); fp_out << buf; sprintf(buf, "\n Point Initial Total Total Final Initial Final\n" @@ -6844,11 +6844,11 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, */ bool BundleAdjust::OutputNoErrorPropagation() { - std:: string ofname("bundleout.txt"); - if( !m_strOutputFilePrefix.empty() ) + QString ofname("bundleout.txt"); + if( !m_strOutputFilePrefix.isEmpty() ) ofname = m_strOutputFilePrefix + "_" + ofname; - std::ofstream fp_out(ofname.c_str(), std::ios::out); + std::ofstream fp_out(ofname.toAscii().data(), std::ios::out); if (!fp_out) return false; @@ -6920,9 +6920,9 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, coefTWI.push_back(angles.at(2)); } - sprintf(buf, "\nImage Full File Name: %s\n", m_pSnList->FileName(i).c_str()); + sprintf(buf, "\nImage Full File Name: %s\n", m_pSnList->FileName(i).toAscii().data()); fp_out << buf; - sprintf(buf, "\n Image Serial Number: %s\n", m_pSnList->SerialNumber(i).c_str()); + sprintf(buf, "\n Image Serial Number: %s\n", m_pSnList->SerialNumber(i).toAscii().data()); fp_out << buf; sprintf(buf, "\n Image Initial Total Final Initial Final\n" "Parameter Value Correction Value Accuracy Accuracy\n"); @@ -7129,7 +7129,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, double dLatInit,dLonInit,dRadiusInit; int nGoodRays; - std::string strStatus; + QString strStatus; int nPoints = m_pCnet->GetNumPoints(); for (int i = 0; i < nPoints; i++) { @@ -7155,7 +7155,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, strStatus = "UNKNOWN"; sprintf(buf, "%16s%12s%4d of %d%6.2lf%16.8lf%16.8lf%16.8lf%11s%16s%16s\n", - point->GetId().c_str(), strStatus.c_str(), nGoodRays, nRays, dResidualRms, dLat, + point->GetId().toAscii().data(), strStatus.toAscii().data(), nGoodRays, nRays, dResidualRms, dLat, dLon, dRadius * 0.001,"N/A","N/A","N/A"); fp_out << buf; @@ -7202,7 +7202,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, strStatus = "UNKNOWN"; sprintf(buf," Label: %s\nStatus: %s\n Rays: %d of %d\n", - point->GetId().c_str(),strStatus.c_str(),nGoodRays,nRays); + point->GetId().toAscii().data(),strStatus.toAscii().data(),nGoodRays,nRays); fp_out << buf; sprintf(buf,"\n Point Initial Total Total Final Initial Final\n" @@ -7237,11 +7237,11 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, bool BundleAdjust::OutputPointsCSV() { char buf[1056]; - std:: string ofname("bundleout_points.csv"); - if( !m_strOutputFilePrefix.empty() ) + QString ofname("bundleout_points.csv"); + if( !m_strOutputFilePrefix.isEmpty() ) ofname = m_strOutputFilePrefix + "_" + ofname; - std::ofstream fp_out(ofname.c_str(), std::ios::out); + std::ofstream fp_out(ofname.toAscii().data(), std::ios::out); if (!fp_out) return false; @@ -7250,7 +7250,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, double dLat, dLon, dRadius; double dX, dY, dZ; double dSigmaLat, dSigmaLong, dSigmaRadius; - std::string strStatus; + QString strStatus; double cor_lat_m; double cor_lon_m; double cor_rad_m; @@ -7316,12 +7316,12 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dSigmaRadius = point->GetAdjustedSurfacePoint().GetLocalRadiusSigma().meters(); sprintf(buf, "%s,%s,%d,%d,%6.2lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n", - point->GetId().c_str(), strStatus.c_str(), nMeasures, nRejectedMeasures, dResidualRms, dLat, dLon, dRadius, + point->GetId().toAscii().data(), strStatus.toAscii().data(), nMeasures, nRejectedMeasures, dResidualRms, dLat, dLon, dRadius, dSigmaLat, dSigmaLong, dSigmaRadius, cor_lat_m, cor_lon_m, cor_rad_m, dX, dY, dZ); } else sprintf(buf, "%s,%s,%d,%d,%6.2lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n", - point->GetId().c_str(), strStatus.c_str(), nMeasures, nRejectedMeasures, dResidualRms, dLat, dLon, dRadius, + point->GetId().toAscii().data(), strStatus.toAscii().data(), nMeasures, nRejectedMeasures, dResidualRms, dLat, dLon, dRadius, cor_lat_m, cor_lon_m, cor_rad_m, dX, dY, dZ); fp_out << buf; @@ -7341,11 +7341,11 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, bool BundleAdjust::OutputResiduals() { char buf[1056]; - std:: string ofname("residuals.csv"); - if( !m_strOutputFilePrefix.empty() ) + QString ofname("residuals.csv"); + if( !m_strOutputFilePrefix.isEmpty() ) ofname = m_strOutputFilePrefix + "_" + ofname; - std::ofstream fp_out(ofname.c_str(), std::ios::out); + std::ofstream fp_out(ofname.toAscii().data(), std::ios::out); if (!fp_out) return false; @@ -7382,13 +7382,13 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if (measure->IsRejected()) sprintf(buf, "%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,*\n", - point->GetId().c_str(), m_pSnList->FileName(nImageIndex).c_str(), m_pSnList->SerialNumber(nImageIndex).c_str(), + point->GetId().toAscii().data(), m_pSnList->FileName(nImageIndex).toAscii().data(), m_pSnList->SerialNumber(nImageIndex).toAscii().data(), measure->GetFocalPlaneMeasuredX(), measure->GetFocalPlaneMeasuredY(), measure->GetSample(), measure->GetLine(), measure->GetSampleResidual(), measure->GetLineResidual(), measure->GetResidualMagnitude()); else sprintf(buf, "%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n", - point->GetId().c_str(), m_pSnList->FileName(nImageIndex).c_str(), m_pSnList->SerialNumber(nImageIndex).c_str(), + point->GetId().toAscii().data(), m_pSnList->FileName(nImageIndex).toAscii().data(), m_pSnList->SerialNumber(nImageIndex).toAscii().data(), measure->GetFocalPlaneMeasuredX(), measure->GetFocalPlaneMeasuredY(), measure->GetSample(), measure->GetLine(), measure->GetSampleResidual(), measure->GetLineResidual(), measure->GetResidualMagnitude()); fp_out << buf; @@ -7406,16 +7406,16 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, bool BundleAdjust::OutputImagesCSV() { char buf[1056]; - std:: string ofname("bundleout_images.csv"); - if( !m_strOutputFilePrefix.empty() ) + QString ofname("bundleout_images.csv"); + if( !m_strOutputFilePrefix.isEmpty() ) ofname = m_strOutputFilePrefix + "_" + ofname; - std::ofstream fp_out(ofname.c_str(), std::ios::out); + std::ofstream fp_out(ofname.toAscii().data(), std::ios::out); if (!fp_out) return false; // setup column headers - std::vector output_columns; + std::vector output_columns; output_columns.push_back("Image,"); @@ -7440,7 +7440,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if( ncoeff == 1 ) output_columns.push_back("X,"); else { - std::string str = "X("; + QString str = "X("; str += ostr.str().c_str(); str += "),"; output_columns.push_back(str); @@ -7461,7 +7461,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if( ncoeff == 1 ) output_columns.push_back("Y,"); else { - std::string str = "Y("; + QString str = "Y("; str += ostr.str().c_str(); str += "),"; output_columns.push_back(str); @@ -7485,7 +7485,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, output_columns.push_back("Z,"); } else { - std::string str = "Z("; + QString str = "Z("; str += ostr.str().c_str(); str += "),"; output_columns.push_back(str); @@ -7509,7 +7509,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if( m_nNumberCamAngleCoefSolved == 1 ) output_columns.push_back("RA,"); else { - std::string str = "RA("; + QString str = "RA("; str += ostr.str().c_str(); str += "),"; output_columns.push_back(str); @@ -7530,7 +7530,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, if( m_nNumberCamAngleCoefSolved == 1 ) output_columns.push_back("DEC,"); else { - std::string str = "DEC("; + QString str = "DEC("; str += ostr.str().c_str(); str += "),"; output_columns.push_back(str); @@ -7555,7 +7555,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, output_columns.push_back("TWIST,"); } else { - std::string str = "TWIST("; + QString str = "TWIST("; str += ostr.str().c_str(); str += "),"; output_columns.push_back(str); @@ -7570,8 +7570,8 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // print first column header to buffer and output to file int ncolumns = output_columns.size(); for ( int i = 0; i < ncolumns; i++) { - std::string str = output_columns.at(i); - sprintf(buf, "%s", (const char*)str.c_str()); + QString str = output_columns.at(i); + sprintf(buf, "%s", (const char*)str.toAscii().data()); fp_out << buf; } sprintf(buf, "\n"); @@ -7603,8 +7603,8 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, // print second column header to buffer and output to file ncolumns = output_columns.size(); for( int i = 0; i < ncolumns; i++) { - std::string str = output_columns.at(i); - sprintf(buf, "%s", (const char*)str.c_str()); + QString str = output_columns.at(i); + sprintf(buf, "%s", (const char*)str.toAscii().data()); fp_out << buf; } sprintf(buf, "\n"); @@ -7691,15 +7691,15 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, output_columns.clear(); // add filename - output_columns.push_back(m_pSnList->FileName(i).c_str()); + output_columns.push_back(m_pSnList->FileName(i).toAscii().data()); // add rms of sample, line, total image coordinate residuals - output_columns.push_back(boost::lexical_cast - (m_rmsImageSampleResiduals[i].Rms())); - output_columns.push_back(boost::lexical_cast - (m_rmsImageLineResiduals[i].Rms())); - output_columns.push_back(boost::lexical_cast - (m_rmsImageResiduals[i].Rms())); + output_columns.push_back( + toString(m_rmsImageSampleResiduals[i].Rms())); + output_columns.push_back( + toString(m_rmsImageLineResiduals[i].Rms())); + output_columns.push_back( + toString(m_rmsImageResiduals[i].Rms())); if ( m_nNumberCamPosCoefSolved > 0 ) { for ( int i = 0; i < m_nNumberCamPosCoefSolved; i++ ) { @@ -7711,18 +7711,18 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dSigma = sqrt((double)(m_Normals(nIndex, nIndex))) * m_dSigma0; } - output_columns.push_back(boost::lexical_cast - (coefX[0] - m_Image_Corrections(nIndex))); - output_columns.push_back(boost::lexical_cast - (m_Image_Corrections(nIndex))); - output_columns.push_back(boost::lexical_cast - (coefX[i])); - output_columns.push_back(boost::lexical_cast( - m_dGlobalSpacecraftPositionAprioriSigma[i])); + output_columns.push_back( + toString(coefX[0] - m_Image_Corrections(nIndex))); + output_columns.push_back( + toString(m_Image_Corrections(nIndex))); + output_columns.push_back( + toString(coefX[i])); + output_columns.push_back( + toString(m_dGlobalSpacecraftPositionAprioriSigma[i])); if ( m_bErrorPropagation && m_bConverged ) - output_columns.push_back(boost::lexical_cast - (dSigma)); + output_columns.push_back( + toString(dSigma)); else output_columns.push_back("N/A"); nIndex++; @@ -7736,18 +7736,18 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dSigma = sqrt((double)(m_Normals(nIndex, nIndex))) * m_dSigma0; } - output_columns.push_back(boost::lexical_cast - (coefY[0] - m_Image_Corrections(nIndex))); - output_columns.push_back(boost::lexical_cast - (m_Image_Corrections(nIndex))); - output_columns.push_back(boost::lexical_cast - (coefY[i])); - output_columns.push_back(boost::lexical_cast( - m_dGlobalSpacecraftPositionAprioriSigma[i])); + output_columns.push_back( + toString(coefY[0] - m_Image_Corrections(nIndex))); + output_columns.push_back( + toString(m_Image_Corrections(nIndex))); + output_columns.push_back( + toString(coefY[i])); + output_columns.push_back( + toString(m_dGlobalSpacecraftPositionAprioriSigma[i])); if ( m_bErrorPropagation && m_bConverged ) - output_columns.push_back(boost::lexical_cast - (dSigma)); + output_columns.push_back( + toString(dSigma)); else output_columns.push_back("N/A"); nIndex++; @@ -7761,17 +7761,17 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dSigma = sqrt((double)(m_Normals(nIndex, nIndex))) * m_dSigma0; } - output_columns.push_back(boost::lexical_cast - (coefZ[0] - m_Image_Corrections(nIndex))); - output_columns.push_back(boost::lexical_cast - (m_Image_Corrections(nIndex))); - output_columns.push_back(boost::lexical_cast - (coefZ[i])); - output_columns.push_back(boost::lexical_cast( - m_dGlobalSpacecraftPositionAprioriSigma[i])); + output_columns.push_back( + toString(coefZ[0] - m_Image_Corrections(nIndex))); + output_columns.push_back( + toString(m_Image_Corrections(nIndex))); + output_columns.push_back( + toString(coefZ[i])); + output_columns.push_back( + toString(m_dGlobalSpacecraftPositionAprioriSigma[i])); if ( m_bErrorPropagation && m_bConverged ) - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (dSigma)); else output_columns.push_back("N/A"); @@ -7779,20 +7779,20 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, } } else { - output_columns.push_back(boost::lexical_cast(coefX[0])); - output_columns.push_back(boost::lexical_cast(0.0)); - output_columns.push_back(boost::lexical_cast(coefX[0])); - output_columns.push_back(boost::lexical_cast(0.0)); + output_columns.push_back(toString(coefX[0])); + output_columns.push_back(toString(0)); + output_columns.push_back(toString(coefX[0])); + output_columns.push_back(toString(0)); output_columns.push_back("N/A"); - output_columns.push_back(boost::lexical_cast(coefY[0])); - output_columns.push_back(boost::lexical_cast(0.0)); - output_columns.push_back(boost::lexical_cast(coefY[0])); - output_columns.push_back(boost::lexical_cast(0.0)); + output_columns.push_back(toString(coefY[0])); + output_columns.push_back(toString(0)); + output_columns.push_back(toString(coefY[0])); + output_columns.push_back(toString(0)); output_columns.push_back("N/A"); - output_columns.push_back(boost::lexical_cast(coefZ[0])); - output_columns.push_back(boost::lexical_cast(0.0)); - output_columns.push_back(boost::lexical_cast(coefZ[0])); - output_columns.push_back(boost::lexical_cast(0.0)); + output_columns.push_back(toString(coefZ[0])); + output_columns.push_back(toString(0)); + output_columns.push_back(toString(coefZ[0])); + output_columns.push_back(toString(0)); output_columns.push_back("N/A"); } @@ -7806,17 +7806,17 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dSigma = sqrt((double)(m_Normals(nIndex, nIndex))) * m_dSigma0; } - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString ((coefRA[i] - m_Image_Corrections(nIndex)) * RAD2DEG)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (m_Image_Corrections(nIndex) * RAD2DEG)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (coefRA[i] * RAD2DEG)); - output_columns.push_back(boost::lexical_cast( + output_columns.push_back(toString( m_dGlobalCameraAnglesAprioriSigma[i])); if ( m_bErrorPropagation && m_bConverged ) - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (dSigma * RAD2DEG)); else output_columns.push_back("N/A"); @@ -7831,29 +7831,29 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dSigma = sqrt((double)(m_Normals(nIndex, nIndex))) * m_dSigma0; } - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString ((coefDEC[i] - m_Image_Corrections(nIndex)) * RAD2DEG)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (m_Image_Corrections(nIndex) * RAD2DEG)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (coefDEC[i] * RAD2DEG)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (m_dGlobalCameraAnglesAprioriSigma[i])); if ( m_bErrorPropagation && m_bConverged ) - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (dSigma * RAD2DEG)); else output_columns.push_back("N/A"); nIndex++; } if ( !m_bSolveTwist ) { - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (coefTWI[0]*RAD2DEG)); - output_columns.push_back(boost::lexical_cast(0.0)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString(0.0)); + output_columns.push_back(toString (coefTWI[0]*RAD2DEG)); - output_columns.push_back(boost::lexical_cast(0.0)); + output_columns.push_back(toString(0.0)); output_columns.push_back("N/A"); } else { @@ -7866,17 +7866,17 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, dSigma = sqrt((double)(m_Normals(nIndex, nIndex))) * m_dSigma0; } - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString ((coefTWI[i] - m_Image_Corrections(nIndex)) * RAD2DEG)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (m_Image_Corrections(nIndex) * RAD2DEG)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (coefTWI[i] * RAD2DEG)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (m_dGlobalCameraAnglesAprioriSigma[i])); if ( m_bErrorPropagation && m_bConverged ) - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (dSigma * RAD2DEG)); else output_columns.push_back("N/A"); @@ -7886,38 +7886,38 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, } else if ( pCamera->GetCameraType() != 3 ) { - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (coefRA[0]*RAD2DEG)); - output_columns.push_back(boost::lexical_cast(0.0)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString(0.0)); + output_columns.push_back(toString (coefRA[0]*RAD2DEG)); - output_columns.push_back(boost::lexical_cast(0.0)); + output_columns.push_back(toString(0.0)); output_columns.push_back("N/A"); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (coefDEC[0]*RAD2DEG)); - output_columns.push_back(boost::lexical_cast(0.0)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString(0.0)); + output_columns.push_back(toString (coefDEC[0]*RAD2DEG)); - output_columns.push_back(boost::lexical_cast(0.0)); + output_columns.push_back(toString(0.0)); output_columns.push_back("N/A"); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString (coefTWI[0]*RAD2DEG)); - output_columns.push_back(boost::lexical_cast(0.0)); - output_columns.push_back(boost::lexical_cast + output_columns.push_back(toString(0.0)); + output_columns.push_back(toString (coefTWI[0]*RAD2DEG)); - output_columns.push_back(boost::lexical_cast(0.0)); + output_columns.push_back(toString(0.0)); output_columns.push_back("N/A"); } // print column vector to buffer and output to file int ncolumns = output_columns.size(); for ( int i = 0; i < ncolumns; i++) { - std::string str = output_columns.at(i); + QString str = output_columns.at(i); if (i < ncolumns-1) - sprintf(buf, "%s,", (const char*)str.c_str()); + sprintf(buf, "%s,", (const char*)str.toAscii().data()); else - sprintf(buf, "%s", (const char*)str.c_str()); + sprintf(buf, "%s", (const char*)str.toAscii().data()); fp_out << buf; } sprintf(buf, "\n"); @@ -7934,14 +7934,14 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, * This method sets the solution method for solving the matrix and fills * the point index map, which is dependent on the solution method. */ - void BundleAdjust::SetSolutionMethod(std::string str) { + void BundleAdjust::SetSolutionMethod(QString str) { m_strSolutionMethod = str; FillPointIndexMap(); } /** This method steps up the maximum likelihood estimation solution. Zero to three successive solutions models are available. */ - void BundleAdjust::maximumLikelihoodSetup( QList models, QList quantiles ) { + void BundleAdjust::maximumLikelihoodSetup( QList models, QList quantiles ) { m_wFunc[0]=m_wFunc[1]=m_wFunc[2]=NULL; //initialize to NULL m_maxLikelihoodFlag[0]=m_maxLikelihoodFlag[1]=m_maxLikelihoodFlag[2]=false; //NULL flag by defualt if (models.size() == 0) { //MaximumLikeliHood Estimation not being used, so leave everything NULL @@ -7962,7 +7962,7 @@ static void cholmod_error_handler(int nStatus, const char* file, int nLineNo, else if ( models[i].compare("CHEN") == 0 ) m_wFunc[i]->setModel(MaximumLikelihoodWFunctions::Chen); else { - std::string msg = "Unsuported Maximum Likelihood estimation model: " + models[i] + "\n"; + QString msg = "Unsuported Maximum Likelihood estimation model: " + models[i] + "\n"; m_maxLikelihoodFlag[i] = false; throw IException(IException::Io, msg, _FILEINFO_); } diff --git a/isis/src/control/objs/BundleAdjust/BundleAdjust.h b/isis/src/control/objs/BundleAdjust/BundleAdjust.h index 3f67120de2..7ed00294d5 100644 --- a/isis/src/control/objs/BundleAdjust/BundleAdjust.h +++ b/isis/src/control/objs/BundleAdjust/BundleAdjust.h @@ -47,7 +47,7 @@ template< typename T > class QList; template< typename A, typename B > class QMap; -#if !defined(__sun__) +#ifndef __sun__ #include "gmm/gmm.h" #endif @@ -154,17 +154,17 @@ namespace Isis { */ class BundleAdjust { public: - BundleAdjust(const std::string &cnetFile, const std::string &cubeList, + BundleAdjust(const QString &cnetFile, const QString &cubeList, bool printSummary = true); - BundleAdjust(const std::string &cnetFile, const std::string &cubeList, - const std::string &heldList, bool printSummary = true); + BundleAdjust(const QString &cnetFile, const QString &cubeList, + const QString &heldList, bool printSummary = true); BundleAdjust(Isis::ControlNet &cnet, Isis::SerialNumberList &snlist, bool printSummary = true); BundleAdjust(Isis::ControlNet &cnet, Isis::SerialNumberList &snlist, Isis::SerialNumberList &heldsnlist, bool printSummary = true); ~BundleAdjust(); - bool ReadSCSigmas(const std::string &scsigmasList); + bool ReadSCSigmas(const QString &scsigmasList); double Solve(); bool SolveCholesky(); @@ -174,7 +174,7 @@ namespace Isis { Isis::SerialNumberList *SerialNumberList() { return m_pSnList; } int Images() const { return m_pSnList->Size(); } int Observations() const; - std::string FileName(int index); + QString FileName(int index); bool IsHeld(int index); Table Cmatrix(int index); Table SpVector(int index); @@ -217,7 +217,7 @@ namespace Isis { void SetStandardOutput(bool b) { m_bOutputStandard = b; } void SetCSVOutput(bool b) { m_bOutputCSV = b; } void SetResidualOutput(bool b) { m_bOutputResiduals = b; } - void SetOutputFilePrefix(const std::string &str) { m_strOutputFilePrefix = str; } + void SetOutputFilePrefix(const QString &str) { m_strOutputFilePrefix = str; } enum DecompositionMethod { NoneSelected, @@ -242,8 +242,8 @@ namespace Isis { }; struct SpacecraftWeights { - std::string SpacecraftName; - std::string InstrumentId; + QString SpacecraftName; + QString InstrumentId; std::vector weights; }; @@ -278,7 +278,7 @@ namespace Isis { void SetConvergenceThreshold(double d) { m_dConvergenceThreshold = d; } void SetMaxIterations(int n) { m_nMaxIterations = n; } - void SetSolutionMethod(std::string str); + void SetSolutionMethod(QString str); void GetSparseParameterCorrections(); @@ -390,17 +390,17 @@ namespace Isis { double m_drms_sigmaLon; //!< rms of adjusted Longitude sigmas double m_drms_sigmaRad; //!< rms of adjusted Radius sigmas double m_dminSigmaLatitude; - std::string m_idMinSigmaLatitude; + QString m_idMinSigmaLatitude; double m_dmaxSigmaLatitude; - std::string m_idMaxSigmaLatitude; + QString m_idMaxSigmaLatitude; double m_dminSigmaLongitude; - std::string m_idMinSigmaLongitude; + QString m_idMinSigmaLongitude; double m_dmaxSigmaLongitude; - std::string m_idMaxSigmaLongitude; + QString m_idMaxSigmaLongitude; double m_dminSigmaRadius; - std::string m_idMinSigmaRadius; + QString m_idMinSigmaRadius; double m_dmaxSigmaRadius; - std::string m_idMaxSigmaRadius; + QString m_idMaxSigmaRadius; double m_dRejectionLimit; //!< current rejection limit @@ -445,9 +445,9 @@ namespace Isis { std::vector m_dxKnowns; std::vector m_dyKnowns; - std::string m_strCnetFileName; //!< Control Net file specification - std::string m_strSolutionMethod; //!< solution method string (QR,SVD,SPARSE-LU,SPECIALK) - std::string m_strOutputFilePrefix; //!< output file prefix + QString m_strCnetFileName; //!< Control Net file specification + QString m_strSolutionMethod; //!< solution method string (QR,SVD,SPARSE-LU,SPECIALK) + QString m_strOutputFilePrefix; //!< output file prefix //!< pointers to... Isis::LeastSquares *m_pLsq; //!< 'LeastSquares' object @@ -674,7 +674,7 @@ namespace Isis { */ double m_maxLikelihoodQuan[3]; - public: void maximumLikelihoodSetup( QList models, QList quantiles ); + public: void maximumLikelihoodSetup( QList models, QList quantiles ); }; } diff --git a/isis/src/control/objs/ControlCubeGraphNode/ControlCubeGraphNode.cpp b/isis/src/control/objs/ControlCubeGraphNode/ControlCubeGraphNode.cpp index 0dcb669189..2c9915c81b 100644 --- a/isis/src/control/objs/ControlCubeGraphNode/ControlCubeGraphNode.cpp +++ b/isis/src/control/objs/ControlCubeGraphNode/ControlCubeGraphNode.cpp @@ -17,10 +17,10 @@ namespace Isis { /** * Create an empty SerialNumber object. */ - ControlCubeGraphNode::ControlCubeGraphNode(IString sn) { + ControlCubeGraphNode::ControlCubeGraphNode(QString sn) { nullify(); - serialNumber = new IString(sn); + serialNumber = new QString(sn); measures = new QHash; connections = new QHash < ControlCubeGraphNode *, QList< ControlPoint * > >; } @@ -29,7 +29,7 @@ namespace Isis { ControlCubeGraphNode::ControlCubeGraphNode(const ControlCubeGraphNode &other) { nullify(); - serialNumber = new IString(*other.serialNumber); + serialNumber = new QString(*other.serialNumber); measures = new QHash; connections = new QHash < ControlCubeGraphNode *, QList< ControlPoint * > >; @@ -84,7 +84,7 @@ namespace Isis { ASSERT(measure); if (measure->GetCubeSerialNumber() != *serialNumber) { - IString msg = "Attempted to add Control Measure with Cube Serial Number "; + QString msg = "Attempted to add Control Measure with Cube Serial Number "; msg += "[" + measure->GetCubeSerialNumber() + "] does not match Serial "; msg += "Number [" + *serialNumber + "]"; throw IException(IException::User, msg, _FILEINFO_); @@ -144,7 +144,7 @@ namespace Isis { } - IString ControlCubeGraphNode::getSerialNumber() const { + QString ControlCubeGraphNode::getSerialNumber() const { return *serialNumber; } @@ -179,8 +179,8 @@ namespace Isis { ControlMeasure *ControlCubeGraphNode::getMeasure(ControlPoint *point) { if (!measures->contains(point)) { - IString msg = "point ["; - msg += (IString) point->GetId(); + QString msg = "point ["; + msg += (QString) point->GetId(); msg += "] not found in the ControlCubeGraphNode"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -192,8 +192,8 @@ namespace Isis { const ControlMeasure *ControlCubeGraphNode::getMeasure( ControlPoint *point) const { if (!measures->contains(point)) { - IString msg = "point ["; - msg += (IString) point->GetId(); + QString msg = "point ["; + msg += (QString) point->GetId(); msg += "] not found in the ControlCubeGraphNode"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -233,7 +233,7 @@ namespace Isis { connections = NULL; } - serialNumber = new IString; + serialNumber = new QString; measures = new QHash< ControlPoint *, ControlMeasure *>; connections = new QHash< ControlCubeGraphNode *, QList< ControlPoint * > >; diff --git a/isis/src/control/objs/ControlCubeGraphNode/ControlCubeGraphNode.h b/isis/src/control/objs/ControlCubeGraphNode/ControlCubeGraphNode.h index 36eff16c3d..0a8d349696 100644 --- a/isis/src/control/objs/ControlCubeGraphNode/ControlCubeGraphNode.h +++ b/isis/src/control/objs/ControlCubeGraphNode/ControlCubeGraphNode.h @@ -33,7 +33,6 @@ class QString; namespace Isis { class ControlMeasure; class ControlPoint; - class IString; /** * @brief Serial Number with added functionality for Control Networks @@ -70,7 +69,7 @@ namespace Isis { Q_OBJECT public: - explicit ControlCubeGraphNode(IString sn); + explicit ControlCubeGraphNode(QString sn); ControlCubeGraphNode(const ControlCubeGraphNode &other); virtual ~ControlCubeGraphNode(); @@ -80,7 +79,7 @@ namespace Isis { void removeConnection(ControlCubeGraphNode *, ControlPoint *); bool contains(ControlPoint *point) const; - IString getSerialNumber() const; + QString getSerialNumber() const; int getMeasureCount() const; QList< ControlMeasure * > getMeasures() const; QList< ControlMeasure * > getValidMeasures() const; @@ -102,7 +101,7 @@ namespace Isis { private: - IString *serialNumber; + QString *serialNumber; //! ControlMeasures hashed by ControlPoint QHash< ControlPoint *, ControlMeasure * > * measures; diff --git a/isis/src/control/objs/ControlGraph/ControlGraph.cpp b/isis/src/control/objs/ControlGraph/ControlGraph.cpp index 2af4a49fc7..df43baa806 100644 --- a/isis/src/control/objs/ControlGraph/ControlGraph.cpp +++ b/isis/src/control/objs/ControlGraph/ControlGraph.cpp @@ -276,7 +276,7 @@ namespace Isis { // save off statistics if (graphIterator != graph->end()) { - QVector< IString > dataNames(cnet->GetPoint(cpIndex)-> + QVector< QString > dataNames(cnet->GetPoint(cpIndex)-> GetMeasure(cmIndex)->GetMeasureDataNames()); for (int i = 0; i < dataNames.size(); i++) diff --git a/isis/src/control/objs/ControlMeasure/ControlMeasure.cpp b/isis/src/control/objs/ControlMeasure/ControlMeasure.cpp index 7474e4d427..f38d37672e 100644 --- a/isis/src/control/objs/ControlMeasure/ControlMeasure.cpp +++ b/isis/src/control/objs/ControlMeasure/ControlMeasure.cpp @@ -44,9 +44,9 @@ namespace Isis { */ ControlMeasure::ControlMeasure() { InitializeToNull(); - p_serialNumber = new IString; - p_chooserName = new IString; - p_dateTime = new IString; + p_serialNumber = new QString; + p_chooserName = new QString; + p_dateTime = new QString; p_loggedData = new QVector(); p_measureType = Candidate; @@ -69,9 +69,9 @@ namespace Isis { const ControlPointFileEntryV0002_Measure &protoBuf) { InitializeToNull(); - p_serialNumber = new IString(protoBuf.serialnumber()); - p_chooserName = new IString(protoBuf.choosername()); - p_dateTime = new IString(protoBuf.datetime()); + p_serialNumber = new QString(protoBuf.serialnumber().c_str()); + p_chooserName = new QString(protoBuf.choosername().c_str()); + p_dateTime = new QString(protoBuf.datetime().c_str()); p_loggedData = new QVector(); switch (protoBuf.type()) { @@ -134,9 +134,9 @@ namespace Isis { ControlMeasure::ControlMeasure(const ControlMeasure &other) { InitializeToNull(); - p_serialNumber = new IString(*other.p_serialNumber); - p_chooserName = new IString(*other.p_chooserName); - p_dateTime = new IString(*other.p_dateTime); + p_serialNumber = new QString(*other.p_serialNumber); + p_chooserName = new QString(*other.p_chooserName); + p_dateTime = new QString(*other.p_dateTime); p_loggedData = new QVector(*other.p_loggedData); @@ -265,7 +265,7 @@ namespace Isis { * @return Status Success or MeasureLocked * */ - ControlMeasure::Status ControlMeasure::SetCubeSerialNumber(IString newSerialNumber) { + ControlMeasure::Status ControlMeasure::SetCubeSerialNumber(QString newSerialNumber) { if (IsEditLocked()) return MeasureLocked; *p_serialNumber = newSerialNumber; @@ -283,7 +283,7 @@ namespace Isis { //! Set the chooser name to an application that last changed the coordinate - ControlMeasure::Status ControlMeasure::SetChooserName(IString name) { + ControlMeasure::Status ControlMeasure::SetChooserName(QString name) { if (IsEditLocked()) return MeasureLocked; *p_chooserName = name; @@ -332,7 +332,7 @@ namespace Isis { //! Set date/time the coordinate was last changed to specified date/time - ControlMeasure::Status ControlMeasure::SetDateTime(IString datetime) { + ControlMeasure::Status ControlMeasure::SetDateTime(QString datetime) { if (IsEditLocked()) return MeasureLocked; *p_dateTime = datetime; @@ -609,7 +609,7 @@ namespace Isis { //! Return the chooser name - IString ControlMeasure::GetChooserName() const { + QString ControlMeasure::GetChooserName() const { if (*p_chooserName != "") { return *p_chooserName; } @@ -620,13 +620,13 @@ namespace Isis { //! Return the serial number of the cube containing the coordinate - IString ControlMeasure::GetCubeSerialNumber() const { + QString ControlMeasure::GetCubeSerialNumber() const { return *p_serialNumber; } //! Return the date/time the coordinate was last changed - IString ControlMeasure::GetDateTime() const { + QString ControlMeasure::GetDateTime() const { if (*p_dateTime != "") { return *p_dateTime; } @@ -843,7 +843,7 @@ namespace Isis { //! One Getter to rule them all - double ControlMeasure::GetMeasureData(IString data) const { + double ControlMeasure::GetMeasureData(QString data) const { if (data == "SampleResidual") return p_sampleResidual; else if (data == "LineResidual") @@ -864,8 +864,8 @@ namespace Isis { //! Returns a list of all valid options to pass to GetMeasureData - QVector< IString > ControlMeasure::GetMeasureDataNames() { - QVector< IString > names; + QVector< QString > ControlMeasure::GetMeasureDataNames() { + QVector< QString > names; names.push_back("SampleResidual"); names.push_back("LineResidual"); @@ -983,8 +983,8 @@ namespace Isis { * added exception. * @history 2010-12-08 Tracie Sucharski - Added measure type of Ground. */ - IString ControlMeasure::MeasureTypeToString(MeasureType type) { - IString sPrintable; + QString ControlMeasure::MeasureTypeToString(MeasureType type) { + QString sPrintable; switch (type) { case ControlMeasure::Candidate: @@ -1005,7 +1005,7 @@ namespace Isis { } if (sPrintable == "") { - IString msg = "Measure type [" + IString(type) + "] cannot be converted " + QString msg = "Measure type [" + toString(type) + "] cannot be converted " "to a string"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1018,7 +1018,7 @@ namespace Isis { * * @return A string representation of the MeasureType */ - IString ControlMeasure::GetMeasureTypeString() const { + QString ControlMeasure::GetMeasureTypeString() const { return MeasureTypeToString(p_measureType); } @@ -1053,9 +1053,9 @@ namespace Isis { p_loggedData = NULL; } - p_serialNumber = new IString; - p_chooserName = new IString; - p_dateTime = new IString; + p_serialNumber = new QString; + p_chooserName = new QString; + p_dateTime = new QString; p_loggedData = new QVector(); *p_serialNumber = *other.p_serialNumber; @@ -1148,7 +1148,7 @@ namespace Isis { ControlPointFileEntryV0002_Measure ControlMeasure::ToProtocolBuffer() const { ControlPointFileEntryV0002_Measure protoBufMeasure; - protoBufMeasure.set_serialnumber(GetCubeSerialNumber()); + protoBufMeasure.set_serialnumber(GetCubeSerialNumber().toAscii().data()); switch (GetType()) { case ControlMeasure::Candidate: protoBufMeasure.set_type(ControlPointFileEntryV0002_Measure::Candidate); @@ -1165,10 +1165,10 @@ namespace Isis { } if (GetChooserName() != "") { - protoBufMeasure.set_choosername(GetChooserName()); + protoBufMeasure.set_choosername(GetChooserName().toAscii().data()); } if (GetDateTime() != "") { - protoBufMeasure.set_datetime(GetDateTime()); + protoBufMeasure.set_datetime(GetDateTime().toAscii().data()); } if (IsEditLocked()) protoBufMeasure.set_editlock(true); diff --git a/isis/src/control/objs/ControlMeasure/ControlMeasure.h b/isis/src/control/objs/ControlMeasure/ControlMeasure.h index d933a7fc34..78c073002f 100644 --- a/isis/src/control/objs/ControlMeasure/ControlMeasure.h +++ b/isis/src/control/objs/ControlMeasure/ControlMeasure.h @@ -38,7 +38,6 @@ namespace Isis { class ControlPoint; class ControlPointFileEntryV0002_Measure; class ControlCubeGraphNode; - class IString; class PvlGroup; class PvlKeyword; @@ -249,12 +248,12 @@ namespace Isis { Status SetAprioriSample(double aprioriSample); Status SetCamera(Isis::Camera *camera); Status SetChooserName(); - Status SetChooserName(IString name); + Status SetChooserName(QString name); Status SetCoordinate(double sample, double line); Status SetCoordinate(double sample, double line, MeasureType type); - Status SetCubeSerialNumber(IString newSerialNumber); + Status SetCubeSerialNumber(QString newSerialNumber); Status SetDateTime(); - Status SetDateTime(IString datetime); + Status SetDateTime(QString datetime); Status SetDiameter(double diameter); Status SetEditLock(bool editLock); Status SetFocalPlaneMeasured(double x, double y); @@ -275,9 +274,9 @@ namespace Isis { double GetAprioriLine() const; double GetAprioriSample() const; Isis::Camera *Camera() const; - IString GetChooserName() const; - IString GetCubeSerialNumber() const; - IString GetDateTime() const; + QString GetChooserName() const; + QString GetCubeSerialNumber() const; + QString GetDateTime() const; double GetDiameter() const; ControlMeasureLogData GetLogData(long dataType) const; bool IsEditLocked() const; @@ -286,7 +285,7 @@ namespace Isis { double GetFocalPlaneComputedY() const; double GetFocalPlaneMeasuredX() const; double GetFocalPlaneMeasuredY() const; - double GetMeasureData(IString) const; + double GetMeasureData(QString) const; bool IsIgnored() const; bool IsMeasured() const; bool IsRegistered() const; @@ -307,13 +306,13 @@ namespace Isis { double GetLineShift() const; double GetPixelShift() const; - static QVector GetMeasureDataNames(); + static QVector GetMeasureDataNames(); QList PrintableClassData() const; - static IString MeasureTypeToString(MeasureType type); + static QString MeasureTypeToString(MeasureType type); static MeasureType StringToMeasureType(QString str); - IString GetMeasureTypeString() const; + QString GetMeasureTypeString() const; const ControlMeasure &operator=(const ControlMeasure &other); bool operator != (const Isis::ControlMeasure &pMeasure) const; @@ -330,7 +329,7 @@ namespace Isis { ControlCubeGraphNode *associatedCSN; //!< Pointer to the Serial Number // structure connecting measures in an image - IString *p_serialNumber; + QString *p_serialNumber; MeasureType p_measureType; QVector * p_loggedData; @@ -340,8 +339,8 @@ namespace Isis { * list the program used and the definition file or include the user * name for qnet */ - IString *p_chooserName; - IString *p_dateTime; + QString *p_chooserName; + QString *p_dateTime; bool p_editLock; //!< If true do not edit anything in measure. bool p_ignore; bool p_jigsawRejected; //!< Status of measure for last bundle adjust iteration diff --git a/isis/src/control/objs/ControlMeasureLogData/ControlMeasureLogData.cpp b/isis/src/control/objs/ControlMeasureLogData/ControlMeasureLogData.cpp index db021a3398..c2c6d5d6ff 100644 --- a/isis/src/control/objs/ControlMeasureLogData/ControlMeasureLogData.cpp +++ b/isis/src/control/objs/ControlMeasureLogData/ControlMeasureLogData.cpp @@ -51,10 +51,10 @@ namespace Isis { ControlMeasureLogData::ControlMeasureLogData(PvlKeyword keywordRep) { Init(); - IString name = keywordRep.Name(); + QString name = keywordRep.Name(); p_dataType = NameToDataType(name); if (p_dataType != InvalidNumericLogDataType) - p_numericalValue = keywordRep[0]; + p_numericalValue = toDouble(keywordRep[0]); } @@ -188,7 +188,7 @@ namespace Isis { */ PvlKeyword ControlMeasureLogData::ToKeyword() const { if(IsValid()) - return PvlKeyword(DataTypeToName(p_dataType), p_numericalValue); + return PvlKeyword(DataTypeToName(p_dataType), toString(p_numericalValue)); else return PvlKeyword(); } @@ -223,11 +223,12 @@ namespace Isis { * @param name The string to convert to data type * @return The data type converted from a string */ - ControlMeasureLogData::NumericLogDataType ControlMeasureLogData::NameToDataType(IString name) const { + ControlMeasureLogData::NumericLogDataType ControlMeasureLogData::NameToDataType( + QString name) const { for (int i = InvalidNumericLogDataType + 1; i < MaximumNumericLogDataType; i++) { try { - IString thisTypeName = DataTypeToName((NumericLogDataType) i); + QString thisTypeName = DataTypeToName((NumericLogDataType) i); if (name == thisTypeName) { return (NumericLogDataType) i; @@ -248,7 +249,7 @@ namespace Isis { * * @param type The data type to convert to a string */ - IString ControlMeasureLogData::DataTypeToName(NumericLogDataType type) const { + QString ControlMeasureLogData::DataTypeToName(NumericLogDataType type) const { switch(type) { case InvalidNumericLogDataType: { IString msg = "Cannot convert an invalid data type to a string"; @@ -280,7 +281,7 @@ namespace Isis { return "Obsolete_AverageResidual"; } - IString msg = "Unknown data type [" + IString(type) + "]"; + QString msg = "Unknown data type [" + toString(type) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } } diff --git a/isis/src/control/objs/ControlMeasureLogData/ControlMeasureLogData.h b/isis/src/control/objs/ControlMeasureLogData/ControlMeasureLogData.h index b9276e41af..4392ddb154 100644 --- a/isis/src/control/objs/ControlMeasureLogData/ControlMeasureLogData.h +++ b/isis/src/control/objs/ControlMeasureLogData/ControlMeasureLogData.h @@ -23,10 +23,10 @@ * http://www.usgs.gov/privacy.html. */ +class QString; class QVariant; namespace Isis { - class IString; class ControlNetLogDataProtoV0001_Point_Measure_DataEntry; class ControlPointFileEntryV0002_Measure_MeasureLogData; class PvlKeyword; @@ -148,8 +148,8 @@ namespace Isis { ControlPointFileEntryV0002_Measure_MeasureLogData ToProtocolBuffer() const; - NumericLogDataType NameToDataType(IString name) const; - IString DataTypeToName(NumericLogDataType) const; + NumericLogDataType NameToDataType(QString name) const; + QString DataTypeToName(NumericLogDataType) const; private: void Init(); diff --git a/isis/src/control/objs/ControlMeasureLogData/unitTest.cpp b/isis/src/control/objs/ControlMeasureLogData/unitTest.cpp index 6379334b9e..df25d5e534 100644 --- a/isis/src/control/objs/ControlMeasureLogData/unitTest.cpp +++ b/isis/src/control/objs/ControlMeasureLogData/unitTest.cpp @@ -34,7 +34,7 @@ int main() { cout << "Testing PvlKeyword constructor..." << endl; { - ControlMeasureLogData logData(PvlKeyword("GoodnessOfFit", 3.14159)); + ControlMeasureLogData logData(PvlKeyword("GoodnessOfFit", toString(3.14159))); cout << "Valid? " << logData.IsValid() << "\n" << "Type? " << logData.GetDataType() << "\n" diff --git a/isis/src/control/objs/ControlNet/ControlNet.cpp b/isis/src/control/objs/ControlNet/ControlNet.cpp index 8e7ee80105..1b00b523cd 100644 --- a/isis/src/control/objs/ControlNet/ControlNet.cpp +++ b/isis/src/control/objs/ControlNet/ControlNet.cpp @@ -88,7 +88,7 @@ namespace Isis { * @param ptfile Name of file containing a Pvl list of control points * @param progress A pointer to the progress of reading in the control points */ - ControlNet::ControlNet(const IString &ptfile, Progress *progress) { + ControlNet::ControlNet(const QString &ptfile, Progress *progress) { nullify(); points = new QHash< QString, ControlPoint * >; @@ -152,22 +152,22 @@ namespace Isis { * in ControlPoint. * */ - void ControlNet::ReadControl(const IString &filename, Progress *progress) { + void ControlNet::ReadControl(const QString &filename, Progress *progress) { LatestControlNetFile *fileData = ControlNetVersioner::Read(filename); ControlNetFileHeaderV0002 &header = fileData->GetNetworkHeader(); - p_networkId = header.networkid(); + p_networkId = header.networkid().c_str(); if (header.has_targetname()) { - SetTarget(header.targetname()); + SetTarget(header.targetname().c_str()); } else { SetTarget(""); } - p_userName = header.username(); - p_created = header.created(); - p_modified = header.lastmodified(); - p_description = header.description(); + p_userName = header.username().c_str(); + p_created = header.created().c_str(); + p_modified = header.lastmodified().c_str(); + p_description = header.description().c_str(); QList< ControlPointFileEntryV0002 > &fileDataPoints = fileData->GetNetworkPoints(); @@ -210,17 +210,17 @@ namespace Isis { * and created this new method to determine format to * be written. */ - void ControlNet::Write(const IString &ptfile, bool pvl) { + void ControlNet::Write(const QString &ptfile, bool pvl) { LatestControlNetFile *fileData = new LatestControlNetFile(); ControlNetFileHeaderV0002 &header = fileData->GetNetworkHeader(); - header.set_networkid(p_networkId); - header.set_targetname(p_targetName); - header.set_username(p_userName); - header.set_created(p_created); - header.set_lastmodified(p_modified); - header.set_description(p_description); + header.set_networkid(p_networkId.toAscii().data()); + header.set_targetname(p_targetName.toAscii().data()); + header.set_username(p_userName.toAscii().data()); + header.set_created(p_created.toAscii().data()); + header.set_lastmodified(p_modified.toAscii().data()); + header.set_description(p_description.toAscii().data()); QList< ControlPointFileEntryV0002 > &fileDataPoints = fileData->GetNetworkPoints(); @@ -295,7 +295,7 @@ namespace Isis { } if (!ContainsPoint(point->GetId())) { - IString msg = "ControlNet does not contain the point ["; + QString msg = "ControlNet does not contain the point ["; msg += point->GetId() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -353,7 +353,7 @@ namespace Isis { } if (!ContainsPoint(point->GetId())) { - IString msg = "ControlNet does not contain the point ["; + QString msg = "ControlNet does not contain the point ["; msg += point->GetId() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -362,7 +362,7 @@ namespace Isis { for (int i = 0; i < point->GetNumMeasures(); i++) { QString sn = point->GetMeasure(i)->GetCubeSerialNumber(); if (!cubeGraphNodes->contains(sn)) { - IString msg = "Node does not exist for ["; + QString msg = "Node does not exist for ["; msg += measure->GetCubeSerialNumber() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -397,7 +397,7 @@ namespace Isis { * @param point The point that needs to be updated. * @param oldId The pointId that the point had. */ - void ControlNet::UpdatePointReference(ControlPoint *point, IString oldId) { + void ControlNet::UpdatePointReference(ControlPoint *point, QString oldId) { points->remove(oldId); (*points)[point->GetId()] = point; (*pointIds)[pointIds->indexOf((QString) oldId)] = (QString)point->GetId(); @@ -448,9 +448,9 @@ namespace Isis { throw IException(IException::Programmer, msg, _FILEINFO_); } - IString serial = measure->GetCubeSerialNumber(); + QString serial = measure->GetCubeSerialNumber(); if (!cubeGraphNodes->contains(serial)) { - IString msg = "Node does not exist for ["; + QString msg = "Node does not exist for ["; msg += serial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -605,7 +605,7 @@ namespace Isis { * * @param pointId The Point Id of the ControlPoint to be deleted. */ - int ControlNet::DeletePoint(IString pointId) { + int ControlNet::DeletePoint(QString pointId) { if (!points->contains(pointId)) { IString msg = "point Id [" + pointId + "] does not exist in the network"; throw IException(IException::User, msg, _FILEINFO_); @@ -674,7 +674,7 @@ namespace Isis { * * @returns True if the point is in the network, false otherwise. */ - bool ControlNet::ContainsPoint(IString pointId) const { + bool ControlNet::ContainsPoint(QString pointId) const { return points->contains(pointId); } @@ -844,10 +844,10 @@ namespace Isis { // Each edge connects two vertices: a point and a graph node. So grab the // trees for each node and check that they're disjoint, and thus able to // be joined. - IString pointId = leastEdge->Parent()->GetId(); + QString pointId = leastEdge->Parent()->GetId(); ControlVertex *pointVertex = forest[pointId]; - IString serialNum = leastEdge->ControlSN()->getSerialNumber(); + QString serialNum = leastEdge->ControlSN()->getSerialNumber(); ControlVertex *nodeVertex = forest[serialNum]; // When the edge joins two different trees (i.e., they have different @@ -915,7 +915,7 @@ namespace Isis { * * @returns A string representation of the cube graph */ - IString ControlNet::CubeGraphToString() const { + QString ControlNet::CubeGraphToString() const { QStringList serials; QHashIterator < QString, ControlCubeGraphNode * > i(*cubeGraphNodes); while (i.hasNext()) { @@ -961,7 +961,7 @@ namespace Isis { * * @param serialNumber the cube serial number to validate */ - void ControlNet::ValidateSerialNumber(IString serialNumber) const { + void ControlNet::ValidateSerialNumber(QString serialNumber) const { if (!cubeGraphNodes->contains(serialNumber)) { IString msg = "Cube Serial Number [" + serialNumber + "] not found in " "the network"; @@ -975,7 +975,7 @@ namespace Isis { * * @returns A list of all measures which are in a given cube */ - QList< ControlMeasure * > ControlNet::GetMeasuresInCube(IString serialNumber) { + QList< ControlMeasure * > ControlNet::GetMeasuresInCube(QString serialNumber) { ValidateSerialNumber(serialNumber); return (*cubeGraphNodes)[serialNumber]->getMeasures(); } @@ -1054,7 +1054,7 @@ namespace Isis { * * @param serialNumber The cube serial number to be removed from the network */ - void ControlNet::DeleteMeasuresWithId(IString serialNumber) { + void ControlNet::DeleteMeasuresWithId(QString serialNumber) { ValidateSerialNumber(serialNumber); ControlCubeGraphNode *csn = (*cubeGraphNodes)[serialNumber]; @@ -1145,7 +1145,7 @@ namespace Isis { * * @return std::string */ - IString ControlNet::CreatedDate() const { + QString ControlNet::CreatedDate() const { return p_created; } @@ -1155,7 +1155,7 @@ namespace Isis { * * @return The description of this Control Network */ - IString ControlNet::Description() const { + QString ControlNet::Description() const { return p_description; } @@ -1172,10 +1172,10 @@ namespace Isis { * @return ControlPoint* Pointer to the ControlPoint * closest to the given line, sample position */ - ControlPoint *ControlNet::FindClosest(IString serialNumber, + ControlPoint *ControlNet::FindClosest(QString serialNumber, double sample, double line) { if (!cubeGraphNodes->contains(serialNumber)) { - IString msg = "serialNumber ["; + QString msg = "serialNumber ["; msg += serialNumber; msg += "] not found in ControlNet"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -1244,7 +1244,7 @@ namespace Isis { } - IString ControlNet::GetNetworkId() const { + QString ControlNet::GetNetworkId() const { return p_networkId; } @@ -1302,7 +1302,7 @@ namespace Isis { * * @return Number of valid measures in image */ - int ControlNet::GetNumberOfMeasuresInImage(const std::string &serialNumber) { + int ControlNet::GetNumberOfMeasuresInImage(const QString &serialNumber) { return p_cameraMeasuresMap[serialNumber]; } @@ -1312,7 +1312,7 @@ namespace Isis { * * @return Number of jigsaw rejected measures in image */ - int ControlNet::GetNumberOfJigsawRejectedMeasuresInImage(const std::string &serialNumber) { + int ControlNet::GetNumberOfJigsawRejectedMeasuresInImage(const QString &serialNumber) { return p_cameraRejectedMeasuresMap[serialNumber]; } @@ -1333,7 +1333,7 @@ namespace Isis { * Increment number of jigsaw rejected measures in image specified by serialNumber * */ - void ControlNet::IncrementNumberOfRejectedMeasuresInImage(const std::string &serialNumber) { + void ControlNet::IncrementNumberOfRejectedMeasuresInImage(const QString &serialNumber) { p_cameraRejectedMeasuresMap[serialNumber]++; } @@ -1342,7 +1342,7 @@ namespace Isis { * Decrement number of jigsaw rejected measures in image specified by serialNumber * */ - void ControlNet::DecrementNumberOfRejectedMeasuresInImage(const std::string &serialNumber) { + void ControlNet::DecrementNumberOfRejectedMeasuresInImage(const QString &serialNumber) { if (p_cameraRejectedMeasuresMap[serialNumber] > 0) p_cameraRejectedMeasuresMap[serialNumber]--; } @@ -1406,13 +1406,13 @@ namespace Isis { //! Return the target name - IString ControlNet::GetTarget() const { + QString ControlNet::GetTarget() const { return p_targetName; } //! Return the user name - IString ControlNet::GetUserName() const { + QString ControlNet::GetUserName() const { return p_userName; } @@ -1440,7 +1440,7 @@ namespace Isis { * * @param date The date this Control Network was created */ - void ControlNet::SetCreatedDate(const IString &date) { + void ControlNet::SetCreatedDate(const QString &date) { p_created = date; } @@ -1450,7 +1450,7 @@ namespace Isis { * * @param desc The description of this Control Network */ - void ControlNet::SetDescription(const IString &newDescription) { + void ControlNet::SetDescription(const QString &newDescription) { p_description = newDescription; } @@ -1460,7 +1460,7 @@ namespace Isis { * * @param imageListFile The list of images */ - void ControlNet::SetImages(const IString &imageListFile) { + void ControlNet::SetImages(const QString &imageListFile) { SerialNumberList list(imageListFile); SetImages(list); } @@ -1488,8 +1488,8 @@ namespace Isis { } // Open the camera for all the images in the serial number list for (int i = 0; i < list.Size(); i++) { - IString serialNumber = list.SerialNumber(i); - IString filename = list.FileName(i); + QString serialNumber = list.SerialNumber(i); + QString filename = list.FileName(i); Pvl pvl(filename); try { @@ -1500,7 +1500,7 @@ namespace Isis { p_cameraList.push_back(cam); } catch (IException &e) { - IString msg = "Unable to create camera for cube file "; + QString msg = "Unable to create camera for cube file "; msg += filename; throw IException(e, IException::Unknown, msg, _FILEINFO_); } @@ -1520,7 +1520,7 @@ namespace Isis { ControlMeasure *curMeasure = (*curPoint)[serialNums[m]]; if (!curMeasure->IsIgnored()) { - IString serialNumber = curMeasure->GetCubeSerialNumber(); + QString serialNumber = curMeasure->GetCubeSerialNumber(); if (list.HasSerialNumber(serialNumber)) { curMeasure->SetCamera(p_cameraMap[serialNumber]); @@ -1544,7 +1544,7 @@ namespace Isis { * * @param date The last date this Control Network was modified */ - void ControlNet::SetModifiedDate(const IString &date) { + void ControlNet::SetModifiedDate(const QString &date) { p_modified = date; } @@ -1554,7 +1554,7 @@ namespace Isis { * * @param id The Id of this Control Network */ - void ControlNet::SetNetworkId(const IString &id) { + void ControlNet::SetNetworkId(const QString &id) { p_networkId = id; } @@ -1564,7 +1564,7 @@ namespace Isis { * * @param target The name of the target of this Control Network */ - void ControlNet::SetTarget(const IString &target) { + void ControlNet::SetTarget(const QString &target) { p_targetName = target; p_targetRadii.clear(); @@ -1591,7 +1591,7 @@ namespace Isis { * * @param name The name of the user creating or modifying this Control Net */ - void ControlNet::SetUserName(const IString &name) { + void ControlNet::SetUserName(const QString &name) { p_userName = name; } diff --git a/isis/src/control/objs/ControlNet/ControlNet.h b/isis/src/control/objs/ControlNet/ControlNet.h index 5e9218a1da..084d1a82b6 100644 --- a/isis/src/control/objs/ControlNet/ControlNet.h +++ b/isis/src/control/objs/ControlNet/ControlNet.h @@ -26,17 +26,16 @@ #include // parent class #include +#include #include "ControlNetFile.h" -#include "IString.h" +#include template< typename A, typename B > class QHash; template< typename T > class QList; template< typename A, typename B > class QPair; template< typename T > class QSet; -class QString; - namespace Isis { class Camera; @@ -44,7 +43,6 @@ namespace Isis { class ControlPoint; class ControlCubeGraphNode; class Distance; - class IString; class Progress; class SerialNumberList; @@ -176,18 +174,18 @@ namespace Isis { public: ControlNet(); ControlNet(const ControlNet &other); - ControlNet(const IString &filename, Progress *progress = 0); + ControlNet(const QString &filename, Progress *progress = 0); ~ControlNet(); - void ReadControl(const IString &filename, Progress *progress = 0); - void Write(const IString &filename, bool pvl = false); + void ReadControl(const QString &filename, Progress *progress = 0); + void Write(const QString &filename, bool pvl = false); void AddPoint(ControlPoint *point); int DeletePoint(ControlPoint *point); - int DeletePoint(IString pointId); + int DeletePoint(QString pointId); int DeletePoint(int index); - bool ContainsPoint(IString pointId) const; + bool ContainsPoint(QString pointId) const; QList< QString > GetCubeSerials() const; QList< ControlCubeGraphNode * > GetCubeGraphNodes(); @@ -197,11 +195,11 @@ namespace Isis { QList< ControlCubeGraphNode *> &island, bool lessThan(const ControlMeasure *, const ControlMeasure *)) const; int getEdgeCount() const; - IString CubeGraphToString() const; - QList< ControlMeasure * > GetMeasuresInCube(IString serialNumber); + QString CubeGraphToString() const; + QList< ControlMeasure * > GetMeasuresInCube(QString serialNumber); QList< ControlMeasure * > sortedMeasureList(double(ControlMeasure::*statFunc)() const, double min,double max); - void DeleteMeasuresWithId(IString serialNumber); + void DeleteMeasuresWithId(QString serialNumber); void ComputeResiduals(); void ComputeApriori(); @@ -216,39 +214,39 @@ namespace Isis { double AverageResidual(); Isis::Camera *Camera(int index); - IString CreatedDate() const; - IString Description() const; - ControlPoint *FindClosest(IString serialNumber, + QString CreatedDate() const; + QString Description() const; + ControlPoint *FindClosest(QString serialNumber, double sample, double line); bool IsValid() const; double GetMaximumResidual(); - IString GetNetworkId() const; + QString GetNetworkId() const; int GetNumEditLockMeasures(); int GetNumEditLockPoints(); int GetNumIgnoredMeasures(); - int GetNumberOfMeasuresInImage(const std::string &serialNumber); - int GetNumberOfJigsawRejectedMeasuresInImage(const std::string &serialNumber); + int GetNumberOfMeasuresInImage(const QString &serialNumber); + int GetNumberOfJigsawRejectedMeasuresInImage(const QString &serialNumber); void ClearJigsawRejected(); - void IncrementNumberOfRejectedMeasuresInImage(const std::string &serialNumber); - void DecrementNumberOfRejectedMeasuresInImage(const std::string &serialNumber); + void IncrementNumberOfRejectedMeasuresInImage(const QString &serialNumber); + void DecrementNumberOfRejectedMeasuresInImage(const QString &serialNumber); int GetNumMeasures() const; int GetNumPoints() const; int GetNumValidMeasures(); int GetNumValidPoints(); - IString GetTarget() const; - IString GetUserName() const; + QString GetTarget() const; + QString GetUserName() const; QList< ControlPoint * > GetPoints(); QList< QString > GetPointIds() const; std::vector GetTargetRadii(); - void SetCreatedDate(const IString &date); - void SetDescription(const IString &newDescription); - void SetImages(const IString &imageListFile); + void SetCreatedDate(const QString &date); + void SetDescription(const QString &newDescription); + void SetImages(const QString &imageListFile); void SetImages(SerialNumberList &list, Progress *progress = 0); - void SetModifiedDate(const IString &date); - void SetNetworkId(const IString &id); - void SetTarget(const IString &target); - void SetUserName(const IString &name); + void SetModifiedDate(const QString &date); + void SetNetworkId(const QString &id); + void SetTarget(const QString &target); + void SetUserName(const QString &name); const ControlNet &operator=(ControlNet other); @@ -263,12 +261,12 @@ namespace Isis { private: void nullify(); - void ValidateSerialNumber(IString serialNumber) const; + void ValidateSerialNumber(QString serialNumber) const; void measureAdded(ControlMeasure *measure); void measureDeleted(ControlMeasure *measure); void measureIgnored(ControlMeasure *measure); void measureUnIgnored(ControlMeasure *measure); - void UpdatePointReference(ControlPoint *point, IString oldId); + void UpdatePointReference(ControlPoint *point, QString oldId); void emitNetworkStructureModified(); @@ -377,15 +375,15 @@ namespace Isis { QHash< QString, ControlCubeGraphNode * > * cubeGraphNodes; QStringList *pointIds; - IString p_targetName; //!< Name of the target - IString p_networkId; //!< The Network Id - IString p_created; //!< Creation Date - IString p_modified; //!< Date Last Modified - IString p_description; //!< Textual Description of network - IString p_userName; //!< The user who created the network - std::map p_cameraMap; //!< A map from serialnumber to camera - std::map p_cameraMeasuresMap; //!< A map from serialnumber to #measures - std::map p_cameraRejectedMeasuresMap; //!< A map from serialnumber to + QString p_targetName; //!< Name of the target + QString p_networkId; //!< The Network Id + QString p_created; //!< Creation Date + QString p_modified; //!< Date Last Modified + QString p_description; //!< Textual Description of network + QString p_userName; //!< The user who created the network + std::map p_cameraMap; //!< A map from serialnumber to camera + std::map p_cameraMeasuresMap; //!< A map from serialnumber to #measures + std::map p_cameraRejectedMeasuresMap; //!< A map from serialnumber to //! #rejected measures std::vector p_cameraList; //!< Vector of image number to camera std::vector p_targetRadii; //!< Radii of target body diff --git a/isis/src/control/objs/ControlNet/unitTest.cpp b/isis/src/control/objs/ControlNet/unitTest.cpp index 8a5f68d37f..49c7dcd967 100644 --- a/isis/src/control/objs/ControlNet/unitTest.cpp +++ b/isis/src/control/objs/ControlNet/unitTest.cpp @@ -293,7 +293,7 @@ int main() { std::stringstream oss1; oss1.flush(); oss1 << pointId << i; - ControlPoint *cp = new ControlPoint(oss1.str()); + ControlPoint *cp = new ControlPoint(oss1.str().c_str()); if (i == 0) { cp->SetType(ControlPoint::Fixed); @@ -324,7 +324,7 @@ int main() { std::stringstream oss2; oss2.flush(); oss2 << id << k; - cm->SetCubeSerialNumber(oss2.str()); + cm->SetCubeSerialNumber(oss2.str().c_str()); cm->SetType(ControlMeasure::RegisteredSubPixel); cm->SetLogData( ControlMeasureLogData(ControlMeasureLogData::GoodnessOfFit, @@ -375,7 +375,7 @@ int main() { cout << endl; // Delete point with invalid point type, first save id for next test - string id2 = cn1[2]->GetId(); + QString id2 = cn1[2]->GetId(); cn1.DeletePoint(2); cout << "Test deleting nonexistant control point id ..." << endl; diff --git a/isis/src/control/objs/ControlNetDiff/ControlNetDiff.cpp b/isis/src/control/objs/ControlNetDiff/ControlNetDiff.cpp index b164aa3362..dff4c70365 100644 --- a/isis/src/control/objs/ControlNetDiff/ControlNetDiff.cpp +++ b/isis/src/control/objs/ControlNetDiff/ControlNetDiff.cpp @@ -67,14 +67,14 @@ namespace Isis { if (diffFile.HasGroup("Tolerances")) { PvlGroup tolerances = diffFile.FindGroup("Tolerances"); for (int i = 0; i < tolerances.Keywords(); i++) - m_tolerances->insert(QString::fromStdString(tolerances[i].Name()), - (double) tolerances[i][0]); + m_tolerances->insert(tolerances[i].Name(), + toDouble(tolerances[i][0])); } if (diffFile.HasGroup("IgnoreKeys")) { PvlGroup ignoreKeys = diffFile.FindGroup("IgnoreKeys"); for (int i = 0; i < ignoreKeys.Keywords(); i++) - m_ignoreKeys->insert(QString::fromStdString(ignoreKeys[i].Name())); + m_ignoreKeys->insert(ignoreKeys[i].Name()); } } @@ -103,7 +103,7 @@ namespace Isis { BigInt net1NumPts = net1Obj.Objects(); BigInt net2NumPts = net2Obj.Objects(); - diff("Points", net1NumPts, net2NumPts, report); + diff("Points", toString(net1NumPts), toString(net2NumPts), report); diff("NetworkId", net1Obj, net2Obj, report); diff("TargetName", net1Obj, net2Obj, report); @@ -111,13 +111,13 @@ namespace Isis { QMap< QString, QMap > pointMap; for (int p = 0; p < net1NumPts; p++) { PvlObject &point = net1Obj.Object(p); - pointMap[QString::fromStdString(point.FindKeyword("PointId")[0])].insert( + pointMap[point.FindKeyword("PointId")[0]].insert( 0, point); } for (int p = 0; p < net2NumPts; p++) { PvlObject &point = net2Obj.Object(p); - pointMap[QString::fromStdString(point.FindKeyword("PointId")[0])].insert( + pointMap[point.FindKeyword("PointId")[0]].insert( 1, point); } @@ -155,26 +155,26 @@ namespace Isis { void ControlNetDiff::compare(PvlObject &point1Pvl, PvlObject &point2Pvl, PvlObject &report) { PvlObject pointReport("Point"); - IString id1 = point1Pvl.FindKeyword("PointId")[0]; - IString id2 = point2Pvl.FindKeyword("PointId")[0]; + QString id1 = point1Pvl.FindKeyword("PointId")[0]; + QString id2 = point2Pvl.FindKeyword("PointId")[0]; pointReport.AddKeyword(makeKeyword("PointId", id1, id2)); int p1Measures = point1Pvl.Groups(); int p2Measures = point2Pvl.Groups(); - diff("Measures", p1Measures, p2Measures, pointReport); + diff("Measures", toString(p1Measures), toString(p2Measures), pointReport); compareGroups(point1Pvl, point2Pvl, pointReport); QMap< QString, QMap > measureMap; for (int m = 0; m < p1Measures; m++) { PvlGroup &measure = point1Pvl.Group(m); - measureMap[QString::fromStdString(measure.FindKeyword("SerialNumber")[0])].insert( + measureMap[measure.FindKeyword("SerialNumber")[0]].insert( 0, measure); } for (int m = 0; m < p2Measures; m++) { PvlGroup &measure = point2Pvl.Group(m); - measureMap[QString::fromStdString(measure.FindKeyword("SerialNumber")[0])].insert( + measureMap[measure.FindKeyword("SerialNumber")[0]].insert( 1, measure); } @@ -212,8 +212,8 @@ namespace Isis { void ControlNetDiff::compareGroups(PvlContainer &g1, PvlContainer &g2, PvlObject &report) { PvlGroup measureReport("Measure"); if (g1.HasKeyword("SerialNumber")) { - IString sn1 = g1.FindKeyword("SerialNumber")[0]; - IString sn2 = g1.FindKeyword("SerialNumber")[0]; + QString sn1 = g1.FindKeyword("SerialNumber")[0]; + QString sn2 = g1.FindKeyword("SerialNumber")[0]; measureReport.AddKeyword(makeKeyword("SerialNumber", sn1, sn2)); } PvlContainer &groupReport = g1.HasKeyword("SerialNumber") ? @@ -221,9 +221,9 @@ namespace Isis { QMap< QString, QMap > keywordMap; for (int k = 0; k < g1.Keywords(); k++) - keywordMap[QString::fromStdString(g1[k].Name())].insert(0, g1[k]); + keywordMap[g1[k].Name()].insert(0, g1[k]); for (int k = 0; k < g2.Keywords(); k++) - keywordMap[QString::fromStdString(g2[k].Name())].insert(1, g2[k]); + keywordMap[g2[k].Name()].insert(1, g2[k]); QList keywordNames = keywordMap.keys(); for (int i = 0; i < keywordNames.size(); i++) { @@ -232,12 +232,12 @@ namespace Isis { compare(idMap[0], idMap[1], groupReport); } else if (idMap.contains(0)) { - IString name = idMap[0].Name(); + QString name = idMap[0].Name(); if (!m_ignoreKeys->contains(name)) diff(name, idMap[0][0], "N/A", groupReport); } else if (idMap.contains(1)) { - IString name = idMap[1].Name(); + QString name = idMap[1].Name(); if (!m_ignoreKeys->contains(name)) diff(name, "N/A", idMap[1][0], groupReport); } @@ -262,9 +262,9 @@ namespace Isis { * keywords */ void ControlNetDiff::compare(PvlKeyword &k1, PvlKeyword &k2, PvlContainer &report) { - IString name = k1.Name(); + QString name = k1.Name(); if (m_tolerances->contains(name)) - diff(name, k1[0], k2[0], (*m_tolerances)[name], report); + diff(name, toDouble(k1[0]), toDouble(k2[0]), (*m_tolerances)[name], report); else diff(name, k1[0], k2[0], report); } @@ -280,9 +280,9 @@ namespace Isis { * @param report Container for reporting differences between these objects for * the keyword with the given name */ - void ControlNetDiff::diff(IString name, PvlObject &o1, PvlObject &o2, PvlContainer &report) { - IString v1 = o1[name][0]; - IString v2 = o2[name][0]; + void ControlNetDiff::diff(QString name, PvlObject &o1, PvlObject &o2, PvlContainer &report) { + QString v1 = o1[name][0]; + QString v2 = o2[name][0]; diff(name, v1, v2, report); } @@ -298,7 +298,7 @@ namespace Isis { * @param report Container for reporting differences between these values for * the keyword with the given name */ - void ControlNetDiff::diff(IString name, IString v1, IString v2, PvlContainer &report) { + void ControlNetDiff::diff(QString name, QString v1, QString v2, PvlContainer &report) { if (!m_ignoreKeys->contains(name)) { if (v1 != v2) report.AddKeyword(makeKeyword(name, v1, v2)); } @@ -314,7 +314,7 @@ namespace Isis { * @param v2 The second keyword's value * @return PvlKeyword Container for the two values */ - PvlKeyword ControlNetDiff::makeKeyword(IString name, IString v1, IString v2) { + PvlKeyword ControlNetDiff::makeKeyword(QString name, QString v1, QString v2) { PvlKeyword keyword(name); keyword.AddValue(v1); if (v1 != v2) keyword.AddValue(v2); @@ -335,7 +335,7 @@ namespace Isis { * @param report Container for reporting differences between these values for * the keyword with the given name */ - void ControlNetDiff::diff(IString name, double v1, double v2, double tol, PvlContainer &report) { + void ControlNetDiff::diff(QString name, double v1, double v2, double tol, PvlContainer &report) { if (!m_ignoreKeys->contains(name)) { if (fabs(v1 - v2) > tol) report.AddKeyword(makeKeyword(name, v1, v2, tol)); } @@ -353,12 +353,12 @@ namespace Isis { * @param tol The tolerance to compare against the values * @return PvlKeyword Container for the two values */ - PvlKeyword ControlNetDiff::makeKeyword(IString name, double v1, double v2, double tol) { + PvlKeyword ControlNetDiff::makeKeyword(QString name, double v1, double v2, double tol) { PvlKeyword keyword(name); - keyword.AddValue(v1); + keyword.AddValue(toString(v1)); if (fabs(v1 - v2) > tol) { - keyword.AddValue(v2); - keyword.AddValue(tol); + keyword.AddValue(toString(v2)); + keyword.AddValue(toString(tol)); } return keyword; } @@ -373,7 +373,7 @@ namespace Isis { * @param v2 The second points's value for the unique label * @param parent Container for the point object */ - void ControlNetDiff::addUniquePoint(IString label, IString v1, IString v2, PvlObject &parent) { + void ControlNetDiff::addUniquePoint(QString label, QString v1, QString v2, PvlObject &parent) { PvlObject point("Point"); PvlKeyword keyword(label); @@ -395,7 +395,7 @@ namespace Isis { * @param v2 The second measure's value for the unique label * @param parent Container for the measure group */ - void ControlNetDiff::addUniqueMeasure(IString label, IString v1, IString v2, PvlObject &parent) { + void ControlNetDiff::addUniqueMeasure(QString label, QString v1, QString v2, PvlObject &parent) { PvlGroup measure("Measure"); PvlKeyword keyword(label); diff --git a/isis/src/control/objs/ControlNetDiff/ControlNetDiff.h b/isis/src/control/objs/ControlNetDiff/ControlNetDiff.h index 49538e5658..f4ae86aada 100644 --- a/isis/src/control/objs/ControlNetDiff/ControlNetDiff.h +++ b/isis/src/control/objs/ControlNetDiff/ControlNetDiff.h @@ -23,13 +23,11 @@ * http://www.usgs.gov/privacy.html. */ -#include "IString.h" +#include template< typename A, typename B > class QMap; template< typename T > class QSet; -class QString; - namespace Isis { class ControlNet; class FileName; @@ -79,15 +77,15 @@ namespace Isis { void compareGroups(PvlContainer &g1, PvlContainer &g2, PvlObject &report); void compare(PvlKeyword &k1, PvlKeyword &k2, PvlContainer &report); - void diff(IString name, PvlObject &o1, PvlObject &o2, PvlContainer &report); - void diff(IString name, IString v1, IString v2, PvlContainer &report); - PvlKeyword makeKeyword(IString name, IString v1, IString v2); + void diff(QString name, PvlObject &o1, PvlObject &o2, PvlContainer &report); + void diff(QString name, QString v1, QString v2, PvlContainer &report); + PvlKeyword makeKeyword(QString name, QString v1, QString v2); - void diff(IString name, double v1, double v2, double tol, PvlContainer &report); - PvlKeyword makeKeyword(IString name, double v1, double v2, double tol); + void diff(QString name, double v1, double v2, double tol, PvlContainer &report); + PvlKeyword makeKeyword(QString name, double v1, double v2, double tol); - void addUniquePoint(IString label, IString v1, IString v2, PvlObject &parent); - void addUniqueMeasure(IString label, IString v1, IString v2, PvlObject &parent); + void addUniquePoint(QString label, QString v1, QString v2, PvlObject &parent); + void addUniqueMeasure(QString label, QString v1, QString v2, PvlObject &parent); private: diff --git a/isis/src/control/objs/ControlNetFilter/ControlNetFilter.cpp b/isis/src/control/objs/ControlNetFilter/ControlNetFilter.cpp index 2fea2d61e3..d9dae00d10 100644 --- a/isis/src/control/objs/ControlNetFilter/ControlNetFilter.cpp +++ b/isis/src/control/objs/ControlNetFilter/ControlNetFilter.cpp @@ -27,10 +27,10 @@ using namespace std; namespace Isis { //! String names for Point Type - extern string sPointType []; + extern QString sPointType []; //! String values for Boolean - extern string sBoolean[]; + extern QString sBoolean[]; /** * ControlNetFilter Constructor @@ -41,7 +41,7 @@ namespace Isis { * @param psSerialNumFile - Corresponding Serial Num List * @param pProgress - Progress of the processing */ - ControlNetFilter::ControlNetFilter(ControlNet *pCNet, string &psSerialNumFile, Progress *pProgress) : + ControlNetFilter::ControlNetFilter(ControlNet *pCNet, QString &psSerialNumFile, Progress *pProgress) : ControlNetStatistics(pCNet, psSerialNumFile, pProgress) { mSerialNumFilter = SerialNumberList(psSerialNumFile); } @@ -54,10 +54,10 @@ namespace Isis { * @param psPrintFile * @param pbPvl */ - void ControlNetFilter::SetOutputFile(string psPrintFile) { + void ControlNetFilter::SetOutputFile(QString psPrintFile) { Isis::FileName outFile(psPrintFile); - string outName(outFile.expanded()); - mOstm.open(outName.c_str(), std::ios::out); + QString outName(outFile.expanded()); + mOstm.open(outName.toAscii().data(), std::ios::out); mOstm.precision(dbl::digits10); } @@ -96,14 +96,14 @@ namespace Isis { * * @param serialNum - Serial Number */ - void ControlNetFilter::FilterOutMeasuresBySerialNum(string serialNum){ - QString sn(serialNum.c_str()); + void ControlNetFilter::FilterOutMeasuresBySerialNum(QString serialNum){ + QString sn(serialNum); const ControlCubeGraphNode *csn = mCNet->getGraphNode(sn); QList< ControlMeasure * > measures = csn->getMeasures(); foreach(ControlMeasure * measure, measures) { bool pointEditFlag = false; - QString ptId(measure->Parent()->GetId().c_str()); + QString ptId(measure->Parent()->GetId()); ControlPoint * point = mCNet->GetPoint(ptId); if (point->IsEditLocked()) { point->SetEditLock(false); @@ -177,11 +177,11 @@ namespace Isis { double dGreater = 0; if (pvlGrp.HasKeyword("LessThan")) { - dLesser = fabs((pvlGrp["LessThan"][0]).ToDouble()); + dLesser = fabs((double)pvlGrp["LessThan"]); } if (pvlGrp.HasKeyword("GreaterThan")) { - dGreater = fabs((pvlGrp["GreaterThan"][0]).ToDouble()); + dGreater = fabs((double)pvlGrp["GreaterThan"]); } if (dLesser < 0 || dGreater < 0 || dLesser <= dGreater) { @@ -223,7 +223,7 @@ namespace Isis { const ControlMeasure *measure = cPoint->GetMeasure(j); PrintCubeFileSerialNum(*measure); double dPixelShift = measure->GetPixelShift(); - mOstm << ", " << (dPixelShift == Null ? "Null" : IString(dPixelShift)) << ", " + mOstm << ", " << (dPixelShift == Null ? "Null" : toString(dPixelShift)) << ", " << measure->GetMeasureTypeString() << ", " << sBoolean[measure->IsIgnored()] << ", " << sBoolean[measure->IsEditLocked()] << ", " @@ -252,11 +252,11 @@ namespace Isis { int iGreater = 0; if (pvlGrp.HasKeyword("LessThan")) { - iLesser = pvlGrp["LessThan"][0]; + iLesser = toInt(pvlGrp["LessThan"][0]); } if (pvlGrp.HasKeyword("GreaterThan")) { - iGreater = pvlGrp["GreaterThan"][0]; + iGreater = toInt(pvlGrp["GreaterThan"][0]); } if (iLesser < 0 || iGreater < 0 || iLesser < iGreater) { @@ -361,11 +361,15 @@ namespace Isis { double dGreater = 0; if (pvlGrp.HasKeyword("LessThan")) { - dLesser = fabs((pvlGrp["LessThan"][0]).ToDouble()); + if (pvlGrp["LessThan"][0] != "") { + dLesser = fabs((double)pvlGrp["LessThan"]); + } } if (pvlGrp.HasKeyword("GreaterThan")) { - dGreater = fabs((pvlGrp["GreaterThan"][0]).ToDouble()); + if (pvlGrp["GreaterThan"][0] != "") { + dGreater = fabs((double)pvlGrp["GreaterThan"]); + } } if (dLesser < 0 || dGreater < 0 || dLesser < dGreater) { @@ -432,18 +436,9 @@ namespace Isis { * @param pbLastFilter - Flag to indicate whether this is the last filter to print the stats */ void ControlNetFilter::PointIDFilter(const PvlGroup &pvlGrp, bool pbLastFilter) { - std::vector strTokens; - IString sPointIDExpr = pvlGrp["Expression"][0]; - IString sSeparator("*"); - - string strToken = sPointIDExpr.Token(sSeparator); - while (strToken != "") { - strTokens.push_back(strToken); - if (!sPointIDExpr.size()) { - break; - } - strToken = sPointIDExpr.Token(sSeparator); - } + QString sPointIDExpr = pvlGrp["Expression"][0]; + QString sSeparator("*"); + QStringList strTokens = sPointIDExpr.split(sSeparator, QString::SkipEmptyParts); int iTokenSize = (int)strTokens.size(); int iNumPoints = mCNet->GetNumPoints(); @@ -458,13 +453,13 @@ namespace Isis { for (int i = (iNumPoints - 1); i >= 0; i--) { const ControlPoint *cPoint = mCNet->GetPoint(i); - string sPointID = cPoint->GetId(); + QString sPointID = cPoint->GetId(); int iPosition = 0; for (int j = (iTokenSize - 1); j >= 0; j--) { int iLen = strTokens[j].length(); if (iLen > 0) { - size_t found = sPointID.find(strTokens[j], iPosition); - if (found != string::npos) { + int found = sPointID.indexOf(strTokens[j], iPosition); + if (found != -1) { iPosition = found + iLen; // End of the expression if (pbLastFilter && j == (iTokenSize - 1)) { @@ -498,11 +493,15 @@ namespace Isis { int iLesser = VALID_MAX2, iGreater = 0; if (pvlGrp.HasKeyword("LessThan")) { - iLesser = pvlGrp["LessThan"][0]; + if (pvlGrp["LessThan"][0] != "") { + iLesser = toInt(pvlGrp["LessThan"][0]); + } } if (pvlGrp.HasKeyword("GreaterThan")) { - iGreater = pvlGrp["GreaterThan"][0]; + if (pvlGrp["GreaterThan"][0] != "") { + iGreater = toInt(pvlGrp["GreaterThan"][0]); + } } if (iLesser < 0 || iGreater < 0 || iLesser < iGreater) { @@ -559,8 +558,10 @@ namespace Isis { IString sTemp = ""; if (pvlGrp.HasKeyword("PointType")) { - sType = pvlGrp["PointType"][0]; - sType = sType.DownCase(sType); + if (pvlGrp["PointType"][0] != "") { + sType = pvlGrp["PointType"][0]; + sType = sType.DownCase(sType); + } } if (pvlGrp.HasKeyword("Ignore")) { @@ -631,19 +632,27 @@ namespace Isis { double dMinLon = Isis::ValidMinimum, dMaxLon = Isis::ValidMaximum; if (pvlGrp.HasKeyword("MinLat")) { - dMinLat = pvlGrp["MinLat"][0]; + if (pvlGrp["MinLat"][0] != "") { + dMinLat = pvlGrp["MinLat"]; + } } if (pvlGrp.HasKeyword("MaxLat")) { - dMaxLat = pvlGrp["MaxLat"][0]; + if (pvlGrp["MaxLat"][0] != "") { + dMaxLat = pvlGrp["MaxLat"]; + } } if (pvlGrp.HasKeyword("MinLon")) { - dMinLon = pvlGrp["MinLon"][0]; + if (pvlGrp["MinLon"][0] != "") { + dMinLon = pvlGrp["MinLon"]; + } } if (pvlGrp.HasKeyword("MaxLon")) { - dMaxLon = pvlGrp["MaxLon"][0]; + if (pvlGrp["MaxLon"][0] != "") { + dMaxLon = pvlGrp["MaxLon"]; + } } if (dMinLat > dMaxLat || dMinLon > dMaxLon) { @@ -666,8 +675,8 @@ namespace Isis { if (!cPointSurfPt.Valid()) { const ControlMeasure *cm = cPoint->GetRefMeasure(); - string sn = cm->GetCubeSerialNumber(); - string filename = mSerialNumList.FileName(sn); + QString sn = cm->GetCubeSerialNumber(); + QString filename = mSerialNumList.FileName(sn); Pvl pvl(filename); Camera *camera = CameraFactory::Create(pvl); @@ -709,10 +718,12 @@ namespace Isis { */ void ControlNetFilter::PointDistanceFilter(const PvlGroup &pvlGrp, bool pbLastFilter) { double dMaxDistance = 0; - string sUnits = "pixels"; + QString sUnits = "pixels"; if (pvlGrp.HasKeyword("MaxDistance")) { - dMaxDistance = pvlGrp["MaxDistance"][0]; + if (pvlGrp["MaxDistance"][0] != "") { + dMaxDistance = pvlGrp["MaxDistance"]; + } } if (pvlGrp.HasKeyword("Units")) { @@ -738,8 +749,8 @@ namespace Isis { surfacePt1 = cp1->GetAdjustedSurfacePoint(); if (!surfacePt1.Valid()) { - string sn1 = cp1RefMeasure->GetCubeSerialNumber(); - string filename1 = mSerialNumList.FileName(sn1); + QString sn1 = cp1RefMeasure->GetCubeSerialNumber(); + QString filename1 = mSerialNumList.FileName(sn1); Pvl pvl1(filename1); cam1 = CameraFactory::Create(pvl1); if (cam1->SetImage(cp1RefMeasure->GetSample(), @@ -776,8 +787,8 @@ namespace Isis { surfacePt2 = cp2->GetAdjustedSurfacePoint(); if (!surfacePt2.Valid()) { - string sn2 = cp2RefMeasure->GetCubeSerialNumber(); - string filename2 = mSerialNumList.FileName(sn2); + QString sn2 = cp2RefMeasure->GetCubeSerialNumber(); + QString filename2 = mSerialNumList.FileName(sn2); Pvl pvl2(filename2); cam2 = CameraFactory::Create(pvl2); @@ -848,11 +859,15 @@ namespace Isis { double dLesser=Isis::ValidMaximum, dGreater=0; if (pvlGrp.HasKeyword("LessThan")){ - dLesser = fabs((pvlGrp["LessThan"][0]).ToDouble()); + if (pvlGrp["LessThan"][0] != "") { + dLesser = fabs((double)(pvlGrp["LessThan"])); + } } if (pvlGrp.HasKeyword("GreaterThan")){ - dGreater = fabs((pvlGrp["GreaterThan"][0]).ToDouble()); + if (pvlGrp["GreaterThan"][0] != "") { + dGreater = fabs((double)pvlGrp["GreaterThan"]); + } } if (pbLastFilter) { @@ -965,7 +980,7 @@ namespace Isis { if (bMeasureFound) { if (pbLastFilter) { PointStats(*cPoint); - string sn = cMeasure->GetCubeSerialNumber(); + QString sn = cMeasure->GetCubeSerialNumber(); mOstm << mSerialNumList.FileName(sn) << ", " << sn << "," << sBoolean[(int) cMeasure->IsIgnored()] << ", " << cMeasure->GetMeasureTypeString() << ", " @@ -997,7 +1012,7 @@ namespace Isis { * @param pbLastFilter - Flag to indicate whether this is the last filter to print the stats */ void ControlNetFilter::PointCubeNamesFilter(const PvlGroup &pvlGrp, bool pbLastFilter) { - std::vector sCubeNames; + std::vector sCubeNames; // Store the Cubenames from the PvlGroup for (int i = 0; i < pvlGrp.Keywords(); i++) { @@ -1057,7 +1072,7 @@ namespace Isis { << cPoint->GetNumLockedMeasures() << ", "; // Image Details - string sn = cMeasure->GetCubeSerialNumber(); + QString sn = cMeasure->GetCubeSerialNumber(); vector imgStats = GetImageStatsBySerialNum(sn); mOstm << mSerialNumList.FileName(sn) << ", " << sn << ", " << imgStats[imgTotalPoints] << ", " << imgStats[imgIgnoredPoints] << ", " @@ -1089,11 +1104,15 @@ namespace Isis { double dGreater = 0; if (pvlGrp.HasKeyword("LessThan")) { - dLesser = fabs((pvlGrp["LessThan"][0]).ToDouble()); + if (pvlGrp["LessThan"][0] != "") { + dLesser = fabs((double)pvlGrp["LessThan"]); + } } if (pvlGrp.HasKeyword("GreaterThan")) { - dGreater = fabs((pvlGrp["GreaterThan"][0]).ToDouble()); + if (pvlGrp["GreaterThan"][0] != "") { + dGreater = fabs((double)pvlGrp["GreaterThan"]); + } } if (dLesser < 0 || dGreater < 0 || dLesser <= dGreater) { @@ -1110,7 +1129,7 @@ namespace Isis { int iNumCubes = mSerialNumFilter.Size(); for (int sn = (iNumCubes - 1); sn >= 0; sn--) { - string sSerialNum = mSerialNumFilter.SerialNumber(sn); + QString sSerialNum = mSerialNumFilter.SerialNumber(sn); vector imgStats = GetImageStatsBySerialNum(sSerialNum); double convexHullRatio = imgStats[imgConvexHullRatio]; if (convexHullRatio < dGreater || convexHullRatio > dLesser){ @@ -1139,21 +1158,13 @@ namespace Isis { * @param pbLastFilter - Flag to indicate whether this is the last filter to print the stats */ void ControlNetFilter::CubeNameExpressionFilter(const PvlGroup &pvlGrp, bool pbLastFilter) { - IString sCubeExpr(""); + QString sCubeExpr(""); if (pvlGrp.HasKeyword("Expression")) { - sCubeExpr = IString(pvlGrp["Expression"][0]); + sCubeExpr = QString(pvlGrp["Expression"][0]); } - vector strTokens; - IString sSeparator("*"); - string strToken = sCubeExpr.Token(sSeparator); - while (strToken != "") { - strTokens.push_back(strToken); - if (!sCubeExpr.size()) { - break; - } - strToken = sCubeExpr.Token(sSeparator); - } + QString sSeparator("*"); + QStringList strTokens = sCubeExpr.split(sSeparator, QString::SkipEmptyParts); int iTokenSize = (int)strTokens.size(); int iNumCubes = mSerialNumFilter.Size(); @@ -1164,14 +1175,14 @@ namespace Isis { } for (int i = (iNumCubes - 1); i >= 0; i--) { - string sCubeName = mSerialNumFilter.FileName(i); - string sSerialNum = mSerialNumFilter.SerialNumber(i); + QString sCubeName = mSerialNumFilter.FileName(i); + QString sSerialNum = mSerialNumFilter.SerialNumber(i); int iPosition = 0; for (int j = (iTokenSize - 1); j >= 0; j--) { int iLen = strTokens[j].length(); if (iLen > 0) { - size_t found = sSerialNum.find(strTokens[j], iPosition); - if (found != string::npos) { + int found = sSerialNum.indexOf(strTokens[j], iPosition); + if (found != -1) { iPosition = found + iLen; // End of the expression - Found if (j == (iTokenSize - 1)) { @@ -1193,7 +1204,7 @@ namespace Isis { if (pbLastFilter) { iNumCubes = mSerialNumFilter.Size(); for (int i = 0; i < iNumCubes; i++) { - string sSerialNum = mSerialNumFilter.SerialNumber(i); + QString sSerialNum = mSerialNumFilter.SerialNumber(i); mOstm << mSerialNumFilter.FileName(i) << ", " << sSerialNum << ", "; vector imgStats = GetImageStatsBySerialNum(sSerialNum); @@ -1217,16 +1228,19 @@ namespace Isis { void ControlNetFilter::CubeNumPointsFilter(const PvlGroup &pvlGrp, bool pbLastFilter) { int iLessPoints = VALID_MAX2, iGreaterPoints = 0; if (pvlGrp.HasKeyword("LessThan")) { - iLessPoints = pvlGrp["LessThan"][0]; + if (pvlGrp["LessThan"][0] != "") { + iLessPoints = toInt(pvlGrp["LessThan"][0]); + } } if (pvlGrp.HasKeyword("GreaterThan")) { - iGreaterPoints = pvlGrp["GreaterThan"][0]; + if (pvlGrp["GreaterThan"][0] != "") { + iGreaterPoints = toInt(pvlGrp["GreaterThan"][0]); + } } if (iLessPoints < 0 || iGreaterPoints < 0 || iLessPoints < iGreaterPoints) { - string sErrMsg = "Invalid Deffile - Check Cube_NumPoints Group\n"; + QString sErrMsg = "Invalid Deffile - Check Cube_NumPoints Group\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); - return; } if (pbLastFilter) { @@ -1237,7 +1251,7 @@ namespace Isis { int iNumCubes = mSerialNumFilter.Size(); for (int sn = (iNumCubes - 1); sn >= 0; sn--) { - string sSerialNum = mSerialNumFilter.SerialNumber(sn); + QString sSerialNum = mSerialNumFilter.SerialNumber(sn); vector imgStats = GetImageStatsBySerialNum(sSerialNum); double numPoints = imgStats[imgTotalPoints]; if (numPoints < iGreaterPoints || numPoints > iLessPoints){ @@ -1267,10 +1281,12 @@ namespace Isis { */ void ControlNetFilter::CubeDistanceFilter(const PvlGroup &pvlGrp, bool pbLastFilter) { double dDistance = 0; - string sUnits = "pixels"; + QString sUnits = "pixels"; if (pvlGrp.HasKeyword("MaxDistance")) { - dDistance = pvlGrp["MaxDistance"][0]; + if (pvlGrp["MaxDistance"][0] != "") { + dDistance = pvlGrp["MaxDistance"]; + } } if (pvlGrp.HasKeyword("Units")) { @@ -1290,7 +1306,7 @@ namespace Isis { int iNumCubes = mSerialNumFilter.Size(); for (int sn = (iNumCubes - 1); sn >= 0; sn--) { - string sSerialNum = mSerialNumFilter.SerialNumber(sn); + QString sSerialNum = mSerialNumFilter.SerialNumber(sn); Pvl pvl(mSerialNumList.FileName(sSerialNum)); Camera *cam = CameraFactory::Create(pvl); double dDist = 0; @@ -1433,13 +1449,13 @@ namespace Isis { << iPointsFixed << ", " << iPointsConstrained << ", " << iPointsFree << ", " << imgStats[ imgConvexHullRatio] << ", "; for (int j = 0; j < (int)sPointIndex1.size(); j++) { - IString sPointIDDist(dPointDistance[j]); + QString sPointIDDist = toString(dPointDistance[j]); sPointIDDist += "#"; sPointIDDist += (*mCNet)[sPointIndex1[j]]->GetId(); sPointIDDist += "#"; sPointIDDist += (*mCNet)[sPointIndex2[j]]->GetId(); - mOstm << (string)sPointIDDist << ","; + mOstm << sPointIDDist << ","; } mOstm << endl; } diff --git a/isis/src/control/objs/ControlNetFilter/ControlNetFilter.h b/isis/src/control/objs/ControlNetFilter/ControlNetFilter.h index 471db6d1c2..a2ea18cbaa 100644 --- a/isis/src/control/objs/ControlNetFilter/ControlNetFilter.h +++ b/isis/src/control/objs/ControlNetFilter/ControlNetFilter.h @@ -4,8 +4,6 @@ #include "ControlNetStatistics.h" #include -using namespace std; - /** * @file * $Revision: $ @@ -50,10 +48,10 @@ namespace Isis { * @history 2010-08-10 Sharmila Prasad - Original version * @history 2010-09-16 Sharmila Prasad - Modified prototype for GetImageStatsBySerialNum API * in sync with the ControlNetStatistics class - * @history 2010-09-27 Sharmila Prasad - Moved ParseExpression functionality to IString class + * @history 2010-09-27 Sharmila Prasad - Moved ParseExpression functionality to QString class * Verify the DefFile in the PVL Class * @history 2010-09-27 Sharmila Prasad - Made changes for the Binary Control Network - * @history 2010-10-04 Sharmila Prasad - Use IString's Token method instead of ParseExpression + * @history 2010-10-04 Sharmila Prasad - Use QString's Token method instead of ParseExpression * @history 2010-10-15 Sharmila Prasad - Display error on bad filter values * @history 2010-11-09 Sharmila Prasad - Point_MeasureProperties,process 'All' measuretype * @history 2011-01-17 Eric Hyer - Fixed breakages caused by ControlNet api @@ -70,7 +68,7 @@ namespace Isis { class ControlNetFilter : public ControlNetStatistics { public: //! Constructor - ControlNetFilter(ControlNet *pCNet, string &psSerialNumFile, Progress *pProgress = 0); + ControlNetFilter(ControlNet *pCNet, QString &psSerialNumFile, Progress *pProgress = 0); //! Destructor ~ControlNetFilter(); @@ -135,16 +133,16 @@ namespace Isis { void CubeStatsHeader(void); //! Set the output print file - void SetOutputFile(string psPrintFile); + void SetOutputFile(QString psPrintFile); void PrintCubeFileSerialNum(const ControlMeasure &pcMeasure); private: - ofstream mOstm; //!< output stream for printing to output file + std::ofstream mOstm; //!< output stream for printing to output file SerialNumberList mSerialNumFilter; //!< Serial Number List file void FilterOutPoint(int pindex); - void FilterOutMeasuresBySerialNum(string serialNum); + void FilterOutMeasuresBySerialNum(QString serialNum); }; } #endif diff --git a/isis/src/control/objs/ControlNetFilter/unitTest.cpp b/isis/src/control/objs/ControlNetFilter/unitTest.cpp index a90518acd2..1a1611ef43 100644 --- a/isis/src/control/objs/ControlNetFilter/unitTest.cpp +++ b/isis/src/control/objs/ControlNetFilter/unitTest.cpp @@ -32,7 +32,7 @@ void IsisMain() { ControlNet *cnet = new ControlNet(ui.GetFileName("CNET")); //test filters - std::string sSerialFile = ui.GetFileName("FROMLIST"); + QString sSerialFile = ui.GetFileName("FROMLIST"); ControlNetFilter *cnetFilter = new ControlNetFilter(cnet, sSerialFile); PvlGroup filterGrp; @@ -41,7 +41,7 @@ void IsisMain() { // Point ResidualMagnitude Filter cout << "****************** Point_ResidualMagnitude Filter ******************" << endl; filterGrp = PvlGroup("Point_ResidualMagnitude"); - keyword = PvlKeyword("LessThan", 1); + keyword = PvlKeyword("LessThan", toString(1)); filterGrp += keyword; cnetFilter->PointResMagnitudeFilter(filterGrp, false); cout << filterGrp << endl; @@ -58,7 +58,7 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Point_EditLock"); - keyword= PvlKeyword("EditLock", true); + keyword= PvlKeyword("EditLock", "1"); filterGrp += keyword; cnetFilter->PointEditLockFilter(filterGrp, false); cout << filterGrp << endl; @@ -75,7 +75,7 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Point_NumMeasuresEditLock"); - keyword = PvlKeyword("LessThan", 1); + keyword = PvlKeyword("LessThan", toString(1)); filterGrp += keyword; cnetFilter->PointNumMeasuresEditLockFilter(filterGrp, false); cout << filterGrp << endl; @@ -92,9 +92,9 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Point_PixelShift"); - keyword = PvlKeyword("LessThan", 10); + keyword = PvlKeyword("LessThan", toString(10)); filterGrp += keyword; - keyword = PvlKeyword("GreaterThan", 1); + keyword = PvlKeyword("GreaterThan", toString(1)); filterGrp += keyword; cnetFilter->PointPixelShiftFilter(filterGrp, false); cout << filterGrp << endl; @@ -128,9 +128,9 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Point_NumMeasures"); - keyword = PvlKeyword("GreaterThan", 2); + keyword = PvlKeyword("GreaterThan", toString(2)); filterGrp += keyword; - keyword = PvlKeyword("LessThan", 2); + keyword = PvlKeyword("LessThan", toString(2)); filterGrp += keyword; cnetFilter->PointMeasuresFilter(filterGrp, false); cout << filterGrp << endl; @@ -147,7 +147,7 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Point_Properties"); - keyword = PvlKeyword("Ignore", false); + keyword = PvlKeyword("Ignore", "0"); filterGrp += keyword; keyword = PvlKeyword("PointType", "constraineD"); filterGrp += keyword; @@ -166,16 +166,16 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Point_LatLon"); - PvlKeyword keyword1("MinLat", -100); + PvlKeyword keyword1("MinLat", toString(-100)); filterGrp += keyword1; - PvlKeyword keyword2("MaxLat", 100); + PvlKeyword keyword2("MaxLat", toString(100)); filterGrp += keyword2; - PvlKeyword keyword3("MinLon", 0); + PvlKeyword keyword3("MinLon", toString(0)); filterGrp += keyword3; - PvlKeyword keyword4("MaxLon", 238); + PvlKeyword keyword4("MaxLon", toString(238)); filterGrp += keyword4; cnetFilter->PointLatLonFilter(filterGrp, false); @@ -193,7 +193,7 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Point_Distance"); - keyword = PvlKeyword("MaxDistance", 50000); + keyword = PvlKeyword("MaxDistance", toString(50000)); filterGrp += keyword; keyword = PvlKeyword("Units", "meters"); filterGrp += keyword; @@ -229,7 +229,7 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Point_GoodnessOfFit"); - keyword = PvlKeyword("LessThan", 0.5); + keyword = PvlKeyword("LessThan", toString(0.5)); filterGrp += keyword; cnetFilter->PointGoodnessOfFitFilter(filterGrp, false); cout << filterGrp << endl; @@ -287,9 +287,9 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Cube_NumPoints"); - keyword = PvlKeyword("GreaterThan", 10); + keyword = PvlKeyword("GreaterThan", toString(10)); filterGrp += keyword; - keyword = PvlKeyword("LessThan", 20); + keyword = PvlKeyword("LessThan", toString(20)); filterGrp += keyword; cnetFilter->CubeNumPointsFilter(filterGrp, false); cout << filterGrp << endl; @@ -306,7 +306,7 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Cube_Distance"); - keyword = PvlKeyword("MaxDistance", 100000); + keyword = PvlKeyword("MaxDistance", toString(100000)); filterGrp += keyword; keyword = PvlKeyword("Units=", "meters"); filterGrp += keyword; @@ -325,9 +325,9 @@ void IsisMain() { cnet = new ControlNet(ui.GetFileName("CNET")); cnetFilter = new ControlNetFilter(cnet, sSerialFile); filterGrp = PvlGroup("Cube_ConvexHullRatio"); - keyword = PvlKeyword("GreaterThan", 0.2); + keyword = PvlKeyword("GreaterThan", toString(0.2)); filterGrp += keyword; - keyword = PvlKeyword("LessThan", 0.3); + keyword = PvlKeyword("LessThan", toString(0.3)); filterGrp += keyword; cnetFilter->CubeConvexHullFilter(filterGrp, false); cout << filterGrp << endl; diff --git a/isis/src/control/objs/ControlNetStatistics/ControlNetStatistics.cpp b/isis/src/control/objs/ControlNetStatistics/ControlNetStatistics.cpp index 653816ca14..d759760033 100644 --- a/isis/src/control/objs/ControlNetStatistics/ControlNetStatistics.cpp +++ b/isis/src/control/objs/ControlNetStatistics/ControlNetStatistics.cpp @@ -31,10 +31,10 @@ using namespace std; namespace Isis { //! String names for Point Type - string sPointType [] = { "Fixed", "Constrained", "Free" }; + QString sPointType [] = { "Fixed", "Constrained", "Free" }; //! String values for Boolean - string sBoolean[] = { "False", "True" }; + QString sBoolean[] = { "False", "True" }; /** * ControlNetStatistics Constructor has ctor to it's base Control Network @@ -45,7 +45,7 @@ namespace Isis { * @param psSerialNumFile - Serial Number List file * @param pProgress - Check Progress if not Null */ - ControlNetStatistics::ControlNetStatistics(ControlNet *pCNet, const string &psSerialNumFile, + ControlNetStatistics::ControlNetStatistics(ControlNet *pCNet, const QString &psSerialNumFile, Progress *pProgress) { numCNetImages = 0; mCNet = pCNet; @@ -94,7 +94,7 @@ namespace Isis { int numSn = mSerialNumList.Size(); numCNetImages = 0; for (int i=0; iGetNumPoints()); - pStatsGrp += PvlKeyword("ValidPoints", NumValidPoints()); - pStatsGrp += PvlKeyword("IgnoredPoints", mCNet->GetNumPoints() - NumValidPoints()); - pStatsGrp += PvlKeyword("FixedPoints", NumFixedPoints()); - pStatsGrp += PvlKeyword("ConstrainedPoints", NumConstrainedPoints()); - pStatsGrp += PvlKeyword("FreePoints", NumFreePoints()); - pStatsGrp += PvlKeyword("EditLockPoints", mCNet->GetNumEditLockPoints()); + pStatsGrp += PvlKeyword("TotalPoints", toString(mCNet->GetNumPoints())); + pStatsGrp += PvlKeyword("ValidPoints", toString(NumValidPoints())); + pStatsGrp += PvlKeyword("IgnoredPoints", toString(mCNet->GetNumPoints() - NumValidPoints())); + pStatsGrp += PvlKeyword("FixedPoints", toString(NumFixedPoints())); + pStatsGrp += PvlKeyword("ConstrainedPoints", toString(NumConstrainedPoints())); + pStatsGrp += PvlKeyword("FreePoints", toString(NumFreePoints())); + pStatsGrp += PvlKeyword("EditLockPoints", toString(mCNet->GetNumEditLockPoints())); - pStatsGrp += PvlKeyword("TotalMeasures", NumMeasures()); - pStatsGrp += PvlKeyword("ValidMeasures", NumValidMeasures()); - pStatsGrp += PvlKeyword("IgnoredMeasures", NumIgnoredMeasures()); - pStatsGrp += PvlKeyword("EditLockMeasures", mCNet->GetNumEditLockMeasures()); + pStatsGrp += PvlKeyword("TotalMeasures", toString(NumMeasures())); + pStatsGrp += PvlKeyword("ValidMeasures", toString(NumValidMeasures())); + pStatsGrp += PvlKeyword("IgnoredMeasures", toString(NumIgnoredMeasures())); + pStatsGrp += PvlKeyword("EditLockMeasures", toString(mCNet->GetNumEditLockMeasures())); double dValue = GetAverageResidual(); - pStatsGrp += PvlKeyword("AvgResidual", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("AvgResidual", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMinimumResidual(); - pStatsGrp += PvlKeyword("MinResidual", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MinResidual", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMaximumResidual(); - pStatsGrp += PvlKeyword("MaxResidual", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxResidual", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMinLineResidual(); - pStatsGrp += PvlKeyword("MinLineResidual", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MinLineResidual", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMaxLineResidual(); - pStatsGrp += PvlKeyword("MaxLineResidual", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxLineResidual", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMinSampleResidual(); - pStatsGrp += PvlKeyword("MinSampleResidual", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MinSampleResidual", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMaxSampleResidual(); - pStatsGrp += PvlKeyword("MaxSampleResidual", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxSampleResidual", (dValue == Null ? "Null" : toString(dValue))); // Shifts - Line, Sample, Pixel dValue = GetMinLineShift(); - pStatsGrp += PvlKeyword("MinLineShift", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MinLineShift", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMaxLineShift(); - pStatsGrp += PvlKeyword("MaxLineShift", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxLineShift", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMinSampleShift(); - pStatsGrp += PvlKeyword("MinSampleShift", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MinSampleShift", (dValue == Null ? "Null" : toString(dValue))); dValue = GetMaxSampleShift(); - pStatsGrp += PvlKeyword("MaxSampleShift", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxSampleShift", (dValue == Null ? "Null" : toString(dValue))); dValue = GetAvgPixelShift(); - pStatsGrp += PvlKeyword("AvgPixelShift", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("AvgPixelShift", (dValue == Null ? "NA" : toString(dValue))); dValue = GetMinPixelShift(); - pStatsGrp += PvlKeyword("MinPixelShift", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("MinPixelShift", (dValue == Null ? "NA" : toString(dValue))); dValue = GetMaxPixelShift(); - pStatsGrp += PvlKeyword("MaxPixelShift", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxPixelShift", (dValue == Null ? "NA" : toString(dValue))); dValue = mPointDoubleStats[minGFit]; - pStatsGrp += PvlKeyword("MinGoodnessOfFit", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("MinGoodnessOfFit", (dValue == Null ? "NA" : toString(dValue))); dValue = mPointDoubleStats[maxGFit]; - pStatsGrp += PvlKeyword("MaxGoodnessOfFit", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxGoodnessOfFit", (dValue == Null ? "NA" : toString(dValue))); dValue = mPointDoubleStats[minEccentricity]; - pStatsGrp += PvlKeyword("MinEccentricity", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("MinEccentricity", (dValue == Null ? "NA" : toString(dValue))); dValue = mPointDoubleStats[maxEccentricity]; - pStatsGrp += PvlKeyword("MaxEccentricity", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxEccentricity", (dValue == Null ? "NA" : toString(dValue))); dValue = mPointDoubleStats[minPixelZScore]; - pStatsGrp += PvlKeyword("MinPixelZScore", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("MinPixelZScore", (dValue == Null ? "NA" : toString(dValue))); dValue = mPointDoubleStats[maxPixelZScore]; - pStatsGrp += PvlKeyword("MaxPixelZScore", (dValue == Null ? "NA" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxPixelZScore", (dValue == Null ? "NA" : toString(dValue))); // Convex Hull if (mSerialNumList.Size()) { dValue = mConvexHullRatioStats.Minimum(); - pStatsGrp += PvlKeyword("MinConvexHullRatio", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MinConvexHullRatio", (dValue == Null ? "Null" : toString(dValue))); dValue = mConvexHullRatioStats.Maximum(); - pStatsGrp += PvlKeyword("MaxConvexHullRatio", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("MaxConvexHullRatio", (dValue == Null ? "Null" : toString(dValue))); dValue = mConvexHullRatioStats.Average(); - pStatsGrp += PvlKeyword("AvgConvexHullRatio", (dValue == Null ? "Null" : IString(dValue))); + pStatsGrp += PvlKeyword("AvgConvexHullRatio", (dValue == Null ? "Null" : toString(dValue))); } } @@ -235,7 +235,7 @@ namespace Isis { vector imgStats(numImageStats, 0); // Open the cube to get the dimensions - IString sn = node->getSerialNumber(); + QString sn = node->getSerialNumber(); Cube *cube = cubeMgr.OpenCube(mSerialNumList.FileName(sn)); mSerialNumMap[sn] = true; @@ -317,20 +317,20 @@ namespace Isis { * * @param psImageFile - Output Image Stats File */ - void ControlNetStatistics::PrintImageStats(const string &psImageFile) { + void ControlNetStatistics::PrintImageStats(const QString &psImageFile) { // Check if the image list has been provided if (!mSerialNumList.Size()) { - string msg = "Serial Number of Images has not been provided to get Image Stats"; + QString msg = "Serial Number of Images has not been provided to get Image Stats"; throw IException(IException::User, msg, _FILEINFO_); } FileName outFile(psImageFile); ofstream ostm; - string outName(outFile.expanded()); - ostm.open(outName.c_str(), std::ios::out); + QString outName(outFile.expanded()); + ostm.open(outName.toAscii().data(), std::ios::out); - //map< string, vector >::iterator it; - map::iterator it; + //map< QString, vector >::iterator it; + map::iterator it; // imgSamples, imgLines, imgTotalPoints, imgIgnoredPoints, imgFixedPoints, imgLockedPoints, imgLocked, imgConstrainedPoints, imgFreePoints, imgConvexHullArea, imgConvexHullRatio // Log into the output file @@ -363,7 +363,7 @@ namespace Isis { * * @return const vector */ - vector ControlNetStatistics::GetImageStatsBySerialNum(string psSerialNum) const { + vector ControlNetStatistics::GetImageStatsBySerialNum(QString psSerialNum) const { return (*mImageMap.find(psSerialNum)).second; } @@ -377,12 +377,12 @@ namespace Isis { * * @param psPointFile - Output Point Statisitics File */ - void ControlNetStatistics::GeneratePointStats(const string &psPointFile) { + void ControlNetStatistics::GeneratePointStats(const QString &psPointFile) { Isis::FileName outFile(psPointFile); ofstream ostm; - string outName(outFile.expanded()); - ostm.open(outName.c_str(), std::ios::out); + QString outName(outFile.expanded()); + ostm.open(outName.toAscii().data(), std::ios::out); ostm << " PointId, PointType, PointIgnore, PointEditLock, TotalMeasures, MeasuresValid, MeasuresIgnore, MeasuresEditLock," << endl; int iNumPoints = mCNet->GetNumPoints(); diff --git a/isis/src/control/objs/ControlNetStatistics/ControlNetStatistics.h b/isis/src/control/objs/ControlNetStatistics/ControlNetStatistics.h index 292926e385..eb3b57cd43 100644 --- a/isis/src/control/objs/ControlNetStatistics/ControlNetStatistics.h +++ b/isis/src/control/objs/ControlNetStatistics/ControlNetStatistics.h @@ -9,8 +9,6 @@ #include "SerialNumberList.h" #include "Statistics.h" -using namespace std; - /** * @file * $Revision: $ @@ -53,7 +51,7 @@ namespace Isis { * * @internal * @history 2010-08-24 Sharmila Prasad Original version - * @history 2010-09-16 Sharmila Prasad Added individual image maps for each + * @history 2010-09-16 Sharmila Prasad Added individual image std::maps for each * Point stats to correct segmentation * faults. * @history 2010-10-26 Tracie Sucharski Added missing includes to cpp after @@ -76,7 +74,7 @@ namespace Isis { class ControlNetStatistics { public: //! Constructor - ControlNetStatistics(ControlNet *pCNet, const string &psSerialNumFile, Progress *pProgress = 0); + ControlNetStatistics(ControlNet *pCNet, const QString &psSerialNumFile, Progress *pProgress = 0); //! Constructor ControlNetStatistics(ControlNet *pCNet, Progress *pProgress = 0); @@ -108,13 +106,13 @@ namespace Isis { void GenerateImageStats(); //! Print the Image Stats into specified output file - void PrintImageStats(const string &psImageFile); + void PrintImageStats(const QString &psImageFile); //! Returns the Image Stats by Serial Number - vector GetImageStatsBySerialNum(string psSerialNum) const; + std::vector GetImageStatsBySerialNum(QString psSerialNum) const; //! Generate stats like Ignored, Fixed, Total Measures, Ignored by Control Point - void GeneratePointStats(const string &psPointFile); + void GeneratePointStats(const QString &psPointFile); //! Generate the Control Net Stats into the PvlGroup void GenerateControlNetStats(PvlGroup &pStatsGrp); @@ -246,10 +244,10 @@ namespace Isis { QList mCubeGraphNodes; private: - map mPointIntStats; //!< Contains map of different count stats - map mPointDoubleStats; //!< Contains map of different computed stats - map > mImageMap; //!< Contains stats by Image/Serial Num - map mSerialNumMap; //!< Whether serial# is part of ControlNet + std::map mPointIntStats; //!< Contains std::map of different count stats + std::map mPointDoubleStats; //!< Contains std::map of different computed stats + std::map > mImageMap; //!< Contains stats by Image/Serial Num + std::map mSerialNumMap; //!< Whether serial# is part of ControlNet //! Get point count stats void GetPointIntStats(); @@ -261,10 +259,10 @@ namespace Isis { ePointDoubleStats min, ePointDoubleStats max); - //! Init Pointstats vector + //! Init Pointstats std::vector void InitPointDoubleStats(); - //! Init SerialNum map + //! Init SerialNum std::map void InitSerialNumMap(); int numCNetImages; diff --git a/isis/src/control/objs/ControlNetStatistics/unitTest.cpp b/isis/src/control/objs/ControlNetStatistics/unitTest.cpp index a4876b4a7f..be25657e85 100644 --- a/isis/src/control/objs/ControlNetStatistics/unitTest.cpp +++ b/isis/src/control/objs/ControlNetStatistics/unitTest.cpp @@ -24,15 +24,15 @@ void IsisMain() { Preference::Preferences(true); cout << "UnitTest for ControlNetStatistics ...." << endl << endl; - Isis::UserInterface &ui = Isis::Application::GetUserInterface(); + UserInterface &ui = Application::GetUserInterface(); cout << "CNET=" << ui.GetAsString("CNET") << endl; cout << "Serial File=" << ui.GetAsString("FROMLIST") << endl; - Isis::ControlNet cnetOrig(ui.GetFileName("CNET")); - Isis::ControlNet cnet = cnetOrig; + ControlNet cnetOrig(ui.GetFileName("CNET")); + ControlNet cnet = cnetOrig; - std::string sSerialFile = ui.GetFileName("FROMLIST"); + QString sSerialFile = ui.GetFileName("FROMLIST"); ControlNetStatistics cnetStats(&cnet, sSerialFile); PvlGroup statsGrp; diff --git a/isis/src/control/objs/ControlNetValidMeasure/ControlNetValidMeasure.cpp b/isis/src/control/objs/ControlNetValidMeasure/ControlNetValidMeasure.cpp index 139601f78b..305718c82d 100644 --- a/isis/src/control/objs/ControlNetValidMeasure/ControlNetValidMeasure.cpp +++ b/isis/src/control/objs/ControlNetValidMeasure/ControlNetValidMeasure.cpp @@ -89,25 +89,25 @@ namespace Isis { void ControlNetValidMeasure::InitStdOptionsGroup(void) { mStdOptionsGrp = PvlGroup("StandardOptions"); - mStdOptionsGrp += Isis::PvlKeyword("MinDN", (mdMinDN == Isis::ValidMinimum ? "NA" : IString(mdMinDN))); - mStdOptionsGrp += Isis::PvlKeyword("MaxDN", (mdMaxDN == Isis::ValidMaximum ? "NA" : IString(mdMaxDN))); - - mStdOptionsGrp += Isis::PvlKeyword("MinEmission", mdMinEmissionAngle); - mStdOptionsGrp += Isis::PvlKeyword("MaxEmission", mdMaxEmissionAngle); - mStdOptionsGrp += Isis::PvlKeyword("MinIncidence", mdMinIncidenceAngle); - mStdOptionsGrp += Isis::PvlKeyword("MaxIncidence", mdMaxIncidenceAngle); - mStdOptionsGrp += Isis::PvlKeyword("MinResolution", mdMinResolution); - mStdOptionsGrp += Isis::PvlKeyword("MaxResolution", (mdMaxResolution == DBL_MAX ? "NA" : IString(mdSampleResTolerance))); - mStdOptionsGrp += Isis::PvlKeyword("PixelsFromEdge", miPixelsFromEdge); - mStdOptionsGrp += Isis::PvlKeyword("MetersFromEdge", mdMetersFromEdge); - - mStdOptionsGrp += Isis::PvlKeyword("SampleResidual", (mdSampleResTolerance == DBL_MAX ? "NA" : IString(mdSampleResTolerance))); - mStdOptionsGrp += Isis::PvlKeyword("LineResidual", (mdLineResTolerance == DBL_MAX ? "NA" : IString(mdLineResTolerance))); - mStdOptionsGrp += Isis::PvlKeyword("ResidualMagnitude", (mdResidualTolerance == DBL_MAX ? "NA" : IString(mdResidualTolerance))); - - mStdOptionsGrp += Isis::PvlKeyword("SampleShift", (m_sampleShiftTolerance == DBL_MAX ? "NA" : IString(m_sampleShiftTolerance))); - mStdOptionsGrp += Isis::PvlKeyword("LineShift", (m_lineShiftTolerance == DBL_MAX ? "NA" : IString(m_lineShiftTolerance))); - mStdOptionsGrp += Isis::PvlKeyword("PixelShift", (m_pixelShiftTolerance == DBL_MAX ? "NA" : IString(m_pixelShiftTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("MinDN", (mdMinDN == Isis::ValidMinimum ? "NA" : toString(mdMinDN))); + mStdOptionsGrp += Isis::PvlKeyword("MaxDN", (mdMaxDN == Isis::ValidMaximum ? "NA" : toString(mdMaxDN))); + + mStdOptionsGrp += Isis::PvlKeyword("MinEmission", toString(mdMinEmissionAngle)); + mStdOptionsGrp += Isis::PvlKeyword("MaxEmission", toString(mdMaxEmissionAngle)); + mStdOptionsGrp += Isis::PvlKeyword("MinIncidence", toString(mdMinIncidenceAngle)); + mStdOptionsGrp += Isis::PvlKeyword("MaxIncidence", toString(mdMaxIncidenceAngle)); + mStdOptionsGrp += Isis::PvlKeyword("MinResolution", toString(mdMinResolution)); + mStdOptionsGrp += Isis::PvlKeyword("MaxResolution", (mdMaxResolution == DBL_MAX ? "NA" : toString(mdSampleResTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("PixelsFromEdge", toString(miPixelsFromEdge)); + mStdOptionsGrp += Isis::PvlKeyword("MetersFromEdge", toString(mdMetersFromEdge)); + + mStdOptionsGrp += Isis::PvlKeyword("SampleResidual", (mdSampleResTolerance == DBL_MAX ? "NA" : toString(mdSampleResTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("LineResidual", (mdLineResTolerance == DBL_MAX ? "NA" : toString(mdLineResTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("ResidualMagnitude", (mdResidualTolerance == DBL_MAX ? "NA" : toString(mdResidualTolerance))); + + mStdOptionsGrp += Isis::PvlKeyword("SampleShift", (m_sampleShiftTolerance == DBL_MAX ? "NA" : toString(m_sampleShiftTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("LineShift", (m_lineShiftTolerance == DBL_MAX ? "NA" : toString(m_lineShiftTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("PixelShift", (m_pixelShiftTolerance == DBL_MAX ? "NA" : toString(m_pixelShiftTolerance))); } /** @@ -127,7 +127,7 @@ namespace Isis { * * @param psSerialNumfile - File with list of Serial Numbers */ - void ControlNetValidMeasure::ReadSerialNumbers(string psSerialNumfile) { + void ControlNetValidMeasure::ReadSerialNumbers(QString psSerialNumfile) { mSerialNumbers = SerialNumberList(psSerialNumfile, true, &mStatus); mCubeMgr.SetNumOpenCubes(50); @@ -181,7 +181,7 @@ namespace Isis { measureCamera = pCube->getCamera(); } catch(IException &e) { - string msg = "Cannot Create Camera for Image:" + pCube->getFileName(); + QString msg = "Cannot Create Camera for Image:" + pCube->getFileName(); throw IException(IException::User, msg, _FILEINFO_); } } @@ -254,20 +254,20 @@ namespace Isis { if(pMeasureGrp != NULL) { if(mbCameraRequired) { - *pMeasureGrp += Isis::PvlKeyword("EmissionAngle", mdEmissionAngle); - *pMeasureGrp += Isis::PvlKeyword("IncidenceAngle", mdIncidenceAngle); - *pMeasureGrp += Isis::PvlKeyword("Resolution", mdResolution); + *pMeasureGrp += Isis::PvlKeyword("EmissionAngle", toString(mdEmissionAngle)); + *pMeasureGrp += Isis::PvlKeyword("IncidenceAngle", toString(mdIncidenceAngle)); + *pMeasureGrp += Isis::PvlKeyword("Resolution", toString(mdResolution)); } if(mbValidateDN) { - *pMeasureGrp += Isis::PvlKeyword("DNValue", mdDnValue); + *pMeasureGrp += Isis::PvlKeyword("DNValue", toString(mdDnValue)); } - *pMeasureGrp += Isis::PvlKeyword("SampleResidual", mdSampleResidual); - *pMeasureGrp += Isis::PvlKeyword("LineResidual", mdLineResidual); - *pMeasureGrp += Isis::PvlKeyword("ResidualMagnitude", mdResidualMagnitude); + *pMeasureGrp += Isis::PvlKeyword("SampleResidual", toString(mdSampleResidual)); + *pMeasureGrp += Isis::PvlKeyword("LineResidual", toString(mdLineResidual)); + *pMeasureGrp += Isis::PvlKeyword("ResidualMagnitude", toString(mdResidualMagnitude)); - *pMeasureGrp += Isis::PvlKeyword("SampleShift", m_sampleShift); - *pMeasureGrp += Isis::PvlKeyword("LineShift", m_lineShift); - *pMeasureGrp += Isis::PvlKeyword("PixelShift", m_pixelShift); + *pMeasureGrp += Isis::PvlKeyword("SampleShift", toString(m_sampleShift)); + *pMeasureGrp += Isis::PvlKeyword("LineShift", toString(m_lineShift)); + *pMeasureGrp += Isis::PvlKeyword("PixelShift", toString(m_pixelShift)); } MeasureValidationResults results; @@ -388,7 +388,7 @@ namespace Isis { else { mbValidateFromEdge = true; } - mStdOptionsGrp += Isis::PvlKeyword("PixelsFromEdge", miPixelsFromEdge); + mStdOptionsGrp += Isis::PvlKeyword("PixelsFromEdge", toString(miPixelsFromEdge)); } // Parse the Meters from edge if(mPvlOpGrp.HasKeyword("MetersFromEdge")) { @@ -399,7 +399,7 @@ namespace Isis { else { mbValidateFromEdge = true; } - mStdOptionsGrp += Isis::PvlKeyword("MetersFromEdge", mdMetersFromEdge); + mStdOptionsGrp += Isis::PvlKeyword("MetersFromEdge", toString(mdMetersFromEdge)); } } @@ -418,7 +418,7 @@ namespace Isis { else { mdMinResolution = 0; } - mStdOptionsGrp += Isis::PvlKeyword("MinResolution", mdMinResolution); + mStdOptionsGrp += Isis::PvlKeyword("MinResolution", toString(mdMinResolution)); if(mPvlOpGrp.HasKeyword("MaxResolution")){ mdMaxResolution = mPvlOpGrp["MaxResolution"]; @@ -427,15 +427,15 @@ namespace Isis { else { mdMaxResolution = DBL_MAX; } - mStdOptionsGrp += Isis::PvlKeyword("MaxResolution", (mdMaxResolution == DBL_MAX ? "NA" : IString(mdMaxResolution))); + mStdOptionsGrp += Isis::PvlKeyword("MaxResolution", (mdMaxResolution == DBL_MAX ? "NA" : toString(mdMaxResolution))); if(mdMinResolution < 0 || mdMaxResolution < 0) { - string msg = "Invalid Resolution value(s), Resolution must be greater than zero"; + QString msg = "Invalid Resolution value(s), Resolution must be greater than zero"; throw IException(IException::User, msg, _FILEINFO_); } if(mdMaxResolution < mdMinResolution) { - string msg = "MinResolution must be less than MaxResolution"; + QString msg = "MinResolution must be less than MaxResolution"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -456,7 +456,7 @@ namespace Isis { else { mdMinDN = Isis::ValidMinimum; } - mStdOptionsGrp += Isis::PvlKeyword("MinDN", (mdMinDN == Isis::ValidMinimum ? "NA" : IString(mdMinDN))); + mStdOptionsGrp += Isis::PvlKeyword("MinDN", (mdMinDN == Isis::ValidMinimum ? "NA" : toString(mdMinDN))); if(mPvlOpGrp.HasKeyword("MaxDN")) { mdMaxDN = mPvlOpGrp["MaxDN"]; @@ -465,10 +465,10 @@ namespace Isis { else { mdMaxDN = Isis::ValidMaximum; } - mStdOptionsGrp += Isis::PvlKeyword("MaxDN", (mdMaxDN == Isis::ValidMaximum ? "NA" : IString(mdMaxDN))); + mStdOptionsGrp += Isis::PvlKeyword("MaxDN", (mdMaxDN == Isis::ValidMaximum ? "NA" : toString(mdMaxDN))); if(mdMaxDN < mdMinDN) { - string msg = "MinDN must be less than MaxDN"; + QString msg = "MinDN must be less than MaxDN"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -486,24 +486,24 @@ namespace Isis { mdMinEmissionAngle = mPvlOpGrp["MinEmission"]; mbCameraRequired = true; if(mdMinEmissionAngle < 0 || mdMinEmissionAngle > 135) { - string msg = "Invalid Min Emission Angle, Valid Range is [0-135]"; + QString msg = "Invalid Min Emission Angle, Valid Range is [0-135]"; throw IException(IException::User, msg, _FILEINFO_); } } - mStdOptionsGrp += Isis::PvlKeyword("MinEmission", mdMinEmissionAngle); + mStdOptionsGrp += Isis::PvlKeyword("MinEmission", toString(mdMinEmissionAngle)); if(mPvlOpGrp.HasKeyword("MaxEmission")) { mdMaxEmissionAngle = mPvlOpGrp["MaxEmission"]; mbCameraRequired = true; if(mdMaxEmissionAngle < 0 || mdMaxEmissionAngle > 135) { - string msg = "Invalid Max Emission Angle, Valid Range is [0-135]"; + QString msg = "Invalid Max Emission Angle, Valid Range is [0-135]"; throw IException(IException::User, msg, _FILEINFO_); } } - mStdOptionsGrp += Isis::PvlKeyword("MaxEmission", mdMaxEmissionAngle); + mStdOptionsGrp += Isis::PvlKeyword("MaxEmission", toString(mdMaxEmissionAngle)); if(mdMaxEmissionAngle < mdMinEmissionAngle) { - string msg = "Min EmissionAngle must be less than Max EmissionAngle"; + QString msg = "Min EmissionAngle must be less than Max EmissionAngle"; throw IException(IException::User, msg, _FILEINFO_); } @@ -522,24 +522,24 @@ namespace Isis { mdMinIncidenceAngle = mPvlOpGrp["MinIncidence"]; mbCameraRequired = true; if(mdMinIncidenceAngle < 0 || mdMinIncidenceAngle > 135) { - string msg = "Invalid Min Incidence Angle, Valid Range is [0-135]"; + QString msg = "Invalid Min Incidence Angle, Valid Range is [0-135]"; throw IException(IException::User, msg, _FILEINFO_); } } - mStdOptionsGrp += Isis::PvlKeyword("MinIncidence", mdMinIncidenceAngle); + mStdOptionsGrp += Isis::PvlKeyword("MinIncidence", toString(mdMinIncidenceAngle)); if(mPvlOpGrp.HasKeyword("MaxIncidence")) { mdMaxIncidenceAngle = mPvlOpGrp["MaxIncidence"]; mbCameraRequired = true; if(mdMaxIncidenceAngle < 0 || mdMaxIncidenceAngle > 135) { - string msg = "Invalid Max Incidence Angle, Valid Range is [0-135]"; + QString msg = "Invalid Max Incidence Angle, Valid Range is [0-135]"; throw IException(IException::User, msg, _FILEINFO_); } } - mStdOptionsGrp += Isis::PvlKeyword("MaxIncidence", mdMaxIncidenceAngle); + mStdOptionsGrp += Isis::PvlKeyword("MaxIncidence", toString(mdMaxIncidenceAngle)); if(mdMaxIncidenceAngle < mdMinIncidenceAngle) { - string msg = "Min IncidenceAngle must be less than Max IncidenceAngle"; + QString msg = "Min IncidenceAngle must be less than Max IncidenceAngle"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -555,35 +555,35 @@ namespace Isis { if(mPvlOpGrp.HasKeyword("SampleResidual")) { mdSampleResTolerance = mPvlOpGrp["SampleResidual"]; if(mdSampleResTolerance < 0) { - string msg = "Invalid Sample Residual, must be greater than zero"; + QString msg = "Invalid Sample Residual, must be greater than zero"; throw IException(IException::User, msg, _FILEINFO_); } bRes = true; } - mStdOptionsGrp += Isis::PvlKeyword("SampleResidual", (mdSampleResTolerance == DBL_MAX ? "NA" : IString(mdSampleResTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("SampleResidual", (mdSampleResTolerance == DBL_MAX ? "NA" : toString(mdSampleResTolerance))); if(mPvlOpGrp.HasKeyword("LineResidual")) { mdLineResTolerance = mPvlOpGrp["LineResidual"]; if(mdLineResTolerance < 0) { - string msg = "Invalid Line Residual, must be greater than zero"; + QString msg = "Invalid Line Residual, must be greater than zero"; throw IException(IException::User, msg, _FILEINFO_); } bRes = true; } - mStdOptionsGrp += Isis::PvlKeyword("LineResidual", (mdLineResTolerance == DBL_MAX ? "NA" : IString(mdLineResTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("LineResidual", (mdLineResTolerance == DBL_MAX ? "NA" : toString(mdLineResTolerance))); if(mPvlOpGrp.HasKeyword("ResidualMagnitude")) { mdResidualTolerance = mPvlOpGrp["ResidualMagnitude"]; if(mdResidualTolerance < 0) { - string msg = "Invalid Residual Magnitude Tolerance, must be greater than zero"; + QString msg = "Invalid Residual Magnitude Tolerance, must be greater than zero"; throw IException(IException::User, msg, _FILEINFO_); } bResMag = true; } - mStdOptionsGrp += Isis::PvlKeyword("ResidualMagnitude", (mdResidualTolerance == DBL_MAX ? "NA" : IString(mdResidualTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("ResidualMagnitude", (mdResidualTolerance == DBL_MAX ? "NA" : toString(mdResidualTolerance))); if(bRes && bResMag) { - string msg = "Cannot have both Sample/Line Residuals and Residual Magnitude."; + QString msg = "Cannot have both Sample/Line Residuals and Residual Magnitude."; msg += "\nChoose either Sample/Line Residual or Residual Magnitude"; throw IException(IException::User, msg, _FILEINFO_); } @@ -599,39 +599,39 @@ namespace Isis { if (mPvlOpGrp.HasKeyword("SampleShift")) { m_sampleShiftTolerance = mPvlOpGrp["SampleShift"]; if (m_sampleShiftTolerance < 0) { - string msg = "Invalid Sample Shift tolerance:" + QString msg = "Invalid Sample Shift tolerance:" " must be greater than or equal to zero"; throw IException(IException::User, msg, _FILEINFO_); } hasSampleLineShift = true; } - mStdOptionsGrp += Isis::PvlKeyword("SampleShift", (m_sampleShiftTolerance == DBL_MAX ? "NA" : IString(m_sampleShiftTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("SampleShift", (m_sampleShiftTolerance == DBL_MAX ? "NA" : toString(m_sampleShiftTolerance))); if (mPvlOpGrp.HasKeyword("LineShift")) { m_lineShiftTolerance = mPvlOpGrp["LineShift"]; if (m_lineShiftTolerance < 0) { - string msg = "Invalid Line Shift tolerance:" + QString msg = "Invalid Line Shift tolerance:" " must be greater than or equal to zero"; throw IException(IException::User, msg, _FILEINFO_); } hasSampleLineShift = true; } - mStdOptionsGrp += Isis::PvlKeyword("LineShift", (m_lineShiftTolerance == DBL_MAX ? "NA" : IString(m_lineShiftTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("LineShift", (m_lineShiftTolerance == DBL_MAX ? "NA" : toString(m_lineShiftTolerance))); bool hasPixelShift = false; if (mPvlOpGrp.HasKeyword("PixelShift")) { m_pixelShiftTolerance = mPvlOpGrp["PixelShift"]; if (m_pixelShiftTolerance < 0) { - string msg = "Invalid Pixel Shift tolerance:" + QString msg = "Invalid Pixel Shift tolerance:" " must be greater than or equal to zero"; throw IException(IException::User, msg, _FILEINFO_); } hasPixelShift = true; } - mStdOptionsGrp += Isis::PvlKeyword("PixelShift", (m_pixelShiftTolerance == DBL_MAX ? "NA" : IString(m_pixelShiftTolerance))); + mStdOptionsGrp += Isis::PvlKeyword("PixelShift", (m_pixelShiftTolerance == DBL_MAX ? "NA" : toString(m_pixelShiftTolerance))); if (hasSampleLineShift && hasPixelShift) { - string msg = "Cannot have both Sample/Line Shift and Pixel Shift"; + QString msg = "Cannot have both Sample/Line Shift and Pixel Shift"; msg += " tolerances.\n"; msg += "Choose either Sample/Line Shift or Pixel Shift to validate on"; throw IException(IException::User, msg, _FILEINFO_); @@ -924,7 +924,7 @@ namespace Isis { return false; } catch(IException &e) { - string msg = "Cannot Create Camera for Image [" + + QString msg = "Cannot Create Camera for Image [" + pCube->getFileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/control/objs/ControlNetValidMeasure/ControlNetValidMeasure.h b/isis/src/control/objs/ControlNetValidMeasure/ControlNetValidMeasure.h index 04e55166f2..96ee3910b2 100644 --- a/isis/src/control/objs/ControlNetValidMeasure/ControlNetValidMeasure.h +++ b/isis/src/control/objs/ControlNetValidMeasure/ControlNetValidMeasure.h @@ -8,7 +8,6 @@ #include "Progress.h" #include "SerialNumberList.h" -#include /** * @file * $Revision: $ @@ -169,8 +168,8 @@ namespace Isis { }; //! API to display location in the form "Sample,Line" - IString LocationString(double pdSample, double pdLine) const { - return IString((int)pdSample) + "," + IString((int)pdLine); + QString LocationString(double pdSample, double pdLine) const { + return QString((int)pdSample) + "," + QString((int)pdLine); }; //! Test for a point to be user defined number of pixels from the edge @@ -236,7 +235,7 @@ namespace Isis { void ValidatePvlShiftTolerances(); //! Read the Serial Numbers from the file and open assocaited cubes - void ReadSerialNumbers(std::string psSerialNumfile); + void ReadSerialNumbers(QString psSerialNumfile); /** * Set the CameraRequired Flag. This flag indicates whether a camera is required diff --git a/isis/src/control/objs/ControlNetValidMeasure/unitTest.cpp b/isis/src/control/objs/ControlNetValidMeasure/unitTest.cpp index 15b3a72760..f7abf9a1e9 100644 --- a/isis/src/control/objs/ControlNetValidMeasure/unitTest.cpp +++ b/isis/src/control/objs/ControlNetValidMeasure/unitTest.cpp @@ -12,17 +12,17 @@ int main(void) { Pvl pvlLog; PvlGroup op("ValidMeasure"); op += PvlKeyword("Name", "StandardDeviation"); - op += PvlKeyword("DeltaLine", 100); - op += PvlKeyword("DeltaSamp", 100); - op += PvlKeyword("Samples", 15); - op += PvlKeyword("Lines", 15); - op += PvlKeyword("MinimumInterest", 0.01); - op += PvlKeyword("MinDN", 1.0); - op += PvlKeyword("MaxDN", -1.0); - op += PvlKeyword("MinEmission", 15.0); - op += PvlKeyword("MaxEmission", 25.0); - op += PvlKeyword("MinIncidence", 0.0); - op += PvlKeyword("MaxIncidence", 135.0); + op += PvlKeyword("DeltaLine", toString(100)); + op += PvlKeyword("DeltaSamp", toString(100)); + op += PvlKeyword("Samples", toString(15)); + op += PvlKeyword("Lines", toString(15)); + op += PvlKeyword("MinimumInterest", toString(0.01)); + op += PvlKeyword("MinDN", toString(1.0)); + op += PvlKeyword("MaxDN", toString(-1.0)); + op += PvlKeyword("MinEmission", toString(15.0)); + op += PvlKeyword("MaxEmission", toString(25.0)); + op += PvlKeyword("MinIncidence", toString(0.0)); + op += PvlKeyword("MaxIncidence", toString(135.0)); pvlLog += op; @@ -37,12 +37,12 @@ int main(void) { Pvl pvlLog; PvlGroup op("ValidMeasure"); op += PvlKeyword("Name", "None"); - op += PvlKeyword("MinDN", -1.0); - op += PvlKeyword("MaxDN", 1.0); - op += PvlKeyword("MinEmission", 25.0); - op += PvlKeyword("MaxEmission", 15.0); - op += PvlKeyword("MinIncidence", 0.0); - op += PvlKeyword("MaxIncidence", 135.0); + op += PvlKeyword("MinDN", toString(-1.0)); + op += PvlKeyword("MaxDN", toString(1.0)); + op += PvlKeyword("MinEmission", toString(25.0)); + op += PvlKeyword("MaxEmission", toString(15.0)); + op += PvlKeyword("MinIncidence", toString(0.0)); + op += PvlKeyword("MaxIncidence", toString(135.0)); pvlLog += op; @@ -57,17 +57,17 @@ int main(void) { Pvl pvlLog; PvlGroup op("ValidMeasure"); op += PvlKeyword("Name", "StandardDeviation"); - op += PvlKeyword("DeltaLine", 100); - op += PvlKeyword("DeltaSamp", 100); - op += PvlKeyword("Samples", 15); - op += PvlKeyword("Lines", 15); - op += PvlKeyword("MinimumInterest", 0.01); - op += PvlKeyword("MinDN", -1.0); - op += PvlKeyword("MaxDN", 1.0); - op += PvlKeyword("MinEmission", 0.0); - op += PvlKeyword("MaxEmission", 135.0); - op += PvlKeyword("MinIncidence", 0.0); - op += PvlKeyword("MaxIncidence", 150.0); + op += PvlKeyword("DeltaLine", toString(100)); + op += PvlKeyword("DeltaSamp", toString(100)); + op += PvlKeyword("Samples", toString(15)); + op += PvlKeyword("Lines", toString(15)); + op += PvlKeyword("MinimumInterest", toString(0.01)); + op += PvlKeyword("MinDN", toString(-1.0)); + op += PvlKeyword("MaxDN", toString(1.0)); + op += PvlKeyword("MinEmission", toString(0.0)); + op += PvlKeyword("MaxEmission", toString(135.0)); + op += PvlKeyword("MinIncidence", toString(0.0)); + op += PvlKeyword("MaxIncidence", toString(150.0)); pvlLog += op; @@ -82,14 +82,14 @@ int main(void) { Pvl pvlLog; PvlGroup op("ValidMeasure"); op += PvlKeyword("Name", "None"); - op += PvlKeyword("MinDN", -1.0); - op += PvlKeyword("MaxDN", 1.0); - op += PvlKeyword("MinEmission", 0.0); - op += PvlKeyword("MaxEmission", 135.0); - op += PvlKeyword("MinIncidence", 0.0); - op += PvlKeyword("MaxIncidence", 135.0); - op += PvlKeyword("MinResolution", 100.0); - op += PvlKeyword("MaxResolution", -1.0); + op += PvlKeyword("MinDN", toString(-1.0)); + op += PvlKeyword("MaxDN", toString(1.0)); + op += PvlKeyword("MinEmission", toString(0.0)); + op += PvlKeyword("MaxEmission", toString(135.0)); + op += PvlKeyword("MinIncidence", toString(0.0)); + op += PvlKeyword("MaxIncidence", toString(135.0)); + op += PvlKeyword("MinResolution", toString(100.0)); + op += PvlKeyword("MaxResolution", toString(-1.0)); pvlLog += op; @@ -104,19 +104,19 @@ int main(void) { Pvl pvlLog; PvlGroup op("ValidMeasure"); op += PvlKeyword("Name", "None"); - op += PvlKeyword("MinDN", -1.0); - op += PvlKeyword("MaxDN", 1.0); - op += PvlKeyword("MinEmission", 0.0); - op += PvlKeyword("MaxEmission", 135.0); - op += PvlKeyword("MinIncidence", 0.0); - op += PvlKeyword("MaxIncidence", 135.0); - op += PvlKeyword("MinResolution", 100.0); - op += PvlKeyword("MaxResolution", 500.0); - op += PvlKeyword("SampleResidual", 5.0); - op += PvlKeyword("LineResidual", 5.0); - op += PvlKeyword("ResidualMagnitude", 10.0); - op += PvlKeyword("SampleShift", 5.0); - op += PvlKeyword("LineShift", 5.0); + op += PvlKeyword("MinDN", toString(-1.0)); + op += PvlKeyword("MaxDN", toString(1.0)); + op += PvlKeyword("MinEmission", toString(0.0)); + op += PvlKeyword("MaxEmission", toString(135.0)); + op += PvlKeyword("MinIncidence", toString(0.0)); + op += PvlKeyword("MaxIncidence", toString(135.0)); + op += PvlKeyword("MinResolution", toString(100.0)); + op += PvlKeyword("MaxResolution", toString(500.0)); + op += PvlKeyword("SampleResidual", toString(5.0)); + op += PvlKeyword("LineResidual", toString(5.0)); + op += PvlKeyword("ResidualMagnitude", toString(10.0)); + op += PvlKeyword("SampleShift", toString(5.0)); + op += PvlKeyword("LineShift", toString(5.0)); pvlLog += op; @@ -131,19 +131,19 @@ int main(void) { Pvl pvlLog; PvlGroup op("ValidMeasure"); op += PvlKeyword("Name", "None"); - op += PvlKeyword("MinDN", -1.0); - op += PvlKeyword("MaxDN", 1.0); - op += PvlKeyword("MinEmission", 0.0); - op += PvlKeyword("MaxEmission", 135.0); - op += PvlKeyword("MinIncidence", 0.0); - op += PvlKeyword("MaxIncidence", 135.0); - op += PvlKeyword("MinResolution", 100.0); - op += PvlKeyword("MaxResolution", 500.0); - op += PvlKeyword("SampleResidual", 5.0); - op += PvlKeyword("LineResidual", 5.0); - op += PvlKeyword("SampleShift", 5.0); - op += PvlKeyword("LineShift", 5.0); - op += PvlKeyword("PixelShift", 10.0); + op += PvlKeyword("MinDN", toString(-1.0)); + op += PvlKeyword("MaxDN", toString(1.0)); + op += PvlKeyword("MinEmission", toString(0.0)); + op += PvlKeyword("MaxEmission", toString(135.0)); + op += PvlKeyword("MinIncidence", toString(0.0)); + op += PvlKeyword("MaxIncidence", toString(135.0)); + op += PvlKeyword("MinResolution", toString(100.0)); + op += PvlKeyword("MaxResolution", toString(500.0)); + op += PvlKeyword("SampleResidual", toString(5.0)); + op += PvlKeyword("LineResidual", toString(5.0)); + op += PvlKeyword("SampleShift", toString(5.0)); + op += PvlKeyword("LineShift", toString(5.0)); + op += PvlKeyword("PixelShift", toString(10.0)); pvlLog += op; @@ -158,18 +158,18 @@ int main(void) { Pvl pvlLog; PvlGroup op("ValidMeasure"); op += PvlKeyword("Name", "None"); - op += PvlKeyword("MinDN", -1.0); - op += PvlKeyword("MaxDN", 1.0); - op += PvlKeyword("MinEmission", 0.0); - op += PvlKeyword("MaxEmission", 135.0); - op += PvlKeyword("MinIncidence", 0.0); - op += PvlKeyword("MaxIncidence", 135.0); - op += PvlKeyword("MinResolution", 100.0); - op += PvlKeyword("MaxResolution", 500.0); - op += PvlKeyword("SampleResidual", 5.0); - op += PvlKeyword("LineResidual", 5.0); - op += PvlKeyword("SampleShift", 5.0); - op += PvlKeyword("LineShift", 5.0); + op += PvlKeyword("MinDN", toString(-1.0)); + op += PvlKeyword("MaxDN", toString(1.0)); + op += PvlKeyword("MinEmission", toString(0.0)); + op += PvlKeyword("MaxEmission", toString(135.0)); + op += PvlKeyword("MinIncidence", toString(0.0)); + op += PvlKeyword("MaxIncidence", toString(135.0)); + op += PvlKeyword("MinResolution", toString(100.0)); + op += PvlKeyword("MaxResolution", toString(500.0)); + op += PvlKeyword("SampleResidual", toString(5.0)); + op += PvlKeyword("LineResidual", toString(5.0)); + op += PvlKeyword("SampleShift", toString(5.0)); + op += PvlKeyword("LineShift", toString(5.0)); pvlLog += op; diff --git a/isis/src/control/objs/ControlNetVersioner/ControlNetFileV0001.cpp b/isis/src/control/objs/ControlNetVersioner/ControlNetFileV0001.cpp index fd13e718c7..23f39c8085 100644 --- a/isis/src/control/objs/ControlNetVersioner/ControlNetFileV0001.cpp +++ b/isis/src/control/objs/ControlNetVersioner/ControlNetFileV0001.cpp @@ -39,7 +39,7 @@ namespace Isis { BigInt coreStartPos = protoBufferCore["StartByte"]; BigInt coreLength = protoBufferCore["Bytes"]; - fstream input(file.expanded().c_str(), ios::in | ios::binary); + fstream input(file.expanded().toAscii().data(), ios::in | ios::binary); if (!input.is_open()) { IString msg = "Failed to open PB file" + file.name(); throw IException(IException::Programmer, msg, _FILEINFO_); @@ -99,12 +99,12 @@ namespace Isis { pvl.AddObject(PvlObject("ControlNetwork")); PvlObject &network = pvl.FindObject("ControlNetwork"); - network += PvlKeyword("NetworkId", p_network->networkid()); - network += PvlKeyword("TargetName", p_network->targetname()); - network += PvlKeyword("UserName", p_network->username()); - network += PvlKeyword("Created", p_network->created()); - network += PvlKeyword("LastModified", p_network->lastmodified()); - network += PvlKeyword("Description", p_network->description()); + network += PvlKeyword("NetworkId", p_network->networkid().c_str()); + network += PvlKeyword("TargetName", p_network->targetname().c_str()); + network += PvlKeyword("UserName", p_network->username().c_str()); + network += PvlKeyword("Created", p_network->created().c_str()); + network += PvlKeyword("LastModified", p_network->lastmodified().c_str()); + network += PvlKeyword("Description", p_network->description().c_str()); // This is the Pvl version we're converting to network += PvlKeyword("Version", "1"); @@ -119,9 +119,9 @@ namespace Isis { else pvlPoint += PvlKeyword("PointType", "Tie"); - pvlPoint += PvlKeyword("PointId", binaryPoint.id()); - pvlPoint += PvlKeyword("ChooserName", binaryPoint.choosername()); - pvlPoint += PvlKeyword("DateTime", binaryPoint.datetime()); + pvlPoint += PvlKeyword("PointId", binaryPoint.id().c_str()); + pvlPoint += PvlKeyword("ChooserName", binaryPoint.choosername().c_str()); + pvlPoint += PvlKeyword("DateTime", binaryPoint.datetime().c_str()); if (binaryPoint.editlock()) { pvlPoint += PvlKeyword("EditLock", "True"); @@ -156,7 +156,7 @@ namespace Isis { if (binaryPoint.has_apriorisurfpointsourcefile()) pvlPoint += PvlKeyword("AprioriXYZSourceFile", - binaryPoint.apriorisurfpointsourcefile()); + binaryPoint.apriorisurfpointsourcefile().c_str()); switch (binaryPoint.aprioriradiussource()) { case ControlNetFileProtoV0001_PBControlPoint::None: @@ -186,21 +186,21 @@ namespace Isis { if (binaryPoint.has_aprioriradiussourcefile()) pvlPoint += PvlKeyword("AprioriRadiusSourceFile", - binaryPoint.aprioriradiussourcefile()); + binaryPoint.aprioriradiussourcefile().c_str()); if(binaryPoint.has_apriorix()) { - pvlPoint += PvlKeyword("AprioriX", binaryPoint.apriorix(), "meters"); - pvlPoint += PvlKeyword("AprioriY", binaryPoint.aprioriy(), "meters"); - pvlPoint += PvlKeyword("AprioriZ", binaryPoint.aprioriz(), "meters"); + pvlPoint += PvlKeyword("AprioriX", toString(binaryPoint.apriorix()), "meters"); + pvlPoint += PvlKeyword("AprioriY", toString(binaryPoint.aprioriy()), "meters"); + pvlPoint += PvlKeyword("AprioriZ", toString(binaryPoint.aprioriz()), "meters"); if(binaryPoint.aprioricovar_size()) { PvlKeyword matrix("AprioriCovarianceMatrix"); - matrix += binaryPoint.aprioricovar(0); - matrix += binaryPoint.aprioricovar(1); - matrix += binaryPoint.aprioricovar(2); - matrix += binaryPoint.aprioricovar(3); - matrix += binaryPoint.aprioricovar(4); - matrix += binaryPoint.aprioricovar(5); + matrix += toString(binaryPoint.aprioricovar(0)); + matrix += toString(binaryPoint.aprioricovar(1)); + matrix += toString(binaryPoint.aprioricovar(2)); + matrix += toString(binaryPoint.aprioricovar(3)); + matrix += toString(binaryPoint.aprioricovar(4)); + matrix += toString(binaryPoint.aprioricovar(5)); pvlPoint += matrix; } } @@ -218,18 +218,18 @@ namespace Isis { pvlPoint += PvlKeyword("RadiusConstrained", "True"); if(binaryPoint.has_adjustedx()) { - pvlPoint += PvlKeyword("AdjustedX", binaryPoint.adjustedx(), "meters"); - pvlPoint += PvlKeyword("AdjustedY", binaryPoint.adjustedy(), "meters"); - pvlPoint += PvlKeyword("AdjustedZ", binaryPoint.adjustedz(), "meters"); + pvlPoint += PvlKeyword("AdjustedX", toString(binaryPoint.adjustedx()), "meters"); + pvlPoint += PvlKeyword("AdjustedY", toString(binaryPoint.adjustedy()), "meters"); + pvlPoint += PvlKeyword("AdjustedZ", toString(binaryPoint.adjustedz()), "meters"); if(binaryPoint.adjustedcovar_size()) { PvlKeyword matrix("AdjustedCovarianceMatrix"); - matrix += binaryPoint.adjustedcovar(0); - matrix += binaryPoint.adjustedcovar(1); - matrix += binaryPoint.adjustedcovar(2); - matrix += binaryPoint.adjustedcovar(3); - matrix += binaryPoint.adjustedcovar(4); - matrix += binaryPoint.adjustedcovar(5); + matrix += toString(binaryPoint.adjustedcovar(0)); + matrix += toString(binaryPoint.adjustedcovar(1)); + matrix += toString(binaryPoint.adjustedcovar(2)); + matrix += toString(binaryPoint.adjustedcovar(3)); + matrix += toString(binaryPoint.adjustedcovar(4)); + matrix += toString(binaryPoint.adjustedcovar(5)); pvlPoint += matrix; } } @@ -238,7 +238,7 @@ namespace Isis { PvlGroup pvlMeasure("ControlMeasure"); const ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure & binaryMeasure = binaryPoint.measures(j); - pvlMeasure += PvlKeyword("SerialNumber", binaryMeasure.serialnumber()); + pvlMeasure += PvlKeyword("SerialNumber", binaryMeasure.serialnumber().c_str()); switch(binaryMeasure.type()) { case ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_Candidate: @@ -255,8 +255,8 @@ namespace Isis { break; } - pvlMeasure += PvlKeyword("ChooserName", binaryMeasure.choosername()); - pvlMeasure += PvlKeyword("DateTime", binaryMeasure.datetime()); + pvlMeasure += PvlKeyword("ChooserName", binaryMeasure.choosername().c_str()); + pvlMeasure += PvlKeyword("DateTime", binaryMeasure.datetime().c_str()); if(binaryMeasure.editlock()) pvlMeasure += PvlKeyword("EditLock", "True"); @@ -265,32 +265,32 @@ namespace Isis { pvlMeasure += PvlKeyword("Ignore", "True"); if(binaryMeasure.has_measurement()) { - pvlMeasure += PvlKeyword("Sample", binaryMeasure.measurement().sample()); - pvlMeasure += PvlKeyword("Line", binaryMeasure.measurement().line()); + pvlMeasure += PvlKeyword("Sample", toString(binaryMeasure.measurement().sample())); + pvlMeasure += PvlKeyword("Line", toString(binaryMeasure.measurement().line())); if (binaryMeasure.measurement().has_sampleresidual()) pvlMeasure += PvlKeyword("SampleResidual", - binaryMeasure.measurement().sampleresidual(), "pixels"); + toString(binaryMeasure.measurement().sampleresidual()), "pixels"); if (binaryMeasure.measurement().has_lineresidual()) pvlMeasure += PvlKeyword("LineResidual", - binaryMeasure.measurement().lineresidual(), "pixels"); + toString(binaryMeasure.measurement().lineresidual()), "pixels"); } if (binaryMeasure.has_diameter()) - pvlMeasure += PvlKeyword("Diameter", binaryMeasure.diameter()); + pvlMeasure += PvlKeyword("Diameter", toString(binaryMeasure.diameter())); if (binaryMeasure.has_apriorisample()) - pvlMeasure += PvlKeyword("AprioriSample", binaryMeasure.apriorisample()); + pvlMeasure += PvlKeyword("AprioriSample", toString(binaryMeasure.apriorisample())); if (binaryMeasure.has_aprioriline()) - pvlMeasure += PvlKeyword("AprioriLine", binaryMeasure.aprioriline()); + pvlMeasure += PvlKeyword("AprioriLine", toString(binaryMeasure.aprioriline())); if (binaryMeasure.has_samplesigma()) - pvlMeasure += PvlKeyword("SampleSigma", binaryMeasure.samplesigma()); + pvlMeasure += PvlKeyword("SampleSigma", toString(binaryMeasure.samplesigma())); if (binaryMeasure.has_samplesigma()) - pvlMeasure += PvlKeyword("LineSigma", binaryMeasure.linesigma()); + pvlMeasure += PvlKeyword("LineSigma", toString(binaryMeasure.linesigma())); for (int logEntry = 0; logEntry < diff --git a/isis/src/control/objs/ControlNetVersioner/ControlNetFileV0002.cpp b/isis/src/control/objs/ControlNetVersioner/ControlNetFileV0002.cpp index 384738c663..4ea35b111e 100644 --- a/isis/src/control/objs/ControlNetVersioner/ControlNetFileV0002.cpp +++ b/isis/src/control/objs/ControlNetVersioner/ControlNetFileV0002.cpp @@ -55,7 +55,7 @@ namespace Isis { BigInt headerStartPos = protoBufferCore["HeaderStartByte"]; BigInt headerLength = protoBufferCore["HeaderBytes"]; - fstream input(file.expanded().c_str(), ios::in | ios::binary); + fstream input(file.expanded().toAscii().data(), ios::in | ios::binary); if (!input.is_open()) { IString msg = "Failed to open control network file" + file.name(); throw IException(IException::Programmer, msg, _FILEINFO_); @@ -99,7 +99,7 @@ namespace Isis { if(pointInStream == NULL) { input.close(); - input.open(file.expanded().c_str(), ios::in | ios::binary); + input.open(file.expanded().toAscii().data(), ios::in | ios::binary); input.seekg(filePos, ios::beg); pointInStream = new IstreamInputStream(&input); @@ -157,7 +157,7 @@ namespace Isis { streampos coreHeaderSize = p_networkHeader->ByteSize(); const int labelBytes = 65536; - fstream output(file.expanded().c_str(), + fstream output(file.expanded().toAscii().data(), ios::out | ios::trunc | ios::binary); char *blankLabel = new char[labelBytes]; @@ -196,24 +196,24 @@ namespace Isis { PvlObject protoCore("Core"); protoCore.AddKeyword(PvlKeyword("HeaderStartByte", - IString((BigInt) startCoreHeaderPos))); - protoCore.AddKeyword(PvlKeyword("HeaderBytes", IString((BigInt) coreHeaderSize))); + toString((BigInt) startCoreHeaderPos))); + protoCore.AddKeyword(PvlKeyword("HeaderBytes", toString((BigInt) coreHeaderSize))); protoCore.AddKeyword(PvlKeyword("PointsStartByte", - IString((BigInt) ( startCoreHeaderPos + coreHeaderSize)))); + toString((BigInt) ( startCoreHeaderPos + coreHeaderSize)))); protoCore.AddKeyword(PvlKeyword("PointsBytes", - (BigInt) IString(pointsSize))); + toString(pointsSize))); protoObj.AddObject(protoCore); PvlGroup netInfo("ControlNetworkInfo"); netInfo.AddComment("This group is for informational purposes only"); - netInfo += PvlKeyword("NetworkId", p_networkHeader->networkid()); - netInfo += PvlKeyword("TargetName", p_networkHeader->targetname()); - netInfo += PvlKeyword("UserName", p_networkHeader->username()); - netInfo += PvlKeyword("Created", p_networkHeader->created()); - netInfo += PvlKeyword("LastModified", p_networkHeader->lastmodified()); - netInfo += PvlKeyword("Description", p_networkHeader->description()); - netInfo += PvlKeyword("NumberOfPoints", p_controlPoints->size()); - netInfo += PvlKeyword("NumberOfMeasures", numMeasures); + netInfo += PvlKeyword("NetworkId", p_networkHeader->networkid().c_str()); + netInfo += PvlKeyword("TargetName", p_networkHeader->targetname().c_str()); + netInfo += PvlKeyword("UserName", p_networkHeader->username().c_str()); + netInfo += PvlKeyword("Created", p_networkHeader->created().c_str()); + netInfo += PvlKeyword("LastModified", p_networkHeader->lastmodified().c_str()); + netInfo += PvlKeyword("Description", p_networkHeader->description().c_str()); + netInfo += PvlKeyword("NumberOfPoints", toString(p_controlPoints->size())); + netInfo += PvlKeyword("NumberOfMeasures", toString(numMeasures)); netInfo += PvlKeyword("Version", "2"); protoObj.AddGroup(netInfo); @@ -247,19 +247,19 @@ namespace Isis { pvl.AddObject(PvlObject("ControlNetwork")); PvlObject &network = pvl.FindObject("ControlNetwork"); - network += PvlKeyword("NetworkId", p_networkHeader->networkid()); - network += PvlKeyword("TargetName", p_networkHeader->targetname()); - network += PvlKeyword("UserName", p_networkHeader->username()); - network += PvlKeyword("Created", p_networkHeader->created()); - network += PvlKeyword("LastModified", p_networkHeader->lastmodified()); - network += PvlKeyword("Description", p_networkHeader->description()); + network += PvlKeyword("NetworkId", p_networkHeader->networkid().c_str()); + network += PvlKeyword("TargetName", p_networkHeader->targetname().c_str()); + network += PvlKeyword("UserName", p_networkHeader->username().c_str()); + network += PvlKeyword("Created", p_networkHeader->created().c_str()); + network += PvlKeyword("LastModified", p_networkHeader->lastmodified().c_str()); + network += PvlKeyword("Description", p_networkHeader->description().c_str()); // This is the Pvl version we're converting to network += PvlKeyword("Version", "3"); // Get Target Radii from naif kernel PvlGroup pvlRadii; - string target = (string)network.FindKeyword("TargetName",Pvl::Traverse); + QString target = (QString)network.FindKeyword("TargetName",Pvl::Traverse); if (target != "") { try { NaifStatus::CheckErrors(); @@ -282,9 +282,9 @@ namespace Isis { else pvlPoint += PvlKeyword("PointType", "Free"); - pvlPoint += PvlKeyword("PointId", binaryPoint.id()); - pvlPoint += PvlKeyword("ChooserName", binaryPoint.choosername()); - pvlPoint += PvlKeyword("DateTime", binaryPoint.datetime()); + pvlPoint += PvlKeyword("PointId", binaryPoint.id().c_str()); + pvlPoint += PvlKeyword("ChooserName", binaryPoint.choosername().c_str()); + pvlPoint += PvlKeyword("DateTime", binaryPoint.datetime().c_str()); if (binaryPoint.editlock()) { pvlPoint += PvlKeyword("EditLock", "True"); @@ -319,7 +319,7 @@ namespace Isis { if (binaryPoint.has_apriorisurfpointsourcefile()) pvlPoint += PvlKeyword("AprioriXYZSourceFile", - binaryPoint.apriorisurfpointsourcefile()); + binaryPoint.apriorisurfpointsourcefile().c_str()); switch (binaryPoint.aprioriradiussource()) { case ControlPointFileEntryV0002::None: @@ -349,12 +349,12 @@ namespace Isis { if (binaryPoint.has_aprioriradiussourcefile()) pvlPoint += PvlKeyword("AprioriRadiusSourceFile", - binaryPoint.aprioriradiussourcefile()); + binaryPoint.aprioriradiussourcefile().c_str()); if(binaryPoint.has_apriorix()) { - pvlPoint += PvlKeyword("AprioriX", binaryPoint.apriorix(), "meters"); - pvlPoint += PvlKeyword("AprioriY", binaryPoint.aprioriy(), "meters"); - pvlPoint += PvlKeyword("AprioriZ", binaryPoint.aprioriz(), "meters"); + pvlPoint += PvlKeyword("AprioriX", toString(binaryPoint.apriorix()), "meters"); + pvlPoint += PvlKeyword("AprioriY", toString(binaryPoint.aprioriy()), "meters"); + pvlPoint += PvlKeyword("AprioriZ", toString(binaryPoint.aprioriz()), "meters"); // Get surface point, convert to lat,lon,radius and output as comment SurfacePoint apriori; @@ -363,23 +363,23 @@ namespace Isis { Displacement(binaryPoint.aprioriy(),Displacement::Meters), Displacement(binaryPoint.aprioriz(),Displacement::Meters)); pvlPoint.FindKeyword("AprioriX").AddComment("AprioriLatitude = " + - IString(apriori.GetLatitude().degrees()) + + toString(apriori.GetLatitude().degrees()) + " "); pvlPoint.FindKeyword("AprioriY").AddComment("AprioriLongitude = " + - IString(apriori.GetLongitude().degrees()) + + toString(apriori.GetLongitude().degrees()) + " "); pvlPoint.FindKeyword("AprioriZ").AddComment("AprioriRadius = " + - IString(apriori.GetLocalRadius().meters()) + + toString(apriori.GetLocalRadius().meters()) + " "); if(binaryPoint.aprioricovar_size()) { PvlKeyword matrix("AprioriCovarianceMatrix"); - matrix += binaryPoint.aprioricovar(0); - matrix += binaryPoint.aprioricovar(1); - matrix += binaryPoint.aprioricovar(2); - matrix += binaryPoint.aprioricovar(3); - matrix += binaryPoint.aprioricovar(4); - matrix += binaryPoint.aprioricovar(5); + matrix += toString(binaryPoint.aprioricovar(0)); + matrix += toString(binaryPoint.aprioricovar(1)); + matrix += toString(binaryPoint.aprioricovar(2)); + matrix += toString(binaryPoint.aprioricovar(3)); + matrix += toString(binaryPoint.aprioricovar(4)); + matrix += toString(binaryPoint.aprioricovar(5)); pvlPoint += matrix; if (pvlRadii.HasKeyword("EquatorialRadius")) { @@ -397,12 +397,12 @@ namespace Isis { covar(1, 2) = binaryPoint.aprioricovar(4); covar(2, 2) = binaryPoint.aprioricovar(5); apriori.SetRectangularMatrix(covar); - IString sigmas = "AprioriLatitudeSigma = " + - IString(apriori.GetLatSigmaDistance().meters()) + + QString sigmas = "AprioriLatitudeSigma = " + + toString(apriori.GetLatSigmaDistance().meters()) + " AprioriLongitudeSigma = " + - IString(apriori.GetLonSigmaDistance().meters()) + + toString(apriori.GetLonSigmaDistance().meters()) + " AprioriRadiusSigma = " + - IString(apriori.GetLocalRadiusSigma().meters()) + + toString(apriori.GetLocalRadiusSigma().meters()) + " "; pvlPoint.FindKeyword("AprioriCovarianceMatrix").AddComment(sigmas); } @@ -419,9 +419,9 @@ namespace Isis { pvlPoint += PvlKeyword("RadiusConstrained", "True"); if(binaryPoint.has_adjustedx()) { - pvlPoint += PvlKeyword("AdjustedX", binaryPoint.adjustedx(), "meters"); - pvlPoint += PvlKeyword("AdjustedY", binaryPoint.adjustedy(), "meters"); - pvlPoint += PvlKeyword("AdjustedZ", binaryPoint.adjustedz(), "meters"); + pvlPoint += PvlKeyword("AdjustedX", toString(binaryPoint.adjustedx()), "meters"); + pvlPoint += PvlKeyword("AdjustedY", toString(binaryPoint.adjustedy()), "meters"); + pvlPoint += PvlKeyword("AdjustedZ", toString(binaryPoint.adjustedz()), "meters"); // Get surface point, convert to lat,lon,radius and output as comment SurfacePoint adjusted; @@ -430,23 +430,23 @@ namespace Isis { Displacement(binaryPoint.adjustedy(),Displacement::Meters), Displacement(binaryPoint.adjustedz(),Displacement::Meters)); pvlPoint.FindKeyword("AdjustedX").AddComment("AdjustedLatitude = " + - IString(adjusted.GetLatitude().degrees()) + + toString(adjusted.GetLatitude().degrees()) + " "); pvlPoint.FindKeyword("AdjustedY").AddComment("AdjustedLongitude = " + - IString(adjusted.GetLongitude().degrees()) + + toString(adjusted.GetLongitude().degrees()) + " "); pvlPoint.FindKeyword("AdjustedZ").AddComment("AdjustedRadius = " + - IString(adjusted.GetLocalRadius().meters()) + + toString(adjusted.GetLocalRadius().meters()) + " "); if(binaryPoint.adjustedcovar_size()) { PvlKeyword matrix("AdjustedCovarianceMatrix"); - matrix += binaryPoint.adjustedcovar(0); - matrix += binaryPoint.adjustedcovar(1); - matrix += binaryPoint.adjustedcovar(2); - matrix += binaryPoint.adjustedcovar(3); - matrix += binaryPoint.adjustedcovar(4); - matrix += binaryPoint.adjustedcovar(5); + matrix += toString(binaryPoint.adjustedcovar(0)); + matrix += toString(binaryPoint.adjustedcovar(1)); + matrix += toString(binaryPoint.adjustedcovar(2)); + matrix += toString(binaryPoint.adjustedcovar(3)); + matrix += toString(binaryPoint.adjustedcovar(4)); + matrix += toString(binaryPoint.adjustedcovar(5)); pvlPoint += matrix; if (pvlRadii.HasKeyword("EquatorialRadius")) { @@ -464,12 +464,12 @@ namespace Isis { covar(1, 2) = binaryPoint.adjustedcovar(4); covar(2, 2) = binaryPoint.adjustedcovar(5); adjusted.SetRectangularMatrix(covar); - IString sigmas = "AdjustedLatitudeSigma = " + - IString(adjusted.GetLatSigmaDistance().meters()) + + QString sigmas = "AdjustedLatitudeSigma = " + + toString(adjusted.GetLatSigmaDistance().meters()) + " AdjustedLongitudeSigma = " + - IString(adjusted.GetLonSigmaDistance().meters()) + + toString(adjusted.GetLonSigmaDistance().meters()) + " AdjustedRadiusSigma = " + - IString(adjusted.GetLocalRadiusSigma().meters()) + + toString(adjusted.GetLocalRadiusSigma().meters()) + " "; pvlPoint.FindKeyword("AdjustedCovarianceMatrix").AddComment(sigmas); } @@ -480,7 +480,7 @@ namespace Isis { PvlGroup pvlMeasure("ControlMeasure"); const ControlPointFileEntryV0002_Measure & binaryMeasure = binaryPoint.measures(j); - pvlMeasure += PvlKeyword("SerialNumber", binaryMeasure.serialnumber()); + pvlMeasure += PvlKeyword("SerialNumber", binaryMeasure.serialnumber().c_str()); switch(binaryMeasure.type()) { case ControlPointFileEntryV0002_Measure_MeasureType_Candidate: @@ -498,10 +498,10 @@ namespace Isis { } if(binaryMeasure.has_choosername()) - pvlMeasure += PvlKeyword("ChooserName", binaryMeasure.choosername()); + pvlMeasure += PvlKeyword("ChooserName", binaryMeasure.choosername().c_str()); if(binaryMeasure.has_datetime()) - pvlMeasure += PvlKeyword("DateTime", binaryMeasure.datetime()); + pvlMeasure += PvlKeyword("DateTime", binaryMeasure.datetime().c_str()); if(binaryMeasure.editlock()) pvlMeasure += PvlKeyword("EditLock", "True"); @@ -510,34 +510,34 @@ namespace Isis { pvlMeasure += PvlKeyword("Ignore", "True"); if(binaryMeasure.has_sample()) - pvlMeasure += PvlKeyword("Sample", binaryMeasure.sample()); + pvlMeasure += PvlKeyword("Sample", toString(binaryMeasure.sample())); if(binaryMeasure.has_line()) - pvlMeasure += PvlKeyword("Line", binaryMeasure.line()); + pvlMeasure += PvlKeyword("Line", toString(binaryMeasure.line())); if (binaryMeasure.has_diameter()) - pvlMeasure += PvlKeyword("Diameter", binaryMeasure.diameter()); + pvlMeasure += PvlKeyword("Diameter", toString(binaryMeasure.diameter())); if (binaryMeasure.has_apriorisample()) - pvlMeasure += PvlKeyword("AprioriSample", binaryMeasure.apriorisample()); + pvlMeasure += PvlKeyword("AprioriSample", toString(binaryMeasure.apriorisample())); if (binaryMeasure.has_aprioriline()) - pvlMeasure += PvlKeyword("AprioriLine", binaryMeasure.aprioriline()); + pvlMeasure += PvlKeyword("AprioriLine", toString(binaryMeasure.aprioriline())); if (binaryMeasure.has_samplesigma()) - pvlMeasure += PvlKeyword("SampleSigma", binaryMeasure.samplesigma(), + pvlMeasure += PvlKeyword("SampleSigma", toString(binaryMeasure.samplesigma()), "pixels"); if (binaryMeasure.has_samplesigma()) - pvlMeasure += PvlKeyword("LineSigma", binaryMeasure.linesigma(), + pvlMeasure += PvlKeyword("LineSigma", toString(binaryMeasure.linesigma()), "pixels"); if(binaryMeasure.has_sampleresidual()) - pvlMeasure += PvlKeyword("SampleResidual", binaryMeasure.sampleresidual(), + pvlMeasure += PvlKeyword("SampleResidual", toString(binaryMeasure.sampleresidual()), "pixels"); if(binaryMeasure.has_lineresidual()) - pvlMeasure += PvlKeyword("LineResidual", binaryMeasure.lineresidual(), + pvlMeasure += PvlKeyword("LineResidual", toString(binaryMeasure.lineresidual()), "pixels"); for(int logEntry = 0; diff --git a/isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.cpp b/isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.cpp index 371f36a552..7c856aa946 100644 --- a/isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.cpp +++ b/isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.cpp @@ -97,9 +97,9 @@ namespace Isis { PvlObject &network = pvl.FindObject("ControlNetwork"); if(!network.HasKeyword("Version")) - network += PvlKeyword("Version", 1); + network += PvlKeyword("Version", "1"); - int version = network["Version"][0]; + int version = toInt(network["Version"][0]); while(version != LATEST_PVL_VERSION) { int previousVersion = version; @@ -123,7 +123,7 @@ namespace Isis { throw IException(IException::Unknown, msg, _FILEINFO_); } - version = network["Version"][0]; + version = toInt(network["Version"][0]); if(version == previousVersion) { IString msg = "Cannot update from version [" + IString(version) + "] " @@ -154,12 +154,12 @@ namespace Isis { ControlNetFileHeaderV0002 &header = latest->GetNetworkHeader(); - header.set_networkid(network.FindKeyword("NetworkId")); - header.set_targetname(network.FindKeyword("TargetName")); - header.set_created(network.FindKeyword("Created")); - header.set_lastmodified(network.FindKeyword("LastModified")); - header.set_description(network.FindKeyword("Description")); - header.set_username(network.FindKeyword("UserName")); + header.set_networkid(network.FindKeyword("NetworkId")[0].toAscii().data()); + header.set_targetname(network.FindKeyword("TargetName")[0].toAscii().data()); + header.set_created(network.FindKeyword("Created")[0].toAscii().data()); + header.set_lastmodified(network.FindKeyword("LastModified")[0].toAscii().data()); + header.set_description(network.FindKeyword("Description")[0].toAscii().data()); + header.set_username(network.FindKeyword("UserName")[0].toAscii().data()); header.add_pointmessagesizes(0); // Just to pass the "IsInitialized" test if(!header.IsInitialized()) { @@ -279,23 +279,23 @@ namespace Isis { if (object.HasKeyword("AprioriCovarianceMatrix")) { PvlKeyword &matrix = object["AprioriCovarianceMatrix"]; - point.add_aprioricovar(matrix[0]); - point.add_aprioricovar(matrix[1]); - point.add_aprioricovar(matrix[2]); - point.add_aprioricovar(matrix[3]); - point.add_aprioricovar(matrix[4]); - point.add_aprioricovar(matrix[5]); + point.add_aprioricovar(toDouble(matrix[0])); + point.add_aprioricovar(toDouble(matrix[1])); + point.add_aprioricovar(toDouble(matrix[2])); + point.add_aprioricovar(toDouble(matrix[3])); + point.add_aprioricovar(toDouble(matrix[4])); + point.add_aprioricovar(toDouble(matrix[5])); } if(object.HasKeyword("AdjustedCovarianceMatrix")) { PvlKeyword &matrix = object["AdjustedCovarianceMatrix"]; - point.add_adjustedcovar(matrix[0]); - point.add_adjustedcovar(matrix[1]); - point.add_adjustedcovar(matrix[2]); - point.add_adjustedcovar(matrix[3]); - point.add_adjustedcovar(matrix[4]); - point.add_adjustedcovar(matrix[5]); + point.add_adjustedcovar(toDouble(matrix[0])); + point.add_adjustedcovar(toDouble(matrix[1])); + point.add_adjustedcovar(toDouble(matrix[2])); + point.add_adjustedcovar(toDouble(matrix[3])); + point.add_adjustedcovar(toDouble(matrix[4])); + point.add_adjustedcovar(toDouble(matrix[5])); } // Process Measures @@ -335,13 +335,13 @@ namespace Isis { measure, &ControlPointFileEntryV0002::Measure::set_linesigma); if(group.HasKeyword("Reference")) { - if(group["Reference"][0].DownCase() == "true") + if(group["Reference"][0].toLower() == "true") point.set_referenceindex(groupIndex); group.DeleteKeyword("Reference"); } - IString type = group["MeasureType"][0].DownCase(); + QString type = group["MeasureType"][0].toLower(); if(type == "candidate") measure.set_type(ControlPointFileEntryV0002::Measure::Candidate); else if(type == "manual") @@ -403,7 +403,7 @@ namespace Isis { const PvlGroup &netInfo = protoBuf.FindGroup("ControlNetworkInfo"); if(netInfo.HasKeyword("Version")) - version = netInfo["Version"][0]; + version = toInt(netInfo["Version"][0]); // Okay, let's instantiate the correct ControlNetFile for this version ControlNetFile *cnetFile; @@ -458,7 +458,7 @@ namespace Isis { */ void ControlNetVersioner::ConvertVersion1ToVersion2( PvlObject &network) { - network["Version"] = 2; + network["Version"] = "2"; // Really... Projection::TargetRadii should be making this call NaifStatus::CheckErrors(); @@ -489,29 +489,29 @@ namespace Isis { if(cp.HasKeyword("AprioriLatitude")) { SurfacePoint apriori( - Latitude(cp["AprioriLatitude"][0], Angle::Degrees), - Longitude(cp["AprioriLongitude"][0], Angle::Degrees), - Distance(cp["AprioriRadius"][0], Distance::Meters)); + Latitude(toDouble(cp["AprioriLatitude"][0]), Angle::Degrees), + Longitude(toDouble(cp["AprioriLongitude"][0]), Angle::Degrees), + Distance(toDouble(cp["AprioriRadius"][0]), Distance::Meters)); - cp += PvlKeyword("AprioriX", apriori.GetX().meters(), "meters"); - cp += PvlKeyword("AprioriY", apriori.GetY().meters(), "meters"); - cp += PvlKeyword("AprioriZ", apriori.GetZ().meters(), "meters"); + cp += PvlKeyword("AprioriX", toString(apriori.GetX().meters()), "meters"); + cp += PvlKeyword("AprioriY", toString(apriori.GetY().meters()), "meters"); + cp += PvlKeyword("AprioriZ", toString(apriori.GetZ().meters()), "meters"); } if(cp.HasKeyword("Latitude")) { SurfacePoint adjusted( - Latitude(cp["Latitude"][0], Angle::Degrees), - Longitude(cp["Longitude"][0], Angle::Degrees), - Distance(cp["Radius"][0], Distance::Meters)); + Latitude(toDouble(cp["Latitude"][0]), Angle::Degrees), + Longitude(toDouble(cp["Longitude"][0]), Angle::Degrees), + Distance(toDouble(cp["Radius"][0]), Distance::Meters)); - cp += PvlKeyword("AdjustedX", adjusted.GetX().meters(), "meters"); - cp += PvlKeyword("AdjustedY", adjusted.GetY().meters(), "meters"); - cp += PvlKeyword("AdjustedZ", adjusted.GetZ().meters(), "meters"); + cp += PvlKeyword("AdjustedX", toString(adjusted.GetX().meters()), "meters"); + cp += PvlKeyword("AdjustedY", toString(adjusted.GetY().meters()), "meters"); + cp += PvlKeyword("AdjustedZ", toString(adjusted.GetZ().meters()), "meters"); if(!cp.HasKeyword("AprioriLatitude")) { - cp += PvlKeyword("AprioriX", adjusted.GetX().meters(), "meters"); - cp += PvlKeyword("AprioriY", adjusted.GetY().meters(), "meters"); - cp += PvlKeyword("AprioriZ", adjusted.GetZ().meters(), "meters"); + cp += PvlKeyword("AprioriX", toString(adjusted.GetX().meters()), "meters"); + cp += PvlKeyword("AprioriY", toString(adjusted.GetY().meters()), "meters"); + cp += PvlKeyword("AprioriZ", toString(adjusted.GetZ().meters()), "meters"); } } @@ -532,24 +532,24 @@ namespace Isis { double sigmaRad = 10000.0; if(cp.HasKeyword("AprioriSigmaLatitude")) { - if((double)cp["AprioriSigmaLatitude"][0] > 0 && - (double)cp["AprioriSigmaLatitude"][0] < sigmaLat) + if(toDouble(cp["AprioriSigmaLatitude"][0]) > 0 && + toDouble(cp["AprioriSigmaLatitude"][0]) < sigmaLat) sigmaLat = cp["AprioriSigmaLatitude"]; cp += PvlKeyword("LatitudeConstrained", "True"); } if(cp.HasKeyword("AprioriSigmaLongitude")) { - if((double)cp["AprioriSigmaLongitude"][0] > 0 && - (double)cp["AprioriSigmaLongitude"][0] < sigmaLon) + if(toDouble(cp["AprioriSigmaLongitude"][0]) > 0 && + toDouble(cp["AprioriSigmaLongitude"][0]) < sigmaLon) sigmaLon = cp["AprioriSigmaLongitude"]; cp += PvlKeyword("LongitudeConstrained", "True"); } if(cp.HasKeyword("AprioriSigmaRadius")) { - if((double)cp["AprioriSigmaRadius"][0] > 0 && - (double)cp["AprioriSigmaRadius"][0] < sigmaRad) + if(toDouble(cp["AprioriSigmaRadius"][0]) > 0 && + toDouble(cp["AprioriSigmaRadius"][0]) < sigmaRad) sigmaRad = cp["AprioriSigmaRadius"]; cp += PvlKeyword("RadiusConstrained", "True"); @@ -567,12 +567,12 @@ namespace Isis { Distance(sigmaRad, Distance::Meters)); PvlKeyword aprioriCovarMatrix("AprioriCovarianceMatrix"); - aprioriCovarMatrix += tmp.GetRectangularMatrix()(0, 0); - aprioriCovarMatrix += tmp.GetRectangularMatrix()(0, 1); - aprioriCovarMatrix += tmp.GetRectangularMatrix()(0, 2); - aprioriCovarMatrix += tmp.GetRectangularMatrix()(1, 1); - aprioriCovarMatrix += tmp.GetRectangularMatrix()(1, 2); - aprioriCovarMatrix += tmp.GetRectangularMatrix()(2, 2); + aprioriCovarMatrix += toString(tmp.GetRectangularMatrix()(0, 0)); + aprioriCovarMatrix += toString(tmp.GetRectangularMatrix()(0, 1)); + aprioriCovarMatrix += toString(tmp.GetRectangularMatrix()(0, 2)); + aprioriCovarMatrix += toString(tmp.GetRectangularMatrix()(1, 1)); + aprioriCovarMatrix += toString(tmp.GetRectangularMatrix()(1, 2)); + aprioriCovarMatrix += toString(tmp.GetRectangularMatrix()(2, 2)); cp += aprioriCovarMatrix; } @@ -585,20 +585,20 @@ namespace Isis { double sigmaRad = 10000.0; if(cp.HasKeyword("AdjustedSigmaLatitude")) { - if((double)cp["AdjustedSigmaLatitude"][0] > 0 && - (double)cp["AdjustedSigmaLatitude"][0] < sigmaLat) + if(toDouble(cp["AdjustedSigmaLatitude"][0]) > 0 && + toDouble(cp["AdjustedSigmaLatitude"][0]) < sigmaLat) sigmaLat = cp["AdjustedSigmaLatitude"]; } if(cp.HasKeyword("AdjustedSigmaLongitude")) { - if((double)cp["AdjustedSigmaLongitude"][0] > 0 && - (double)cp["AdjustedSigmaLongitude"][0] < sigmaLon) + if(toDouble(cp["AdjustedSigmaLongitude"][0]) > 0 && + toDouble(cp["AdjustedSigmaLongitude"][0]) < sigmaLon) sigmaLon = cp["AdjustedSigmaLongitude"]; } if(cp.HasKeyword("AdjustedSigmaRadius")) { - if((double)cp["AdjustedSigmaRadius"][0] > 0 && - (double)cp["AdjustedSigmaRadius"][0] < sigmaRad) + if(toDouble(cp["AdjustedSigmaRadius"][0]) > 0 && + toDouble(cp["AdjustedSigmaRadius"][0]) < sigmaRad) sigmaRad = cp["AdjustedSigmaRadius"]; } @@ -614,12 +614,12 @@ namespace Isis { Distance(sigmaRad, Distance::Meters)); PvlKeyword adjustedCovarMatrix("AdjustedCovarianceMatrix"); - adjustedCovarMatrix += tmp.GetRectangularMatrix()(0, 0); - adjustedCovarMatrix += tmp.GetRectangularMatrix()(0, 1); - adjustedCovarMatrix += tmp.GetRectangularMatrix()(0, 2); - adjustedCovarMatrix += tmp.GetRectangularMatrix()(1, 1); - adjustedCovarMatrix += tmp.GetRectangularMatrix()(1, 2); - adjustedCovarMatrix += tmp.GetRectangularMatrix()(2, 2); + adjustedCovarMatrix += toString(tmp.GetRectangularMatrix()(0, 0)); + adjustedCovarMatrix += toString(tmp.GetRectangularMatrix()(0, 1)); + adjustedCovarMatrix += toString(tmp.GetRectangularMatrix()(0, 2)); + adjustedCovarMatrix += toString(tmp.GetRectangularMatrix()(1, 1)); + adjustedCovarMatrix += toString(tmp.GetRectangularMatrix()(1, 2)); + adjustedCovarMatrix += toString(tmp.GetRectangularMatrix()(2, 2)); cp += adjustedCovarMatrix; } @@ -684,15 +684,15 @@ namespace Isis { // Delete some extraneous values we once printed if(cm.HasKeyword("SampleResidual") && - (double)cm["SampleResidual"][0] == 0.0) + toDouble(cm["SampleResidual"][0]) == 0.0) cm.DeleteKeyword("SampleResidual"); if(cm.HasKeyword("LineResidual") && - (double)cm["LineResidual"][0] == 0.0) + toDouble(cm["LineResidual"][0]) == 0.0) cm.DeleteKeyword("LineResidual"); if(cm.HasKeyword("Diameter") && - (double)cm["Diameter"][0] == 0.0) + toDouble(cm["Diameter"][0]) == 0.0) cm.DeleteKeyword("Diameter"); if(cm.HasKeyword("ErrorMagnitude")) @@ -722,7 +722,7 @@ namespace Isis { */ void ControlNetVersioner::ConvertVersion2ToVersion3( PvlObject &network) { - network["Version"] = 3; + network["Version"] = "3"; for(int cpIndex = 0; cpIndex < network.Objects(); cpIndex ++) { PvlObject &cp = network.Object(cpIndex); @@ -743,7 +743,7 @@ namespace Isis { */ void ControlNetVersioner::ConvertVersion3ToVersion4( PvlObject &network) { - network["Version"] = 4; + network["Version"] = "4"; for (int cpIndex = 0; cpIndex < network.Objects(); cpIndex ++) { PvlObject &cp = network.Object(cpIndex); @@ -768,14 +768,14 @@ namespace Isis { * @param setter The protocol buffer setter method */ void ControlNetVersioner::Copy(PvlContainer &container, - IString keyName, ControlPointFileEntryV0002 &point, + QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(bool)) { if(!container.HasKeyword(keyName)) return; - IString value = container[keyName][0]; + QString value = container[keyName][0]; container.DeleteKeyword(keyName); - value.DownCase(); + value = value.toLower(); if(value == "true" || value == "yes") (point.*setter)(true); } @@ -795,12 +795,12 @@ namespace Isis { * @param setter The protocol buffer setter method */ void ControlNetVersioner::Copy(PvlContainer &container, - IString keyName, ControlPointFileEntryV0002 &point, + QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(double)) { if(!container.HasKeyword(keyName)) return; - double value = container[keyName][0]; + double value = toDouble(container[keyName][0]); container.DeleteKeyword(keyName); (point.*setter)(value); } @@ -820,7 +820,7 @@ namespace Isis { * @param setter The protocol buffer setter method */ void ControlNetVersioner::Copy(PvlContainer &container, - IString keyName, ControlPointFileEntryV0002 &point, + QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(const std::string&)) { if(!container.HasKeyword(keyName)) return; @@ -844,15 +844,15 @@ namespace Isis { * @param measure The protocol buffer point instance to set the value in * @param setter The protocol buffer setter method */ - void ControlNetVersioner::Copy(PvlContainer &container, IString keyName, + void ControlNetVersioner::Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter)(bool)) { if(!container.HasKeyword(keyName)) return; - IString value = container[keyName][0]; + QString value = container[keyName][0]; container.DeleteKeyword(keyName); - value.DownCase(); + value = value.toLower(); if(value == "true" || value == "yes") (measure.*setter)(true); } @@ -871,13 +871,13 @@ namespace Isis { * @param measure The protocol buffer point instance to set the value in * @param setter The protocol buffer setter method */ - void ControlNetVersioner::Copy(PvlContainer &container, IString keyName, + void ControlNetVersioner::Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter)(double)) { if(!container.HasKeyword(keyName)) return; - double value = container[keyName][0]; + double value = toDouble(container[keyName][0]); container.DeleteKeyword(keyName); (measure.*setter)(value); } @@ -896,7 +896,7 @@ namespace Isis { * @param measure The protocol buffer point instance to set the value in * @param set The protocol buffer setter method */ - void ControlNetVersioner::Copy(PvlContainer &container, IString keyName, + void ControlNetVersioner::Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*set)(const std::string &)) { if(!container.HasKeyword(keyName)) diff --git a/isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.h b/isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.h index 4e3887f44b..4dd9c74b0a 100644 --- a/isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.h +++ b/isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.h @@ -1,11 +1,5 @@ #ifndef ControlNetVersioner_h #define ControlNetVersioner_h - -#include - -#include "ControlNetFile.h" -#include "ControlNetFileV0002.pb.h" - /** * @file * $Revision: 1.9 $ @@ -29,11 +23,17 @@ * http://www.usgs.gov/privacy.html. */ +#include + +#include "ControlNetFile.h" +#include "ControlNetFileV0002.pb.h" + +class QString; + namespace Isis { class ControlNetFileV0001; class ControlNetFileV0002; class FileName; - class IString; class Progress; class Pvl; class PvlContainer; @@ -145,23 +145,23 @@ namespace Isis { private: // helper methods for LatestPvlToBinary - static void Copy(PvlContainer &container, IString keyName, + static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(bool)); static void Copy(PvlContainer &container, - IString keyName, ControlPointFileEntryV0002 &point, + QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(double)); static void Copy(PvlContainer &container, - IString keyName, ControlPointFileEntryV0002 &point, + QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(const std::string&)); - static void Copy(PvlContainer &container, IString keyName, + static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter)(bool)); - static void Copy(PvlContainer &container, IString keyName, + static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter)(double)); - static void Copy(PvlContainer &container, IString keyName, + static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter) (const std::string &)); diff --git a/isis/src/control/objs/ControlNetVersioner/unitTest.cpp b/isis/src/control/objs/ControlNetVersioner/unitTest.cpp index bf45311bb1..d010857b66 100644 --- a/isis/src/control/objs/ControlNetVersioner/unitTest.cpp +++ b/isis/src/control/objs/ControlNetVersioner/unitTest.cpp @@ -1,6 +1,6 @@ #include "ControlNetVersioner.h" -#include +#include #include @@ -14,7 +14,7 @@ using namespace std; using namespace Isis; -void TestNetwork(const string &filename, bool printNetwork = true); +void TestNetwork(const QString &filename, bool printNetwork = true); int main(int argc, char *argv[]) { Preference::Preferences(true); @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) { } -void TestNetwork(const string &filename, bool printNetwork) { +void TestNetwork(const QString &filename, bool printNetwork) { cerr << "Reading: " << filename << "...\n\n"; FileName networkFileName(filename); diff --git a/isis/src/control/objs/ControlPoint/ControlPoint.cpp b/isis/src/control/objs/ControlPoint/ControlPoint.cpp index d2bcf04675..ac8300c75c 100644 --- a/isis/src/control/objs/ControlPoint/ControlPoint.cpp +++ b/isis/src/control/objs/ControlPoint/ControlPoint.cpp @@ -20,13 +20,13 @@ #include "ControlNetFile.h" #include "ControlNetFileV0002.pb.h" #include "Cube.h" +#include "IString.h" #include "Latitude.h" #include "Longitude.h" #include "PvlObject.h" #include "SerialNumberList.h" #include "SpecialPixel.h" #include "Statistics.h" -#include "IString.h" using boost::numeric::ublas::symmetric_matrix; using boost::numeric::ublas::upper; @@ -127,13 +127,13 @@ namespace Isis { measures = new QHash< QString, ControlMeasure * >; cubeSerials = new QStringList; - id = fileEntry.id(); + id = fileEntry.id().c_str(); dateTime = ""; aprioriSurfacePointSource = SurfacePointSource::None; aprioriRadiusSource = RadiusSource::None; - chooserName = fileEntry.choosername(); - dateTime = fileEntry.datetime(); + chooserName = fileEntry.choosername().c_str(); + dateTime = fileEntry.datetime().c_str(); editLock = false; parentNetwork = NULL; @@ -151,7 +151,7 @@ namespace Isis { type = Fixed; break; default: - IString msg = "Point type is invalid."; + QString msg = "Point type is invalid."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -192,7 +192,7 @@ namespace Isis { } if (fileEntry.has_apriorisurfpointsourcefile()) { - aprioriSurfacePointSourceFile = fileEntry.apriorisurfpointsourcefile(); + aprioriSurfacePointSourceFile = fileEntry.apriorisurfpointsourcefile().c_str(); } if (fileEntry.has_aprioriradiussource()) { @@ -223,7 +223,7 @@ namespace Isis { } if (fileEntry.has_aprioriradiussourcefile()) { - aprioriRadiusSourceFile = fileEntry.aprioriradiussourcefile(); + aprioriRadiusSourceFile = fileEntry.aprioriradiussourcefile().c_str(); } constraintStatus.reset(); @@ -317,7 +317,7 @@ namespace Isis { * * @param id Control Point Id */ - ControlPoint::ControlPoint(const IString &newId) : invalid(false) { + ControlPoint::ControlPoint(const QString &newId) : invalid(false) { parentNetwork = NULL; measures = NULL; referenceMeasure = NULL; @@ -430,7 +430,7 @@ namespace Isis { // Make sure measure is unique foreach(ControlMeasure * m, measures->values()) { if (m->GetCubeSerialNumber() == measure->GetCubeSerialNumber()) { - IString msg = "The SerialNumber is not unique. A measure with " + QString msg = "The SerialNumber is not unique. A measure with " "serial number [" + measure->GetCubeSerialNumber() + "] already " "exists for ControlPoint [" + GetId() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -469,9 +469,9 @@ namespace Isis { * * @param sn The serial number of the measure to validate */ - void ControlPoint::ValidateMeasure(IString serialNumber) const { + void ControlPoint::ValidateMeasure(QString serialNumber) const { if (!measures->contains(serialNumber)) { - IString msg = "No measure with serial number [" + serialNumber + + QString msg = "No measure with serial number [" + serialNumber + "] is owned by this point"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -484,7 +484,7 @@ namespace Isis { * * @param serialNumber The serial number of the measure to delete */ - int ControlPoint::Delete(IString serialNumber) { + int ControlPoint::Delete(QString serialNumber) { ValidateMeasure(serialNumber); ControlMeasure *cm = (*measures)[serialNumber]; @@ -543,7 +543,7 @@ namespace Isis { */ int ControlPoint::Delete(int index) { if (index < 0 || index >= cubeSerials->size()) { - IString msg = "index [" + IString(index) + "] out of bounds"; + QString msg = "index [" + QString(index) + "] out of bounds"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -578,7 +578,7 @@ namespace Isis { * @param serialNumber serial number of measure to get * @returns control measure with matching serial number */ - ControlMeasure *ControlPoint::GetMeasure(IString serialNumber) { + ControlMeasure *ControlPoint::GetMeasure(QString serialNumber) { ValidateMeasure(serialNumber); return (*measures)[serialNumber]; } @@ -590,7 +590,7 @@ namespace Isis { * @param serialNumber serial number of measure to get * @returns const control measure with matching serial number */ - const ControlMeasure *ControlPoint::GetMeasure(IString serialNumber) const { + const ControlMeasure *ControlPoint::GetMeasure(QString serialNumber) const { ValidateMeasure(serialNumber); return measures->value(serialNumber); } @@ -598,7 +598,7 @@ namespace Isis { const ControlMeasure *ControlPoint::GetMeasure(int index) const { if (index < 0 || index >= cubeSerials->size()) { - IString msg = "Index [" + IString(index) + "] out of range"; + QString msg = "Index [" + QString(index) + "] out of range"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -608,7 +608,7 @@ namespace Isis { ControlMeasure *ControlPoint::GetMeasure(int index) { if (index < 0 || index >= cubeSerials->size()) { - IString msg = "Index [" + IString(index) + "] out of range"; + QString msg = "Index [" + QString(index) + "] out of range"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -623,7 +623,7 @@ namespace Isis { */ const ControlMeasure *ControlPoint::GetRefMeasure() const { if (referenceMeasure == NULL) { - IString msg = "Control point [" + GetId() + "] has no reference measure!"; + QString msg = "Control point [" + GetId() + "] has no reference measure!"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -636,7 +636,7 @@ namespace Isis { */ ControlMeasure *ControlPoint::GetRefMeasure() { if (referenceMeasure == NULL) { - IString msg = "Control point [" + GetId() + "] has no reference measure!"; + QString msg = "Control point [" + GetId() + "] has no reference measure!"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -651,7 +651,7 @@ namespace Isis { * * @param name The username of the person who last modified this control point */ - ControlPoint::Status ControlPoint::SetChooserName(IString name) { + ControlPoint::Status ControlPoint::SetChooserName(QString name) { if (editLock) return PointLocked; chooserName = name; @@ -667,7 +667,7 @@ namespace Isis { * * @param newDateTime The date and time this control point was last modified */ - ControlPoint::Status ControlPoint::SetDateTime(IString newDateTime) { + ControlPoint::Status ControlPoint::SetDateTime(QString newDateTime) { if (editLock) return PointLocked; dateTime = newDateTime; @@ -711,10 +711,10 @@ namespace Isis { * * @return (int) status Success or PointLocked */ - ControlPoint::Status ControlPoint::SetId(IString newId) { + ControlPoint::Status ControlPoint::SetId(QString newId) { if (editLock) return PointLocked; - IString oldId = id; + QString oldId = id; id = newId; if (parentNetwork) parentNetwork->UpdatePointReference(this, oldId); @@ -747,7 +747,7 @@ namespace Isis { return PointLocked; if (index < 0 || index >= cubeSerials->size()) { - IString msg = "Index ["; + QString msg = "Index ["; msg += index + "] out of range"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -762,12 +762,12 @@ namespace Isis { * * @param sn The serial number of the new reference measure */ - ControlPoint::Status ControlPoint::SetRefMeasure(IString sn) { + ControlPoint::Status ControlPoint::SetRefMeasure(QString sn) { if (editLock) return PointLocked; if (!cubeSerials->contains(sn)) { - IString msg = "Point [" + id + "] has no measure with serial number [" + + QString msg = "Point [" + id + "] has no measure with serial number [" + sn + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -865,7 +865,7 @@ namespace Isis { */ ControlPoint::Status ControlPoint::SetType(PointType newType) { if (type != Fixed && type != Free && type != Constrained) { - IString msg = "Invalid Point Enumeration, [" + IString(type) + "], for " + QString msg = "Invalid Point Enumeration, [" + QString(type) + "], for " "Control Point [" + GetId() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -904,7 +904,7 @@ namespace Isis { * @param source Where the radius came from */ ControlPoint::Status ControlPoint::SetAprioriRadiusSourceFile( - IString sourceFile) { + QString sourceFile) { if (editLock) return PointLocked; PointModified(); @@ -971,7 +971,7 @@ namespace Isis { * @param sourceFile Where the surface point came from */ ControlPoint::Status ControlPoint::SetAprioriSurfacePointSourceFile( - IString sourceFile) { + QString sourceFile) { if (editLock) return PointLocked; PointModified(); @@ -1020,7 +1020,7 @@ namespace Isis { // it exists! if (GetType() == Fixed) { if (!aprioriSurfacePoint.Valid()) { - IString msg = "ControlPoint [" + GetId() + "] is a fixed point "; + QString msg = "ControlPoint [" + GetId() + "] is a fixed point "; msg += "and requires an apriori x/y/z"; throw IException(IException::User, msg, _FILEINFO_); } @@ -1050,7 +1050,7 @@ namespace Isis { else { Camera *cam = m->Camera(); if (cam == NULL) { - IString msg = "The Camera must be set prior to calculating apriori"; + QString msg = "The Camera must be set prior to calculating apriori"; throw IException(IException::Programmer, msg, _FILEINFO_); } if (cam->SetImage(m->GetSample(), m->GetLine())) { @@ -1073,7 +1073,7 @@ namespace Isis { continue; // TODO: What do we do -// IString msg = "Cannot compute lat/lon/radius (x/y/z) for " +// QString msg = "Cannot compute lat/lon/radius (x/y/z) for " // "ControlPoint [" + GetId() + "], measure [" + // m->GetCubeSerialNumber() + "]"; // throw IException(IException::User, msg, _FILEINFO_); @@ -1096,7 +1096,7 @@ namespace Isis { // Did we have any measures? if (goodMeasures == 0) { - IString msg = "ControlPoint [" + GetId() + "] has no measures which " + QString msg = "ControlPoint [" + GetId() + "] has no measures which " "project to lat/lon/radius (x/y/z)"; throw IException(IException::User, msg, _FILEINFO_); } @@ -1191,7 +1191,7 @@ namespace Isis { // FocalPlaneMap which takes x/y to detector s/l. We will bypass the // distortion map and have residuals in undistorted pixels. if (!fpmap->SetFocalPlane(m->GetFocalPlaneComputedX(), m->GetFocalPlaneComputedY())) { - IString msg = "Sanity check #1 for ControlPoint [" + GetId() + + QString msg = "Sanity check #1 for ControlPoint [" + GetId() + "], ControlMeasure [" + m->GetCubeSerialNumber() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); // This error shouldn't happen but check anyways @@ -1263,7 +1263,7 @@ namespace Isis { if (cam->GetCameraType() != Isis::Camera::Radar) { // Again we will bypass the distortion map and have residuals in undistorted pixels. if (!fpmap->SetFocalPlane(m->GetFocalPlaneMeasuredX(), m->GetFocalPlaneMeasuredY())) { - IString msg = "Sanity check #2 for ControlPoint [" + GetId() + + QString msg = "Sanity check #2 for ControlPoint [" + GetId() + "], ControlMeasure [" + m->GetCubeSerialNumber() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); // This error shouldn't happen but check anyways @@ -1350,7 +1350,7 @@ namespace Isis { return Success; } - IString ControlPoint::GetChooserName() const { + QString ControlPoint::GetChooserName() const { if (chooserName != "") { return chooserName; } @@ -1360,7 +1360,7 @@ namespace Isis { } - IString ControlPoint::GetDateTime() const { + QString ControlPoint::GetDateTime() const { if (dateTime != "") { return dateTime; } @@ -1402,7 +1402,7 @@ namespace Isis { * * @return Control Point Id */ - IString ControlPoint::GetId() const { + QString ControlPoint::GetId() const { return id; } @@ -1429,8 +1429,8 @@ namespace Isis { * * @returns A string representation of type */ - IString ControlPoint::PointTypeToString(PointType pointType) { - IString str; + QString ControlPoint::PointTypeToString(PointType pointType) { + QString str; switch (pointType) { case Fixed: @@ -1456,12 +1456,12 @@ namespace Isis { * @returns the PointType for the given string */ ControlPoint::PointType ControlPoint::StringToPointType( - IString pointTypeString) { + QString pointTypeString) { // On failure assume Free ControlPoint::PointType type = ControlPoint::Free; - IString errMsg = "There is no PointType that has a string representation" + QString errMsg = "There is no PointType that has a string representation" " of \""; errMsg += pointTypeString; errMsg += "\"."; @@ -1484,7 +1484,7 @@ namespace Isis { * * @return A string representation of the PointType */ - IString ControlPoint::GetPointTypeString() const { + QString ControlPoint::GetPointTypeString() const { return PointTypeToString(GetType()); } @@ -1505,8 +1505,8 @@ namespace Isis { * * @returns A string representation of RadiusSource */ - IString ControlPoint::RadiusSourceToString(RadiusSource::Source source) { - IString str; + QString ControlPoint::RadiusSourceToString(RadiusSource::Source source) { + QString str; switch (source) { case RadiusSource::None: @@ -1567,7 +1567,7 @@ namespace Isis { * * @return A string representation of the RadiusSource */ - IString ControlPoint::GetRadiusSourceString() const { + QString ControlPoint::GetRadiusSourceString() const { return RadiusSourceToString(aprioriRadiusSource); } @@ -1579,10 +1579,10 @@ namespace Isis { * * @returns A string representation of SurfacePointSource */ - IString ControlPoint::SurfacePointSourceToString( + QString ControlPoint::SurfacePointSourceToString( SurfacePointSource::Source source) { - IString str; + QString str; switch (source) { case SurfacePointSource::None: @@ -1643,7 +1643,7 @@ namespace Isis { * * @return A string representation of the SurfacePointSource */ - IString ControlPoint::GetSurfacePointSourceString() const { + QString ControlPoint::GetSurfacePointSourceString() const { return SurfacePointSourceToString(aprioriSurfacePointSource); } @@ -1692,7 +1692,7 @@ namespace Isis { return constraintStatus.count(); } - IString ControlPoint::GetAprioriRadiusSourceFile() const { + QString ControlPoint::GetAprioriRadiusSourceFile() const { return aprioriRadiusSourceFile; } @@ -1702,7 +1702,7 @@ namespace Isis { } - IString ControlPoint::GetAprioriSurfacePointSourceFile() const { + QString ControlPoint::GetAprioriSurfacePointSourceFile() const { return aprioriSurfacePointSourceFile; } @@ -1749,7 +1749,7 @@ namespace Isis { * @param serialNumber The serial number * @return True if point contains serial number, false if not */ - bool ControlPoint::HasSerialNumber(IString serialNumber) const { + bool ControlPoint::HasSerialNumber(QString serialNumber) const { return cubeSerials->contains(serialNumber); } @@ -1768,7 +1768,7 @@ namespace Isis { */ QString ControlPoint::GetReferenceSN() const { if (referenceMeasure == NULL) { - IString msg = "There is no reference measure set in the ControlPoint [" + + QString msg = "There is no reference measure set in the ControlPoint [" + GetId() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1799,11 +1799,11 @@ namespace Isis { * @returns The index of the measure with serial number matching sn, * or -1 on failure if throws is false. */ - int ControlPoint::IndexOf(IString sn, bool throws) const { + int ControlPoint::IndexOf(QString sn, bool throws) const { int index = cubeSerials->indexOf(sn); if (throws && index == -1) { - IString msg = "ControlMeasure [" + sn + "] does not exist in point [" + + QString msg = "ControlMeasure [" + sn + "] does not exist in point [" + id + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1822,7 +1822,7 @@ namespace Isis { */ int ControlPoint::IndexOfRefMeasure() const { if (!referenceMeasure) { - IString msg = "There is no reference measure for point [" + id + "]." + QString msg = "There is no reference measure for point [" + id + "]." " This also means of course that the point is empty!"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -1901,7 +1901,7 @@ namespace Isis { * * @returns const version of the measure which has the provided serial number */ - const ControlMeasure *ControlPoint::operator[](IString serialNumber) const { + const ControlMeasure *ControlPoint::operator[](QString serialNumber) const { return GetMeasure(serialNumber); } @@ -1913,7 +1913,7 @@ namespace Isis { * * @returns The measure which has the provided serial number */ - ControlMeasure *ControlPoint::operator[](IString serialNumber) { + ControlMeasure *ControlPoint::operator[](QString serialNumber) { return GetMeasure(serialNumber); } @@ -2185,7 +2185,7 @@ namespace Isis { ControlPointFileEntryV0002 ControlPoint::ToFileEntry() const { ControlPointFileEntryV0002 fileEntry; - fileEntry.set_id(GetId()); + fileEntry.set_id(GetId().toAscii().data()); switch (GetType()) { case ControlPoint::Free: fileEntry.set_type(ControlPointFileEntryV0002::Free); @@ -2198,11 +2198,11 @@ namespace Isis { break; } - if (!GetChooserName().empty()) { - fileEntry.set_choosername(GetChooserName()); + if (!GetChooserName().isEmpty()) { + fileEntry.set_choosername(GetChooserName().toAscii().data()); } - if (!GetDateTime().empty()) { - fileEntry.set_datetime(GetDateTime()); + if (!GetDateTime().isEmpty()) { + fileEntry.set_datetime(GetDateTime().toAscii().data()); } if (IsEditLocked()) fileEntry.set_editlock(true); @@ -2236,8 +2236,8 @@ namespace Isis { default: break; } - if (!GetAprioriSurfacePointSourceFile().empty()) { - fileEntry.set_apriorisurfpointsourcefile(GetAprioriSurfacePointSourceFile()); + if (!GetAprioriSurfacePointSourceFile().isEmpty()) { + fileEntry.set_apriorisurfpointsourcefile(GetAprioriSurfacePointSourceFile().toAscii().data()); } switch (GetAprioriRadiusSource()) { @@ -2262,8 +2262,8 @@ namespace Isis { break; } - if (!GetAprioriRadiusSourceFile().empty()) { - fileEntry.set_aprioriradiussourcefile(GetAprioriRadiusSourceFile()); + if (!GetAprioriRadiusSourceFile().isEmpty()) { + fileEntry.set_aprioriradiussourcefile(GetAprioriRadiusSourceFile().toAscii().data()); } if (GetAprioriSurfacePoint().Valid()) { diff --git a/isis/src/control/objs/ControlPoint/ControlPoint.h b/isis/src/control/objs/ControlPoint/ControlPoint.h index d33a0ac9df..65207ff8a6 100644 --- a/isis/src/control/objs/ControlPoint/ControlPoint.h +++ b/isis/src/control/objs/ControlPoint/ControlPoint.h @@ -27,8 +27,8 @@ #include #include +#include -#include "IString.h" #include "SurfacePoint.h" template< typename A, typename B > class QHash; @@ -209,7 +209,7 @@ namespace Isis { * operator now relies on QVector's comparison * operator instead of looping itself. Added private * helper methods: - * int FindMeasureIndex(IString serialNumber) + * int FindMeasureIndex(QString serialNumber) * const * void PointModified(); * Updated documentation extensively. Removed @@ -429,7 +429,7 @@ namespace Isis { ControlPoint(); ControlPoint(const ControlPoint &); - ControlPoint(const IString &id); + ControlPoint(const QString &id); ControlPoint(const ControlPointFileEntryV0002 &fileEntry, const Distance &majorRad, const Distance &minorRad, const Distance &polarRad); @@ -441,12 +441,12 @@ namespace Isis { void Add(ControlMeasure *measure); int Delete(ControlMeasure *measure); - int Delete(IString serialNumber); + int Delete(QString serialNumber); int Delete(int index); Status ResetApriori(); - const ControlMeasure *GetMeasure(IString serialNumber) const; - ControlMeasure *GetMeasure(IString serialNumber); + const ControlMeasure *GetMeasure(QString serialNumber) const; + ControlMeasure *GetMeasure(QString serialNumber); const ControlMeasure *GetMeasure(int index) const; ControlMeasure *GetMeasure(int index); @@ -454,23 +454,23 @@ namespace Isis { const ControlMeasure *GetRefMeasure() const; ControlMeasure *GetRefMeasure(); - Status SetChooserName(IString name); - Status SetDateTime(IString newDateTime); + Status SetChooserName(QString name); + Status SetDateTime(QString newDateTime); Status SetEditLock(bool editLock); - Status SetId(IString id); + Status SetId(QString id); Status SetRefMeasure(ControlMeasure *cm); Status SetRefMeasure(int index); - Status SetRefMeasure(IString sn); + Status SetRefMeasure(QString sn); Status SetRejected(bool rejected); Status SetIgnored(bool newIgnoreStatus); Status SetAdjustedSurfacePoint(SurfacePoint newSurfacePoint); Status SetType(PointType newType); Status SetAprioriRadiusSource(RadiusSource::Source source); - Status SetAprioriRadiusSourceFile(IString sourceFile); + Status SetAprioriRadiusSourceFile(QString sourceFile); Status SetAprioriSurfacePoint(SurfacePoint aprioriSP); Status SetAprioriSurfacePointSource(SurfacePointSource::Source source); - Status SetAprioriSurfacePointSourceFile(IString sourceFile); + Status SetAprioriSurfacePointSourceFile(QString sourceFile); // Status UpdateSphericalPointCoordinates(const Latitude &lat, const Longitude &lon, // const Distance &radius); @@ -481,11 +481,11 @@ namespace Isis { SurfacePoint GetAdjustedSurfacePoint() const; SurfacePoint GetBestSurfacePoint() const; - IString GetChooserName() const; - IString GetDateTime() const; + QString GetChooserName() const; + QString GetDateTime() const; bool IsEditLocked() const; bool IsRejected() const; - IString GetId() const; + QString GetId() const; bool IsIgnored() const; bool IsValid() const; bool IsInvalid() const; @@ -498,31 +498,31 @@ namespace Isis { bool IsRadiusConstrained(); int NumberOfConstrainedCoordinates(); - static IString PointTypeToString(PointType type); - static PointType StringToPointType(IString pointTypeString); + static QString PointTypeToString(PointType type); + static PointType StringToPointType(QString pointTypeString); - IString GetPointTypeString() const; + QString GetPointTypeString() const; PointType GetType() const; - static IString RadiusSourceToString(RadiusSource::Source source); + static QString RadiusSourceToString(RadiusSource::Source source); static RadiusSource::Source StringToRadiusSource(QString str); - IString GetRadiusSourceString() const; - static IString SurfacePointSourceToString(SurfacePointSource::Source source); + QString GetRadiusSourceString() const; + static QString SurfacePointSourceToString(SurfacePointSource::Source source); static SurfacePointSource::Source StringToSurfacePointSource(QString str); - IString GetSurfacePointSourceString() const; + QString GetSurfacePointSourceString() const; SurfacePoint GetAprioriSurfacePoint() const; RadiusSource::Source GetAprioriRadiusSource() const; - IString GetAprioriRadiusSourceFile() const; + QString GetAprioriRadiusSourceFile() const; SurfacePointSource::Source GetAprioriSurfacePointSource() const; - IString GetAprioriSurfacePointSourceFile() const; + QString GetAprioriSurfacePointSourceFile() const; int GetNumMeasures() const; int GetNumValidMeasures() const; int GetNumLockedMeasures() const; - bool HasSerialNumber(IString serialNumber) const; + bool HasSerialNumber(QString serialNumber) const; int IndexOf(ControlMeasure *, bool throws = true) const; - int IndexOf(IString sn, bool throws = true) const; + int IndexOf(QString sn, bool throws = true) const; int IndexOfRefMeasure() const; bool IsReferenceExplicit() const; QString GetReferenceSN() const; @@ -533,8 +533,8 @@ namespace Isis { QList< ControlMeasure * > getMeasures(bool excludeIgnored = false) const; QList< QString > getCubeSerialNumbers() const; - const ControlMeasure *operator[](IString serialNumber) const; - ControlMeasure *operator[](IString serialNumber); + const ControlMeasure *operator[](QString serialNumber) const; + ControlMeasure *operator[](QString serialNumber); const ControlMeasure *operator[](int index) const; ControlMeasure *operator[](int index); @@ -556,7 +556,7 @@ namespace Isis { private: void SetExplicitReference(ControlMeasure *measure); - void ValidateMeasure(IString serialNumber) const; + void ValidateMeasure(QString serialNumber) const; void AddMeasure(ControlMeasure *measure); void PointModified(); @@ -576,7 +576,7 @@ namespace Isis { * identifier for control points. This often has a number in it, and * looks like "T0052" where the next one is "T0053" and so on. */ - IString id; + QString id; /** * This is the user name of the person who last modified this control @@ -586,13 +586,13 @@ namespace Isis { * be updated. This is an empty string if we need to dynamically * get the username of the caller when asked for (or written to file). */ - IString chooserName; + QString chooserName; /** * This is the last modified date and time. This is updated automatically * and works virtually in the same way as chooserName. */ - IString dateTime; + QString dateTime; /** * What this control point is tying together. @@ -643,7 +643,7 @@ namespace Isis { SurfacePointSource::Source aprioriSurfacePointSource; //! FileName where the apriori surface point originated from - IString aprioriSurfacePointSourceFile; + QString aprioriSurfacePointSourceFile; /** * Where the apriori surface point's radius originated from, most commonly @@ -654,7 +654,7 @@ namespace Isis { /** * The name of the file that derives the apriori surface point's radius */ - IString aprioriRadiusSourceFile; + QString aprioriRadiusSourceFile; /** * The apriori surface point. This is the "known truth" or trustworthy diff --git a/isis/src/control/objs/ControlPointList/ControlPointList.cpp b/isis/src/control/objs/ControlPointList/ControlPointList.cpp index 8778a27c8f..b6553ece3b 100644 --- a/isis/src/control/objs/ControlPointList/ControlPointList.cpp +++ b/isis/src/control/objs/ControlPointList/ControlPointList.cpp @@ -19,7 +19,7 @@ namespace Isis { FileList list(psListFile); int size = list.size(); for(int i = 0; i < size; i++) { - qList.insert(i, list[i].toString().ToQt()); + qList.insert(i, list[i].toString()); mbFound.push_back(false); } mqCpList = QStringList(qList); @@ -28,7 +28,7 @@ namespace Isis { mqCpList.sort(); } catch(IException &e) { - std::string msg = "Can't open or invalid file list [" + + QString msg = "Can't open or invalid file list [" + psListFile.expanded() + "]"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -49,8 +49,8 @@ namespace Isis { * * @return bool */ - bool ControlPointList::HasControlPoint(const std::string &psCpId) { - int index = mqCpList.indexOf(QString(psCpId.c_str())); + bool ControlPointList::HasControlPoint(const QString &psCpId) { + int index = mqCpList.indexOf(QString(psCpId)); if(index == -1 || index >= Size()) return false; @@ -75,16 +75,16 @@ namespace Isis { * * @param piIndex The index of the desired control point id * - * @return std::string The control point id returned + * @return QString The control point id returned */ - std::string ControlPointList::ControlPointId(int piIndex) { + QString ControlPointList::ControlPointId(int piIndex) { int size = Size(); if(piIndex >= 0 && piIndex < size) { - return (mqCpList.value(piIndex).toStdString()); + return (mqCpList.value(piIndex)); } else { - IString num = IString(piIndex); - std::string msg = "Index [" + (std::string) num + "] is invalid"; + QString num = toString(piIndex); + QString msg = "Index [" + num + "] is invalid"; throw IException(IException::Programmer, msg, _FILEINFO_); } } @@ -96,12 +96,12 @@ namespace Isis { * * @return int The index of the control point id */ - int ControlPointList::ControlPointIndex(const std::string &psCpId) { + int ControlPointList::ControlPointIndex(const QString &psCpId) { if(HasControlPoint(psCpId)) { - return mqCpList.indexOf(QString(psCpId.c_str())); + return mqCpList.indexOf(QString(psCpId)); } else { - std::string msg = "Requested control point id [" + psCpId + "] "; + QString msg = "Requested control point id [" + psCpId + "] "; msg += "does not exist in the list"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -116,21 +116,21 @@ namespace Isis { void ControlPointList::RegisterStatistics(Pvl &pcPvlLog) { int size = Size(); int iNotFound = 0; - std::string sPointsNotFound = ""; + QString sPointsNotFound = ""; for(int i = 0; i < size; i++) { if(!mbFound[i]) { if(iNotFound) { sPointsNotFound += ", "; } - sPointsNotFound += mqCpList.value(i).toStdString(); + sPointsNotFound += mqCpList.value(i); iNotFound++; } } - pcPvlLog += Isis::PvlKeyword("TotalPoints", size); - pcPvlLog += Isis::PvlKeyword("ValidPoints", size - iNotFound); - pcPvlLog += Isis::PvlKeyword("InvalidPoints", iNotFound); + pcPvlLog += Isis::PvlKeyword("TotalPoints", toString(size)); + pcPvlLog += Isis::PvlKeyword("ValidPoints", toString(size - iNotFound)); + pcPvlLog += Isis::PvlKeyword("InvalidPoints", toString(iNotFound)); pcPvlLog += Isis::PvlKeyword("InvalidPointIds", sPointsNotFound); } } diff --git a/isis/src/control/objs/ControlPointList/ControlPointList.h b/isis/src/control/objs/ControlPointList/ControlPointList.h index 3ee481a040..9f34d9ccc9 100644 --- a/isis/src/control/objs/ControlPointList/ControlPointList.h +++ b/isis/src/control/objs/ControlPointList/ControlPointList.h @@ -53,10 +53,10 @@ namespace Isis { ControlPointList(const FileName &psFileName); virtual ~ControlPointList(); - std::string ControlPointId(int piIndex); - int ControlPointIndex(const std::string &psCpId); + QString ControlPointId(int piIndex); + int ControlPointIndex(const QString &psCpId); - bool HasControlPoint(const std::string &psCpId); + bool HasControlPoint(const QString &psCpId); int Size() const; diff --git a/isis/src/control/objs/ControlPointList/unitTest.cpp b/isis/src/control/objs/ControlPointList/unitTest.cpp index 874bf27bd7..cf66d58666 100644 --- a/isis/src/control/objs/ControlPointList/unitTest.cpp +++ b/isis/src/control/objs/ControlPointList/unitTest.cpp @@ -7,6 +7,7 @@ #include "FileName.h" #include "Preference.h" +using namespace Isis; using namespace std; int main() { diff --git a/isis/src/control/objs/InterestOperator/InterestOperator.cpp b/isis/src/control/objs/InterestOperator/InterestOperator.cpp index bed59479d7..8d6010cd9c 100644 --- a/isis/src/control/objs/InterestOperator/InterestOperator.cpp +++ b/isis/src/control/objs/InterestOperator/InterestOperator.cpp @@ -89,23 +89,23 @@ namespace Isis { mOperatorGrp += Isis::PvlKeyword(op["Name"]); p_samples = op["Samples"]; - mOperatorGrp += Isis::PvlKeyword("Samples", p_samples); + mOperatorGrp += Isis::PvlKeyword("Samples", toString(p_samples)); p_lines = op["Lines"]; - mOperatorGrp += Isis::PvlKeyword("Lines", p_lines); + mOperatorGrp += Isis::PvlKeyword("Lines", toString(p_lines)); p_deltaLine = op["DeltaLine"]; - mOperatorGrp += Isis::PvlKeyword("DeltaLine", p_deltaLine); + mOperatorGrp += Isis::PvlKeyword("DeltaLine", toString(p_deltaLine)); p_deltaSamp = op["DeltaSamp"]; - mOperatorGrp += Isis::PvlKeyword("DeltaSamp", p_deltaSamp); + mOperatorGrp += Isis::PvlKeyword("DeltaSamp", toString(p_deltaSamp)); p_minimumInterest = op["MinimumInterest"]; - mOperatorGrp += Isis::PvlKeyword("MinimumInterest", p_minimumInterest); + mOperatorGrp += Isis::PvlKeyword("MinimumInterest", toString(p_minimumInterest)); } catch (IException &e) { - std::string msg = "Improper format for InterestOperator PVL [" + pPvl.FileName() + "]"; + QString msg = "Improper format for InterestOperator PVL [" + pPvl.FileName() + "]"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -155,7 +155,7 @@ namespace Isis { if (!pUnivGrndMap.HasCamera()) // Level 3 images/mosaic or bad image { - std::string msg = "Cannot run interest on images with no camera. Image " + + QString msg = "Cannot run interest on images with no camera. Image " + pCube.getFileName() + " has no Camera"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -240,8 +240,8 @@ namespace Isis { * @history 10/15/2010 Sharmila Prasad - Use a single copy of Control Net * */ - void InterestOperator::Operate(ControlNet &pNewNet, std::string psSerialNumFile, - std::string psOverlapListFile) { + void InterestOperator::Operate(ControlNet &pNewNet, QString psSerialNumFile, + QString psOverlapListFile) { ReadSerialNumbers(psSerialNumFile); // Find all the overlaps between the images in the FROMLIST @@ -281,7 +281,7 @@ namespace Isis { newMeasure->SetChooserName("Application cnetref(interest)"); bool bMeasureLocked = newMeasure->IsEditLocked(); - std::string sn = newMeasure->GetCubeSerialNumber(); + QString sn = newMeasure->GetCubeSerialNumber(); //double dSample = newMeasure->GetSample(); //double dLine = newMeasure->GetLine(); @@ -416,7 +416,7 @@ namespace Isis { // Process for point with good interest and a best index double dReferenceLat = 0, dReferenceLon = 0; if (iBestMeasureIndex >= 0) { - std::string sn = mtInterestResults[iBestMeasureIndex].msSerialNum; + QString sn = mtInterestResults[iBestMeasureIndex].msSerialNum; Cube *bestCube = mCubeMgr.OpenCube(mSerialNumbers.FileName(sn)); // Get the Camera for the reference image and get the lat/lon from that measurment @@ -425,7 +425,7 @@ namespace Isis { bestCamera = bestCube->getCamera(); } catch (IException &e) { - std::string msg = "Cannot Create Camera for Image:" + mSerialNumbers.FileName(sn); + QString msg = "Cannot Create Camera for Image:" + mSerialNumbers.FileName(sn); throw IException(IException::User, msg, _FILEINFO_); } @@ -447,7 +447,7 @@ namespace Isis { ControlMeasure *newMeasure = newPnt->GetMeasure(measure); newMeasure->SetDateTime(); newMeasure->SetChooserName("Application cnetref(interest)"); - std::string sn = newMeasure->GetCubeSerialNumber(); + QString sn = newMeasure->GetCubeSerialNumber(); // Log PvlGroup pvlMeasureGrp("MeasureDetails"); @@ -470,7 +470,7 @@ namespace Isis { measureCamera = measureCube->getCamera(); } catch (IException &e) { - std::string msg = "Cannot Create Camera for Image:" + mSerialNumbers.FileName(sn); + QString msg = "Cannot Create Camera for Image:" + mSerialNumbers.FileName(sn); throw IException(e, IException::User, msg, _FILEINFO_); } @@ -486,8 +486,8 @@ namespace Isis { pvlMeasureGrp += Isis::PvlKeyword("NewLocation", LocationString(mtInterestResults[measure].mdBestSample, mtInterestResults[measure].mdBestLine)); - pvlMeasureGrp += Isis::PvlKeyword("DeltaSample", mtInterestResults[measure].miDeltaSample); - pvlMeasureGrp += Isis::PvlKeyword("DeltaLine", mtInterestResults[measure].miDeltaLine); + pvlMeasureGrp += Isis::PvlKeyword("DeltaSample", toString(mtInterestResults[measure].miDeltaSample)); + pvlMeasureGrp += Isis::PvlKeyword("DeltaLine", toString(mtInterestResults[measure].miDeltaLine)); pvlMeasureGrp += Isis::PvlKeyword("Reference", "true"); } else { @@ -503,12 +503,12 @@ namespace Isis { ValidStandardOptions(newMeasure, measureCube); if (!results.isValid()) { iNumIgnore++; - pvlMeasureGrp += Isis::PvlKeyword("Ignored", "Failed Validation Test-" + results.toString().toStdString()); + pvlMeasureGrp += Isis::PvlKeyword("Ignored", "Failed Validation Test-" + results.toString()); newMeasure->SetIgnored(true); } pvlMeasureGrp += Isis::PvlKeyword("NewLocation", LocationString(dSample, dLine)); - pvlMeasureGrp += Isis::PvlKeyword("DeltaSample", (int)abs((int)dSample - (int)origSample)); - pvlMeasureGrp += Isis::PvlKeyword("DeltaLine", (int)abs((int)dLine - (int)origLine)); + pvlMeasureGrp += Isis::PvlKeyword("DeltaSample", toString((int)abs((int)dSample - (int)origSample))); + pvlMeasureGrp += Isis::PvlKeyword("DeltaLine", toString((int)abs((int)dLine - (int)origLine))); pvlMeasureGrp += Isis::PvlKeyword("Reference", "false"); } } @@ -532,11 +532,11 @@ namespace Isis { iMeasuresModified ++; } - pvlMeasureGrp += Isis::PvlKeyword("BestInterest", mtInterestResults[measure].mdInterest); - pvlMeasureGrp += Isis::PvlKeyword("EmissionAngle", mtInterestResults[measure].mdEmission); - pvlMeasureGrp += Isis::PvlKeyword("IncidenceAngle", mtInterestResults[measure].mdIncidence); - pvlMeasureGrp += Isis::PvlKeyword("Resolution", mtInterestResults[measure].mdResolution); - pvlMeasureGrp += Isis::PvlKeyword("DNValue", mtInterestResults[measure].mdDn); + pvlMeasureGrp += Isis::PvlKeyword("BestInterest", toString(mtInterestResults[measure].mdInterest)); + pvlMeasureGrp += Isis::PvlKeyword("EmissionAngle", toString(mtInterestResults[measure].mdEmission)); + pvlMeasureGrp += Isis::PvlKeyword("IncidenceAngle", toString(mtInterestResults[measure].mdIncidence)); + pvlMeasureGrp += Isis::PvlKeyword("Resolution", toString(mtInterestResults[measure].mdResolution)); + pvlMeasureGrp += Isis::PvlKeyword("DNValue", toString(mtInterestResults[measure].mdDn)); pvlPointObj += pvlMeasureGrp; } // Measures Loop @@ -557,7 +557,7 @@ namespace Isis { PvlGroup pvlRefChangeGrp("ReferenceChangeDetails"); if (iOrigRefIndex >= 0) { pvlRefChangeGrp += Isis::PvlKeyword("PrevSerialNumber", mtInterestResults[iOrigRefIndex].msSerialNum); - pvlRefChangeGrp += Isis::PvlKeyword("PrevBestInterest", mtInterestResults[iOrigRefIndex].mdInterest); + pvlRefChangeGrp += Isis::PvlKeyword("PrevBestInterest", toString(mtInterestResults[iOrigRefIndex].mdInterest)); pvlRefChangeGrp += Isis::PvlKeyword("PrevLocation", LocationString(mtInterestResults[iOrigRefIndex].mdOrigSample, mtInterestResults[iOrigRefIndex].mdOrigLine)); } @@ -565,7 +565,7 @@ namespace Isis { pvlRefChangeGrp += Isis::PvlKeyword("PrevReference", "Not Set"); } pvlRefChangeGrp += Isis::PvlKeyword("NewSerialNumber", mtInterestResults[iBestMeasureIndex].msSerialNum); - pvlRefChangeGrp += Isis::PvlKeyword("NewBestInterest", mtInterestResults[iBestMeasureIndex].mdInterest); + pvlRefChangeGrp += Isis::PvlKeyword("NewBestInterest", toString(mtInterestResults[iBestMeasureIndex].mdInterest)); pvlRefChangeGrp += Isis::PvlKeyword("NewLocation", LocationString(mtInterestResults[iBestMeasureIndex].mdBestSample, mtInterestResults[iBestMeasureIndex].mdBestLine)); @@ -587,25 +587,25 @@ namespace Isis { int iComment = 0; if (numMeasures == 0) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "No Measures in the Point"); } if (newPnt->IsIgnored()) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Point was originally Ignored"); } if (newPnt->GetType() == ControlPoint::Fixed) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Fixed Point"); } else if (newPnt->GetType() == ControlPoint::Constrained) { - IString sComment = "Comment"; - sComment += IString(++iComment); + QString sComment = "Comment"; + sComment += toString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Constrained Point"); } @@ -628,9 +628,9 @@ namespace Isis { } // Point loop // CnetRef Change Statistics - mStatisticsGrp += Isis::PvlKeyword("PointsModified", iPointsModified); - mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", iRefChanged); - mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", iMeasuresModified); + mStatisticsGrp += Isis::PvlKeyword("PointsModified", toString(iPointsModified)); + mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", toString(iRefChanged)); + mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", toString(iMeasuresModified)); mPvlLog += mStatisticsGrp; } @@ -650,8 +650,8 @@ namespace Isis { if (mbOverlaps) { overlapPoly = FindOverlap(pCnetPoint); if (overlapPoly == NULL) { - string msg = "Unable to find overlap polygon for point [" + - pCnetPoint.GetId() + "]"; + QString msg = "Unable to find overlap polygon for point [" + + pCnetPoint.GetId() + "]"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -666,7 +666,7 @@ namespace Isis { for (int measure = 0; measure < pCnetPoint.GetNumMeasures(); ++measure) { ControlMeasure *origMsr = pCnetPoint[measure]; - std::string sn = origMsr->GetCubeSerialNumber(); + QString sn = origMsr->GetCubeSerialNumber(); // Do not process Ignored Measures if (!origMsr->IsIgnored()) { @@ -710,7 +710,7 @@ namespace Isis { */ bool InterestOperator::InterestByMeasure(int piMeasure, ControlMeasure &pCnetMeasure, Cube &pCube) { - std::string serialNum = pCnetMeasure.GetCubeSerialNumber(); + QString serialNum = pCnetMeasure.GetCubeSerialNumber(); int iOrigSample = (int)(pCnetMeasure.GetSample() + 0.5); int iOrigLine = (int)(pCnetMeasure.GetLine() + 0.5); @@ -787,7 +787,7 @@ namespace Isis { camera = pCube.getCamera(); } catch (IException &e) { - std::string msg = "Cannot Create Camera for Image:" + mSerialNumbers.FileName(serialNum); + QString msg = "Cannot Create Camera for Image:" + mSerialNumbers.FileName(serialNum); throw IException(IException::User, msg, _FILEINFO_); } @@ -846,7 +846,7 @@ namespace Isis { measureIndex ++) { if (measureIndex == numMatches) { const ControlMeasure &controlMeasure = *pCnetPoint[measureIndex]; - IString serialNum = controlMeasure.GetCubeSerialNumber(); + QString serialNum = controlMeasure.GetCubeSerialNumber(); if (overlap->HasSerialNumber(serialNum)) { numMatches++; } @@ -881,12 +881,12 @@ namespace Isis { geos::geom::Geometry *geomIntersect1, *geomIntersect2; // Create Multipolygon for the first Control Measure - std::string sn1 = pCnetPoint[0]->GetCubeSerialNumber(); + QString sn1 = pCnetPoint[0]->GetCubeSerialNumber(); Cube *inCube1 = mCubeMgr.OpenCube(mSerialNumbers.FileName(sn1)); inCube1->read((Blob &)measPolygon1); // Create Multipolygon for the Second Control Measure - std::string sn2 = pCnetPoint[1]->GetCubeSerialNumber(); + QString sn2 = pCnetPoint[1]->GetCubeSerialNumber(); Cube *inCube2 = mCubeMgr.OpenCube(mSerialNumbers.FileName(sn2)); inCube2->read((Blob &)measPolygon2); @@ -895,7 +895,7 @@ namespace Isis { (const geos::geom::Geometry *)measPolygon2.Polys()); for (int measureIndex = 2; measureIndex < pCnetPoint.GetNumMeasures(); measureIndex ++) { - std::string sn3 = pCnetPoint[measureIndex]->GetCubeSerialNumber(); + QString sn3 = pCnetPoint[measureIndex]->GetCubeSerialNumber(); Cube *inCube3 = mCubeMgr.OpenCube(mSerialNumbers.FileName(sn3)); inCube3->read((Blob &)measPolygon3); diff --git a/isis/src/control/objs/InterestOperator/InterestOperator.h b/isis/src/control/objs/InterestOperator/InterestOperator.h index 5310dd4b37..d5a611bdfe 100644 --- a/isis/src/control/objs/InterestOperator/InterestOperator.h +++ b/isis/src/control/objs/InterestOperator/InterestOperator.h @@ -131,7 +131,7 @@ namespace Isis { void SetPatternReduction(std::vector samples, std::vector lines); //! Return name of the matching operator - inline std::string operatorName() const { + inline QString operatorName() const { return mOperatorGrp["Name"]; }; @@ -139,7 +139,7 @@ namespace Isis { bool Operate(Cube &pCube, UniversalGroundMap &pUnivGrndMap, int piSample, int piLine); //! Operate - to calculate interest for entire control net to get better reference - void Operate(ControlNet &pNewNet, std::string psSerialNumFile, std::string psOverlapListFile = ""); + void Operate(ControlNet &pNewNet, QString psSerialNumFile, QString psOverlapListFile = ""); //! Return the Interest Amount inline double InterestAmount() const { @@ -220,7 +220,7 @@ namespace Isis { //! Structure to hold Interest Results typedef struct { - std::string msSerialNum; //!< Serial Number of the Measure + QString msSerialNum; //!< Serial Number of the Measure double mdInterest; //!< Resulting interest amt from InterestOperator double mdBestSample; //!< Most interesting sample double mdBestLine; //!< Most interesting line diff --git a/isis/src/control/objs/InterestOperator/unitTest.cpp b/isis/src/control/objs/InterestOperator/unitTest.cpp index 3c39cb69c1..1ae4e87322 100644 --- a/isis/src/control/objs/InterestOperator/unitTest.cpp +++ b/isis/src/control/objs/InterestOperator/unitTest.cpp @@ -18,19 +18,19 @@ int main() { try { PvlGroup op("Operator"); op += PvlKeyword("Name", "StandardDeviation"); - op += PvlKeyword("DeltaLine", 100); - op += PvlKeyword("DeltaSamp", 100); - op += PvlKeyword("Samples", 15); - op += PvlKeyword("Lines", 15); - op += PvlKeyword("MinimumInterest", 0.01); + op += PvlKeyword("DeltaLine", toString(100)); + op += PvlKeyword("DeltaSamp", toString(100)); + op += PvlKeyword("Samples", toString(15)); + op += PvlKeyword("Lines", toString(15)); + op += PvlKeyword("MinimumInterest", toString(0.01)); PvlGroup opv("ValidMeasure"); - opv += PvlKeyword("MinDN", 0.0); - opv += PvlKeyword("MaxDN", 1.0); - opv += PvlKeyword("MinEmission", 15.0); - opv += PvlKeyword("MaxEmission", 25.0); - opv += PvlKeyword("MinIncidence", 0.0); - opv += PvlKeyword("MaxIncidence", 135.0); + opv += PvlKeyword("MinDN", toString(0.0)); + opv += PvlKeyword("MaxDN", toString(1.0)); + opv += PvlKeyword("MinEmission", toString(15.0)); + opv += PvlKeyword("MaxEmission", toString(25.0)); + opv += PvlKeyword("MinIncidence", toString(0.0)); + opv += PvlKeyword("MaxIncidence", toString(135.0)); //op += PvlKeyword("MinResolution", 100); //op += PvlKeyword("MaxResolution", 300); diff --git a/isis/src/control/objs/InterestOperatorFactory/InterestOperatorFactory.cpp b/isis/src/control/objs/InterestOperatorFactory/InterestOperatorFactory.cpp index a39a32bc38..291bd0ad8f 100644 --- a/isis/src/control/objs/InterestOperatorFactory/InterestOperatorFactory.cpp +++ b/isis/src/control/objs/InterestOperatorFactory/InterestOperatorFactory.cpp @@ -53,7 +53,7 @@ namespace Isis { InterestOperator *InterestOperatorFactory::Create(Pvl &pPvl) { // Get the algorithm name to create PvlGroup &op = pPvl.FindGroup("Operator", Pvl::Traverse); - std::string operatorName = op["Name"]; + QString operatorName = op["Name"]; // Open the factory plugin file Plugin p; diff --git a/isis/src/control/objs/InterestOperatorFactory/InterestOperatorFactory.h b/isis/src/control/objs/InterestOperatorFactory/InterestOperatorFactory.h index 9802b97a01..e97ace2f88 100644 --- a/isis/src/control/objs/InterestOperatorFactory/InterestOperatorFactory.h +++ b/isis/src/control/objs/InterestOperatorFactory/InterestOperatorFactory.h @@ -1,4 +1,4 @@ -#if !defined(InterestOperatorFactory_h) +#ifndef InterestOperatorFactory_h #define InterestOperatorFactory_h /** * @file diff --git a/isis/src/database/objs/Database/Database.cpp b/isis/src/database/objs/Database/Database.cpp index c2c15a807d..7397f3f3fa 100644 --- a/isis/src/database/objs/Database/Database.cpp +++ b/isis/src/database/objs/Database/Database.cpp @@ -34,7 +34,7 @@ using namespace std; namespace Isis { - std::string Database::_actualConnectionName = ""; + QString Database::_actualConnectionName = ""; /** * @brief Default database constructor @@ -67,7 +67,7 @@ namespace Isis { _name = _actualConnectionName; if((dbConn == Connect) && isValid()) { if(!open()) { - string mess = "Failed to open database default database [" + _name; + QString mess = "Failed to open database default database [" + _name; tossDbError(mess, _FILEINFO_); } } @@ -85,12 +85,12 @@ namespace Isis { * @param dbConn If Connect, an immediate connection is attempted, otherwise * connection is deferred. */ - Database::Database(const std::string &name, Database::Access dbConn) : + Database::Database(const QString &name, Database::Access dbConn) : QSqlDatabase(init(name)), _name(name) { _name = _actualConnectionName; if((dbConn == Connect) && isValid()) { if(!open()) { - string mess = "Failed to open database specified as " + _name; + QString mess = "Failed to open database specified as " + _name; tossDbError(mess, _FILEINFO_); } } @@ -114,7 +114,7 @@ namespace Isis { * @param driverType Type of database to created. This is typically MySQL, * PostgreSQL or SQLite. */ - Database::Database(const std::string &connName, const std::string &driverType) : + Database::Database(const QString &connName, const QString &driverType) : QSqlDatabase(init(connName, driverType)), _name(connName) { _name = _actualConnectionName; } @@ -140,7 +140,7 @@ namespace Isis { _name = _actualConnectionName; if((dbConn == Connect) && isValid()) { if(!open()) { - string mess = "Failed to open database with profile " + _name; + QString mess = "Failed to open database with profile " + _name; tossDbError(mess, _FILEINFO_); } } @@ -156,8 +156,8 @@ namespace Isis { * @param other Database to clone from this one * @param newName New name of the cloned database (it can't be the same name) */ - Database::Database(const QSqlDatabase &other, const std::string &newName) : - QSqlDatabase(QSqlDatabase::cloneDatabase(other, IString::ToQt(newName))), + Database::Database(const QSqlDatabase &other, const QString &newName) : + QSqlDatabase(QSqlDatabase::cloneDatabase(other, newName)), _name(newName) { } @@ -264,7 +264,7 @@ namespace Isis { * * @param name Name of database to remove (and destroy) */ - void Database::remove(const std::string &name) { + void Database::remove(const QString &name) { DatabaseFactory *factory = DatabaseFactory::getInstance(); factory->destroy(name); return; @@ -285,7 +285,7 @@ namespace Isis { * @return bool True if successful, false if the file could not be opened or an * error was found in the file. */ - bool Database::addAccessConfig(const std::string &confFile) { + bool Database::addAccessConfig(const QString &confFile) { DatabaseFactory *factory = DatabaseFactory::getInstance(); return (factory->addAccessProfile(confFile)); } @@ -322,7 +322,7 @@ namespace Isis { * @return DbProfile Requested profile. Test its validity using the * DbProfile::isValid() method. */ - DbProfile Database::getProfile(const std::string &name) { + DbProfile Database::getProfile(const QString &name) { DatabaseFactory *factory = DatabaseFactory::getInstance(); return (factory->getProfile(name)); } @@ -353,8 +353,8 @@ namespace Isis { * * @return QSqlDatabase The created database */ - QSqlDatabase Database::init(const std::string &connName, - const std::string &driverType) { + QSqlDatabase Database::init(const QString &connName, + const QString &driverType) { _actualConnectionName = connName; DatabaseFactory *factory = DatabaseFactory::getInstance(); @@ -362,7 +362,7 @@ namespace Isis { // First test for condition where both name and type are not provided. // This tests for the default profile and returns it if it exists, // otherwise it returns a default database. - if(connName.empty() && driverType.empty()) { + if(connName.isEmpty() && driverType.isEmpty()) { if(factory->isAvailable(factory->getDefault())) { _actualConnectionName = factory->getDefault(); return (factory->create(_actualConnectionName)); @@ -376,7 +376,7 @@ namespace Isis { } // If only the name and no driver is provided, get an existing connection - if((!connName.empty()) && (driverType.empty())) { + if((!connName.isEmpty()) && (driverType.isEmpty())) { if(factory->isAvailable(connName)) { _actualConnectionName = connName; return (factory->create(connName)); @@ -435,7 +435,7 @@ namespace Isis { // Go ahead and connect if requested if(dbConn == Connect) { if(!db.open()) { - string mess = "Failed to connect to database using profile " + + QString mess = "Failed to connect to database using profile " + profile("Name"); tossDbError(mess, _FILEINFO_); } @@ -443,11 +443,11 @@ namespace Isis { return (db); } catch(IException &ie) { - string mess = "Unable to create database from " + profile.Name(); + QString mess = "Unable to create database from " + profile.Name(); throw IException(ie, IException::User, mess, _FILEINFO_); } catch(...) { - string mess = "Unknown exception while creating database from profile " + QString mess = "Unknown exception while creating database from profile " + profile.Name(); throw IException(IException::User, mess, _FILEINFO_); } @@ -467,34 +467,34 @@ namespace Isis { */ void Database::configureAccess(QSqlDatabase &db, const DbProfile &profile) { if(profile.exists("Host")) { - db.setHostName(IString::ToQt(profile("Host"))); + db.setHostName(profile("Host")); } if(profile.exists("DbName")) { - db.setDatabaseName(IString::ToQt(profile("DbName"))); + db.setDatabaseName(profile("DbName")); } if(profile.exists("User")) { - db.setUserName(IString::ToQt(profile("User"))); + db.setUserName(profile("User")); } if(profile.exists("Password")) { - db.setPassword(IString::ToQt(profile("Password"))); + db.setPassword(profile("Password")); } if(profile.exists("Port")) { bool ok; - db.setPort(IString::ToQt(profile("Port")).toInt(&ok)); + db.setPort(profile("Port").toInt(&ok)); if(!ok) { ostringstream mess; mess << "Invalid port number [" << profile("Port") << "] in profile " << profile("Name") << ends; - throw IException(IException::User, mess.str(), _FILEINFO_); + throw IException(IException::User, mess.str().c_str(), _FILEINFO_); } } if(profile.exists("Options")) { - db.setConnectOptions(IString::ToQt(profile("Options"))); + db.setConnectOptions(profile("Options")); } return; } @@ -509,7 +509,7 @@ namespace Isis { * * @return The cloned Database */ - Database Database::clone(const std::string &name) const { + Database Database::clone(const QString &name) const { return (Database(*this, name)); } @@ -519,10 +519,10 @@ namespace Isis { * This method returns a complete list of accessable tables within the database. * It is assumed the database connections is established and open. * - * @return std::vector List of tables in the database + * @return std::vector List of tables in the database */ - std::vector Database::getTables() const { - return (IString::ToStd(tables(QSql::Tables))); + QStringList Database::getTables() const { + return (tables(QSql::Tables)); } /** @@ -531,11 +531,11 @@ namespace Isis { * This method returns a vector of strings with all views accessable to the user * in each element in the vector. * - * @return std::vector List of all accessable views in the + * @return std::vector List of all accessable views in the * database */ - std::vector Database::getViews() const { - return (IString::ToStd(tables(QSql::Views))); + QStringList Database::getViews() const { + return (tables(QSql::Views)); } /** @@ -544,10 +544,10 @@ namespace Isis { * This method returns a vector of strings containing a list of all system * tables accessable to the user within the database. * - * @return std::vector List of system tables with the database + * @return std::vector List of system tables with the database */ - std::vector Database::getSystemTables() const { - return (IString::ToStd(tables(QSql::SystemTables))); + QStringList Database::getSystemTables() const { + return (tables(QSql::SystemTables)); } /** @@ -560,9 +560,9 @@ namespace Isis { * @param f Name of method initiating the exception * @param l Line number the error occured */ - void Database::tossDbError(const std::string &message, const char *f, int l) const { - string errmess = message + " - DatabaseError = " + - IString::ToStd(lastError().text()); + void Database::tossDbError(const QString &message, const char *f, int l) const { + QString errmess = message + " - DatabaseError = " + + lastError().text(); throw IException(IException::Programmer, errmess, f, l); } diff --git a/isis/src/database/objs/Database/Database.h b/isis/src/database/objs/Database/Database.h index 0babdfc590..25ce4bf3d9 100644 --- a/isis/src/database/objs/Database/Database.h +++ b/isis/src/database/objs/Database/Database.h @@ -1,4 +1,4 @@ -#if !defined(Database_h) +#ifndef Database_h #define Database_h /** * @file @@ -76,7 +76,7 @@ namespace Isis { * * @internal * @history 2007-06-05 Brendan George - Modified to work with - * IString/StringTools merge + * QString/StringTools merge * @history 2008-10-30 Steven Lambright - tossDbError now accepts a const * char* for a filename, issue pointed out by "novus0x2a" (Support * Board Member) @@ -91,47 +91,47 @@ namespace Isis { Database(); Database(Access dbConn); - Database(const std::string &connName, const std::string &driverType); - Database(const std::string &name, Access dbConn = Connect); + Database(const QString &connName, const QString &driverType); + Database(const QString &name, Access dbConn = Connect); Database(const DbProfile &profile, Access dbConn = Connect); virtual ~Database(); /** * @brief Return the name of this database as specifed upon creation * - * @return std::string The name of this database + * @return QString The name of this database */ - std::string Name() const { + QString Name() const { return (_name); } void makePersistant(); bool isPersistant() const; void setAsDefault(); - Database clone(const std::string &name) const; - std::vector getTables() const; - std::vector getViews() const; - std::vector getSystemTables() const; + Database clone(const QString &name) const; + QStringList getTables() const; + QStringList getViews() const; + QStringList getSystemTables() const; - static void remove(const std::string &name); + static void remove(const QString &name); - static bool addAccessConfig(const std::string &confFile); - static DbProfile getProfile(const std::string &name); + static bool addAccessConfig(const QString &confFile); + static DbProfile getProfile(const QString &name); protected: - Database(const QSqlDatabase &other, const std::string &name); + Database(const QSqlDatabase &other, const QString &name); QSqlDatabase init(const DbProfile &profile, Access dbConn = Connect); - QSqlDatabase init(const std::string &name = "", - const std::string &driverType = ""); + QSqlDatabase init(const QString &name = "", + const QString &driverType = ""); void configureAccess(QSqlDatabase &db, const DbProfile &profile); private: - static std::string _actualConnectionName; /** Needed due to peculiar + static QString _actualConnectionName; /** Needed due to peculiar * issues with Database * construction techniques */ - std::string _name; //!< Name of the connection + QString _name; //!< Name of the connection - void tossDbError(const std::string &message, const char *f, int l) const; + void tossDbError(const QString &message, const char *f, int l) const; }; } diff --git a/isis/src/database/objs/Database/unitTest.cpp b/isis/src/database/objs/Database/unitTest.cpp index a55464ba0a..25e3e9a021 100644 --- a/isis/src/database/objs/Database/unitTest.cpp +++ b/isis/src/database/objs/Database/unitTest.cpp @@ -7,16 +7,16 @@ using namespace std; using namespace Isis; -void print(vector in); +void print(QStringList in); int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); // SQLite database is in memory - std::string dbname(":memory:"); + QString dbname(":memory:"); Database testdb("unittestdb", "SQLite"); - testdb.setDatabaseName(dbname.c_str()); + testdb.setDatabaseName(dbname); if(!testdb.open()) { throw IException(IException::User, "Connection failed", _FILEINFO_); } @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) { } // Print contents of a vector to console -void print(vector in) { +void print(QStringList in) { cout << "["; for(int i = 0; i < (int)in.size(); i++) { cout << " " << in[i] << " "; diff --git a/isis/src/database/objs/DatabaseFactory/DatabaseFactory.cpp b/isis/src/database/objs/DatabaseFactory/DatabaseFactory.cpp index b6bc9a33d2..4a3feffee3 100644 --- a/isis/src/database/objs/DatabaseFactory/DatabaseFactory.cpp +++ b/isis/src/database/objs/DatabaseFactory/DatabaseFactory.cpp @@ -159,7 +159,7 @@ namespace Isis { * * @return bool True if the new profile is successfully added, false otherwise. */ - bool DatabaseFactory::addAccessProfile(const std::string &profileFile) { + bool DatabaseFactory::addAccessProfile(const QString &profileFile) { try { FileName dbconf(profileFile); if(dbconf.fileExists()) { @@ -212,12 +212,12 @@ namespace Isis { * This method will return a list of the names of all currently available * database access profiles as a vector of strings. * - * @return std::vector List of available profile names + * @return std::vector List of available profile names */ - std::vector DatabaseFactory::getProfileList() const { - std::vector plist; + std::vector DatabaseFactory::getProfileList() const { + std::vector plist; for(int i = 0 ; i < _profiles.size() ; i++) { - plist.push_back(_profiles.key(i)); + plist.push_back(_profiles.key(i).ToQt()); } return (plist); } @@ -242,9 +242,9 @@ namespace Isis { * @return DbProfile An database access profile resulting from the request. * @see initPreferences(). */ - DbProfile DatabaseFactory::getProfile(const std::string &name) const { - string profName(name); - if(profName.empty()) profName = _defProfName; + DbProfile DatabaseFactory::getProfile(const QString &name) const { + QString profName(name); + if(profName.isEmpty()) profName = _defProfName; // Refer to user access if provided if(!_profiles.exists(profName)) { @@ -265,13 +265,13 @@ namespace Isis { * drivers such as MySQL and PostgreSQL, and named database connections such as * UPC. The list includes all currently availble database resources. * - * @return std::vector List of database drivers + * @return std::vector List of database drivers */ - std::vector DatabaseFactory::available() const { + std::vector DatabaseFactory::available() const { Drivers drivers = getResourceList(true, true); - std::vector dblist; + std::vector dblist; for(int i = 0 ; i < drivers.size() ; i++) { - dblist.push_back(drivers.key(i)); + dblist.push_back(drivers.key(i).ToQt()); } return (dblist); } @@ -286,12 +286,12 @@ namespace Isis { * * @return bool True if the specifed driver exists, otherwise false */ - bool DatabaseFactory::isDriverAvailable(const std::string &dbname) const { + bool DatabaseFactory::isDriverAvailable(const QString &dbname) const { Drivers drivers = getResourceList(true, false); if(!drivers.exists(dbname)) { return (false); } - return (QSqlDatabase::isDriverAvailable(IString::ToQt(drivers.get(dbname)))); + return (QSqlDatabase::isDriverAvailable(drivers.get(dbname))); } /** @@ -304,10 +304,10 @@ namespace Isis { * * @return bool True if the connection exists, otherwise false */ - bool DatabaseFactory::isAvailable(const std::string &dbname) const { + bool DatabaseFactory::isAvailable(const QString &dbname) const { Drivers dbdrivers = getResourceList(false, true); - string name(dbname); - if(name.empty()) { + QString name(dbname); + if(name.isEmpty()) { name = _defDatabase; } return (dbdrivers.exists(name)); @@ -322,12 +322,12 @@ namespace Isis { * * @return bool True if it exists in the pool, otherwise false */ - bool DatabaseFactory::isConnected(const std::string &dbname) const { - string name(dbname); - if(name.empty()) { + bool DatabaseFactory::isConnected(const QString &dbname) const { + QString name(dbname); + if(name.isEmpty()) { name = _defDatabase; } - return (QSqlDatabase::contains(IString::ToQt(name))); + return (QSqlDatabase::contains(name)); } /** @@ -342,7 +342,7 @@ namespace Isis { * * @return bool True if the database is persistant, otherwise false */ - bool DatabaseFactory::isPersistant(const std::string &dbname) const { + bool DatabaseFactory::isPersistant(const QString &dbname) const { return (_dbList.exists(dbname)); } @@ -365,19 +365,18 @@ namespace Isis { * @return QSqlDatabase A named Qt database object created with the specifed * driver */ - QSqlDatabase DatabaseFactory::create(const std::string &driver, - const std::string &dbname) { + QSqlDatabase DatabaseFactory::create(const QString &driver, + const QString &dbname) { // Check driver availability if(!isDriverAvailable(driver)) { - string mess = "Driver [" + driver + "] for database [" + dbname - + "] does not exist"; + QString mess = "Driver [" + driver + "] for database [" + dbname + + "] does not exist"; throw IException(IException::Unknown, mess, _FILEINFO_); } // Create the database with the specified driver and name Drivers drivers = getResourceList(true, false); - return (QSqlDatabase::addDatabase(IString::ToQt(drivers.get(driver)), - IString::ToQt(dbname))); + return (QSqlDatabase::addDatabase(drivers.get(driver), dbname)); } /** @@ -391,7 +390,7 @@ namespace Isis { * * @return QSqlDatabase A Database object */ - QSqlDatabase DatabaseFactory::create(const std::string &dbname) { + QSqlDatabase DatabaseFactory::create(const QString &dbname) { // Return an existing connection if(_dbList.exists(dbname)) { @@ -399,7 +398,7 @@ namespace Isis { } // One doesn't exist, throw an error - string mess = "Database [" + dbname + "] does not exist"; + QString mess = "Database [" + dbname + "] does not exist"; throw IException(IException::Unknown, mess, _FILEINFO_); } @@ -421,7 +420,7 @@ namespace Isis { * @param name Name to associate with the object * @param setAsDefault True if this is to become the default connection */ - void DatabaseFactory::add(const QSqlDatabase &db, const std::string &name, + void DatabaseFactory::add(const QSqlDatabase &db, const QString &name, bool setAsDefault) { _dbList.add(name, db); if(setAsDefault) { @@ -441,9 +440,9 @@ namespace Isis { * * @param name Name of the database to remove */ - void DatabaseFactory::destroy(const std::string &name) { + void DatabaseFactory::destroy(const QString &name) { remove(name); - QSqlDatabase::removeDatabase(IString::ToQt(name)); + QSqlDatabase::removeDatabase(name); return; } @@ -456,7 +455,7 @@ namespace Isis { * * @param name Name of database to remove from the connection pool */ - void DatabaseFactory::remove(const std::string &name) { + void DatabaseFactory::remove(const QString &name) { _dbList.remove(name); #if 0 if(IString::Equal(name, _defDatabase)) { @@ -501,7 +500,7 @@ namespace Isis { } // Get default profile name for later use if(dbgroup.HasKeyword("DefaultProfile")) - _defProfName = (string) dbgroup["DefaultProfile"]; + _defProfName = (QString) dbgroup["DefaultProfile"]; } return; } @@ -530,7 +529,7 @@ namespace Isis { if(connections) dblist += QSqlDatabase::connectionNames(); Drivers dbDrivers; for(int i = 0 ; i < dblist.size() ; i++) { - string dbname(IString::ToStd(dblist.at(i))); + QString dbname(dblist.at(i)); dbDrivers.add(dbname, dbname); } diff --git a/isis/src/database/objs/DatabaseFactory/DatabaseFactory.h b/isis/src/database/objs/DatabaseFactory/DatabaseFactory.h index 050ada63ee..565bac5163 100644 --- a/isis/src/database/objs/DatabaseFactory/DatabaseFactory.h +++ b/isis/src/database/objs/DatabaseFactory/DatabaseFactory.h @@ -1,4 +1,4 @@ -#if !defined(DatabaseFactory_h) +#ifndef DatabaseFactory_h #define DatabaseFactory_h /** * @file @@ -250,7 +250,7 @@ namespace Isis { * * @internal * @history 2007-06-05 Brendan George - Modified to work with - * IString/StringTools merge + * QString/StringTools merge * @history 2009-11-27 Kris Becker - Made argc parameter for * QCoreApplication so persistence of the parameter * is preserve as required for Qt. @@ -269,7 +269,7 @@ namespace Isis { * * @param name Name of the default database */ - void setDefault(const std::string &name) { + void setDefault(const QString &name) { _defDatabase = name; } @@ -280,16 +280,16 @@ namespace Isis { * call to the create method is attempted without a name, this is the one * used to return an instance of database. * - * @return std::string Name of default database + * @return QString Name of default database */ - std::string getDefault() const { + QString getDefault() const { return (_defDatabase); } - bool addAccessProfile(const std::string &profileFile); + bool addAccessProfile(const QString &profileFile); void addProfile(const DbProfile &profile); - std::vector getProfileList() const; - DbProfile getProfile(const std::string &name = "") const; + std::vector getProfileList() const; + DbProfile getProfile(const QString &name = "") const; /** * @brief Returns the name of the default profile @@ -298,9 +298,9 @@ namespace Isis { * name of the default profile. If none are loaded, an empty string is * returned. * - * @return std::string Name of default profile, empty if undetermined + * @return QString Name of default profile, empty if undetermined */ - std::string getDefaultProfileName() const { + QString getDefaultProfileName() const { return (_defProfName); } @@ -315,23 +315,23 @@ namespace Isis { * * @return bool True if it named profile exists, false otherwise */ - bool setDefaultProfileName(const std::string &name) { + bool setDefaultProfileName(const QString &name) { _defProfName = name; return (_profiles.exists(name)); } - std::vector available() const; - bool isDriverAvailable(const std::string &driver) const; - bool isAvailable(const std::string &dbname = "") const; - bool isConnected(const std::string &dbname) const; - bool isPersistant(const std::string &name) const; + std::vector available() const; + bool isDriverAvailable(const QString &driver) const; + bool isAvailable(const QString &dbname = "") const; + bool isConnected(const QString &dbname) const; + bool isPersistant(const QString &name) const; - QSqlDatabase create(const std::string &driver, const std::string &dbname); - QSqlDatabase create(const std::string &name); - void add(const QSqlDatabase &db, const std::string &name, + QSqlDatabase create(const QString &driver, const QString &dbname); + QSqlDatabase create(const QString &name); + void add(const QSqlDatabase &db, const QString &name, bool setAsDefault = false); - void remove(const std::string &dbname); - void destroy(const std::string &dbname); + void remove(const QString &dbname); + void destroy(const QString &dbname); private: // Gain access through Singleton interface @@ -343,15 +343,15 @@ namespace Isis { static DatabaseFactory *_factory; //!< Pointer to self (singleton) /** Define list of drivers and/or databases */ - typedef CollectorMap Drivers; + typedef CollectorMap Drivers; /** Define list of Profiles */ - typedef CollectorMap Profiles; + typedef CollectorMap Profiles; /** Define active database maintainer */ - typedef CollectorMap Databases; + typedef CollectorMap Databases; - std::string _defProfName; //!< Default profile name + QString _defProfName; //!< Default profile name Profiles _profiles; //!< Maintain list of profiles - std::string _defDatabase; //!< Name of default database + QString _defDatabase; //!< Name of default database Databases _dbList; //!< Maintains active databases void init(); diff --git a/isis/src/database/objs/DatabaseFactory/unitTest.cpp b/isis/src/database/objs/DatabaseFactory/unitTest.cpp index 107911e9e9..2ad32d80eb 100644 --- a/isis/src/database/objs/DatabaseFactory/unitTest.cpp +++ b/isis/src/database/objs/DatabaseFactory/unitTest.cpp @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) { cout << "Adding a couple profiles..." << endl; df->addProfile(p1); df->addProfile(p2); - vector strings = df->getProfileList(); + vector strings = df->getProfileList(); /* Removed to keep from having to change truth data every install. * Added specific checks below for databases we care about. for(int i = 0; i < (int)strings.size(); i++) { @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) { cout << df->setDefaultProfileName("default name") << endl; cout << "Default profile name: " << df->getDefaultProfileName() << endl; - vector available = df->available(); + vector available = df->available(); cout << "Driver available [doesntexist]: " << df->isDriverAvailable("doesntexist") << endl; cout << "Driver available [mysql]: " << df->isDriverAvailable("mysql") << endl; cout << "Driver available [postgresql]: " << df->isDriverAvailable("postgresql") << endl; diff --git a/isis/src/database/objs/DbAccess/DbAccess.cpp b/isis/src/database/objs/DbAccess/DbAccess.cpp index 42df4723f9..56240f801b 100644 --- a/isis/src/database/objs/DbAccess/DbAccess.cpp +++ b/isis/src/database/objs/DbAccess/DbAccess.cpp @@ -25,7 +25,6 @@ #include #include -using std::string; using std::ostringstream; #include "DbAccess.h" @@ -58,8 +57,8 @@ namespace Isis { * specifications for a database * @param defProfileName Optional name of the default access profile */ - DbAccess::DbAccess(const std::string &dbaccFile, - const std::string &defProfileName) : DbProfile("Database"), + DbAccess::DbAccess(const QString &dbaccFile, + const QString &defProfileName) : DbProfile("Database"), _defProfileName(defProfileName), _profiles() { load(dbaccFile); } @@ -74,7 +73,7 @@ namespace Isis { * @param pvl A Database PvlObject containing access information * @param defProfileName Optional name of the default profile */ - DbAccess::DbAccess(PvlObject &pvl, const std::string &defProfileName) : + DbAccess::DbAccess(PvlObject &pvl, const QString &defProfileName) : DbProfile("Database"), _defProfileName(defProfileName), _profiles() { load(pvl); @@ -104,9 +103,9 @@ namespace Isis { * validatity of the profile returned as this is the only indication of * success. */ - const DbProfile DbAccess::getProfile(const std::string &name) const { - string defName(name); - if(defName.empty()) { + const DbProfile DbAccess::getProfile(const QString &name) const { + QString defName(name); + if(defName.isEmpty()) { defName = getDefaultProfileName(); } else { @@ -154,7 +153,7 @@ namespace Isis { * * @param filename Name of Pvl file to open. */ - void DbAccess::load(const std::string &filename) { + void DbAccess::load(const QString &filename) { Pvl pvl(filename); PvlObject db = pvl.FindObject("Database"); load(db); @@ -198,17 +197,17 @@ namespace Isis { * default specified in the configuration Database object, the \b DefaultProfile * keyword, or provided by the application progirammer in the constructor. * - * @return std::string Name of default profile it it can be determined + * @return QString Name of default profile it it can be determined * otherwise an empty string is returned. */ - std::string DbAccess::getDefaultProfileName() const { - if(!_defProfileName.empty()) { + QString DbAccess::getDefaultProfileName() const { + if(!_defProfileName.isEmpty()) { return (_defProfileName); } else if(exists("DefaultProfile")) { return (value("DefaultProfile")); } - return (string("")); + return (""); } diff --git a/isis/src/database/objs/DbAccess/DbAccess.h b/isis/src/database/objs/DbAccess/DbAccess.h index 4fb7fbc4d7..94ef6ac966 100644 --- a/isis/src/database/objs/DbAccess/DbAccess.h +++ b/isis/src/database/objs/DbAccess/DbAccess.h @@ -1,4 +1,4 @@ -#if !defined(DbAccess_h) +#ifndef DbAccess_h #define DbAccess_h /** * @file @@ -115,20 +115,20 @@ namespace Isis { * * @internal * @history 2007-06-05 Brendan George - Modified to work with - * IString/StringTool merge + * QString/StringTool merge */ class DbAccess : public DbProfile { private: /** Define the container for the DbAccess key word list */ - typedef CollectorMap + typedef CollectorMap ProfileList; public: // Constructors and Destructor DbAccess() : DbProfile("Database"), _defProfileName(""), _profiles() { } - DbAccess(const std::string &dbaccFile, - const std::string &defProfileName = ""); - DbAccess(PvlObject &pvl, const std::string &defProfileName = ""); + DbAccess(const QString &dbaccFile, + const QString &defProfileName = ""); + DbAccess(PvlObject &pvl, const QString &defProfileName = ""); /** Destructor ensures everything is cleaned up properly */ virtual ~DbAccess() { } @@ -149,11 +149,11 @@ namespace Isis { * * @return bool True if the profile exists, false otherwise */ - bool profileExists(const std::string &profile) const { + bool profileExists(const QString &profile) const { return (_profiles.exists(profile)); } - const DbProfile getProfile(const std::string &name = "") const; + const DbProfile getProfile(const QString &name = "") const; const DbProfile getProfile(int nth) const; @@ -170,13 +170,13 @@ namespace Isis { _profiles.add(profile.Name(), profile); } - void load(const std::string &filename); + void load(const QString &filename); void load(PvlObject &pvl); - std::string getDefaultProfileName() const; + QString getDefaultProfileName() const; private: - std::string _defProfileName; //!< Name of default profile + QString _defProfileName; //!< Name of default profile ProfileList _profiles; //!< List of profiles }; diff --git a/isis/src/database/objs/DbProfile/DbProfile.cpp b/isis/src/database/objs/DbProfile/DbProfile.cpp index d36e785702..5ac851261e 100644 --- a/isis/src/database/objs/DbProfile/DbProfile.cpp +++ b/isis/src/database/objs/DbProfile/DbProfile.cpp @@ -25,7 +25,6 @@ #include #include -using std::string; using std::ostringstream; #include "DbProfile.h" @@ -73,13 +72,13 @@ namespace Isis { * @param prof2 Second profile to merge */ DbProfile::DbProfile(const DbProfile &prof1, const DbProfile &prof2, - const std::string &name) : _name(prof1.Name()), + const QString &name) : _name(prof1.Name()), _keys(prof1._keys) { for(int nk = 0 ; nk < prof2._keys.size() ; nk++) { _keys.add(prof2._keys.key(nk), prof2._keys.getNth(nk)); } - if(!name.empty()) { + if(!name.isEmpty()) { _name = name; } } @@ -94,7 +93,7 @@ namespace Isis { * @param key Keyword to add or ammend * @param value Value to add to the keyword */ - void DbProfile::add(const std::string &key, const std::string &value) { + void DbProfile::add(const QString &key, const QString &value) { if(_keys.exists(key)) { _keys.get(key).AddValue(value); } @@ -115,7 +114,7 @@ namespace Isis { * @param key Keyword to replace * @param value Value to add to the keyword */ - void DbProfile::replace(const std::string &key, const std::string &value) { + void DbProfile::replace(const QString &key, const QString &value) { _keys.add(key, PvlKeyword(key, value)); } @@ -125,7 +124,7 @@ namespace Isis { * * @param key Keyword to remove */ - void DbProfile::remove(const std::string &key) { + void DbProfile::remove(const QString &key) { _keys.remove(key); } @@ -139,7 +138,7 @@ namespace Isis { * * @return int Number values in key, or 0 if the key does not exist */ - int DbProfile::count(const std::string &key) const { + int DbProfile::count(const QString &key) const { if(_keys.exists(key)) { return (_keys.get(key).Size()); } @@ -156,9 +155,9 @@ namespace Isis { * * @param nth Specifies the nth value in the keyword * - * @return std::string The requested value in the keyword + * @return QString The requested value in the keyword */ - std::string DbProfile::value(const std::string &key, int nth) const { + QString DbProfile::value(const QString &key, int nth) const { try { return (_keys.get(key)[nth]); } @@ -182,9 +181,9 @@ namespace Isis { * * @param nth Specifies the nth value in the keyword * - * @return std::string The requested value in the keyword + * @return QString The requested value in the keyword */ - std::string DbProfile::operator()(const std::string &key, int nth) const { + QString DbProfile::operator()(const QString &key, int nth) const { return (value(key, nth)); } diff --git a/isis/src/database/objs/DbProfile/DbProfile.h b/isis/src/database/objs/DbProfile/DbProfile.h index a79242c86d..2fa5807f74 100644 --- a/isis/src/database/objs/DbProfile/DbProfile.h +++ b/isis/src/database/objs/DbProfile/DbProfile.h @@ -1,4 +1,4 @@ -#if !defined(DbProfile_h) +#ifndef DbProfile_h #define DbProfile_h /** * @file @@ -66,14 +66,14 @@ namespace Isis { protected: /* Container for multi-valued keywords in profiles */ - typedef CollectorMap KeyList; + typedef CollectorMap KeyList; public: // Constructors and Destructor DbProfile() : _name("Profile"), _keys() { } - DbProfile(const std::string &name) : _name(name), _keys() { } + DbProfile(const QString &name) : _name(name), _keys() { } DbProfile(const DbProfile &prof1, const DbProfile &prof2, - const std::string &name = ""); + const QString &name = ""); DbProfile(PvlContainer &pvl); @@ -104,18 +104,18 @@ namespace Isis { /** * Set the name of this profile * - * @param name IString used to set the name of this profile + * @param name QString used to set the name of this profile */ - void setName(const std::string &name) { + void setName(const QString &name) { _name = name; } /** * @brief Returns the name of this property * - * @return std::string Name of this property + * @return QString Name of this property */ - std::string Name() const { + QString Name() const { return (_name); } @@ -126,15 +126,15 @@ namespace Isis { * * @return bool True if it exists, false if it doesn't */ - bool exists(const std::string &key) const { + bool exists(const QString &key) const { return (_keys.exists(key)); } // Convenience methods for adding keys - void add(const std::string &key, const std::string &value = ""); - void replace(const std::string &key, const std::string &value = ""); - void remove(const std::string &key); - int count(const std::string &key) const; + void add(const QString &key, const QString &value = ""); + void replace(const QString &key, const QString &value = ""); + void remove(const QString &key); + int count(const QString &key) const; /** * Returns the nth key in the profile @@ -148,15 +148,15 @@ namespace Isis { * * @param nth Specifies the nth key in the profile * - * @return std::string Name of nth keyword in the profile. + * @return QString Name of nth keyword in the profile. * * @throws Out-of-range exception if the nth keyword does not exist */ - std::string key(int nth) const { - return (_keys.key(nth)); + QString key(int nth) const { + return (_keys.key(nth).ToQt()); } - std::string value(const std::string &key, int nth = 0) const; - std::string operator()(const std::string &key, int nth = 0) const; + QString value(const QString &key, int nth = 0) const; + QString operator()(const QString &key, int nth = 0) const; protected: void loadkeys(PvlContainer &pvl); @@ -175,7 +175,7 @@ namespace Isis { } private: - std::string _name; //!< Name of this profile + QString _name; //!< Name of this profile KeyList _keys; //!< List of keys in profile }; } diff --git a/isis/src/database/objs/SqlQuery/SqlQuery.cpp b/isis/src/database/objs/SqlQuery/SqlQuery.cpp index 9b44fa6f5e..e14e4dc025 100644 --- a/isis/src/database/objs/SqlQuery/SqlQuery.cpp +++ b/isis/src/database/objs/SqlQuery/SqlQuery.cpp @@ -229,7 +229,7 @@ namespace Isis { std::vector types; SqlRecord rec = getRecord(); for(int i = 0 ; i < rec.count() ; i++) { - types.push_back(rec.getType(i)); + types.push_back(rec.getType(i).toAscii().data()); } return (types); } diff --git a/isis/src/database/objs/SqlQuery/SqlQuery.h b/isis/src/database/objs/SqlQuery/SqlQuery.h index 002a1fc46f..75a313be25 100644 --- a/isis/src/database/objs/SqlQuery/SqlQuery.h +++ b/isis/src/database/objs/SqlQuery/SqlQuery.h @@ -1,4 +1,4 @@ -#if !defined(SqlQuery_h) +#ifndef SqlQuery_h #define SqlQuery_h /** * @file @@ -92,7 +92,7 @@ namespace Isis { * finder.setThrowOnFailure(); * string pntDist = "distance(giscpt,UPCPoint(%longitude,%latitude))"; * string pntQuery = "SELECT pointid, latitude, longitude, radius FROM " - * + pntTable + " WHERE (%distance <= " + IString(maxDist) + + * + pntTable + " WHERE (%distance <= " + QString(maxDist) + * ")"; * * Progress progress; @@ -102,15 +102,15 @@ namespace Isis { * CSVReader::CSVAxis pntR = pnts.getRow(row); * * // Convert longitude to proper system if requested - * double longitude = IString(pntR[1]).ToDouble(); + * double longitude = QString(pntR[1]).ToDouble(); * if ((make360) && (longitude < 0.0)) { longitude += 360.0; } - * double latitude = IString(pntR[0]).ToDouble(); - * double radius = IString(pntR[2]).ToDouble(); + * double latitude = QString(pntR[0]).ToDouble(); + * double radius = QString(pntR[2]).ToDouble(); * * // Prepare the query, converting the longitude - * string dcheck(IString::Replace(pntDist, "%longitude", - * IString(longitude))); dcheck = IString::Replace(dcheck, "%latitude", - * IString(latitude)); string query = IString::Replace(pntQuery, "%distance", + * string dcheck(QString::Replace(pntDist, "%longitude", + * QString(longitude))); dcheck = QString::Replace(dcheck, "%latitude", + * QString(latitude)); string query = QString::Replace(pntQuery, "%distance", * dcheck); * * finder.exec(query); @@ -120,10 +120,10 @@ namespace Isis { * while (finder.next()) { * SqlRecord record = finder.getRecord(); * OutPoint point; - * point.latitude = IString(record.getValue("latitude")).ToDouble(), - * point.longitude = IString(record.getValue("longitude")).ToDouble(), - * point.radius = IString(record.getValue("radius")).ToDouble(), - * point.pointid = IString(record.getValue("pointid")), + * point.latitude = QString(record.getValue("latitude")).ToDouble(), + * point.longitude = QString(record.getValue("longitude")).ToDouble(), + * point.radius = QString(record.getValue("radius")).ToDouble(), + * point.pointid = QString(record.getValue("pointid")), * stats.AddData(&point.radius, 1); * pointList.push_back(point); * } @@ -133,7 +133,7 @@ namespace Isis { * * @endcode * - * @see IString + * @see QString * * @ingroup Database * @@ -144,7 +144,7 @@ namespace Isis { * to first try lastQuery(), then * executedQuery(). * @history 2007-06-05 Brendan George - Modified to work with - * IString/StringTools merge + * QString/StringTools merge * @history 2008-10-30 Steven Lambright - tossQueryError now accepts a const * char* for a filename, issue pointed out by "novus0x2a" (Support * Board Member) diff --git a/isis/src/database/objs/SqlRecord/SqlRecord.cpp b/isis/src/database/objs/SqlRecord/SqlRecord.cpp index 2b90ef8598..9a9501cd2c 100644 --- a/isis/src/database/objs/SqlRecord/SqlRecord.cpp +++ b/isis/src/database/objs/SqlRecord/SqlRecord.cpp @@ -24,9 +24,9 @@ #include #include +#include "IString.h" #include "SqlRecord.h" #include "SqlQuery.h" -#include "IString.h" #include #include @@ -64,8 +64,8 @@ namespace Isis { * * @return bool True if the field/column exists, false otherwise. */ - bool SqlRecord::hasField(const std::string &name) const { - return (contains(IString::ToQt(name))); + bool SqlRecord::hasField(const QString &name) const { + return (contains(name)); } /** @@ -76,10 +76,10 @@ namespace Isis { * * @param index Index of the desired column name to return. * - * @return std::string Name of the column at the requested index + * @return QString Name of the column at the requested index */ - std::string SqlRecord::getFieldName(int index) const { - return (IString::ToStd(fieldName(index))); + QString SqlRecord::getFieldName(int index) const { + return (fieldName(index)); } /** @@ -91,8 +91,8 @@ namespace Isis { * * @return int Index of the named column */ - int SqlRecord::getFieldIndex(const std::string &name) const { - return(indexOf(IString::ToQt(name))); + int SqlRecord::getFieldIndex(const QString &name) const { + return(indexOf(name)); } /** @@ -113,10 +113,10 @@ namespace Isis { * * @param name Field/column name to determine type for * - * @return std::string Type of the field/column + * @return QString Type of the field/column */ - std::string SqlRecord::getType(const std::string &name) const { - QVariant ftype(field(IString::ToQt(name)).type()); + QString SqlRecord::getType(const QString &name) const { + QVariant ftype(field(name).type()); return (QtTypeField(ftype.typeName())); } @@ -134,13 +134,13 @@ namespace Isis { * The \b double type is returned as is, \b double. * * @see QtTypeField(). - * @see getType(const std::string &name). + * @see getType(const QString &name). * * @param index Index of the desired field/column to return type for. * - * @return std::string Type of the field/column at given index. + * @return QString Type of the field/column at given index. */ - std::string SqlRecord::getType(int index) const { + QString SqlRecord::getType(int index) const { QVariant ftype(field(index).type()); return (QtTypeField(ftype.typeName())); } @@ -152,8 +152,8 @@ namespace Isis { * * @return bool True if NULL, otherwise false. */ - bool SqlRecord::isNull(const std::string &name) const { - return (field(IString::ToQt(name)).isNull()); + bool SqlRecord::isNull(const QString &name) const { + return (field(name).isNull()); } /** @@ -164,10 +164,10 @@ namespace Isis { * * @param index Index of field/column get value from. * - * @return IString Value of the field/column index. + * @return QString Value of the field/column index. */ - IString SqlRecord::getValue(int index) const { - return (IString(IString::ToStd(field(index).value().toString()))); + QString SqlRecord::getValue(int index) const { + return (QString(field(index).value().toString())); } /** @@ -178,10 +178,10 @@ namespace Isis { * * @param name Name of the field/column to get value for. * - * @return IString Value of the named field/column. + * @return QString Value of the named field/column. */ - IString SqlRecord::getValue(const std::string &name) const { - return (IString(IString::ToStd(field(IString::ToQt(name)).value().toString()))); + QString SqlRecord::getValue(const QString &name) const { + return (QString(field(name).value().toString())); } /** @@ -195,15 +195,15 @@ namespace Isis { * * @param ctype A Qt QVariant::Type description * - * @return std::string A generic type for the Qt type. + * @return QString A generic type for the Qt type. */ - std::string SqlRecord::QtTypeField(const char *ctype) const { - string retType(""); + QString SqlRecord::QtTypeField(const char *ctype) const { + QString retType(""); if(ctype == 0) { return (retType); } else { - retType = IString::DownCase((tolower(ctype[0]) == 'q') ? &ctype[1] : ctype); + retType = QString((tolower(ctype[0]) == 'q') ? &ctype[1] : ctype).toLower(); } return(retType); } diff --git a/isis/src/database/objs/SqlRecord/SqlRecord.h b/isis/src/database/objs/SqlRecord/SqlRecord.h index bb2a4be16b..979177afe0 100644 --- a/isis/src/database/objs/SqlRecord/SqlRecord.h +++ b/isis/src/database/objs/SqlRecord/SqlRecord.h @@ -1,4 +1,4 @@ -#if !defined(SqlRecord_h) +#ifndef SqlRecord_h #define SqlRecord_h /** * @file @@ -29,10 +29,11 @@ #include "IException.h" #include +class QString; + namespace Isis { class SqlQuery; - class IString; /** * @brief Provide simplified access to resulting SQL query row @@ -40,9 +41,9 @@ namespace Isis { * This class is derived from * Qt's QSqlRecord * class and is provided for convenience and simplifed use in a standard C++ - * environment. Mainly, it provides strings and values as Standard std::strings + * environment. Mainly, it provides strings and values as Standard QStrings * and other more common C++ constructs as well as taking advantage of some - * unique Isis provisions (e.g., IString). One can still use Qt's rich features + * unique Isis provisions (e.g., QString). One can still use Qt's rich features * interchangeably with this class. * * SqlRecord is intended to be used by the SqlQuery class provided in this @@ -56,7 +57,7 @@ namespace Isis { * * @internal * @history 2007-06-05 Brendan George - Modified to work with - * IString/StringTools merge + * QString/StringTools merge */ class SqlRecord : public QSqlRecord { public: @@ -76,19 +77,19 @@ namespace Isis { return (count()); } - bool hasField(const std::string &name) const; - int getFieldIndex(const std::string &name) const; - std::string getFieldName(int index) const; + bool hasField(const QString &name) const; + int getFieldIndex(const QString &name) const; + QString getFieldName(int index) const; - std::string getType(int index) const; - std::string getType(const std::string &name) const; + QString getType(int index) const; + QString getType(const QString &name) const; - bool isNull(const std::string &name) const; - IString getValue(int index) const; - IString getValue(const std::string &name) const; + bool isNull(const QString &name) const; + QString getValue(int index) const; + QString getValue(const QString &name) const; private: - std::string QtTypeField(const char *ctype) const; + QString QtTypeField(const char *ctype) const; }; } diff --git a/isis/src/database/objs/SqlRecord/unitTest.cpp b/isis/src/database/objs/SqlRecord/unitTest.cpp index a71cc75782..c6ab025348 100644 --- a/isis/src/database/objs/SqlRecord/unitTest.cpp +++ b/isis/src/database/objs/SqlRecord/unitTest.cpp @@ -1,4 +1,7 @@ #include "Database.h" + +#include + #include "FileName.h" #include "SqlQuery.h" #include "SqlRecord.h" @@ -13,8 +16,8 @@ int main(int argc, char *argv[]) { // SQLite FileName dbfile("$TEMPORARY/test.db"); Database testdb("testdb", "SQLite"); - string dbfileName(dbfile.expanded()); - testdb.setDatabaseName(dbfileName.c_str()); + QString dbfileName(dbfile.expanded()); + testdb.setDatabaseName(dbfileName.toAscii().data()); if(!testdb.open()) { throw IException(IException::User, "Connection failed", _FILEINFO_); } @@ -64,6 +67,6 @@ int main(int argc, char *argv[]) { } - remove(FileName("$TEMPORARY/test.db").expanded().c_str()); + QFile::remove(FileName("$TEMPORARY/test.db").expanded()); return 0; } diff --git a/isis/src/dawn/apps/dawnfc2isis/dawnfc2isis.cpp b/isis/src/dawn/apps/dawnfc2isis/dawnfc2isis.cpp index cf5c69a6bc..8b76f86533 100644 --- a/isis/src/dawn/apps/dawnfc2isis/dawnfc2isis.cpp +++ b/isis/src/dawn/apps/dawnfc2isis/dawnfc2isis.cpp @@ -1,7 +1,9 @@ #include "Isis.h" #include -#include + +#include +#include #include "ProcessImportPds.h" #include "ProcessBySample.h" @@ -19,33 +21,29 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); FileName inFile = ui.GetFileName("FROM"); - IString instid; - IString missid; + QString instid; + QString missid; try { Pvl lab(inFile.expanded()); - instid = (string) lab.FindKeyword("INSTRUMENT_ID"); - missid = (string) lab.FindKeyword("MISSION_ID"); + instid = (QString) lab.FindKeyword("INSTRUMENT_ID"); + missid = (QString) lab.FindKeyword("MISSION_ID"); } catch(IException &e) { - string msg = "Unable to read [INSTRUMENT_ID] or [MISSION_ID] from input file [" + + QString msg = "Unable to read [INSTRUMENT_ID] or [MISSION_ID] from input file [" + inFile.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } - instid.ConvertWhiteSpace(); - instid.Compress(); - instid.Trim(" "); - missid.ConvertWhiteSpace(); - missid.Compress(); - missid.Trim(" "); + instid = instid.simplified().trimmed(); + missid = missid.simplified().trimmed(); if(missid != "DAWN" && instid != "FC1" && instid != "FC2") { - string msg = "Input file [" + inFile.expanded() + "] does not appear to be " + + QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + "a DAWN Framing Camera (FC) EDR or RDR file."; throw IException(IException::Io, msg, _FILEINFO_); } - std::string target; + QString target; if(ui.WasEntered("TARGET")) { target = ui.GetString("TARGET"); } @@ -53,7 +51,7 @@ void IsisMain() { p.SetPdsFile(inFile.expanded(), "", pdsLabel); p.SetOrganization(Isis::ProcessImport::BSQ); - string tmpName = "$TEMPORARY/" + inFile.baseName() + ".tmp.cub"; + QString tmpName = "$TEMPORARY/" + inFile.baseName() + ".tmp.cub"; FileName tmpFile(tmpName); CubeAttributeOutput outatt = CubeAttributeOutput("+Real"); p.SetOutputCube(tmpFile.expanded(), outatt); @@ -71,7 +69,7 @@ void IsisMain() { // Get the directory where the DAWN translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Dawn"] + "/translations/"; + QString transDir = (QString) dataDir["Dawn"] + "/translations/"; // Create a PVL to store the translated labels in Pvl outLabel; @@ -92,9 +90,9 @@ void IsisMain() { instrumentXlater.Auto(outLabel); // Update target if user specifies it - if (!target.empty()) { + if (!target.isEmpty()) { PvlGroup &igrp = outLabel.FindGroup("Instrument",Pvl::Traverse); - igrp["TargetName"] = IString(target); + igrp["TargetName"] = target; } // Write the BandBin, Archive, and Instrument groups @@ -109,7 +107,7 @@ void IsisMain() { int filtno = bbGrp["FilterNumber"]; int center; int width; - string filtname; + QString filtname; if(filtno == 1) { center = 700; width = 700; @@ -151,24 +149,24 @@ void IsisMain() { filtname = "Blue_F8"; } else { - string msg = "Input file [" + inFile.expanded() + "] has an invalid " + + QString msg = "Input file [" + inFile.expanded() + "] has an invalid " + "FilterNumber. The FilterNumber must fall in the range 1 to 8."; throw IException(IException::Io, msg, _FILEINFO_); } - bbGrp.AddKeyword(PvlKeyword("Center", center)); - bbGrp.AddKeyword(PvlKeyword("Width", width)); + bbGrp.AddKeyword(PvlKeyword("Center", toString(center))); + bbGrp.AddKeyword(PvlKeyword("Width", toString(width))); bbGrp.AddKeyword(PvlKeyword("FilterName", filtname)); outcube->putGroup(bbGrp); PvlGroup kerns("Kernels"); if(instid == "FC1") { - kerns += PvlKeyword("NaifFrameCode", -203110-filtno); + kerns += PvlKeyword("NaifFrameCode", toString(-203110-filtno)); } else if(instid == "FC2") { - kerns += PvlKeyword("NaifFrameCode", -203120-filtno); + kerns += PvlKeyword("NaifFrameCode", toString(-203120-filtno)); } else { - string msg = "Input file [" + inFile.expanded() + "] has an invalid " + + QString msg = "Input file [" + inFile.expanded() + "] has an invalid " + "InstrumentId."; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -177,8 +175,8 @@ void IsisMain() { p2.StartProcess(flipbyline); p2.EndProcess(); - string tmp(tmpFile.expanded()); - remove(tmp.c_str()); + QString tmp(tmpFile.expanded()); + QFile::remove(tmp); } // Flip image by line diff --git a/isis/src/dawn/apps/dawnvir2isis/dawnvir2isis.cpp b/isis/src/dawn/apps/dawnvir2isis/dawnvir2isis.cpp index 08de04bd19..cf5b5f160b 100644 --- a/isis/src/dawn/apps/dawnvir2isis/dawnvir2isis.cpp +++ b/isis/src/dawn/apps/dawnvir2isis/dawnvir2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "FileName.h" #include "ImportPdsTable.h" @@ -19,15 +19,15 @@ void IsisMain () UserInterface &ui = Application::GetUserInterface(); FileName inFile = ui.GetFileName("FROM"); - string imageFile(""); + QString imageFile(""); if (ui.WasEntered("IMAGE")) { imageFile = ui.GetFileName("IMAGE"); } // Generate the housekeeping filenames - string hkLabel(""); - string hkData(""); + QString hkLabel(""); + QString hkData(""); if (ui.WasEntered("HKFROM") ) { hkLabel = ui.GetFileName("HKFROM"); } @@ -36,7 +36,7 @@ void IsisMain () // Determine the housekeeping file FileName hkFile(hkLabel); if (!hkFile.fileExists()) { - hkFile = IString::Replace(hkLabel, "_1B_", "_1A_", false); + hkFile = hkLabel.replace("_1B_", "_1A_"); if (hkFile.fileExists()) hkLabel = hkFile.expanded(); } } @@ -45,39 +45,35 @@ void IsisMain () hkData = ui.GetFileName("HKTABLE"); } - IString instid; - IString missid; + QString instid; + QString missid; try { Pvl lab(inFile.expanded()); - instid = (string) lab.FindKeyword ("CHANNEL_ID"); - missid = (string) lab.FindKeyword ("INSTRUMENT_HOST_ID"); + instid = (QString) lab.FindKeyword ("CHANNEL_ID"); + missid = (QString) lab.FindKeyword ("INSTRUMENT_HOST_ID"); } catch (IException &e) { - string msg = "Unable to read [INSTRUMENT_ID] or [MISSION_ID] from input file [" + + QString msg = "Unable to read [INSTRUMENT_ID] or [MISSION_ID] from input file [" + inFile.expanded() + "]"; throw IException(e, IException::Io,msg, _FILEINFO_); } - instid.ConvertWhiteSpace(); - instid.Compress(); - instid.Trim(" "); - missid.ConvertWhiteSpace(); - missid.Compress(); - missid.Trim(" "); + instid = instid.simplified().trimmed(); + missid = missid.simplified().trimmed(); if (missid != "DAWN" && instid != "VIS" && instid != "IR") { - string msg = "Input file [" + inFile.expanded() + "] does not appear to be a " + + QString msg = "Input file [" + inFile.expanded() + "] does not appear to be a " + "DAWN Visual and InfraRed Mapping Spectrometer (VIR) EDR or RDR file."; throw IException(IException::Unknown, msg, _FILEINFO_); } - std::string target; + QString target; if (ui.WasEntered("TARGET")) { target = ui.GetString("TARGET"); } // p.SetPdsFile (inFile.expanded(),imageFile,pdsLabel); -// string labelFile = ui.GetFileName("FROM"); +// QString labelFile = ui.GetFileName("FROM"); p.SetPdsFile (inFile.expanded(),imageFile,pdsLabel); p.SetOrganization(Isis::ProcessImport::BIP); Cube *outcube = p.SetOutputCube ("TO"); @@ -89,7 +85,7 @@ void IsisMain () // Get the directory where the DAWN translation tables are. PvlGroup dataDir (Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Dawn"] + "/translations/"; + QString transDir = (QString) dataDir["Dawn"] + "/translations/"; // Create a PVL to store the translated labels in Pvl outLabel; @@ -110,9 +106,9 @@ void IsisMain () instrumentXlater.Auto(outLabel); // Update target if user specifies it - if (!target.empty()) { + if (!target.isEmpty()) { PvlGroup &igrp = outLabel.FindGroup("Instrument",Pvl::Traverse); - igrp["TargetName"] = IString(target); + igrp["TargetName"] = target; } // Write the BandBin, Archive, and Instrument groups @@ -123,11 +119,11 @@ void IsisMain () PvlGroup kerns("Kernels"); if (instid == "VIS") { - kerns += PvlKeyword("NaifFrameCode",-203211); + kerns += PvlKeyword("NaifFrameCode","-203211"); } else if (instid == "IR") { - kerns += PvlKeyword("NaifFrameCode",-203213); + kerns += PvlKeyword("NaifFrameCode","-203213"); } else { - string msg = "Input file [" + inFile.expanded() + "] has an invalid " + + QString msg = "Input file [" + inFile.expanded() + "] has an invalid " + "InstrumentId."; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -146,7 +142,7 @@ void IsisMain () outcube->write(hktab); } catch (IException &e) { - string mess = "Cannot read/open housekeeping data"; + QString mess = "Cannot read/open housekeeping data"; throw IException(e, IException::User, mess, _FILEINFO_); } diff --git a/isis/src/dawn/objs/DawnFcCamera/DawnFcCamera.cpp b/isis/src/dawn/objs/DawnFcCamera/DawnFcCamera.cpp index dd4a4b4092..e383b7666e 100644 --- a/isis/src/dawn/objs/DawnFcCamera/DawnFcCamera.cpp +++ b/isis/src/dawn/objs/DawnFcCamera/DawnFcCamera.cpp @@ -63,7 +63,7 @@ namespace Isis { // only problem with ISIS is the pixel resolution computation. This may // be something we want to refactor later in case future instrument have // non-square detectors. - IString keyword = "INS" + (IString)(int)naifIkCode() + "_PIXEL_SIZE"; + QString keyword = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE"; double pixelPitch = (Spice::getDouble(keyword, 0) + Spice::getDouble(keyword, 1)) / 2.0; pixelPitch /= 1000.0; SetPixelPitch(pixelPitch); @@ -86,15 +86,15 @@ namespace Isis { // from detector samp,line to focal plane x,y. This is where the non-square detector size are read and utilized. // The boresight position recorded in the IK is zero-based and therefore needs to be adjusted for ISIS CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); - double boresightSample = Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_CCD_CENTER",0) + 1.0; - double boresightLine = Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_CCD_CENTER",1) + 1.0; + double boresightSample = Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER",0) + 1.0; + double boresightLine = Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER",1) + 1.0; focalMap->SetDetectorOrigin(boresightSample,boresightLine); // Setup distortion map. Start by reading the distortion coefficient from the instrument kernel. Then // construct the distortion model. Note the distortion model code is copied from the RadialDistortionMap // class and reversed. TODO: Check with Ken Edmundson to see if we can just read from IK and pass 1/K // to the original RadialDistortionMap which would allow us to delete the DawnFcDistortionMap - double k = Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_RAD_DIST_COEFF"); + double k = Spice::getDouble("INS" + toString(naifIkCode()) + "_RAD_DIST_COEFF"); new DawnFcDistortionMap(this,k); // Setup the ground and sky map @@ -107,7 +107,7 @@ namespace Isis { // CCD is discharged or cleared. Finally the exporsure information // needs to be obtained. PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - string stime = inst["SpacecraftClockStartCount"]; + QString stime = inst["SpacecraftClockStartCount"]; double et = getClockTime(stime).Et(); et += 193.0 / 1000.0; double exposureDuration = (double)inst["ExposureDuration"] / 1000.0; diff --git a/isis/src/dawn/objs/DawnFcCamera/unitTest.cpp b/isis/src/dawn/objs/DawnFcCamera/unitTest.cpp index e769e52416..300a1d59bb 100644 --- a/isis/src/dawn/objs/DawnFcCamera/unitTest.cpp +++ b/isis/src/dawn/objs/DawnFcCamera/unitTest.cpp @@ -62,9 +62,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/dawn/objs/DawnVirCamera/DawnVirCamera.cpp b/isis/src/dawn/objs/DawnVirCamera/DawnVirCamera.cpp index 6f90def807..df663504dd 100644 --- a/isis/src/dawn/objs/DawnVirCamera/DawnVirCamera.cpp +++ b/isis/src/dawn/objs/DawnVirCamera/DawnVirCamera.cpp @@ -36,10 +36,10 @@ namespace Isis { // Get the start time from labels PvlGroup &inst = lab.FindGroup("Instrument", Isis::Pvl::Traverse); - string channelId = inst["ChannelId"]; + QString channelId = inst["ChannelId"]; - string instMode = inst["InstrumentModeId"]; - m_slitMode = instMode[14]; // "F" for full slit, Q for quarter slit + QString instMode = inst["InstrumentModeId"]; + m_slitMode = instMode[14].toAscii(); // "F" for full slit, Q for quarter slit // Check for presence of articulation kernel bool hasArtCK = hasArticulationKernel(lab); @@ -66,9 +66,9 @@ namespace Isis { // Get other info from labels PvlKeyword &frameParam = inst["FrameParameter"]; - m_exposureTime = frameParam[0].ToDouble(); - m_summing = frameParam[1].ToInteger(); - m_scanRate = frameParam[2].ToDouble(); + m_exposureTime = toDouble(frameParam[0]); + m_summing = toDouble(frameParam[1]); + m_scanRate = toDouble(frameParam[2]); // Setup detector map // Get the line scan rates/times @@ -80,10 +80,10 @@ namespace Isis { new CameraFocalPlaneMap(this, naifIkCode()); // Retrieve boresight location from instrument kernel (IK) (addendum?) - IString ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_SAMPLE"; + QString ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"; double sampleBoreSight = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_LINE"; + ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE"; double lineBoreSight = getDouble(ikernKey); FocalPlaneMap()->SetDetectorOrigin(sampleBoreSight, lineBoreSight); @@ -150,12 +150,12 @@ namespace Isis { * * @param text String to scrub * - * @return std::string Returns scrubs strings + * @return QString Returns scrubs strings */ - std::string DawnVirCamera::scrub(const std::string &text) const { - string ostr; - for (unsigned int i = 0 ; i < text.size() ; i++) { - if ((text[i] > ' ') && (text[i] <= 'z')) ostr.push_back(text[i]); + QString DawnVirCamera::scrub(const QString &text) const { + QString ostr; + for (int i = 0 ; i < text.size() ; i++) { + if ((text[i] > ' ') && (text[i] <= 'z')) ostr += text[i]; } return (ostr); } @@ -213,8 +213,8 @@ namespace Isis { * * @history 2011-07-22 Kris Becker */ - void DawnVirCamera::readHouseKeeping(const std::string &filename, - double lineRate) { + void DawnVirCamera::readHouseKeeping(const QString &filename, + double lineRate) { // Open the ISIS table object Table hktable("VIRHouseKeeping", filename); @@ -223,8 +223,8 @@ namespace Isis { NumericalApproximation angFit; for (int i = 0; i < hktable.Records(); i++) { TableRecord &trec = hktable[i]; - string scet = scrub(trec["ScetTimeClock"]); - string shutterMode = scrub(trec["ShutterStatus"]); + QString scet = scrub(trec["ScetTimeClock"]); + QString shutterMode = scrub(trec["ShutterStatus"]); // Compute the optical mirror angle double mirrorSin = trec["MirrorSin"]; @@ -238,7 +238,7 @@ namespace Isis { double lineMidTime; // scs2e_c(naifSpkCode(), scet.c_str(), &lineMidTime); lineMidTime = getClockTime(scet, naifSpkCode()).Et(); - bool isDark = IString::Equal("closed", shutterMode); + bool isDark = shutterMode.toLower() == "closed"; // Add fit data for all open angles if ( ! isDark ) { angFit.AddData(lineno, optAng); } @@ -301,7 +301,7 @@ namespace Isis { * * @history 2011-07-22 Kris Becker */ - Table DawnVirCamera::getPointingTable(const std::string &virChannel, + Table DawnVirCamera::getPointingTable(const QString &virChannel, const int zeroFrame) { // Create Spice Pointing table @@ -328,8 +328,8 @@ namespace Isis { Table quats("SpiceRotation", record); int nfields = record.Fields(); - string virId = "DAWN_VIR_" + virChannel; - string virZero = virId + "_ZERO"; + QString virId = "DAWN_VIR_" + virChannel; + QString virZero = virId + "_ZERO"; // Allocate output arrays int nvals = nfields - 1; @@ -374,21 +374,21 @@ namespace Isis { } // Add some necessary keywords - quats.Label() += PvlKeyword("CkTableStartTime", startTime()); - quats.Label() += PvlKeyword("CkTableEndTime", endTime()); - quats.Label() += PvlKeyword("CkTableOriginalSize", quats.Records()); + quats.Label() += PvlKeyword("CkTableStartTime", toString(startTime())); + quats.Label() += PvlKeyword("CkTableEndTime", toString(endTime())); + quats.Label() += PvlKeyword("CkTableOriginalSize", toString(quats.Records())); // Create the time dependant frames keyword int virZeroId = getInteger("FRAME_" + virZero); - PvlKeyword tdf("TimeDependentFrames", virZeroId); // DAWN_VIR_{ID}_ZERO - tdf.AddValue(-203200); // DAWN_VIR - tdf.AddValue(-203000); // DAWN_SPACECRAFT - tdf.AddValue(1); // J2000 + PvlKeyword tdf("TimeDependentFrames", toString(virZeroId)); // DAWN_VIR_{ID}_ZERO + tdf.AddValue("-203200"); // DAWN_VIR + tdf.AddValue("-203000"); // DAWN_SPACECRAFT + tdf.AddValue("1"); // J2000 quats.Label() += tdf; // Create constant rotation frames - PvlKeyword cf("ConstantFrames", virZeroId); - cf.AddValue(virZeroId); + PvlKeyword cf("ConstantFrames", toString(virZeroId)); + cf.AddValue(toString(virZeroId)); quats.Label() += cf; SpiceDouble identity[3][3]; @@ -398,7 +398,7 @@ namespace Isis { PvlKeyword crot("ConstantRotation"); for (int i = 0 ; i < 3 ; i++) { for (int j = 0 ; j < 3 ; j++) { - crot.AddValue(identity[i][j]); + crot.AddValue(toString(identity[i][j])); } } @@ -423,22 +423,22 @@ namespace Isis { * @history 2011-07-22 Kris Becker */ - DawnVirCamera::SMatrix DawnVirCamera::getStateRotation(const std::string &frame1, - const std::string &frame2, + DawnVirCamera::SMatrix DawnVirCamera::getStateRotation(const QString &frame1, + const QString &frame2, const double &etTime) const { SMatrix state(6,6); NaifStatus::CheckErrors(); try { // Get pointing w/AVs - sxform_c(frame1.c_str(), frame2.c_str(), etTime, + sxform_c(frame1.toAscii().data(), frame2.toAscii().data(), etTime, (SpiceDouble (*)[6]) state[0]); NaifStatus::CheckErrors(); } catch (IException &) { try { SMatrix rot(3,3); - pxform_c(frame1.c_str(), frame2.c_str(), etTime, + pxform_c(frame1.toAscii().data(), frame2.toAscii().data(), etTime, (SpiceDouble (*)[3]) rot[0]); NaifStatus::CheckErrors(); SpiceDouble av[3] = {0.0, 0.0, 0.0 }; @@ -471,11 +471,11 @@ namespace Isis { */ bool DawnVirCamera::hasArticulationKernel(Pvl &label) const { Kernels kerns(label); - std::vector cks = kerns.getKernelList("CK"); + QStringList cks = kerns.getKernelList("CK"); QRegExp virCk("*dawn_vir_?????????_?.bc"); virCk.setPatternSyntax(QRegExp::Wildcard); - for (unsigned int i = 0 ; i < cks.size() ; i++) { - if ( virCk.exactMatch(IString::ToQt(cks[i])) ) return (true); + for (int i = 0 ; i < cks.size() ; i++) { + if ( virCk.exactMatch(cks[i]) ) return (true); } return (false); } diff --git a/isis/src/dawn/objs/DawnVirCamera/DawnVirCamera.h b/isis/src/dawn/objs/DawnVirCamera/DawnVirCamera.h index a6179044e9..a19de62711 100644 --- a/isis/src/dawn/objs/DawnVirCamera/DawnVirCamera.h +++ b/isis/src/dawn/objs/DawnVirCamera/DawnVirCamera.h @@ -88,8 +88,8 @@ namespace Isis { std::vector m_lineRates; std::vector m_mirrorData; - void readHouseKeeping(const std::string &filename, double lineRate); - std::string scrub(const std::string &text) const; + void readHouseKeeping(const QString &filename, double lineRate); + QString scrub(const QString &text) const; double exposureTime() const; double scanLineTime() const; int pixelSumming() const; @@ -101,10 +101,10 @@ namespace Isis { double startTime() const; double endTime() const; - Table getPointingTable(const std::string &channelId, + Table getPointingTable(const QString &channelId, const int zeroFrame); - SMatrix getStateRotation(const std::string &frame1, - const std::string &frame2, + SMatrix getStateRotation(const QString &frame1, + const QString &frame2, const double &et) const; bool hasArticulationKernel(Pvl &label) const; diff --git a/isis/src/galileo/apps/gllssi2isis/gllssi2isis.cpp b/isis/src/galileo/apps/gllssi2isis/gllssi2isis.cpp index fe77141692..bdba0f1c30 100644 --- a/isis/src/galileo/apps/gllssi2isis/gllssi2isis.cpp +++ b/isis/src/galileo/apps/gllssi2isis/gllssi2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "ProcessImportPds.h" @@ -36,24 +36,24 @@ void IsisMain() { //Checks if in file is rdr if(lab.HasObject("IMAGE_MAP_PROJECTION")) { - string msg = "[" + inFile.name() + "] appears to be an rdr file."; + QString msg = "[" + inFile.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::Io, msg, _FILEINFO_); } // data set id value must contain "SSI-2-REDR-V1.0"(valid SSI image) // or "SSI-4-REDR-V1.0"(reconstructed from garbled SSI image) - string dataSetId; - dataSetId = (string)lab["DATA_SET_ID"]; + QString dataSetId; + dataSetId = (QString)lab["DATA_SET_ID"]; try { - if(dataSetId.find("SSI-2-REDR-V1.0") == string::npos - && dataSetId.find("SSI-4-REDR-V1.0") == string::npos) { - string msg = "Invalid DATA_SET_ID [" + dataSetId + "]"; + if(!dataSetId.contains("SSI-2-REDR-V1.0") + && !dataSetId.contains("SSI-4-REDR-V1.0")) { + QString msg = "Invalid DATA_SET_ID [" + dataSetId + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } } catch(IException &e) { - string msg = "Unable to read [DATA_SET_ID] from input file [" + + QString msg = "Unable to read [DATA_SET_ID] from input file [" + inFile.expanded() + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -64,7 +64,7 @@ void IsisMain() { // reconstructed images are 800x800 (i.e. not summed) // even though they have frame duration of 2.333 // (which ordinarily indicates a summed image) - if(dataSetId.find("SSI-4-REDR-V1.0") != string::npos) { + if(dataSetId.contains("SSI-4-REDR-V1.0")) { summed = false; } else if(frameDuration > 2.0 && frameDuration < 3.0) { @@ -123,7 +123,7 @@ void TranslateLabels(Pvl &pdsLabel, Cube *ocube) { PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); // Transfer the instrument group to the output cube - IString transDir = (string) dataDir["Galileo"]; + QString transDir = (QString) dataDir["Galileo"]; FileName transFile(transDir + "/translations/galileoSsi.trn"); // Get the translation manager ready @@ -136,23 +136,23 @@ void TranslateLabels(Pvl &pdsLabel, Cube *ocube) { PvlGroup &arch = outputLabel->FindGroup("Archive", Pvl::Traverse); PvlGroup &inst = outputLabel->FindGroup("Instrument", Pvl::Traverse); arch.AddKeyword(PvlKeyword("DataType", "RADIANCE")); - string CTC = (string) arch.FindKeyword("ObservationId"); - string CTCout = CTC.substr(0, 2); + QString CTC = (QString) arch.FindKeyword("ObservationId"); + QString CTCout = CTC.mid(0, 2); arch.AddKeyword(PvlKeyword("CalTargetCode", CTCout)); // Add to the Instrument Group - IString itest = (string) inst.FindKeyword("StartTime"); - itest.Remove("Z"); + QString itest = (QString) inst.FindKeyword("StartTime"); + itest.remove("Z"); inst.FindKeyword("StartTime").SetValue(itest); //change exposure duration to seconds double expDur = inst.FindKeyword("exposureDuration"); double expDurOut = expDur / 1000.0; - inst.FindKeyword("exposureDuration").SetValue(expDurOut, "seconds"); + inst.FindKeyword("exposureDuration").SetValue(toString(expDurOut), "seconds"); inst.AddKeyword(PvlKeyword("FrameDuration", - (string) pdsLabel["frameDuration"], "seconds")); + (QString) pdsLabel["frameDuration"], "seconds")); //Calculate the Frame_Rate_Id keyword - string frameModeId = "FULL"; + QString frameModeId = "FULL"; int summingMode = 1; if(summed) { @@ -160,14 +160,14 @@ void TranslateLabels(Pvl &pdsLabel, Cube *ocube) { summingMode = 2; } - inst.AddKeyword(PvlKeyword("Summing", summingMode)); + inst.AddKeyword(PvlKeyword("Summing", toString(summingMode))); inst.AddKeyword(PvlKeyword("FrameModeId", frameModeId)); // Create the Band bin Group PvlGroup &bandBin = outputLabel->FindGroup("BandBin", Pvl::Traverse); - string filterName = pdsLabel["FILTER_NAME"]; - string waveLength = ""; - string width = ""; + QString filterName = pdsLabel["FILTER_NAME"]; + QString waveLength = ""; + QString width = ""; if(filterName == "CLEAR") { waveLength = "0.611"; width = ".44"; @@ -205,6 +205,6 @@ void TranslateLabels(Pvl &pdsLabel, Cube *ocube) { //create the kernel group PvlGroup kern("Kernels"); - kern += PvlKeyword("NaifFrameCode", -77001); + kern += PvlKeyword("NaifFrameCode", "-77001"); ocube->putGroup(kern); } diff --git a/isis/src/galileo/apps/gllssical/gllssical.cpp b/isis/src/galileo/apps/gllssical/gllssical.cpp index 76f564daeb..77f6b36cc9 100644 --- a/isis/src/galileo/apps/gllssical/gllssical.cpp +++ b/isis/src/galileo/apps/gllssical/gllssical.cpp @@ -58,7 +58,7 @@ void IsisMain() { Isis::CubeAttributeInput inAtt1; FileName darkFileName = FindDarkFile(icube); Cube *darkcube = p.SetInputCube(darkFileName.expanded(), inAtt1); - dcScaleFactor = darkcube->getGroup("Instrument")["PicScale"][0]; + dcScaleFactor = toDouble(darkcube->getGroup("Instrument")["PicScale"][0]); Isis::CubeAttributeInput inAtt2; FileName gainFileName = FindGainFile(icube); @@ -83,7 +83,7 @@ void IsisMain() { calculateScaleFactor0(icube, gaincube); - exposureDuration = ((double)icube->getGroup("Instrument")["ExposureDuration"][0]) * 1000; + exposureDuration = toDouble(icube->getGroup("Instrument")["ExposureDuration"][0]) * 1000; if(darkcube->getPixelType() == Isis::UnsignedByte) { eightBitDarkCube = true; @@ -95,7 +95,7 @@ void IsisMain() { p.StartProcess(Calibrate); PvlGroup calibrationLog("RadiometricCalibration"); - calibrationLog.AddKeyword(PvlKeyword("From", (std::string)ui.GetFileName("FROM"))); + calibrationLog.AddKeyword(PvlKeyword("From", ui.GetFileName("FROM"))); FileName shutterFileName = FindShutterFile(icube); calibrationLog.AddKeyword(PvlKeyword("DarkCurrentFile", darkFileName.originalPath() + "/" + @@ -104,23 +104,23 @@ void IsisMain() { gainFileName.name())); calibrationLog.AddKeyword(PvlKeyword("ShutterFile", shutterFileName.originalPath() + "/" + shutterFileName.name())); - calibrationLog.AddKeyword(PvlKeyword("ScaleFactor", scaleFactor)); + calibrationLog.AddKeyword(PvlKeyword("ScaleFactor", toString(scaleFactor))); calibrationLog.AddKeyword(PvlKeyword("OutputUnits", iof ? "I/F" : "Radiance")); if (iof) { - calibrationLog.AddKeyword(PvlKeyword("S1", s1, "I/F per Ft-Lambert")); - calibrationLog.AddKeyword(PvlKeyword("RSUN", rsun, "(Planet-Sun range)/5.2 A.U.")); - calibrationLog.AddKeyword(PvlKeyword("Scale", scaleFactor, "I/F units per DN")); - calibrationLog.AddKeyword(PvlKeyword("GC", cubeConversion, "Cube gain conversion")); - calibrationLog.AddKeyword(PvlKeyword("GG", gainConversion, "Gain file gain conversion")); - calibrationLog.AddKeyword(PvlKeyword("IOF-SCALE0", scaleFactor0, "(S1/Scale)*(GC/GG)/RSUN**2")); + calibrationLog.AddKeyword(PvlKeyword("S1", toString(s1), "I/F per Ft-Lambert")); + calibrationLog.AddKeyword(PvlKeyword("RSUN", toString(rsun), "(Planet-Sun range)/5.2 A.U.")); + calibrationLog.AddKeyword(PvlKeyword("Scale", toString(scaleFactor), "I/F units per DN")); + calibrationLog.AddKeyword(PvlKeyword("GC", toString(cubeConversion), "Cube gain conversion")); + calibrationLog.AddKeyword(PvlKeyword("GG", toString(gainConversion), "Gain file gain conversion")); + calibrationLog.AddKeyword(PvlKeyword("IOF-SCALE0", toString(scaleFactor0), "(S1/Scale)*(GC/GG)/RSUN**2")); } else { - calibrationLog.AddKeyword(PvlKeyword("S2", s2, "Nanowatts per Ft-Lambert")); - calibrationLog.AddKeyword(PvlKeyword("Scale", scaleFactor, + calibrationLog.AddKeyword(PvlKeyword("S2", toString(s2), "Nanowatts per Ft-Lambert")); + calibrationLog.AddKeyword(PvlKeyword("Scale", toString(scaleFactor), "Nanowatts/cm**2/steradian/nanometer/DN")); - calibrationLog.AddKeyword(PvlKeyword("GC", cubeConversion, "Cube gain conversion")); - calibrationLog.AddKeyword(PvlKeyword("GG", gainConversion, "Gain file gain conversion")); - calibrationLog.AddKeyword(PvlKeyword("Radiance-SCALE0", scaleFactor0, "(S2/Scale)*(GC/GG)")); + calibrationLog.AddKeyword(PvlKeyword("GC", toString(cubeConversion), "Cube gain conversion")); + calibrationLog.AddKeyword(PvlKeyword("GG", toString(gainConversion), "Gain file gain conversion")); + calibrationLog.AddKeyword(PvlKeyword("Radiance-SCALE0", toString(scaleFactor0), "(S2/Scale)*(GC/GG)")); } ocube->putGroup(calibrationLog); @@ -188,11 +188,11 @@ void Calibrate(vector &in, vector &out) { } FileName FindDarkFile(Cube *icube) { - string file = "$galileo/calibration/gll_dc.sav"; + QString file = "$galileo/calibration/gll_dc.sav"; TextFile darkFile(file); darkFile.SetComment("C"); - IString data; + QString data; /** * The dark current table requires the following information to match: @@ -210,54 +210,55 @@ FileName FindDarkFile(Cube *icube) { * 4 = 60 2/3 * 5 = 15 1/6 */ - if((int)(double)icube->getGroup("Instrument")["FrameDuration"][0] == 2) frameRateId = 1; - if((int)(double)icube->getGroup("Instrument")["FrameDuration"][0] == 8) frameRateId = 2; - if((int)(double)icube->getGroup("Instrument")["FrameDuration"][0] == 30) frameRateId = 3; - if((int)(double)icube->getGroup("Instrument")["FrameDuration"][0] == 60) frameRateId = 4; - if((int)(double)icube->getGroup("Instrument")["FrameDuration"][0] == 15) frameRateId = 5; + if((int)(toDouble(icube->getGroup("Instrument")["FrameDuration"][0])) == 2) frameRateId = 1; + if((int)(toDouble(icube->getGroup("Instrument")["FrameDuration"][0])) == 8) frameRateId = 2; + if((int)(toDouble(icube->getGroup("Instrument")["FrameDuration"][0])) == 30) frameRateId = 3; + if((int)(toDouble(icube->getGroup("Instrument")["FrameDuration"][0])) == 60) frameRateId = 4; + if((int)(toDouble(icube->getGroup("Instrument")["FrameDuration"][0])) == 15) frameRateId = 5; int exposureTypeId = (icube->getGroup("Instrument")["ExposureType"][0] == "NORMAL") ? 0 : 1; // We have what we need from the image label, now go through the text file that is our table line by line // looking for a match. while(darkFile.GetLine(data)) { - data = data.Compress(); + data = data.simplified().trimmed(); - IString mission = data.Token(" "); + QStringList tokens = data.split(" "); + QString mission = (tokens.count()? tokens.takeFirst() : ""); if(mission != "GALILEO") { continue; } - IString frameMode = data.Token(" "); + QString frameMode = (tokens.count()? tokens.takeFirst() : ""); if(frameMode.at(0) != icube->getGroup("Instrument")["FrameModeId"][0].at(0)) { continue; } - IString gainState = data.Token(" "); - if((int)gainState != gainModeId) { + QString gainState = (tokens.count()? tokens.takeFirst() : ""); + if(toInt(gainState) != gainModeId) { continue; } - IString frameRate = data.Token(" "); - if(frameRateId != (int)frameRate) { + QString frameRate = (tokens.count()? tokens.takeFirst() : ""); + if(frameRateId != toInt(frameRate)) { continue; } - IString tableExposureTypeId = data.Token(" "); - if((int)tableExposureTypeId != exposureTypeId) { + QString tableExposureTypeId = (tokens.count()? tokens.takeFirst() : ""); + if(toInt(tableExposureTypeId) != exposureTypeId) { continue; } - IString readout = data.Token(" "); + QString readout = (tokens.count()? tokens.takeFirst() : ""); if(readout.at(0) != icube->getGroup("Instrument")["ReadoutMode"][0].at(0)) { continue; } - int minImageNum = data.Token(" "); - int maxImageNum = data.Token(" "); + int minImageNum = toInt(tokens.takeFirst()); + int maxImageNum = toInt(tokens.takeFirst()); - int imageNumber = (int)((double)icube->getGroup("Instrument")["SpacecraftClockStartCount"] * 100 + 0.5); - IString telemetry = icube->getGroup("Instrument")["TelemetryFormat"][0]; + int imageNumber = (int)(toDouble(icube->getGroup("Instrument")["SpacecraftClockStartCount"]) * 100 + 0.5); + QString telemetry = icube->getGroup("Instrument")["TelemetryFormat"][0]; if(imageNumber > 99757701 && imageNumber < 159999999) { if((telemetry == "AI8" && (gainState == "1" || gainState == "2")) || (telemetry == "IM4" && (gainState == "3" || gainState == "4"))) { @@ -273,25 +274,27 @@ FileName FindDarkFile(Cube *icube) { } // By process of elimination, we found the dark current file successfully. Return it. - return FileName(string("$galileo/calibration/darkcurrent/") + data.Token(" ") + string(".cub")); + return FileName("$galileo/calibration/darkcurrent/" + tokens.takeFirst() + ".cub"); } throw IException(IException::Unknown, "Dark current file could not be determined.", _FILEINFO_); } FileName FindGainFile(Cube *icube) { - string file = "$galileo/calibration/gll_gain.sav"; + QString file = "$galileo/calibration/gll_gain.sav"; TextFile gainFile(file); gainFile.SetComment("C"); - IString data; + QString data; int imageNumber = (int)((double)icube->getGroup("Instrument")["SpacecraftClockStartCount"] * 100 + 0.5); while(gainFile.GetLine(data)) { - data = data.Compress(); + data = data.simplified().trimmed(); - IString mission = data.Token(" "); + QStringList tokens = data.split(" "); + + QString mission = tokens.count()? tokens.takeFirst() : ""; if(mission != "GALILEO") { continue; } @@ -300,40 +303,40 @@ FileName FindGainFile(Cube *icube) { * Filter codes * 0=clear,1=green,2=red,3=violet,4=7560,5=9680,6=7270,7=8890 */ - IString filter = icube->getGroup("BandBin")["FilterNumber"][0]; - if(filter != data.Token(" ")) { + QString filter = icube->getGroup("BandBin")["FilterNumber"][0]; + if(filter != tokens.takeFirst()) { continue; } - IString frameMode = data.Token(" "); + QString frameMode = tokens.count()? tokens.takeFirst() : ""; if(frameMode.at(0) != icube->getGroup("Instrument")["FrameModeId"][0].at(0)) { continue; } - int minImageNum = data.Token(" "); - int maxImageNum = data.Token(" "); + int minImageNum = toInt(tokens.takeFirst()); + int maxImageNum = toInt(tokens.takeFirst()); if(imageNumber < minImageNum || imageNumber > maxImageNum) { continue; } - return FileName(string("$galileo/calibration/gain/") + data.Token(" ") + string(".cub")); + return FileName("$galileo/calibration/gain/" + tokens.takeFirst() + ".cub"); } throw IException(IException::Unknown, "Gain file could not be determined.", _FILEINFO_); } FileName ReadWeightTable(Cube *icube) { - string file = "$galileo/calibration/weightTables_v???.sav"; + QString file = "$galileo/calibration/weightTables_v???.sav"; FileName weightFile(file); weightFile = weightFile.highestVersion(); Pvl weightTables(weightFile.expanded()); - IString group = IString("FrameMode") + (char)icube->getGroup("Instrument")["FrameModeId"][0].at(0); + QString group = QString("FrameMode") + icube->getGroup("Instrument")["FrameModeId"][0].at(0); PvlGroup &frameGrp = weightTables.FindGroup(group); - IString keyword = IString("GainState") + ((getGainModeID(icube) < 3) ? IString("12") : IString("34")); + QString keyword = QString("GainState") + ((getGainModeID(icube) < 3) ? QString("12") : QString("34")); for(int i = 0; i < frameGrp[keyword].Size(); i++) { - weight.push_back(frameGrp[keyword][i]); + weight.push_back(toDouble(frameGrp[keyword][i])); } return weightFile; @@ -348,16 +351,16 @@ int getGainModeID(Cube *icube) { * 3 = 40,000 * 4 = 10,000 */ - if((int)(double)icube->getGroup("Instrument")["GainModeId"][0] == 4E5) { + if((int)toDouble(icube->getGroup("Instrument")["GainModeId"][0]) == 4E5) { gainModeId = 1; } - else if((int)(double)icube->getGroup("Instrument")["GainModeId"][0] == 1E5) { + else if((int)toDouble(icube->getGroup("Instrument")["GainModeId"][0]) == 1E5) { gainModeId = 2; } - else if((int)(double)icube->getGroup("Instrument")["GainModeId"][0] == 4E4) { + else if((int)toDouble(icube->getGroup("Instrument")["GainModeId"][0]) == 4E4) { gainModeId = 3; } - else if((int)(double)icube->getGroup("Instrument")["GainModeId"][0] == 1E4) { + else if((int)toDouble(icube->getGroup("Instrument")["GainModeId"][0]) == 1E4) { gainModeId = 4; } else { @@ -394,7 +397,7 @@ void calculateScaleFactor0(Cube *icube, Cube *gaincube) { // Match target name if(currGrp.HasKeyword("TargetName")) { - if(icube->getGroup("Archive")["CalTargetCode"][0].find(currGrp["TargetName"][0]) != 0) { + if(!icube->getGroup("Archive")["CalTargetCode"][0].startsWith(currGrp["TargetName"][0])) { continue; } } @@ -403,7 +406,7 @@ void calculateScaleFactor0(Cube *icube, Cube *gaincube) { if(currGrp.HasKeyword("MinimumTargetName")) { try { if((int)currGrp["MinimumTargetName"] > - (int)(IString)icube->getGroup("Archive")["CalTargetCode"][0].substr(0, 2)) { + (int)toInt(icube->getGroup("Archive")["CalTargetCode"][0].mid(0, 2))) { continue; } } @@ -416,7 +419,7 @@ void calculateScaleFactor0(Cube *icube, Cube *gaincube) { fltToRad = currGrp["FloatToRad"]; } - int filterNumber = (int)icube->getGroup("BandBin")["FilterNumber"][0]; + int filterNumber = toInt(icube->getGroup("BandBin")["FilterNumber"][0]); if(fltToRef.Size() == 0) { throw IException(IException::Unknown, @@ -426,10 +429,10 @@ void calculateScaleFactor0(Cube *icube, Cube *gaincube) { _FILEINFO_); } - s1 = fltToRef[filterNumber]; - s2 = fltToRad[filterNumber]; - cubeConversion = (double) conversionFactors["GainRatios"][getGainModeID(icube)-1]; - gainConversion = (double)conversionFactors["GainRatios"][getGainModeID(gaincube)-1]; + s1 = toDouble(fltToRef[filterNumber]); + s2 = toDouble(fltToRad[filterNumber]); + cubeConversion = toDouble( conversionFactors["GainRatios"][getGainModeID(icube)-1]); + gainConversion = toDouble(conversionFactors["GainRatios"][getGainModeID(gaincube)-1]); if (iof) { Camera *cam = icube->getCamera(); @@ -465,14 +468,14 @@ void calculateScaleFactor0(Cube *icube, Cube *gaincube) { } FileName GetScaleFactorFile() { - string file = "$galileo/calibration/conversionFactors_v???.sav"; + QString file = "$galileo/calibration/conversionFactors_v???.sav"; FileName scaleFactor(file); scaleFactor = scaleFactor.highestVersion(); return scaleFactor; } FileName FindShutterFile(Cube *icube) { - string file = "$galileo/calibration/shutter/calibration.so02"; + QString file = "$galileo/calibration/shutter/calibration.so02"; file += icube->getGroup("Instrument")["FrameModeId"][0].at(0); file += ".cub"; FileName shutterFile(file); diff --git a/isis/src/galileo/objs/SsiCamera/SsiCamera.cpp b/isis/src/galileo/objs/SsiCamera/SsiCamera.cpp index d9c97ad008..a6c85a6949 100644 --- a/isis/src/galileo/objs/SsiCamera/SsiCamera.cpp +++ b/isis/src/galileo/objs/SsiCamera/SsiCamera.cpp @@ -59,13 +59,13 @@ namespace Isis { */ if(imageDate < removeCoverDate) { int code = naifIkCode(); - string key = "INS" + IString(code) + "_FOCAL_LENGTH_COVER"; + QString key = "INS" + toString(code) + "_FOCAL_LENGTH_COVER"; SetFocalLength(Spice::getDouble(key)); - k1 = Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_K1_COVER"); + k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1_COVER"); } else { SetFocalLength(); - k1 = Spice::getDouble("INS" + (IString)(int)naifIkCode() + "_K1"); + k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1"); } SetPixelPitch(); @@ -73,7 +73,7 @@ namespace Isis { // Get the start time in et PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); - double et = iTime((string)inst["StartTime"]).Et(); + double et = iTime((QString)inst["StartTime"]).Et(); //?????????? NEED THESE?????? // exposure duration keyword value is measured in seconds @@ -92,9 +92,9 @@ namespace Isis { CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); focalMap->SetDetectorOrigin( - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"), - Spice::getDouble("INS" + (IString)(int)naifIkCode() + + Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE")); // Setup distortion map diff --git a/isis/src/galileo/objs/SsiCamera/unitTest.cpp b/isis/src/galileo/objs/SsiCamera/unitTest.cpp index 27c916b087..3595ba011b 100644 --- a/isis/src/galileo/objs/SsiCamera/unitTest.cpp +++ b/isis/src/galileo/objs/SsiCamera/unitTest.cpp @@ -64,9 +64,9 @@ int main(void) { const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/kaguya/apps/kaguyatc2isis/kaguyatc2isis.cpp b/isis/src/kaguya/apps/kaguyatc2isis/kaguyatc2isis.cpp index 1168ee18ea..d63f108a9e 100644 --- a/isis/src/kaguya/apps/kaguyatc2isis/kaguyatc2isis.cpp +++ b/isis/src/kaguya/apps/kaguyatc2isis/kaguyatc2isis.cpp @@ -16,27 +16,25 @@ void IsisMain() { Pvl label; UserInterface &ui = Application::GetUserInterface(); - string labelFile = ui.GetFileName("FROM"); + QString labelFile = ui.GetFileName("FROM"); FileName inFile = ui.GetFileName("FROM"); - IString id; + QString id; Pvl lab(inFile.expanded()); try { - id = (string) lab.FindKeyword("DATA_SET_ID"); + id = (QString) lab.FindKeyword("DATA_SET_ID"); } catch(IException &e) { - string msg = "Unable to read [DATA_SET_ID] from input file [" + + QString msg = "Unable to read [DATA_SET_ID] from input file [" + inFile.expanded() + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } - id.ConvertWhiteSpace(); - id.Compress(); - id.Trim(" "); + id = id.simplified().trimmed(); if(id != "TC_MAP" && id != "TCO_MAP") { - string msg = "Input file [" + inFile.expanded() + "] does not appear to be " + - "in Kaguya Terrain Camera level 2 format. " + - "DATA_SET_ID is [" + id + "]"; + QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + + "in Kaguya Terrain Camera level 2 format. " + + "DATA_SET_ID is [" + id + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -53,7 +51,7 @@ void IsisMain() { // Get the directory where the generic pds2isis level 2 translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["base"] + "/translations/"; + QString transDir = (QString) dataDir["base"] + "/translations/"; // Translate the Archive group FileName transFile(transDir + "pdsImageArchive.trn"); diff --git a/isis/src/lo/apps/lo2isis/lo2isis.cpp b/isis/src/lo/apps/lo2isis/lo2isis.cpp index d51278e77b..6b0a905322 100644 --- a/isis/src/lo/apps/lo2isis/lo2isis.cpp +++ b/isis/src/lo/apps/lo2isis/lo2isis.cpp @@ -5,7 +5,7 @@ #include "Pvl.h" #include "IException.h" #include "TextFile.h" -#include +#include using namespace std; using namespace Isis; @@ -21,7 +21,7 @@ void IsisMain() { //Checks if in file is rdr label = in.expanded(); if(label.HasObject("IMAGE_MAP_PROJECTION")) { - string msg = "[" + in.name() + "] appears to be an rdr file."; + QString msg = "[" + in.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -41,7 +41,7 @@ void TranslateLunarLabels(FileName &labelFile, Cube *ocube) { PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); // Transfer the instrument group to the output cube - IString transDir = (string) dataDir["Lo"] + "/translations/"; + QString transDir = (QString) dataDir["Lo"] + "/translations/"; Pvl inputLabel(labelFile.expanded()); FileName transFile; FileName bandBinTransFile; @@ -49,7 +49,7 @@ void TranslateLunarLabels(FileName &labelFile, Cube *ocube) { bool hasFiducial = false; // Check to see if file is PDS if(inputLabel.HasKeyword("PDS_VERSION_ID", Pvl::None)) { - IString pdsVersion = inputLabel.FindKeyword("PDS_VERSION_ID", Pvl::None)[0]; + QString pdsVersion = inputLabel.FindKeyword("PDS_VERSION_ID", Pvl::None)[0]; if(pdsVersion == "PDS3") { if(inputLabel.HasKeyword("LO:FIDUCIAL_ID", Pvl::Traverse)) { @@ -60,12 +60,12 @@ void TranslateLunarLabels(FileName &labelFile, Cube *ocube) { bandBinTransFile = transDir + "LoPdsBoresightImport.trn"; } else { - string msg = "[" + labelFile.name() + "] does not contain boresight or fiducial information"; + QString msg = "[" + labelFile.name() + "] does not contain boresight or fiducial information"; throw IException(IException::User, msg, _FILEINFO_); } } else { - string msg = "[" + labelFile.name() + "] contains unknown PDS version [" + + QString msg = "[" + labelFile.name() + "] contains unknown PDS version [" + pdsVersion + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -80,7 +80,7 @@ void TranslateLunarLabels(FileName &labelFile, Cube *ocube) { bandBinTransFile = transDir + "LoIsis2BoresightImport.trn"; } else { - string msg = "[" + labelFile.name() + "] does not contain boresight or fiducial information"; + QString msg = "[" + labelFile.name() + "] does not contain boresight or fiducial information"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -99,11 +99,11 @@ void TranslateLunarLabels(FileName &labelFile, Cube *ocube) { //Creates FiducialCoordinateMicron with the proper units if(!inputLabel.HasKeyword("LO:BORESIGHT_SAMPLE", Pvl::Traverse)) { - IString fcm = (string) inst.FindKeyword("FiducialCoordinateMicron"); - IString fcmUnits = fcm; - fcmUnits = IString::TrimHead("0123456789.", fcmUnits); - fcm = IString::TrimTail("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", fcm); - inst.FindKeyword("FiducialCoordinateMicron").SetValue((int)fcm, fcmUnits); + QString fcm = (QString) inst.FindKeyword("FiducialCoordinateMicron"); + QString fcmUnits = fcm; + fcmUnits.remove(QRegExp("^[0-9.]*")); + fcm.remove(QRegExp("[a-zA-Z]*$")); + inst.FindKeyword("FiducialCoordinateMicron").SetValue(fcm, fcmUnits); } // High Resolution & Fiducial Medium Case @@ -137,12 +137,12 @@ void TranslateLunarLabels(FileName &labelFile, Cube *ocube) { //What needs to be done if it contains Boresight info } - string instrumentID = inst.FindKeyword("InstrumentId"); - string spacecraftName = inst.FindKeyword("SpacecraftName"); + QString instrumentID = inst.FindKeyword("InstrumentId"); + QString spacecraftName = inst.FindKeyword("SpacecraftName"); //Determines the NaifFrameCode PvlGroup kerns("Kernels"); - IString frameCode; + QString frameCode; if(spacecraftName.compare("Lunar Orbiter 3") == 0) { frameCode = "-533"; } @@ -161,10 +161,10 @@ void TranslateLunarLabels(FileName &labelFile, Cube *ocube) { } //Create subframe and frame keywords - IString imgNumber = (string) inst.FindKeyword("ImageNumber"); - int subFrame = ((IString)imgNumber.substr(5)).ToInteger(); + QString imgNumber = (QString) inst.FindKeyword("ImageNumber"); + int subFrame = toInt(imgNumber.mid(5)); - inst.AddKeyword(PvlKeyword("SubFrame", subFrame)); + inst.AddKeyword(PvlKeyword("SubFrame", toString(subFrame))); //ImageNumber is auto translated, and no longer needed inst.DeleteKeyword("ImageNumber"); diff --git a/isis/src/lo/apps/lopdsgen/lopdsgen.cpp b/isis/src/lo/apps/lopdsgen/lopdsgen.cpp index 31c018b0b1..e1458a9ef9 100644 --- a/isis/src/lo/apps/lopdsgen/lopdsgen.cpp +++ b/isis/src/lo/apps/lopdsgen/lopdsgen.cpp @@ -72,8 +72,8 @@ void IsisMain() { // Add PRODUCT_ID keyword, the first part of the output filename FileName outFileNoExt(ui.GetFileName("TO")); outFileNoExt = outFileNoExt.removeExtension(); - IString productID(outFileNoExt.baseName()); - PvlKeyword productId("PRODUCT_ID", productID.UpCase()); + QString productID(outFileNoExt.baseName()); + PvlKeyword productId("PRODUCT_ID", productID.toUpper()); pdsLabel.AddKeyword(productId); // Translate the keywords from the original labels that go in this label @@ -88,7 +88,7 @@ void IsisMain() { PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); // Transfer the instrument group to the output cube - IString transDir = (string) dataDir["Lo"] + "/translations/"; + QString transDir = (QString) dataDir["Lo"] + "/translations/"; // Isis 3 cubes being exported for the first time if(!origLabel.HasKeyword("PRODUCT_TYPE", Pvl::Traverse)) { @@ -105,18 +105,18 @@ void IsisMain() { PvlKeyword &scanDensityRange = ingestion.FindKeyword("SCAN_DENSITY_RANGE"); // Change the units of SCAN_RESOLUTION from "um" to "" - string scanResolutionStr = scanResolution[0]; - unsigned umPos = scanResolutionStr.find("um"); - string resolution = scanResolutionStr.substr(0, umPos); + QString scanResolutionStr = scanResolution[0]; + int umPos = scanResolutionStr.indexOf("um"); + QString resolution = scanResolutionStr.mid(0, umPos); scanResolution[0] = resolution; scanResolution.SetUnits("micron"); scanResolution.SetName("LO:FILMSTRIP_SCAN_RESOLUTION"); // Break keyword SCAN_DENSITY_RANGE into two different parts - string scanDensityRangeStr = scanDensityRange[0]; - unsigned toPos = scanDensityRangeStr.find("_TO_"); - string range1 = scanDensityRangeStr.substr(0, toPos); - string range2 = scanDensityRangeStr.substr(toPos + 4); + QString scanDensityRangeStr = scanDensityRange[0]; + int toPos = scanDensityRangeStr.indexOf("_TO_"); + QString range1 = scanDensityRangeStr.mid(0, toPos); + QString range2 = scanDensityRangeStr.mid(toPos + 4); // Label translation for strips if(qube.FindGroup("ISIS_INSTRUMENT").HasKeyword("STRIP_NUMBER")) { @@ -135,9 +135,9 @@ void IsisMain() { PvlKeyword &outputMicron = qube.FindKeyword("OUTPUT_MICRON"); // Change the units of OUTPUT_MICRON from "um" to "" - string outputMicronStr = outputMicron[0]; - umPos = outputMicronStr.find("um"); - resolution = outputMicronStr.substr(0, umPos); + QString outputMicronStr = outputMicron[0]; + umPos = outputMicronStr.indexOf("um"); + resolution = outputMicronStr.mid(0, umPos); outputMicron[0] = resolution; outputMicron.SetUnits("micron"); outputMicron.SetName("LO:FILMSTRIP_SCAN_PROCESSING_RES"); @@ -147,12 +147,12 @@ void IsisMain() { // Calculate statistics on the cube to be processed and place // its MINIMUM and MAXIMUM into the output label p.CalculateStatistics(); - pdsLabel.FindObject("IMAGE").AddKeyword(PvlKeyword("MINIMUM", p.CubeStatistics(0)->Minimum()), Pvl::Replace); - pdsLabel.FindObject("IMAGE").AddKeyword(PvlKeyword("MAXIMUM", p.CubeStatistics(0)->Maximum()), Pvl::Replace); + pdsLabel.FindObject("IMAGE").AddKeyword(PvlKeyword("MINIMUM", toString(p.CubeStatistics(0)->Minimum())), Pvl::Replace); + pdsLabel.FindObject("IMAGE").AddKeyword(PvlKeyword("MAXIMUM", toString(p.CubeStatistics(0)->Maximum())), Pvl::Replace); } else { FileName inputFile(ui.GetFileName("FROM")); - string msg = "[" + inputFile.expanded() + "] does not appear to be an LO file. "; + QString msg = "[" + inputFile.expanded() + "] does not appear to be an LO file. "; throw IException(IException::User, msg, _FILEINFO_); } } @@ -175,7 +175,7 @@ void IsisMain() { } // Add to labels boresight or fiducial data - string bandBinTransFile; + QString bandBinTransFile; if(iCube->getLabel()->HasKeyword("FiducialId", Pvl::Traverse)) { bandBinTransFile = transDir + "LoFiducialExport.trn"; PvlTranslationManager bandLab(*(iCube->getLabel()), bandBinTransFile); @@ -184,9 +184,9 @@ void IsisMain() { // Change the units of FIDCUAIL_COORDINATE_MICRON from "um" to "" PvlKeyword &coordMicron = iCube->getLabel()->FindKeyword( "FiducialCoordinateMicron", Pvl::Traverse); - string coordMicronStr = coordMicron[0]; - unsigned umPos = coordMicronStr.find("um"); - string coord = coordMicronStr.substr(0, umPos); + QString coordMicronStr = coordMicron[0]; + int umPos = coordMicronStr.indexOf("um"); + QString coord = coordMicronStr.mid(0, umPos); coordMicron[0] = coord; coordMicron.SetUnits("micron"); coordMicron.SetName("LO:FIDUCIAL_COORDINATE_MICRON"); @@ -200,7 +200,7 @@ void IsisMain() { } else { FileName inputFile(ui.GetFileName("FROM")); - string msg = "[" + inputFile.expanded() + "] does not contain boresight or fiducial information. "; + QString msg = "[" + inputFile.expanded() + "] does not contain boresight or fiducial information. "; msg += "Try ingesting your data with lo2isis first."; throw IException(IException::User, msg, _FILEINFO_); } @@ -210,7 +210,7 @@ void IsisMain() { struct tm *tmbuf = gmtime(&startTime); char timestr[80]; strftime(timestr, 80, "%Y-%m-%dT%H:%M:%S", tmbuf); - string dateTime = (string) timestr; + QString dateTime = (QString) timestr; iTime tmpDateTime(dateTime); pdsLabel += PvlKeyword("PRODUCT_CREATION_TIME", tmpDateTime.UTC()); @@ -218,7 +218,7 @@ void IsisMain() { pdsLabel.AddKeyword(PvlKeyword("NOTE", ui.GetString("NOTE")), Pvl::Replace); } - // Add a keyword type (i.e., string, bool, int...) file to the PDS label Pvl + // Add a keyword type (i.e., QString, bool, int...) file to the PDS label Pvl PvlFormatPds *formatter = new PvlFormatPds(); formatter->SetCharLimit(128); formatter->Add(transDir + "LoExportFormatter.typ"); @@ -226,13 +226,13 @@ void IsisMain() { // Add an output format template (group, object, & keyword output order) to // the PDS PVL - IString formatDir = (string) dataDir["Lo"] + "/templates/labels/"; + QString formatDir = (QString) dataDir["Lo"] + "/templates/labels/"; pdsLabel.SetFormatTemplate(formatDir + "LoExportTemplate.pft"); // Write labels to output file FileName outFile(ui.GetFileName("TO", "img")); - string outFileName(outFile.expanded()); - ofstream oCube(outFileName.c_str()); + QString outFileName(outFile.expanded()); + ofstream oCube(outFileName.toAscii().data()); p.OutputLabel(oCube); p.StartProcess(oCube); oCube.close(); diff --git a/isis/src/lo/objs/LoCameraFiducialMap/LoCameraFiducialMap.cpp b/isis/src/lo/objs/LoCameraFiducialMap/LoCameraFiducialMap.cpp index f19a19889b..e13dcb1f3d 100644 --- a/isis/src/lo/objs/LoCameraFiducialMap/LoCameraFiducialMap.cpp +++ b/isis/src/lo/objs/LoCameraFiducialMap/LoCameraFiducialMap.cpp @@ -53,10 +53,10 @@ namespace Isis { PvlKeyword &fYs = inst["FiducialYCoordinates"]; for(int i = 0; i < fSamps.Size(); i++) { - p_fidSamples.push_back(fSamps[i]); - p_fidLines.push_back(fLines[i]); - p_fidXCoords.push_back(fXs[i]); - p_fidYCoords.push_back(fYs[i]); + p_fidSamples.push_back(toDouble(fSamps[i])); + p_fidLines.push_back(toDouble(fLines[i])); + p_fidXCoords.push_back(toDouble(fXs[i])); + p_fidYCoords.push_back(toDouble(fYs[i])); } } catch(IException &e) { diff --git a/isis/src/lo/objs/LoHighCamera/LoHighCamera.cpp b/isis/src/lo/objs/LoHighCamera/LoHighCamera.cpp index 8b45ba374a..16a797f121 100644 --- a/isis/src/lo/objs/LoHighCamera/LoHighCamera.cpp +++ b/isis/src/lo/objs/LoHighCamera/LoHighCamera.cpp @@ -50,8 +50,8 @@ namespace Isis { NaifStatus::CheckErrors(); // Get the Instrument label information needed to define the camera for this frame PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); - IString spacecraft = (string)inst["SpacecraftName"]; - IString instId = (string)inst["InstrumentId"]; + QString spacecraft = (QString)inst["SpacecraftName"]; + QString instId = (QString)inst["InstrumentId"]; // Turn off the aberration corrections for the instrument position object instrumentPosition()->SetAberrationCorrection("NONE"); @@ -61,7 +61,7 @@ namespace Isis { SetPixelPitch(); // Get the start time in et - double time = iTime((string)inst["StartTime"]).Et(); + double time = iTime((QString)inst["StartTime"]).Et(); // Setup focal plane map LoCameraFiducialMap fid(inst, naifIkCode()); diff --git a/isis/src/lo/objs/LoHighCamera/LoHighDistortionMap.cpp b/isis/src/lo/objs/LoHighCamera/LoHighDistortionMap.cpp index d689d4af86..4bef683693 100644 --- a/isis/src/lo/objs/LoHighCamera/LoHighDistortionMap.cpp +++ b/isis/src/lo/objs/LoHighCamera/LoHighDistortionMap.cpp @@ -95,8 +95,8 @@ namespace Isis { void LoHighDistortionMap::SetDistortion(const int naifIkCode) { // Get the perspective correction factors for x and y and the distortion // center (point of symmetry of distortion) - string perskey = "INS" + IString(naifIkCode) + "_PERSPECTIVE_FACTORS"; - string centkey = "INS" + IString(naifIkCode) + "_POINT_OF_SYMMETRY"; + QString perskey = "INS" + toString(naifIkCode) + "_PERSPECTIVE_FACTORS"; + QString centkey = "INS" + toString(naifIkCode) + "_POINT_OF_SYMMETRY"; p_xPerspective = p_camera->Spice::getDouble(perskey, 0); p_yPerspective = p_camera->Spice::getDouble(perskey, 1); p_x0 = p_camera->Spice::getDouble(centkey, 0); diff --git a/isis/src/lo/objs/LoHighCamera/unitTest.cpp b/isis/src/lo/objs/LoHighCamera/unitTest.cpp index 706134728f..2f5fcc70f1 100644 --- a/isis/src/lo/objs/LoHighCamera/unitTest.cpp +++ b/isis/src/lo/objs/LoHighCamera/unitTest.cpp @@ -68,9 +68,9 @@ int main(void) { const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); // approximate 1 tenth of a second since Lunar Orbiter did not provide double exposureDuration = .1; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/lo/objs/LoMediumCamera/LoMediumCamera.cpp b/isis/src/lo/objs/LoMediumCamera/LoMediumCamera.cpp index 1fa3b17482..6ade6abdc3 100644 --- a/isis/src/lo/objs/LoMediumCamera/LoMediumCamera.cpp +++ b/isis/src/lo/objs/LoMediumCamera/LoMediumCamera.cpp @@ -51,8 +51,8 @@ namespace Isis { NaifStatus::CheckErrors(); // Get the Instrument label information needed to define the camera for this frame PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); - IString spacecraft = (string)inst["SpacecraftName"]; - IString instId = (string)inst["InstrumentId"]; + QString spacecraft = inst["SpacecraftName"]; + QString instId = inst["InstrumentId"]; LoMediumCamera::FocalPlaneMapType type; if(inst.HasKeyword("FiducialSamples")) { @@ -75,7 +75,7 @@ namespace Isis { SetPixelPitch(); // Get the start time in et - double time = iTime((string)inst["StartTime"]).Et(); + double time = iTime((QString)inst["StartTime"]).Et(); // Setup focal plane map if(type == Fiducial) { diff --git a/isis/src/lo/objs/LoMediumCamera/LoMediumDistortionMap.cpp b/isis/src/lo/objs/LoMediumCamera/LoMediumDistortionMap.cpp index 5a7b68c7c7..864cb185ff 100644 --- a/isis/src/lo/objs/LoMediumCamera/LoMediumDistortionMap.cpp +++ b/isis/src/lo/objs/LoMediumCamera/LoMediumDistortionMap.cpp @@ -91,7 +91,7 @@ namespace Isis { p_camera->FocalPlaneMap()->SetFocalPlane(0., 0.); double boreS = p_camera->FocalPlaneMap()->DetectorSample(); double boreL = p_camera->FocalPlaneMap()->DetectorLine(); - string centkey = "INS" + IString(naifIkCode) + "_POINT_OF_SYMMETRY"; + QString centkey = "INS" + toString(naifIkCode) + "_POINT_OF_SYMMETRY"; p_sample0 = boreS - p_camera->Spice::getDouble(centkey, 0); p_line0 = boreL + p_camera->Spice::getDouble(centkey, 1); diff --git a/isis/src/lo/objs/LoMediumCamera/unitTest.cpp b/isis/src/lo/objs/LoMediumCamera/unitTest.cpp index a6135c5af7..37aaca63bb 100644 --- a/isis/src/lo/objs/LoMediumCamera/unitTest.cpp +++ b/isis/src/lo/objs/LoMediumCamera/unitTest.cpp @@ -68,9 +68,9 @@ int main(void) { const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); // approximate 1 tenth of a second since Lunar Orbiter did not provide double exposureDuration = .1; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/local/apps/basemapmos/basemapmos.cpp b/isis/src/local/apps/basemapmos/basemapmos.cpp index 747c7695ce..2c019bea4b 100644 --- a/isis/src/local/apps/basemapmos/basemapmos.cpp +++ b/isis/src/local/apps/basemapmos/basemapmos.cpp @@ -3,6 +3,8 @@ #include #include +#include + #include "Application.h" #include "Cube.h" #include "FileList.h" @@ -17,35 +19,35 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); FileList cubes; cubes.read(ui.GetFileName("FROMLIST")); - string PRIORITY = ui.GetString("PRIORITY"); - string HNS1 = ui.GetAsString("HNS1"); - string HNL1 = ui.GetAsString("HNL1"); - string HNS2 = ui.GetAsString("HNS2"); - string HNL2 = ui.GetAsString("HNL2"); - string LNS = ui.GetAsString("LNS"); - string LNL = ui.GetAsString("LNL"); - string GRANGE = ui.GetString("GRANGE"); - string MINLAT, MAXLAT, MINLON, MAXLON; + QString PRIORITY = ui.GetString("PRIORITY"); + QString HNS1 = ui.GetAsString("HNS1"); + QString HNL1 = ui.GetAsString("HNL1"); + QString HNS2 = ui.GetAsString("HNS2"); + QString HNL2 = ui.GetAsString("HNL2"); + QString LNS = ui.GetAsString("LNS"); + QString LNL = ui.GetAsString("LNL"); + QString GRANGE = ui.GetString("GRANGE"); + QString MINLAT, MAXLAT, MINLON, MAXLON; if(GRANGE == "USER") { MINLAT = ui.GetAsString("MINLAT"); MAXLAT = ui.GetAsString("MAXLAT"); MINLON = ui.GetAsString("MINLON"); MAXLON = ui.GetAsString("MAXLON"); } - string MATCHBANDBIN = ui.GetAsString("MATCHBANDBIN"); + QString MATCHBANDBIN = ui.GetAsString("MATCHBANDBIN"); // Sets up the pathName to be used for most application calls - string pathName = FileName("$TEMPORARY/").path() + "/"; - string cubeListBaseName = pathName + FileName(ui.GetFileName("FROMLIST")).baseName(); + QString pathName = FileName("$TEMPORARY/").path() + "/"; + QString cubeListBaseName = pathName + FileName(ui.GetFileName("FROMLIST")).baseName(); //Creates the first highpass cubes std::ofstream firstHighPassList; - string firstHighPass(cubeListBaseName + "_FirstHighPassList.lis"); - firstHighPassList.open(firstHighPass.c_str()); + QString firstHighPass(cubeListBaseName + "_FirstHighPassList.lis"); + firstHighPassList.open(firstHighPass.toAscii().data()); for (int i = 0; i < cubes.size(); i++) { FileName inFile = cubes[i]; - string outParam = pathName + inFile.baseName() + "_hpffirst.cub"; - string parameters = "FROM=" + inFile.expanded() + QString outParam = pathName + inFile.baseName() + "_hpffirst.cub"; + QString parameters = "FROM=" + inFile.expanded() + " TO=" + outParam + " SAMPLES= " + HNS1 + " LINES= " + HNL1; @@ -57,12 +59,12 @@ void IsisMain() { //Creates the second highpass cubes std::ofstream secondHighPassList; - string secondHighPass(cubeListBaseName + "_SecondHighPassList.lis"); - secondHighPassList.open(secondHighPass.c_str()); + QString secondHighPass(cubeListBaseName + "_SecondHighPassList.lis"); + secondHighPassList.open(secondHighPass.toAscii().data()); for(int i = 0; i < cubes.size(); i++) { FileName inFile = cubes[i]; - string outParam = pathName + inFile.baseName() + "_hpfsecond.cub"; - string parameters = "FROM=" + inFile.expanded() + QString outParam = pathName + inFile.baseName() + "_hpfsecond.cub"; + QString parameters = "FROM=" + inFile.expanded() + " TO=" + outParam + " SAMPLES= " + HNS2 + " LINES= " + HNL2; @@ -73,7 +75,7 @@ void IsisMain() { secondHighPassList.close(); //Makes a mosaic out of the first highpass cube filelist - string parameters = "FROM= " + cubeListBaseName + "_FirstHighPassList.lis MOSAIC=" + QString parameters = "FROM= " + cubeListBaseName + "_FirstHighPassList.lis MOSAIC=" + cubeListBaseName + "_newmosFirst.cub" + " MATCHBANDBIN=" + MATCHBANDBIN + " GRANGE= " + GRANGE; @@ -133,22 +135,22 @@ void IsisMain() { //Will remove all of the temp files by default if(ui.GetBoolean("REMOVETEMP")) { - string newmosFirst(cubeListBaseName + "_newmosFirst.cub"); - string newmosSecond(cubeListBaseName + "_newmosSecond.cub"); - string lpfmos(cubeListBaseName + "_lpfmos.cub"); - string untrimmedmoc(cubeListBaseName + "_untrimmedmoc.cub"); - remove(firstHighPass.c_str()); - remove(secondHighPass.c_str()); - remove(newmosFirst.c_str()); - remove(newmosSecond.c_str()); - remove(lpfmos.c_str()); - remove(untrimmedmoc.c_str()); + QString newmosFirst(cubeListBaseName + "_newmosFirst.cub"); + QString newmosSecond(cubeListBaseName + "_newmosSecond.cub"); + QString lpfmos(cubeListBaseName + "_lpfmos.cub"); + QString untrimmedmoc(cubeListBaseName + "_untrimmedmoc.cub"); + QFile::remove(firstHighPass); + QFile::remove(secondHighPass); + QFile::remove(newmosFirst); + QFile::remove(newmosSecond); + QFile::remove(lpfmos); + QFile::remove(untrimmedmoc); for(int i = 0; i < cubes.size(); i++) { FileName inFile = cubes[i]; - string hpffirst(pathName + inFile.baseName() + "_hpffirst.cub"); - string hpfsecond(pathName + inFile.baseName() + "_hpfsecond.cub"); - remove(hpffirst.c_str()); - remove(hpfsecond.c_str()); + QString hpffirst(pathName + inFile.baseName() + "_hpffirst.cub"); + QString hpfsecond(pathName + inFile.baseName() + "_hpfsecond.cub"); + QFile::remove(hpffirst); + QFile::remove(hpfsecond); } } diff --git a/isis/src/local/apps/camcoeffs/camcoeffs.cpp b/isis/src/local/apps/camcoeffs/camcoeffs.cpp index 57988d2ed8..989ab9d8e1 100644 --- a/isis/src/local/apps/camcoeffs/camcoeffs.cpp +++ b/isis/src/local/apps/camcoeffs/camcoeffs.cpp @@ -120,18 +120,18 @@ void IsisMain() { throw IException(IException::Unknown, "Not enough information", _FILEINFO_); } - IString inEquationX = "X = " + IString(eq1[0]); - inEquationX += " + " + IString(eq1[1]) + "S"; - inEquationX += " + " + IString(eq1[2]) + "L"; - IString inEquationY = "Y = " + IString(eq2[0]); - inEquationY += " + " + IString(eq2[1]) + "S"; - inEquationY += " + " + IString(eq2[2]) + "L"; - IString outEquationS = "S = " + IString(res1[0]); - outEquationS += " + " + IString(res1[1]) + "X"; - outEquationS += " + " + IString(res1[2]) + "Y"; - IString outEquationL = "L = " + IString(res2[0]); - outEquationL += " + " + IString(res2[1]) + "X"; - outEquationL += " + " + IString(res2[2]) + "Y"; + QString inEquationX = "X = " + toString(eq1[0]); + inEquationX += " + " + toString(eq1[1]) + "S"; + inEquationX += " + " + toString(eq1[2]) + "L"; + QString inEquationY = "Y = " + toString(eq2[0]); + inEquationY += " + " + toString(eq2[1]) + "S"; + inEquationY += " + " + toString(eq2[2]) + "L"; + QString outEquationS = "S = " + toString(res1[0]); + outEquationS += " + " + toString(res1[1]) + "X"; + outEquationS += " + " + toString(res1[2]) + "Y"; + QString outEquationL = "L = " + toString(res2[0]); + outEquationL += " + " + toString(res2[1]) + "X"; + outEquationL += " + " + toString(res2[2]) + "Y"; // check.... /* @@ -153,21 +153,21 @@ void IsisMain() { if(ui.WasEntered("IAKCODE")) { PvlKeyword naifFormatX("INS" + ui.GetString("IAKCODE") + "_TRANSX"); - naifFormatX += eq1[0]; - naifFormatX += eq1[1]; - naifFormatX += eq1[2]; + naifFormatX += toString(eq1[0]); + naifFormatX += toString(eq1[1]); + naifFormatX += toString(eq1[2]); PvlKeyword naifFormatY("INS" + ui.GetString("IAKCODE") + "_TRANSY"); - naifFormatY += eq2[0]; - naifFormatY += eq2[1]; - naifFormatY += eq2[2]; + naifFormatY += toString(eq2[0]); + naifFormatY += toString(eq2[1]); + naifFormatY += toString(eq2[2]); PvlKeyword naifFormatS("INS" + ui.GetString("IAKCODE") + "_ITRANSS"); - naifFormatS += res1[0]; - naifFormatS += res1[1]; - naifFormatS += res1[2]; + naifFormatS += toString(res1[0]); + naifFormatS += toString(res1[1]); + naifFormatS += toString(res1[2]); PvlKeyword naifFormatL("INS" + ui.GetString("IAKCODE") + "_ITRANSL"); - naifFormatL += res2[0]; - naifFormatL += res2[1]; - naifFormatL += res2[2]; + naifFormatL += toString(res2[0]); + naifFormatL += toString(res2[1]); + naifFormatL += toString(res2[2]); res += naifFormatX; res += naifFormatY; diff --git a/isis/src/local/apps/cissua2isis/cissua2isis.cpp b/isis/src/local/apps/cissua2isis/cissua2isis.cpp index 1e888a1201..259551843a 100644 --- a/isis/src/local/apps/cissua2isis/cissua2isis.cpp +++ b/isis/src/local/apps/cissua2isis/cissua2isis.cpp @@ -1,6 +1,6 @@ #include "Isis.h" -#include +#include #include "ProcessImportPds.h" #include "Pvl.h" @@ -42,10 +42,10 @@ void IsisMain() { PvlGroup &inst = outLabel->FindGroup("Instrument", Isis::PvlObject::Traverse); PvlKeyword &start = inst.FindKeyword("StartTime"); PvlKeyword &stop = inst.FindKeyword("StopTime"); - IString startValue = start[0]; - IString stopValue = stop[0]; - start[0] = startValue.TrimTail("Z"); - stop[0] = stopValue.TrimTail("Z"); + QString startValue = start[0]; + QString stopValue = stop[0]; + start[0] = startValue.remove(QRegExp("Z$")); + stop[0] = stopValue.remove(QRegExp("Z$")); // All finished with the ImportPds object p.EndProcess(); @@ -100,11 +100,10 @@ void CreateStretchPairs() { // Create the stretch pairs stretch.ClearPairs(); for(int i = 0; i < stretchPairs->LineCount(); i++) { - IString line; + QString line; stretchPairs->GetLine(line, true); //assigns value to line - int temp1 = line.Token(" "); - int temp2 = line.Trim(" "); - stretch.AddPair(temp1, temp2); + QStringList pairStrings = line.split(" "); + stretch.AddPair(toInt(pairStrings[0]), toInt(pairStrings[1])); } stretchPairs->Close(); @@ -122,7 +121,7 @@ void TranslateUoACassiniLabels(Pvl &labelPvl, Cube *ocube) { // Get the directory where the CISS translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Cassini"] + "/translations/"; + QString transDir = (QString) dataDir["Cassini"] + "/translations/"; // Translate FileName transFile(transDir + "cissua2isis.trn"); @@ -133,12 +132,12 @@ void TranslateUoACassiniLabels(Pvl &labelPvl, Cube *ocube) { // Create the correct SpacecraftClockCount value PvlGroup &inInst = labelPvl.FindGroup("ISIS_INSTRUMENT", Pvl::Traverse); - string scc = inInst.FindKeyword("SPACECRAFT_CLOCK_CNT_PARTITION"); - scc += "/" + (string) inInst.FindKeyword("ORIGINAL_SPACECRAFT_CLOCK_START_COUN"); + QString scc = inInst.FindKeyword("SPACECRAFT_CLOCK_CNT_PARTITION"); + scc += "/" + (QString) inInst.FindKeyword("ORIGINAL_SPACECRAFT_CLOCK_START_COUN"); inst.AddKeyword(PvlKeyword("SpacecraftClockCount", scc)); // dataConv is used later - string dataConv = inInst.FindKeyword("DATA_CONVERSION_TYPE"); + QString dataConv = inInst.FindKeyword("DATA_CONVERSION_TYPE"); inst.AddKeyword(PvlKeyword("DataConversionType", dataConv)); //to add an array of values @@ -148,37 +147,37 @@ void TranslateUoACassiniLabels(Pvl &labelPvl, Cube *ocube) { //two possible label names for same keyword if(labelPvl.HasKeyword("ENCODING_TYPE")) { - string encodingType = labelPvl.FindKeyword("ENCODING_TYPE", Pvl::Traverse); + QString encodingType = labelPvl.FindKeyword("ENCODING_TYPE", Pvl::Traverse); inst.AddKeyword(PvlKeyword("CompressionType", encodingType)); } else { - string instCmprsType = labelPvl.FindKeyword("INST_CMPRS_TYPE", Pvl::Traverse); + QString instCmprsType = labelPvl.FindKeyword("INST_CMPRS_TYPE", Pvl::Traverse); inst.AddKeyword(PvlKeyword("CompressionType", instCmprsType)); } - string flightSoftware = labelPvl.FindKeyword("FLIGHT_SOFTWARE_VERSION_ID", Pvl::Traverse); + QString flightSoftware = labelPvl.FindKeyword("FLIGHT_SOFTWARE_VERSION_ID", Pvl::Traverse); inst.AddKeyword(PvlKeyword("FlightSoftwareVersionId", flightSoftware)); // Sets the needed Kernel FrameCode - string instrumentID = inst.FindKeyword("InstrumentId"); + QString instrumentID = inst.FindKeyword("InstrumentId"); PvlGroup kerns("Kernels"); if(instrumentID == "ISSNA") { - kerns += PvlKeyword("NaifFrameCode", -82360); + kerns += PvlKeyword("NaifFrameCode", toString(-82360)); } else if(instrumentID == "ISSWA") { - kerns += PvlKeyword("NaifFrameCode", -82361); + kerns += PvlKeyword("NaifFrameCode", toString(-82361)); } else { - string msg = "CISS2ISIS only imports Cassini ISS narrow "; + QString msg = "CISS2ISIS only imports Cassini ISS narrow "; msg += "angle or wide angle images"; throw IException(IException::User, msg, _FILEINFO_); } outLabel->FindObject("IsisCube").AddGroup(kerns); // Create BandBin group - IString filter = labelPvl.FindKeyword("BAND_BIN_FILTER_NAME", Isis::PvlObject::Traverse)[0]; - filter = filter.substr(0, 3) + "/" + filter.substr(4); - string cameraAngleDefs; + QString filter = labelPvl.FindKeyword("BAND_BIN_FILTER_NAME", Isis::PvlObject::Traverse)[0]; + filter = filter.mid(0, 3) + "/" + filter.mid(4); + QString cameraAngleDefs; if(instrumentID.at(3) == 'N') { cameraAngleDefs = transDir + "narrowAngle.def"; } @@ -191,28 +190,27 @@ void TranslateUoACassiniLabels(Pvl &labelPvl, Cube *ocube) { int numLines = cameraAngle.LineCount(); bool foundfilter = false; for(int i = 0; i < numLines; i++) { - IString line; + QString line; cameraAngle.GetLine(line, true); - IString token = line.Token(" "); - if(token == filter) { - line = line.Trim(" "); - center = line.Token(" "); - line = line.Trim(" "); - width = line.Token(" "); + QStringList tokens = line.simplified().trimmed().split(" "); + + if (tokens.count() > 2 && tokens[0] == filter) { + center = toDouble(tokens[1]); + width = toDouble(tokens[2]); foundfilter = true; break; } } if(!foundfilter) { - string msg = "Camera Angle Lookup Failed: "; + QString msg = "Camera Angle Lookup Failed: "; msg += "Filter combination " + filter + " unknown."; throw IException(IException::User, msg, _FILEINFO_); } PvlGroup bandBin("BandBin"); bandBin += PvlKeyword("FilterName", filter); - bandBin += PvlKeyword("OriginalBand", 1); - bandBin += PvlKeyword("Center", center); - bandBin += PvlKeyword("Width", width); + bandBin += PvlKeyword("OriginalBand", "1"); + bandBin += PvlKeyword("Center", toString(center)); + bandBin += PvlKeyword("Width", toString(width)); outLabel->FindObject("IsisCube").AddGroup(bandBin); } diff --git a/isis/src/local/apps/kaguyami2isis/kaguyami2isis.cpp b/isis/src/local/apps/kaguyami2isis/kaguyami2isis.cpp index ef74142c98..18a61d0550 100644 --- a/isis/src/local/apps/kaguyami2isis/kaguyami2isis.cpp +++ b/isis/src/local/apps/kaguyami2isis/kaguyami2isis.cpp @@ -24,15 +24,15 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); FileName inFile = ui.GetFileName("FROM"); - IString id; + QString id; Pvl lab(inFile.expanded()); try { - id = (string) lab.FindKeyword("DATA_SET_ID"); + id = (QString) lab.FindKeyword("DATA_SET_ID"); } catch(IException &e) { - string msg = "Unable to read [DATA_SET_ID] from input file [" + - inFile.expanded() + "]"; + QString msg = "Unable to read [DATA_SET_ID] from input file [" + + inFile.expanded() + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } @@ -45,7 +45,7 @@ void IsisMain() { // Get the directory where the Kaguya MI translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Kaguya"] + "/translations/"; + QString transDir = (QString) dataDir["Kaguya"] + "/translations/"; Pvl inputLabel(inFile.expanded()); Pvl *outputLabel = outcube->getLabel(); FileName transFile; @@ -61,23 +61,23 @@ void IsisMain() { instrumentXlater.Auto(*(outputLabel)); //trim trailing z's from the time strings PvlGroup &instGroup(outputLabel->FindGroup("Instrument",Pvl::Traverse)); - IString timeString; + QString timeString; //StartTime PvlKeyword &startTimeKeyword=instGroup["StartTime"]; timeString = startTimeKeyword[0]; - startTimeKeyword.SetValue( timeString.substr(0,timeString.find_last_of("Z")) ); + startTimeKeyword.SetValue( timeString.mid(0,timeString.lastIndexOf("Z")) ); //StartTimeRaw PvlKeyword &startTimeRawKeyword=instGroup["StartTimeRaw"]; timeString = startTimeRawKeyword[0]; - startTimeRawKeyword.SetValue( timeString.substr(0,timeString.find_last_of("Z")) ); + startTimeRawKeyword.SetValue( timeString.mid(0,timeString.lastIndexOf("Z")) ); //StopTime PvlKeyword &stopTimeKeyword=instGroup["StopTime"]; timeString = stopTimeKeyword[0]; - stopTimeKeyword.SetValue( timeString.substr(0,timeString.find_last_of("Z")) ); + stopTimeKeyword.SetValue( timeString.mid(0,timeString.lastIndexOf("Z")) ); //StopTimeRaw PvlKeyword &stopTimeRawKeyword=instGroup["StopTimeRaw"]; timeString = stopTimeRawKeyword[0]; - stopTimeRawKeyword.SetValue( timeString.substr(0,timeString.find_last_of("Z")) ); + stopTimeRawKeyword.SetValue( timeString.mid(0,timeString.lastIndexOf("Z")) ); // Translate the BandBin group @@ -88,24 +88,24 @@ void IsisMain() { //Set up the Kernels group PvlGroup kern("Kernels"); if (lab.FindKeyword("INSTRUMENT_ID")[0] == "MI-VIS") { - kern += PvlKeyword("NaifFrameCode", -131335); - kern += PvlKeyword("NaifCkCode", -131330); + kern += PvlKeyword("NaifFrameCode", toString(-131335)); + kern += PvlKeyword("NaifCkCode", toString(-131330)); } else if (lab.FindKeyword("INSTRUMENT_ID")[0] == "MI-NIR") { - kern += PvlKeyword("NaifFrameCode", -131341); - kern += PvlKeyword("NaifCkCode", -131340); + kern += PvlKeyword("NaifFrameCode", toString(-131341)); + kern += PvlKeyword("NaifCkCode", toString(-131340)); } //At the time of this writing there was no expectation that Kaguya ever did any binning // so this is check to make sure an error is thrown if an image was binned if (lab.FindKeyword("INSTRUMENT_ID")[0] == "MI-VIS" && outcube->getSampleCount() != 962 ) { - string msg = "Input file [" + inFile.expanded() + "]" + " appears to be binned. Binning was " - "unexpected, and is unsupported by the camera model"; + QString msg = "Input file [" + inFile.expanded() + "]" + " appears to be binned. Binning was " + "unexpected, and is unsupported by the camera model"; throw IException(IException::Unknown, msg, _FILEINFO_); } if (lab.FindKeyword("INSTRUMENT_ID")[0] == "MI-NIR" && outcube->getSampleCount() != 320 ) { - string msg = "Input file [" + inFile.expanded() + "]" + " appears to be binned. Binning was " - "unexpected, and is unsupported by the camera model"; + QString msg = "Input file [" + inFile.expanded() + "]" + " appears to be binned. Binning was " + "unexpected, and is unsupported by the camera model"; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/local/apps/polytool/polytool.cpp b/isis/src/local/apps/polytool/polytool.cpp index 6ae7ac7c51..801b331ad8 100644 --- a/isis/src/local/apps/polytool/polytool.cpp +++ b/isis/src/local/apps/polytool/polytool.cpp @@ -13,7 +13,7 @@ using namespace std; using namespace Isis; -geos::geom::Geometry *GetPolygon(std::string name); +geos::geom::Geometry *GetPolygon(QString name); void IsisMain() { UserInterface &ui = Application::GetUserInterface(); @@ -67,9 +67,9 @@ void IsisMain() { if(!result.empty()) { // Output the resultant polygon - std::string outname = ui.GetFileName("TO"); + QString outname = ui.GetFileName("TO"); std::ofstream outfile; - outfile.open(outname.c_str()); + outfile.open(outname.toAscii().data()); outfile << result; outfile.close(); if(outfile.fail()) { @@ -88,9 +88,9 @@ void IsisMain() { * * @return geos::geom::MultiPolygon* */ -geos::geom::Geometry *GetPolygon(std::string name) { +geos::geom::Geometry *GetPolygon(QString name) { ifstream is; - is.open(name.c_str()); + is.open(name.toAscii().data()); std::string fileData = ""; while(is.good()) { diff --git a/isis/src/local/objs/KaguyaMiCamera/KaguyaMiCamera.cpp b/isis/src/local/objs/KaguyaMiCamera/KaguyaMiCamera.cpp index 07c226b33a..fefe19601f 100644 --- a/isis/src/local/objs/KaguyaMiCamera/KaguyaMiCamera.cpp +++ b/isis/src/local/objs/KaguyaMiCamera/KaguyaMiCamera.cpp @@ -47,13 +47,13 @@ namespace Isis { SetFocalLength(); //Kaguya IK kernal uses INS-131???_PIXEL_SIZE instead of PIXEL_PITCH - IString ikernKey = "INS" + IString((int)naifIkCode()) + "_PIXEL_SIZE"; + QString ikernKey = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE"; SetPixelPitch(getDouble(ikernKey)); // Get the start time from labels PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - IString stime = (string)inst["StartTime"]; + QString stime = (QString)inst["StartTime"]; SpiceDouble etStart=0; if(stime != "NULL") { @@ -78,7 +78,7 @@ namespace Isis { // Setup focal plane map CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); // Retrieve boresight location from instrument kernel (IK) (addendum?) - ikernKey = "INS" + IString((int)naifIkCode()) + "_CENTER"; + ikernKey = "INS" + toString(naifIkCode()) + "_CENTER"; double sampleBoreSight = getDouble(ikernKey,0); double lineBoreSight = getDouble(ikernKey,1)-1.0; diff --git a/isis/src/local/objs/KaguyaMiCamera/KaguyaMiCameraDistortionMap.cpp b/isis/src/local/objs/KaguyaMiCamera/KaguyaMiCameraDistortionMap.cpp index 1d50ce3b53..1ddfc019cd 100644 --- a/isis/src/local/objs/KaguyaMiCamera/KaguyaMiCameraDistortionMap.cpp +++ b/isis/src/local/objs/KaguyaMiCamera/KaguyaMiCameraDistortionMap.cpp @@ -53,15 +53,15 @@ namespace Isis { else m_numDistCoef = 4; //NIR camera has 4 distortion coefs //read the distortion coefs from the NAIF Kernels - std::string naifXKey = "INS" + Isis::IString(naifIkCode) + "_DISTORTION_COEF_X"; - std::string naifYKey = "INS" + Isis::IString(naifIkCode) + "_DISTORTION_COEF_Y"; + QString naifXKey = "INS" + toString(naifIkCode) + "_DISTORTION_COEF_X"; + QString naifYKey = "INS" + toString(naifIkCode) + "_DISTORTION_COEF_Y"; for (int i=0; i < m_numDistCoef; i++) { m_distCoefX[i] = p_camera->getDouble(naifXKey,i); m_distCoefY[i] = p_camera->getDouble(naifYKey,i); } //now read the boresights, or what I would typicall call the principal point offsets - naifXKey = "INS" + Isis::IString(naifIkCode) + "_BORESIGHT"; + naifXKey = "INS" + toString(naifIkCode) + "_BORESIGHT"; m_boreX = p_camera->getDouble(naifXKey, 0); m_boreY = p_camera->getDouble(naifXKey, 1); } diff --git a/isis/src/lro/apps/lronac2isis/lronac2isis.cpp b/isis/src/lro/apps/lronac2isis/lronac2isis.cpp index 99a32f553e..39379b44b7 100644 --- a/isis/src/lro/apps/lronac2isis/lronac2isis.cpp +++ b/isis/src/lro/apps/lronac2isis/lronac2isis.cpp @@ -31,21 +31,21 @@ void IsisMain() { //Check that the file comes from the right camera UserInterface &ui = Application::GetUserInterface(); FileName inFile = ui.GetFileName("FROM"); - IString id; + QString id; try { Pvl lab(inFile.expanded()); if(lab.HasKeyword("DATA_SET_ID")) - id = (string) lab.FindKeyword("DATA_SET_ID"); + id = (QString) lab.FindKeyword("DATA_SET_ID"); else { - string msg = "Unable to read [DATA_SET_ID] from input file [" + inFile.expanded() + "]"; + QString msg = "Unable to read [DATA_SET_ID] from input file [" + inFile.expanded() + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } //Checks if in file is rdr bool projected = lab.HasObject("IMAGE_MAP_PROJECTION"); if(projected) { - string msg = "[" + inFile.name() + "] appears to be an rdr file."; + QString msg = "[" + inFile.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -56,17 +56,17 @@ void IsisMain() { btermKeyword = lab.FindKeyword("LRO:BTERM"); if(mtermKeyword.Size() != xtermKeyword.Size() || btermKeyword.Size() != xtermKeyword.Size()) { - string msg = "The decompanding terms do not have the same dimensions"; + QString msg = "The decompanding terms do not have the same dimensions"; throw IException(IException::Io, msg, _FILEINFO_); } for(int i = 0; i < xtermKeyword.Size(); i++) { - g_xterm.push_back(xtermKeyword[i]); - g_mterm.push_back(mtermKeyword[i]); - g_bterm.push_back(btermKeyword[i]); + g_xterm.push_back(toDouble(xtermKeyword[i])); + g_mterm.push_back(toDouble(mtermKeyword[i])); + g_bterm.push_back(toDouble(btermKeyword[i])); } - double versionId = (double)(lab.FindKeyword("PRODUCT_VERSION_ID")[0]).Trim("v"); + double versionId = toDouble(lab.FindKeyword("PRODUCT_VERSION_ID")[0].remove(QRegExp("^v"))); if(lab.FindKeyword("FRAME_ID")[0] == "RIGHT" && versionId < 1.30) g_flip = true; @@ -74,15 +74,13 @@ void IsisMain() { g_flip = false; } catch(IException &e) { - string msg = "The PDS header is missing important keyword(s)."; + QString msg = "The PDS header is missing important keyword(s)."; throw IException(IException::Io, msg, _FILEINFO_); } - id.ConvertWhiteSpace(); - id.Compress(); - id.Trim(" "); - if(id.substr(13, 3) != "EDR") { - string msg = "Input file [" + inFile.expanded() + "] does not appear to be " + id = id.simplified().trimmed(); + if(id.mid(13, 3) != "EDR") { + QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + "in LROC-NAC EDR format. DATA_SET_ID is [" + id + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -186,7 +184,7 @@ void TranslateLrocNacLabels(FileName &labelFile, Cube *ocube) { Pvl outLabel; //Set up the directory where the translations are PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Lro"] + "/translations/"; + QString transDir = (QString) dataDir["Lro"] + "/translations/"; Pvl labelPvl(labelFile.expanded()); //Translate the Instrument group @@ -209,9 +207,9 @@ void TranslateLrocNacLabels(FileName &labelFile, Cube *ocube) { //Set up the Kernels group PvlGroup kern("Kernels"); if(lab.FindKeyword("FRAME_ID")[0] == "LEFT") - kern += PvlKeyword("NaifFrameCode", -85600); + kern += PvlKeyword("NaifFrameCode", "-85600"); else - kern += PvlKeyword("NaifFrameCode", -85610); + kern += PvlKeyword("NaifFrameCode", "-85610"); PvlGroup inst = outLabel.FindGroup("Instrument", Pvl::Traverse); if(lab.FindKeyword("FRAME_ID")[0] == "LEFT") { diff --git a/isis/src/lro/apps/lronac2pds/lronac2pds.cpp b/isis/src/lro/apps/lronac2pds/lronac2pds.cpp index 14373c845e..7216e75d81 100644 --- a/isis/src/lro/apps/lronac2pds/lronac2pds.cpp +++ b/isis/src/lro/apps/lronac2pds/lronac2pds.cpp @@ -21,15 +21,15 @@ using namespace Isis; void ResetGlobals (); void ProcessImage ( Buffer &in, Buffer &out ); -string MD5Checksum ( string filename ); +QString MD5Checksum ( QString filename ); void OutputLabel ( std::ofstream &fout, Cube* cube ); void CopyData ( std::ifstream &fin, std::ofstream &fout ); -string g_md5Checksum; +QString g_md5Checksum; bool g_isIof; -IString g_productVersionId = "N/A"; +QString g_productVersionId = "N/A"; void IsisMain () { ResetGlobals(); @@ -42,7 +42,7 @@ void IsisMain () { ProcessByLine p; Cube *inCube = p.SetInputCube("FROM"); - g_isIof = inCube->getLabel()->FindGroup("Radiometry", Pvl::Traverse).FindKeyword("RadiometricType")[0].Equal("IOF"); + g_isIof = inCube->getLabel()->FindGroup("Radiometry", Pvl::Traverse).FindKeyword("RadiometricType")[0].toUpper() == "IOF"; FileName scaledCube("$TEMPORARY/" + FileName(ui.GetFileName("FROM")).name()); scaledCube.addExtension("cub"); @@ -89,8 +89,8 @@ void IsisMain () { FileName tempFile; tempFile = FileName::createTempFile("$TEMPORARY/" + FileName(ui.GetFileName("TO")).baseName() + ".temp"); - string tempFileName(tempFile.expanded()); - ofstream temporaryFile(tempFileName.c_str()); + QString tempFileName(tempFile.expanded()); + ofstream temporaryFile(tempFileName.toAscii().data()); pe.StartProcess(temporaryFile); temporaryFile.close(); @@ -99,9 +99,9 @@ void IsisMain () { g_md5Checksum = MD5Checksum(tempFileName); FileName outFile(ui.GetFileName("TO")); - string outFileName(outFile.expanded()); - ifstream inFile(tempFileName.c_str()); - ofstream pdsFile(outFileName.c_str()); + QString outFileName(outFile.expanded()); + ifstream inFile(tempFileName.toAscii().data()); + ofstream pdsFile(outFileName.toAscii().data()); // Output the label OutputLabel(pdsFile, inCube); @@ -113,8 +113,8 @@ void IsisMain () { pe.EndProcess(); - remove((scaledCube.expanded()).c_str()); - remove(tempFileName.c_str()); + remove((scaledCube.expanded()).toAscii().data()); + remove(tempFileName.toAscii().data()); return; } @@ -134,9 +134,9 @@ void ProcessImage ( Buffer &in, Buffer &out ) { } } -string MD5Checksum ( string filename ) { +QString MD5Checksum ( QString filename ) { md5wrapper md5; - std::string checkSum = md5.getHashFromFile(filename.c_str()); + QString checkSum = md5.getHashFromFile(filename); return checkSum; } @@ -151,10 +151,10 @@ void OutputLabel ( std::ofstream &fout, Cube* cube ) { labelPvl.SetTerminator("END"); //Set up the directory where the translations are PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Lro"] + "/translations/"; + QString transDir = (QString) dataDir["Lro"] + "/translations/"; stringstream stream; - IString pdsLabel = ""; + QString pdsLabel = ""; //Translate the Original Pds Label FileName transFile(transDir + "lronacPdsLabelExport.trn"); @@ -164,13 +164,13 @@ void OutputLabel ( std::ofstream &fout, Cube* cube ) { // Copy any Translation changes over for (int i = 0; i < outLabel.Keywords(); i++) { bool hasUnit = false; - string unit = ""; + QString unit = ""; if (labelPvl[outLabel[i].Name()].Unit() != "") { hasUnit = true; unit = labelPvl[outLabel[i].Name()].Unit(); } bool hasComment = false; - string comment = ""; + QString comment = ""; if (labelPvl[outLabel[i].Name()].Comments() > 0) { hasComment = true; comment = labelPvl[outLabel[i].Name()].Comment(0); @@ -185,7 +185,7 @@ void OutputLabel ( std::ofstream &fout, Cube* cube ) { //Update the product ID //we switch the last char in the id from edr->cdr - string prod_id = labelPvl["PRODUCT_ID"][0]; + QString prod_id = labelPvl["PRODUCT_ID"][0]; labelPvl["PRODUCT_ID"][0].replace((prod_id.length()-1), 1, "C"); // Update the product creation time @@ -196,22 +196,22 @@ void OutputLabel ( std::ofstream &fout, Cube* cube ) { // Update the "IMAGE" Object PvlObject &imageObject = labelPvl.FindObject("IMAGE"); imageObject.Clear(); - imageObject += PvlKeyword("LINES", cube->getLineCount()); - imageObject += PvlKeyword("LINE_SAMPLES", cube->getSampleCount()); + imageObject += PvlKeyword("LINES", toString(cube->getLineCount())); + imageObject += PvlKeyword("LINE_SAMPLES", toString(cube->getSampleCount())); if (g_isIof) { - imageObject += PvlKeyword("SAMPLE_BITS", 16); + imageObject += PvlKeyword("SAMPLE_BITS", toString(16)); imageObject += PvlKeyword("SAMPLE_TYPE", "LSB_INTEGER"); - imageObject += PvlKeyword("SCALING_FACTOR", 1.0 / SCALING_FACTOR); - imageObject += PvlKeyword("VALID_MINIMUM", Isis::VALID_MIN2); - imageObject += PvlKeyword("NULL", Isis::NULL2); - imageObject += PvlKeyword("LOW_REPR_SATURATION", Isis::LOW_REPR_SAT2); - imageObject += PvlKeyword("LOW_INSTR_SATURATION", Isis::LOW_INSTR_SAT2); - imageObject += PvlKeyword("HIGH_INSTR_SATURATION", Isis::HIGH_INSTR_SAT2); - imageObject += PvlKeyword("HIGH_REPR_SATURATION", Isis::HIGH_REPR_SAT2); + imageObject += PvlKeyword("SCALING_FACTOR", toString(1.0 / SCALING_FACTOR)); + imageObject += PvlKeyword("VALID_MINIMUM", toString(Isis::VALID_MIN2)); + imageObject += PvlKeyword("NULL", toString(Isis::NULL2)); + imageObject += PvlKeyword("LOW_REPR_SATURATION", toString(Isis::LOW_REPR_SAT2)); + imageObject += PvlKeyword("LOW_INSTR_SATURATION", toString(Isis::LOW_INSTR_SAT2)); + imageObject += PvlKeyword("HIGH_INSTR_SATURATION", toString(Isis::HIGH_INSTR_SAT2)); + imageObject += PvlKeyword("HIGH_REPR_SATURATION", toString(Isis::HIGH_REPR_SAT2)); imageObject += PvlKeyword("UNIT", "Scaled I/F"); } else { - imageObject += PvlKeyword("SAMPLE_BITS", 32); + imageObject += PvlKeyword("SAMPLE_BITS", "32"); imageObject += PvlKeyword("SAMPLE_TYPE", "PC_REAL"); imageObject += PvlKeyword("VALID_MINIMUM", "16#FF7FFFFA#"); imageObject += PvlKeyword("NULL", "16#FF7FFFFB#"); @@ -221,25 +221,25 @@ void OutputLabel ( std::ofstream &fout, Cube* cube ) { imageObject += PvlKeyword("HIGH_REPR_SATURATION", "16#FF7FFFFF#"); imageObject += PvlKeyword("UNIT", "W / (m**2 micrometer sr)"); } - imageObject += PvlKeyword("MD5_CHECKSUM", (IString) g_md5Checksum); + imageObject += PvlKeyword("MD5_CHECKSUM", g_md5Checksum); stream << labelPvl; int recordBytes = cube->getSampleCount(); int labelRecords = (int) ((stream.str().length()) / recordBytes) + 1; - labelPvl["RECORD_BYTES"] = recordBytes; + labelPvl["RECORD_BYTES"] = toString(recordBytes); if (g_isIof) - labelPvl["FILE_RECORDS"] = (int) (cube->getLineCount() * 2 + labelRecords); + labelPvl["FILE_RECORDS"] = toString((int) (cube->getLineCount() * 2 + labelRecords)); else - labelPvl["FILE_RECORDS"] = (int) (cube->getLineCount() * 4 + labelRecords); - labelPvl["LABEL_RECORDS"] = labelRecords; - labelPvl["^IMAGE"] = (int) (labelRecords + 1); + labelPvl["FILE_RECORDS"] = toString((int) (cube->getLineCount() * 4 + labelRecords)); + labelPvl["LABEL_RECORDS"] = toString(labelRecords); + labelPvl["^IMAGE"] = toString((int) (labelRecords + 1)); stream.str(std::string()); stream << labelPvl; - pdsLabel += stream.str(); + pdsLabel += stream.str().c_str(); while (pdsLabel.length() < (unsigned int) (labelRecords * recordBytes)) { pdsLabel += '\n'; diff --git a/isis/src/lro/apps/lronac2pds/md5wrapper.cpp b/isis/src/lro/apps/lronac2pds/md5wrapper.cpp index f95a961b3c..e95d2acd68 100644 --- a/isis/src/lro/apps/lronac2pds/md5wrapper.cpp +++ b/isis/src/lro/apps/lronac2pds/md5wrapper.cpp @@ -1,13 +1,13 @@ /* - * This is part of my wrapper-class to create - * a MD5 Hash from a string and a file. + * This is part of my wrapper-class to create + * a MD5 Hash from a string and a file. * - * This code is completly free, you - * can copy it, modify it, or do - * what ever you want with it. + * This code is completly free, you + * can copy it, modify it, or do + * what ever you want with it. * - * Feb. 2005 - * Benjamin Grüdelbach + * Feb. 2005 + * Benjamin Grüdelbach */ //---------------------------------------------------------------------- @@ -25,14 +25,14 @@ * internal hash function, calling * the basic methods from md5.h */ -std::string md5wrapper::hashit(std::string text) { +QString md5wrapper::hashit(QString text) { MD5_CTX ctx; //init md5 md5->MD5Init(&ctx); //update with our string md5->MD5Update(&ctx, - (unsigned char *)text.c_str(), + (unsigned char *)text.toAscii().data(), text.length()); //create the hash @@ -45,11 +45,11 @@ std::string md5wrapper::hashit(std::string text) { /* * converts the numeric hash to - * a valid std::string. + * a valid QString. * (based on Jim Howard's code; * http://www.codeproject.com/cpp/cmd5.asp) */ -std::string md5wrapper::convToString(unsigned char *bytes) { +QString md5wrapper::convToString(unsigned char *bytes) { char asciihash[33]; int p = 0; @@ -58,7 +58,7 @@ std::string md5wrapper::convToString(unsigned char *bytes) { p += 2; } asciihash[32] = '\0'; - return std::string(asciihash); + return QString(asciihash); } //---------publics-------------------------- @@ -79,7 +79,7 @@ md5wrapper::~md5wrapper() { * "text" and returns it as * string */ -std::string md5wrapper::getHashFromString(std::string text) { +QString md5wrapper::getHashFromString(QString text) { return this->hashit(text); } @@ -91,7 +91,7 @@ std::string md5wrapper::getHashFromString(std::string text) { * (based on Ronald L. Rivest's code * from RFC1321 "The MD5 Message-Digest Algorithm") */ -std::string md5wrapper::getHashFromFile(std::string filename) { +QString md5wrapper::getHashFromFile(QString filename) { FILE *file; MD5_CTX context; @@ -99,7 +99,7 @@ std::string md5wrapper::getHashFromFile(std::string filename) { unsigned char buffer[1024], digest[16]; //open file - if((file = fopen(filename.c_str(), "rb")) == NULL) { + if((file = fopen(filename.toAscii().data(), "rb")) == NULL) { return "-1"; } @@ -113,7 +113,7 @@ std::string md5wrapper::getHashFromFile(std::string filename) { /* generate hash, close the file and return the - hash as std::string + hash as QString */ md5->MD5Final(digest, &context); fclose(file); diff --git a/isis/src/lro/apps/lronac2pds/md5wrapper.h b/isis/src/lro/apps/lronac2pds/md5wrapper.h index ae48ed4fd3..82d8db8141 100644 --- a/isis/src/lro/apps/lronac2pds/md5wrapper.h +++ b/isis/src/lro/apps/lronac2pds/md5wrapper.h @@ -15,7 +15,7 @@ #define MD5WRAPPER_H //basic includes -#include +#include //forwards class MD5; @@ -33,13 +33,13 @@ class md5wrapper { * internal hash function, calling * the basic methods from md5.h */ - std::string hashit(std::string text); + QString hashit(QString text); /* * converts the numeric giets to - * a valid std::string + * a valid QString */ - std::string convToString(unsigned char *bytes); + QString convToString(unsigned char *bytes); public: //constructor md5wrapper(); @@ -52,14 +52,14 @@ class md5wrapper { * "text" and returns it as * string */ - std::string getHashFromString(std::string text); + QString getHashFromString(QString text); /* * creates a MD5 hash from * a file specified in "filename" and * returns it as string */ - std::string getHashFromFile(std::string filename); + QString getHashFromFile(QString filename); }; diff --git a/isis/src/lro/apps/lronaccal/lronaccal.cpp b/isis/src/lro/apps/lronaccal/lronaccal.cpp index db1a5c4bf8..c6473c2621 100644 --- a/isis/src/lro/apps/lronaccal/lronaccal.cpp +++ b/isis/src/lro/apps/lronaccal/lronaccal.cpp @@ -16,9 +16,9 @@ using namespace Isis; // Working functions and parameters void ResetGlobals(); -void CopyCubeIntoArray(string &fileString, vector &data); -void ReadTextDataFile(string &fileString, vector &data); -void ReadTextDataFile(string &fileString, vector > &data); +void CopyCubeIntoArray(QString &fileString, vector &data); +void ReadTextDataFile(QString &fileString, vector &data); +void ReadTextDataFile(QString &fileString, vector > &data); void Calibrate(Buffer &in, Buffer &out); void RemoveMaskedOffset(Buffer &line); void CorrectDark(Buffer &in); @@ -65,20 +65,20 @@ void IsisMain() { Isis::PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); // Check if it is a NAC image - std::string instId = inst["InstrumentId"]; + QString instId = inst["InstrumentId"]; if(instId != "NACL" && instId != "NACR") { - string msg = "This is not a NAC image. lrocnaccal requires a NAC image."; + QString msg = "This is not a NAC image. lrocnaccal requires a NAC image."; throw IException(IException::User, msg, _FILEINFO_); } // And check if it has already run through calibration if(lab.FindObject("IsisCube").HasGroup("Radiometry")) { - string msg = "This image has already been calibrated"; + QString msg = "This image has already been calibrated"; throw IException(IException::User, msg, _FILEINFO_); } if(lab.FindObject("IsisCube").HasGroup("AlphaCube")) { - string msg = "This application can not be run on any image that has been geometrically transformed (i.e. scaled, rotated, sheared, or reflected) or cropped."; + QString msg = "This application can not be run on any image that has been geometrically transformed (i.e. scaled, rotated, sheared, or reflected) or cropped."; throw IException(IException::User, msg, _FILEINFO_); } @@ -101,19 +101,19 @@ void IsisMain() { if(iCube->getStatistics()->Maximum() > 1000) g_maskedLeftOnly = true; - IString darkFile, flatFile, offsetFile, coefficientFile; + QString darkFile, flatFile, offsetFile, coefficientFile; if(g_masked) { - IString maskedFile = ui.GetAsString("MASKEDFILE"); + QString maskedFile = ui.GetAsString("MASKEDFILE"); - if(maskedFile.Equal("Default") || maskedFile.length() == 0) + if(maskedFile.toLower() == "default" || maskedFile.length() == 0) maskedFile = "$lro/calibration/" + instId + "_MaskedPixels.????.pvl"; FileName maskedFileName(maskedFile); if(maskedFileName.isVersioned()) maskedFileName = maskedFileName.highestVersion(); if(!maskedFileName.fileExists()) { - string msg = maskedFile + " does not exist."; + QString msg = maskedFile + " does not exist."; throw IException(IException::User, msg, _FILEINFO_); } @@ -130,16 +130,16 @@ void IsisMain() { } for(int i = 0; i < maskedPixels.Size(); i++) - if((g_isLeftNac && (int) maskedPixels[i] < cutoff) || (!g_isLeftNac && (int) maskedPixels[i] > cutoff)) - g_maskedPixelsLeft.push_back(maskedPixels[i]); + if((g_isLeftNac && toInt(maskedPixels[i]) < cutoff) || (!g_isLeftNac && toInt(maskedPixels[i]) > cutoff)) + g_maskedPixelsLeft.push_back(toInt(maskedPixels[i])); else - g_maskedPixelsRight.push_back(maskedPixels[i]); + g_maskedPixelsRight.push_back(toInt(maskedPixels[i])); } if(g_dark) { darkFile = ui.GetAsString("DARKFILE"); - if(darkFile.Equal("Default") || darkFile.length() == 0) { + if(darkFile.toLower() == "default" || darkFile.length() == 0) { darkFile = "$lro/calibration/" + instId + "_AverageDarks"; if(g_summed) darkFile += "_Summed"; @@ -151,7 +151,7 @@ void IsisMain() { if(g_nonlinear) { offsetFile = ui.GetAsString("OFFSETFILE"); - if(offsetFile.Equal("Default") || offsetFile.length() == 0) { + if(offsetFile.toLower() == "default" || offsetFile.length() == 0) { offsetFile = "$lro/calibration/" + instId + "_LinearizationOffsets"; if(g_summed) offsetFile += "_Summed"; @@ -160,7 +160,7 @@ void IsisMain() { CopyCubeIntoArray(offsetFile, g_linearOffsetLine); coefficientFile = ui.GetAsString("NONLINEARITYFILE"); - if(coefficientFile.Equal("Default") || coefficientFile.length() == 0) { + if(coefficientFile.toLower() == "default" || coefficientFile.length() == 0) { coefficientFile = "$lro/calibration/" + instId + "_LinearizationCoefficients.????.txt"; } ReadTextDataFile(coefficientFile, g_linearityCoefficients); @@ -169,7 +169,7 @@ void IsisMain() { if(g_flatfield) { flatFile = ui.GetAsString("FLATFIELDFILE"); - if(flatFile.Equal("Default") || flatFile.length() == 0) { + if(flatFile.toLower() == "default" || flatFile.length() == 0) { flatFile = "$lro/calibration/" + instId + "_Flatfield"; ; if(g_summed) @@ -180,16 +180,16 @@ void IsisMain() { } if(g_radiometric) { - IString radFile = ui.GetAsString("RADIOMETRICFILE"); + QString radFile = ui.GetAsString("RADIOMETRICFILE"); - if(radFile.Equal("Default") || radFile.length() == 0) + if(radFile.toLower() == "default" || radFile.length() == 0) radFile = "$lro/calibration/NAC_RadiometricResponsivity.????.pvl"; FileName radFileName(radFile); if(radFileName.isVersioned()) radFileName = radFileName.highestVersion(); if(!radFileName.fileExists()) { - string msg = radFile + " does not exist."; + QString msg = radFile + " does not exist."; throw IException(IException::User, msg, _FILEINFO_); } @@ -197,31 +197,31 @@ void IsisMain() { if(g_iof) { try { - iTime startTime((string) inst["StartTime"]); + iTime startTime((QString) inst["StartTime"]); double etStart = startTime.Et(); // Get the distance between the Moon and the Sun at the given time in // Astronomical Units (AU) - string bspKernel1 = p.MissionData("lro", "/kernels/tspk/moon_pa_de421_1900-2050.bpc", false); - string bspKernel2 = p.MissionData("lro", "/kernels/tspk/de421.bsp", false); - furnsh_c(bspKernel1.c_str()); - furnsh_c(bspKernel2.c_str()); - string pckKernel1 = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); - string pckKernel2 = p.MissionData("lro", "/kernels/pck/moon_080317.tf", false); - string pckKernel3 = p.MissionData("lro", "/kernels/pck/moon_assoc_me.tf", false); - furnsh_c(pckKernel1.c_str()); - furnsh_c(pckKernel2.c_str()); - furnsh_c(pckKernel3.c_str()); + QString bspKernel1 = p.MissionData("lro", "/kernels/tspk/moon_pa_de421_1900-2050.bpc", false); + QString bspKernel2 = p.MissionData("lro", "/kernels/tspk/de421.bsp", false); + furnsh_c(bspKernel1.toAscii().data()); + furnsh_c(bspKernel2.toAscii().data()); + QString pckKernel1 = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); + QString pckKernel2 = p.MissionData("lro", "/kernels/pck/moon_080317.tf", false); + QString pckKernel3 = p.MissionData("lro", "/kernels/pck/moon_assoc_me.tf", false); + furnsh_c(pckKernel1.toAscii().data()); + furnsh_c(pckKernel2.toAscii().data()); + furnsh_c(pckKernel3.toAscii().data()); double sunpos[6], lt; spkezr_c("sun", etStart, "MOON_ME", "LT+S", "MOON", sunpos, <); g_solarDistance = vnorm_c(sunpos) / KM_PER_AU; - unload_c(bspKernel1.c_str()); - unload_c(bspKernel2.c_str()); - unload_c(pckKernel1.c_str()); - unload_c(pckKernel2.c_str()); - unload_c(pckKernel3.c_str()); + unload_c(bspKernel1.toAscii().data()); + unload_c(bspKernel2.toAscii().data()); + unload_c(pckKernel1.toAscii().data()); + unload_c(pckKernel2.toAscii().data()); + unload_c(pckKernel3.toAscii().data()); } catch(IException &e) { - string msg = "Unable to find the necessary SPICE kernels for converting to IOF"; + QString msg = "Unable to find the necessary SPICE kernels for converting to IOF"; throw IException(e, IException::User, msg, _FILEINFO_); } g_iofLeft = radPvl["IOF_LEFT"]; @@ -243,9 +243,9 @@ void IsisMain() { if(g_masked) { PvlKeyword darkColumns("DarkColumns"); for(unsigned int i = 0; i < g_maskedPixelsLeft.size(); i++) - darkColumns += g_maskedPixelsLeft[i]; + darkColumns += toString(g_maskedPixelsLeft[i]); for(unsigned int i = 0; i < g_maskedPixelsRight.size(); i++) - darkColumns += g_maskedPixelsRight[i]; + darkColumns += toString(g_maskedPixelsRight[i]); calgrp += darkColumns; } if(g_dark) @@ -260,18 +260,18 @@ void IsisMain() { if(g_iof) { calgrp += PvlKeyword("RadiometricType", "IOF"); if(g_isLeftNac) - calgrp += PvlKeyword("ResponsivityValue", g_iofLeft); + calgrp += PvlKeyword("ResponsivityValue", toString(g_iofLeft)); else - calgrp += PvlKeyword("ResponsivityValue", g_iofRight); + calgrp += PvlKeyword("ResponsivityValue", toString(g_iofRight)); } else { calgrp += PvlKeyword("RadiometricType", "AbsoluteRadiance"); if(g_isLeftNac) - calgrp += PvlKeyword("ResponsivityValue", g_radianceLeft); + calgrp += PvlKeyword("ResponsivityValue", toString(g_radianceLeft)); else - calgrp += PvlKeyword("ResponsivityValue", g_radianceRight); + calgrp += PvlKeyword("ResponsivityValue", toString(g_radianceRight)); } - calgrp += PvlKeyword("SolarDistance", g_solarDistance); + calgrp += PvlKeyword("SolarDistance", toString(g_solarDistance)); } ocube->putGroup(calgrp); p.EndProcess(); @@ -325,13 +325,13 @@ void Calibrate(Buffer &in, Buffer &out) { RadiometricCalibration(out); } -void CopyCubeIntoArray(string &fileString, vector &data) { +void CopyCubeIntoArray(QString &fileString, vector &data) { Cube cube; FileName filename(fileString); if(filename.isVersioned()) filename = filename.highestVersion(); if(!filename.fileExists()) { - string msg = fileString + " does not exist."; + QString msg = fileString + " does not exist."; throw IException(IException::User, msg, _FILEINFO_); } cube.open(filename.expanded()); @@ -346,41 +346,41 @@ void CopyCubeIntoArray(string &fileString, vector &data) { fileString = filename.expanded(); } -void ReadTextDataFile(string &fileString, vector &data) { +void ReadTextDataFile(QString &fileString, vector &data) { FileName filename(fileString); if(filename.isVersioned()) filename = filename.highestVersion(); if(!filename.fileExists()) { - string msg = fileString + " does not exist."; + QString msg = fileString + " does not exist."; throw IException(IException::User, msg, _FILEINFO_); } TextFile file(filename.expanded()); - IString lineString; + QString lineString; unsigned int line = 0; while(file.GetLine(lineString)) { - data.push_back((lineString.Token(" ,;")).ToDouble()); + data.push_back(toDouble(lineString.split(QRegExp("[ ,;]")).first())); line++; } fileString = filename.expanded(); } -void ReadTextDataFile(string &fileString, vector > &data) { +void ReadTextDataFile(QString &fileString, vector > &data) { FileName filename(fileString); if(filename.isVersioned()) filename = filename.highestVersion(); if(!filename.fileExists()) { - string msg = fileString + " does not exist."; + QString msg = fileString + " does not exist."; throw IException(IException::User, msg, _FILEINFO_); } TextFile file(filename.expanded()); - IString lineString; + QString lineString; while(file.GetLine(lineString)) { vector line; - lineString.ConvertWhiteSpace(); - lineString.Compress(); - lineString.TrimHead(" ,"); - while(lineString.size() > 0) { - line.push_back((lineString.Token(" ,")).ToDouble()); + lineString = lineString.simplified().remove(QRegExp("^[ ,]*")).trimmed(); + + QStringList lineTokens = lineString.split(QRegExp("[ ,]"), QString::SkipEmptyParts); + foreach (QString value, lineTokens) { + line.push_back(toDouble(value)); } data.push_back(line); diff --git a/isis/src/lro/apps/lrowac2isis/lrowac2isis.cpp b/isis/src/lro/apps/lrowac2isis/lrowac2isis.cpp index 80bf889f4e..e387f4ea02 100644 --- a/isis/src/lro/apps/lrowac2isis/lrowac2isis.cpp +++ b/isis/src/lro/apps/lrowac2isis/lrowac2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include @@ -53,7 +53,7 @@ void IsisMain() { Pvl pdsLab; UserInterface &ui = Application::GetUserInterface(); - string fromFile = ui.GetFileName("FROM"); + QString fromFile = ui.GetFileName("FROM"); flip = false;//ui.GetBoolean("FLIP"); @@ -71,13 +71,13 @@ void IsisMain() { IString lutPair = lutKeyword[i]; lutPair.ConvertWhiteSpace(); lutPair.Remove("() "); - IString outValueMin = lutPair.Token(" ,"); - IString outValueMax = lutPair.Token(" ,"); - lookupTable.AddPair(i, ((double)outValueMin + (double)outValueMax) / 2.0); + QString outValueMin = lutPair.Token(" ,").ToQt(); + QString outValueMax = lutPair.Token(" ,").ToQt(); + lookupTable.AddPair(i, (toDouble(outValueMin) + toDouble(outValueMax)) / 2.0); } } - string instModeId = pdsLab["INSTRUMENT_MODE_ID"]; + QString instModeId = pdsLab["INSTRUMENT_MODE_ID"]; // this will be used to convert num input lines to num output lines, // only changed for when both uv and vis exist (varying summing) @@ -173,7 +173,7 @@ void IsisMain() { uveven->setDimensions(numSamples, numLines, numBands); uveven->setPixelType(Isis::Real); - string filename = baseFileName.path() + "/" + baseFileName.baseName() + ".uv.even.cub"; + QString filename = baseFileName.path() + "/" + baseFileName.baseName() + ".uv.even.cub"; uveven->create(filename); uvodd->setDimensions(numSamples, numLines, numBands); @@ -192,7 +192,7 @@ void IsisMain() { viseven->setDimensions(numSamples, numLines, numBands); viseven->setPixelType(Isis::Real); - string filename = baseFileName.path() + "/" + baseFileName.baseName() + ".vis.even.cub"; + QString filename = baseFileName.path() + "/" + baseFileName.baseName() + ".vis.even.cub"; viseven->create(filename); visodd->setDimensions(numSamples, numLines, numBands); @@ -213,7 +213,7 @@ void IsisMain() { OriginalLabel origLabel(pdsLab); int numFramelets = padding.size(); - PvlKeyword numFrameletsKeyword("NumFramelets", numFramelets); + PvlKeyword numFrameletsKeyword("NumFramelets", toString(numFramelets)); if(uveven) { for(int grp = 0; grp < isis3UvEvenLab.Groups(); grp++) { @@ -412,7 +412,7 @@ void separateFramelets(Buffer &in) { if(!extractMiddleSamples) { for(int i = 0; i < in.size(); i++) { if(i >= mgr.size()) { - string msg = "The input file has an unexpected number of samples"; + QString msg = "The input file has an unexpected number of samples"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -425,7 +425,7 @@ void separateFramelets(Buffer &in) { int endSamp = (in.size() / 2) + mgr.size() / 2; if(mgr.size() > in.size()) { - string msg = "Output number of samples calculated is invalid"; + QString msg = "Output number of samples calculated is invalid"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -458,7 +458,7 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3VisEven, Pvl &isis3VisOdd, // Get the directory where the translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Lro"] + "/translations/"; + QString transDir = (QString) dataDir["Lro"] + "/translations/"; // Translate the in FileName transFile(transDir + "lrowacInstrument.trn"); @@ -488,7 +488,7 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3VisEven, Pvl &isis3VisOdd, genericInstrument.push_back(PvlKeyword("ColorOffset", 0)); } else { - genericInstrument.push_back(PvlKeyword("ColorOffset", colorOffset)); + genericInstrument.push_back(PvlKeyword("ColorOffset", toString(colorOffset))); } genericInstrument.push_back(PvlKeyword("Decompanded", (ui.GetBoolean("UNLUT") ? "Yes" : "No"))); @@ -510,16 +510,16 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3VisEven, Pvl &isis3VisOdd, // add labels unique to particular files if(viseven) { visEvenInst.AddKeyword(PvlKeyword("Framelets", "Even")); - visEvenInst.AddKeyword(PvlKeyword("NumFramelets", viseven->getLineCount() / 14)); + visEvenInst.AddKeyword(PvlKeyword("NumFramelets", toString(viseven->getLineCount() / 14))); visEvenInst.AddKeyword(PvlKeyword("InstrumentId", "WAC-VIS"), Pvl::Replace); - visEvenInst.AddKeyword(PvlKeyword("InstrumentModeId", (std::string) pdsLab["INSTRUMENT_MODE_ID"])); + visEvenInst.AddKeyword(PvlKeyword("InstrumentModeId", (QString) pdsLab["INSTRUMENT_MODE_ID"])); } if(visodd) { visOddInst.AddKeyword(PvlKeyword("Framelets", "Odd")); - visOddInst.AddKeyword(PvlKeyword("NumFramelets", visodd->getLineCount() / 14)); + visOddInst.AddKeyword(PvlKeyword("NumFramelets", toString(visodd->getLineCount() / 14))); visOddInst.AddKeyword(PvlKeyword("InstrumentId", "WAC-VIS"), Pvl::Replace); - visOddInst.AddKeyword(PvlKeyword("InstrumentModeId", (std::string) pdsLab["INSTRUMENT_MODE_ID"])); + visOddInst.AddKeyword(PvlKeyword("InstrumentModeId", (QString) pdsLab["INSTRUMENT_MODE_ID"])); } // **TEMPORARY. This should be done by a translation table. @@ -539,7 +539,7 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3VisEven, Pvl &isis3VisOdd, } else { for(int i = 0; i < pdsLab["FILTER_NUMBER"].Size(); i++) { - if((int) pdsLab["FILTER_NUMBER"][i] > 2) { + if(toInt(pdsLab["FILTER_NUMBER"][i]) > 2) { visWavelength += pdsLab["CENTER_FILTER_WAVELENGTH"][i]; visFilterNum += pdsLab["FILTER_NUMBER"][i]; @@ -567,16 +567,16 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3VisEven, Pvl &isis3VisOdd, if(uveven) { uvEvenInst.AddKeyword(PvlKeyword("Framelets", "Even")); - uvEvenInst.AddKeyword(PvlKeyword("NumFramelets", uveven->getLineCount() / 4)); + uvEvenInst.AddKeyword(PvlKeyword("NumFramelets", toString(uveven->getLineCount() / 4))); uvEvenInst.AddKeyword(PvlKeyword("InstrumentId", "WAC-UV"), Pvl::Replace); - uvEvenInst.AddKeyword(PvlKeyword("InstrumentModeId", (std::string) pdsLab["INSTRUMENT_MODE_ID"])); + uvEvenInst.AddKeyword(PvlKeyword("InstrumentModeId", (QString) pdsLab["INSTRUMENT_MODE_ID"])); } if(uvodd) { uvOddInst.AddKeyword(PvlKeyword("Framelets", "Odd")); - uvOddInst.AddKeyword(PvlKeyword("NumFramelets", uvodd->getLineCount() / 4)); + uvOddInst.AddKeyword(PvlKeyword("NumFramelets", toString(uvodd->getLineCount() / 4))); uvOddInst.AddKeyword(PvlKeyword("InstrumentId", "WAC-UV"), Pvl::Replace); - uvOddInst.AddKeyword(PvlKeyword("InstrumentModeId", (std::string) pdsLab["INSTRUMENT_MODE_ID"])); + uvOddInst.AddKeyword(PvlKeyword("InstrumentModeId", (QString) pdsLab["INSTRUMENT_MODE_ID"])); } // Translate the BandBin group @@ -586,7 +586,7 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3VisEven, Pvl &isis3VisOdd, PvlKeyword uvBandwidth("Width"); for(int i = 0; i < pdsLab["FILTER_NUMBER"].Size(); i++) { - if((int) pdsLab["FILTER_NUMBER"][i] <= 2) { + if(toInt(pdsLab["FILTER_NUMBER"][i]) <= 2) { uvWavelength += pdsLab["CENTER_FILTER_WAVELENGTH"][i]; uvFilterNum += pdsLab["FILTER_NUMBER"][i]; @@ -671,68 +671,68 @@ void ValidateInputLabels(Pvl &pdsLab) { PvlKeyword &lut = pdsLab["LRO:LOOKUP_CONVERSION_TABLE"]; if(lut.Size() != 256) { - IString msg = "Keyword [LRO:LOOKUP_CONVERSION_TABLE] has the wrong number of values"; + QString msg = "Keyword [LRO:LOOKUP_CONVERSION_TABLE] has the wrong number of values"; throw IException(IException::Unknown, msg, _FILEINFO_); } PvlKeyword &missionName = pdsLab["MISSION_NAME"]; if(missionName.Size() != 1 || missionName[0] != "LUNAR RECONNAISSANCE ORBITER") { - IString msg = "Keyword [MISSION_NAME] does not have a value of [LUNAR RECONNAISSANCER ORBITER]"; + QString msg = "Keyword [MISSION_NAME] does not have a value of [LUNAR RECONNAISSANCER ORBITER]"; throw IException(IException::Unknown, msg, _FILEINFO_); } PvlKeyword &instrumentId = pdsLab["INSTRUMENT_ID"]; if(instrumentId.Size() != 1 || instrumentId[0] != "LROC") { - IString msg = "Keyword [INSTRUMENT_ID] does not have a value of [LROC]"; + QString msg = "Keyword [INSTRUMENT_ID] does not have a value of [LROC]"; throw IException(IException::Unknown, msg, _FILEINFO_); } // Make sure CENTER_FILTER_WAVELENGTH/FILTER_NUMBER makes sense if(pdsLab["FILTER_NUMBER"].Size() != pdsLab["CENTER_FILTER_WAVELENGTH"].Size()) { - IString msg = "Keywords [FILTER_NUMBER,CENTER_FILTER_WAVELENGTH] must have the same number of values"; + QString msg = "Keywords [FILTER_NUMBER,CENTER_FILTER_WAVELENGTH] must have the same number of values"; throw IException(IException::Unknown, msg, _FILEINFO_); } if(pdsLab["INSTRUMENT_MODE_ID"][0] == "BW" && pdsLab["FILTER_NUMBER"].Size() != 1) { - IString msg = "Keyword [FILTER_NUMBER] must have size 1 if [INSTRUMENT_MODE_ID] is [BW]"; + QString msg = "Keyword [FILTER_NUMBER] must have size 1 if [INSTRUMENT_MODE_ID] is [BW]"; throw IException(IException::Unknown, msg, _FILEINFO_); } else if(pdsLab["INSTRUMENT_MODE_ID"][0] == "COLOR" && (pdsLab["FILTER_NUMBER"].Size() < 5 || pdsLab["FILTER_NUMBER"].Size() > 7 || pdsLab["FILTER_NUMBER"].Size() == 6)) { - IString msg = "Keyword [FILTER_NUMBER] must have size 5 or 7 if [INSTRUMENT_MODE_ID] is [COLOR]"; + QString msg = "Keyword [FILTER_NUMBER] must have size 5 or 7 if [INSTRUMENT_MODE_ID] is [COLOR]"; throw IException(IException::Unknown, msg, _FILEINFO_); } else if(pdsLab["INSTRUMENT_MODE_ID"][0] == "UV" && pdsLab["FILTER_NUMBER"].Size() != 2) { - IString msg = "Keyword [FILTER_NUMBER] must have size 2 if [INSTRUMENT_MODE_ID] is [UV]"; + QString msg = "Keyword [FILTER_NUMBER] must have size 2 if [INSTRUMENT_MODE_ID] is [UV]"; throw IException(IException::Unknown, msg, _FILEINFO_); } else if(pdsLab["INSTRUMENT_MODE_ID"][0] == "VIS" && pdsLab["FILTER_NUMBER"].Size() != 5) { - IString msg = "Keyword [FILTER_NUMBER] must have size 5 if [INSTRUMENT_MODE_ID] is [VIS]"; + QString msg = "Keyword [FILTER_NUMBER] must have size 5 if [INSTRUMENT_MODE_ID] is [VIS]"; throw IException(IException::Unknown, msg, _FILEINFO_); } else if(pdsLab["INSTRUMENT_MODE_ID"][0] != "BW" && pdsLab["INSTRUMENT_MODE_ID"][0] != "COLOR" && pdsLab["INSTRUMENT_MODE_ID"][0] != "UV" && pdsLab["INSTRUMENT_MODE_ID"][0] != "VIS") { - IString msg = "The value of keyword [INSTRUMENT_MODE_ID] is not recognized"; + QString msg = "The value of keyword [INSTRUMENT_MODE_ID] is not recognized"; throw IException(IException::Unknown, msg, _FILEINFO_); } // number/bandwidth matches for filters - vector< pair > filters; - filters.push_back(pair(1, "321")); - filters.push_back(pair(2, "360")); - filters.push_back(pair(3, "415")); - filters.push_back(pair(4, "566")); - filters.push_back(pair(5, "604")); - filters.push_back(pair(6, "643")); - filters.push_back(pair(7, "689")); + vector< pair > filters; + filters.push_back(pair(1, "321")); + filters.push_back(pair(2, "360")); + filters.push_back(pair(3, "415")); + filters.push_back(pair(4, "566")); + filters.push_back(pair(5, "604")); + filters.push_back(pair(6, "643")); + filters.push_back(pair(7, "689")); for(int i = 0; i < pdsLab["FILTER_NUMBER"].Size(); i++) { bool found = false; bool match = false; for(int j = 0; !found && j < (int) filters.size(); j++) { - if((int) pdsLab["FILTER_NUMBER"][i] == filters[j].first) { + if(toInt(pdsLab["FILTER_NUMBER"][i]) == filters[j].first) { found = true; match = (pdsLab["CENTER_FILTER_WAVELENGTH"][i] == filters[j].second); @@ -740,24 +740,24 @@ void ValidateInputLabels(Pvl &pdsLab) { } if(found && !match) { - IString msg = "The [FILTER_NUMBER] and [CENTER_FILTER_WAVELENGTH] keywords do not correspond properly"; + QString msg = "The [FILTER_NUMBER] and [CENTER_FILTER_WAVELENGTH] keywords do not correspond properly"; throw IException(IException::Unknown, msg, _FILEINFO_); } if(!found) { - IString msg = "The value of the keyword [FILTER_NUMBER] is invalid"; + QString msg = "The value of the keyword [FILTER_NUMBER] is invalid"; throw IException(IException::Unknown, msg, _FILEINFO_); } } // Now make sure keywords that shouldn't exist dont - IString invalidKeywords[] = { + QString invalidKeywords[] = { "SPACECRAFT_CLOCK_CNT_PARTITION" }; - for(unsigned int i = 0; i < sizeof(IString) / sizeof(invalidKeywords); i++) { + for(unsigned int i = 0; i < sizeof(QString) / sizeof(invalidKeywords); i++) { if(pdsLab.HasKeyword(invalidKeywords[i])) { - IString msg = "Keyword ["; + QString msg = "Keyword ["; msg += invalidKeywords[i]; msg += "] must not exist"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -769,13 +769,13 @@ void ValidateInputLabels(Pvl &pdsLab) { QRegExp integerRegex("[0-9]+"); if(orbitNumber.Size() != 1 || !integerRegex.exactMatch(orbitNumber[0])) { - IString msg = "The value of keyword [ORBIT_NUMBER] is not valid"; + QString msg = "The value of keyword [ORBIT_NUMBER] is not valid"; throw IException(IException::Unknown, msg, _FILEINFO_); } // Check for keywords that must be doubles or integers QRegExp numberRegex("[-+]{0,1}([0-9]*\\.[0-9]+)|([0-9]+\\.[0-9]*)|([0-9]+)"); - IString numericKeywords[] = { + QString numericKeywords[] = { "LRO:BEGIN_TEMPERATURE_SCS", "LRO:MIDDLE_TEMPERATURE_SCS", "LRO:END_TEMPERATURE_SCS", @@ -786,9 +786,9 @@ void ValidateInputLabels(Pvl &pdsLab) { "EXPOSURE_DURATION" }; - for(unsigned int i = 0; i < sizeof(numericKeywords) / sizeof(IString); i++) { + for(unsigned int i = 0; i < sizeof(numericKeywords) / sizeof(QString); i++) { if(pdsLab[numericKeywords[i]].Size() != 1 || !numberRegex.exactMatch(pdsLab[numericKeywords[i]][0])) { - IString msg = "The value of keyword ["; + QString msg = "The value of keyword ["; msg += numericKeywords[i]; msg += "] is not valid"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -797,14 +797,14 @@ void ValidateInputLabels(Pvl &pdsLab) { // Now check for keywords that must be dateTtime QRegExp timeRegex("[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]*"); - IString timeKeywords[] = { + QString timeKeywords[] = { "START_TIME", "STOP_TIME" }; - for(unsigned int i = 0; i < sizeof(timeKeywords) / sizeof(IString); i++) { + for(unsigned int i = 0; i < sizeof(timeKeywords) / sizeof(QString); i++) { if(pdsLab[timeKeywords[i]].Size() != 1 || !timeRegex.exactMatch(pdsLab[timeKeywords[i]][0])) { - IString msg = "The value of keyword ["; + QString msg = "The value of keyword ["; msg += timeKeywords[i]; msg += "] is not valid"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -813,14 +813,14 @@ void ValidateInputLabels(Pvl &pdsLab) { // Now check keywords that must be clock counts QRegExp clockRegex("[0-9]+/[0-9]+:[0-9]+\\.{0,1}[0-9]*"); - IString clockKeywords[] = { + QString clockKeywords[] = { "SPACECRAFT_CLOCK_START_COUNT", "SPACECRAFT_CLOCK_STOP_COUNT" }; - for(unsigned int i = 0; i < sizeof(clockKeywords) / sizeof(IString); i++) { + for(unsigned int i = 0; i < sizeof(clockKeywords) / sizeof(QString); i++) { if(pdsLab[clockKeywords[i]].Size() != 1 || !clockRegex.exactMatch(pdsLab[clockKeywords[i]][0])) { - IString msg = "The value of keyword ["; + QString msg = "The value of keyword ["; msg += clockKeywords[i]; msg += "] is not valid"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -828,7 +828,7 @@ void ValidateInputLabels(Pvl &pdsLab) { } } catch(IException &e) { - IString msg = "The input product is out of date and has invalid labels. Please get an up to date version from the ASU LROC Team"; + QString msg = "The input product is out of date and has invalid labels. Please get an up to date version from the ASU LROC Team"; throw IException(e, IException::Unknown, msg, _FILEINFO_); } } diff --git a/isis/src/lro/apps/lrowac2pds/lrowac2pds.cpp b/isis/src/lro/apps/lrowac2pds/lrowac2pds.cpp index 1bbfbf58df..9d718c1db9 100644 --- a/isis/src/lro/apps/lrowac2pds/lrowac2pds.cpp +++ b/isis/src/lro/apps/lrowac2pds/lrowac2pds.cpp @@ -1,6 +1,6 @@ #include "Isis.h" #include -#include +#include #include #include "FileList.h" #include "Brick.h" @@ -31,7 +31,7 @@ vector frameletLines; void ResetGlobals (); void mergeFramelets (); -string MD5Checksum ( string filename ); +QString MD5Checksum ( QString filename ); void OutputLabel ( std::ofstream &fout, Cube* cube, Pvl &pdsLab ); void CopyData ( std::ifstream &fin, std::ofstream &fout ); @@ -49,11 +49,11 @@ Cube *visodd = NULL; Cube* out = NULL; -IString instrumentModeId = ""; -IString productId = ""; -IString g_productVersionId = "N/A"; +QString instrumentModeId = ""; +QString productId = ""; +QString g_productVersionId = "N/A"; -string g_md5Checksum; +QString g_md5Checksum; int numFramelets = 0; int numSamples = 0; @@ -71,7 +71,7 @@ void IsisMain () { list.read(ui.GetFileName("FROMLIST")); if (list.size() < 1) { - string msg = "The list file [" + ui.GetFileName("FROMLIST") + "does not contain any data"; + QString msg = "The list file [" + ui.GetFileName("FROMLIST") + "does not contain any data"; throw IException(IException::User, msg, _FILEINFO_); } @@ -85,33 +85,33 @@ void IsisMain () { OriginalLabel origLab(list[i].toString()); pdsLab = origLab.ReturnLabels(); - IString prodId = pdsLab["PRODUCT_ID"][0]; + QString prodId = pdsLab["PRODUCT_ID"][0]; if (productId == "") productId = prodId; if (productId != prodId) { - string msg = "This program is intended for use on a single LROC WAC images only."; + QString msg = "This program is intended for use on a single LROC WAC images only."; msg += "The ProductIds do not match."; throw IException(IException::User, msg, _FILEINFO_); } Isis::PvlGroup &inst = tempPvl.FindGroup("Instrument", Pvl::Traverse); - IString instId = (string) inst["InstrumentId"]; - IString framelets = (string) inst["Framelets"]; - IString numFrames = (int) inst["NumFramelets"]; + QString instId = (QString) inst["InstrumentId"]; + QString framelets = (QString) inst["Framelets"]; + QString numFrames = inst["NumFramelets"]; if (instId != "WAC-VIS" && instId != "WAC-UV") { - string msg = "This program is intended for use on LROC WAC images only. ["; + QString msg = "This program is intended for use on LROC WAC images only. ["; msg += list[i].toString() + "] does not appear to be a WAC image."; throw IException(IException::User, msg, _FILEINFO_); } - IString instModeId = (string) inst["InstrumentModeId"]; + QString instModeId = (QString) inst["InstrumentModeId"]; if (instrumentModeId == "") instrumentModeId = instModeId; if (numFramelets == 0) - numFramelets = numFrames; - g_isIoF = tempPvl.FindGroup("Radiometry", Pvl::Traverse).FindKeyword("RadiometricType")[0].Equal("IOF"); + numFramelets = toInt(numFrames); + g_isIoF = tempPvl.FindGroup("Radiometry", Pvl::Traverse).FindKeyword("RadiometricType")[0].toUpper() == "IOF"; if (instId == "WAC-VIS" && framelets == "Even") { viseven = new Cube(); @@ -167,14 +167,14 @@ void IsisMain () { FileName mergedCube = FileName::createTempFile( "$TEMPORARY/" + FileName(ui.GetFileName("TO")).baseName() + ".cub"); - out->create(mergedCube.expanded().c_str()); + out->create(mergedCube.expanded()); mergeFramelets(); /* FileName outFile(ui.GetFileName("TO", "img")); - string outFileName(outFile.expanded()); + QString outFileName(outFile.expanded()); ofstream oCube(outFileName.c_str()); p.OutputLabel(oCube); p.StartProcess(oCube); @@ -231,8 +231,8 @@ void IsisMain () { FileName tempFile = FileName::createTempFile( "$TEMPORARY/" + FileName(ui.GetFileName("TO")).baseName() + ".temp"); - string tempFileName(tempFile.expanded()); - ofstream temporaryFile(tempFileName.c_str()); + QString tempFileName(tempFile.expanded()); + ofstream temporaryFile(tempFileName.toAscii().data()); pe.StartProcess(temporaryFile); temporaryFile.close(); @@ -241,9 +241,9 @@ void IsisMain () { g_md5Checksum = MD5Checksum(tempFileName); FileName outFile(ui.GetFileName("TO")); - string outFileName(outFile.expanded()); - ifstream inFile(tempFileName.c_str()); - ofstream pdsFile(outFileName.c_str()); + QString outFileName(outFile.expanded()); + ifstream inFile(tempFileName.toAscii().data()); + ofstream pdsFile(outFileName.toAscii().data()); // Output the label OutputLabel(pdsFile, inCube, pdsLab); @@ -255,8 +255,8 @@ void IsisMain () { pe.EndProcess(); - remove((mergedCube.expanded()).c_str()); - remove(tempFileName.c_str()); + remove((mergedCube.expanded()).toAscii().data()); + remove(tempFileName.toAscii().data()); return; } @@ -355,9 +355,9 @@ void mergeFramelets () { } } -string MD5Checksum ( string filename ) { +QString MD5Checksum ( QString filename ) { md5wrapper md5; - std::string checkSum = md5.getHashFromFile(filename.c_str()); + QString checkSum = md5.getHashFromFile(filename); return checkSum; } @@ -369,10 +369,10 @@ void OutputLabel ( std::ofstream &fout, Cube* cube, Pvl &labelPvl ) { labelPvl.SetTerminator("END"); //Set up the directory where the translations are PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Lro"] + "/translations/"; + QString transDir = (QString) dataDir["Lro"] + "/translations/"; stringstream stream; - IString pdsLabel = ""; + QString pdsLabel = ""; //Translate the Original Pds Label FileName transFile(transDir + "lrowacPdsLabelExport.trn"); @@ -382,13 +382,13 @@ void OutputLabel ( std::ofstream &fout, Cube* cube, Pvl &labelPvl ) { // Copy any Translation changes over for (int i = 0; i < outLabel.Keywords(); i++) { bool hasUnit = false; - string unit = ""; + QString unit = ""; if (labelPvl[outLabel[i].Name()].Unit() != "") { hasUnit = true; unit = labelPvl[outLabel[i].Name()].Unit(); } bool hasComment = false; - string comment = ""; + QString comment = ""; if (labelPvl[outLabel[i].Name()].Comments() > 0) { hasComment = true; comment = labelPvl[outLabel[i].Name()].Comment(0); @@ -402,7 +402,7 @@ void OutputLabel ( std::ofstream &fout, Cube* cube, Pvl &labelPvl ) { } //Update the product ID - string prod_id = labelPvl["PRODUCT_ID"][0]; + QString prod_id = labelPvl["PRODUCT_ID"][0]; labelPvl["PRODUCT_ID"][0].replace((prod_id.length()-1), 1, "C"); // Update the product creation time @@ -413,9 +413,9 @@ void OutputLabel ( std::ofstream &fout, Cube* cube, Pvl &labelPvl ) { // Update the "IMAGE" Object PvlObject &imageObject = labelPvl.FindObject("IMAGE"); imageObject.Clear(); - imageObject += PvlKeyword("LINES", cube->getLineCount()); - imageObject += PvlKeyword("LINE_SAMPLES", cube->getSampleCount()); - imageObject += PvlKeyword("SAMPLE_BITS", 32); + imageObject += PvlKeyword("LINES", toString(cube->getLineCount())); + imageObject += PvlKeyword("LINE_SAMPLES", toString(cube->getSampleCount())); + imageObject += PvlKeyword("SAMPLE_BITS", toString(32)); imageObject += PvlKeyword("SAMPLE_TYPE", "PC_REAL"); imageObject += PvlKeyword("VALID_MINIMUM", "16#FF7FFFFA#"); imageObject += PvlKeyword("NULL", "16#FF7FFFFB#"); @@ -427,22 +427,22 @@ void OutputLabel ( std::ofstream &fout, Cube* cube, Pvl &labelPvl ) { imageObject += PvlKeyword("UNIT", "\"I/F\""); else imageObject += PvlKeyword("UNIT", "W / (m**2 micrometer sr)"); - imageObject += PvlKeyword("MD5_CHECKSUM", (IString) g_md5Checksum); + imageObject += PvlKeyword("MD5_CHECKSUM", g_md5Checksum); stream << labelPvl; int recordBytes = cube->getSampleCount(); int labelRecords = (int) ((stream.str().length()) / recordBytes) + 1; - labelPvl["RECORD_BYTES"] = recordBytes; - labelPvl["FILE_RECORDS"] = (int) (cube->getLineCount() * 4 + labelRecords); - labelPvl["LABEL_RECORDS"] = labelRecords; - labelPvl["^IMAGE"] = (int) (labelRecords + 1); + labelPvl["RECORD_BYTES"] = toString(recordBytes); + labelPvl["FILE_RECORDS"] = toString((int) (cube->getLineCount() * 4 + labelRecords)); + labelPvl["LABEL_RECORDS"] = toString(labelRecords); + labelPvl["^IMAGE"] = toString((int) (labelRecords + 1)); stream.str(std::string()); stream << labelPvl; - pdsLabel += stream.str(); + pdsLabel += stream.str().c_str(); while (pdsLabel.length() < (unsigned int) (labelRecords * recordBytes)) { pdsLabel += '\n'; diff --git a/isis/src/lro/apps/lrowac2pds/md5wrapper.cpp b/isis/src/lro/apps/lrowac2pds/md5wrapper.cpp index f95a961b3c..e95d2acd68 100644 --- a/isis/src/lro/apps/lrowac2pds/md5wrapper.cpp +++ b/isis/src/lro/apps/lrowac2pds/md5wrapper.cpp @@ -1,13 +1,13 @@ /* - * This is part of my wrapper-class to create - * a MD5 Hash from a string and a file. + * This is part of my wrapper-class to create + * a MD5 Hash from a string and a file. * - * This code is completly free, you - * can copy it, modify it, or do - * what ever you want with it. + * This code is completly free, you + * can copy it, modify it, or do + * what ever you want with it. * - * Feb. 2005 - * Benjamin Grüdelbach + * Feb. 2005 + * Benjamin Grüdelbach */ //---------------------------------------------------------------------- @@ -25,14 +25,14 @@ * internal hash function, calling * the basic methods from md5.h */ -std::string md5wrapper::hashit(std::string text) { +QString md5wrapper::hashit(QString text) { MD5_CTX ctx; //init md5 md5->MD5Init(&ctx); //update with our string md5->MD5Update(&ctx, - (unsigned char *)text.c_str(), + (unsigned char *)text.toAscii().data(), text.length()); //create the hash @@ -45,11 +45,11 @@ std::string md5wrapper::hashit(std::string text) { /* * converts the numeric hash to - * a valid std::string. + * a valid QString. * (based on Jim Howard's code; * http://www.codeproject.com/cpp/cmd5.asp) */ -std::string md5wrapper::convToString(unsigned char *bytes) { +QString md5wrapper::convToString(unsigned char *bytes) { char asciihash[33]; int p = 0; @@ -58,7 +58,7 @@ std::string md5wrapper::convToString(unsigned char *bytes) { p += 2; } asciihash[32] = '\0'; - return std::string(asciihash); + return QString(asciihash); } //---------publics-------------------------- @@ -79,7 +79,7 @@ md5wrapper::~md5wrapper() { * "text" and returns it as * string */ -std::string md5wrapper::getHashFromString(std::string text) { +QString md5wrapper::getHashFromString(QString text) { return this->hashit(text); } @@ -91,7 +91,7 @@ std::string md5wrapper::getHashFromString(std::string text) { * (based on Ronald L. Rivest's code * from RFC1321 "The MD5 Message-Digest Algorithm") */ -std::string md5wrapper::getHashFromFile(std::string filename) { +QString md5wrapper::getHashFromFile(QString filename) { FILE *file; MD5_CTX context; @@ -99,7 +99,7 @@ std::string md5wrapper::getHashFromFile(std::string filename) { unsigned char buffer[1024], digest[16]; //open file - if((file = fopen(filename.c_str(), "rb")) == NULL) { + if((file = fopen(filename.toAscii().data(), "rb")) == NULL) { return "-1"; } @@ -113,7 +113,7 @@ std::string md5wrapper::getHashFromFile(std::string filename) { /* generate hash, close the file and return the - hash as std::string + hash as QString */ md5->MD5Final(digest, &context); fclose(file); diff --git a/isis/src/lro/apps/lrowac2pds/md5wrapper.h b/isis/src/lro/apps/lrowac2pds/md5wrapper.h index e17db7cca1..82d8db8141 100644 --- a/isis/src/lro/apps/lrowac2pds/md5wrapper.h +++ b/isis/src/lro/apps/lrowac2pds/md5wrapper.h @@ -1,13 +1,13 @@ /* - * This is my wrapper-class to create - * a MD5 Hash from a string and a file. + * This is my wrapper-class to create + * a MD5 Hash from a string and a file. * - * This code is completly free, you - * can copy it, modify it, or do - * what ever you want with it. + * This code is completly free, you + * can copy it, modify it, or do + * what ever you want with it. * - * Feb. 2005 - * Benjamin Grüdelbach + * Feb. 2005 + * Benjamin Grüdelbach */ //include protection @@ -15,11 +15,16 @@ #define MD5WRAPPER_H //basic includes -#include +#include //forwards class MD5; +/** + * @author 2005-02-?? Benjamin Grudelbach + * + * @internal + */ class md5wrapper { private: MD5 *md5; @@ -28,13 +33,13 @@ class md5wrapper { * internal hash function, calling * the basic methods from md5.h */ - std::string hashit(std::string text); + QString hashit(QString text); /* * converts the numeric giets to - * a valid std::string + * a valid QString */ - std::string convToString(unsigned char *bytes); + QString convToString(unsigned char *bytes); public: //constructor md5wrapper(); @@ -47,14 +52,14 @@ class md5wrapper { * "text" and returns it as * string */ - std::string getHashFromString(std::string text); + QString getHashFromString(QString text); /* * creates a MD5 hash from * a file specified in "filename" and * returns it as string */ - std::string getHashFromFile(std::string filename); + QString getHashFromFile(QString filename); }; diff --git a/isis/src/lro/apps/lrowaccal/lrowaccal.cpp b/isis/src/lro/apps/lrowaccal/lrowaccal.cpp index 3023423720..142cdf6e96 100644 --- a/isis/src/lro/apps/lrowaccal/lrowaccal.cpp +++ b/isis/src/lro/apps/lrowaccal/lrowaccal.cpp @@ -31,11 +31,11 @@ using namespace std; void ResetGlobals (); void Calibrate ( Buffer &in, Buffer &out ); -void CopyCubeIntoBuffer ( string &fileString, Buffer* &data); +void CopyCubeIntoBuffer ( QString &fileString, Buffer* &data); double min ( double a, double b ); -void GetDark(string fileString, double temp, double time, Buffer* &data1, Buffer* &data2, double & temp1, double & temp2, string & file1, string & file2); -void GetMask(string &fileString, double temp, Buffer* &data); +void GetDark(QString fileString, double temp, double time, Buffer* &data1, Buffer* &data2, double & temp1, double & temp2, QString & file1, QString & file2); +void GetMask(QString &fileString, double temp, Buffer* &data); vector g_iofResponsivity; vector g_radianceResponsivity; @@ -62,22 +62,22 @@ void IsisMain () { // Make sure it is a WAC cube Isis::PvlGroup &inst = icube->getLabel()->FindGroup("Instrument", Pvl::Traverse); - IString instId = (string) inst["InstrumentId"]; - instId.UpCase(); + QString instId = (QString) inst["InstrumentId"]; + instId = instId.toUpper(); if (instId != "WAC-VIS" && instId != "WAC-UV") { - string msg = "This program is intended for use on LROC WAC images only. ["; + QString msg = "This program is intended for use on LROC WAC images only. ["; msg += icube->getFileName() + "] does not appear to be a WAC image."; throw IException(IException::User, msg, _FILEINFO_); } // And check if it has already run through calibration if (icube->getLabel()->FindObject("IsisCube").HasGroup("Radiometry")) { - string msg = "This image has already been calibrated"; + QString msg = "This image has already been calibrated"; throw IException(IException::User, msg, _FILEINFO_); } if (icube->getLabel()->FindObject("IsisCube").HasGroup("AlphaCube")) { - string msg = "This application can not be run on any image that has been geometrically transformed (i.e. scaled, rotated, sheared, or reflected) or cropped."; + QString msg = "This application can not be run on any image that has been geometrically transformed (i.e. scaled, rotated, sheared, or reflected) or cropped."; throw IException(IException::User, msg, _FILEINFO_); } @@ -88,12 +88,12 @@ void IsisMain () { g_specpix = ui.GetBoolean("SPECIALPIXELS"); // Determine the dark/flat files to use - IString offset = (string) inst["BackgroundOffset"]; - IString mode = (string) inst["Mode"]; - IString instModeId = (string) inst["InstrumentModeId"]; - instModeId.UpCase(); + QString offset = (QString) inst["BackgroundOffset"]; + QString mode = (QString) inst["Mode"]; + QString instModeId = (QString) inst["InstrumentModeId"]; + instModeId = instModeId.toUpper(); - if (instModeId == "COLOR" && (string) inst["InstrumentId"] == "WAC-UV") + if (instModeId == "COLOR" && (QString) inst["InstrumentId"] == "WAC-UV") instModeId = "UV"; else if (instModeId == "VIS") instModeId = "COLOR"; @@ -103,11 +103,11 @@ void IsisMain () { g_numFrames = (int) inst["NumFramelets"]; - vector darkFiles; + vector darkFiles; ui.GetAsString("DARKFILE", darkFiles); - IString flatFile = ui.GetAsString("FLATFIELDFILE"); - IString radFile = ui.GetAsString("RADIOMETRICFILE"); - IString specpixFile = ui.GetAsString("SPECIALPIXELSFILE"); + QString flatFile = ui.GetAsString("FLATFIELDFILE"); + QString radFile = ui.GetAsString("RADIOMETRICFILE"); + QString specpixFile = ui.GetAsString("SPECIALPIXELSFILE"); // Figure out which bands are input for (int i = 1; i <= icube->getBandCount(); i++) { @@ -115,14 +115,14 @@ void IsisMain () { } Isis::PvlGroup &bandBin = icube->getLabel()->FindGroup("BandBin", Pvl::Traverse); - IString filter = (string) bandBin["Center"][0]; + QString filter = (QString) bandBin["Center"][0]; if (g_dark) { if (darkFiles.size() == 0 || darkFiles[0] =="Default" || darkFiles[0].length() == 0) { darkFiles.resize(2); double temp = (double) inst["MiddleTemperatureFpa"]; double time = iTime(inst["StartTime"][0]).Et(); - string darkFile = "$lro/calibration/wac_darks/WAC_" + instModeId; + QString darkFile = "$lro/calibration/wac_darks/WAC_" + instModeId; if (instModeId == "BW") darkFile += "_" + filter + "_Mode" + mode; darkFile += "_Offset" + offset + "_*C_*T_Dark.????.cub"; @@ -136,16 +136,16 @@ void IsisMain () { } else { CopyCubeIntoBuffer(darkFiles[0], g_darkCube1); - int index = darkFiles[0].find_last_of("_"); - g_temp1 = IString(darkFiles[0].substr( darkFiles[0].find_last_of("_", index-1), index)).ToDouble(); + int index = darkFiles[0].lastIndexOf("_"); + g_temp1 = IString(darkFiles[0].mid( darkFiles[0].lastIndexOf("_", index-1), index)).ToDouble(); CopyCubeIntoBuffer(darkFiles[1], g_darkCube2); - index = darkFiles[1].find_last_of("_"); - g_temp2 = IString(darkFiles[1].substr( darkFiles[1].find_last_of("_", index-1), index)).ToDouble(); + index = darkFiles[1].lastIndexOf("_"); + g_temp2 = IString(darkFiles[1].mid( darkFiles[1].lastIndexOf("_", index-1), index)).ToDouble(); } } if (g_flatfield) { - if (flatFile.Equal("Default") || flatFile.length() == 0) { + if (flatFile.toLower() == "default" || flatFile.length() == 0) { flatFile = "$lro/calibration/wac_flats/WAC_" + instModeId; if (instModeId == "BW") flatFile += "_" + filter + "_Mode" + mode; @@ -165,14 +165,14 @@ void IsisMain () { Isis::PvlKeyword &bands = icube->getLabel()->FindGroup("BandBin", Pvl::Traverse).FindKeyword("FilterNumber"); - if (radFile.Equal("Default") || radFile.length() == 0) + if (radFile.toLower() == "default" || radFile.length() == 0) radFile = "$lro/calibration/WAC_RadiometricResponsivity.????.pvl"; FileName radFileName(radFile); if (radFileName.isVersioned()) radFileName = radFileName.highestVersion(); if (!radFileName.fileExists()) { - string msg = radFile + " does not exist."; + QString msg = radFile + " does not exist."; throw IException(IException::User, msg, _FILEINFO_); } @@ -182,46 +182,46 @@ void IsisMain () { responsivity = radPvl["IOF"]; for (int i = 0; i < bands.Size(); i++) - g_iofResponsivity.push_back(responsivity[(int)bands[i] - 1]); + g_iofResponsivity.push_back(toDouble(responsivity[toInt(bands[i]) - 1])); try { - iTime startTime((string) inst["StartTime"]); + iTime startTime((QString) inst["StartTime"]); double etStart = startTime.Et(); // Get the distance between the Moon and the Sun at the given time in // Astronomical Units (AU) - string bspKernel1 = p.MissionData("lro", "/kernels/tspk/moon_pa_de421_1900-2050.bpc", false); - string bspKernel2 = p.MissionData("lro", "/kernels/tspk/de421.bsp", false); - furnsh_c(bspKernel1.c_str()); - furnsh_c(bspKernel2.c_str()); - string pckKernel1 = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); - string pckKernel2 = p.MissionData("lro", "/kernels/pck/moon_080317.tf", false); - string pckKernel3 = p.MissionData("lro", "/kernels/pck/moon_assoc_me.tf", false); - furnsh_c(pckKernel1.c_str()); - furnsh_c(pckKernel2.c_str()); - furnsh_c(pckKernel3.c_str()); + QString bspKernel1 = p.MissionData("lro", "/kernels/tspk/moon_pa_de421_1900-2050.bpc", false); + QString bspKernel2 = p.MissionData("lro", "/kernels/tspk/de421.bsp", false); + furnsh_c(bspKernel1.toAscii().data()); + furnsh_c(bspKernel2.toAscii().data()); + QString pckKernel1 = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); + QString pckKernel2 = p.MissionData("lro", "/kernels/pck/moon_080317.tf", false); + QString pckKernel3 = p.MissionData("lro", "/kernels/pck/moon_assoc_me.tf", false); + furnsh_c(pckKernel1.toAscii().data()); + furnsh_c(pckKernel2.toAscii().data()); + furnsh_c(pckKernel3.toAscii().data()); double sunpos[6], lt; spkezr_c("sun", etStart, "MOON_ME", "LT+S", "MOON", sunpos, <); g_solarDistance = vnorm_c(sunpos) / KM_PER_AU; - unload_c(bspKernel1.c_str()); - unload_c(bspKernel2.c_str()); - unload_c(pckKernel1.c_str()); - unload_c(pckKernel2.c_str()); - unload_c(pckKernel3.c_str()); + unload_c(bspKernel1.toAscii().data()); + unload_c(bspKernel2.toAscii().data()); + unload_c(pckKernel1.toAscii().data()); + unload_c(pckKernel2.toAscii().data()); + unload_c(pckKernel3.toAscii().data()); } catch (IException &e) { - string msg = "Can not find necessary SPICE kernels for converting to IOF"; + QString msg = "Can not find necessary SPICE kernels for converting to IOF"; throw IException(e, IException::User, msg, _FILEINFO_); } } else { responsivity = radPvl["Radiance"]; for (int i = 0; i < bands.Size(); i++) - g_radianceResponsivity.push_back(responsivity[(int)bands[i] - 1]); + g_radianceResponsivity.push_back(toDouble(responsivity[toInt(bands[i]) - 1])); } } if (g_specpix) { - if (specpixFile.Equal("Default") || specpixFile.length() == 0) { + if (specpixFile.toLower() == "default" || specpixFile.length() == 0) { specpixFile = "$lro/calibration/wac_masks/WAC_" + instModeId; double temp = (double) inst["MiddleTemperatureFpa"]; if (instModeId == "BW") @@ -267,15 +267,15 @@ void IsisMain () { if (g_iof) { calgrp += PvlKeyword("RadiometricType", "IOF"); for (unsigned int i=0; i< g_iofResponsivity.size(); i++) - vals.AddValue(g_iofResponsivity[i]); + vals.AddValue(toString(g_iofResponsivity[i])); } else { calgrp += PvlKeyword("RadiometricType", "AbsoluteRadiance"); for (unsigned int i=0; i< g_radianceResponsivity.size(); i++) - vals.AddValue(g_radianceResponsivity[i]); + vals.AddValue(toString(g_radianceResponsivity[i])); } calgrp += vals; - calgrp += PvlKeyword("SolarDistance", g_solarDistance); + calgrp += PvlKeyword("SolarDistance", toString(g_solarDistance)); } if (g_specpix) calgrp += PvlKeyword("SpecialPixelsFile", specpixFile); @@ -330,11 +330,11 @@ void Calibrate ( Buffer &inCube, Buffer &outCube ) { // We're bypassing Buffer::at for speed, so we need to make sure our // index will not overrun the buffer if(offset + frameSize > g_darkCube1->size()) { - string message = Message::ArraySubscriptNotInRange(offset + frameSize) + " (Dark cube 1)"; + QString message = Message::ArraySubscriptNotInRange(offset + frameSize) + " (Dark cube 1)"; throw IException(IException::Programmer, message, _FILEINFO_); } if(offset + frameSize > g_darkCube2->size()) { - string message = Message::ArraySubscriptNotInRange(offset + frameSize) + " (Dark cube 2)"; + QString message = Message::ArraySubscriptNotInRange(offset + frameSize) + " (Dark cube 2)"; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -384,7 +384,7 @@ void Calibrate ( Buffer &inCube, Buffer &outCube ) { // We're bypassing Buffer::at for speed, so we need to make sure our // index will not overrun the buffer if(offset + frameSize > g_flatCube->size()) { - string message = Message::ArraySubscriptNotInRange(offset + frameSize) + " (Flat-field cube)"; + QString message = Message::ArraySubscriptNotInRange(offset + frameSize) + " (Flat-field cube)"; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -428,13 +428,13 @@ void Calibrate ( Buffer &inCube, Buffer &outCube ) { } } -void CopyCubeIntoBuffer ( string &fileString, Buffer* &data) { +void CopyCubeIntoBuffer ( QString &fileString, Buffer* &data) { Cube cube; FileName filename(fileString); if (filename.isVersioned()) filename = filename.highestVersion(); if (!filename.fileExists()) { - string msg = fileString + " does not exist."; + QString msg = fileString + " does not exist."; throw IException(IException::User, msg, _FILEINFO_); } cube.open(filename.expanded()); @@ -510,21 +510,21 @@ struct DarkComp { * @param file1 Filename of dark file 1 * @param file2 Filename of dark file 2 */ -void GetDark(string fileString, double temp, double time, Buffer* &data1, Buffer* &data2, double & temp1, double & temp2, string & file1, string & file2) { +void GetDark(QString fileString, double temp, double time, Buffer* &data1, Buffer* &data2, double & temp1, double & temp2, QString & file1, QString & file2) { FileName filename(fileString); - string basename = FileName(filename.baseName()).baseName(); // We do it twice to remove the ".????.cub" + QString basename = FileName(filename.baseName()).baseName(); // We do it twice to remove the ".????.cub" // create a regular expression to capture the temp and time from filenames - QString regexPattern(basename.c_str()); + QString regexPattern(basename); regexPattern.replace("*", "([0-9\\.-]*)"); QRegExp regex(regexPattern); // create a filter for the QDir to only load files matching our name - QString filter(basename.c_str()); + QString filter(basename); filter.append(".*"); // get a list of dark files that match our basename - QDir dir( (QString)filename.path().c_str(), filter ); + QDir dir( filename.path(), filter ); vector darkFiles; darkFiles.reserve(dir.count()); @@ -537,7 +537,7 @@ void GetDark(string fileString, double temp, double time, Buffer* &data1, Buffer continue; // filename did not match basename regex (time or temp contain non-digit) } - // Get a list of regex matches. Item 0 should be the full string, item 1 + // Get a list of regex matches. Item 0 should be the full QString, item 1 // is temp and item 2 is time. QStringList texts = regex.capturedTexts(); if (texts.size() < 3) { @@ -558,7 +558,7 @@ void GetDark(string fileString, double temp, double time, Buffer* &data1, Buffer // we require at least 2 different dark files to interpolate/extrapolate if (darkFiles.size() < 2) { - string msg = "Not enough Dark files exist for these image options [" + basename + "]. Need at least 2 files with different temperatures\n"; + QString msg = "Not enough Dark files exist for these image options [" + basename + "]. Need at least 2 files with different temperatures\n"; throw IException(IException::User, msg, _FILEINFO_); } @@ -586,35 +586,35 @@ void GetDark(string fileString, double temp, double time, Buffer* &data1, Buffer int time1 = darkFiles[temp1Index].time; int time2 = darkFiles[temp2Index].time; - unsigned int tempIndex = fileString.find("*C"); - unsigned int timeIndex = fileString.find("*T"); + int tempIndex = fileString.indexOf("*C"); + int timeIndex = fileString.indexOf("*T"); file1 = fileString; - file1.replace(timeIndex, 1, IString(time1)); - file1.replace(tempIndex, 1, IString((int)temp1)); + file1.replace(timeIndex, 1, toString(time1)); + file1.replace(tempIndex, 1, toString((int)temp1)); file2 = fileString; - file2.replace(timeIndex, 1, IString(time2)); - file2.replace(tempIndex, 1, IString((int)temp2)); + file2.replace(timeIndex, 1, toString(time2)); + file2.replace(tempIndex, 1, toString((int)temp2)); CopyCubeIntoBuffer ( file1, data1 ); CopyCubeIntoBuffer ( file2, data2 ); } -void GetMask(string &fileString, double temp, Buffer* &data) { +void GetMask(QString &fileString, double temp, Buffer* &data) { FileName filename(fileString); - string basename = FileName(filename.baseName()).baseName(); // We do it twice to remove the ".????.cub" + QString basename = FileName(filename.baseName()).baseName(); // We do it twice to remove the ".????.cub" - unsigned int index = basename.find_first_of("*"); + unsigned int index = basename.indexOf("*"); // create a filter for the QDir to only load files matching our name - QString filter(basename.c_str()); + QString filter(basename); filter.append(".*"); - QDir dir( (QString)filename.path().c_str(), filter ); + QDir dir( filename.path(), filter ); // create a regular expression to capture the temp and time from filenames - QString regexPattern(basename.c_str()); + QString regexPattern(basename); regexPattern.replace("*", "([0-9\\.-]*)"); QRegExp regex(regexPattern); @@ -626,7 +626,7 @@ void GetMask(string &fileString, double temp, Buffer* &data) { continue; // filename did not match basename regex (temp contain non-digit) } - // Get a list of regex matches. Item 0 should be the full string, item 1 is temp + // Get a list of regex matches. Item 0 should be the full QString, item 1 is temp QStringList texts = regex.capturedTexts(); if (texts.size() < 2) { continue; // could not find temp @@ -645,12 +645,12 @@ void GetMask(string &fileString, double temp, Buffer* &data) { } if (bestTemp == DBL_MAX) { - string msg = "No files exist for these mask options [" + basename + "]"; + QString msg = "No files exist for these mask options [" + basename + "]"; throw IException(IException::User, msg, _FILEINFO_); } - index = fileString.find_first_of("*"); - fileString.replace(index, 1, IString((int)bestTemp)); + index = fileString.indexOf("*"); + fileString.replace(index, 1, toString((int)bestTemp)); CopyCubeIntoBuffer ( fileString, data ); } diff --git a/isis/src/lro/apps/lrowacpho/Exponential.cpp b/isis/src/lro/apps/lrowacpho/Exponential.cpp index c7fde854dd..c168bbda74 100644 --- a/isis/src/lro/apps/lrowacpho/Exponential.cpp +++ b/isis/src/lro/apps/lrowacpho/Exponential.cpp @@ -129,9 +129,9 @@ namespace Isis { pvl.AddComment(" F(phase) = A0*exp(B0*phase) + A1*exp(B1*phase) + ... + An*exp(Bn*phase)"); pvl += PvlKeyword("Algorithm", "Exponential"); - pvl += PvlKeyword("IncRef", _iRef, "degrees"); - pvl += PvlKeyword("EmaRef", _eRef, "degrees"); - pvl += PvlKeyword("PhaRef", _gRef, "degrees"); + pvl += PvlKeyword("IncRef", toString(_iRef), "degrees"); + pvl += PvlKeyword("EmaRef", toString(_eRef), "degrees"); + pvl += PvlKeyword("PhaRef", toString(_gRef), "degrees"); PvlKeyword units("ExponentialUnits"); PvlKeyword phostd("PhotometricStandard"); PvlKeyword bbc("BandBinCenter"); @@ -141,21 +141,21 @@ namespace Isis { std::vector < PvlKeyword > aTermKeywords; std::vector < PvlKeyword > bTermKeywords; for (unsigned int i = 0; i < _bandpho[0].aTerms.size(); i++) - aTermKeywords.push_back(PvlKeyword("A" + IString((int) i))); + aTermKeywords.push_back(PvlKeyword("A" + toString((int) i))); for (unsigned int i = 0; i < _bandpho[0].bTerms.size(); i++) - bTermKeywords.push_back(PvlKeyword("B" + IString((int) i))); + bTermKeywords.push_back(PvlKeyword("B" + toString((int) i))); for (unsigned int i = 0; i < _bandpho.size(); i++) { Parameters &p = _bandpho[i]; units.AddValue(p.units); - phostd.AddValue(p.phoStd); - bbc.AddValue(p.wavelength); - bbct.AddValue(p.tolerance); - bbn.AddValue(p.band); + phostd.AddValue(toString(p.phoStd)); + bbc.AddValue(toString(p.wavelength)); + bbct.AddValue(toString(p.tolerance)); + bbn.AddValue(toString(p.band)); for (unsigned int j = 0; j < aTermKeywords.size(); j++) - aTermKeywords[j].AddValue(p.aTerms[j]); + aTermKeywords[j].AddValue(toString(p.aTerms[j])); for (unsigned int j = 0; j < bTermKeywords.size(); j++) - bTermKeywords[j].AddValue(p.bTerms[j]); + bTermKeywords[j].AddValue(toString(p.bTerms[j])); } pvl += units; pvl += phostd; @@ -194,8 +194,8 @@ namespace Isis { for (unsigned int i = 0; i < _profiles.size(); i++) { const DbProfile &p = _profiles[i]; if (p.exists("BandBinCenter")) { - double p_center = ConfKey(p, "BandBinCenter", Null); - double tolerance = ConfKey(p, "BandBinCenterTolerance", 1.0E-6); + double p_center = toDouble(ConfKey(p, "BandBinCenter", toString(Null))); + double tolerance = toDouble(ConfKey(p, "BandBinCenterTolerance", toString(1.0E-6))); if (fabs(wavelength - p_center) <= fabs(tolerance)) { Parameters pars = extract(p); pars.iProfile = i; @@ -227,17 +227,17 @@ namespace Isis { Parameters pars; for (int i = 0; i < p.size(); i++) { - if (p.exists("A" + IString(i)) || p.exists("B" + IString(i))) { - pars.aTerms.push_back(ConfKey(p, "A" + IString(i), 1.0)); - pars.bTerms.push_back(ConfKey(p, "B" + IString(i), 0.0)); + if (p.exists("A" + toString(i)) || p.exists("B" + toString(i))) { + pars.aTerms.push_back(toDouble(ConfKey(p, "A" + toString(i), (QString)"1.0"))); + pars.bTerms.push_back(toDouble(ConfKey(p, "B" + toString(i), (QString)"0.0"))); } } - pars.wavelength = ConfKey(p, "BandBinCenter", Null); - pars.tolerance = ConfKey(p, "BandBinCenterTolerance", Null); + pars.wavelength = toDouble(ConfKey(p, "BandBinCenter", toString(Null))); + pars.tolerance = toDouble(ConfKey(p, "BandBinCenterTolerance", toString(Null))); // Determine equation units - defaults to Radians - pars.units = ConfKey(p, "ExponentialUnits", IString("Radians")); - pars.phaUnit = (IString::Equal(pars.units, "Degrees")) ? 1.0 : rpd_c(); + pars.units = ConfKey(p, "ExponentialUnits", toString("Radians")); + pars.phaUnit = (pars.units.toLower() == "degrees") ? 1.0 : rpd_c(); return (pars); } @@ -263,15 +263,15 @@ namespace Isis { // Interate over all Photometric groups _normProf = DbProfile(pvl.FindObject("NormalizationModel").FindGroup("Algorithm", Pvl::Traverse)); - _iRef = ConfKey(_normProf, "IncRef", 30.0); - _eRef = ConfKey(_normProf, "EmaRef", 0.0); - _gRef = ConfKey(_normProf, "PhaRef", _iRef); + _iRef = toDouble(ConfKey(_normProf, "IncRef", toString(30.0))); + _eRef = toDouble(ConfKey(_normProf, "EmaRef", toString(0.0))); + _gRef = toDouble(ConfKey(_normProf, "PhaRef", toString(_iRef))); PvlObject &phoObj = pvl.FindObject("PhotometricModel"); DbProfile phoProf = DbProfile(phoObj); PvlObject::PvlGroupIterator algo = phoObj.BeginGroup(); while (algo != phoObj.EndGroup()) { - if (IString::Equal(algo->Name(), "Algorithm")) { + if (algo->Name().toLower() == "algorithm") { _profiles.push_back(DbProfile(phoProf, DbProfile(*algo))); } ++algo; @@ -279,9 +279,9 @@ namespace Isis { Pvl *label = cube.getLabel(); PvlKeyword center = label->FindGroup("BandBin", Pvl::Traverse)["Center"]; - string errs(""); + QString errs(""); for (int i = 0; i < cube.getBandCount(); i++) { - Parameters parms = findParameters(center[i]); + Parameters parms = findParameters(toDouble(center[i])); if (parms.IsValid()) { parms.band = i + 1; //_camera->SetBand(i + 1); @@ -298,7 +298,7 @@ namespace Isis { } // Check for errors and throw them all at the same time - if (!errs.empty()) { + if (!errs.isEmpty()) { errs += " --> Errors in the input PVL file \"" + pvl.FileName() + "\""; throw IException(IException::User, errs, _FILEINFO_); } diff --git a/isis/src/lro/apps/lrowacpho/Exponential.h b/isis/src/lro/apps/lrowacpho/Exponential.h index 1f1fe15d27..bc0e8d8923 100644 --- a/isis/src/lro/apps/lrowacpho/Exponential.h +++ b/isis/src/lro/apps/lrowacpho/Exponential.h @@ -1,4 +1,4 @@ -#if !defined(Exponential_h) +#ifndef Exponential_h #define Exponential_h /** * @file @@ -29,9 +29,9 @@ #include #include "PhotometricFunction.h" -#include "IString.h" #include "Camera.h" #include "DbProfile.h" +#include "IString.h" #include "SpecialPixel.h" namespace Isis { @@ -85,7 +85,7 @@ namespace Isis { std::vector bTerms; // aTermKeywords; std::vector bTermKeywords; for (unsigned int i = 0; i < _bandpho[0].aTerms.size(); i++) - aTermKeywords.push_back(PvlKeyword("A" + IString((int) i+1))); + aTermKeywords.push_back(PvlKeyword("A" + toString((int) i+1))); for (unsigned int i = 0; i < _bandpho[0].bTerms.size(); i++) - bTermKeywords.push_back(PvlKeyword("B" + IString((int) i+1))); + bTermKeywords.push_back(PvlKeyword("B" + toString((int) i+1))); for (unsigned int i = 0; i < _bandpho.size(); i++) { Parameters &p = _bandpho[i]; units.AddValue(p.units); - phostd.AddValue(p.phoStd); - bbc.AddValue(p.wavelength); - bbct.AddValue(p.tolerance); - bbn.AddValue(p.band); + phostd.AddValue(toString(p.phoStd)); + bbc.AddValue(toString(p.wavelength)); + bbct.AddValue(toString(p.tolerance)); + bbn.AddValue(toString(p.band)); for (unsigned int j = 0; j < aTermKeywords.size(); j++) - aTermKeywords[j].AddValue(p.aTerms[j]); + aTermKeywords[j].AddValue(toString(p.aTerms[j])); for (unsigned int j = 0; j < bTermKeywords.size(); j++) - bTermKeywords[j].AddValue(p.bTerms[j]); + bTermKeywords[j].AddValue(toString(p.bTerms[j])); } pvl += units; pvl += phostd; @@ -199,8 +199,8 @@ namespace Isis { for (unsigned int i = 0; i < _profiles.size(); i++) { const DbProfile &p = _profiles[i]; if (p.exists("BandBinCenter")) { - double p_center = ConfKey(p, "BandBinCenter", Null); - double tolerance = ConfKey(p, "BandBinCenterTolerance", 1.0E-6); + double p_center = toDouble(ConfKey(p, "BandBinCenter", toString(Null))); + double tolerance = toDouble(ConfKey(p, "BandBinCenterTolerance", toString(1.0E-6))); if (fabs(wavelength - p_center) <= fabs(tolerance)) { Parameters pars = extract(p); pars.iProfile = i; @@ -232,16 +232,16 @@ namespace Isis { Parameters pars; for (int i=1; i<=4; i++) - pars.aTerms.push_back(ConfKey(p, "A" + IString(i), 0.0)); + pars.aTerms.push_back(toDouble(ConfKey(p, "A" + toString(i), toString(0.0)))); for (int i=1; i<=2; i++) - pars.bTerms.push_back(ConfKey(p, "B" + IString(i), 0.0)); + pars.bTerms.push_back(toDouble(ConfKey(p, "B" + toString(i), toString(0.0)))); - pars.wavelength = ConfKey(p, "BandBinCenter", Null); - pars.tolerance = ConfKey(p, "BandBinCenterTolerance", Null); + pars.wavelength = toDouble(ConfKey(p, "BandBinCenter", toString(Null))); + pars.tolerance = toDouble(ConfKey(p, "BandBinCenterTolerance", toString(Null))); // Determine equation units - defaults to Radians - pars.units = ConfKey(p, "HapkeExponentialUnits", IString("Radians")); - pars.phaUnit = (IString::Equal(pars.units, "Degrees")) ? 1.0 : rpd_c(); + pars.units = ConfKey(p, "HapkeExponentialUnits", QString("Radians")); + pars.phaUnit = (pars.units.toLower() == "degrees") ? 1.0 : rpd_c(); return (pars); } @@ -266,15 +266,15 @@ namespace Isis { // Interate over all Photometric groups _normProf = DbProfile(pvl.FindObject("NormalizationModel").FindGroup("Algorithm", Pvl::Traverse)); - _iRef = ConfKey(_normProf, "IncRef", 30.0); - _eRef = ConfKey(_normProf, "EmaRef", 0.0); - _gRef = ConfKey(_normProf, "PhaRef", _iRef); + _iRef = toDouble(ConfKey(_normProf, "IncRef", toString(30.0))); + _eRef = toDouble(ConfKey(_normProf, "EmaRef", toString(0.0))); + _gRef = toDouble(ConfKey(_normProf, "PhaRef", toString(_iRef))); PvlObject &phoObj = pvl.FindObject("PhotometricModel"); DbProfile phoProf = DbProfile(phoObj); PvlObject::PvlGroupIterator algo = phoObj.BeginGroup(); while (algo != phoObj.EndGroup()) { - if (IString::Equal(algo->Name(), "Algorithm")) { + if (algo->Name().toLower() == "algorithm") { _profiles.push_back(DbProfile(phoProf, DbProfile(*algo))); } ++algo; @@ -282,9 +282,9 @@ namespace Isis { Pvl *label = cube.getLabel(); PvlKeyword center = label->FindGroup("BandBin", Pvl::Traverse)["Center"]; - string errs(""); + QString errs(""); for (int i = 0; i < cube.getBandCount(); i++) { - Parameters parms = findParameters(center[i]); + Parameters parms = findParameters(toDouble(center[i])); if (parms.IsValid()) { parms.band = i + 1; //_camera->SetBand(i + 1); @@ -301,7 +301,7 @@ namespace Isis { } // Check for errors and throw them all at the same time - if (!errs.empty()) { + if (!errs.isEmpty()) { errs += " --> Errors in the input PVL file \"" + pvl.FileName() + "\""; throw IException(IException::User, errs, _FILEINFO_); } diff --git a/isis/src/lro/apps/lrowacpho/HapkeExponential.h b/isis/src/lro/apps/lrowacpho/HapkeExponential.h index 890cec1e33..647695791f 100644 --- a/isis/src/lro/apps/lrowacpho/HapkeExponential.h +++ b/isis/src/lro/apps/lrowacpho/HapkeExponential.h @@ -1,4 +1,4 @@ -#if !defined(HapkeExponential_h) +#ifndef HapkeExponential_h #define HapkeExponential_h /** * @file @@ -84,7 +84,7 @@ namespace Isis { std::vector bTerms; //Name(), "Algorithm")) { + if (algo->Name().toLower() == "algorithm") { _profiles.push_back(DbProfile(phoProf, DbProfile(*algo))); } ++algo; @@ -278,9 +278,9 @@ namespace Isis { Pvl *label = cube.getLabel(); PvlKeyword center = label->FindGroup("BandBin", Pvl::Traverse)["Center"]; - string errs(""); + QString errs(""); for (int i = 0; i < cube.getBandCount(); i++) { - Parameters parms = findParameters(center[i]); + Parameters parms = findParameters(toDouble(center[i])); if (parms.IsValid()) { parms.band = i + 1; //_camera->SetBand(i + 1); @@ -297,7 +297,7 @@ namespace Isis { } // Check for errors and throw them all at the same time - if (!errs.empty()) { + if (!errs.isEmpty()) { errs += " --> Errors in the input PVL file \"" + pvl.FileName() + "\""; throw IException(IException::User, errs, _FILEINFO_); } diff --git a/isis/src/lro/apps/lrowacpho/Hillier.h b/isis/src/lro/apps/lrowacpho/Hillier.h index 9ce61a1d1e..7b29482b21 100644 --- a/isis/src/lro/apps/lrowacpho/Hillier.h +++ b/isis/src/lro/apps/lrowacpho/Hillier.h @@ -1,4 +1,4 @@ -#if !defined(Hillier_h) +#ifndef Hillier_h #define Hillier_h /** * @file @@ -79,7 +79,7 @@ namespace Isis { double b0, b1, a0, a1, a2, a3, a4; // - T ConfKey ( const DbProfile &conf, const std::string &keyname, const T &defval, int index = 0 ) const { + T ConfKey ( const DbProfile &conf, const QString &keyname, const T &defval, int index = 0 ) const { if (!conf.exists(keyname)) { return (defval); } if (conf.count(keyname) < index) { return (defval); } - IString iValue(conf.value(keyname, index)); - T value = iValue; // This makes it work with a string? - return (value); + return conf.value(keyname, index); } }; diff --git a/isis/src/lro/apps/mrf2isis/mrf2isis.cpp b/isis/src/lro/apps/mrf2isis/mrf2isis.cpp index e1269ed9b2..5f860a1012 100644 --- a/isis/src/lro/apps/mrf2isis/mrf2isis.cpp +++ b/isis/src/lro/apps/mrf2isis/mrf2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "ProcessImportPds.h" @@ -16,29 +16,27 @@ void IsisMain() { Pvl label; UserInterface &ui = Application::GetUserInterface(); - string labelFile = ui.GetFileName("FROM"); + QString labelFile = ui.GetFileName("FROM"); FileName inFile = ui.GetFileName("FROM"); - IString id; + QString id; Pvl lab(inFile.expanded()); try { - id = (string) lab.FindKeyword("DATA_SET_ID"); + id = (QString) lab.FindKeyword("DATA_SET_ID"); } catch(IException &e) { - string msg = "Unable to read [DATA_SET_ID] from input file [" + + QString msg = "Unable to read [DATA_SET_ID] from input file [" + inFile.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } - id.ConvertWhiteSpace(); - id.Compress(); - id.Trim(" "); + id = id.simplified().trimmed(); if(id != "CHAN1-L-MRFFR-5-CDR-MAP-V1.0" && id != "CHAN1-L-MRFFR-4-CDR-V1.0" && id != "CH1-ORB-L-MRFFR-4-CDR-V1.0" && id != "CH1-ORB-L-MRFFR-5-CDR-MAP-V1.0" && id != "CH1-ORB-L-MRFFR-5-CDR-MOSAIC-V1.0" && id != "LRO-L-MRFLRO-3-CDR-V1.0" && id != "LRO-L-MRFLRO-5-CDR-MAP-V1.0" && id != "LRO-L-MRFLRO-4-CDR-V1.0" && id != "LRO-L-MRFLRO-5-CDR-MOSAIC-V1.0") { - string msg = "Input file [" + inFile.expanded() + "] does not appear to be " + + QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + "in CHANDRAYAAN-1 MINI-RF FORERUNNER level 1 or level 2 format " + "or in LUNAR RECONNAISSANCE ORBITER MINI-RF LRO level 1 or " + "level 2 format. " + @@ -49,9 +47,9 @@ void IsisMain() { p.SetPdsFile(labelFile, "", label); Cube *outcube = p.SetOutputCube("TO"); - IString bandorder; - bandorder = (string) lab.FindObject("IMAGE").FindKeyword("BAND_STORAGE_TYPE"); - bandorder.UpCase(); + QString bandorder; + bandorder = (QString) lab.FindObject("IMAGE").FindKeyword("BAND_STORAGE_TYPE"); + bandorder = bandorder.toUpper(); if(bandorder == "BAND_SEQUENTIAL") { p.SetOrganization(Isis::ProcessImport::BSQ); } @@ -62,7 +60,7 @@ void IsisMain() { p.SetOrganization(Isis::ProcessImport::BIL); } else { - string msg = "Input file [" + inFile.expanded() + "] has an invalid " + + QString msg = "Input file [" + inFile.expanded() + "] has an invalid " + "band storage type. BAND_STORAGE_TYPE is [" + bandorder + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -74,7 +72,7 @@ void IsisMain() { // Get the directory where the MiniRF level 2 translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Lro"] + "/translations/"; + QString transDir = (QString) dataDir["Lro"] + "/translations/"; if(id == "CHAN1-L-MRFFR-5-CDR-MAP-V1.0" || id == "LRO-L-MRFLRO-5-CDR-MAP-V1.0") { // Translate the BandBin group @@ -127,7 +125,7 @@ void IsisMain() { double pheight = instGrp["ScaledPixelHeight"]; double pwidth = instGrp["ScaledPixelWidth"]; if(pheight != pwidth) { - string msg = "Input file [" + inFile.expanded() + "] does not have valid " + + QString msg = "Input file [" + inFile.expanded() + "] does not have valid " + "ScaledPixelHeight and ScaledPixelWidth values. These values " + "must be equivalent or the image is considered to be invalid."; throw IException(IException::Io, msg, _FILEINFO_); @@ -138,24 +136,24 @@ void IsisMain() { // be done manually, because the frequency information was not // put in the PDS labels. if(!(instGrp.HasKeyword("Frequency"))) { - string instmodeid = instGrp["InstrumentModeId"]; + QString instmodeid = instGrp["InstrumentModeId"]; double frequency; - if(instmodeid.compare(0, 10, "BASELINE_S") == 0 || - instmodeid.compare(0, 6, "ZOOM_S") == 0) { + if(instmodeid.startsWith("BASELINE_S") || + instmodeid.startsWith("ZOOM_S")) { frequency = 2379305000.0; } else { // BASELINE_X or ZOOM_X frequency = 7140000000.0; } - instGrp.AddKeyword(PvlKeyword("Frequency", frequency)); + instGrp.AddKeyword(PvlKeyword("Frequency", toString(frequency))); outcube->putGroup(instGrp); } PvlGroup kerns("Kernels"); - if(id.compare(0, 5, "CHAN1") == 0 || id.compare(0, 3, "CH1") == 0) { - kerns += PvlKeyword("NaifFrameCode", -86001); + if(id.startsWith("CHAN1") || id.startsWith("CH1")) { + kerns += PvlKeyword("NaifFrameCode", toString(-86001)); } else { // LRO - kerns += PvlKeyword("NaifFrameCode", -85700); + kerns += PvlKeyword("NaifFrameCode", toString(-85700)); } outcube->putGroup(kerns); } diff --git a/isis/src/lro/apps/mrf2pds/mrf2pds.cpp b/isis/src/lro/apps/mrf2pds/mrf2pds.cpp index 56f98f2408..0b4d84cf60 100644 --- a/isis/src/lro/apps/mrf2pds/mrf2pds.cpp +++ b/isis/src/lro/apps/mrf2pds/mrf2pds.cpp @@ -20,8 +20,8 @@ using namespace std; using namespace Isis; void FixLabel(Pvl &pcPdsLbl, bool &pbLevel2); -void GetSourceProductID(std::string psSrcListFile, std::string psSrcType, Pvl &pcPdsLabel); -void GetUserLabel(std::string psUserLbl, Pvl &pdsLabel, bool pbLevel2); +void GetSourceProductID(QString psSrcListFile, QString psSrcType, Pvl &pcPdsLabel); +void GetUserLabel(QString psUserLbl, Pvl &pdsLabel, bool pbLevel2); static unsigned int iCheckSum = 0; @@ -38,7 +38,7 @@ void IsisMain() { // Get the output label file FileName outFile(ui.GetFileName("TO", "lbl")); - string outFileName(outFile.expanded()); + QString outFileName(outFile.expanded()); cProcess.SetDetached(outFileName); @@ -91,8 +91,8 @@ void IsisMain() { if(cInLabel->FindObject("IsisCube").FindGroup("Instrument").HasKeyword("MissionName")) { PvlKeyword &cKeyMissionName = cInLabel->FindObject("IsisCube").FindGroup("Instrument").FindKeyword("MissionName"); - size_t sFound = cKeyMissionName[0].find("CHANDRAYAAN"); - if(sFound != string::npos) { + int sFound = cKeyMissionName[0].indexOf("CHANDRAYAAN"); + if(sFound != -1) { cCubeLabel2 = PvlTranslationManager(cOrigLabel, "$lro/translations/mrfExportOrigLabelCH1.trn"); cCubeLabel2.Auto(pdsLabel); } @@ -121,14 +121,14 @@ void IsisMain() { // Get the Sources Product ID if entered for Level2 only as per example if(ui.WasEntered("SRC") && bLevel2) { - std::string sSrcFile = ui.GetFileName("SRC"); - std::string sSrcType = ui.GetString("TYPE"); + QString sSrcFile = ui.GetFileName("SRC"); + QString sSrcType = ui.GetString("TYPE"); GetSourceProductID(sSrcFile, sSrcType, pdsLabel); } // Get the User defined Labels if(ui.WasEntered("USERLBL")) { - std::string sUserLbl = ui.GetFileName("USERLBL"); + QString sUserLbl = ui.GetFileName("USERLBL"); GetUserLabel(sUserLbl, pdsLabel, bLevel2); } @@ -148,9 +148,9 @@ void IsisMain() { pdsLabel.SetFormatTemplate("$lro/translations/mrfPdsLevel3.pft"); } - size_t iFound = outFileName.find(".lbl"); + int iFound = outFileName.indexOf(".lbl"); outFileName.replace(iFound, 4, ".img"); - ofstream oCube(outFileName.c_str()); + ofstream oCube(outFileName.toAscii().data()); cProcess.OutputDetachedLabel(); //cProcess.OutputLabel(oCube); cProcess.StartProcess(oCube); @@ -168,7 +168,7 @@ void IsisMain() { * @param psUserLbl - User Label File * @param pcPdsLbl - Output Pds PVL */ -void GetUserLabel(std::string psUserLbl, Pvl &pcPdsLbl, bool pbLevel2) { +void GetUserLabel(QString psUserLbl, Pvl &pcPdsLbl, bool pbLevel2) { Pvl cUsrPvl(psUserLbl); /*if (pbLevel2 && @@ -177,7 +177,7 @@ void GetUserLabel(std::string psUserLbl, Pvl &pcPdsLbl, bool pbLevel2) { cUsrPvl.HasKeyword("START_TIME") || cUsrPvl.HasKeyword("STOP_TIME"))) { - std::string msg = "Unsupported User defined keywords for Level2"; + QString msg = "Unsupported User defined keywords for Level2"; throw Isis::iException::Message(Isis::iException::User,msg,_FILEINFO_); }*/ @@ -221,7 +221,7 @@ void GetUserLabel(std::string psUserLbl, Pvl &pcPdsLbl, bool pbLevel2) { * @param psSrcListFile - File containing source id's * @param pcPdsLbl - Output PVL */ -void GetSourceProductID(std::string psSrcListFile, std::string psSrcType, Pvl &pcPdsLbl) { +void GetSourceProductID(QString psSrcListFile, QString psSrcType, Pvl &pcPdsLbl) { PvlKeyword cKeySrcPrdId; if(pcPdsLbl.HasKeyword("SOURCE_PRODUCT_ID")) { @@ -240,7 +240,7 @@ void GetSourceProductID(std::string psSrcListFile, std::string psSrcType, Pvl &p // ID's - add directly to the PvlKeyword else { ifstream inIdFile; - inIdFile.open(psSrcListFile.c_str(), std::ios::in); + inIdFile.open(psSrcListFile.toAscii().data(), std::ios::in); char buff[501]; inIdFile.getline(buff, 500); while(!inIdFile.eof()) { @@ -332,8 +332,8 @@ void FixLabel(Pvl &pcPdsLbl, bool &pbLevel2) { // Update SAMPLE_TYPE from "IEEE_" to "PC_" if(cImageObject.HasKeyword("SAMPLE_TYPE")) { PvlKeyword &cSampleType = cImageObject.FindKeyword("SAMPLE_TYPE"); - string sVal = cSampleType[0]; - int iFound = sVal.find('_'); + QString sVal = cSampleType[0]; + int iFound = sVal.indexOf('_'); if(iFound >= 0) { sVal.replace(0, iFound, "PC"); cSampleType.SetValue(sVal); @@ -387,13 +387,13 @@ void FixLabel(Pvl &pcPdsLbl, bool &pbLevel2) { dLat = atan(z / (sqrt(pow(x, 2) + pow(y, 2)))) * (180 / Isis::PI); PvlKeyword cKeyRefLon("REFERENCE_LONGITUDE"); - IString iStr(dLon, 6); + QString iStr = toString(dLon, 6); iStr += " "; - cKeyRefLon.SetValue((std::string)iStr); + cKeyRefLon.SetValue(iStr); cProjectionObject.AddKeyword(cKeyRefLon); PvlKeyword cKeyRefLat("REFERENCE_LATITUDE"); - iStr = IString(dLat, 6); + iStr = toString(dLat, 6); iStr += " "; cKeyRefLat.SetValue(iStr); cProjectionObject.AddKeyword(cKeyRefLat); @@ -426,34 +426,30 @@ void FixLabel(Pvl &pcPdsLbl, bool &pbLevel2) { if(cProjectionObject.HasKeyword("LINE_PROJECTION_OFFSET")) { PvlKeyword &cLineProjOffset = cProjectionObject.FindKeyword("LINE_PROJECTION_OFFSET"); - string sVal = cLineProjOffset[0]; - int iFound = sVal.find('<'); + QString sVal = cLineProjOffset[0]; + int iFound = sVal.indexOf('<'); if(iFound >= 0) { - string::iterator it; - it = sVal.begin() + iFound; - sVal.erase(it); + sVal.remove(iFound, 1); cLineProjOffset.SetValue(sVal); } } if(cProjectionObject.HasKeyword("SAMPLE_PROJECTION_OFFSET")) { PvlKeyword &cSampleProjOffset = cProjectionObject.FindKeyword("SAMPLE_PROJECTION_OFFSET"); - string sVal = cSampleProjOffset[0]; - int iFound = sVal.find('<'); + QString sVal = cSampleProjOffset[0]; + int iFound = sVal.indexOf('<'); if(iFound >= 0) { - string::iterator it; - it = sVal.begin() + iFound; - sVal.erase(it); + sVal.remove(iFound, 1); cSampleProjOffset.SetValue(sVal); } } if(cProjectionObject.HasKeyword("MAP_SCALE")) { PvlKeyword &cMapScale = cProjectionObject.FindKeyword("MAP_SCALE"); - string sVal = cMapScale[0]; - int iFound = sVal.find("EL"); + QString sVal = cMapScale[0]; + int iFound = sVal.indexOf("EL"); if(iFound >= 0) { - sVal.erase(iFound, 2); + sVal.remove(iFound, 2); cMapScale.SetValue(sVal); } } diff --git a/isis/src/lro/objs/LroNarrowAngleCamera/LroNarrowAngleCamera.cpp b/isis/src/lro/objs/LroNarrowAngleCamera/LroNarrowAngleCamera.cpp index 710b0c76ce..b29e9c3579 100644 --- a/isis/src/lro/objs/LroNarrowAngleCamera/LroNarrowAngleCamera.cpp +++ b/isis/src/lro/objs/LroNarrowAngleCamera/LroNarrowAngleCamera.cpp @@ -52,28 +52,28 @@ namespace Isis { additiveLineTimeError = 0.0, multiplicativeLineTimeError = 0.0; - IString ikernKey = "INS" + IString((int)naifIkCode()) + "_CONSTANT_TIME_OFFSET"; + QString ikernKey = "INS" + toString(naifIkCode()) + "_CONSTANT_TIME_OFFSET"; constantTimeOffset = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_ADDITIONAL_PREROLL"; + ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIONAL_PREROLL"; additionalPreroll = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_ADDITIVE_LINE_ERROR"; + ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIVE_LINE_ERROR"; additiveLineTimeError = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_MULTIPLI_LINE_ERROR"; + ikernKey = "INS" + toString(naifIkCode()) + "_MULTIPLI_LINE_ERROR"; multiplicativeLineTimeError = getDouble(ikernKey); // Get the start time from labels PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - IString stime = (string)inst["SpacecraftClockPrerollCount"]; + QString stime = inst["SpacecraftClockPrerollCount"]; SpiceDouble etStart; if(stime != "NULL") { etStart = getClockTime(stime).Et(); } else { - etStart = iTime((string)inst["PrerollTime"]).Et(); + etStart = iTime((QString)inst["PrerollTime"]).Et(); } // Get other info from labels @@ -98,10 +98,10 @@ namespace Isis { CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); // Retrieve boresight location from instrument kernel (IK) (addendum?) - ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_SAMPLE"; + ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"; double sampleBoreSight = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_LINE"; + ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE"; double lineBoreSight = getDouble(ikernKey); focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight); diff --git a/isis/src/lro/objs/LroNarrowAngleCamera/LroNarrowAngleDistortionMap.cpp b/isis/src/lro/objs/LroNarrowAngleCamera/LroNarrowAngleDistortionMap.cpp index 49e2517c33..25213ec273 100644 --- a/isis/src/lro/objs/LroNarrowAngleCamera/LroNarrowAngleDistortionMap.cpp +++ b/isis/src/lro/objs/LroNarrowAngleCamera/LroNarrowAngleDistortionMap.cpp @@ -42,7 +42,7 @@ namespace Isis { * @param naifIkCode */ void LroNarrowAngleDistortionMap::SetDistortion(const int naifIkCode) { - std::string odkkey = "INS" + Isis::IString(naifIkCode) + "_OD_K"; + QString odkkey = "INS" + toString(naifIkCode) + "_OD_K"; p_odk.clear(); p_odk.push_back(p_camera->getDouble(odkkey, 0)); } diff --git a/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCamera.cpp b/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCamera.cpp index 956c34f92f..57dcc96ee8 100644 --- a/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCamera.cpp +++ b/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCamera.cpp @@ -56,7 +56,7 @@ namespace Isis { // Get the ephemeris time from the labels double et; PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - string stime = inst["SpacecraftClockStartCount"]; + QString stime = inst["SpacecraftClockStartCount"]; et = getClockTime(stime).Et(); p_exposureDur = inst["ExposureDuration"]; @@ -65,7 +65,7 @@ namespace Isis { p_etStart = et + ((p_exposureDur / 1000.0) / 2.0); // Compute the framelet size and number of framelets - IString instId = IString((string) inst["InstrumentId"]).UpCase(); + IString instId = QString((QString) inst["InstrumentId"]).toUpper(); int frameletSize = 14; int sumMode = 1; @@ -100,11 +100,11 @@ namespace Isis { } // Is the data flipped? - bool dataflipped = (inst["DataFlipped"][0].UpCase() == "YES"); + bool dataflipped = (inst["DataFlipped"][0].toUpper() == "YES"); // Now create detector offsets - IString instCode = "INS" + IString((int) naifIkCode()); - IString ikernKey = instCode + "_FILTER_BANDCENTER"; + QString instCode = "INS" + toString(naifIkCode()); + QString ikernKey = instCode + "_FILTER_BANDCENTER"; vector fbc = GetVector(ikernKey); ikernKey = instCode + "_FILTER_OFFSET"; vector foffset = GetVector(ikernKey); @@ -132,13 +132,13 @@ namespace Isis { // Now map the actual filter that exist in cube for(int i = 0; i < filtNames.Size(); i++) { - if(!filterToDetectorOffset.exists(filtNames[i])) { - string msg = "Unrecognized filter name [" + filtNames[i] + "]"; + if(!filterToDetectorOffset.exists((IString)filtNames[i])) { + QString msg = "Unrecognized filter name [" + filtNames[i] + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } - p_detectorStartLines.push_back(filterToDetectorOffset.get(filtNames[i])); - p_frameletOffsets.push_back(filterToFrameletOffset.get(filtNames[i])); + p_detectorStartLines.push_back(filterToDetectorOffset.get((IString)filtNames[i])); + p_frameletOffsets.push_back(filterToFrameletOffset.get((IString)filtNames[i])); } // Setup detector map @@ -168,7 +168,7 @@ namespace Isis { double lineBoreSight = getDouble(ikernKey); // get instrument-specific sample offset - IString instModeId = ((IString)(string) inst["InstrumentModeId"]).UpCase(); + QString instModeId = ((QString)inst["InstrumentModeId"]).toUpper(); // For BW mode, add the mode (0,1 (non-polar) or 2,3 (polar)) used to // acquire image if (instModeId == "BW") { @@ -191,7 +191,7 @@ namespace Isis { new LroWideAngleCameraDistortionMap(this, naifIkCode()); // Setup the ground and sky map - bool evenFramelets = (IString((string) inst["Framelets"][0]).UpCase() + bool evenFramelets = (QString(inst["Framelets"][0]).toUpper() == "EVEN"); new PushFrameCameraGroundMap(this, evenFramelets); @@ -238,11 +238,11 @@ namespace Isis { * @param key * @return @b int Pool key size */ - int LroWideAngleCamera::PoolKeySize(const string &key) const { + int LroWideAngleCamera::PoolKeySize(const QString &key) const { SpiceBoolean found; SpiceInt n; SpiceChar ctype[1]; - dtpool_c(key.c_str(), &found, &n, ctype); + dtpool_c(key.toAscii().data(), &found, &n, ctype); if(!found) n = 0; return (n); } @@ -251,7 +251,7 @@ namespace Isis { * @param key * @return @b vector < @b int > */ - vector LroWideAngleCamera::GetVector(const string &key) { + vector LroWideAngleCamera::GetVector(const QString &key) { QVariant poolKeySize = getStoredResult(key + "_SIZE", SpiceIntType); int nvals = poolKeySize.toInt(); @@ -262,7 +262,7 @@ namespace Isis { } if(nvals <= 0) { - string mess = "Kernel pool keyword " + key + " not found!"; + QString mess = "Kernel pool keyword " + key + " not found!"; throw IException(IException::Programmer, mess, _FILEINFO_); } diff --git a/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCamera.h b/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCamera.h index 22f039c180..e1ca87c158 100644 --- a/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCamera.h +++ b/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCamera.h @@ -120,8 +120,8 @@ namespace Isis { std::vector p_detectorStartLines; std::vector p_frameletOffsets; - int PoolKeySize(const std::string &key) const; - std::vector GetVector(const std::string &key); + int PoolKeySize(const QString &key) const; + std::vector GetVector(const QString &key); }; }; #endif diff --git a/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCameraDistortionMap.cpp b/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCameraDistortionMap.cpp index 0b103bda6d..6d841fcf4e 100644 --- a/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCameraDistortionMap.cpp +++ b/isis/src/lro/objs/LroWideAngleCamera/LroWideAngleCameraDistortionMap.cpp @@ -39,7 +39,7 @@ namespace Isis { * */ LroWideAngleCameraDistortionMap::LroWideAngleCameraDistortionMap(Camera *parent, int naifIkCode) : CameraDistortionMap(parent) { - std::string odkkey = "INS" + Isis::IString(naifIkCode) + "_OD_K"; + QString odkkey = "INS" + toString(naifIkCode) + "_OD_K"; for(int i = 0; i < 2; i++) { p_odk.push_back(p_camera->getDouble(odkkey, i)); } diff --git a/isis/src/lro/objs/MiniRF/MiniRF.cpp b/isis/src/lro/objs/MiniRF/MiniRF.cpp index 2c1e166d1a..2bf9949b85 100644 --- a/isis/src/lro/objs/MiniRF/MiniRF.cpp +++ b/isis/src/lro/objs/MiniRF/MiniRF.cpp @@ -63,7 +63,7 @@ namespace Isis { // Get the start time from labels (the SpacecraftClockStartCount is set to // is set to UNK in the PDS labels, so StartTime is used instead) - SpiceDouble etStart = iTime((string)inst["StartTime"]).Et(); + SpiceDouble etStart = iTime((QString)inst["StartTime"]).Et(); // The line rate is in units of seconds in the PDS label. The exposure // is the sum of the burst and the delay for the return. The movement of the @@ -94,7 +94,7 @@ namespace Isis { // Setup map from radar(sample,time) to radar(groundrange,time) Radar::LookDirection ldir = Radar::Right; - if((std::string)inst["LookDirection"] == "LEFT") { + if((QString)inst["LookDirection"] == "LEFT") { ldir = Radar::Left; } RadarGroundRangeMap::setTransform(naifIkCode(), groundRangeResolution, diff --git a/isis/src/mariner/apps/mar102isis/mar102isis.cpp b/isis/src/mariner/apps/mar102isis/mar102isis.cpp index af2b7ef921..a3a6fcb8c5 100644 --- a/isis/src/mariner/apps/mar102isis/mar102isis.cpp +++ b/isis/src/mariner/apps/mar102isis/mar102isis.cpp @@ -15,15 +15,16 @@ #include "PvlFormatPds.h" #include -#include + +#include using namespace std; using namespace Isis; -void UpdateLabels(Cube *cube, const string &labels); +void UpdateLabels(Cube *cube, const QString &labels); void TranslateIsis2Labels(FileName &labelFile, Cube *oCube); -string EbcdicToAscii(unsigned char *header); -string DaysToDate(int days); +QString EbcdicToAscii(unsigned char *header); +QString DaysToDate(int days); void IsisMain() { UserInterface &ui = Application::GetUserInterface(); @@ -55,7 +56,7 @@ void IsisMain() { p.StartProcess(); unsigned char *header = (unsigned char *) p.FileHeader(); - string labels = EbcdicToAscii(header); + QString labels = EbcdicToAscii(header); UpdateLabels(oCube, labels); p.EndProcess(); } @@ -80,62 +81,62 @@ void IsisMain() { // Converts labels into standard pvl format and adds necessary // information not included in original labels -void UpdateLabels(Cube *cube, const string &labels) { +void UpdateLabels(Cube *cube, const QString &labels) { // First, we parse out as much valid information as possible from the // original labels - string key; + QString key; int keyPosition; int consumeChars; // Image number key = "FDS="; - keyPosition = labels.find(key); - consumeChars = labels.find("IM-1") - keyPosition - key.length(); - IString fds(labels.substr(keyPosition + key.length(), consumeChars)); - fds.Trim(" "); + keyPosition = labels.indexOf(key); + consumeChars = labels.indexOf("IM-1") - keyPosition - key.length(); + QString fds(labels.mid(keyPosition + key.length(), consumeChars)); + fds = fds.trimmed(); // Year the image was taken key = "YR="; - keyPosition = labels.find(key); - consumeChars = labels.find("DAY") - keyPosition - key.length(); - IString yr(labels.substr(keyPosition + key.length(), consumeChars)); - yr.Trim(" "); + keyPosition = labels.indexOf(key); + consumeChars = labels.indexOf("DAY") - keyPosition - key.length(); + QString yr(labels.mid(keyPosition + key.length(), consumeChars)); + yr = yr.trimmed(); // Day the image was taken key = "DAY="; - keyPosition = labels.find(key); - consumeChars = labels.find("GMT") - keyPosition - key.length(); - IString day(labels.substr(keyPosition + key.length(), consumeChars)); - day.Trim(" "); + keyPosition = labels.indexOf(key); + consumeChars = labels.indexOf("GMT") - keyPosition - key.length(); + QString day(labels.mid(keyPosition + key.length(), consumeChars)); + day = day.trimmed(); // Greenwich Mean Time key = "GMT="; - keyPosition = labels.find(key); - consumeChars = labels.find("CCAMERA") - keyPosition - key.length(); - IString gmt(labels.substr(keyPosition + key.length(), consumeChars)); - gmt.Trim(" "); + keyPosition = labels.indexOf(key); + consumeChars = labels.indexOf("CCAMERA") - keyPosition - key.length(); + QString gmt(labels.mid(keyPosition + key.length(), consumeChars)); + gmt = gmt.trimmed(); // Which of the two cameras took the image key = "CCAMERA="; - keyPosition = labels.find(key); - consumeChars = labels.find("FILTER") - keyPosition - key.length(); - IString ccamera(labels.substr(keyPosition + key.length(), consumeChars)); - ccamera.Trim(" "); + keyPosition = labels.indexOf(key); + consumeChars = labels.indexOf("FILTER") - keyPosition - key.length(); + QString ccamera(labels.mid(keyPosition + key.length(), consumeChars)); + ccamera = ccamera.trimmed(); // Filter number key = "FILTER="; - keyPosition = labels.find(key); - consumeChars = labels.find("(") - keyPosition - key.length(); - IString filterNum(labels.substr(keyPosition + key.length(), consumeChars)); - filterNum.Trim(" "); + keyPosition = labels.indexOf(key); + consumeChars = labels.indexOf("(") - keyPosition - key.length(); + QString filterNum(labels.mid(keyPosition + key.length(), consumeChars)); + filterNum = filterNum.trimmed(); // Filter name - consumeChars = labels.find(")") - keyPosition - key.length() - consumeChars; - IString filterName(labels.substr(labels.find("(") + 1, consumeChars)); - filterName.Trim(" "); + consumeChars = labels.indexOf(")") - keyPosition - key.length() - consumeChars; + QString filterName(labels.mid(labels.indexOf("(") + 1, consumeChars)); + filterName = filterName.trimmed(); // Center wavelength - int fnum = filterNum.ToInteger(); + int fnum = toInt(filterNum); double filterCenter = 0.; switch(fnum) { case 0: @@ -162,10 +163,10 @@ void UpdateLabels(Cube *cube, const string &labels) { // Exposure duration key = "EXPOSURE="; - keyPosition = labels.find(key); - consumeChars = labels.find("MSEC") - keyPosition - key.length(); - IString exposure(labels.substr(keyPosition + key.length(), consumeChars)); - exposure.Trim(" "); + keyPosition = labels.indexOf(key); + consumeChars = labels.indexOf("MSEC") - keyPosition - key.length(); + QString exposure(labels.mid(keyPosition + key.length(), consumeChars)); + exposure = exposure.trimmed(); // Create the instrument group PvlGroup inst("Instrument"); @@ -173,35 +174,35 @@ void UpdateLabels(Cube *cube, const string &labels) { inst += PvlKeyword("InstrumentId", "M10_VIDICON_" + ccamera); // Get the date - int days = day.ToInteger(); - IString date = DaysToDate(days); + int days = toInt(day); + QString date = DaysToDate(days); // Get the time - IString time = gmt; - time = time.Replace("/", ":"); + QString time = gmt; + time = time.replace("/", ":"); // Construct the Start Time in yyyy-mm-ddThh:mm:ss format - string fullTime = date + "T" + time + ".000"; + QString fullTime = date + "T" + time + ".000"; iTime startTime(fullTime); // Create the archive group PvlGroup archive("Archive"); - int year = yr.ToInteger(); + int year = toInt(yr); year += 1900; - string fullGMT = IString(year) + ":" + day + ":" + time; + QString fullGMT = toString(year) + ":" + day + ":" + time; archive += PvlKeyword("GMT", fullGMT); archive += PvlKeyword("ImageNumber", fds); // Create the band bin group PvlGroup bandBin("BandBin"); - IString filter = filterName; - filter = filter.Replace(")", ""); + QString filter = filterName; + filter = filter.replace(")", ""); bandBin += PvlKeyword("FilterName", filter); - IString number = filterNum; + QString number = filterNum; bandBin += PvlKeyword("FilterNumber", number); bandBin += PvlKeyword("OriginalBand", "1"); - IString center = filterCenter; + QString center = toString(filterCenter); bandBin += PvlKeyword("Center", center); bandBin.FindKeyword("Center").SetUnits("micrometers"); @@ -210,7 +211,7 @@ void UpdateLabels(Cube *cube, const string &labels) { // under fast facts. Mariner encountered the Moon, Venus, and Mercury three times. // Date used for all is two days before date of first encounter on website. Information // is important for nominal reseaus used and for Keyword encounter - string target = ""; + QString target = ""; if(startTime < iTime("1974-2-3T12:00:00")) { target = "$mariner10/reseaus/mar10MoonNominal.pvl"; inst += PvlKeyword("TargetName", "Moon"); @@ -243,7 +244,7 @@ void UpdateLabels(Cube *cube, const string &labels) { inst += PvlKeyword("StartTime", fullTime); inst += PvlKeyword("ExposureDuration", exposure, "milliseconds"); - // Open nominal positions pvl named by string encounter + // Open nominal positions pvl named by QString encounter Pvl nomRx(target); // Allocate all keywords within reseaus groups well as the group its self @@ -255,7 +256,7 @@ void UpdateLabels(Cube *cube, const string &labels) { PvlKeyword templ("Template"); PvlKeyword status("Status"); - // All cubes will stay this way until findrx is run on them + // All cubes will stay this way until indexOfrx is run on them status = "Nominal"; // Kernels group @@ -263,8 +264,8 @@ void UpdateLabels(Cube *cube, const string &labels) { PvlKeyword naif("NaifFrameCode"); // Camera dependent information - string camera = ""; - if(IString("M10_VIDICON_A") == inst["InstrumentId"][0]) { + QString camera = ""; + if(QString("M10_VIDICON_A") == inst["InstrumentId"][0]) { templ = "$mariner10/reseaus/mar10a.template.cub"; naif += "-76110"; camera = "M10_VIDICON_A_RESEAUS"; @@ -293,7 +294,7 @@ void UpdateLabels(Cube *cube, const string &labels) { i++; type += resnom[i]; i++; - valid += 0; + valid += "0"; } // Add all the PvlKeywords to the PvlGroup Reseaus @@ -326,7 +327,7 @@ void TranslateIsis2Labels(FileName &labelFile, Cube *oCube) { PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); // Transfer the instrument group to the output cube - IString transDir = (string) dataDir["Mariner10"] + "/translations/"; + QString transDir = (QString) dataDir["Mariner10"] + "/translations/"; Pvl inputLabel(labelFile.expanded()); FileName transFile; @@ -344,17 +345,17 @@ void TranslateIsis2Labels(FileName &labelFile, Cube *oCube) { instrumentId.SetValue("M10_VIDICON_" + instrumentId[0]); PvlKeyword &targetName = inst.FindKeyword("TargetName"); - IString targetTail(targetName[0].substr(1)); - targetTail = targetTail.DownCase(); + QString targetTail(targetName[0].mid(1)); + targetTail = targetTail.toLower(); targetName.SetValue(targetName[0].at(0) + targetTail); PvlKeyword &startTime = inst.FindKeyword("StartTime"); - startTime.SetValue(startTime[0].substr(0, startTime[0].size() - 1)); + startTime.SetValue(startTime[0].mid(0, startTime[0].size() - 1)); PvlGroup &archive = outputLabel->FindGroup("Archive", Pvl::Traverse); PvlKeyword &imgNo = archive.FindKeyword("ImageNumber"); - IString ino = imgNo[0]; - ino.Trim(" "); + QString ino = imgNo[0]; + ino = ino.trimmed(); imgNo.SetValue(ino); iTime time(startTime[0]); @@ -377,7 +378,7 @@ void TranslateIsis2Labels(FileName &labelFile, Cube *oCube) { inst.FindKeyword("ExposureDuration").SetUnits("milliseconds"); PvlGroup &bBin = outputLabel->FindGroup("BandBin", Pvl::Traverse); - std::string filter = inputLabel.FindObject("QUBE")["FILTER_NAME"]; + QString filter = inputLabel.FindObject("QUBE")["FILTER_NAME"]; if(filter != "F") { //Band Bin group bBin.FindKeyword("Center").SetUnits("micrometers"); @@ -390,12 +391,12 @@ void TranslateIsis2Labels(FileName &labelFile, Cube *oCube) { PvlKeyword &valid = reseaus.FindKeyword("Valid"); for(int i = 0; i < valid.Size(); i++) { - valid[i] = valid[i].substr(0, 1); + valid[i] = valid[i].mid(0, 1); } // Camera dependent information - string camera = ""; - if(IString("M10_VIDICON_A") == inst["InstrumentId"][0]) { + QString camera = ""; + if(QString("M10_VIDICON_A") == inst["InstrumentId"][0]) { templ = "$mariner10/reseaus/mar10a.template.cub"; kernels.FindKeyword("NaifFrameCode").SetValue("-76110"); camera = "M10_VIDICON_A_RESEAUS"; @@ -411,7 +412,7 @@ void TranslateIsis2Labels(FileName &labelFile, Cube *oCube) { // a conversion table is necessary then to get the characters over to ascii. For // more info: http://en.wikipedia.org/wiki/Extended_Binary_Coded_Decimal_Interchange_Code //! Converts ebsidic Mariner10 labels to ascii -string EbcdicToAscii(unsigned char *header) { +QString EbcdicToAscii(unsigned char *header) { // Table to convert ebcdic to ascii unsigned char xlate[] = { 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, @@ -437,16 +438,16 @@ string EbcdicToAscii(unsigned char *header) { header[i] = xlate[header[i]]; } - // Put in a end of string mark and return + // Put in a end of QString mark and return header[215] = 0; - return string((const char *)header); + return QString((const char *)header); } // Mariner 10 labels provide the number of days since the beginning of the year // 1974 in the GMT keyword, but not always a start time. In order to derive an // estimated start time, with an actual date attached, a conversion must be // performed. -string DaysToDate(int days) { +QString DaysToDate(int days) { int currentMonth = 12; int currentDay = 31; int currentYear = 1973; @@ -477,8 +478,8 @@ string DaysToDate(int days) { } days--; } - IString year = currentYear; - IString month = (currentMonth < 10) ? "0" + IString(currentMonth) : IString(currentMonth); - IString day = (currentDay < 10) ? "0" + IString(currentDay) : IString(currentDay); + QString year = toString(currentYear); + QString month = (currentMonth < 10) ? "0" + toString(currentMonth) : toString(currentMonth); + QString day = (currentDay < 10) ? "0" + toString(currentDay) : toString(currentDay); return year + "-" + month + "-" + day; } diff --git a/isis/src/mariner/apps/mar10cal/mar10cal.cpp b/isis/src/mariner/apps/mar10cal/mar10cal.cpp index bf6a5dc99d..af94ae2f22 100644 --- a/isis/src/mariner/apps/mar10cal/mar10cal.cpp +++ b/isis/src/mariner/apps/mar10cal/mar10cal.cpp @@ -37,7 +37,7 @@ void IsisMain() { Isis::Pvl lab(ui.GetFileName("FROM")); Isis::PvlGroup & inst = lab.FindGroup("Instrument", Pvl::Traverse); - std::string mission = inst["SpacecraftName"]; + QString mission = inst["SpacecraftName"]; if (mission != "Mariner_10") { string msg = "This is not a Mariner 10 image. Mar10cal requires a Mariner 10 image."; throw IException(IException::User, msg, _FILEINFO_); @@ -47,21 +47,21 @@ void IsisMain() { // If it is already calibrated then complain if (icube->hasGroup("Radiometry")) { - string msg = "This Mariner 10 image [" + icube->getFileName() + "] has " - "already been radiometrically calibrated"; + QString msg = "This Mariner 10 image [" + icube->getFileName() + "] has " + "already been radiometrically calibrated"; throw IException(IException::User, msg, _FILEINFO_); } // Get label parameters we will need for calibration equation - std::string instId = inst["InstrumentId"]; - string camera = instId.substr(instId.size()-1); + QString instId = inst["InstrumentId"]; + QString camera = instId.mid(instId.size()-1); - IString filter = (string)(icube->getGroup("BandBin"))["FilterName"]; - filter = filter.UpCase().substr(0,3); + QString filter = (QString)(icube->getGroup("BandBin"))["FilterName"]; + filter = filter.toUpper().mid(0,3); - string target = inst["TargetName"]; + QString target = inst["TargetName"]; - iTime startTime((string) inst["StartTime"]); + iTime startTime((QString) inst["StartTime"]); double exposure = inst["ExposureDuration"]; double exposureOffset = 0.0; @@ -76,7 +76,7 @@ void IsisMain() { exposureOffset = 3.060; } else { - string msg = "Camera [" + camera + "] is not supported."; + QString msg = "Camera [" + camera + "] is not supported."; throw IException(IException::User, msg, _FILEINFO_); } } @@ -89,7 +89,7 @@ void IsisMain() { else { // Mercury Dark current // ??? NOTE: Need to find Mark's dc for venus and moon ???? - string dcFile("$mariner10/calibration/mariner_10_" + camera + + QString dcFile("$mariner10/calibration/mariner_10_" + camera + "_dc.cub"); CubeAttributeInput cubeAtt; dcCube = p.SetInputCube(dcFile, cubeAtt); @@ -100,13 +100,13 @@ void IsisMain() { Cube * blemCube = 0; useBlem = (ui.GetBoolean("BLEMMASK")) ? true : false; if (useBlem) { - string blemFile("$mariner10/calibration/mariner_10_blem_" + camera + ".cub"); + QString blemFile("$mariner10/calibration/mariner_10_blem_" + camera + ".cub"); CubeAttributeInput cubeAtt; blemCube = p.SetInputCube(blemFile, cubeAtt); } if (filter == "FAB" || filter == "WAF") { - string msg = "Filter type [" + filter + "] is not supported at this time."; + QString msg = "Filter type [" + filter + "] is not supported at this time."; throw IException(IException::User, msg, _FILEINFO_); } @@ -131,7 +131,7 @@ void IsisMain() { absCoef = 750.0; } else { - string msg = "Camera [" + camera + "] is not supported."; + QString msg = "Camera [" + camera + "] is not supported."; throw IException(IException::User, msg, _FILEINFO_); } } @@ -161,7 +161,7 @@ void IsisMain() { calgrp += PvlKeyword("BlemishRemovalCube", blemCube->getFileName()); } calgrp += PvlKeyword("CoefficientCube", coCube.getFileName()); - calgrp += PvlKeyword("AbsoluteCoefficient", absCoef); + calgrp += PvlKeyword("AbsoluteCoefficient", toString(absCoef)); ocube->putGroup(calgrp); diff --git a/isis/src/mariner/apps/mar10clean/mar10clean.cpp b/isis/src/mariner/apps/mar10clean/mar10clean.cpp index f867fd40d5..ed8d416a7a 100644 --- a/isis/src/mariner/apps/mar10clean/mar10clean.cpp +++ b/isis/src/mariner/apps/mar10clean/mar10clean.cpp @@ -16,8 +16,8 @@ void IsisMain() { Cube iCube; iCube.open(ui.GetFileName("FROM")); Pvl * labels = iCube.getLabel(); - if ("Mariner_10" != (string)labels->FindKeyword("SpacecraftName", Pvl::Traverse)) { - string msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + + if ("Mariner_10" != (QString)labels->FindKeyword("SpacecraftName", Pvl::Traverse)) { + QString msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + " to be a Mariner10 cube"; throw IException(IException::User, msg, _FILEINFO_); } @@ -31,12 +31,12 @@ void IsisMain() { stats = cp.Statistics(); cout << "Valid pixels: "<< stats->ValidPixels() << endl; if (stats->ValidPixels() == 7) { - string msg = "The cube [" + ui.GetFileName("FROM") + "] needs" + + QString msg = "The cube [" + ui.GetFileName("FROM") + "] needs" + " reconstruction, try mar10restore instead"; throw IException(IException::User, msg, _FILEINFO_); } else if (stats->ValidPixels() == 0) { - string msg = "The cube [" + ui.GetFileName("FROM") + "]" + + QString msg = "The cube [" + ui.GetFileName("FROM") + "]" + " appears to have already been cleaned"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/mariner/apps/mar10nonoise/mar10nonoise.cpp b/isis/src/mariner/apps/mar10nonoise/mar10nonoise.cpp index 062b99bde3..d47570c10d 100644 --- a/isis/src/mariner/apps/mar10nonoise/mar10nonoise.cpp +++ b/isis/src/mariner/apps/mar10nonoise/mar10nonoise.cpp @@ -15,8 +15,8 @@ void IsisMain() { Cube iCube; iCube.open(ui.GetFileName("FROM")); Pvl * labels = iCube.getLabel(); - if ("Mariner_10" != (string)labels->FindKeyword("SpacecraftName", Pvl::Traverse)) { - string msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + + if ("Mariner_10" != (QString)labels->FindKeyword("SpacecraftName", Pvl::Traverse)) { + QString msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + " to be a Mariner10 cube"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/mariner/apps/mar10restore/mar10restore.cpp b/isis/src/mariner/apps/mar10restore/mar10restore.cpp index 29da830ac2..891a7c2e92 100644 --- a/isis/src/mariner/apps/mar10restore/mar10restore.cpp +++ b/isis/src/mariner/apps/mar10restore/mar10restore.cpp @@ -19,8 +19,8 @@ void IsisMain() { // Check that it is a Mariner10 cube. Pvl * labels = cube.getLabel(); - if ("Mariner_10" != (string)labels->FindKeyword("SpacecraftName", Pvl::Traverse)) { - string msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + + if ("Mariner_10" != (QString)labels->FindKeyword("SpacecraftName", Pvl::Traverse)) { + QString msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + " to be a Mariner10 cube"; throw IException(IException::User, msg, _FILEINFO_); } @@ -33,7 +33,7 @@ void IsisMain() { stats = cp.Statistics(); // Maximum possible number of good pixels in a 5x5 if(stats->ValidPixels() > 8) { - string msg = "The cube [" + ui.GetFileName("FROM") + "] does not need" + + QString msg = "The cube [" + ui.GetFileName("FROM") + "] does not need" + " reconstruction, try mar10clean instead"; throw IException(IException::User, msg, _FILEINFO_); } @@ -129,10 +129,10 @@ void IsisMain() { p.AddToPipeline("trim"); p.Application("trim").SetInputParameter("FROM", true); p.Application("trim").SetOutputParameter("TO", "trim"); - p.Application("trim").AddConstParameter("LEFT", 15); - p.Application("trim").AddConstParameter("RIGHT", 5); - p.Application("trim").AddConstParameter("BOTTOM", 0); - p.Application("trim").AddConstParameter("TOP", 5); + p.Application("trim").AddConstParameter("LEFT", toString(15)); + p.Application("trim").AddConstParameter("RIGHT", toString(5)); + p.Application("trim").AddConstParameter("BOTTOM", toString(0)); + p.Application("trim").AddConstParameter("TOP", toString(5)); p.Run(); } diff --git a/isis/src/mariner/objs/Mariner10Camera/Mariner10Camera.cpp b/isis/src/mariner/objs/Mariner10Camera/Mariner10Camera.cpp index f9597368b1..fb1eeaa4ee 100644 --- a/isis/src/mariner/objs/Mariner10Camera/Mariner10Camera.cpp +++ b/isis/src/mariner/objs/Mariner10Camera/Mariner10Camera.cpp @@ -67,10 +67,10 @@ namespace Isis { PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); // Get utc start time - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; iTime startTime; - startTime.setUtc((string)inst["StartTime"]); + startTime.setUtc((QString)inst["StartTime"]); setTime(startTime); // Setup detector map @@ -79,18 +79,18 @@ namespace Isis { // Setup focal plane map, and detector origin CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); - IString ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_SAMPLE"; + QString ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_SAMPLE"; double sampleBoresight = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_LINE"; + ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_LINE"; double lineBoresight = getDouble(ikernKey); focalMap->SetDetectorOrigin(sampleBoresight, lineBoresight); // Setup distortion map which is dependent on encounter, use start time // MOON: 1973-11-08T03:16:26.350 - IString spacecraft = (string)inst["SpacecraftName"]; - IString instId = (string)inst["InstrumentId"]; - string cam; + QString spacecraft = (QString)inst["SpacecraftName"]; + QString instId = (QString)inst["InstrumentId"]; + QString cam; if(instId == "M10_VIDICON_A") { cam = "a"; } @@ -98,13 +98,13 @@ namespace Isis { cam = "b"; } else { - string msg = "File does not appear to be a Mariner10 image. InstrumentId [" - + instId + "] is invalid Mariner 10 value."; + QString msg = "File does not appear to be a Mariner10 image. InstrumentId [" + + instId + "] is invalid Mariner 10 value."; throw IException(IException::User, msg, _FILEINFO_); } - const string fname = FileName("$mariner10/reseaus/mar10" + cam - + "MasterReseaus.pvl").expanded(); + QString fname = FileName("$mariner10/reseaus/mar10" + cam + + "MasterReseaus.pvl").expanded(); try { new ReseauDistortionMap(this, lab, fname); diff --git a/isis/src/mariner/objs/Mariner10Camera/unitTest.cpp b/isis/src/mariner/objs/Mariner10Camera/unitTest.cpp index 9778591c3f..88ca4f51ae 100644 --- a/isis/src/mariner/objs/Mariner10Camera/unitTest.cpp +++ b/isis/src/mariner/objs/Mariner10Camera/unitTest.cpp @@ -87,9 +87,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/mer/apps/mer2isis/mer2isis.cpp b/isis/src/mer/apps/mer2isis/mer2isis.cpp index 4c76700b80..c2c92f1b71 100644 --- a/isis/src/mer/apps/mer2isis/mer2isis.cpp +++ b/isis/src/mer/apps/mer2isis/mer2isis.cpp @@ -21,12 +21,12 @@ void IsisMain() { //Checks if in file is rdr Pvl lab(input.expanded()); if(lab.HasObject("IMAGE_MAP_PROJECTION")) { - string msg = "[" + input.name() + "] has already been projected."; + QString msg = "[" + input.name() + "] has already been projected."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } - IString output; + QString output; if(ui.WasEntered("TO")) { output = ui.GetFileName("TO"); } @@ -36,7 +36,7 @@ void IsisMain() { Pvl inputFile; - IString paramaters = "FROM=" + input.expanded(); + QString paramaters = "FROM=" + input.expanded(); paramaters += " TO=" + output; ProcessImportPds p; @@ -54,7 +54,7 @@ void TranslateMerEdrLabels(FileName &labelFile, Cube *ocube) { // Get the directory where the MER translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Mer"]; + QString transDir = (QString) dataDir["Mer"]; transDir = transDir + "/" + "translations/"; // Get a filename for the MESSENGER EDR label @@ -109,11 +109,11 @@ void MiFixLab(PvlGroup &instGroup) { //Code to remove "Z" from the StartTime and StopTime keywords //StartTime code - IString Newstarttime = (string)instGroup.FindKeyword("StartTime"); - Newstarttime.Remove("Z"); + QString Newstarttime = (QString)instGroup.FindKeyword("StartTime"); + Newstarttime.remove("Z"); instGroup.FindKeyword("StartTime").SetValue(Newstarttime); //StopTime code - IString Newstoptime = (string)instGroup.FindKeyword("StopTime"); - Newstoptime.Remove("Z"); + QString Newstoptime = (QString)instGroup.FindKeyword("StopTime"); + Newstoptime.remove("Z"); instGroup.FindKeyword("StopTime").SetValue(Newstoptime); } diff --git a/isis/src/mer/apps/mical/MiCalibration.cpp b/isis/src/mer/apps/mical/MiCalibration.cpp index ad79a69ba3..58f4c96127 100644 --- a/isis/src/mer/apps/mical/MiCalibration.cpp +++ b/isis/src/mer/apps/mical/MiCalibration.cpp @@ -28,12 +28,12 @@ namespace Isis { image.getLabel()->FindGroup("Instrument", Pvl::Traverse); p_exposureDuration = labelgrp["ExposureDuration"]; p_instrumentSerialNumber = labelgrp["InstrumentSerialNumber"]; - p_CCDTemperature = labelgrp["InstrumentTemperature"][6]; - p_PCBTemperature = labelgrp["InstrumentTemperature"][7]; + p_CCDTemperature = toDouble(labelgrp["InstrumentTemperature"][6]); + p_PCBTemperature = toDouble(labelgrp["InstrumentTemperature"][7]); p_OffsetModeId = labelgrp["OffsetModeID"]; - p_shuttereffectcorrectionflag = (string)labelgrp["ShutterEffectCorrectionFlag"]; - p_filterName = (string)labelgrp["FilterName"]; - p_startTime = (string)labelgrp["StartTime"]; + p_shuttereffectcorrectionflag = (QString)labelgrp["ShutterEffectCorrectionFlag"]; + p_filterName = (QString)labelgrp["FilterName"]; + p_startTime = (QString)labelgrp["StartTime"]; } /** * Get values from the calibration kernel @@ -44,7 +44,7 @@ namespace Isis { * entered. */ void MiCalibration::ReadKernel(Pvl &kernel) { - string rover = "MI_" + Isis::IString(p_instrumentSerialNumber); + QString rover = "MI_" + toString(p_instrumentSerialNumber); PvlGroup kernelgrp = kernel.FindGroup(rover, Pvl::Traverse); p_DELCCDTa = kernelgrp["DELCCDTa"]; p_DELCCDTb = kernelgrp["DELCCDTb"]; @@ -62,11 +62,11 @@ namespace Isis { p_ACTAREAb = kernelgrp["ACTAREAb"]; p_temperatureOffset = kernelgrp["TemperatureOffset"]; p_transfertime = kernelgrp["TransferTime"]; - p_ReferencePixelImage = (string)kernelgrp["ReferencePixelImage"]; - p_ZeroExposureImage = (string)kernelgrp["ZeroExposureImage"]; - p_ActiveAreaImage = (string)kernelgrp["ActiveAreaImage"]; - p_FlatImageOpen = (string)kernelgrp["FlatImageOpen"]; - p_FlatImageClosed = (string)kernelgrp["FlatImageClosed"]; + p_ReferencePixelImage = (QString)kernelgrp["ReferencePixelImage"]; + p_ZeroExposureImage = (QString)kernelgrp["ZeroExposureImage"]; + p_ActiveAreaImage = (QString)kernelgrp["ActiveAreaImage"]; + p_FlatImageOpen = (QString)kernelgrp["FlatImageOpen"]; + p_FlatImageClosed = (QString)kernelgrp["FlatImageClosed"]; } /** * Get the CCD temperature and output a corrected diff --git a/isis/src/mer/apps/mical/MiCalibration.h b/isis/src/mer/apps/mical/MiCalibration.h index 3e4667257b..a5f286d733 100644 --- a/isis/src/mer/apps/mical/MiCalibration.h +++ b/isis/src/mer/apps/mical/MiCalibration.h @@ -23,29 +23,29 @@ namespace Isis { int InstrumentSerialNumber() const { return p_instrumentSerialNumber; }; - inline std::string ShutterEffectCorrectionFlag() + inline QString ShutterEffectCorrectionFlag() const { return p_shuttereffectcorrectionflag; }; - inline std::string ReferencePixelImage() const { + inline QString ReferencePixelImage() const { return p_ReferencePixelImage; }; - inline std::string ZeroExposureImage() const { + inline QString ZeroExposureImage() const { return p_ZeroExposureImage; }; - inline std::string ActiveAreaImage() const { + inline QString ActiveAreaImage() const { return p_ActiveAreaImage; }; - inline std::string FlatImageOpen() const { + inline QString FlatImageOpen() const { return p_FlatImageOpen; }; - inline std::string FlatImageClosed() const { + inline QString FlatImageClosed() const { return p_FlatImageClosed; }; - inline std::string FilterName() const { + inline QString FilterName() const { return p_filterName; }; - inline std::string StartTime() const { + inline QString StartTime() const { return p_startTime; }; inline double TransferTime() const { @@ -87,9 +87,9 @@ namespace Isis { double p_PCBTemperature; double p_CCDTemperatureCorrect; double p_OffsetModeId; - std::string p_shuttereffectcorrectionflag; - std::string p_filterName; - std::string p_startTime; + QString p_shuttereffectcorrectionflag; + QString p_filterName; + QString p_startTime; double p_ReferencePixelModel; double p_ZeroExposureValue; @@ -111,11 +111,11 @@ namespace Isis { double p_ACTAREAb; double p_temperatureOffset; double p_transfertime; - std::string p_ReferencePixelImage; - std::string p_ZeroExposureImage; - std::string p_ActiveAreaImage; - std::string p_FlatImageOpen; - std::string p_FlatImageClosed; + QString p_ReferencePixelImage; + QString p_ZeroExposureImage; + QString p_ActiveAreaImage; + QString p_FlatImageOpen; + QString p_FlatImageClosed; double p_RPswitch; double p_ZEswitch; double p_AAswitch; diff --git a/isis/src/mer/apps/mical/mical.cpp b/isis/src/mer/apps/mical/mical.cpp index 84bd5a3a81..86cc834360 100644 --- a/isis/src/mer/apps/mical/mical.cpp +++ b/isis/src/mer/apps/mical/mical.cpp @@ -19,8 +19,8 @@ using namespace Isis; //helper button functions in the code void helperButtonLogCalKernel(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonLogCalKernel"] = (void *) helperButtonLogCalKernel; return helper; } @@ -39,7 +39,7 @@ namespace gbl { } PvlGroup calgrp; -string stagestop; +QString stagestop; void IsisMain() { //We will be processing by line @@ -54,13 +54,13 @@ void IsisMain() { //check if the image is calibrated if(pack->hasGroup("Radiometry")) { - string msg = "The MI image [" + pack->getFileName() + "] has already " + QString msg = "The MI image [" + pack->getFileName() + "] has already " "been radiometrically calibrated"; throw IException(IException::User, msg, _FILEINFO_); } //Open the calibration kernel that contains constrnts for each camera - string calKernelFile; + QString calKernelFile; if(ui.WasEntered("CALKERNEL")) { calKernelFile = ui.GetFileName("CALKERNEL"); cout << "use the user kernel" << endl; @@ -87,17 +87,17 @@ void IsisMain() { double ETstartTime = startTime.Et(); //Get the distance between Mars and the Sun at the given time in // Astronomical Units (AU) - string bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true); - furnsh_c(bspKernel.c_str()); - string pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); - furnsh_c(pckKernel.c_str()); + QString bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true); + furnsh_c(bspKernel.toAscii().data()); + QString pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); + furnsh_c(pckKernel.toAscii().data()); double sunpos[6], lt; spkezr_c("sun", ETstartTime, "iau_mars", "LT+S", "mars", sunpos, <); double dist = vnorm_c(sunpos); double kmperAU = 1.4959787066E8; gbl::sunAU = dist / kmperAU; - unload_c(bspKernel.c_str()); - unload_c(pckKernel.c_str()); + unload_c(bspKernel.toAscii().data()); + unload_c(pckKernel.toAscii().data()); //See what calibtation values the user wants to apply @@ -111,7 +111,7 @@ void IsisMain() { if(!ui.GetBoolean("RPCORRECTION") || gbl::mi->ShutterEffectCorrectionFlag() == "TRUE") { gbl::useReferenceValue = 0; calgrp += PvlKeyword("ReferencePixelValueSource", "N/A"); - calgrp += PvlKeyword("ReferencePixelValue", 0); + calgrp += PvlKeyword("ReferencePixelValue", "0"); calgrp += PvlKeyword("ReferencePixelImage", "NoCorrection"); } // find out if user entered a ERP file. If yes then get the AVG for the @@ -133,22 +133,22 @@ void IsisMain() { calgrp += PvlKeyword("ReferencePixelValueSource", "ERPImage"); calgrp += PvlKeyword("ReferencePixelValueImage", ui.GetFileName("REFPIXIMAGE")); - calgrp += PvlKeyword("ReferencePixelValue", gbl::ReferencePixelValue); + calgrp += PvlKeyword("ReferencePixelValue", toString(gbl::ReferencePixelValue)); } else { gbl::ReferencePixelValue = gbl::mi->ReferencePixelModel(); calgrp += PvlKeyword("ReferencePixelValueSource", "ERPModel"); - calgrp += PvlKeyword("ReferenceModel", gbl::ReferencePixelValue); + calgrp += PvlKeyword("ReferenceModel", toString(gbl::ReferencePixelValue)); } // if user wants NO zero exposure or if shutter effect correction is true // set the user value to zero and set label output to reflect no correction if(!ui.GetBoolean("ZECORRECTION") || gbl::mi->ShutterEffectCorrectionFlag() == "TRUE") { gbl::useZeroExposureValue = 0; - calgrp += PvlKeyword("ZeroExposureValue", 0); + calgrp += PvlKeyword("ZeroExposureValue", "0"); calgrp += PvlKeyword("ZeroExposureImage", "NoCorrection"); } else { - calgrp += PvlKeyword("ZeroExposureValue", gbl::mi->ZeroExposureValue()); + calgrp += PvlKeyword("ZeroExposureValue", toString(gbl::mi->ZeroExposureValue())); calgrp += PvlKeyword("ZeroExposureImage", gbl::mi->ZeroExposureImage()); } // If user wants NO active area set user value to zero and set the label @@ -159,7 +159,7 @@ void IsisMain() { calgrp += PvlKeyword("ActiveAreaImage", "NoCorrection"); } else { - calgrp += PvlKeyword("ActiveAreaValue", gbl::mi->ActiveAreaValue()); + calgrp += PvlKeyword("ActiveAreaValue", toString(gbl::mi->ActiveAreaValue())); calgrp += PvlKeyword("ActiveAreaImage", gbl::mi->ActiveAreaImage()); } @@ -200,14 +200,14 @@ void IsisMain() { double fullModel = gbl::mi->ReferencePixelModel() + gbl::mi->ZeroExposureValue() + gbl::mi->ActiveAreaValue(); - calgrp += PvlKeyword("DarkCurrentFullModel", fullModel); + calgrp += PvlKeyword("DarkCurrentFullModel", toString(fullModel)); //Add temperature values to the radiometry group - calgrp += PvlKeyword("CCDTemperture", gbl::mi->CCDTemperatureCorrect()); - calgrp += PvlKeyword("PCBTemperature", gbl::mi->PCBTemperature()); + calgrp += PvlKeyword("CCDTemperture", toString(gbl::mi->CCDTemperatureCorrect())); + calgrp += PvlKeyword("PCBTemperature", toString(gbl::mi->PCBTemperature())); if(stagestop == "IOF") { - calgrp += PvlKeyword("OmegaNaught", gbl::mi->OmegaNaught()); - calgrp += PvlKeyword("SunAU", gbl::sunAU); + calgrp += PvlKeyword("OmegaNaught", toString(gbl::mi->OmegaNaught())); + calgrp += PvlKeyword("SunAU", toString(gbl::sunAU)); } //write Radiometry group to the output cube. @@ -302,7 +302,7 @@ void gbl::Calibrate(vector&in, vector&out) { //Helper Button Function to display cal Kernel in the log area void helperButtonLogCalKernel() { UserInterface &ui = Application::GetUserInterface(); - string calKernelFile; + QString calKernelFile; if(ui.WasEntered("CALKERNEL")) { calKernelFile = ui.GetFileName("CALKERNEL"); } @@ -313,8 +313,8 @@ void helperButtonLogCalKernel() { Pvl p; p.Read(calKernelFile); - string Ostring = "********** Output of [" + calKernelFile + "] *********"; - Application::GuiLog(Ostring); + QString OQString = "********** Output of [" + calKernelFile + "] *********"; + Application::GuiLog(OQString); Application::GuiLog(p); } diff --git a/isis/src/messenger/apps/mdis2isis/mdis2isis.cpp b/isis/src/messenger/apps/mdis2isis/mdis2isis.cpp index 4ee4b5e913..591246ece5 100644 --- a/isis/src/messenger/apps/mdis2isis/mdis2isis.cpp +++ b/isis/src/messenger/apps/mdis2isis/mdis2isis.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include "ProcessImportPds.h" #include "ProcessByLine.h" @@ -34,11 +34,11 @@ static const double WACValidMaximum = 3600.0; static const double NACValidMaximum = 3400.0; LutTable lut; -Pvl TranslateMdisEdrLabels(FileName &labelFile, const std::string &target = ""); -int CreateFilterSpecs(const std::string &instId, int filter_code, - PvlGroup &bandbin, std::string &naifId); +Pvl TranslateMdisEdrLabels(FileName &labelFile, const QString &target = ""); +int CreateFilterSpecs(const QString &instId, int filter_code, + PvlGroup &bandbin, QString &naifId); void UnlutData(Buffer &data); -LutTable LoadLut(Pvl &label, std::string &tableused, std::string &lutid); +LutTable LoadLut(Pvl &label, QString &tableused, QString &lutid); Cube *outCube = NULL; double validMaxDn = WACValidMaximum; // Assumes the WAC @@ -76,18 +76,18 @@ void IsisMain() { needsUnlut = (int) lab.FindKeyword("MESS:COMP12_8"); // Check for NAC imager if((int) lab.FindKeyword("MESS:IMAGER") == 1) validMaxDn = NACValidMaximum; - id = (string) lab.FindKeyword("MISSION_NAME"); + id = (QString) lab.FindKeyword("MISSION_NAME"); projected = lab.HasObject("IMAGE_MAP_PROJECTION"); } catch(IException &e) { - string msg = "Unable to read [MISSION] from input file [" + - inFile.expanded() + "]"; + QString msg = "Unable to read [MISSION] from input file [" + + inFile.expanded() + "]"; throw IException(e, IException::Io, msg, _FILEINFO_); } //Checks if in file is rdr if(projected) { - string msg = "[" + inFile.name() + "] appears to be an rdr file."; + QString msg = "[" + inFile.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -96,12 +96,12 @@ void IsisMain() { id.Compress(); id.Trim(" "); if(id != "MESSENGER") { - string msg = "Input file [" + inFile.expanded() + "] does not appear to be " + - "in MESSENGER EDR format. MISSION_NAME is [" + id + "]"; + QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + + "in MESSENGER EDR format. MISSION_NAME is [" + id.ToQt() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } - std::string target; + QString target; if(ui.WasEntered("TARGET")) { target = ui.GetString("TARGET"); } @@ -113,7 +113,7 @@ void IsisMain() { // Create YearDoy keyword in Archive group iTime stime(outLabel.FindGroup("Instrument", Pvl::Traverse)["StartTime"][0]); - PvlKeyword yeardoy("YearDoy", stime.Year()*1000 + stime.DayOfYear()); + PvlKeyword yeardoy("YearDoy", toString(stime.Year()*1000 + stime.DayOfYear())); (void) outLabel.FindGroup("Archive", Pvl::Traverse).AddKeyword(yeardoy); if(ui.GetBoolean("UNLUT") == false || !needsUnlut) { @@ -125,7 +125,7 @@ void IsisMain() { // Write the Instrument, BandBin, Archive, and Kernels groups to the output // cube label PvlGroup &group = outLabel.FindGroup("Instrument", Pvl::Traverse); - group.AddKeyword(PvlKeyword("Unlutted", !needsUnlut)); + group.AddKeyword(PvlKeyword("Unlutted", toString((int)!needsUnlut))); outCube->putGroup(group); outCube->putGroup(outLabel.FindGroup("BandBin", Pvl::Traverse)); @@ -146,7 +146,7 @@ void IsisMain() { else { // Unlut is indicated, so we need to handle the conversion and the cube // writing. Also will enforce DN limits. - std::string lutfile, lutid; + QString lutfile, lutid; lut = LoadLut(lab, lutfile, lutid); outCube = new Cube(); @@ -154,7 +154,7 @@ void IsisMain() { outCube->create(ui.GetFileName("TO")); PvlGroup &group = outLabel.FindGroup("Instrument", Pvl::Traverse); - group.AddKeyword(PvlKeyword("Unlutted", true)); + group.AddKeyword(PvlKeyword("Unlutted", toString((int)true))); group.AddKeyword(PvlKeyword("LutInversionTable", lutfile)); outCube->getLabel()->FindObject("IsisCube").AddGroup(group); @@ -178,13 +178,13 @@ void IsisMain() { p.EndProcess(); } -Pvl TranslateMdisEdrLabels(FileName &labelFile, const std::string &target) { +Pvl TranslateMdisEdrLabels(FileName &labelFile, const QString &target) { //Create a PVL to store the translated labels Pvl outLabel; // Get the directory where the MESSENGER/MDIS translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Messenger"] + "/translations/"; + QString transDir = (QString) dataDir["Messenger"] + "/translations/"; // Get a filename for the MESSENGER EDR label Pvl labelPvl(labelFile.expanded()); @@ -208,8 +208,8 @@ Pvl TranslateMdisEdrLabels(FileName &labelFile, const std::string &target) { PvlGroup kerns("Kernels"); PvlGroup &bandbin(outLabel.FindGroup("BandBin", Pvl::Traverse)); PvlGroup &instGrp(outLabel.FindGroup("Instrument", Pvl::Traverse)); - std::string instId = instGrp["InstrumentId"]; - std::string naifCode; + QString instId = instGrp["InstrumentId"]; + QString naifCode; // Establish Filter specific keywords CreateFilterSpecs(instId, (int) instGrp["FilterWheelPosition"], bandbin, @@ -219,19 +219,19 @@ Pvl TranslateMdisEdrLabels(FileName &labelFile, const std::string &target) { // If the user specifed the target explicitly or it doesn't exist, create // something so the camera will always work - if(instGrp.FindKeyword("TargetName").IsNull() || (!target.empty())) { - if(!target.empty()) { - instGrp["TargetName"] = IString(target); + if(instGrp.FindKeyword("TargetName").IsNull() || (!target.isEmpty())) { + if(!target.isEmpty()) { + instGrp["TargetName"] = QString(target); } else { - instGrp["TargetName"] = IString("Sky"); + instGrp["TargetName"] = QString("Sky"); } } // Compute the gimble pivot angle and write to the label double pivotCounter = (double) instGrp["PivotPosition"]; double pivotAngle = pivotCounter / ((double)(2 << 15)) * 180.0; - instGrp += PvlKeyword("PivotAngle", pivotAngle, "Degrees"); + instGrp += PvlKeyword("PivotAngle", toString(pivotAngle), "Degrees"); return outLabel; } @@ -249,8 +249,8 @@ Pvl TranslateMdisEdrLabels(FileName &labelFile, const std::string &target) { * @return int Valid filter number between 1 and 12, otherwise * returns 0. */ -int CreateFilterSpecs(const std::string &instId, int filter_code, - PvlGroup &bandbin, string &naifCode) { +int CreateFilterSpecs(const QString &instId, int filter_code, + PvlGroup &bandbin, QString &naifCode) { // WAC Filter table struct { @@ -278,7 +278,7 @@ int CreateFilterSpecs(const std::string &instId, int filter_code, naifCode = "NULL"; int filter(0); - string name, center, width; + QString name, center, width; if(instId == "MDIS-NAC") { naifCode = "-236820"; @@ -298,7 +298,7 @@ int CreateFilterSpecs(const std::string &instId, int filter_code, naifCode = "-236800"; for(int filterTry = 1; filterTry <= 12 ; filterTry++) { - int idealPosition = confgrp[IString("EncoderPosition") + IString(filterTry)]; + int idealPosition = confgrp[QString("EncoderPosition") + toString(filterTry)]; if((filter_code <= (idealPosition + tolerance)) && (filter_code >= (idealPosition - tolerance))) { int fno = filterTry - 1; @@ -312,13 +312,13 @@ int CreateFilterSpecs(const std::string &instId, int filter_code, } else { // Not the expected instrument - string msg = "Unknown InstrumentId [" + instId + "], image does not " + + QString msg = "Unknown InstrumentId [" + instId + "], image does not " + "appear to be from the MESSENGER/MDIS Camera"; throw IException(IException::Io, msg, _FILEINFO_); } - if(!name.empty()) { - bandbin.AddKeyword(PvlKeyword("Number", filter), PvlContainer::Replace); + if(!name.isEmpty()) { + bandbin.AddKeyword(PvlKeyword("Number", toString(filter)), PvlContainer::Replace); bandbin.AddKeyword(PvlKeyword("Name", name), PvlContainer::Replace); bandbin.AddKeyword(PvlKeyword("Center", center, "NM"), PvlContainer::Replace); bandbin.AddKeyword(PvlKeyword("Width", width, "NM"), PvlContainer::Replace); @@ -351,7 +351,7 @@ void UnlutData(Buffer &data) { outCube->write(out); } -LutTable LoadLut(Pvl &label, std::string &tableused, std::string &froot) { +LutTable LoadLut(Pvl &label, QString &tableused, QString &froot) { int tableToUse = label.FindKeyword("MESS:COMP_ALG"); FileName tableFile("$messenger/calibration/LUT_INVERT/MDISLUTINV_?.TAB"); diff --git a/isis/src/messenger/apps/mdis2pds/mdis2pds.cpp b/isis/src/messenger/apps/mdis2pds/mdis2pds.cpp index a2f531faa5..3a7e71467b 100644 --- a/isis/src/messenger/apps/mdis2pds/mdis2pds.cpp +++ b/isis/src/messenger/apps/mdis2pds/mdis2pds.cpp @@ -21,10 +21,10 @@ using namespace std; using namespace Isis; -inline std::string Quote(const std::string &value, const char qChar = '"') { - if(value.empty()) return (value); +inline QString Quote(const QString &value, const char qChar = '"') { + if(value.isEmpty()) return (value); if(value[0] == qChar) return (value); - return (std::string(qChar + value + qChar)); + return (QString(qChar + value + qChar)); } inline double SetRound(double value, const int precision) { @@ -33,15 +33,15 @@ inline double SetRound(double value, const int precision) { return (value); } -inline void ValidateUnit(PvlKeyword &key, const std::string &kunit) { +inline void ValidateUnit(PvlKeyword &key, const QString &kunit) { PvlKeyword temp = key; key.Clear(); for(int i = 0 ; i < temp.Size() ; i++) { try { // If this works, check unit, otherwise an exception is thrown - (void) temp[i].ToDouble(); - string unit = temp.Unit(i); - if(unit.empty()) unit = kunit; + (void) toDouble(temp[i]); + QString unit = temp.Unit(i); + if(unit.isEmpty()) unit = kunit; key.AddValue(temp[i], unit); } catch(...) { @@ -51,14 +51,14 @@ inline void ValidateUnit(PvlKeyword &key, const std::string &kunit) { return; } -inline void FixUnit(PvlObject &obj, const string &key, const string &unit) { +inline void FixUnit(PvlObject &obj, const QString &key, const QString &unit) { if(obj.HasKeyword(key, PvlObject::Traverse)) { ValidateUnit(obj.FindKeyword(key, PvlObject::Traverse), unit); } return; } -inline void FixQuotes(PvlContainer &kcont, const string &value = "N/A") { +inline void FixQuotes(PvlContainer &kcont, const QString &value = "N/A") { PvlContainer::PvlKeywordIterator kiter; for(kiter = kcont.Begin() ; kiter != kcont.End() ; ++kiter) { for(int nv = 0 ; nv < kiter->Size() ; nv++) { @@ -87,10 +87,10 @@ inline void FixLabels(PvlObject &obj) { void IsisMain() { - const std::string mdis2pds_program = "mdis2pds"; - const std::string mdis2pds_version = "1.0"; - const std::string mdis2pds_revision = "$Revision$"; - const std::string mdis2pds_runtime = Application::DateTime(); + const QString mdis2pds_program = "mdis2pds"; + const QString mdis2pds_version = "1.0"; + const QString mdis2pds_revision = "$Revision$"; + const QString mdis2pds_runtime = Application::DateTime(); UserInterface &ui = Application::GetUserInterface(); FileName input(ui.GetFileName("FROM")); @@ -123,7 +123,7 @@ void IsisMain() { processPds.SetInputRange(minmin, maxmax); // Set the output pixel type and the special pixel values - string dataSetID = "MESS-E/V/H-MDIS-"; + QString dataSetID = "MESS-E/V/H-MDIS-"; int nbits = ui.GetInteger("BITS"); if(nbits == 8) { processPds.SetOutputType(UnsignedByte); @@ -166,7 +166,7 @@ void IsisMain() { dataSetID += "0"; } else { - string msg = "[" + IString(nbits) + "] is not a supported bit length."; + QString msg = "[" + QString(nbits) + "] is not a supported bit length."; throw IException(IException::User, msg, _FILEINFO_); } dataSetID += "-CDR-CALDATA-V1.0"; @@ -241,12 +241,12 @@ void IsisMain() { p.CheckStatus(); // Creates keywords from the input's hist above - PvlKeyword minDn("MINIMUM", SetRound(hist->Minimum(), 16)); - PvlKeyword maxDn("MAXIMUM", SetRound(hist->Maximum(), 16)); - PvlKeyword meanDn("MEAN", SetRound(hist->Average(), 16)); - PvlKeyword stddev("STANDARD_DEVIATION", SetRound(hist->StandardDeviation(), 16)); + PvlKeyword minDn("MINIMUM", toString(SetRound(hist->Minimum(), 16))); + PvlKeyword maxDn("MAXIMUM", toString(SetRound(hist->Maximum(), 16))); + PvlKeyword meanDn("MEAN", toString(SetRound(hist->Average(), 16))); + PvlKeyword stddev("STANDARD_DEVIATION", toString(SetRound(hist->StandardDeviation(), 16))); - PvlKeyword saturated("SATURATED_PIXEL_COUNT", hist->HisPixels()); + PvlKeyword saturated("SATURATED_PIXEL_COUNT", toString(hist->HisPixels())); PvlObject &imageObj = pdsLabel.FindObject("IMAGE"); @@ -262,7 +262,7 @@ void IsisMain() { try { if(darkStripMean.Size() > 0) { - darkStripMean[0] = IString(SetRound(darkStripMean[0], 16)); + darkStripMean[0] = toString(SetRound(toDouble(darkStripMean[0]), 16)); } } catch(IException &) { @@ -342,8 +342,8 @@ void IsisMain() { // Now address nested keywords in SUBFRAME groups for(int i = 1 ; i <= 5 ; i++) { - IString n(i); - string group = "SUBFRAME" + n + "_PARAMETERS"; + QString n(toString(i)); + QString group = "SUBFRAME" + n + "_PARAMETERS"; if(pdsLabel.HasGroup(group)) { PvlGroup &grp = pdsLabel.FindGroup(group); ValidateUnit(grp.FindKeyword("RETICLE_POINT_LATITUDE"), "DEG"); @@ -358,7 +358,7 @@ void IsisMain() { p.CheckStatus(); // All done...write result. - ofstream outstream(output.expanded().c_str()); + ofstream outstream(output.expanded().toAscii().data()); processPds.OutputLabel(outstream); processPds.StartProcess(outstream); diff --git a/isis/src/messenger/apps/mdiscal/DarkModelPixel.h b/isis/src/messenger/apps/mdiscal/DarkModelPixel.h index a6852b7927..77ab989fe0 100644 --- a/isis/src/messenger/apps/mdiscal/DarkModelPixel.h +++ b/isis/src/messenger/apps/mdiscal/DarkModelPixel.h @@ -1,4 +1,4 @@ -#if !defined(DarkModelPixel_h) +#ifndef DarkModelPixel_h #define DarkModelPixel_h /** * @file @@ -80,8 +80,8 @@ namespace Isis { } - std::string loadCoefficients(bool isNac, bool isFpuBinned) { - std::string filename = "$messenger/calibration/DARK_MODEL/MDIS"; + QString loadCoefficients(bool isNac, bool isFpuBinned) { + QString filename = "$messenger/calibration/DARK_MODEL/MDIS"; // FileName consists of binned/notbinned, camera, and filter filename += (isNac) ? "NAC" : "WAC"; filename += (isFpuBinned) ? "_BINNED_" : "_NOTBIN_"; @@ -116,7 +116,7 @@ namespace Isis { return (filename); } - std::string getFileName() const { + QString getFileName() const { return (_filename); } @@ -151,7 +151,7 @@ namespace Isis { double _ccdTemp; double _expTime; DVector _coefs; - std::string _filename; + QString _filename; }; }; diff --git a/isis/src/messenger/apps/mdiscal/MdisCalUtils.h b/isis/src/messenger/apps/mdiscal/MdisCalUtils.h index c63b6d40c0..83137c9682 100644 --- a/isis/src/messenger/apps/mdiscal/MdisCalUtils.h +++ b/isis/src/messenger/apps/mdiscal/MdisCalUtils.h @@ -1,4 +1,4 @@ -#if !defined(MdisCalUtils_h) +#ifndef MdisCalUtils_h #define MdisCalUtils_h /** * @file @@ -41,11 +41,11 @@ namespace Isis { * @return double Converted value */ template double ToDouble(const T &value) { - return (IString(value).Trim(" \r\t\n").ToDouble()); + return toDouble(QString(value).trimmed()); } template int ToInteger(const T &value) { - return (IString(value).Trim(" \r\t\n").ToInteger()); + return toInt(QString(value).trimmed()); } template inline T MIN(const T &A, const T &B) { @@ -56,10 +56,10 @@ namespace Isis { return (((A) > (B)) ? (A) : (B)); } - inline std::string Quote(const std::string &value) { - if(value.empty()) return (value); + inline QString Quote(const QString &value) { + if(value.isEmpty()) return (value); if(value[0] == '"') return (value); - return (std::string('"' + value + '"')); + return (QString('"' + value + '"')); } /** @@ -83,12 +83,12 @@ namespace Isis { pck = pck.highestVersion(); // Load the kernels - std::string leapsecondsName(leapseconds.expanded()); - std::string sclkName(sclk.expanded()); - std::string pckName(pck.expanded()); - furnsh_c(leapsecondsName.c_str()); - furnsh_c(sclkName.c_str()); - furnsh_c(pckName.c_str()); + QString leapsecondsName(leapseconds.expanded()); + QString sclkName(sclk.expanded()); + QString pckName(pck.expanded()); + furnsh_c(leapsecondsName.toAscii().data()); + furnsh_c(sclkName.toAscii().data()); + furnsh_c(pckName.toAscii().data()); // Ensure it is loaded only once _naifLoaded = true; @@ -104,8 +104,8 @@ namespace Isis { * * @return double Distance in AU between Sun and observed body */ - static bool sunDistanceAU(const std::string &scStartTime, - const std::string &target, + static bool sunDistanceAU(const QString &scStartTime, + const QString &target, double &sunDist) { // Ensure NAIF kernels are loaded @@ -115,17 +115,17 @@ namespace Isis { // Determine if the target is a valid NAIF target SpiceInt tcode; SpiceBoolean found; - (void) bodn2c_c(target.c_str(), &tcode, &found); + (void) bodn2c_c(target.toAscii().data(), &tcode, &found); if(!found) return (false); // Convert starttime to et double obsStartTime; - scs2e_c(-236, scStartTime.c_str(), &obsStartTime); + scs2e_c(-236, scStartTime.toAscii().data(), &obsStartTime); // Get the vector from target to sun and determine its length double sunv[3]; double lt; - (void) spkpos_c(target.c_str(), obsStartTime, "J2000", "LT+S", "sun", + (void) spkpos_c(target.toAscii().data(), obsStartTime, "J2000", "LT+S", "sun", sunv, <); double sunkm = vnorm_c(sunv); @@ -134,7 +134,7 @@ namespace Isis { return (true); } - std::vector loadWACCSV(const std::string &fname, int filter, + std::vector loadWACCSV(const QString &fname, int filter, int nvalues, bool header = true, int skip = 0) { // Open the CSV file FileName csvfile(fname); @@ -143,11 +143,11 @@ namespace Isis { CSVReader::CSVAxis row = csv.getRow(i); if(ToInteger(row[0]) == filter) { if((row.dim1() - 1) < nvalues) { - std::string mess = "Number values (" + IString(row.dim1() - 1) + + QString mess = "Number values (" + QString(row.dim1() - 1) + ") in file " + fname + " less than number requested (" + - IString(nvalues) + ")!"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString(nvalues) + ")!"; + throw IException(IException::User, mess, _FILEINFO_); } std::vector rsp; @@ -166,17 +166,17 @@ namespace Isis { } - std::vector loadNACCSV(const std::string &fname, int nvalues, + std::vector loadNACCSV(const QString &fname, int nvalues, bool header = true, int skip = 0) { // Open the CSV file FileName csvfile(fname); CSVReader csv(csvfile.expanded(), header, skip); CSVReader::CSVAxis row = csv.getRow(0); if(row.dim1() < nvalues) { - std::string mess = "Number values (" + IString(row.dim1()) + + QString mess = "Number values (" + QString(row.dim1()) + ") in file " + fname + " less than number requested (" + - IString(nvalues) + ")!"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString(nvalues) + ")!"; + throw IException(IException::User, mess, _FILEINFO_); } std::vector rsp; @@ -188,13 +188,13 @@ namespace Isis { std::vector loadResponsivity(bool isNAC, bool binned, int filter, - std::string &fname) { + QString &fname) { FileName resfile(fname); - if(fname.empty()) { - std::string camstr = (isNAC) ? "NAC" : "WAC"; - std::string binstr = (binned) ? "_BINNED" : "_NOTBIN"; - std::string base = "$messenger/calibration/RESPONSIVITY/"; + if(fname.isEmpty()) { + QString camstr = (isNAC) ? "NAC" : "WAC"; + QString binstr = (binned) ? "_BINNED" : "_NOTBIN"; + QString base = "$messenger/calibration/RESPONSIVITY/"; resfile = base + "MDIS" + camstr + binstr + "_RESP_?.TAB"; resfile = resfile.highestVersion(); fname = resfile.originalPath() + "/" + resfile.name(); @@ -213,12 +213,12 @@ namespace Isis { std::vector loadSolarIrr(bool isNAC, bool binned, int filter, - std::string &fname) { + QString &fname) { FileName solfile(fname); - if(fname.empty()) { - std::string camstr = (isNAC) ? "NAC" : "WAC"; - std::string base = "$messenger/calibration/SOLAR/"; + if(fname.isEmpty()) { + QString camstr = (isNAC) ? "NAC" : "WAC"; + QString base = "$messenger/calibration/SOLAR/"; solfile = base + "MDIS" + camstr + "_SOLAR_?.TAB"; solfile = solfile.highestVersion(); fname = solfile.originalPath() + "/" + solfile.name(); @@ -232,12 +232,12 @@ namespace Isis { } } - double loadSmearComponent(bool isNAC, int filter, std::string &fname) { + double loadSmearComponent(bool isNAC, int filter, QString &fname) { FileName smearfile(fname); - if(fname.empty()) { - std::string camstr = (isNAC) ? "NAC" : "WAC"; - std::string base = "$messenger/calibration/smear/"; + if(fname.isEmpty()) { + QString camstr = (isNAC) ? "NAC" : "WAC"; + QString base = "$messenger/calibration/smear/"; smearfile = base + "MDIS" + camstr + "_FRAME_TRANSFER_??.TAB"; smearfile = smearfile.highestVersion(); fname = smearfile.originalPath() + "/" + smearfile.name(); @@ -325,8 +325,8 @@ namespace Isis { * @return double - Event correction factor at the selected time to apply * to WAC filter data. */ - double loadContaminationEvent(const std::string &scStartTime, const int filter, - std::string &ename, std::string &eDate) { + double loadContaminationEvent(const QString &scStartTime, const int filter, + QString &ename, QString &eDate) { // This table maps the filter number extracted from BandBin/Number keyword // to the columns (index) in the contamination table @@ -351,7 +351,7 @@ namespace Isis { } // File name not provided by caller. Determine the event table name - if ( ename.empty() ) { + if ( ename.isEmpty() ) { FileName eventfile("$messenger/calibration/events/event_table_ratioed_v?.txt"); eventfile = eventfile.highestVersion(); ename = eventfile.originalPath() + "/" + eventfile.name(); @@ -364,10 +364,10 @@ namespace Isis { const int nvalues(13); // Expected columns in table CSVReader csv(csvfile.expanded(), header, skip); if (csv.columns() < nvalues) { // All rows should have same # columns - std::string mess = "Number values (" + IString(csv.columns()) + + QString mess = "Number values (" + QString(csv.columns()) + ") in file " + ename + " less than number requested (" + - IString(nvalues) + ")!"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString(nvalues) + ")!"; + throw IException(IException::User, mess, _FILEINFO_); } // Ensure NAIF kernels are loaded for NAIF time computations @@ -375,7 +375,7 @@ namespace Isis { // Convert s/c clock start time to et double obsStartTime; - (void) scs2e_c(-236, scStartTime.c_str(), &obsStartTime); + (void) scs2e_c(-236, scStartTime.toAscii().data(), &obsStartTime); // Set initial conditions and loop through all rows in the event table double evalue(1.0); @@ -383,9 +383,9 @@ namespace Isis { double preEventTime(0.0); for (int i = 0 ; i < csv.rows() ; i++) { CSVReader::CSVAxis eRow = csv.getRow(i); - std::string utcTime = eRow[0]; + QString utcTime = eRow[0]; double eTime; - (void) utc2et_c(utcTime.c_str(), &eTime); + (void) utc2et_c(utcTime.toAscii().data(), &eTime); // If current time is greater than start time this is the post event case if (eTime > obsStartTime) { @@ -393,7 +393,7 @@ namespace Isis { if ( fabs(obsStartTime-preEventTime) > fabs(eTime-obsStartTime) ) { // Post-event time closer to SCLK than Pre-event time eDate = utcTime; - evalue = eRow[column].ToDouble(); + evalue = toDouble(eRow[column]); } break; // Terminate loop and return @@ -402,7 +402,7 @@ namespace Isis { // Record pre-event time slot - Sets return variables as well eDate = utcTime; preEventTime = eTime; - evalue = eRow[column].ToDouble(); + evalue = toDouble(eRow[column]); } // Return the factor diff --git a/isis/src/messenger/apps/mdiscal/mdiscal.cpp b/isis/src/messenger/apps/mdiscal/mdiscal.cpp index 98a9cf45ff..8e484f96c0 100644 --- a/isis/src/messenger/apps/mdiscal/mdiscal.cpp +++ b/isis/src/messenger/apps/mdiscal/mdiscal.cpp @@ -2,7 +2,7 @@ #include "Isis.h" #include -#include +#include #include #include #include @@ -66,10 +66,10 @@ void Calibrate(vector& in, vector& out); void IsisMain() { - const string mdiscal_program = "mdiscal"; - const string mdiscal_version = "1.4"; - const string mdiscal_revision = "$Revision$"; - string mdiscal_runtime = Application::DateTime(); + const QString mdiscal_program = "mdiscal"; + const QString mdiscal_version = "1.4"; + const QString mdiscal_revision = "$Revision$"; + QString mdiscal_runtime = Application::DateTime(); // Specify the version of the CDR generated const int cdr_version = 4; @@ -96,7 +96,7 @@ void IsisMain() { Cube *icube = p.SetInputCube("FROM"); PvlGroup& inst = icube->getGroup("Instrument"); - isNarrowAngleCamera = ((string)inst["InstrumentId"] == "MDIS-NAC"); + isNarrowAngleCamera = ((QString)inst["InstrumentId"] == "MDIS-NAC"); exposureDuration = inst["ExposureDuration"]; exposureDuration /= 1000.0; // Convert ms to sec @@ -142,7 +142,7 @@ void IsisMain() { if (!convertDarkToNull) nSampsToNull = 0; - IString darkCurr = ui.GetString("DARKCURRENT"); + QString darkCurr = ui.GetString("DARKCURRENT"); g_flatfield = ui.GetBoolean("FLATFIELD"); g_radiometric = ui.GetBoolean("RADIOMETRIC"); @@ -170,7 +170,7 @@ void IsisMain() { // Both cases require dark pixels, model does not if ((darkCurr == "STANDARD") || (darkCurr == "LINEAR")) { darkCurr = "MODEL"; - string mess = "There are no valid dark current pixels which are required" + QString mess = "There are no valid dark current pixels which are required" " for " + darkCurr + " calibration... must use MODEL"; IException ie(IException::User, mess, _FILEINFO_); ie.print(); @@ -179,7 +179,7 @@ void IsisMain() { // Model cannot be used for exposure times > 1.0 if ((darkCurr == "MODEL") && (exposureDuration > 1.0)) { darkCurr = "NONE"; - string mess = "There are no valid dark current pixels and the dark model" + QString mess = "There are no valid dark current pixels and the dark model" " correction can not be used when the exposure duration" " exceeds 1000...image cannot be calibrated"; IException ie(IException::User, mess, _FILEINFO_); @@ -198,7 +198,7 @@ void IsisMain() { calibrationValues.resize(icube->getLineCount()); } else if (darkCurr == "MODEL") { if (exposureDuration > 1.0) { - string mess = "Dark model correction can not be used when the " + QString mess = "Dark model correction can not be used when the " "exposure duration exceeds 1000...using LINEAR instead."; IException ie(IException::User, mess, _FILEINFO_); ie.print(); @@ -217,7 +217,7 @@ void IsisMain() { darkCurr + "]", _FILEINFO_); } - string darkCurrentFile(""); + QString darkCurrentFile(""); if (darkCurrentMode != DarkCurrentNone) { if (darkCurrentMode != DarkCurrentModel) { p.Progress()->SetText("Gathering Dark Current Statistics"); @@ -259,7 +259,7 @@ void IsisMain() { } // Compute the (new) absolute calibration - string respfile(""); + QString respfile(""); vector rsp = loadResponsivity(isNarrowAngleCamera, isBinnedData, filterNumber + 1, respfile); // abs_coef = 1.0 / (rsp[0] * ((rsp[2] * ccdTemperature) + rsp[1])); @@ -273,15 +273,15 @@ void IsisMain() { abs_coef = 1.0 / Resp; // Retrieve filter dependant SMEAR component - string smearfile(""); + QString smearfile(""); smearComponent = loadSmearComponent(isNarrowAngleCamera, filterNumber + 1, smearfile); // Get s/c clock count - string startTime = inst["SpacecraftClockCount"]; + QString startTime = inst["SpacecraftClockCount"]; // Retrieve contamination event correction parameter - string eventfile(""), eventDate("N/A"); + QString eventfile(""), eventDate("N/A"); if (isNarrowAngleCamera) { // Not applicable to the NAC eventfile = "N/A"; eventCorrection = 1.0; @@ -296,11 +296,11 @@ void IsisMain() { bool do_iof = ui.GetBoolean("IOF"); if (!g_radiometric) do_iof = false; bool iof_is_good = false; - string solirrfile(""); + QString solirrfile(""); if (do_iof) { PvlGroup& inst = icube->getGroup("Instrument"); - string target = inst["TargetName"]; - string startTime = inst["SpacecraftClockCount"]; + QString target = inst["TargetName"]; + QString startTime = inst["SpacecraftClockCount"]; if (sunDistanceAU(startTime, target, solarDist)) { vector sol = loadSolarIrr(isNarrowAngleCamera, isBinnedData, filterNumber + 1, solirrfile); @@ -315,13 +315,13 @@ void IsisMain() { // Determine if we need to subsample the flat field should pixel binning // occurred - string reducedFlat(""); + QString reducedFlat(""); FileName flatfield = DetermineFlatFieldFile(); if (pxlBin > 0) { - IString scale(pxlBin); + QString scale(toString(pxlBin)); FileName newflat = FileName::createTempFile("$TEMPORARY/" + flatfield.baseName() + "_reduced.cub"); reducedFlat = newflat.expanded(); - string parameters = "FROM=" + flatfield.expanded() + + QString parameters = "FROM=" + flatfield.expanded() + " TO=" + newflat.expanded() + " MODE=SCALE" + " LSCALE=" + scale + @@ -332,7 +332,7 @@ void IsisMain() { reducedFlat = newflat.expanded(); } catch (IException&) { - remove(reducedFlat.c_str()); + remove(reducedFlat.toAscii().data()); throw; } CubeAttributeInput att; @@ -350,12 +350,12 @@ void IsisMain() { p.StartProcess(Calibrate); } catch (...) { - if (!reducedFlat.empty()) remove(reducedFlat.c_str()); + if (!reducedFlat.isEmpty()) remove(reducedFlat.toAscii().data()); throw; } // Remove the temporary reduced input file if generated - if (!reducedFlat.empty()) remove(reducedFlat.c_str()); + if (!reducedFlat.isEmpty()) remove(reducedFlat.toAscii().data()); // Log calibration activity PvlGroup calibrationLog("RadiometricCalibration"); @@ -365,25 +365,25 @@ void IsisMain() { calibrationLog.AddKeyword(PvlKeyword("DarkCurrentModel", darkCurr)); if (darkCurrentMode == DarkCurrentLinear) { - IString equation = "Y = " + IString(calibrationValues[0]) + IString(" + ") + IString(calibrationValues[1]) + IString("x"); - calibrationLog.AddKeyword(PvlKeyword("DarkCurrentEquation", (string)equation)); + QString equation = "Y = " + toString(calibrationValues[0]) + QString(" + ") + toString(calibrationValues[1]) + QString("x"); + calibrationLog.AddKeyword(PvlKeyword("DarkCurrentEquation", (QString)equation)); } else if (darkCurrentMode == DarkCurrentModel) { calibrationLog.AddKeyword(PvlKeyword("DarkCurrentFile", darkCurrentFile)); } - calibrationLog.AddKeyword(PvlKeyword("BinnedImage", isBinnedData)); - calibrationLog.AddKeyword(PvlKeyword("FilterNumber", filterNumber + 1)); + calibrationLog.AddKeyword(PvlKeyword("BinnedImage", toString((int)isBinnedData))); + calibrationLog.AddKeyword(PvlKeyword("FilterNumber", toString(filterNumber + 1))); if (g_flatfield) { calibrationLog.AddKeyword(PvlKeyword("FlatFieldFile", flatfield.originalPath() + "/" + flatfield.name())); calibrationLog.AddKeyword(PvlKeyword("CalibrationFile", calibFile.originalPath() + "/" + calibFile.name())); calibrationLog.AddKeyword(PvlKeyword("ResponsivityFile", respfile)); calibrationLog.AddKeyword(PvlKeyword("SmearCompFile", smearfile)); - PvlKeyword rspKey("Response", rsp[0]); + PvlKeyword rspKey("Response", toString(rsp[0])); for (unsigned int i = 1; i < rsp.size(); i++) { - rspKey.AddValue(rsp[i]); + rspKey.AddValue(toString(rsp[i])); } calibrationLog.AddKeyword(rspKey); - calibrationLog.AddKeyword(PvlKeyword("SmearComponent", smearComponent)); + calibrationLog.AddKeyword(PvlKeyword("SmearComponent", toString(smearComponent))); } else { calibrationLog.AddKeyword(PvlKeyword("FlatFieldFile", "N/A")); calibrationLog.AddKeyword(PvlKeyword("CalibrationFile", "N/A")); @@ -394,13 +394,13 @@ void IsisMain() { calibrationLog.AddKeyword(PvlKeyword("SmearComponent", "N/A")); } - string calibType; + QString calibType; if (do_iof && iof_is_good) { calibrationLog.AddKeyword(PvlKeyword("Units", "I over F")); - calibrationLog.AddKeyword(PvlKeyword("SolarDistance", solarDist, "AU")); + calibrationLog.AddKeyword(PvlKeyword("SolarDistance", toString(solarDist), "AU")); calibrationLog.AddKeyword(PvlKeyword("SolarIrrFile", solirrfile)); - calibrationLog.AddKeyword(PvlKeyword("FilterIrradianceFactor", F_f)); - calibrationLog.AddKeyword(PvlKeyword("IOFFactor", iof)); + calibrationLog.AddKeyword(PvlKeyword("FilterIrradianceFactor", toString(F_f))); + calibrationLog.AddKeyword(PvlKeyword("IOFFactor", toString(iof))); calibType = "IF"; } else if (g_radiometric) { calibrationLog.AddKeyword(PvlKeyword("Units", "W / (m**2 micrometer sr)")); @@ -413,27 +413,27 @@ void IsisMain() { calibrationLog.AddKeyword(PvlKeyword("ContaminationEventFile", eventfile)); calibrationLog.AddKeyword(PvlKeyword("ContaminationEventDate", eventDate)); calibrationLog.AddKeyword(PvlKeyword("ContaminationEventFactor", - eventCorrection)); + toString(eventCorrection))); - calibrationLog.AddKeyword(PvlKeyword("DarkStripColumns", nDarkColumns), + calibrationLog.AddKeyword(PvlKeyword("DarkStripColumns", toString(nDarkColumns)), Pvl::Replace); - calibrationLog.AddKeyword(PvlKeyword("ValidDarkColumns", nValidDark), + calibrationLog.AddKeyword(PvlKeyword("ValidDarkColumns", toString(nValidDark)), Pvl::Replace); if (darkStrip.TotalPixels() > 0) { double avgDark = (darkStrip.ValidPixels() > 0) ? darkStrip.Average() : 0.0; - calibrationLog.AddKeyword(PvlKeyword("DarkStripMean", avgDark), + calibrationLog.AddKeyword(PvlKeyword("DarkStripMean", toString(avgDark)), Pvl::Replace); } // Report nulled sample count - calibrationLog.AddKeyword(PvlKeyword("LeftSamplesNulled", nSampsToNull)); + calibrationLog.AddKeyword(PvlKeyword("LeftSamplesNulled", toString(nSampsToNull))); // Handle updates of ProductId and SourceProduct Id keywords PvlGroup& archive = ocube->getGroup("Archive"); PvlKeyword key = archive["ProductId"]; - IString orgProdId = key[0]; - IString newProdId = orgProdId + "_" + calibType + "_" + IString(cdr_version); + QString orgProdId = key[0]; + QString newProdId = orgProdId + "_" + calibType + "_" + toString(cdr_version); newProdId[0] = 'C'; key.SetValue(Quote(newProdId)); archive.AddKeyword(key, Pvl::Replace); @@ -448,7 +448,7 @@ void IsisMain() { key = PvlKeyword("SourceProductId", Quote(orgProdId)); } - if (!darkCurrentFile.empty()) { + if (!darkCurrentFile.isEmpty()) { key.AddValue(Quote(FileName(darkCurrentFile).baseName())); } key.AddValue(Quote(flatfield.baseName())); @@ -466,7 +466,7 @@ void IsisMain() { } FileName DetermineFlatFieldFile() { - string filename = "$messenger/calibration/FLAT/"; + QString filename = "$messenger/calibration/FLAT/"; // FileName consists of binned/notbinned, camera, and filter filename += "MDIS"; @@ -480,7 +480,7 @@ FileName DetermineFlatFieldFile() { // add a zero if the filter is 1-digit filename += "_FIL"; if (filterNumber < 9) filename += "0"; - filename += IString(filterNumber + 1); + filename += toString(filterNumber + 1); filename += "_?.cub"; } diff --git a/isis/src/messenger/apps/mdisddr/mdisddr.cpp b/isis/src/messenger/apps/mdisddr/mdisddr.cpp index 288d687808..ce9d038445 100644 --- a/isis/src/messenger/apps/mdisddr/mdisddr.cpp +++ b/isis/src/messenger/apps/mdisddr/mdisddr.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include #include @@ -25,12 +25,12 @@ using namespace std; using namespace Isis; -typedef CollectorMap BandMap; +typedef CollectorMap BandMap; -inline std::string Quote(const std::string &value, const char qChar = '"') { - if(value.empty()) return (value); +inline QString Quote(const QString &value, const char qChar = '"') { + if(value.isEmpty()) return (value); if(value[0] == qChar) return (value); - return (std::string(qChar + value + qChar)); + return (QString(qChar + value + qChar)); } inline double SetRound(double value, const int precision) { @@ -39,15 +39,15 @@ inline double SetRound(double value, const int precision) { return (value); } -inline void ValidateUnit(PvlKeyword &key, const std::string &kunit) { +inline void ValidateUnit(PvlKeyword &key, const QString &kunit) { PvlKeyword temp = key; key.Clear(); for(int i = 0 ; i < temp.Size() ; i++) { try { // If this works, check unit, otherwise an exception is thrown - (void) temp[i].ToDouble(); - string unit = temp.Unit(i); - if(unit.empty()) unit = kunit; + (void) toDouble(temp[i]); + QString unit = temp.Unit(i); + if(unit.isEmpty()) unit = kunit; key.AddValue(temp[i], unit); } catch(...) { @@ -57,14 +57,14 @@ inline void ValidateUnit(PvlKeyword &key, const std::string &kunit) { return; } -inline void FixUnit(PvlObject &obj, const string &key, const string &unit) { +inline void FixUnit(PvlObject &obj, const QString &key, const QString &unit) { if(obj.HasKeyword(key, PvlObject::Traverse)) { ValidateUnit(obj.FindKeyword(key, PvlObject::Traverse), unit); } return; } -inline void FixQuotes(PvlContainer &kcont, const string &value = "N/A") { +inline void FixQuotes(PvlContainer &kcont, const QString &value = "N/A") { PvlContainer::PvlKeywordIterator kiter; for(kiter = kcont.Begin() ; kiter != kcont.End() ; ++kiter) { for(int nv = 0 ; nv < kiter->Size() ; nv++) { @@ -92,30 +92,30 @@ inline void FixLabels(PvlObject &obj) { } inline void WriteBand(ProcessExportPds &process, ofstream &out, - const std::string &fname, int band) { + const QString &fname, int band) { process.ClearInputCubes(); - (void) process.SetInputCube(fname, CubeAttributeInput("+" + IString(band))); + (void) process.SetInputCube(fname, CubeAttributeInput("+" + toString(band))); process.StartProcess(out); return; } void IsisMain() { - const std::string mdisddr_program = "mdisddr"; - const std::string mdisddr_version = "1.0"; - const std::string mdisddr_revision = "$Revision$"; - const std::string mdisddr_runtime = Application::DateTime(); - const std::string dataSetID = "MESS-E/V/H-MDIS-6-DDR-GEOMDATA-V1.0"; + const QString mdisddr_program = "mdisddr"; + const QString mdisddr_version = "1.0"; + const QString mdisddr_revision = "$Revision$"; + const QString mdisddr_runtime = Application::DateTime(); + const QString dataSetID = "MESS-E/V/H-MDIS-6-DDR-GEOMDATA-V1.0"; UserInterface &ui = Application::GetUserInterface(); FileName input(ui.GetFileName("FROM")); - string to(""); + QString to(""); bool toEntered = ui.WasEntered("TO"); if(toEntered) { to = ui.GetAsString("TO"); } - string opath("."); // Set default to local directory + QString opath("."); // Set default to local directory if(ui.WasEntered("OPATH")) { opath = ui.GetString("OPATH"); } @@ -125,8 +125,8 @@ void IsisMain() { // Generate the image cube that phocube produces for the DDR data FileName phoFile = FileName::createTempFile("$TEMPORARY/" + input.baseName() + "_phocube.cub"); - string pfile = phoFile.expanded(); - string parameters = "FROM=" + input.expanded() + " TO=" + pfile + + QString pfile = phoFile.expanded(); + QString parameters = "FROM=" + input.expanded() + " TO=" + pfile + " LATITUDE=TRUE LONGITUDE=TRUE PHASE=TRUE EMISSION=TRUE INCIDENCE=TRUE"; ProgramLauncher::RunIsisProgram("phocube", parameters); @@ -204,7 +204,7 @@ void IsisMain() { p.CheckStatus(); // Add any new keywords - string lnote = "2007-12-20, S. Murchie (JHU/APL); " + QString lnote = "2007-12-20, S. Murchie (JHU/APL); " "2008-01-02, S. Murchie (JHU/APL); " "2008-01-11, J. Ward (GEO)"; pdsLabel += PvlKeyword("LABEL_REVISION_NOTE", lnote); @@ -213,18 +213,15 @@ void IsisMain() { // Fixes bad keywords PvlKeyword &data_set_id = pdsLabel.FindKeyword("DATA_SET_ID", Pvl::Traverse); data_set_id.SetValue(dataSetID); - string prodid(input.baseName()); + QString prodid(input.baseName()); PvlKeyword &product_id = pdsLabel.FindKeyword("PRODUCT_ID", Pvl::Traverse); if((product_id.Size() == 0) || ((product_id.Size() > 0) && (product_id[0] == "N/A"))) { product_id.SetValue(prodid); } else { - string pid = product_id[0]; + QString pid = product_id[0]; pid[0] = 'D'; - string::size_type pos = pid.find_first_of("_"); - if(pos != string::npos) { - pid.erase(pos); - } + pid.remove(QRegExp("_.*")); pid.append("_DE_0"); product_id.SetValue(pid); prodid = pid; @@ -264,10 +261,10 @@ void IsisMain() { // For DDRs, the SOURCE_PRODUCT_ID is made up of SPICE kernels. I need to // go get em. Kernels kernels(from); - vector kfiles = kernels.getKernelList(); + QStringList kfiles = kernels.getKernelList(); PvlKeyword &source_product_id = pdsLabel.FindKeyword("SOURCE_PRODUCT_ID", Pvl::Traverse); source_product_id.Clear(); - for(unsigned int i = 0; i < kfiles.size(); i++) { + for(int i = 0; i < kfiles.size(); i++) { FileName kfile(kfiles[i]); source_product_id.AddValue(Quote(kfile.name())); } @@ -308,8 +305,8 @@ void IsisMain() { // Now address nested keywords in SUBFRAME groups for(int i = 1 ; i <= 5 ; i++) { - IString n(i); - string group = "SUBFRAME" + n + "_PARAMETERS"; + QString n(toString(i)); + QString group = "SUBFRAME" + n + "_PARAMETERS"; if(pdsLabel.HasGroup(group)) { PvlGroup &grp = pdsLabel.FindGroup(group); ValidateUnit(grp.FindKeyword("RETICLE_POINT_LATITUDE"), "DEG"); @@ -325,8 +322,8 @@ void IsisMain() { // All done...write result. pdsLabel.SetFormatTemplate("$messenger/templates/labels/mdisPdsDDR.pft"); - string ofile(output.expanded()); - ofstream outstream(ofile.c_str()); + QString ofile(output.expanded()); + ofstream outstream(ofile.toAscii().data()); processPds.OutputLabel(outstream); // Writing out the 5 bands is a bit tricky for this product. The bands @@ -344,14 +341,14 @@ void IsisMain() { WriteBand(processPds, outstream, pfile, bandmap.get("Phase Angle")); outstream.close(); processPds.EndProcess(); - remove(pfile.c_str()); + remove(pfile.toAscii().data()); } catch(IException &) { - remove(pfile.c_str()); + remove(pfile.toAscii().data()); throw; } catch(...) { - remove(pfile.c_str()); + remove(pfile.toAscii().data()); throw IException(IException::Unknown, "Unexpected exception caught!", _FILEINFO_); } diff --git a/isis/src/messenger/apps/mdisedrinfo/MdisEdrKeys.h b/isis/src/messenger/apps/mdisedrinfo/MdisEdrKeys.h index b64cd83fdb..55539bede9 100644 --- a/isis/src/messenger/apps/mdisedrinfo/MdisEdrKeys.h +++ b/isis/src/messenger/apps/mdisedrinfo/MdisEdrKeys.h @@ -1,4 +1,4 @@ -#if !defined(MdisEdrKeys_h) +#ifndef MdisEdrKeys_h #define MdisEdrKeys_h /** * @file @@ -79,7 +79,7 @@ namespace Isis { * * @param edrfile File containing the PDS EDR label */ - MdisEdrKeys(const std::string &edrfile) { + MdisEdrKeys(const QString &edrfile) { _edrLabel = Pvl(edrfile); LoadKeys(_edrLabel, _keys); } @@ -120,8 +120,8 @@ namespace Isis { * @param key PvlKeyword to add to the container * @param name Optional name other than what the keyword is named */ - void add(const PvlKeyword &key, const std::string &name = "") { - if(name.empty()) { + void add(const PvlKeyword &key, const QString &name = "") { + if(name.isEmpty()) { _keys.add(key.Name(), key); } else { @@ -158,7 +158,7 @@ namespace Isis { * * @return PvlKeyword& Reference to named keyword */ - PvlKeyword &get(const std::string &name) { + PvlKeyword &get(const QString &name) { return (_keys.get(name)); } @@ -173,7 +173,7 @@ namespace Isis { * @return const PvlKeyword& Returns a const reference to the named * keyword */ - const PvlKeyword &get(const std::string &name) const { + const PvlKeyword &get(const QString &name) const { return (_keys.get(name)); } @@ -203,18 +203,18 @@ namespace Isis { * @param keylist List of keywords to extract * @param NAstr String used to specify no value (used mainly so a unit * qualifer is not added to the value) - * @return std::string Returns a comma delineated string of keyword values + * @return QString Returns a comma delineated string of keyword values */ - std::string extract(const std::vector &keylist, - const std::string &NAstr, PvlGroup *group = 0) { + QString extract(const QStringList &keylist, + const QString &NAstr, PvlGroup *group = 0) { std::ostringstream out; - std::string loopSep(""); + QString loopSep(""); int nbad(0); IException errors; - for(unsigned int i = 0 ; i < keylist.size() ; i++) { - IString keyname(keylist[i]); - keyname.Trim(" \n\t"); + for(int i = 0 ; i < keylist.size() ; i++) { + QString keyname(keylist[i]); + keyname = keyname.trimmed(); try { PvlKeyword &key = _keys.get(keyname); if(group) group->AddKeyword(key); @@ -226,7 +226,7 @@ namespace Isis { } else { out << loopSep << "("; - std::string vsep(""); + QString vsep(""); for(int iv = 0 ; iv < key.Size() ; iv++) { out << vsep << key[iv]; if(key[iv] != NAstr) { @@ -240,24 +240,24 @@ namespace Isis { } catch(IException &ie) { nbad++; - std::string mess = "Keyword \"" + keyname + "\" does not exist!"; + QString mess = "Keyword \"" + keyname + "\" does not exist!"; errors.append( - IException(IException::User, mess.c_str(), _FILEINFO_)); + IException(IException::User, mess, _FILEINFO_)); } } // Check to see if all keywords are found if(nbad > 0) { - std::string mess = "One or more keywords in list do not exist!"; - throw IException(errors, IException::User, mess.c_str(), _FILEINFO_); + QString mess = "One or more keywords in list do not exist!"; + throw IException(errors, IException::User, mess, _FILEINFO_); } - return (out.str()); + return (out.str().c_str()); } private: //!< Define the keyword container for systematic processing - typedef CollectorMap KeyList; + typedef CollectorMap KeyList; Pvl _edrLabel; //!< Label used to populate the container KeyList _keys; //!< The container @@ -271,12 +271,12 @@ namespace Isis { * @param keys Container to receive the keywords */ void MapKeys(PvlContainer &p, KeyList &keys, - const std::string prefix = "") { - std::string prekey(prefix); - if(!prefix.empty()) prekey += "/"; + const QString prefix = "") { + QString prekey(prefix); + if(!prefix.isEmpty()) prekey += "/"; PvlContainer::PvlKeywordIterator keyIter = p.Begin(); for(; keyIter != p.End() ; ++keyIter) { - std::string keyname = prefix + keyIter->Name(); + QString keyname = prefix + keyIter->Name(); PvlKeyword key = *keyIter; key.SetName(keyname); keys.add(keyname, key); @@ -311,7 +311,7 @@ namespace Isis { * @param keys The container to add keywords to */ void LoadKeys(PvlObject &obj, KeyList &keys, - const std::string prefix = "") { + const QString prefix = "") { MapKeys(obj, keys, prefix); // Load object level keywords LoadGroups(obj, keys); // Load all groups in this object @@ -319,10 +319,10 @@ namespace Isis { // all SUBFRAME[12345]_PARAMETERS since they are unsupported. PvlObject::PvlObjectIterator objIter = obj.BeginObject(); for(; objIter != obj.EndObject() ; ++objIter) { - IString objname(objIter->Name()); - objname.UpCase(); - std::string::size_type gotSubframe = objname.find("SUBFRAME"); - if(gotSubframe != std::string::npos) { + QString objname(objIter->Name()); + objname = objname.toUpper(); + int gotSubframe = objname.indexOf("SUBFRAME"); + if(gotSubframe != -1) { LoadKeys(*objIter, keys, objIter->Name()); } else { @@ -339,10 +339,10 @@ namespace Isis { * @param unit value of unit. If empty returns empty string otherwise * places "<" and ">" on the ends. * - * @return std::string The formatted unit + * @return QString The formatted unit */ - std::string formatUnit(const std::string &unit) const { - if(!unit.empty()) { + QString formatUnit(const QString &unit) const { + if(!unit.isEmpty()) { return (" <" + unit + ">"); } return (unit); diff --git a/isis/src/messenger/apps/mdisedrinfo/MdisGeometry.cpp b/isis/src/messenger/apps/mdisedrinfo/MdisGeometry.cpp index 9818bd49ec..ce6ed1ca04 100644 --- a/isis/src/messenger/apps/mdisedrinfo/MdisGeometry.cpp +++ b/isis/src/messenger/apps/mdisedrinfo/MdisGeometry.cpp @@ -52,7 +52,7 @@ namespace Isis { * @brief Constructor using an ISIS cube file name * @param filename Name of ISIS cube file */ - MdisGeometry::MdisGeometry(const std::string &filename) { + MdisGeometry::MdisGeometry(const QString &filename) { Cube cube; cube.open(filename); init(cube); @@ -75,7 +75,7 @@ namespace Isis { * * @param filename Name of ISIS cube file */ - void MdisGeometry::setCube(const std::string &filename) { + void MdisGeometry::setCube(const QString &filename) { Cube cube; cube.open(filename); delete _camera; @@ -114,7 +114,7 @@ namespace Isis { PvlKeyword &target = label.FindKeyword("TargetName", PvlObject::Traverse); SpiceInt tcode; SpiceBoolean found; - (void) bodn2c_c(target[0].c_str(), &tcode, &found); + (void) bodn2c_c(target[0].toAscii().data(), &tcode, &found); if(found) return (true); if(makeValid) { @@ -250,7 +250,7 @@ namespace Isis { * * @return Pvl Contains PvlKeywords of all computed parameters */ - Pvl MdisGeometry::getGeometry(const std::string &filename) { + Pvl MdisGeometry::getGeometry(const QString &filename) { Pvl geom; // Set initial keywords @@ -554,8 +554,8 @@ namespace Isis { // Now compute the reticle points of all subframes if they exist for(int i = 1 ; i <= 5 ; i++) { - IString n(i); - string object = "SUBFRAME" + n + "_PARAMETERS/"; + QString n(i); + QString object = "SUBFRAME" + n + "_PARAMETERS/"; double sample, line, width, height; if(!getSubframeCoordinates(i, sample, line, width, height)) { @@ -663,7 +663,7 @@ namespace Isis { } else { // It does exist, extract coordinates from original image label - IString n(frameno); + QString n(toString(frameno)); sample = (double) _orglabel.FindKeyword("MESS:SUBF_X" + n, PvlObject::Traverse); line = (double) _orglabel.FindKeyword("MESS:SUBF_Y" + n, @@ -717,9 +717,9 @@ namespace Isis { // Get NAIF body codes SpiceInt scCode(-236), targCode(0); SpiceBoolean found; - string target(_camera->target()->name()); + QString target(_camera->target()->name()); (void) bodn2c_c("MESSENGER", &scCode, &found); - (void) bodn2c_c(target.c_str(), &targCode, &found); + (void) bodn2c_c(target.toAscii().data(), &targCode, &found); if(!found) { return (false); } @@ -1066,8 +1066,8 @@ namespace Isis { * * @return PvlKeyword Returns the formatted PVL keyword */ - PvlKeyword MdisGeometry::format(const std::string &name, const double &value, - const std::string &unit) const { + PvlKeyword MdisGeometry::format(const QString &name, const double &value, + const QString &unit) const { if(IsSpecial(value)) { return (PvlKeyword(name, _NullDefault)); } @@ -1094,9 +1094,9 @@ namespace Isis { * * @return PvlKeyword Returns the formatted PVL keyword */ - PvlKeyword MdisGeometry::format(const std::string &name, + PvlKeyword MdisGeometry::format(const QString &name, const std::vector &values, - const std::string &unit) const { + const QString &unit) const { PvlKeyword key(name); for(unsigned int i = 0 ; i < values.size() ; i++) { if(IsSpecial(values[i])) { @@ -1124,14 +1124,44 @@ namespace Isis { * * @return PvlKeyword Returns the formatted PVL keyword */ - PvlKeyword MdisGeometry::format(const std::string &name, + PvlKeyword MdisGeometry::format(const QString &name, const std::vector &values, - const std::string &unit) const { + const QString &unit) const { PvlKeyword key(name); for(unsigned int i = 0 ; i < values.size() ; i++) { if(values[i].empty()) { key.AddValue(_NullDefault); } + else { + key.AddValue(values[i].c_str(), unit); + } + } + return (key); + } + + /** + * @brief Create a PvlKeyword from a vector of string values + * + * This method formats a vector of string values according to specifications + * of the PDS and mission definitions. If any one of the passed string values + * is a an empty string, the special null string is subsitituted. + * + * @param name Name of the keyword to create + * @param values Vector of string values to format. Empty strings are + * substituted by the null string value. + * @param unit Optional unit for the value. Pass an empty string to exclude + * unit from format. + * + * @return PvlKeyword Returns the formatted PVL keyword + */ + PvlKeyword MdisGeometry::format(const QString &name, + const std::vector &values, + const QString &unit) const { + PvlKeyword key(name); + for(unsigned int i = 0 ; i < values.size() ; i++) { + if(values[i].isEmpty()) { + key.AddValue(_NullDefault); + } else { key.AddValue(values[i], unit); } @@ -1150,16 +1180,16 @@ namespace Isis { * * @return IString Returns the converted string */ - IString MdisGeometry::DoubleToString(const double &value) const { + QString MdisGeometry::DoubleToString(const double &value) const { if(IsSpecial(value)) { - return (IString(_NullDefault)); + return (QString(_NullDefault)); } // Format the string to specs ostringstream strcnv; strcnv.setf(std::ios::fixed); strcnv << setprecision(_digitsPrecision) << value; - return (IString(strcnv.str())); + return (QString(strcnv.str().c_str())); } } // namespace Isis diff --git a/isis/src/messenger/apps/mdisedrinfo/MdisGeometry.h b/isis/src/messenger/apps/mdisedrinfo/MdisGeometry.h index becfbe7c04..b7c0aa551a 100644 --- a/isis/src/messenger/apps/mdisedrinfo/MdisGeometry.h +++ b/isis/src/messenger/apps/mdisedrinfo/MdisGeometry.h @@ -1,4 +1,4 @@ -#if !defined(MdisGeometry_h) +#ifndef MdisGeometry_h #define MdisGeometry_h /** * @file @@ -79,20 +79,20 @@ namespace Isis { MdisGeometry() : _label(), _orglabel(), _nSubframes(0), _camera(0), _digitsPrecision(_defaultDigits), _NullDefault("\"N/A\""), _doUpdate(true), _spice() { } - MdisGeometry(const std::string &filename); + MdisGeometry(const QString &filename); MdisGeometry(Cube &cube); virtual ~MdisGeometry() { delete _camera; } - void setCube(const std::string &filename); + void setCube(const QString &filename); static bool validateTarget(Pvl &label, bool makeValid = true); virtual void refCenterCoord(double &sample, double &line) const; virtual void refUpperLeftCoord(double &sample, double &line) const; virtual void refUpperRightCoord(double &sample, double &line) const; virtual void refLowerLeftCoord(double &sample, double &line) const; virtual void refLowerRightCoord(double &sample, double &line) const; - Pvl getGeometry(const std::string &filename); + Pvl getGeometry(const QString &filename); /** @@ -116,16 +116,16 @@ namespace Isis { * * @param nullstring Value of the string to use */ - void setNull(const std::string &nullstring) { + void setNull(const QString &nullstring) { _NullDefault = nullstring; } /** * @brief Value in use for uncomputable values * - * @return std::string Uncomputed value string + * @return QString Uncomputed value string */ - std::string getNull() const { + QString getNull() const { return (_NullDefault); } @@ -161,7 +161,7 @@ namespace Isis { int _nSubframes; //!< Number subframes in image Camera *_camera; //!< Camera model initiated from cube label int _digitsPrecision; //!< Current digits of precision - std::string _NullDefault; //!< Current null string + QString _NullDefault; //!< Current null string bool _doUpdate; //!< Action when vlue is uncomputable SpiceManager _spice; //!< SPICE kernel manager @@ -177,14 +177,17 @@ namespace Isis { bool SmearComponents(double &smear_magnitude, double &smear_azimuth); std::vector ScVelocityVector(); - PvlKeyword format(const std::string &name, const double &value, - const std::string &unit = "") const; - PvlKeyword format(const std::string &name, const std::vector &values, - const std::string &unit = "") const; - PvlKeyword format(const std::string &name, + PvlKeyword format(const QString &name, const double &value, + const QString &unit = "") const; + PvlKeyword format(const QString &name, const std::vector &values, + const QString &unit = "") const; + PvlKeyword format(const QString &name, + const std::vector &values, + const QString &unit = "") const; + PvlKeyword format(const QString &name, const std::vector &values, - const std::string &unit = "") const; - IString DoubleToString(const double &value) const; + const QString &unit = "") const; + QString DoubleToString(const double &value) const; }; } // namespace Isis diff --git a/isis/src/messenger/apps/mdisedrinfo/SpiceManager.cpp b/isis/src/messenger/apps/mdisedrinfo/SpiceManager.cpp index ab2bad4e0d..04bc48f67f 100644 --- a/isis/src/messenger/apps/mdisedrinfo/SpiceManager.cpp +++ b/isis/src/messenger/apps/mdisedrinfo/SpiceManager.cpp @@ -45,7 +45,7 @@ namespace Isis { * @param filename Name of ISIS cube file * @param furnish Do we load the kernels we find? */ - SpiceManager::SpiceManager(const std::string &filename, bool furnish) { + SpiceManager::SpiceManager(const QString &filename, bool furnish) { Pvl pvl(filename); Load(pvl, furnish); } @@ -86,7 +86,7 @@ namespace Isis { Unload(); _furnish = furnish; - std::string kernlist; + QString kernlist; // Get the kernel group and load main kernels PvlGroup kernels = pvl.FindGroup("Kernels", Pvl::Traverse); // Changed 2008-02-27 to load planetary ephemeris before spacecraft @@ -136,9 +136,9 @@ namespace Isis { * * @param kernel Name of kernel file (or pattern) to add */ - void SpiceManager::add(const std::string &kernfile) { + void SpiceManager::add(const QString &kernfile) { - string kfile(kernfile); + QString kfile(kernfile); // Check for versioned file naming FileName efile(kfile); @@ -164,10 +164,10 @@ namespace Isis { * @param removePath Do we remove the file paths and return only the file * names? * - * @return std::vector A vector of filenames of SPICE kernels + * @return std::vector A vector of filenames of SPICE kernels */ - std::vector SpiceManager::getList(bool removePath) const { - std::vector flist; + std::vector SpiceManager::getList(bool removePath) const { + std::vector flist; for(unsigned int i = 0 ; i < _kernlist.size() ; i++) { if(removePath) { FileName kfile(_kernlist[i]); @@ -192,8 +192,8 @@ namespace Isis { * unload_c(kernName.c_str()); */ FileName f(_kernlist[i]); - string kernName(f.expanded()); - unload_c(kernName.c_str()); + QString kernName(f.expanded()); + unload_c(kernName.toAscii().data()); } } _kernlist.clear(); @@ -222,12 +222,12 @@ namespace Isis { if(IString(key[i]).UpCase() == "TABLE") continue; Isis::FileName file(key[i]); if(!file.fileExists()) { - string msg = "Spice file does not exist [" + file.expanded() + "]"; + QString msg = "Spice file does not exist [" + file.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } - string fileName(file.expanded()); - if(_furnish) furnsh_c(fileName.c_str()); - addKernelName((string)key[i]); + QString fileName(file.expanded()); + if(_furnish) furnsh_c(fileName.toAscii().data()); + addKernelName((QString)key[i]); } } @@ -243,16 +243,16 @@ namespace Isis { * @param pvl Pvl label to search for the SPICE Table Object Blob */ void SpiceManager::loadKernelFromTable(PvlKeyword &key, - const std::string &tblname, Pvl &pvl) { - if(IString::UpCase(key[0]) != "TABLE") { + const QString &tblname, Pvl &pvl) { + if(key[0].toUpper() != "TABLE") { loadKernel(key); } else { PvlObject::PvlObjectIterator objIter; for(objIter = pvl.BeginObject() ; objIter != pvl.EndObject() ; ++objIter) { - if(IString::UpCase(objIter->Name()) == "TABLE") { + if(objIter->Name().toUpper() == "TABLE") { if(objIter->HasKeyword("Name")) { - if(IString::Equal(objIter->FindKeyword("Name")[0], tblname)) { + if(objIter->FindKeyword("Name")[0].toUpper() == tblname.toUpper()) { loadKernel(objIter->FindKeyword("Kernels")); return; } @@ -271,7 +271,7 @@ namespace Isis { * * @param kname Name of SPICE kernel file to add */ - void SpiceManager::addKernelName(const std::string &kname) { + void SpiceManager::addKernelName(const QString &kname) { for(unsigned int i = 0 ; i < _kernlist.size() ; i++) { if(_kernlist[i] == kname) return; } diff --git a/isis/src/messenger/apps/mdisedrinfo/SpiceManager.h b/isis/src/messenger/apps/mdisedrinfo/SpiceManager.h index 97e066b89e..0ceae558ed 100644 --- a/isis/src/messenger/apps/mdisedrinfo/SpiceManager.h +++ b/isis/src/messenger/apps/mdisedrinfo/SpiceManager.h @@ -1,4 +1,4 @@ -#if !defined(SpiceManager_h) +#ifndef SpiceManager_h #define SpiceManager_h /** * @file @@ -58,7 +58,7 @@ namespace Isis { public: /** Default Constructor */ SpiceManager() : _kernlist(), _furnish(true) { } - SpiceManager(const std::string &filename, bool furnish = true); + SpiceManager(const QString &filename, bool furnish = true); SpiceManager(Cube &cube, bool furnish = true); SpiceManager(Pvl &pvl, bool furnish = true); /** Destructor always unloads the kernels from the pool */ @@ -72,19 +72,19 @@ namespace Isis { } void Load(Pvl &pvl, bool furnish = true); - void add(const std::string &kernel); - std::vector getList(bool removePath = false) const; + void add(const QString &kernel); + std::vector getList(bool removePath = false) const; void Unload(); private: - std::vector _kernlist; //!< The list of kernels + std::vector _kernlist; //!< The list of kernels bool _furnish; //!< Load the kernels found? void loadKernel(PvlKeyword &key); - void loadKernelFromTable(PvlKeyword &key, const std::string &tblname, + void loadKernelFromTable(PvlKeyword &key, const QString &tblname, Pvl &pvl); - void addKernelName(const std::string &kname); + void addKernelName(const QString &kname); }; diff --git a/isis/src/messenger/apps/mdisedrinfo/mdisedrinfo.cpp b/isis/src/messenger/apps/mdisedrinfo/mdisedrinfo.cpp index b6db9e95ac..c66b99b1c5 100644 --- a/isis/src/messenger/apps/mdisedrinfo/mdisedrinfo.cpp +++ b/isis/src/messenger/apps/mdisedrinfo/mdisedrinfo.cpp @@ -28,27 +28,27 @@ void IsisMain() { // Input parameters UserInterface &ui = Application::GetUserInterface(); - string sourceFile = ui.GetAsString("FROM"); // Save off source filename + QString sourceFile = ui.GetAsString("FROM"); // Save off source filename FileName from(sourceFile); - string to; + QString to; if(ui.WasEntered("TO")) to = ui.GetAsString("TO"); bool delete_from(false); // Is there a separate file containing keywords to report? - string keylist; + QString keylist; if(ui.WasEntered("KEYLIST")) keylist = ui.GetAsString("KEYLIST"); else keylist = to; // Get PVL parameter - string pvl; + QString pvl; if(ui.WasEntered("PVL")) pvl = ui.GetAsString("PVL"); // Run mdis2isis if necessary. If this step must be done, we must also // run spiceinit to initialize it with spice. - if(IString::UpCase(from.extension()) != "CUB") { + if(from.extension().toUpper() != "CUB") { FileName temp = FileName::createTempFile("$TEMPORARY/" + from.baseName() + ".cub"); - string params = "from=" + from.expanded() + " to=" + temp.expanded(); + QString params = "from=" + from.expanded() + " to=" + temp.expanded(); try { ProgramLauncher::RunIsisProgram("mdis2isis", params); @@ -64,8 +64,8 @@ void IsisMain() { ProgramLauncher::RunIsisProgram("spiceinit", "from=" + temp.expanded()); } catch(IException &ie) { - string tempName(temp.expanded()); - remove(tempName.c_str()); + QString tempName(temp.expanded()); + remove(tempName.toAscii().data()); throw IException(ie, IException::User, "Failed to execute mdis2isis/spiceinit", _FILEINFO_); } @@ -90,51 +90,50 @@ void IsisMain() { PvlGroup mdiskeys("MdisPdsKeys"); // Only process the PDS EDR keyword mapping if KEYMAP (or TO) is entered. - if(!keylist.empty()) { + if(!keylist.isEmpty()) { FileName kmap(keylist); if(!kmap.fileExists()) { - string mess = "EDR keyword map source file, " + kmap.expanded() - + ", does not exist!"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString mess = "EDR keyword map source file, " + kmap.expanded() + + ", does not exist!"; + throw IException(IException::User, mess, _FILEINFO_); } // Get the keylist source line - string kmapName(kmap.expanded()); - ifstream ifile(kmapName.c_str(), ios::in); + QString kmapName(kmap.expanded()); + ifstream ifile(kmapName.toAscii().data(), ios::in); if(!ifile) { - string mess = "Unable to open key map source file " + kmap.expanded(); + QString mess = "Unable to open key map source file " + kmap.expanded(); throw IException(IException::User, mess, _FILEINFO_); } string keystring; if(!getline(ifile, keystring)) { - string mess = "I/O error reading key map line from " + kmap.expanded(); + QString mess = "I/O error reading key map line from " + kmap.expanded(); throw IException(IException::User, mess, _FILEINFO_); } ifile.close(); // Split the line using semi-colons as the delimiter - vector keys; - IString::Split(';', keystring, keys); - std::string keyvalues = edrkeys.extract(keys, geom.getNull(), &mdiskeys); + QStringList keys = QString(keystring.c_str()).split(";"); + QString keyvalues = edrkeys.extract(keys, geom.getNull(), &mdiskeys); - if(!to.empty()) { + if(!to.isEmpty()) { // Now open the output file and write the result FileName tomap(to); - string tomapName(tomap.expanded()); + QString tomapName(tomap.expanded()); bool toExists = tomap.fileExists(); ofstream ofile; if(toExists) { - ofile.open(tomapName.c_str(), std::ios::out | std::ios::app); + ofile.open(tomapName.toAscii().data(), std::ios::out | std::ios::app); } else { - ofile.open(tomapName.c_str(), std::ios::out); + ofile.open(tomapName.toAscii().data(), std::ios::out); } if(!ofile) { - string mess = "Could not open or create output TO file " + - tomapName; + QString mess = "Could not open or create output TO file " + + tomapName; throw IException(IException::User, mess, _FILEINFO_); } @@ -152,7 +151,7 @@ void IsisMain() { } // See if the user wants to write out the PVL keywords - if(!pvl.empty()) { + if(!pvl.isEmpty()) { Pvl pout; pout.AddGroup(mdiskeys); pout.Write(pvl); @@ -162,13 +161,13 @@ void IsisMain() { Application::Log(mdiskeys); } catch(IException &) { - string fromName(from.expanded()); - if(delete_from) remove(fromName.c_str()); + QString fromName(from.expanded()); + if(delete_from) remove(fromName.toAscii().data()); throw; } // Delete the from file if it was temporarily created from an EDR - string fromName(from.expanded()); - if(delete_from) remove(fromName.c_str()); + QString fromName(from.expanded()); + if(delete_from) remove(fromName.toAscii().data()); } diff --git a/isis/src/messenger/apps/mdisproc/mdisproc.cpp b/isis/src/messenger/apps/mdisproc/mdisproc.cpp index 9ee7e02874..62e4ba0b73 100644 --- a/isis/src/messenger/apps/mdisproc/mdisproc.cpp +++ b/isis/src/messenger/apps/mdisproc/mdisproc.cpp @@ -26,7 +26,7 @@ void IsisMain() { //--------------------------------------------------------------------------- // Set up the ingestion run if requested if(ui.GetBoolean("INGESTION")) { - string app = "mdis2isis"; + QString app = "mdis2isis"; p.AddToPipeline(app); p.Application(app).SetInputParameter("FROM", false); p.Application(app).SetOutputParameter("TO", "raw"); @@ -35,7 +35,7 @@ void IsisMain() { //--------------------------------------------------------------------------- // Set up the calibration run if requested if(ui.GetBoolean("CALIBRATION")) { - string app = "mdiscal"; + QString app = "mdiscal"; p.AddToPipeline(app); p.Application(app).SetInputParameter("FROM", true); p.Application(app).SetOutputParameter("TO", "lev1"); @@ -58,7 +58,7 @@ void IsisMain() { //--------------------------------------------------------------------------- // Set up the calibrated run when asked if(ui.GetBoolean("CDR")) { - string app = "mdis2pds"; + QString app = "mdis2pds"; p.AddToPipeline(app); p.Application(app).SetInputParameter("FROM", true); p.Application(app).SetOutputParameter("TO", "cdr", "IMG"); diff --git a/isis/src/messenger/objs/MdisCamera/MdisCamera.cpp b/isis/src/messenger/objs/MdisCamera/MdisCamera.cpp index e9ce2e297e..aca03cf90b 100644 --- a/isis/src/messenger/objs/MdisCamera/MdisCamera.cpp +++ b/isis/src/messenger/objs/MdisCamera/MdisCamera.cpp @@ -101,17 +101,17 @@ namespace Isis { } // Set up instrument and filter code strings - IString ikCode((int) naifIkCode()); + QString ikCode = toString(naifIkCode()); int fnCode(naifIkCode() - filterNumber); - IString filterCode(fnCode); - string ikernKey; + QString filterCode = toString(fnCode); + QString ikernKey; // Fetch the frame translations from the instrument kernels ikernKey = "INS" + ikCode + "_REFERENCE_FRAME"; - IString baseFrame = getString(ikernKey); + QString baseFrame = getString(ikernKey); ikernKey = "INS" + filterCode + "_FRAME"; - IString ikFrame = getString(ikernKey); + QString ikFrame = getString(ikernKey); // Set up the camera info from ik/iak kernels @@ -131,7 +131,7 @@ namespace Isis { // !!NOTE: The ephemeris time MUST be set prior to creating the // cache (CreateCache) because the kernels are all unloaded // after the cache is done and this operation will fail!! - string stime = inst["SpacecraftClockCount"]; + QString stime = inst["SpacecraftClockCount"]; double exposureDuration = ((double) inst["ExposureDuration"]) / 1000.0;// divide by 1000 to convert to seconds iTime etStart = getClockTime(stime); @@ -280,11 +280,11 @@ namespace Isis { * * @return double Computed temperature dependant focal length */ - double MdisCamera::computeFocalLength(const std::string &filterCode, + double MdisCamera::computeFocalLength(const QString &filterCode, Pvl &label) { double focalLength(0.0); - IString tdflKey("TempDependentFocalLength"); + QString tdflKey("TempDependentFocalLength"); // Determine if the desired value is already computed. We are interested // in the temperature dependent value firstly. Backward compatibility is @@ -302,7 +302,7 @@ namespace Isis { // Check for disabling of temperature dependent focal length bool tdfl_disabled(false); -#if !defined(DISABLE_TDFL_DISABLING) +#ifndef DISABLE_TDFL_DISABLING try { IString tdfl_state = getString("DISABLE_MDIS_TD_FOCAL_LENGTH"); tdfl_disabled = ( "TRUE" == tdfl_state.UpCase() ); @@ -321,7 +321,7 @@ namespace Isis { PvlGroup &inst = label.FindGroup("Instrument", Pvl::Traverse); double fpTemp = inst["FocalPlaneTemperature"]; double fl(0.0); - IString fptCoeffs = "INS" + filterCode + "_FL_TEMP_COEFFS"; + QString fptCoeffs = "INS" + filterCode + "_FL_TEMP_COEFFS"; // Compute 5th order polynomial for (int i = 0 ; i < 6 ; i++) { fl += getDouble(fptCoeffs, i) * pow(fpTemp, (double) i); diff --git a/isis/src/messenger/objs/MdisCamera/MdisCamera.h b/isis/src/messenger/objs/MdisCamera/MdisCamera.h index 0b01f35259..2b3d20fa3c 100644 --- a/isis/src/messenger/objs/MdisCamera/MdisCamera.h +++ b/isis/src/messenger/objs/MdisCamera/MdisCamera.h @@ -134,7 +134,7 @@ namespace Isis { virtual int SpkReferenceId() const { return (1); } private: - double computeFocalLength(const std::string &filterCode, Pvl &label); + double computeFocalLength(const QString &filterCode, Pvl &label); }; }; #endif diff --git a/isis/src/messenger/objs/MdisCamera/TaylorCameraDistortionMap.cpp b/isis/src/messenger/objs/MdisCamera/TaylorCameraDistortionMap.cpp index 9c5ac862ec..001945d424 100644 --- a/isis/src/messenger/objs/MdisCamera/TaylorCameraDistortionMap.cpp +++ b/isis/src/messenger/objs/MdisCamera/TaylorCameraDistortionMap.cpp @@ -73,8 +73,8 @@ namespace Isis { * @param naifIkCode Code to search for in instrument kernel */ void TaylorCameraDistortionMap::SetDistortion(const int naifIkCode) { - string odtxkey = "INS" + IString(naifIkCode) + "_OD_T_X"; - string odtykey = "INS" + IString(naifIkCode) + "_OD_T_Y"; + QString odtxkey = "INS" + toString(naifIkCode) + "_OD_T_X"; + QString odtykey = "INS" + toString(naifIkCode) + "_OD_T_Y"; for(int i = 0; i < 10; ++i) { p_odtx.push_back(p_camera->getDouble(odtxkey, i)); p_odty.push_back(p_camera->getDouble(odtykey, i)); diff --git a/isis/src/messenger/objs/MdisCamera/unitTest.cpp b/isis/src/messenger/objs/MdisCamera/unitTest.cpp index b75e940716..27bf69e3fc 100644 --- a/isis/src/messenger/objs/MdisCamera/unitTest.cpp +++ b/isis/src/messenger/objs/MdisCamera/unitTest.cpp @@ -68,9 +68,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl; diff --git a/isis/src/mex/apps/hrsc2isis/hrsc2isis.cpp b/isis/src/mex/apps/hrsc2isis/hrsc2isis.cpp index 7cb4999527..07c2066084 100644 --- a/isis/src/mex/apps/hrsc2isis/hrsc2isis.cpp +++ b/isis/src/mex/apps/hrsc2isis/hrsc2isis.cpp @@ -146,7 +146,7 @@ void IsisMain() { else { //Checks if in file is rdr FileName inFile = ui.GetFileName("FROM"); - string msg = "[" + inFile.name() + "] appears to be an rdr file."; + QString msg = "[" + inFile.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -225,7 +225,7 @@ void WriteOutput(Isis::Buffer &buf) { void TranslateHrscLabels(Pvl &inLabels, Pvl &outLabel) { // Get the directory where the MRO HiRISE translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Mex"] + "/translations/"; + QString transDir = (QString) dataDir["Mex"] + "/translations/"; // Translate the Instrument group FileName transFile(transDir + "hrscInstrument.trn"); @@ -233,19 +233,19 @@ void TranslateHrscLabels(Pvl &inLabels, Pvl &outLabel) { instrumentXlater.Auto(outLabel); if(inLabels.HasKeyword("MACROPIXEL_SIZE")) { - outLabel.FindGroup("Instrument", Pvl::Traverse) += PvlKeyword("Summing", (int)inLabels["MACROPIXEL_SIZE"]); + outLabel.FindGroup("Instrument", Pvl::Traverse) += PvlKeyword("Summing", inLabels["MACROPIXEL_SIZE"][0]); } else { - outLabel.FindGroup("Instrument", Pvl::Traverse) += PvlKeyword("Summing", 1); + outLabel.FindGroup("Instrument", Pvl::Traverse) += PvlKeyword("Summing", "1"); } // Remove 'Z' from times - IString startTime = outLabel.FindGroup("Instrument", Pvl::Traverse)["StartTime"][0]; - startTime = startTime.substr(0, startTime.size() - 1); + QString startTime = outLabel.FindGroup("Instrument", Pvl::Traverse)["StartTime"][0]; + startTime = startTime.mid(0, startTime.size() - 1); outLabel.FindGroup("Instrument", Pvl::Traverse)["StartTime"] = startTime; - IString stopTime = outLabel.FindGroup("Instrument", Pvl::Traverse)["StopTime"][0]; - stopTime = stopTime.substr(0, stopTime.size() - 1); + QString stopTime = outLabel.FindGroup("Instrument", Pvl::Traverse)["StopTime"][0]; + stopTime = stopTime.mid(0, stopTime.size() - 1); outLabel.FindGroup("Instrument", Pvl::Traverse)["StopTime"] = stopTime; // Translate the BandBin group @@ -258,30 +258,30 @@ void TranslateHrscLabels(Pvl &inLabels, Pvl &outLabel) { PvlTranslationManager archiveXlater(inLabels, transFile.expanded()); archiveXlater.Auto(outLabel); - std::map naifIkCodes; - naifIkCodes.insert(std::pair("MEX_HRSC_HEAD", -41210)); - naifIkCodes.insert(std::pair("MEX_HRSC_S2", -41211)); - naifIkCodes.insert(std::pair("MEX_HRSC_RED", -41212)); - naifIkCodes.insert(std::pair("MEX_HRSC_P2", -41213)); - naifIkCodes.insert(std::pair("MEX_HRSC_BLUE", -41214)); - naifIkCodes.insert(std::pair("MEX_HRSC_NADIR", -41215)); - naifIkCodes.insert(std::pair("MEX_HRSC_GREEN", -41216)); - naifIkCodes.insert(std::pair("MEX_HRSC_P1", -41217)); - naifIkCodes.insert(std::pair("MEX_HRSC_IR", -41218)); - naifIkCodes.insert(std::pair("MEX_HRSC_S1", -41219)); - naifIkCodes.insert(std::pair("MEX_HRSC_SRC", -41220)); - - std::string key = outLabel.FindGroup("Archive", Pvl::Traverse)["DetectorId"]; + std::map naifIkCodes; + naifIkCodes.insert(std::pair("MEX_HRSC_HEAD", -41210)); + naifIkCodes.insert(std::pair("MEX_HRSC_S2", -41211)); + naifIkCodes.insert(std::pair("MEX_HRSC_RED", -41212)); + naifIkCodes.insert(std::pair("MEX_HRSC_P2", -41213)); + naifIkCodes.insert(std::pair("MEX_HRSC_BLUE", -41214)); + naifIkCodes.insert(std::pair("MEX_HRSC_NADIR", -41215)); + naifIkCodes.insert(std::pair("MEX_HRSC_GREEN", -41216)); + naifIkCodes.insert(std::pair("MEX_HRSC_P1", -41217)); + naifIkCodes.insert(std::pair("MEX_HRSC_IR", -41218)); + naifIkCodes.insert(std::pair("MEX_HRSC_S1", -41219)); + naifIkCodes.insert(std::pair("MEX_HRSC_SRC", -41220)); + + QString key = outLabel.FindGroup("Archive", Pvl::Traverse)["DetectorId"]; int ikCode = naifIkCodes[key]; if(ikCode < -41220 || ikCode > -41210) { - std::string msg = "Unrecognized Detector ID ["; + QString msg = "Unrecognized Detector ID ["; msg += key; msg += "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } PvlGroup kerns("Kernels"); - kerns += PvlKeyword("NaifIkCode", ikCode); + kerns += PvlKeyword("NaifIkCode", toString(ikCode)); outLabel.AddGroup(kerns); } diff --git a/isis/src/mex/objs/HrscCamera/HrscCamera.cpp b/isis/src/mex/objs/HrscCamera/HrscCamera.cpp index 380c84ba72..b1f8b907fd 100644 --- a/isis/src/mex/objs/HrscCamera/HrscCamera.cpp +++ b/isis/src/mex/objs/HrscCamera/HrscCamera.cpp @@ -64,10 +64,10 @@ namespace Isis { new CameraFocalPlaneMap(this, naifIkCode()); - string ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_SAMPLE"; + QString ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"; double sampleBoresight = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_LINE"; + ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE"; double lineBoresight = getDouble(ikernKey); FocalPlaneMap()->SetDetectorOrigin(sampleBoresight, lineBoresight); @@ -92,11 +92,11 @@ namespace Isis { /** * @param filename */ - void HrscCamera::ReadLineRates(IString filename) { + void HrscCamera::ReadLineRates(QString filename) { Table timesTable("LineScanTimes", filename); if(timesTable.Records() <= 0) { - string msg = "Table [LineScanTimes] in ["; + QString msg = "Table [LineScanTimes] in ["; msg += filename + "] must not be empty"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -108,7 +108,7 @@ namespace Isis { } if(p_lineRates.size() <= 0) { - string msg = "There is a problem with the data within the Table "; + QString msg = "There is a problem with the data within the Table "; msg += "[LineScanTimes] in [" + filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/mex/objs/HrscCamera/HrscCamera.h b/isis/src/mex/objs/HrscCamera/HrscCamera.h index e843cc8f06..bd2a8fce2a 100644 --- a/isis/src/mex/objs/HrscCamera/HrscCamera.h +++ b/isis/src/mex/objs/HrscCamera/HrscCamera.h @@ -85,7 +85,7 @@ namespace Isis { virtual int SpkReferenceId() const { return (1); } private: - void ReadLineRates(IString filename); + void ReadLineRates(QString filename); std::vector p_lineRates; }; diff --git a/isis/src/mgs/apps/moc2isis/moc2isis.cpp b/isis/src/mgs/apps/moc2isis/moc2isis.cpp index 0776368239..c9a5aef4cd 100644 --- a/isis/src/mgs/apps/moc2isis/moc2isis.cpp +++ b/isis/src/mgs/apps/moc2isis/moc2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "ProcessImportPds.h" @@ -24,34 +24,32 @@ void IsisMain() { // Get the input filename and make sure it is a MOC EDR FileName in = ui.GetFileName("FROM"); - IString id; + QString id; bool compressed = false; bool projected; try { Pvl lab(in.expanded()); - id = (string) lab["DATA_SET_ID"]; + id = (QString) lab["DATA_SET_ID"]; if(lab.FindObject("IMAGE").HasKeyword("ENCODING_TYPE")) compressed = true; projected = lab.HasObject("IMAGE_MAP_PROJECTION"); } catch(IException &e) { - string msg = "Unable to read [DATA_SET_ID] from input file [" + + QString msg = "Unable to read [DATA_SET_ID] from input file [" + in.expanded() + "]"; throw IException(e, IException::Io, msg, _FILEINFO_); } //Checks if in file is rdr if(projected) { - string msg = "[" + in.name() + "] appears to be an rdr file."; + QString msg = "[" + in.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } - id.ConvertWhiteSpace(); - id.Compress(); - id.Trim(" "); + id = id.simplified().trimmed(); if((id != "MGS-M-MOC-NA/WA-2-DSDP-L0-V1.0") && (id != "MGS-M-MOC-NA/WA-2-SDP-L0-V1.0")) { - string msg = "Input file [" + in.expanded() + "] does not appear to be " + + QString msg = "Input file [" + in.expanded() + "] does not appear to be " + "in MOC EDR format. DATA_SET_ID [" + id + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -66,10 +64,10 @@ void IsisMain() { // Get a temporary file for the uncompressed version incase we need it uncompressed = FileName::createTempFile("$TEMPORARY/" + in.baseName() + ".img"); - IString command = "mocuncompress " + in.expanded() + " " + + QString command = "mocuncompress " + in.expanded() + " " + uncompressed.expanded(); - if(system(command.c_str()) == 1) { - string msg = "Unable to execute [mocuncompress]"; + if(system(command.toAscii().data()) == 1) { + QString msg = "Unable to execute [mocuncompress]"; throw IException(IException::Programmer, msg, _FILEINFO_); } p.SetPdsFile(uncompressed.expanded(), "", pdsLabel); @@ -85,8 +83,8 @@ void IsisMain() { p.EndProcess(); if(compressed) { - string uncompressedName(uncompressed.expanded()); - remove(uncompressedName.c_str()); + QString uncompressedName(uncompressed.expanded()); + remove(uncompressedName.toAscii().data()); } return; @@ -94,13 +92,13 @@ void IsisMain() { void TranslateMocEdrLabels(FileName &labelFile, Cube *ocube) { - string startTime, productId, clockCount; + QString startTime, productId, clockCount; // Get the directory where the MOC translation tables are. PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); // Transfer the instrument group to the output cube - IString transDir = (string) dataDir["Mgs"]; + QString transDir = (QString) dataDir["Mgs"]; FileName transFile(transDir + "/" + "translations/mocInstrument.trn"); // Get the translation manager ready @@ -110,89 +108,89 @@ void TranslateMocEdrLabels(FileName &labelFile, Cube *ocube) { PvlGroup inst("Instrument"); if(instrumentXlater.InputHasKeyword("SpacecraftName")) { - string str = instrumentXlater.Translate("SpacecraftName"); + QString str = instrumentXlater.Translate("SpacecraftName"); inst += PvlKeyword("SpacecraftName", str); } if(instrumentXlater.InputHasKeyword("InstrumentId")) { - string str = instrumentXlater.Translate("InstrumentId"); + QString str = instrumentXlater.Translate("InstrumentId"); inst += PvlKeyword("InstrumentId", str); } if(instrumentXlater.InputHasKeyword("TargetName")) { - string str = instrumentXlater.Translate("TargetName"); + QString str = instrumentXlater.Translate("TargetName"); inst += PvlKeyword("TargetName", str); } if(instrumentXlater.InputHasKeyword("StartTime")) { - string str = instrumentXlater.Translate("StartTime"); + QString str = instrumentXlater.Translate("StartTime"); inst += PvlKeyword("StartTime", str); // isisLab.AddKeyword ("StartTime", str+"Z"); startTime = str; } if(instrumentXlater.InputHasKeyword("StopTime")) { - string str = instrumentXlater.Translate("StopTime"); + QString str = instrumentXlater.Translate("StopTime"); inst += PvlKeyword("StopTime", str); // isisLab.AddKeyword ("StopTime", str+"Z"); } if(instrumentXlater.InputHasKeyword("CrosstrackSumming")) { - string str = instrumentXlater.Translate("CrosstrackSumming"); + QString str = instrumentXlater.Translate("CrosstrackSumming"); inst += PvlKeyword("CrosstrackSumming", str); } if(instrumentXlater.InputHasKeyword("DowntrackSumming")) { - string str = instrumentXlater.Translate("DowntrackSumming"); + QString str = instrumentXlater.Translate("DowntrackSumming"); inst += PvlKeyword("DowntrackSumming", str); } if(instrumentXlater.InputHasKeyword("FocalPlaneTemperature")) { - string str = instrumentXlater.Translate("FocalPlaneTemperature"); + QString str = instrumentXlater.Translate("FocalPlaneTemperature"); inst += PvlKeyword("FocalPlaneTemperature", str); } if(instrumentXlater.InputHasKeyword("GainModeId")) { - string str = instrumentXlater.Translate("GainModeId"); + QString str = instrumentXlater.Translate("GainModeId"); inst += PvlKeyword("GainModeId", str); } if(instrumentXlater.InputHasKeyword("LineExposureDuration")) { - string str = instrumentXlater.Translate("LineExposureDuration"); + QString str = instrumentXlater.Translate("LineExposureDuration"); inst += PvlKeyword("LineExposureDuration", str, "milliseconds"); } if(instrumentXlater.InputHasKeyword("MissionPhaseName")) { - string str = instrumentXlater.Translate("MissionPhaseName"); + QString str = instrumentXlater.Translate("MissionPhaseName"); inst += PvlKeyword("MissionPhaseName", str); } if(instrumentXlater.InputHasKeyword("OffsetModeId")) { - string str = instrumentXlater.Translate("OffsetModeId"); + QString str = instrumentXlater.Translate("OffsetModeId"); inst += PvlKeyword("OffsetModeId", str); } if(instrumentXlater.InputHasKeyword("SpacecraftClockCount")) { - string str = instrumentXlater.Translate("SpacecraftClockCount"); + QString str = instrumentXlater.Translate("SpacecraftClockCount"); inst += PvlKeyword("SpacecraftClockCount", str); clockCount = str; } if(instrumentXlater.InputHasKeyword("RationaleDesc")) { - string str = instrumentXlater.Translate("RationaleDesc"); + QString str = instrumentXlater.Translate("RationaleDesc"); inst += PvlKeyword("RationaleDesc", str); } if(instrumentXlater.InputHasKeyword("OrbitNumber")) { - string str = instrumentXlater.Translate("OrbitNumber"); + QString str = instrumentXlater.Translate("OrbitNumber"); inst += PvlKeyword("OrbitNumber", str); } if(instrumentXlater.InputHasKeyword("FirstLineSample")) { - IString str = instrumentXlater.Translate("FirstLineSample"); - int num = str.ToInteger(); + QString str = instrumentXlater.Translate("FirstLineSample"); + int num = toInt(str); num++; - inst += PvlKeyword("FirstLineSample", num); + inst += PvlKeyword("FirstLineSample", toString(num)); } // Add the instrument specific info to the output file @@ -200,7 +198,7 @@ void TranslateMocEdrLabels(FileName &labelFile, Cube *ocube) { // Transfer the archive group to the output cube - transDir = (string) dataDir["Mgs"]; + transDir = (QString) dataDir["Mgs"]; FileName transFileArchive(transDir + "/" + "translations/mocArchive.trn"); // Get the translation manager ready for the archive group @@ -209,38 +207,38 @@ void TranslateMocEdrLabels(FileName &labelFile, Cube *ocube) { PvlGroup arch("Archive"); if(archiveXlater.InputHasKeyword("DataSetId")) { - string str = archiveXlater.Translate("DataSetId"); + QString str = archiveXlater.Translate("DataSetId"); arch += PvlKeyword("DataSetId", str); } if(archiveXlater.InputHasKeyword("ProductId")) { - string str = archiveXlater.Translate("ProductId"); + QString str = archiveXlater.Translate("ProductId"); arch += PvlKeyword("ProductId", str); productId = str; } if(archiveXlater.InputHasKeyword("ProducerId")) { - string str = archiveXlater.Translate("ProducerId"); + QString str = archiveXlater.Translate("ProducerId"); arch += PvlKeyword("ProducerId", str); } if(archiveXlater.InputHasKeyword("ProductCreationTime")) { - string str = archiveXlater.Translate("ProductCreationTime"); + QString str = archiveXlater.Translate("ProductCreationTime"); arch += PvlKeyword("ProductCreationTime", str); } if(archiveXlater.InputHasKeyword("SoftwareName")) { - string str = archiveXlater.Translate("SoftwareName"); + QString str = archiveXlater.Translate("SoftwareName"); arch += PvlKeyword("SoftwareName", str); } if(archiveXlater.InputHasKeyword("UploadId")) { - string str = archiveXlater.Translate("UploadId"); + QString str = archiveXlater.Translate("UploadId"); arch += PvlKeyword("UploadId", str); } if(archiveXlater.InputHasKeyword("DataQualityDesc")) { - string str = archiveXlater.Translate("DataQualityDesc"); + QString str = archiveXlater.Translate("DataQualityDesc"); arch += PvlKeyword("DataQualityDesc", str); } @@ -254,11 +252,11 @@ void TranslateMocEdrLabels(FileName &labelFile, Cube *ocube) { // Last five digits of the ProductId if(startTime.length() > 0 && productId.length() > 0) { iTime tim(startTime); - string imageNumber = tim.YearString(); - imageNumber = imageNumber.substr(3, 1); + QString imageNumber = tim.YearString(); + imageNumber = imageNumber.mid(3, 1); imageNumber += tim.DayOfYearString(); - imageNumber += productId.substr(4); + imageNumber += productId.mid(4); arch += PvlKeyword("ImageNumber", imageNumber); } @@ -268,8 +266,8 @@ void TranslateMocEdrLabels(FileName &labelFile, Cube *ocube) { // First five digits of the SpacecraftClockCount followed by the // Last five dights of the ProductId if(clockCount.length() > 0 && productId.length() > 0) { - arch += PvlKeyword("ImageKeyId", clockCount.substr(0, 5) + - productId.substr(4)); + arch += PvlKeyword("ImageKeyId", clockCount.mid(0, 5) + + productId.mid(4)); } // Add the archive info to the output file @@ -277,7 +275,7 @@ void TranslateMocEdrLabels(FileName &labelFile, Cube *ocube) { // Create the BandBin Group and populate it - transDir = (string) dataDir["Mgs"]; + transDir = (QString) dataDir["Mgs"]; FileName transFileBandBin(transDir + "/" + "translations/mocBandBin.trn"); // Get the translation manager ready for the BandBin group @@ -288,35 +286,34 @@ void TranslateMocEdrLabels(FileName &labelFile, Cube *ocube) { PvlGroup bandBin("BandBin"); - string frameCode; + QString frameCode; if(bandBinXlater.InputHasKeyword("FilterName")) { - IString str = bandBinXlater.Translate("FilterName"); - str.UpCase(); + QString str = bandBinXlater.Translate("FilterName").toUpper(); if(str == "BLUE") { bandBin += PvlKeyword("FilterName", str); - bandBin += PvlKeyword("OriginalBand", 1); - bandBin += PvlKeyword("Center", 0.4346, "micrometers"); - bandBin += PvlKeyword("Width", 0.050, "micrometers"); + bandBin += PvlKeyword("OriginalBand", toString(1)); + bandBin += PvlKeyword("Center", toString(0.4346), "micrometers"); + bandBin += PvlKeyword("Width", toString(0.050), "micrometers"); frameCode = "-94033"; } else if(str == "RED") { bandBin += PvlKeyword("FilterName", str); - bandBin += PvlKeyword("OriginalBand", 1); - bandBin += PvlKeyword("Center", 0.6134, "micrometers"); - bandBin += PvlKeyword("Width", 0.050, "micrometers"); + bandBin += PvlKeyword("OriginalBand", toString(1)); + bandBin += PvlKeyword("Center", toString(0.6134), "micrometers"); + bandBin += PvlKeyword("Width", toString(0.050), "micrometers"); frameCode = "-94032"; } else { - string msg = "Invalid value for filter name [" + str + "]"; + QString msg = "Invalid value for filter name [" + str + "]"; } } else { bandBin += PvlKeyword("FilterName", "BROAD_BAND"); - bandBin += PvlKeyword("OriginalBand", 1); - bandBin += PvlKeyword("Center", 0.700, "micrometers"); - bandBin += PvlKeyword("Width", 0.400, "micrometers"); + bandBin += PvlKeyword("OriginalBand", toString(1)); + bandBin += PvlKeyword("Center", toString(0.700), "micrometers"); + bandBin += PvlKeyword("Width", toString(0.400), "micrometers"); frameCode = "-94031"; } diff --git a/isis/src/mgs/apps/moccal/moccal.cpp b/isis/src/mgs/apps/moccal/moccal.cpp index e9d61d9e50..5278646a2a 100644 --- a/isis/src/mgs/apps/moccal/moccal.cpp +++ b/isis/src/mgs/apps/moccal/moccal.cpp @@ -31,8 +31,8 @@ using namespace Isis; // Working functions and parameters namespace gbl { void Calibrate(Buffer &in, Buffer &out); - void LoadCoefficients(const string &file, int ns); - void FixWagoLines(string file); + void LoadCoefficients(const QString &file, int ns); + void FixWagoLines(QString file); double a; // Commanded system gain double off; // Commanded system offset @@ -66,7 +66,7 @@ void IsisMain() { // If it is already calibrated then complain if(icube->hasGroup("Radiometry")) { - string msg = "The MOC image [" + icube->getFileName() + "] has already " + QString msg = "The MOC image [" + icube->getFileName() + "] has already " "been radiometrically calibrated"; throw IException(IException::User, msg, _FILEINFO_); } @@ -86,7 +86,7 @@ void IsisMain() { // Open the calibration kernel that contains constants for each camera // and internalize it in a pvl object - string calKernelFile; + QString calKernelFile; if(ui.WasEntered("CALKERNEL")) { calKernelFile = ui.GetFileName("CALKERNEL"); } @@ -96,7 +96,7 @@ void IsisMain() { Pvl calKernel(calKernelFile); // Point to the right group of camera parameters - string camera; + QString camera; if(gbl::moc->WideAngleRed()) { camera = "WideAngleRed"; } @@ -117,7 +117,7 @@ void IsisMain() { gbl::dc = calCamera["DC"]; gbl::g = calCamera["G"]; gbl::w0 = calCamera["W0"]; - string coefFile = calCamera["CoefFile"]; + QString coefFile = calCamera["CoefFile"]; gbl::LoadCoefficients(coefFile, icube->getSampleCount()); #if 0 @@ -131,17 +131,17 @@ void IsisMain() { // Get the distance between Mars and the Sun at the given time in // Astronomical Units (AU) - string bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true); - furnsh_c(bspKernel.c_str()); - string pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); - furnsh_c(pckKernel.c_str()); + QString bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true); + furnsh_c(bspKernel.toAscii().data()); + QString pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); + furnsh_c(pckKernel.toAscii().data()); double sunpos[6], lt; spkezr_c("sun", etStart, "iau_mars", "LT+S", "mars", sunpos, <); double dist = vnorm_c(sunpos); double kmPerAU = 1.4959787066E8; double sunAU = dist / kmPerAU; - unload_c(bspKernel.c_str()); - unload_c(pckKernel.c_str()); + unload_c(bspKernel.toAscii().data()); + unload_c(pckKernel.toAscii().data()); // See if the user wants counts/ms or i/f but if w0 is 0 then // we must go to counts/ms @@ -162,19 +162,19 @@ void IsisMain() { calgrp += PvlKeyword("CalibrationKernel", calKernelFile); calgrp += PvlKeyword("CoefficientFile", coefFile); - calgrp += PvlKeyword("a", gbl::a); + calgrp += PvlKeyword("a", toString(gbl::a)); calgrp["a"].AddComment("Radiometric equation in moccal"); calgrp["a"].AddComment("r = (pixel - z + off) / a - g / ex - dc"); - calgrp += PvlKeyword("off", gbl::off); - calgrp += PvlKeyword("ex", gbl::ex); - calgrp += PvlKeyword("z", gbl::z); - calgrp += PvlKeyword("dc", gbl::dc); - calgrp += PvlKeyword("g", gbl::g); + calgrp += PvlKeyword("off", toString(gbl::off)); + calgrp += PvlKeyword("ex", toString(gbl::ex)); + calgrp += PvlKeyword("z", toString(gbl::z)); + calgrp += PvlKeyword("dc", toString(gbl::dc)); + calgrp += PvlKeyword("g", toString(gbl::g)); - calgrp += PvlKeyword("w0", gbl::w0); + calgrp += PvlKeyword("w0", toString(gbl::w0)); calgrp["w0"].AddComment("Reflectance = r * iof, where iof = (s * s) / w0"); - calgrp += PvlKeyword("s", sunAU); - calgrp += PvlKeyword("iof", gbl::iof); + calgrp += PvlKeyword("s", toString(sunAU)); + calgrp += PvlKeyword("iof", toString(gbl::iof)); ocube->putGroup(calgrp); @@ -241,7 +241,7 @@ void gbl::Calibrate(Buffer &in, Buffer &out) { } -void gbl::LoadCoefficients(const string &file, int ns) { +void gbl::LoadCoefficients(const QString &file, int ns) { // First create space for our coefficients gbl::pixelGain.resize(ns); gbl::pixelOffset.resize(ns); @@ -259,24 +259,26 @@ void gbl::LoadCoefficients(const string &file, int ns) { vector gainCoef; vector offsetCoef; TextFile coef(file); - IString record, tok; + QString record, tok; coef.GetLine(record, true); - int numCoefs = record.ToInteger(); + int numCoefs = toInt(record); for(int i = 0; i < numCoefs; i++) { coef.GetLine(record, true); - record.Trim(" "); - tok = record.Token(" "); - gainCoef.push_back(tok.ToDouble()); - record.Trim(" "); - tok = record.Token(" "); - offsetCoef.push_back(tok.ToDouble()); + record = record.simplified().trimmed(); + + QStringList records = record.split(" "); + + if (records.count() > 1) { + gainCoef.push_back(toDouble(records.takeFirst())); + offsetCoef.push_back(toDouble(records.takeFirst())); + } } // Make sure the file had the correct number of coefficients. It should // match the number of detectors in the NA or WA camera if((int)gainCoef.size() != gbl::moc->Detectors()) { - string msg = "Coefficient file [" + file + "] size is wrong ... should have ["; - msg += IString(gbl::moc->Detectors()) + "] gain/offset entries"; + QString msg = "Coefficient file [" + file + "] size is wrong ... should have ["; + msg += toString(gbl::moc->Detectors()) + "] gain/offset entries"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -290,7 +292,7 @@ void gbl::LoadCoefficients(const string &file, int ns) { double osum = 0.0; for(n = 0; ss <= es; ss++, n++) { if(ss >= (int)gainCoef.size()) { - string msg = "Array bounds exceeded for gainCoef/offsetCoef"; + QString msg = "Array bounds exceeded for gainCoef/offsetCoef"; throw IException(IException::Programmer, msg, _FILEINFO_); } gsum += gainCoef[ss]; @@ -301,7 +303,7 @@ void gbl::LoadCoefficients(const string &file, int ns) { } } -void gbl::FixWagoLines(string file) { +void gbl::FixWagoLines(QString file) { // Nothing to do for narrow angle if(gbl::moc->NarrowAngle()) return; diff --git a/isis/src/mgs/apps/mocnoise50/mocnoise50.cpp b/isis/src/mgs/apps/mocnoise50/mocnoise50.cpp index 63e8ef44e4..a490426778 100644 --- a/isis/src/mgs/apps/mocnoise50/mocnoise50.cpp +++ b/isis/src/mgs/apps/mocnoise50/mocnoise50.cpp @@ -53,14 +53,14 @@ void IsisMain() { // Must be narrow angle if(moc.WideAngle()) { - string msg = "The 50 sample noise pattern does not occur in "; + QString msg = "The 50 sample noise pattern does not occur in "; msg += "MOC wide angle images"; throw IException(IException::User, msg, _FILEINFO_); } // Must have crosstrack summing of 1 if(moc.CrosstrackSumming() != 1) { - string msg = "The 50 sample noise pattern does not occur in "; + QString msg = "The 50 sample noise pattern does not occur in "; msg += "MOC narrow angle images with crosstrack summing greater than one"; throw IException(IException::User, msg, _FILEINFO_); } @@ -152,11 +152,11 @@ void IsisMain() { p.SetOutputCube("TO"); PvlGroup results("Results"); - results += PvlKeyword("DeltaSample", gbl::delta); - results += PvlKeyword("StartingSample", gbl::ssFirst); - results += PvlKeyword("Coefficient1", gbl::avg1); - results += PvlKeyword("Coefficient2", gbl::avg2); - results += PvlKeyword("Coefficient3", gbl::avg3); + results += PvlKeyword("DeltaSample", toString(gbl::delta)); + results += PvlKeyword("StartingSample", toString(gbl::ssFirst)); + results += PvlKeyword("Coefficient1", toString(gbl::avg1)); + results += PvlKeyword("Coefficient2", toString(gbl::avg2)); + results += PvlKeyword("Coefficient3", toString(gbl::avg3)); // If less than 50% of the lines do not agree on a delta then // we will assume no noise so just make a copy @@ -164,7 +164,7 @@ void IsisMain() { p.Progress()->SetText("Copying cube"); p.StartProcess(gbl::Copy); results += PvlKeyword("NoiseRemoved", "No"); - string reason = "Less than 50% of the lines agreed on a delta sample"; + QString reason = "Less than 50% of the lines agreed on a delta sample"; results += PvlKeyword("Reason", reason); } @@ -174,7 +174,7 @@ void IsisMain() { p.Progress()->SetText("Copying cube"); p.StartProcess(gbl::Copy); results += PvlKeyword("NoiseRemoved", "No"); - string reason = "Less than 50% of the lines agreed on a starting sample"; + QString reason = "Less than 50% of the lines agreed on a starting sample"; results += PvlKeyword("Reason", reason); } diff --git a/isis/src/mgs/apps/mocproc/mocproc.cpp b/isis/src/mgs/apps/mocproc/mocproc.cpp index 4f92b19407..c726f4880f 100644 --- a/isis/src/mgs/apps/mocproc/mocproc.cpp +++ b/isis/src/mgs/apps/mocproc/mocproc.cpp @@ -1,6 +1,6 @@ #include "Isis.h" -#include +#include #include "ProcessImport.h" @@ -18,7 +18,7 @@ void IsisMain() { if(!ui.GetBoolean("INGESTION") && !ui.GetBoolean("CALIBRATION") && !ui.GetBoolean("MAPPING")) { - string m = "Please pick at least one of [INGESTION, CALIBRATION, MAPPING]"; + QString m = "Please pick at least one of [INGESTION, CALIBRATION, MAPPING]"; throw IException(IException::User, m, _FILEINFO_); } @@ -64,12 +64,12 @@ void IsisMain() { if(inputPvl.HasKeyword("CROSSTRACK_SUMMING")) { summingMode = inputPvl["CROSSTRACK_SUMMING"]; - isNarrowAngle = ((string)inputPvl["INSTRUMENT_ID"] == "MOC-NA"); + isNarrowAngle = ((QString)inputPvl["INSTRUMENT_ID"] == "MOC-NA"); } else { PvlGroup &inst = inputPvl.FindGroup("Instrument", Pvl::Traverse); summingMode = inst["CrosstrackSumming"]; - isNarrowAngle = ((string)inst["InstrumentId"] == "MOC-NA"); + isNarrowAngle = ((QString)inst["InstrumentId"] == "MOC-NA"); } if(summingMode != 1) { diff --git a/isis/src/mgs/apps/mocuncompress/CheckSum.h b/isis/src/mgs/apps/mocuncompress/CheckSum.h index 4d7161e6a1..8f2b194082 100644 --- a/isis/src/mgs/apps/mocuncompress/CheckSum.h +++ b/isis/src/mgs/apps/mocuncompress/CheckSum.h @@ -39,7 +39,7 @@ Copyright (C) 1999 Malin Space Science Systems. All Rights Reserved. SCCSID @(#)CheckSum.h 1.1 10/04/99 */ /* SCCShid @(#)CheckSum.h (CheckSum.h) 1.5 */ -#if !defined(CheckSum_h) +#ifndef CheckSum_h #define CheckSum_h extern uint8 CS8EAC(); extern void CS8EACA1(); diff --git a/isis/src/mgs/apps/mocuncompress/bitsOut.h b/isis/src/mgs/apps/mocuncompress/bitsOut.h index d5724cd680..b169ffab33 100644 --- a/isis/src/mgs/apps/mocuncompress/bitsOut.h +++ b/isis/src/mgs/apps/mocuncompress/bitsOut.h @@ -40,7 +40,7 @@ SCCSID @(#)bitsOut.h 1.1 10/04/99 */ /* SCCShid @(#)bitsOut.h (bitsOut.h) 1.4 */ -#if !defined(bitsOut_h) +#ifndef bitsOut_h #define bitsOut_h diff --git a/isis/src/mgs/apps/mocuncompress/decompNONE.h b/isis/src/mgs/apps/mocuncompress/decompNONE.h index b43c7ff66f..58cfbdf95e 100644 --- a/isis/src/mgs/apps/mocuncompress/decompNONE.h +++ b/isis/src/mgs/apps/mocuncompress/decompNONE.h @@ -40,7 +40,7 @@ SCCSID @(#)decompNONE.h 1.1 10/04/99 */ /* SCCShid @(#)decompNONE.h (decompNONE.h) 1.2 */ -#if !defined(decompNONE_h) +#ifndef decompNONE_h #define decompNONE_h diff --git a/isis/src/mgs/apps/mocuncompress/decompSYNC.h b/isis/src/mgs/apps/mocuncompress/decompSYNC.h index bc74d08580..a815213634 100644 --- a/isis/src/mgs/apps/mocuncompress/decompSYNC.h +++ b/isis/src/mgs/apps/mocuncompress/decompSYNC.h @@ -40,7 +40,7 @@ SCCSID @(#)decompSYNC.h 1.1 10/04/99 */ /* SCCShid @(#)decompSYNC.h (decompSYNC.h) 1.2 */ -#if !defined(decompSYNC_h) +#ifndef decompSYNC_h #define decompSYNC_h diff --git a/isis/src/mgs/apps/mocuncompress/decompXPRED.h b/isis/src/mgs/apps/mocuncompress/decompXPRED.h index 135deb1b57..6ff3334d2d 100644 --- a/isis/src/mgs/apps/mocuncompress/decompXPRED.h +++ b/isis/src/mgs/apps/mocuncompress/decompXPRED.h @@ -40,7 +40,7 @@ SCCSID @(#)decompXPRED.h 1.1 10/04/99 */ /* SCCShid @(#)decompXPRED.h (decompXPRED.h) 1.2 */ -#if !defined(decompXPRED_h) +#ifndef decompXPRED_h #define decompXPRED_h diff --git a/isis/src/mgs/apps/mocuncompress/decompXPREDYPRED.h b/isis/src/mgs/apps/mocuncompress/decompXPREDYPRED.h index a168447ca1..09d246920f 100644 --- a/isis/src/mgs/apps/mocuncompress/decompXPREDYPRED.h +++ b/isis/src/mgs/apps/mocuncompress/decompXPREDYPRED.h @@ -40,7 +40,7 @@ SCCSID @(#)decompXPREDYPRED.h 1.1 10/04/99 */ /* SCCShid @(#)decompXPREDYPRED.h (decompXPREDYPRED.h) 1.2 */ -#if !defined(decompXPREDYPRED_h) +#ifndef decompXPREDYPRED_h #define decompXPREDYPRED_h diff --git a/isis/src/mgs/apps/mocuncompress/decompYPRED.h b/isis/src/mgs/apps/mocuncompress/decompYPRED.h index 60445c5d6f..3db94c4a9e 100644 --- a/isis/src/mgs/apps/mocuncompress/decompYPRED.h +++ b/isis/src/mgs/apps/mocuncompress/decompYPRED.h @@ -40,7 +40,7 @@ SCCSID @(#)decompYPRED.h 1.1 10/04/99 */ /* SCCShid @(#)decompYPRED.h (decompYPRED.h) 1.2 */ -#if !defined(decompYPRED_h) +#ifndef decompYPRED_h #define decompYPRED_h diff --git a/isis/src/mgs/apps/mocuncompress/encodeCoefs.static.h b/isis/src/mgs/apps/mocuncompress/encodeCoefs.static.h index d081c0257a..42184e2591 100644 --- a/isis/src/mgs/apps/mocuncompress/encodeCoefs.static.h +++ b/isis/src/mgs/apps/mocuncompress/encodeCoefs.static.h @@ -40,7 +40,7 @@ SCCSID @(#)encodeCoefs.static.h 1.1 10/04/99 */ /* This file was automatically generated by 'makeEncode' */ -#if !defined(encodeCoefs_static_h) +#ifndef encodeCoefs_static_h #define encodeCoefs_static_h diff --git a/isis/src/mgs/apps/mocuncompress/fs.h b/isis/src/mgs/apps/mocuncompress/fs.h index bdd14ee655..58483cc5a8 100644 --- a/isis/src/mgs/apps/mocuncompress/fs.h +++ b/isis/src/mgs/apps/mocuncompress/fs.h @@ -53,7 +53,7 @@ SCCSID @(#)fs.h 1.1 10/04/99 * such things as arithmetic operations. */ -#if !defined(fs_h) +#ifndef fs_h #define fs_h diff --git a/isis/src/mgs/apps/mocuncompress/initBlock.h b/isis/src/mgs/apps/mocuncompress/initBlock.h index 39598a9880..d39bd81660 100644 --- a/isis/src/mgs/apps/mocuncompress/initBlock.h +++ b/isis/src/mgs/apps/mocuncompress/initBlock.h @@ -40,7 +40,7 @@ SCCSID @(#)initBlock.h 1.1 10/04/99 */ /* SCCShid @(#)initBlock.h (initBlock.h) 1.2 */ -#if !defined(initBlock_h) +#ifndef initBlock_h #define initBlock_h diff --git a/isis/src/mgs/apps/mocuncompress/limits.h b/isis/src/mgs/apps/mocuncompress/limits.h index 279fb052ec..1f8f19b16e 100644 --- a/isis/src/mgs/apps/mocuncompress/limits.h +++ b/isis/src/mgs/apps/mocuncompress/limits.h @@ -40,7 +40,7 @@ SCCSID @(#)limits.h 1.1 10/04/99 */ /* SCCShid @(#)limits.h (limits.h) 1.4 */ -#if !defined(limits_h) +#ifndef limits_h #define limits_h diff --git a/isis/src/mgs/apps/mocuncompress/nextValue.h b/isis/src/mgs/apps/mocuncompress/nextValue.h index e9ecef75ae..a9f43b82f3 100644 --- a/isis/src/mgs/apps/mocuncompress/nextValue.h +++ b/isis/src/mgs/apps/mocuncompress/nextValue.h @@ -40,7 +40,7 @@ SCCSID @(#)nextValue.h 1.1 10/04/99 */ /* SCCShid @(#)nextValue.h (nextValue.h) 1.3 */ -#if !defined(nextValue_h) +#ifndef nextValue_h #define nextValue_h diff --git a/isis/src/mgs/apps/mocuncompress/predCompCommon.h b/isis/src/mgs/apps/mocuncompress/predCompCommon.h index 7ce9107905..109598fbd0 100644 --- a/isis/src/mgs/apps/mocuncompress/predCompCommon.h +++ b/isis/src/mgs/apps/mocuncompress/predCompCommon.h @@ -40,7 +40,7 @@ SCCSID @(#)predCompCommon.h 1.1 10/04/99 */ /* SCCShid @(#)predCompCommon.h (predCompCommon.h) 1.2 */ -#if !defined(predCompCommon_h) +#ifndef predCompCommon_h #define predCompCommon_h diff --git a/isis/src/mgs/apps/mocuncompress/predDecompCommon.h b/isis/src/mgs/apps/mocuncompress/predDecompCommon.h index 0c1bc097c9..9a8a7d38bb 100644 --- a/isis/src/mgs/apps/mocuncompress/predDecompCommon.h +++ b/isis/src/mgs/apps/mocuncompress/predDecompCommon.h @@ -40,7 +40,7 @@ SCCSID @(#)predDecompCommon.h 1.1 10/04/99 */ /* SCCShid @(#)predDecompCommon.h (predDecompCommon.h) 1.1 */ -#if !defined(predDecompCommon_h) +#ifndef predDecompCommon_h #define predDecompCommon_h diff --git a/isis/src/mgs/apps/mocuncompress/predictiveDecompressor.h b/isis/src/mgs/apps/mocuncompress/predictiveDecompressor.h index 9292f4b431..a2b6a5d64a 100644 --- a/isis/src/mgs/apps/mocuncompress/predictiveDecompressor.h +++ b/isis/src/mgs/apps/mocuncompress/predictiveDecompressor.h @@ -40,7 +40,7 @@ SCCSID @(#)predictiveDecompressor.h 1.1 10/04/99 */ /* SCCShid @(#)predictiveDecompressor.h (predictiveDecompressor.h) 1.4 */ -#if !defined(predictiveDecompressor_h) +#ifndef predictiveDecompressor_h #define predictiveDecompressor_h diff --git a/isis/src/mgs/apps/mocuncompress/readBits.h b/isis/src/mgs/apps/mocuncompress/readBits.h index 231a372eb1..d3413eae22 100644 --- a/isis/src/mgs/apps/mocuncompress/readBits.h +++ b/isis/src/mgs/apps/mocuncompress/readBits.h @@ -40,7 +40,7 @@ SCCSID @(#)readBits.h 1.1 10/04/99 */ /* SCCShid @(#)readBits.h (readBits.h) 1.2 */ -#if !defined(readBits_h) +#ifndef readBits_h #define readBits_h diff --git a/isis/src/mgs/apps/mocuncompress/readBlock.h b/isis/src/mgs/apps/mocuncompress/readBlock.h index d2bf3a0426..2b49eb1ab1 100644 --- a/isis/src/mgs/apps/mocuncompress/readBlock.h +++ b/isis/src/mgs/apps/mocuncompress/readBlock.h @@ -40,7 +40,7 @@ SCCSID @(#)readBlock.h 1.1 10/04/99 */ /* SCCShid @(#)readBlock.h (readBlock.h) 1.4 */ -#if !defined(readBlock_h) +#ifndef readBlock_h #define readBlock_h diff --git a/isis/src/mgs/apps/mocuncompress/readCoef.h b/isis/src/mgs/apps/mocuncompress/readCoef.h index 5e76602af8..5fa0a5f4cc 100644 --- a/isis/src/mgs/apps/mocuncompress/readCoef.h +++ b/isis/src/mgs/apps/mocuncompress/readCoef.h @@ -40,7 +40,7 @@ SCCSID @(#)readCoef.h 1.1 10/04/99 */ /* SCCShid @(#)readCoef.h (readCoef.h) 1.2 */ -#if !defined(readCoef_h) +#ifndef readCoef_h #define readCoef_h diff --git a/isis/src/mgs/apps/mocuncompress/readGroups.h b/isis/src/mgs/apps/mocuncompress/readGroups.h index 4484cbc83e..d74f08e51f 100644 --- a/isis/src/mgs/apps/mocuncompress/readGroups.h +++ b/isis/src/mgs/apps/mocuncompress/readGroups.h @@ -40,7 +40,7 @@ SCCSID @(#)readGroups.h 1.1 10/04/99 */ /* SCCShid @(#)readGroups.h (readGroups.h) 1.2 */ -#if !defined(readGroups_h) +#ifndef readGroups_h #define readGroups_h diff --git a/isis/src/mgs/apps/mocuncompress/reorder.h b/isis/src/mgs/apps/mocuncompress/reorder.h index 636662c2cb..80a6b2561a 100644 --- a/isis/src/mgs/apps/mocuncompress/reorder.h +++ b/isis/src/mgs/apps/mocuncompress/reorder.h @@ -40,7 +40,7 @@ SCCSID @(#)reorder.h 1.1 10/04/99 */ /* SCCShid @(#)reorder.h (reorder.h) 1.2 */ -#if !defined(reorder_h) +#ifndef reorder_h #define reorder_h diff --git a/isis/src/mgs/apps/mocuncompress/reorder.static.h b/isis/src/mgs/apps/mocuncompress/reorder.static.h index aba0b2da16..c6f06a378b 100644 --- a/isis/src/mgs/apps/mocuncompress/reorder.static.h +++ b/isis/src/mgs/apps/mocuncompress/reorder.static.h @@ -40,7 +40,7 @@ SCCSID @(#)reorder.static.h 1.1 10/04/99 */ /* This file was automatically generated by 'makeOrder' */ -#if !defined(reorder_static_h) +#ifndef reorder_static_h #define reorder_static_h diff --git a/isis/src/mgs/apps/mocuncompress/types.h b/isis/src/mgs/apps/mocuncompress/types.h index c497bd51a3..8235ed3589 100644 --- a/isis/src/mgs/apps/mocuncompress/types.h +++ b/isis/src/mgs/apps/mocuncompress/types.h @@ -40,7 +40,7 @@ SCCSID @(#)types.h 1.1 10/04/99 */ /* SCCShid @(#)types.h (types.h) 1.1 */ -#if !defined(types_h) +#ifndef types_h #define types_h diff --git a/isis/src/mgs/objs/MocLabels/MocLabels.cpp b/isis/src/mgs/objs/MocLabels/MocLabels.cpp index 01968bbf01..95f3259a97 100644 --- a/isis/src/mgs/objs/MocLabels/MocLabels.cpp +++ b/isis/src/mgs/objs/MocLabels/MocLabels.cpp @@ -18,7 +18,7 @@ namespace Isis { /** * Construct MocLabels object using the file name */ - MocLabels::MocLabels(const string &file) { + MocLabels::MocLabels(const QString &file) { Pvl lab(file); Init(lab); } @@ -55,31 +55,31 @@ namespace Isis { void MocLabels::ReadLabels(Pvl &lab) { // Get stuff out of the instrument group PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - p_instrumentId = (string) inst["InstrumentId"]; + p_instrumentId = (QString) inst["InstrumentId"]; p_startingSample = inst["FirstLineSample"]; p_crosstrackSumming = inst["CrosstrackSumming"]; p_downtrackSumming = inst["DowntrackSumming"]; p_exposureDuration = inst["LineExposureDuration"]; p_focalPlaneTemp = inst["FocalPlaneTemperature"]; - p_clockCount = (string) inst["SpacecraftClockCount"]; + p_clockCount = (QString) inst["SpacecraftClockCount"]; p_orbitNumber = 0; if(inst.HasKeyword("OrbitNumber")) { p_orbitNumber = inst["OrbitNumber"]; } - p_gainModeId = (string) inst["GainModeId"]; + p_gainModeId = (QString) inst["GainModeId"]; p_offsetModeId = inst["OffsetModeId"]; - p_startTime = (string) inst["StartTime"]; + p_startTime = (QString) inst["StartTime"]; // Get stuff out of the archive group p_dataQuality = "Unknown"; PvlGroup &arch = lab.FindGroup("Archive", Pvl::Traverse); if(arch.HasKeyword("DataQualityDesc")) { - p_dataQuality = (string) arch["DataQualityDesc"]; + p_dataQuality = (QString) arch["DataQualityDesc"]; } // Get Stuff out of the band bind group PvlGroup &bandBin = lab.FindGroup("BandBin", Pvl::Traverse); - p_filter = (string) bandBin["FilterName"]; + p_filter = (QString) bandBin["FilterName"]; // Get the number of samples in the initial cube as it may have been // cropped or projected @@ -109,8 +109,8 @@ namespace Isis { } if(!p_mocNA && !p_mocRedWA && !p_mocBlueWA) { - string msg = "InstrumentID [" + p_instrumentId + "] and/or FilterName [" - + p_filter + "] are inappropriate for the MOC camera"; + QString msg = "InstrumentID [" + p_instrumentId + "] and/or FilterName [" + + p_filter + "] are inappropriate for the MOC camera"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -158,20 +158,20 @@ namespace Isis { } // Lookup the gain using the gain mode in the gain maps - map::iterator p; + map::iterator p; if(NarrowAngle()) { p = p_gainMapNA.find(p_gainModeId); if(p == p_gainMapNA.end()) { - string msg = "Invalid value for PVL keyword GainModeId [" + - p_gainModeId + "]"; + QString msg = "Invalid value for PVL keyword GainModeId [" + + p_gainModeId + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } } else { p = p_gainMapWA.find(p_gainModeId); if(p == p_gainMapWA.end()) { - string msg = "Invalid value for PVL keyword GainModeId [" + - p_gainModeId + "]"; + QString msg = "Invalid value for PVL keyword GainModeId [" + + p_gainModeId + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } } @@ -189,8 +189,8 @@ namespace Isis { if(currentTime < mappingPhaseBeginTime) { double newGain = p_gain / (double) p_downtrackSumming; double mindiff = DBL_MAX; - map::iterator p; - string index = ""; + map::iterator p; + QString index = ""; p = p_gainMapNA.begin(); while(p != p_gainMapNA.end()) { double diff = abs(newGain - p->second); @@ -215,18 +215,18 @@ namespace Isis { InitDetectorMaps(); // Temporarily load some naif kernels - string lsk = p_lsk.expanded(); - string sclk = p_sclk.expanded(); - furnsh_c(lsk.c_str()); - furnsh_c(sclk.c_str()); + QString lsk = p_lsk.expanded(); + QString sclk = p_sclk.expanded(); + furnsh_c(lsk.toAscii().data()); + furnsh_c(sclk.toAscii().data()); // Compute the starting ephemeris time - scs2e_c(-94, p_clockCount.c_str(), &p_etStart); + scs2e_c(-94, p_clockCount.toAscii().data(), &p_etStart); p_etEnd = EphemerisTime((double)p_nl); // Unload the naif kernels - unload_c(lsk.c_str()); - unload_c(sclk.c_str()); + unload_c(lsk.toAscii().data()); + unload_c(sclk.toAscii().data()); } /** @@ -417,16 +417,16 @@ namespace Isis { firstTime = false; // Load naif kernels - string lskKern = p_lsk.expanded(); - string sclkKern = p_sclk.expanded(); - furnsh_c(lskKern.c_str()); - furnsh_c(sclkKern.c_str()); + QString lskKern = p_lsk.expanded(); + QString sclkKern = p_sclk.expanded(); + furnsh_c(lskKern.toAscii().data()); + furnsh_c(sclkKern.toAscii().data()); //Set up file for reading FileName wagoFile("$mgs/calibration/MGSC_????_wago.tab"); wagoFile = wagoFile.highestVersion(); - string nameOfFile = wagoFile.expanded(); - ifstream temp(nameOfFile.c_str()); + QString nameOfFile = wagoFile.expanded(); + ifstream temp(nameOfFile.toAscii().data()); vector wholeFile; // Read file into a vector of bytes, ignoring EOL chars @@ -442,7 +442,8 @@ namespace Isis { int low = 1; int high = wholeFile.size() / 35; int middle; - IString line, filter, sclk, gainId, offsetId; + IString line, filter, sclk, offsetId; + QString gainId; WAGO wago; //Binary search. This determines the middle of the current range and @@ -541,9 +542,7 @@ namespace Isis { scs2e_c(-94, sclk.c_str(), &et); // Get the gain mode id - gainId = line.Token(","); - gainId.Remove("\""); - gainId.Trim(" "); + gainId = line.Token(",").ToQt().remove("\"").trimmed(); // Get the offset mode id offsetId = line; @@ -552,14 +551,14 @@ namespace Isis { offsetId.Trim(" "); // Compute the gain - map::iterator p; + map::iterator p; p = p_gainMapWA.find(gainId); if(p == p_gainMapWA.end()) { // Unload the naif kernels - unload_c(lskKern.c_str()); - unload_c(sclkKern.c_str()); + unload_c(lskKern.toAscii().data()); + unload_c(sclkKern.toAscii().data()); - string msg = "Invalid GainModeId [" + gainId + "] in wago table"; + QString msg = "Invalid GainModeId [" + gainId + "] in wago table"; throw IException(IException::Unknown, msg, _FILEINFO_); } double gain = p->second; @@ -592,8 +591,8 @@ namespace Isis { unique(p_wagos.begin(), p_wagos.end()); // Unload the naif kernels - unload_c(lskKern.c_str()); - unload_c(sclkKern.c_str()); + unload_c(lskKern.toAscii().data()); + unload_c(sclkKern.toAscii().data()); } } diff --git a/isis/src/mgs/objs/MocLabels/MocLabels.h b/isis/src/mgs/objs/MocLabels/MocLabels.h index 82612760a8..1a8d9a9124 100644 --- a/isis/src/mgs/objs/MocLabels/MocLabels.h +++ b/isis/src/mgs/objs/MocLabels/MocLabels.h @@ -23,6 +23,9 @@ */ #include + +#include + #include "FileName.h" @@ -40,7 +43,7 @@ namespace Isis { * @internal * @history 2008-04-30 Steven Lambright corrected infinite loop * @history 2008-05-29 Steven Lambright Fixed binary search indexing, - * bad calls to std::string::_cstr() references + * bad calls to QString::_cstr() references * @history 2008-06-18 Steven Koechle - Fixed Documentation Errors * @history 2008-08-11 Steven Lambright - Fixed definition of WAGO, * problem pointed out by "novas0x2a" (Support Board Member) @@ -57,7 +60,7 @@ namespace Isis { class MocLabels { public: MocLabels(Pvl &lab); - MocLabels(const std::string &file); + MocLabels(const QString &file); //! Empty destructor. ~MocLabels() {}; @@ -140,9 +143,9 @@ namespace Isis { }; /** * Returns the value for StartTime from the instrument group. - * @return @b std::string Start time + * @return @b QString Start time */ - inline std::string StartTime() const { + inline QString StartTime() const { return p_startTime; }; /** @@ -175,19 +178,19 @@ namespace Isis { bool p_mocNA; bool p_mocRedWA; bool p_mocBlueWA; - std::string p_instrumentId; - std::string p_filter; - std::string p_clockCount; - std::string p_gainModeId; + QString p_instrumentId; + QString p_filter; + QString p_clockCount; + QString p_gainModeId; int p_offsetModeId; - std::string p_startTime; - std::string p_dataQuality; + QString p_startTime; + QString p_dataQuality; double p_etStart; double p_etEnd; void InitGainMaps(); - std::map p_gainMapNA; - std::map p_gainMapWA; + std::map p_gainMapNA; + std::map p_gainMapWA; double p_gain; double p_offset; diff --git a/isis/src/mgs/objs/MocNarrowAngleCamera/MocNarrowAngleCamera.cpp b/isis/src/mgs/objs/MocNarrowAngleCamera/MocNarrowAngleCamera.cpp index d2a87017d6..eda91b70c3 100644 --- a/isis/src/mgs/objs/MocNarrowAngleCamera/MocNarrowAngleCamera.cpp +++ b/isis/src/mgs/objs/MocNarrowAngleCamera/MocNarrowAngleCamera.cpp @@ -49,7 +49,7 @@ namespace Isis { // Get the start time from labels PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - string stime = inst["SpacecraftClockCount"]; + QString stime = inst["SpacecraftClockCount"]; double etStart = getClockTime(stime).Et(); // Get other info from labels diff --git a/isis/src/mgs/objs/MocWideAngleCamera/MocWideAngleCamera.cpp b/isis/src/mgs/objs/MocWideAngleCamera/MocWideAngleCamera.cpp index 064c7bad19..16ba4c7f24 100644 --- a/isis/src/mgs/objs/MocWideAngleCamera/MocWideAngleCamera.cpp +++ b/isis/src/mgs/objs/MocWideAngleCamera/MocWideAngleCamera.cpp @@ -66,7 +66,7 @@ namespace Isis { // Get the start time from labels PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - string stime = inst["SpacecraftClockCount"]; + QString stime = inst["SpacecraftClockCount"]; double etStart = getClockTime(stime).Et(); // Setup detector map diff --git a/isis/src/mro/apps/crism2isis/crism2isis.cpp b/isis/src/mro/apps/crism2isis/crism2isis.cpp index 376419aa4b..1176b421d8 100644 --- a/isis/src/mro/apps/crism2isis/crism2isis.cpp +++ b/isis/src/mro/apps/crism2isis/crism2isis.cpp @@ -25,57 +25,58 @@ void IsisMain() { Pvl labelPvl(inFile.expanded()); - IString prodType; + QString prodType; if(labelPvl.HasKeyword("PRODUCT_TYPE")) { - prodType = (string)labelPvl.FindKeyword("PRODUCT_TYPE"); + prodType = (QString)labelPvl.FindKeyword("PRODUCT_TYPE"); } else { - string msg = "Unsupported CRISM file type, supported types are: DDR, MRDR, and TRDR"; + QString msg = "Unsupported CRISM file type, supported types are: DDR, MRDR, and TRDR"; throw IException(IException::User, msg, _FILEINFO_); } - if(prodType.Equal("MAP_PROJECTED_MULTISPECTRAL_RDR")) { - IString prodId; + if(prodType.toUpper() == "MAP_PROJECTED_MULTISPECTRAL_RDR") { + QString prodId; if(labelPvl.HasKeyword("PRODUCT_ID")) { - prodId = (string)labelPvl.FindKeyword("PRODUCT_ID"); - prodId = prodId.substr(prodId.find("_") + 1, prodId.find("_")); + prodId = (QString)labelPvl.FindKeyword("PRODUCT_ID"); + prodId = prodId.mid(prodId.indexOf("_") + 1, prodId.indexOf("_")); } else { - string msg = "Could not find label PRODUCT_ID, invalid MRDR"; + QString msg = "Could not find label PRODUCT_ID, invalid MRDR"; throw IException(IException::Unknown, msg, _FILEINFO_); } //If the product type is AL (Lambert albedo) or IF (I/F) //Read the wavelength table and put the corresponding //widths in the band bin group - if(prodId.Equal("MRRAL") || prodId.Equal("MRRIF")) { + if(prodId.toUpper() == "MRRAL" || prodId.toUpper() == "MRRIF") { //If the wavelength file is specified in the label if(labelPvl.HasKeyword("MRO:WAVELENGTH_FILE_NAME")) { PvlGroup bandBin = PvlGroup("BandBin"); PvlKeyword origBand = PvlKeyword("OriginalBand"); PvlKeyword widths = PvlKeyword("Width"); - IString tablePath = (string)labelPvl.FindKeyword("MRO:WAVELENGTH_FILE_NAME"); - tablePath = tablePath.DownCase(); + QString tablePath = (QString)labelPvl.FindKeyword("MRO:WAVELENGTH_FILE_NAME"); + tablePath = tablePath.toLower(); FileName tableFile(inFile.path() + "/" + tablePath); //Check if the wavelength file exists if(tableFile.fileExists()) { TextFile *fin = new TextFile(tableFile.expanded()); // Open table file if(!fin->OpenChk()) { - string msg = "Cannot open wavelength table [" + tableFile.expanded() + "]"; + QString msg = "Cannot open wavelength table [" + tableFile.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } //For each line in the wavelength table, add the width to //The band bin group - IString st; + QString st; int band = 1; while(fin->GetLine(st)) { - st.Token(","); - st.Token(","); - origBand += band; - widths += st.Token(",").ConvertWhiteSpace().Trim(" ").ToDouble(); + st = st.simplified().trimmed(); + QStringList cols = st.split(","); + + origBand += toString(band); + widths += cols[2]; band++; } delete fin; @@ -86,7 +87,7 @@ void IsisMain() { } //Otherwise throw an error else { - string msg = "Cannot fine wavelength table [" + tableFile.expanded() + "]"; + QString msg = "Cannot fine wavelength table [" + tableFile.expanded() + "]"; throw IException(IException::Io, msg, _FILEINFO_); } } @@ -94,13 +95,13 @@ void IsisMain() { //If the product type is DE (Derived products for I/F) or DL //(Derived products for Lambert albedo) write the band names //to the band bin group - else if(prodId.Equal("MRRDE") || prodId.Equal("MRRDL")) { + else if(prodId.toUpper() == "MRRDE" || prodId.toUpper() == "MRRDL") { PvlGroup bandBin = PvlGroup("BandBin"); PvlKeyword origBand = PvlKeyword("OriginalBand"); PvlKeyword bandName = PvlKeyword("BandName"); PvlKeyword bandNames = labelPvl.FindObject("IMAGE").FindKeyword("BAND_NAME"); for(int i = 0; i < bandNames.Size(); i++) { - origBand += (i + 1); + origBand += toString(i + 1); bandName += bandNames[i]; } bandBin.AddKeyword(origBand); @@ -111,15 +112,15 @@ void IsisMain() { p.TranslatePdsProjection(outLabel); ocube->putGroup(outLabel.FindGroup("Mapping", Pvl::Traverse)); } - else if(prodType.Equal("TARGETED_RDR")) { + else if(prodType.toUpper() == "TARGETED_RDR") { } - else if(prodType.Equal("DDR")) { + else if(prodType.toUpper() == "DDR") { PvlGroup bandBin = PvlGroup("BandBin"); PvlKeyword origBand = PvlKeyword("OriginalBand"); PvlKeyword bandName = PvlKeyword("BandName"); PvlKeyword bandNames = labelPvl.FindObject("FILE").FindObject("IMAGE").FindKeyword("BAND_NAME"); for(int i = 0; i < bandNames.Size(); i++) { - origBand += (i + 1); + origBand += toString(i + 1); bandName += bandNames[i]; } bandBin.AddKeyword(origBand); @@ -127,7 +128,7 @@ void IsisMain() { ocube->putGroup(bandBin); } else { - string msg = "Unsupported CRISM file type, supported types are: DDR, MRDR, and TRDR"; + QString msg = "Unsupported CRISM file type, supported types are: DDR, MRDR, and TRDR"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/mro/apps/ctxcal/ctxcal.cpp b/isis/src/mro/apps/ctxcal/ctxcal.cpp index 229cd690e9..06d5b61ac6 100644 --- a/isis/src/mro/apps/ctxcal/ctxcal.cpp +++ b/isis/src/mro/apps/ctxcal/ctxcal.cpp @@ -38,9 +38,9 @@ void IsisMain() { Isis::PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - std::string instId = inst["InstrumentId"]; + QString instId = inst["InstrumentId"]; if(instId != "CTX") { - string msg = "This is not a CTX image. Ctxcal requires a CTX image."; + QString msg = "This is not a CTX image. Ctxcal requires a CTX image."; throw IException(IException::User, msg, _FILEINFO_); } @@ -60,13 +60,13 @@ void IsisMain() { // If it is already calibrated then complain if(icube->hasGroup("Radiometry")) { - string msg = "The CTX image [" + icube->getFileName() + "] has already " + QString msg = "The CTX image [" + icube->getFileName() + "] has already " "been radiometrically calibrated"; throw IException(IException::User, msg, _FILEINFO_); } // Get label parameters we will need for calibration equation - iTime startTime((string) inst["StartTime"]); + iTime startTime((QString) inst["StartTime"]); double etStart = startTime.Et(); // Read exposure and convert to milliseconds @@ -133,21 +133,21 @@ void IsisMain() { if(convertIOF) { // Get the distance between Mars and the Sun at the given time in // Astronomical Units (AU) - string bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true); - furnsh_c(bspKernel.c_str()); - string pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); - furnsh_c(pckKernel.c_str()); + QString bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true); + furnsh_c(bspKernel.toAscii().data()); + QString pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true); + furnsh_c(pckKernel.toAscii().data()); double sunpos[6], lt; spkezr_c("sun", etStart, "iau_mars", "LT+S", "mars", sunpos, <); double dist1 = vnorm_c(sunpos); - unload_c(bspKernel.c_str()); - unload_c(pckKernel.c_str()); + unload_c(bspKernel.toAscii().data()); + unload_c(pckKernel.toAscii().data()); double dist = 2.07E8; double w0 = 3660.5; double w1 = w0 * ((dist * dist) / (dist1 * dist1)); if(exposure *w1 == 0.0) { - string msg = icube->getFileName() + ": exposure or w1 has value of 0.0 "; + QString msg = icube->getFileName() + ": exposure or w1 has value of 0.0 "; throw IException(IException::User, msg, _FILEINFO_); } iof = 1.0 / (exposure * w1); @@ -163,7 +163,7 @@ void IsisMain() { PvlGroup calgrp("Radiometry"); calgrp += PvlKeyword("FlatFile", flatFile.getFileName()); - calgrp += PvlKeyword("iof", iof); + calgrp += PvlKeyword("iof", toString(iof)); ocube->putGroup(calgrp); diff --git a/isis/src/mro/apps/ctxevenodd/ctxevenodd.cpp b/isis/src/mro/apps/ctxevenodd/ctxevenodd.cpp index d64b30aec4..409bd29c40 100644 --- a/isis/src/mro/apps/ctxevenodd/ctxevenodd.cpp +++ b/isis/src/mro/apps/ctxevenodd/ctxevenodd.cpp @@ -37,14 +37,14 @@ void IsisMain() { Isis::PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - std::string instId = inst["InstrumentId"]; + QString instId = inst["InstrumentId"]; if(instId != "CTX") { - string msg = "This is not a CTX image. Ctxcevenodd requires a CTX image."; + QString msg = "This is not a CTX image. Ctxcevenodd requires a CTX image."; throw IException(IException::User, msg, _FILEINFO_); } int sum = inst["SpatialSumming"]; if(sum != 1) { - string msg = "CTX images do not have even/odd noise problems"; + QString msg = "CTX images do not have even/odd noise problems"; msg += " if the SpatialSumming is greater than one."; throw IException(IException::User, msg, _FILEINFO_); } @@ -66,7 +66,7 @@ void IsisMain() { // // throw err if, pixel counts could result in division by zero if((oddCount == 0) || (evenCount == 0)) { - string msg = "Couldn't compute column averages"; + QString msg = "Couldn't compute column averages"; throw IException(IException::User, msg, _FILEINFO_); } diff --git a/isis/src/mro/apps/hi2isis/hi2isis.cpp b/isis/src/mro/apps/hi2isis/hi2isis.cpp index f6effcded1..f938ea0c36 100644 --- a/isis/src/mro/apps/hi2isis/hi2isis.cpp +++ b/isis/src/mro/apps/hi2isis/hi2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "ProcessImportPds.h" #include "ProcessByLine.h" @@ -64,31 +64,29 @@ void IsisMain() { // Get the input filename and make sure it is a HiRISE EDR FileName inFile = ui.GetFileName("FROM"); - IString id; + QString id; bool projected; try { Pvl lab(inFile.expanded()); - id = (string) lab.FindKeyword("DATA_SET_ID"); + id = (QString) lab.FindKeyword("DATA_SET_ID"); projected = lab.HasObject("IMAGE_MAP_PROJECTION"); } catch(IException &e) { - string msg = "Unable to read [DATA_SET_ID] from input file [" + + QString msg = "Unable to read [DATA_SET_ID] from input file [" + inFile.expanded() + "]"; throw IException(e, IException::Io, msg, _FILEINFO_); } //Checks if in file is rdr if(projected) { - string msg = "[" + inFile.name() + "] appears to be an rdr file."; + QString msg = "[" + inFile.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } - id.ConvertWhiteSpace(); - id.Compress(); - id.Trim(" "); + id = id.simplified().trimmed(); if(id != "MRO-M-HIRISE-2-EDR-V1.0") { - string msg = "Input file [" + inFile.expanded() + "] does not appear to be " + + QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + "in HiRISE EDR format. DATA_SET_ID is [" + id + "]"; throw IException(IException::Io, msg, _FILEINFO_); } @@ -135,7 +133,7 @@ void IsisMain() { // The user wants it unlutted else if(ui.GetBoolean("UNLUT")) { for(int i = 0; i < lutSeq.Size(); i++) { - stretch.AddPair(i, (((double)lutSeq[i][0] + (double)lutSeq[i][1]) / 2.0)); + stretch.AddPair(i, ((toDouble(lutSeq[i][0]) + toDouble(lutSeq[i][1])) / 2.0)); } instgrp.AddKeyword(PvlKeyword("Unlutted", "TRUE")); instgrp.DeleteKeyword("LookupTable"); @@ -165,7 +163,7 @@ void IsisMain() { // counts lsbGap = ui.GetBoolean("LSBGAP"); ProcessByLine p2; - string ioFile = ui.GetFileName("TO"); + QString ioFile = ui.GetFileName("TO"); CubeAttributeInput att; p2.SetInputCube(ioFile, att, ReadWrite); p2.Progress()->SetText("Converting special pixels"); @@ -178,47 +176,47 @@ void IsisMain() { PvlGroup results("Results"); results += PvlKeyword("From", inFile.expanded()); - results += PvlKeyword("CalibrationBufferGaps", gapCount[0]); - results += PvlKeyword("CalibrationBufferLIS", lisCount[0]); - results += PvlKeyword("CalibrationBufferHIS", hisCount[0]); - results += PvlKeyword("CalibrationBufferPossibleGaps", suspectGapCount[0]); - results += PvlKeyword("CalibrationBufferInvalid", invalidCount[0]); - results += PvlKeyword("CalibrationBufferValid", validCount[0]); - - results += PvlKeyword("CalibrationImageGaps", gapCount[1]); - results += PvlKeyword("CalibrationImageLIS", lisCount[1]); - results += PvlKeyword("CalibrationImageHIS", hisCount[1]); - results += PvlKeyword("CalibrationImagePossibleGaps", suspectGapCount[1]); - results += PvlKeyword("CalibrationImageInvalid", invalidCount[1]); - results += PvlKeyword("CalibrationImageValid", validCount[1]); - - results += PvlKeyword("CalibrationDarkGaps", gapCount[2]); - results += PvlKeyword("CalibrationDarkLIS", lisCount[2]); - results += PvlKeyword("CalibrationDarkHIS", hisCount[2]); - results += PvlKeyword("CalibrationDarkPossibleGaps", suspectGapCount[2]); - results += PvlKeyword("CalibrationDarkInvalid", invalidCount[2]); - results += PvlKeyword("CalibrationDarkValid", validCount[2]); - - results += PvlKeyword("ObservationBufferGaps", gapCount[3]); - results += PvlKeyword("ObservationBufferLIS", lisCount[3]); - results += PvlKeyword("ObservationBufferHIS", hisCount[3]); - results += PvlKeyword("ObservationBufferPossibleGaps", suspectGapCount[3]); - results += PvlKeyword("ObservationBufferInvalid", invalidCount[3]); - results += PvlKeyword("ObservationBufferValid", validCount[3]); - - results += PvlKeyword("ObservationImageGaps", gapCount[4]); - results += PvlKeyword("ObservationImageLIS", lisCount[4]); - results += PvlKeyword("ObservationImageHIS", hisCount[4]); - results += PvlKeyword("ObservationImagePossibleGaps", suspectGapCount[4]); - results += PvlKeyword("ObservationImageInvalid", invalidCount[4]); - results += PvlKeyword("ObservationImageValid", validCount[4]); - - results += PvlKeyword("ObservationDarkGaps", gapCount[5]); - results += PvlKeyword("ObservationDarkLIS", lisCount[5]); - results += PvlKeyword("ObservationDarkHIS", hisCount[5]); - results += PvlKeyword("ObservationDarkPossibleGaps", suspectGapCount[5]); - results += PvlKeyword("ObservationDarkInvalid", invalidCount[5]); - results += PvlKeyword("ObservationDarkValid", validCount[5]); + results += PvlKeyword("CalibrationBufferGaps", toString(gapCount[0])); + results += PvlKeyword("CalibrationBufferLIS", toString(lisCount[0])); + results += PvlKeyword("CalibrationBufferHIS", toString(hisCount[0])); + results += PvlKeyword("CalibrationBufferPossibleGaps", toString(suspectGapCount[0])); + results += PvlKeyword("CalibrationBufferInvalid", toString(invalidCount[0])); + results += PvlKeyword("CalibrationBufferValid", toString(validCount[0])); + + results += PvlKeyword("CalibrationImageGaps", toString(gapCount[1])); + results += PvlKeyword("CalibrationImageLIS", toString(lisCount[1])); + results += PvlKeyword("CalibrationImageHIS", toString(hisCount[1])); + results += PvlKeyword("CalibrationImagePossibleGaps", toString(suspectGapCount[1])); + results += PvlKeyword("CalibrationImageInvalid", toString(invalidCount[1])); + results += PvlKeyword("CalibrationImageValid", toString(validCount[1])); + + results += PvlKeyword("CalibrationDarkGaps", toString(gapCount[2])); + results += PvlKeyword("CalibrationDarkLIS", toString(lisCount[2])); + results += PvlKeyword("CalibrationDarkHIS", toString(hisCount[2])); + results += PvlKeyword("CalibrationDarkPossibleGaps", toString(suspectGapCount[2])); + results += PvlKeyword("CalibrationDarkInvalid", toString(invalidCount[2])); + results += PvlKeyword("CalibrationDarkValid", toString(validCount[2])); + + results += PvlKeyword("ObservationBufferGaps", toString(gapCount[3])); + results += PvlKeyword("ObservationBufferLIS", toString(lisCount[3])); + results += PvlKeyword("ObservationBufferHIS", toString(hisCount[3])); + results += PvlKeyword("ObservationBufferPossibleGaps", toString(suspectGapCount[3])); + results += PvlKeyword("ObservationBufferInvalid", toString(invalidCount[3])); + results += PvlKeyword("ObservationBufferValid", toString(validCount[3])); + + results += PvlKeyword("ObservationImageGaps", toString(gapCount[4])); + results += PvlKeyword("ObservationImageLIS", toString(lisCount[4])); + results += PvlKeyword("ObservationImageHIS", toString(hisCount[4])); + results += PvlKeyword("ObservationImagePossibleGaps", toString(suspectGapCount[4])); + results += PvlKeyword("ObservationImageInvalid", toString(invalidCount[4])); + results += PvlKeyword("ObservationImageValid", toString(validCount[4])); + + results += PvlKeyword("ObservationDarkGaps", toString(gapCount[5])); + results += PvlKeyword("ObservationDarkLIS", toString(lisCount[5])); + results += PvlKeyword("ObservationDarkHIS", toString(hisCount[5])); + results += PvlKeyword("ObservationDarkPossibleGaps", toString(suspectGapCount[5])); + results += PvlKeyword("ObservationDarkInvalid", toString(invalidCount[5])); + results += PvlKeyword("ObservationDarkValid", toString(validCount[5])); // Write the results to the log Application::Log(results); @@ -234,7 +232,7 @@ void TranslateHiriseEdrLabels(FileName &labelFile, Cube *ocube) { // Get the directory where the MRO HiRISE translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Mro"] + "/translations/"; + QString transDir = (QString) dataDir["Mro"] + "/translations/"; // Get a filename for the HiRISE EDR label Pvl labelPvl(labelFile.expanded()); @@ -257,7 +255,7 @@ void TranslateHiriseEdrLabels(FileName &labelFile, Cube *ocube) { // Create the Instrument group keyword CcdId from the ProductId // SCS 28-03-06 Do it in the instrument translation table instead of here // PvlGroup &archiveGroup(outLabel.FindGroup("Archive", Pvl::Traverse)); -// IString productId = (string)archiveGroup.FindKeyword("ProductId"); +// QString productId = (QString)archiveGroup.FindKeyword("ProductId"); // productId.Token("_"); // productId.Token("_"); // productId = productId.Token("_"); diff --git a/isis/src/mro/apps/hical/GainChannelNormalize.h b/isis/src/mro/apps/hical/GainChannelNormalize.h index d9e8bd4862..93059ee18e 100644 --- a/isis/src/mro/apps/hical/GainChannelNormalize.h +++ b/isis/src/mro/apps/hical/GainChannelNormalize.h @@ -1,4 +1,4 @@ -#if !defined(GainChannelNormalize_h) +#ifndef GainChannelNormalize_h #define GainChannelNormalize_h /** * @file diff --git a/isis/src/mro/apps/hical/GainFlatField.h b/isis/src/mro/apps/hical/GainFlatField.h index 4ea926c28b..6bd25700cb 100644 --- a/isis/src/mro/apps/hical/GainFlatField.h +++ b/isis/src/mro/apps/hical/GainFlatField.h @@ -1,4 +1,4 @@ -#if !defined(GainFlatField_h) +#ifndef GainFlatField_h #define GainFlatField_h /** * @file @@ -74,7 +74,7 @@ namespace Isis { const Statistics &Stats() const { return (_stats); } private: - std::string _amatrix; + QString _amatrix; Statistics _stats; // Stats Results void init(const HiCalConf &conf) { diff --git a/isis/src/mro/apps/hical/GainLineDrift.h b/isis/src/mro/apps/hical/GainLineDrift.h index 442c4221bf..2093426276 100644 --- a/isis/src/mro/apps/hical/GainLineDrift.h +++ b/isis/src/mro/apps/hical/GainLineDrift.h @@ -1,4 +1,4 @@ -#if !defined(GainLineDrift_h) +#ifndef GainLineDrift_h #define GainLineDrift_h /** * @file @@ -65,7 +65,7 @@ namespace Isis { virtual ~GainLineDrift() { } private: - std::string _gdfile; + QString _gdfile; int _ccd; int _channel; HiVector _coefs; diff --git a/isis/src/mro/apps/hical/GainNonLinearity.h b/isis/src/mro/apps/hical/GainNonLinearity.h index 1433256327..27b4f4edfb 100644 --- a/isis/src/mro/apps/hical/GainNonLinearity.h +++ b/isis/src/mro/apps/hical/GainNonLinearity.h @@ -1,4 +1,4 @@ -#if !defined(GainNonLinearity_h) +#ifndef GainNonLinearity_h #define GainNonLinearity_h /** * @file @@ -64,7 +64,7 @@ namespace Isis { virtual ~GainNonLinearity() { } private: - std::string _gainFile; + QString _gainFile; double _gainFactor; // Temperature factor void init(const HiCalConf &conf) { diff --git a/isis/src/mro/apps/hical/GainTemperature.h b/isis/src/mro/apps/hical/GainTemperature.h index da3456c2c7..3c641a15aa 100644 --- a/isis/src/mro/apps/hical/GainTemperature.h +++ b/isis/src/mro/apps/hical/GainTemperature.h @@ -1,4 +1,4 @@ -#if !defined(GainTemperature_h) +#ifndef GainTemperature_h #define GainTemperature_h /** * @file @@ -71,7 +71,7 @@ namespace Isis { virtual ~GainTemperature() { } private: - std::string _fpaFile; + QString _fpaFile; double _refTemp; // Reference temperature double _fpaFactor; // Temperature factor double _baseT; // Base temperature @@ -86,7 +86,7 @@ namespace Isis { _fpaFactor = factor[0]; // Get temperature parameters - _refTemp = ConfKey(prof, "FpaReferenceTemperature", 21.0); + _refTemp = toDouble(ConfKey(prof, "FpaReferenceTemperature", toString(21.0))); double fpa_py_temp = ToDouble(prof("FpaPositiveYTemperature")); double fpa_my_temp = ToDouble(prof("FpaNegativeYTemperature")); diff --git a/isis/src/mro/apps/hical/GainUnitConversion.h b/isis/src/mro/apps/hical/GainUnitConversion.h index 8716e24ef5..40970db373 100644 --- a/isis/src/mro/apps/hical/GainUnitConversion.h +++ b/isis/src/mro/apps/hical/GainUnitConversion.h @@ -1,4 +1,4 @@ -#if !defined(GainUnitConversion_h) +#ifndef GainUnitConversion_h #define GainUnitConversion_h /** * @file @@ -56,7 +56,7 @@ namespace Isis { public: // Constructors and Destructor GainUnitConversion() : Module("GainUnitConversion"), _units("DN") { } - GainUnitConversion(HiCalConf &conf, const std::string &units) : + GainUnitConversion(HiCalConf &conf, const QString &units) : Module("GainUnitConversion"), _units(units) { init(conf); } @@ -65,7 +65,7 @@ namespace Isis { virtual ~GainUnitConversion() { } private: - std::string _units; + QString _units; void init(HiCalConf &conf) { _history.clear(); diff --git a/isis/src/mro/apps/hical/HiBlob.h b/isis/src/mro/apps/hical/HiBlob.h index 91f25aa016..bf19492944 100644 --- a/isis/src/mro/apps/hical/HiBlob.h +++ b/isis/src/mro/apps/hical/HiBlob.h @@ -1,4 +1,4 @@ -#if !defined(HiBlob_h) +#ifndef HiBlob_h #define HiBlob_h /** * @file @@ -59,9 +59,9 @@ namespace Isis { /** * @brief Constructor providing interface to an ISIS Cube object */ - HiBlob(Cube &cube, const std::string &tblname, - const std::string &field, - const std::string &name = "HiBlob") : + HiBlob(Cube &cube, const QString &tblname, + const QString &field, + const QString &name = "HiBlob") : Blobber(cube, tblname, field, name) { } /** Destructor */ diff --git a/isis/src/mro/apps/hical/HiCalConf.cpp b/isis/src/mro/apps/hical/HiCalConf.cpp index 311f1b8e27..dbe6120c02 100644 --- a/isis/src/mro/apps/hical/HiCalConf.cpp +++ b/isis/src/mro/apps/hical/HiCalConf.cpp @@ -69,7 +69,7 @@ bool HiCalConf::_naifLoaded = false; * @param label Label from HiRISE cube file * @param conf Name of configuration file to use */ - HiCalConf::HiCalConf(Pvl &label, const std::string &conf) : + HiCalConf::HiCalConf(Pvl &label, const QString &conf) : DbAccess(Pvl(filepath(conf)).FindObject("Hical", PvlObject::Traverse)) { _profName.clear(); init(label); @@ -95,13 +95,13 @@ bool HiCalConf::_naifLoaded = false; * * @param fname File specification with or without versioning patterns * - * @return string Expanded filename but not the filepath + * @return QString Expanded filename but not the filepath */ - string HiCalConf::filepath(const std::string &fname) const { + QString HiCalConf::filepath(const QString &fname) const { FileName efile(fname); if (efile.isVersioned()) { - string path(efile.originalPath()); - if (!path.empty()) path += "/"; + QString path(efile.originalPath()); + if (!path.isEmpty()) path += "/"; efile = efile.highestVersion(); @@ -120,7 +120,7 @@ bool HiCalConf::_naifLoaded = false; * * @param conf Name of configuration file to use */ - void HiCalConf::setConf(const std::string &conf) { + void HiCalConf::setConf(const QString &conf) { load(Pvl(filepath(conf)).FindObject("Hical", PvlObject::Traverse)); } @@ -133,7 +133,7 @@ bool HiCalConf::_naifLoaded = false; * * @param profile Name of existing profile in the configuration file */ - void HiCalConf::selectProfile(const std::string &profile) { + void HiCalConf::selectProfile(const QString &profile) { _profName = profile; return; } @@ -143,9 +143,9 @@ bool HiCalConf::_naifLoaded = false; * * This method returns the selected profile name. * - * @return string Selected profile name + * @return QString Selected profile name */ - string HiCalConf::getProfileName() const { + QString HiCalConf::getProfileName() const { return (_profName); } @@ -155,14 +155,14 @@ bool HiCalConf::_naifLoaded = false; * This method returns the name of a matrix file reference variable from the * \b Matrices keyword as determined from the fully option profile. It then * expands the filename portion (not the filepath!) and returns the result as - * a string for subsequent use. See also getMatrixList and getMatrix. + * a QString for subsequent use. See also getMatrixList and getMatrix. * * @param name Name of Matrix to resolve. It must be one in the \b Matrices * keyword from the configuration file * - * @return std::string The expanded file name reference for the matrix + * @return QString The expanded file name reference for the matrix */ - std::string HiCalConf::getMatrixSource(const std::string &name) const { + QString HiCalConf::getMatrixSource(const QString &name) const { return (getMatrixSource(name, getMatrixProfile())); } @@ -172,18 +172,18 @@ bool HiCalConf::_naifLoaded = false; * This method returns the name of a matrix file reference variable from the * \b Matrices keyword as determined from the specified profile. It then * expands the filename portion (not the filepath!) and returns the result as - * a string for subsequent use. See also getMatrixList and getMatrix. + * a QString for subsequent use. See also getMatrixList and getMatrix. * * @param name Name of Matrix to resolve. It must be one in the \b Matrices * keyword from the configuration file * @param matconf Profile to extract the named matrix source from * - * @return std::string The expanded file name reference for the matrix + * @return QString The expanded file name reference for the matrix */ - std::string HiCalConf::getMatrixSource(const std::string &name, + QString HiCalConf::getMatrixSource(const QString &name, const DbProfile &matconf) const { - std::string mfile = parser(matconf.value(name), + QString mfile = parser(matconf.value(name), getList(matconf,"OptionKeywords"), matconf); @@ -191,13 +191,13 @@ bool HiCalConf::_naifLoaded = false; return (filepath(mfile)); } - HiVector HiCalConf::getMatrix(const std::string &name, + HiVector HiCalConf::getMatrix(const QString &name, int expected_size) const { return (getMatrix(name,getMatrixProfile(), expected_size)); } - std::string HiCalConf::resolve(const std::string &composite, + QString HiCalConf::resolve(const QString &composite, const DbProfile &matconf) const { return (parser(composite,getList(matconf,"OptionKeywords"), matconf)); } @@ -227,11 +227,11 @@ bool HiCalConf::_naifLoaded = false; * * @return HiCalConf::HiVector Returns the extracted band from the cube */ - HiVector HiCalConf::getMatrix(const std::string &name, + HiVector HiCalConf::getMatrix(const QString &name, const DbProfile &profile, int expected_size) const { - std::string mfile = getMatrixSource(name, profile); + QString mfile = getMatrixSource(name, profile); // Crack the file and read the appropriate band Cube cube; @@ -277,7 +277,7 @@ bool HiCalConf::_naifLoaded = false; * * @return HiCalConf::HiVector Values of scalar constants */ - HiVector HiCalConf::getScalar(const std::string &name, + HiVector HiCalConf::getScalar(const QString &name, const DbProfile &profile, int expected_size) const { int nvals = profile.count(name); @@ -311,20 +311,20 @@ bool HiCalConf::_naifLoaded = false; double HiCalConf::sunDistanceAU() { loadNaifTiming(); - string scStartTime = getKey("SpacecraftClockStartCount", "Instrument"); + QString scStartTime = getKey("SpacecraftClockStartCount", "Instrument"); double obsStartTime; - scs2e_c (-74999,scStartTime.c_str(),&obsStartTime); + scs2e_c (-74999,scStartTime.toAscii().data(),&obsStartTime); - string targetName = getKey("TargetName", "Instrument"); - if ( (IString::Equal(targetName, "Sky")) || - (IString::Equal(targetName, "Cal")) || - (IString::Equal(targetName, "Phobos")) || - (IString::Equal(targetName, "Deimos")) ) { + QString targetName = getKey("TargetName", "Instrument"); + if ( targetName.toLower() == "sky" || + targetName.toLower() == "cal" || + targetName.toLower() == "phobos" || + targetName.toLower() == "deimos" ) { targetName = "Mars"; } double sunv[3]; double lt; - (void) spkpos_c(targetName.c_str(), obsStartTime, "J2000", "LT+S", "sun", + (void) spkpos_c(targetName.toAscii().data(), obsStartTime, "J2000", "LT+S", "sun", sunv, <); double sunkm = vnorm_c(sunv); // Return in AU units @@ -373,16 +373,16 @@ bool HiCalConf::_naifLoaded = false; * @brief Generic profile keyword value extractor * * This method retrieves a profile keyword from the given profile and returns - * all its values a a list of strings. An exception will be thrown + * all its values a a list of QStrings. An exception will be thrown * incidentally if the keyword does not exist. * * @param profile Profile containing the keyword to extract * @param key Name of keyword to retrieve * - * @return std::vector List of values from profile keyword + * @return std::vector List of values from profile keyword */ HiCalConf::ValueList HiCalConf::getList(const DbProfile &profile, - const std::string &key) const { + const QString &key) const { ValueList slist; // Get keyword parameters @@ -414,12 +414,12 @@ void HiCalConf::loadNaifTiming( ) { pck = pck.highestVersion(); // Load the kernels - string lsk = leapseconds.expanded(); - string sClock = sclk.expanded(); - string pConstants = pck.expanded(); - furnsh_c(lsk.c_str()); - furnsh_c(sClock.c_str()); - furnsh_c(pConstants.c_str()); + QString lsk = leapseconds.expanded(); + QString sClock = sclk.expanded(); + QString pConstants = pck.expanded(); + furnsh_c(lsk.toAscii().data()); + furnsh_c(sClock.toAscii().data()); + furnsh_c(pConstants.toAscii().data()); // Ensure it is loaded only once _naifLoaded = true; @@ -461,9 +461,9 @@ void HiCalConf::init(Pvl &label) { * * @return PvlKeyword& Reference to retrieved label keyword */ -PvlKeyword &HiCalConf::getKey(const std::string &key, - const std::string &group) { - if (!group.empty()) { +PvlKeyword &HiCalConf::getKey(const QString &key, + const QString &group) { + if (!group.isEmpty()) { PvlGroup &grp = _label.FindGroup(group, Pvl::Traverse); return (grp[key]); } @@ -490,8 +490,8 @@ PvlKeyword &HiCalConf::getKey(const std::string &key, * default profile if this parameter is not provided (empty). * @return DbProfile Returns a fully optioned profile */ -DbProfile HiCalConf::getMatrixProfile(const std::string &profile) const { - string myprof = (!profile.empty()) ? profile : _profName; +DbProfile HiCalConf::getMatrixProfile(const QString &profile) const { + QString myprof = (!profile.isEmpty()) ? profile : _profName; DbProfile matconf = getProfile(myprof); if (!matconf.isValid()) { ostringstream mess; @@ -509,9 +509,9 @@ DbProfile HiCalConf::getMatrixProfile(const std::string &profile) const { // Load any optional ones ValueList profkeys = getList(matconf,"OptionKeywords"); ValueList proforder = getList(matconf,"ProfileOptions"); - string pName(matconf.Name()); + QString pName(matconf.Name()); for (unsigned int i = 0 ; i < proforder.size() ; i++) { - std::string profile = parser(proforder[i], profkeys, matconf); + QString profile = parser(proforder[i], profkeys, matconf); if (profileExists(profile)) { pName += "+[" + profile + "]"; matconf = DbProfile(matconf,getProfile(profile), pName); @@ -527,7 +527,7 @@ DbProfile HiCalConf::getLabelProfile(const DbProfile &profile) const { int ngroups = profile.count("LabelGroups"); Pvl label = _label; for ( int g = 0 ; g < ngroups ; g++ ) { - string group = profile("LabelGroups", g); + QString group = profile("LabelGroups", g); PvlGroup grp = label.FindGroup(group, Pvl::Traverse); lblprof = DbProfile(lblprof,DbProfile(grp)); } @@ -567,30 +567,30 @@ DbProfile HiCalConf::makeParameters(const DbProfile &profile) const { return (parms); } -std::string HiCalConf::makePattern(const std::string &str) const { - return (string("{" + str + "}")); +QString HiCalConf::makePattern(const QString &str) const { + return (QString("{" + str + "}")); } /** - * @brief Performs a search and replace operation for the given string + * @brief Performs a search and replace operation for the given QString * - * This method will search the input string s for predefined keywords (FILTER, + * This method will search the input QString s for predefined keywords (FILTER, * TDI, BIN, CCD and CHANNEL) delimited by {} and replace these occurances with * the textual equivalent. * * @param s String to conduct search/replace of values * - * @return std::string Results of search/replace + * @return QString Results of search/replace */ -std::string HiCalConf::parser(const std::string &s, const ValueList &vlist, +QString HiCalConf::parser(const QString &s, const ValueList &vlist, const DbProfile &prof) const { - string sout(s); + QString sout(s); ValueList::const_iterator ciVlist; for ( ciVlist = vlist.begin() ; ciVlist != vlist.end() ; ++ciVlist ) { - std::string str(*ciVlist); + QString str(*ciVlist); if ( prof.exists(str) ) { - sout = IString::Replace(sout, makePattern(str), prof(str)); + sout = sout.replace(makePattern(str), prof(str)); } } diff --git a/isis/src/mro/apps/hical/HiCalConf.h b/isis/src/mro/apps/hical/HiCalConf.h index eeb9b6761c..075a9408b0 100644 --- a/isis/src/mro/apps/hical/HiCalConf.h +++ b/isis/src/mro/apps/hical/HiCalConf.h @@ -1,4 +1,4 @@ -#if !defined(HiCalConf_h) +#ifndef HiCalConf_h #define HiCalConf_h /** * @file @@ -92,53 +92,53 @@ namespace Isis { class HiCalConf : public DbAccess { public: typedef enum { Matrix, Scalar, Keyword } CalType; - typedef std::vector ValueList; + typedef std::vector ValueList; public: // Constructors and Destructor HiCalConf(); HiCalConf(Pvl &label); - HiCalConf(Pvl &label, const std::string &conf); + HiCalConf(Pvl &label, const QString &conf); /** Destructor ensures everything is cleaned up properly */ virtual ~HiCalConf () { } void setLabel(Pvl &label); - PvlKeyword &getKey(const std::string &key, const std::string &group = ""); + PvlKeyword &getKey(const QString &key, const QString &group = ""); - std::string filepath(const std::string &fname) const; - void setConf(const std::string &conf); - void selectProfile(const std::string &profile = ""); + QString filepath(const QString &fname) const; + void setConf(const QString &conf); + void selectProfile(const QString &profile = ""); - std::string getProfileName() const; - std::string getMatrixSource(const std::string &name) const; - std::string getMatrixSource(const std::string &name, + QString getProfileName() const; + QString getMatrixSource(const QString &name) const; + QString getMatrixSource(const QString &name, const DbProfile &matconf) const; - HiVector getMatrix(const std::string &name, int expected_size = 0) const; - HiVector getMatrix(const std::string &name, const DbProfile &profile, + HiVector getMatrix(const QString &name, int expected_size = 0) const; + HiVector getMatrix(const QString &name, const DbProfile &profile, int expected_size = 0) const; - HiVector getScalar(const std::string &name, const DbProfile &profile, + HiVector getScalar(const QString &name, const DbProfile &profile, int expected_size) const; int getMatrixBand() const; int getMatrixBand(const DbProfile &p) const; double sunDistanceAU(); - DbProfile getMatrixProfile(const std::string &profile = "") const; - ValueList getList(const DbProfile &profile, const std::string &key) const; - std::string resolve(const std::string &composite, + DbProfile getMatrixProfile(const QString &profile = "") const; + ValueList getList(const DbProfile &profile, const QString &key) const; + QString resolve(const QString &composite, const DbProfile &matconf) const; private: static bool _naifLoaded; //!< Ensures one instance of NAIF kernels - std::string _profName; //!< Specified name of profile + QString _profName; //!< Specified name of profile Pvl _label; //!< Hold label for future references int _ccd; //!< CCD Number int _channel; //!< Channel number int _tdi; //!< TDI mode of operation int _binMode; //!< Binning mode - std::string _filter; //!< Filter set name (RED, IR, BG) + QString _filter; //!< Filter set name (RED, IR, BG) void init(); @@ -148,8 +148,8 @@ namespace Isis { int getChannelIndex(const int &ccd, const int &channel) const; DbProfile makeParameters(Pvl &label) const; DbProfile makeParameters(const DbProfile &profile) const; - std::string makePattern(const std::string &str) const; - std::string parser(const std::string &s, const ValueList &options, + QString makePattern(const QString &str) const; + QString parser(const QString &s, const ValueList &options, const DbProfile &prof ) const; }; diff --git a/isis/src/mro/apps/hical/HiCalData.h b/isis/src/mro/apps/hical/HiCalData.h index 0d0e206779..0192fec00b 100644 --- a/isis/src/mro/apps/hical/HiCalData.h +++ b/isis/src/mro/apps/hical/HiCalData.h @@ -1,4 +1,4 @@ -#if !defined(HiCalData_h) +#ifndef HiCalData_h #define HiCalData_h /** * @file diff --git a/isis/src/mro/apps/hical/HiCalTypes.h b/isis/src/mro/apps/hical/HiCalTypes.h index 0aa9f7c22c..9b99025987 100644 --- a/isis/src/mro/apps/hical/HiCalTypes.h +++ b/isis/src/mro/apps/hical/HiCalTypes.h @@ -1,4 +1,4 @@ -#if !defined(HiCalTypes_h) +#ifndef HiCalTypes_h #define HiCalTypes_h /** * @file @@ -53,8 +53,12 @@ class HiHistory { * @return std::ostream& Returns new state of stream */ friend std::ostream &operator<<(std::ostream &o, const HiHistory &h) { - std::copy(h._events.begin(), h._events.end(), - std::ostream_iterator(o,"; ")); + std::vector::const_iterator it = h._events.begin(); + + while (it != h._events.end()) { + o << *it << "; "; + it++; + } return (o); } @@ -64,19 +68,19 @@ class HiHistory { virtual ~HiHistory() { } inline int size() const { return (_events.size()); } - void add(const std::string &event) { _events.push_back(event); } - std::string get(unsigned int index = 0) const { + void add(const QString &event) { _events.push_back(event); } + QString get(unsigned int index = 0) const { if (index < _events.size()) { return (_events[index]); } else { - return (std::string("")); + return (QString("")); } } void clear() { _events.clear(); } - PvlKeyword makekey(const std::string &name = "History") const { + PvlKeyword makekey(const QString &name = "History") const { PvlKeyword key(name); for (unsigned int i = 0 ; i < _events.size() ; i++) { key.AddValue(_events[i]); @@ -85,7 +89,7 @@ class HiHistory { } private: - std::vector _events; + std::vector _events; }; }; diff --git a/isis/src/mro/apps/hical/HiCalUtil.h b/isis/src/mro/apps/hical/HiCalUtil.h index 2fc228e1b7..2b7275f483 100644 --- a/isis/src/mro/apps/hical/HiCalUtil.h +++ b/isis/src/mro/apps/hical/HiCalUtil.h @@ -1,4 +1,4 @@ -#if !defined(HiCalUtil_h) +#ifndef HiCalUtil_h #define HiCalUtil_h /** * @file @@ -85,8 +85,8 @@ inline int InValidCount(const HiVector &v) { inline int CpmmToCcd(int cpmm) { const int cpmm2ccd[] = {0,1,2,3,12,4,10,11,5,13,6,7,8,9}; if ( (cpmm < 0) || (cpmm >= (int)(sizeof(cpmm2ccd)/sizeof(int))) ) { - std::string mess = "CpmmToCdd: Bad CpmmNumber (" + IString(cpmm) + ")"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString mess = "CpmmToCdd: Bad CpmmNumber (" + toString(cpmm) + ")"; + throw IException(IException::User, mess, _FILEINFO_); } return (cpmm2ccd[cpmm]); } @@ -97,13 +97,13 @@ inline int CpmmToCcd(int cpmm) { * * @param ccd Ccd number of device */ -inline std::string CcdToFilter(int ccd) { +inline QString CcdToFilter(int ccd) { if ( (ccd < 0) || (ccd > 13) ) { - std::string mess = "CcdToFilter: Bad Ccd Number (" + IString(ccd) + ")"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString mess = "CcdToFilter: Bad Ccd Number (" + QString(ccd) + ")"; + throw IException(IException::User, mess, _FILEINFO_); } - std::string filter; + QString filter; if ( ccd <= 9 ) { filter = "RED"; } else if (ccd <= 11) { filter = "IR"; } else { filter = "BG"; } @@ -216,11 +216,11 @@ inline HiVector averageSamples(const HiMatrix &m, int ssamp = 0, * */ template - T ConfKey(const DbProfile &conf, const std::string &keyname, const T &defval, + T ConfKey(const DbProfile &conf, const QString &keyname, const T &defval, int index = 0) { if (!conf.exists(keyname)) { return (defval); } if (conf.count(keyname) < index) { return (defval); } - IString iValue(conf.value(keyname, index)); + QString iValue(conf.value(keyname, index)); T value = iValue; // This makes it work with a string? return (value); } @@ -234,7 +234,7 @@ template * @return int Converted value */ template int ToInteger(const T &value) { - return (IString(value).Trim(" \r\t\n").ToInteger()); + return (QString(value).trimmed().toInt()); } /** @@ -246,7 +246,7 @@ template int ToInteger(const T &value) { * @return double Converted value */ template double ToDouble(const T &value) { - return (IString(value).Trim(" \r\t\n").ToDouble()); + return (QString(value).trimmed().toDouble()); } /** @@ -257,8 +257,8 @@ template double ToDouble(const T &value) { * * @return string Converted value */ -template std::string ToString(const T &value) { - return (IString(value).Trim(" \r\t\n")); +template QString ToString(const T &value) { + return (toString(value).trimmed()); } /** @@ -269,8 +269,8 @@ template std::string ToString(const T &value) { * * @return bool True if they are equal w/o regard to case */ -inline bool IsEqual(const std::string &v1, const std::string &v2 = "TRUE") { - return (IString::UpCase(v1) == IString::UpCase(v2)); +inline bool IsEqual(const QString &v1, const QString &v2 = "TRUE") { + return (v1.toUpper() == v2.toUpper()); } /** @@ -287,8 +287,8 @@ inline bool IsEqual(const std::string &v1, const std::string &v2 = "TRUE") { * @return bool Returns true only if the keyword exists in the profile and it is * the value expected. */ -inline bool IsTrueValue(const DbProfile &prof, const std::string &key, - const std::string &value = "TRUE") { +inline bool IsTrueValue(const DbProfile &prof, const QString &key, + const QString &value = "TRUE") { if ( prof.exists(key) ) { return (IsEqual(prof(key), value)); } @@ -463,10 +463,10 @@ inline HiVector rebin(const HiVector &v, int n) { inline void RemoveHiBlobs(Pvl &label) { for ( int blob = 0 ; blob < label.Objects() ; blob++ ) { if ( label.Object(blob).IsNamed("Table") ) { - std::string name = label.Object(blob)["Name"][0]; - if ( IString::Equal(name,"HiRISE Calibration Ancillary") || - IString::Equal(name,"HiRISE Calibration Image") || - IString::Equal(name,"HiRISE Ancillary") ) { + QString name = label.Object(blob)["Name"][0]; + if ( name.toLower() == "hirise calibration ancillary" || + name.toLower() == "hirise calibration image" || + name.toLower() == "hirise ancillary" ) { label.DeleteObject(blob); blob--; } diff --git a/isis/src/mro/apps/hical/LoadCSV.cpp b/isis/src/mro/apps/hical/LoadCSV.cpp index c5843791c1..951e6fa95a 100644 --- a/isis/src/mro/apps/hical/LoadCSV.cpp +++ b/isis/src/mro/apps/hical/LoadCSV.cpp @@ -38,13 +38,13 @@ namespace Isis { LoadCSV::LoadCSV() : _base(), _csvSpecs("LoadCSV"), _data(0,0), _history() { } - LoadCSV::LoadCSV(const std::string &base, const HiCalConf &conf, + LoadCSV::LoadCSV(const QString &base, const HiCalConf &conf, const DbProfile &profile) : _base(), _csvSpecs("LoadCSV"), _data(0,0), _history() { load(base, conf, profile); } - void LoadCSV::load(const std::string &base, const HiCalConf &conf, + void LoadCSV::load(const QString &base, const HiCalConf &conf, const DbProfile &profile) { // Initialize the object with necessary info @@ -53,12 +53,12 @@ namespace Isis { // Set up access to the CSV table. Note that HiCalConf.getMatrixSource() // method is typically used, but the parsing has been broken up here for // implementation purposes. - string csvfile(conf.filepath(getValue())); + QString csvfile(conf.filepath(getValue())); addHistory("File", csvfile); CSVReader csv; // Retrieve information regarding the format within the CSV - bool colHeader(IsEqual(ConfKey(_csvSpecs,makeKey("Header"), string("FALSE")), "TRUE")); + bool colHeader(IsEqual(ConfKey(_csvSpecs,makeKey("Header"), QString("FALSE")), "TRUE")); bool rowHeader(colHeader); // Both default to state of the {BASE}Header if (IsEqual(getValue("ColumnHeader"), "TRUE")) colHeader = true; if (IsEqual(getValue("RowHeader"), "TRUE")) rowHeader = true; @@ -66,17 +66,17 @@ namespace Isis { if (_csvSpecs.exists(makeKey("RowName") )) rowHeader = true; // Skip lines, comment headers and separator - int skip = ConfKey(_csvSpecs, makeKey("SkipLines"), 0); + int skip = toInt(ConfKey(_csvSpecs, makeKey("SkipLines"), toString(0))); addHistory("SkipLines", ToString(skip)); - bool comments = IsEqual(ConfKey(_csvSpecs, makeKey("IgnoreComments"), string("TRUE"))); - string separator = ConfKey(_csvSpecs, makeKey("Separator"), string(",")); - if (separator.empty()) separator = ","; // Guarantees content + bool comments = IsEqual(ConfKey(_csvSpecs, makeKey("IgnoreComments"), QString("TRUE"))); + QString separator = ConfKey(_csvSpecs, makeKey("Separator"), QString(",")); + if (separator.isEmpty()) separator = ","; // Guarantees content // Apply conditions csv.setComment(comments); csv.setSkip(skip); csv.setHeader(colHeader); - csv.setDelimiter(separator[0]); + csv.setDelimiter(separator[0].toAscii()); if (separator[0] == ' ') csv.setSkipEmptyParts(); // Now read the file @@ -85,7 +85,7 @@ namespace Isis { try { csv.read(csvfile); } catch (IException &ie) { - string mess = "Could not read CSV file \'" + csvfile + "\'"; + QString mess = "Could not read CSV file \'" + csvfile + "\'"; throw IException(IException::User, mess, _FILEINFO_); } @@ -98,20 +98,20 @@ namespace Isis { int startRow(0), endRow(nrows-1); // Update columns - string colName(getValue("ColumnName")); - if (!colName.empty()) { + QString colName(getValue("ColumnName")); + if (!colName.isEmpty()) { addHistory("ColumnName", colName); CSVReader::CSVAxis chead = csv.getHeader(); startColumn = getAxisIndex(colName, chead); if (startColumn < 0) { - string mess = "Column name " + colName + - " not found in CSV file " + csvfile; + QString mess = "Column name " + colName + + " not found in CSV file " + csvfile; throw IException(IException::User, mess, _FILEINFO_); } endColumn = startColumn; addHistory("ColumnIndex", ToString(startColumn)); } - else if (!(getValue("ColumnIndex").empty())) { + else if (!(getValue("ColumnIndex").isEmpty())) { startColumn = ToInteger(getValue("ColumnIndex")) + ((rowHeader) ? 1 : 0); endColumn = startColumn; @@ -120,8 +120,8 @@ namespace Isis { } // Update row indicies - string rowName(getValue("RowName")); - if (!rowName.empty()) { + QString rowName(getValue("RowName")); + if (!rowName.isEmpty()) { addHistory("RowName", rowName); if (!rowHeader) { string mess = "Row name given but config does not specify presence of row header!"; @@ -130,13 +130,13 @@ namespace Isis { CSVReader::CSVAxis rhead = csv.getColumn(0); startRow = getAxisIndex(rowName, rhead); if (startRow < 0) { - string mess = "Row name " + rowName + " not found in CSV file " + csvfile; + QString mess = "Row name " + rowName + " not found in CSV file " + csvfile; throw IException(IException::User, mess, _FILEINFO_); } endRow = startRow; addHistory("RowIndex", ToString(startRow)); } - else if (!(getValue("RowIndex").empty())) { + else if (!(getValue("RowIndex").isEmpty())) { startRow = ToInteger(getValue("RowIndex")); if (rowHeader) startRow++; endRow = startRow; @@ -148,7 +148,7 @@ namespace Isis { int drows(endRow-startRow+1); int dcols(endColumn-startColumn+1); HiMatrix d(drows, dcols); - vector errors; + vector errors; for (int r = startRow, hr = 0 ; r <= endRow ; r++, hr++) { CSVReader::CSVAxis row = csv.getRow(r); for (int c = startColumn, hc = 0 ; c <= endColumn ; c++, hc++) { @@ -158,10 +158,10 @@ namespace Isis { catch (...) { std::ostringstream mess; mess << "Invalid real value (" << row[c] << ") in row index " << r; - if (!rowName.empty()) mess << " (Name:" << rowName << ")"; + if (!rowName.isEmpty()) mess << " (Name:" << rowName << ")"; mess << ", column index " << c; - if (!colName.empty()) mess << " (Name:" << colName << ")"; - errors.push_back(mess.str()); + if (!colName.isEmpty()) mess << " (Name:" << colName << ")"; + errors.push_back(mess.str().c_str()); d[hr][hc] = Null; } } @@ -175,15 +175,20 @@ namespace Isis { //iException::Clear(); Not sure how this could ever do anything std::ostringstream mess; mess << "Conversion errors in CSV file " + csvfile + ": Errors: "; - std::copy(errors.begin(), errors.end(), - std::ostream_iterator(mess,"; ")); + + std::vector::const_iterator it = errors.begin(); + + while (it != errors.end()) { + mess << *it << "; "; + it++; + } throw IException(IException::User, mess.str(), _FILEINFO_); } return; } - std::string LoadCSV::filename() const { + QString LoadCSV::filename() const { return (getValue()); } @@ -222,11 +227,11 @@ namespace Isis { comma = ","; } mess << ")"; - history.add(mess.str()); + history.add(mess.str().c_str()); return; } - void LoadCSV::init(const std::string &base, const HiCalConf &conf, + void LoadCSV::init(const QString &base, const HiCalConf &conf, const DbProfile &profile) { _base = base; _csvSpecs = ResolveKeys(base, conf, profile); @@ -234,15 +239,15 @@ namespace Isis { return; } - void LoadCSV::addHistory(const std::string &element, - const std::string &desc) { + void LoadCSV::addHistory(const QString &element, + const QString &desc) { std::ostringstream mess; mess << element << "[" << desc << "]"; - _history.push_back(mess.str()); + _history.push_back(mess.str().c_str()); } - void LoadCSV::getKeyList(const std::string &base, - std::vector &keys) const { + void LoadCSV::getKeyList(const QString &base, + std::vector &keys) const { keys.clear(); keys.push_back(base); keys.push_back(base+"IgnoreComments"); @@ -258,44 +263,44 @@ namespace Isis { return; } - DbProfile LoadCSV::ResolveKeys(const std::string &base, const HiCalConf &conf, + DbProfile LoadCSV::ResolveKeys(const QString &base, const HiCalConf &conf, const DbProfile &prof) const { - vector keys; + vector keys; getKeyList(base, keys); DbProfile keyprof("LoadCSV"); for (unsigned int i = 0 ; i < keys.size() ; i++) { - string kvalue = ParsedKey(keys[i], conf, prof); - if (!kvalue.empty()) keyprof.add(keys[i], kvalue); + QString kvalue = ParsedKey(keys[i], conf, prof); + if (!kvalue.isEmpty()) keyprof.add(keys[i], kvalue); } return (keyprof); } - std::string LoadCSV::ParsedKey(const std::string &key, const HiCalConf &conf, + QString LoadCSV::ParsedKey(const QString &key, const HiCalConf &conf, const DbProfile &prof) const { - string value(""); + QString value(""); if (prof.exists(key)) { value = conf.resolve(prof(key), prof); } return (value); } - std::string LoadCSV::makeKey(const std::string &suffix) const { - string key = _base + suffix; + QString LoadCSV::makeKey(const QString &suffix) const { + QString key = _base + suffix; return (key); } - std::string LoadCSV::getValue(const std::string &suffix) const { - string key = makeKey(suffix); - string value(""); + QString LoadCSV::getValue(const QString &suffix) const { + QString key = makeKey(suffix); + QString value(""); if (_csvSpecs.exists(key)) value = _csvSpecs(key); return (value); } - int LoadCSV::getAxisIndex(const std::string &name, + int LoadCSV::getAxisIndex(const QString &name, const CSVReader::CSVAxis &header) const { - std::string head = IString(name).Trim(" \r\n\t"); + QString head = QString(name).trimmed(); for (int i = 0 ; i < header.dim() ; i++) { - if (IString::Equal(head,IString(header[i]).Trim(" \r\n\t"))) { + if (head.toLower() == QString(header[i]).toLower().trimmed()) { return (i); } } diff --git a/isis/src/mro/apps/hical/LoadCSV.h b/isis/src/mro/apps/hical/LoadCSV.h index c548aa76b7..188a3dab8a 100644 --- a/isis/src/mro/apps/hical/LoadCSV.h +++ b/isis/src/mro/apps/hical/LoadCSV.h @@ -1,4 +1,4 @@ -#if !defined(LoadCSV_h) +#ifndef LoadCSV_h #define LoadCSV_h /** * @file @@ -70,16 +70,16 @@ namespace Isis { public: // Constructors and Destructor LoadCSV(); - LoadCSV(const std::string &base, const HiCalConf &conf, + LoadCSV(const QString &base, const HiCalConf &conf, const DbProfile &profile); /** Destructor */ virtual ~LoadCSV() { } - void load(const std::string &base, const HiCalConf &conf, + void load(const QString &base, const HiCalConf &conf, const DbProfile &profile); - std::string filename() const; + QString filename() const; int size() const; bool validateSize(const int &expected, @@ -92,24 +92,24 @@ namespace Isis { void History(HiHistory &history) const; private: - std::string _base; + QString _base; DbProfile _csvSpecs; HiMatrix _data; - std::vector _history; + std::vector _history; - void init(const std::string &base, const HiCalConf &conf, + void init(const QString &base, const HiCalConf &conf, const DbProfile &profile); - void addHistory(const std::string &element, const std::string &desc); - void getKeyList(const std::string &base, std::vector &keys) + void addHistory(const QString &element, const QString &desc); + void getKeyList(const QString &base, std::vector &keys) const; - DbProfile ResolveKeys(const std::string &base, const HiCalConf &conf, + DbProfile ResolveKeys(const QString &base, const HiCalConf &conf, const DbProfile &prof) const; - std::string ParsedKey(const std::string &key, const HiCalConf &conf, + QString ParsedKey(const QString &key, const HiCalConf &conf, const DbProfile &prof) const; - std::string makeKey(const std::string &ksuffix = "") const; - std::string getValue(const std::string &ksuffix = "") const; + QString makeKey(const QString &ksuffix = "") const; + QString getValue(const QString &ksuffix = "") const; HiMatrix extract (const CSVReader &csv); - int getAxisIndex(const std::string &name, + int getAxisIndex(const QString &name, const CSVReader::CSVAxis &header) const; }; diff --git a/isis/src/mro/apps/hical/LowPassFilter.h b/isis/src/mro/apps/hical/LowPassFilter.h index 60050133e8..4cad520ecd 100644 --- a/isis/src/mro/apps/hical/LowPassFilter.h +++ b/isis/src/mro/apps/hical/LowPassFilter.h @@ -1,4 +1,4 @@ -#if !defined(LowPassFilter_h) +#ifndef LowPassFilter_h #define LowPassFilter_h /** * @file @@ -83,8 +83,8 @@ namespace Isis { int _width; //!< Filter width int _iterations; // Number iterations to apply filter - std::string formHistory() { - return (std::string("LowPassFilter(Width[" + ToString(_width) + + QString formHistory() { + return (QString("LowPassFilter(Width[" + ToString(_width) + "],Iters["+ToString(_iterations)+"])")); } diff --git a/isis/src/mro/apps/hical/Module.h b/isis/src/mro/apps/hical/Module.h index b80ed26b55..2b9d381b5b 100644 --- a/isis/src/mro/apps/hical/Module.h +++ b/isis/src/mro/apps/hical/Module.h @@ -1,4 +1,4 @@ -#if !defined(Module_h) +#ifndef Module_h #define Module_h /** * @file @@ -62,13 +62,13 @@ namespace Isis { // Constructors and Destructor Module() : _name("Module"), _csvFile(""), _data(), _history(), _fmtWidth(DefaultWidth), _fmtPrecision(DefaultPrecision) { } - Module(const std::string &name) : _name(name), _csvFile(""), _data(), + Module(const QString &name) : _name(name), _csvFile(""), _data(), _history(),_fmtWidth(DefaultWidth), _fmtPrecision(DefaultPrecision) { } - Module(const std::string &name, const HiHistory &history) : + Module(const QString &name, const HiHistory &history) : _name(name), _csvFile(""), _data(), _history(history), _fmtWidth(DefaultWidth), _fmtPrecision(DefaultPrecision) { } - Module(const std::string &name, const Module &c) : _name(name), + Module(const QString &name, const Module &c) : _name(name), _csvFile(c._csvFile), _data(c._data), _history(c._history), _fmtWidth(c._fmtWidth),_fmtPrecision(c._fmtPrecision) { } Module(const Module &c) : _name(c._name), _csvFile(c._csvFile), @@ -81,9 +81,9 @@ namespace Isis { virtual ~Module() { } /** Returns name of component */ - inline std::string name() const { return (_name); } + inline QString name() const { return (_name); } /** Returns expanded name of last CSV file loaded by loadCsv */ - inline std::string getcsvFile() const { return (_csvFile); } + inline QString getcsvFile() const { return (_csvFile); } /** Returns the size (number of elements) of data array */ inline int size() const { return (_data.dim()); } @@ -113,7 +113,7 @@ namespace Isis { * * @return HiVector */ - HiVector loadCsv(const std::string &csvBase, const HiCalConf &conf, + HiVector loadCsv(const QString &csvBase, const HiCalConf &conf, const DbProfile &prof, const int &elements = 0) { LoadCSV csv(csvBase, conf, prof); _csvFile = csv.filename(); @@ -132,7 +132,7 @@ namespace Isis { /** Record history in Pvl group object */ virtual void record(PvlGroup &pvl, - const std::string keyname = "ModuleHistory") + const QString keyname = "ModuleHistory") const { pvl += _history.makekey(keyname); return; @@ -143,12 +143,12 @@ namespace Isis { * * @param fname Name of file to dump contents to */ - void Dump(const std::string &fname) const { + void Dump(const QString &fname) const { FileName dumpc(fname); - std::string dumpcFile = dumpc.expanded(); - std::ofstream ofile(dumpcFile.c_str(), std::ios::out); + QString dumpcFile = dumpc.expanded(); + std::ofstream ofile(dumpcFile.toAscii().data(), std::ios::out); if (!ofile) { - std::string mess = "Unable to open/create module dump file " + + QString mess = "Unable to open/create module dump file " + dumpc.expanded(); throw IException(IException::User, mess, _FILEINFO_); } @@ -161,8 +161,8 @@ namespace Isis { protected: enum { DefaultWidth = 10, DefaultPrecision = 6}; - std::string _name; //!< Name of component - std::string _csvFile; //!< Fully expanded name of CSV file if present + QString _name; //!< Name of component + QString _csvFile; //!< Fully expanded name of CSV file if present HiVector _data; //!< Data vector HiHistory _history; //!< Hierarchial component history int _fmtWidth; //!< Default field with of double @@ -181,16 +181,16 @@ namespace Isis { * @param[in] (int) prec Precision used to format the value * @return (string) Formatted double value */ - inline std::string formatDbl(const double &value) const { + inline QString formatDbl(const double &value) const { std::ostringstream ostr; if (IsSpecial(value)) { ostr << std::setw(_fmtWidth) << PixelToString(value); - return (std::string(ostr.str())); + return (QString(ostr.str().c_str())); } else { // Its not special so format to callers specs ostr << std::setw(_fmtWidth) << std::setprecision(_fmtPrecision) << value; - return (std::string(ostr.str())); + return (QString(ostr.str().c_str())); } } diff --git a/isis/src/mro/apps/hical/NonLinearLSQ.cpp b/isis/src/mro/apps/hical/NonLinearLSQ.cpp index 501a7b3e52..5cc4e8e624 100644 --- a/isis/src/mro/apps/hical/NonLinearLSQ.cpp +++ b/isis/src/mro/apps/hical/NonLinearLSQ.cpp @@ -93,14 +93,14 @@ int NonLinearLSQ::curvefit() { } -void NonLinearLSQ::Terminate(const std::string &message) { +void NonLinearLSQ::Terminate(const QString &message) { _userMessage = message; _userTerminated = true; _status = GSL_SUCCESS; return; } -void NonLinearLSQ::Abort(const std::string &reason) { +void NonLinearLSQ::Abort(const QString &reason) { _userMessage = reason; _userTerminated = true; _status = GSL_FAILURE; diff --git a/isis/src/mro/apps/hical/NonLinearLSQ.h b/isis/src/mro/apps/hical/NonLinearLSQ.h index 653c6f65fd..14c016bef8 100644 --- a/isis/src/mro/apps/hical/NonLinearLSQ.h +++ b/isis/src/mro/apps/hical/NonLinearLSQ.h @@ -1,4 +1,4 @@ -#if !defined(NonLinearLSQ_h) +#ifndef NonLinearLSQ_h #define NonLinearLSQ_h /** * @file @@ -30,10 +30,12 @@ #include #include -#include "tnt_array1d.h" -#include "tnt_array1d_utils.h" -#include "tnt_array2d.h" -#include "tnt_array2d_utils.h" +#include + +#include +#include +#include +#include #include #include @@ -101,12 +103,12 @@ namespace Isis { /** Check status for success of the given condition */ inline bool success(int status) const { return (status == GSL_SUCCESS); } /** Return error message pertaining to last fit procesing */ - inline std::string statusstr() const { - return (std::string(gsl_strerror(_status))); + inline QString statusstr() const { + return (QString(gsl_strerror(_status))); } /** Return error message given status condition */ - inline std::string statusstr(int status) const { - return (std::string(gsl_strerror(status))); + inline QString statusstr(int status) const { + return (QString(gsl_strerror(status))); } /** Default interation test simply returns input status */ @@ -124,8 +126,8 @@ namespace Isis { inline int nIterations() const { return (_nIters); } protected: - void Terminate(const std::string &message = ""); - void Abort(const std::string &reason = ""); + void Terminate(const QString &message = ""); + void Abort(const QString &reason = ""); bool doContinue() const { return (!_userTerminated); } @@ -137,7 +139,7 @@ namespace Isis { int _maxIters; int _status; bool _userTerminated; - std::string _userMessage; + QString _userMessage; struct _nlsqPointer { NonLinearLSQ *nlsq; diff --git a/isis/src/mro/apps/hical/SplineFill.h b/isis/src/mro/apps/hical/SplineFill.h index 11a975a9e1..c2a3242ce1 100644 --- a/isis/src/mro/apps/hical/SplineFill.h +++ b/isis/src/mro/apps/hical/SplineFill.h @@ -1,4 +1,4 @@ -#if !defined(SplineFill_h) +#ifndef SplineFill_h #define SplineFill_h /** * @file @@ -83,9 +83,9 @@ namespace Isis { private: int _filled; //!< Number values replaced - std::string formHistory() { - IString cfilled(_filled); - return (std::string("SplineFill(Cubic,Filled[" + cfilled + "])")); + QString formHistory() { + QString cfilled(toString(_filled)); + return (QString("SplineFill(Cubic,Filled[" + cfilled + "])")); } void fill(const HiVector &v) { diff --git a/isis/src/mro/apps/hical/ZeroBufferFit.cpp b/isis/src/mro/apps/hical/ZeroBufferFit.cpp index 68e1df596e..c0e8f038bc 100644 --- a/isis/src/mro/apps/hical/ZeroBufferFit.cpp +++ b/isis/src/mro/apps/hical/ZeroBufferFit.cpp @@ -57,26 +57,26 @@ namespace Isis { _timet.setBin(ToInteger(prof("Summing"))); _timet.setLineTime(ToDouble(prof("ScanExposureDuration"))); - _skipFit = IsEqual(ConfKey(prof, "ZeroBufferFitSkipFit", std::string("TRUE")), "TRUE"); + _skipFit = IsEqual(ConfKey(prof, "ZeroBufferFitSkipFit", QString("TRUE")), "TRUE"); _useLinFit = IsTrueValue(prof, "ZeroBufferFitOnFailUseLinear"); - _absErr = ConfKey(prof, "AbsoluteError", 1.0E-4); - _relErr = ConfKey(prof, "RelativeError", 1.0E-4); + _absErr = toDouble(ConfKey(prof, "AbsoluteError", toString(1.0E-4))); + _relErr = toDouble(ConfKey(prof, "RelativeError", toString(1.0E-4))); - _sWidth = ConfKey(prof, "GuessFilterWidth", 17); - _sIters = ConfKey(prof, "GuessFilterIterations", 1); + _sWidth = toInt(ConfKey(prof, "GuessFilterWidth", toString(17))); + _sIters = toInt(ConfKey(prof, "GuessFilterIterations", toString(1))); if ( prof.exists("MaximumIterations") ) { setMaxIters(ToInteger(prof("MaximumIterations"))); } - _maxLog = ConfKey(prof, "MaximumLog", 709.0); + _maxLog = toDouble(ConfKey(prof, "MaximumLog", toString(709.0))); _badLines = ToInteger(prof("TrimLines"))/ToInteger(prof("Summing")); - _minLines = ConfKey(prof,"ZeroBufferFitMinimumLines", 100); + _minLines = toInt(ConfKey(prof,"ZeroBufferFitMinimumLines", toString(100))); - string histstr = "ZeroBufferFit(AbsErr[" + ToString(_absErr) + + QString histstr = "ZeroBufferFit(AbsErr[" + ToString(_absErr) + "],RelErr[" + ToString(_relErr) + "],MaxIter[" + ToString(maxIters()) + "])"; _history.add(histstr); @@ -118,7 +118,7 @@ namespace Isis { } hist << "SkipFit(TRUE: Not using LMFit)"; - _history.add(hist.str()); + _history.add(hist.str().c_str()); } else { hist << "Fit("; @@ -128,7 +128,7 @@ namespace Isis { _uncert = uncert(); hist << "Solved,#Iters[" << nIterations() << "],ChiSq[" << Chisq() << "],DoF[" << DoF() << "])"; - _history.add(hist.str()); + _history.add(hist.str().c_str()); _history.add("a0("+ToString(_coefs[0])+"+-"+ToString(_uncert[0])+")"); _history.add("a1("+ToString(_coefs[1])+"+-"+ToString(_uncert[1])+")"); _history.add("a2("+ToString(_coefs[2])+"+-"+ToString(_uncert[2])+")"); @@ -146,7 +146,7 @@ namespace Isis { hist << "Failed::Reason("<< statusstr() << "),#Iters[" << nIterations() << "])"; - _history.add(hist.str()); + _history.add(hist.str().c_str()); _history.add("a0("+ToString(_coefs[0])+")"); _history.add("a1("+ToString(_coefs[1])+")"); _history.add("a2("+ToString(_coefs[2])+")"); diff --git a/isis/src/mro/apps/hical/ZeroBufferFit.h b/isis/src/mro/apps/hical/ZeroBufferFit.h index 83ad0511af..9b76345c9d 100644 --- a/isis/src/mro/apps/hical/ZeroBufferFit.h +++ b/isis/src/mro/apps/hical/ZeroBufferFit.h @@ -1,4 +1,4 @@ -#if !defined(ZeroBufferFit_h) +#ifndef ZeroBufferFit_h #define ZeroBufferFit_h /** * @file diff --git a/isis/src/mro/apps/hical/ZeroBufferSmooth.h b/isis/src/mro/apps/hical/ZeroBufferSmooth.h index bda8246f28..5ee9f50dc2 100644 --- a/isis/src/mro/apps/hical/ZeroBufferSmooth.h +++ b/isis/src/mro/apps/hical/ZeroBufferSmooth.h @@ -1,4 +1,4 @@ -#if !defined(ZeroBufferSmooth_h) +#ifndef ZeroBufferSmooth_h #define ZeroBufferSmooth_h /** * @file @@ -113,15 +113,15 @@ namespace Isis { _history.clear(); _history.add("Profile["+ prof.Name()+"]"); - int samp0 = ConfKey(prof,"ZeroBufferSmoothFirstSample",0); - int sampN = ConfKey(prof,"ZeroBufferSmoothLastSample",11); + int samp0 = toInt(ConfKey(prof, "ZeroBufferSmoothFirstSample", toString(0))); + int sampN = toInt(ConfKey(prof, "ZeroBufferSmoothLastSample", toString(11))); _buffer = averageSamples(cal.getBuffer(), samp0, sampN); _history.add("AveCols(Buffer["+ToString(samp0)+","+ToString(sampN)+"])"); // Smooth/filter the averages LowPassFilter bufter(_buffer, _history, - ConfKey(prof,"ZeroBufferSmoothFilterWidth",201), - ConfKey(prof,"ZeroBufferSmoothFilterIterations",2)); + toInt(ConfKey(prof, "ZeroBufferSmoothFilterWidth", toString(201))), + toInt(ConfKey(prof, "ZeroBufferSmoothFilterIterations", toString(2)))); // If need be, fill the data with a cubic spline SplineFill spline(bufter); _data = spline.ref(); diff --git a/isis/src/mro/apps/hical/ZeroDark.h b/isis/src/mro/apps/hical/ZeroDark.h index ac7564ac44..7d9049f7cf 100644 --- a/isis/src/mro/apps/hical/ZeroDark.h +++ b/isis/src/mro/apps/hical/ZeroDark.h @@ -1,4 +1,4 @@ -#if !defined(ZeroDark_h) +#ifndef ZeroDark_h #define ZeroDark_h /** * @file @@ -107,11 +107,11 @@ namespace Isis { _intercept = loadCsv("DarkIntercept", conf, prof, 256); // Get temperation normalization factor - _refTemp = ConfKey(prof, "FpaReferenceTemperature", 21.0); + _refTemp = toDouble(ConfKey(prof, "FpaReferenceTemperature", toString(21.0))); // Smooth/filter if requested - int width = ConfKey(prof,"ZeroDarkFilterWidth",3); - int iters = ConfKey(prof,"ZerDarkFilterIterations",0); + int width = toInt(ConfKey(prof, "ZeroDarkFilterWidth", toString(3))); + int iters = toInt(ConfKey(prof, "ZerDarkFilterIterations", toString(0))); LowPassFilter smooth(width, iters); _history.add("Smooth(Width["+ToString(width)+"],Iters["+ToString(iters)+"])"); diff --git a/isis/src/mro/apps/hical/ZeroReverse.h b/isis/src/mro/apps/hical/ZeroReverse.h index 5b57f72b8a..b9e46001b0 100644 --- a/isis/src/mro/apps/hical/ZeroReverse.h +++ b/isis/src/mro/apps/hical/ZeroReverse.h @@ -1,4 +1,4 @@ -#if !defined(ZeroReverse_h) +#ifndef ZeroReverse_h #define ZeroReverse_h /** * @file @@ -107,9 +107,9 @@ namespace Isis { _history.clear(); _history.add("Profile["+ prof.Name()+"]"); - int line0 = ConfKey(prof,"ZeroReverseFirstLine",0); - int lineN = ConfKey(prof,"ZeroReverseLastLine",19); - std::string tfile= conf.getMatrixSource("ReverseClockStatistics",prof); + int line0 = toInt(ConfKey(prof, "ZeroReverseFirstLine", toString(0))); + int lineN = toInt(ConfKey(prof, "ZeroReverseLastLine", toString(19))); + QString tfile= conf.getMatrixSource("ReverseClockStatistics",prof); HiMatrix revclk = cropLines(cal.getReverseClock(), line0, lineN); _stats.Reset(); @@ -124,18 +124,18 @@ namespace Isis { "],NulPixels["+ToString(_stats.NullPixels())+ "])"); DbAccess triggers(Pvl(tfile).FindObject("ReverseClockStatistics")); - std::string tprofName = conf.resolve("{FILTER}{CCD}_{CHANNEL}_{BIN}",prof); + QString tprofName = conf.resolve("{FILTER}{CCD}_{CHANNEL}_{BIN}",prof); _history.add("ReverseClockStatistics(File["+tfile+ "],Profile["+tprofName+"])"); _triggered= false; if (triggers.profileExists(tprofName)) { DbProfile tprof(prof, triggers.getProfile(tprofName), tprofName); - double revmean = ConfKey(tprof,"RevMeanTrigger", _stats.Average()); - double revstddev = ConfKey(tprof,"RevStdDevTrigger", DBL_MAX); - int lisTol = ConfKey(tprof, "RevLisTolerance", 1); - int hisTol = ConfKey(tprof, "RevHisTolerance", 1); - int nulTol = ConfKey(tprof, "RevNulTolerance", 1); + double revmean = toDouble(ConfKey(tprof,"RevMeanTrigger", toString(_stats.Average()))); + double revstddev = toDouble(ConfKey(tprof,"RevStdDevTrigger", toString(DBL_MAX))); + int lisTol = toInt(ConfKey(tprof, "RevLisTolerance", toString(1))); + int hisTol = toInt(ConfKey(tprof, "RevHisTolerance", toString(1))); + int nulTol = toInt(ConfKey(tprof, "RevNulTolerance", toString(1))); _history.add("TriggerLimits(RevMeanTrigger["+ToString(revmean) + "],RevStdDevTrigger["+ToString(revstddev)+ diff --git a/isis/src/mro/apps/hical/hical.cpp b/isis/src/mro/apps/hical/hical.cpp index 501a6c3fa8..f750eb039a 100644 --- a/isis/src/mro/apps/hical/hical.cpp +++ b/isis/src/mro/apps/hical/hical.cpp @@ -2,7 +2,7 @@ #include "Isis.h" #include -#include +#include #include #include #include @@ -38,7 +38,7 @@ using namespace Isis; using namespace std; //!< Define the matrix container for systematic processing -typedef CollectorMap MatrixList; +typedef CollectorMap MatrixList; // Calibration parameter container MatrixList *calVars = 0; @@ -107,14 +107,14 @@ void calibrate(Buffer &in, Buffer &out) { void IsisMain(){ - const std::string hical_program = "hical"; - const std::string hical_version = "5.0"; - const std::string hical_revision = "$Revision$"; - const std::string hical_runtime = Application::DateTime(); + const QString hical_program = "hical"; + const QString hical_version = "5.0"; + const QString hical_revision = "$Revision$"; + const QString hical_runtime = Application::DateTime(); UserInterface &ui = Application::GetUserInterface(); - string procStep("prepping phase"); + QString procStep("prepping phase"); try { // The output from the last processing is the input into subsequent processing ProcessByLine p; @@ -124,7 +124,7 @@ void IsisMain(){ int nlines = hifrom->getLineCount(); // Initialize the configuration file - string conf(ui.GetAsString("CONF")); + QString conf(ui.GetAsString("CONF")); HiCalConf hiconf(*(hifrom->getLabel()), conf); DbProfile hiprof = hiconf.getMatrixProfile(); @@ -150,7 +150,7 @@ void IsisMain(){ } // Do I/F output DN conversions - string units = ui.GetString("UNITS"); + QString units = ui.GetString("UNITS"); // Allocate the calibration list calVars = new MatrixList; @@ -386,17 +386,17 @@ void IsisMain(){ // Get the default profile for logging purposes hiprof = hiconf.getMatrixProfile(); - const std::string conf_file = hiconf.filepath(conf); + const QString conf_file = hiconf.filepath(conf); // Quitely dumps parameter history to alternative format file. This // is completely controlled by the configuration file if ( hiprof.exists("DumpHistoryFile") ) { procStep = "logging/reporting phase"; FileName hdump(hiconf.getMatrixSource("DumpHistoryFile",hiprof)); - string hdumpFile = hdump.expanded(); - ofstream ofile(hdumpFile.c_str(), ios::out); + QString hdumpFile = hdump.expanded(); + ofstream ofile(hdumpFile.toAscii().data(), ios::out); if (!ofile) { - string mess = "Unable to open/create history dump file " + + QString mess = "Unable to open/create history dump file " + hdump.expanded(); IException(IException::User, mess, _FILEINFO_).print(); } @@ -432,7 +432,7 @@ void IsisMain(){ } // Ensure the RadiometricCalibration group is out there - const std::string rcalGroup("RadiometricCalibration"); + const QString rcalGroup("RadiometricCalibration"); if (!ocube->hasGroup(rcalGroup)) { PvlGroup temp(rcalGroup); ocube->putGroup(temp); @@ -456,7 +456,7 @@ void IsisMain(){ // Record parameter generation history. Controllable in configuration // file. Note this is optional because of a BUG!! in the ISIS label // writer as this application was initially developed - if ( IsEqual(ConfKey(hiprof,"LogParameterHistory",string("TRUE")),"TRUE")) { + if ( IsEqual(ConfKey(hiprof,"LogParameterHistory",QString("TRUE")),"TRUE")) { rcal += ZbsHist.makekey("ZeroBufferSmooth"); rcal += ZbfHist.makekey("ZeroBufferFit"); rcal += ZrHist.makekey("ZeroReverse"); @@ -474,8 +474,8 @@ void IsisMain(){ catch (IException &ie) { delete calVars; calVars = 0; - string mess = "Failed in " + procStep; - throw IException(ie, IException::User, mess.c_str(), _FILEINFO_); + QString mess = "Failed in " + procStep; + throw IException(ie, IException::User, mess.toAscii().data(), _FILEINFO_); } // Clean up parameters diff --git a/isis/src/mro/apps/hicalbeta/GainChannelNormalize.h b/isis/src/mro/apps/hicalbeta/GainChannelNormalize.h index 9c568d933e..ae89483372 100644 --- a/isis/src/mro/apps/hicalbeta/GainChannelNormalize.h +++ b/isis/src/mro/apps/hicalbeta/GainChannelNormalize.h @@ -1,4 +1,4 @@ -#if !defined(GainChannelNormalize_h) +#ifndef GainChannelNormalize_h #define GainChannelNormalize_h /** * @file diff --git a/isis/src/mro/apps/hicalbeta/GainFlatField.h b/isis/src/mro/apps/hicalbeta/GainFlatField.h index 6eba6a2785..5c55125c37 100644 --- a/isis/src/mro/apps/hicalbeta/GainFlatField.h +++ b/isis/src/mro/apps/hicalbeta/GainFlatField.h @@ -1,4 +1,4 @@ -#if !defined(GainFlatField_h) +#ifndef GainFlatField_h #define GainFlatField_h /** * @file diff --git a/isis/src/mro/apps/hicalbeta/GainLineDrift.h b/isis/src/mro/apps/hicalbeta/GainLineDrift.h index a02f22a6b6..593c94ccff 100644 --- a/isis/src/mro/apps/hicalbeta/GainLineDrift.h +++ b/isis/src/mro/apps/hicalbeta/GainLineDrift.h @@ -1,4 +1,4 @@ -#if !defined(GainLineDrift_h) +#ifndef GainLineDrift_h #define GainLineDrift_h /** * @file diff --git a/isis/src/mro/apps/hicalbeta/GainNonLinearity.h b/isis/src/mro/apps/hicalbeta/GainNonLinearity.h index cf45e23585..e15354e138 100644 --- a/isis/src/mro/apps/hicalbeta/GainNonLinearity.h +++ b/isis/src/mro/apps/hicalbeta/GainNonLinearity.h @@ -1,4 +1,4 @@ -#if !defined(GainNonLinearity_h) +#ifndef GainNonLinearity_h #define GainNonLinearity_h /** * @file diff --git a/isis/src/mro/apps/hicalbeta/GainTemperature.h b/isis/src/mro/apps/hicalbeta/GainTemperature.h index f59c8972b0..59ef511338 100644 --- a/isis/src/mro/apps/hicalbeta/GainTemperature.h +++ b/isis/src/mro/apps/hicalbeta/GainTemperature.h @@ -1,4 +1,4 @@ -#if !defined(GainTemperature_h) +#ifndef GainTemperature_h #define GainTemperature_h /** * @file @@ -86,7 +86,7 @@ namespace Isis { _fpaFactor = factor[0]; // Get temperature parameters - _refTemp = ConfKey(prof, "FpaReferenceTemperature", 21.0); + _refTemp = toDouble(ConfKey(prof, "FpaReferenceTemperature", toString(21.0))); double fpa_py_temp = ToDouble(prof("FpaPositiveYTemperature")); double fpa_my_temp = ToDouble(prof("FpaNegativeYTemperature")); diff --git a/isis/src/mro/apps/hicalbeta/GainUnitConversion.h b/isis/src/mro/apps/hicalbeta/GainUnitConversion.h index fc4644a129..b31842acc5 100644 --- a/isis/src/mro/apps/hicalbeta/GainUnitConversion.h +++ b/isis/src/mro/apps/hicalbeta/GainUnitConversion.h @@ -1,4 +1,4 @@ -#if !defined(GainUnitConversion_h) +#ifndef GainUnitConversion_h #define GainUnitConversion_h /** * @file @@ -56,7 +56,7 @@ namespace Isis { public: // Constructors and Destructor GainUnitConversion() : Module("GainUnitConversion"), _units("DN") { } - GainUnitConversion(HiCalConf &conf, const std::string &units) : + GainUnitConversion(HiCalConf &conf, const QString &units) : Module("GainUnitConversion"), _units(units) { init(conf); } @@ -65,7 +65,7 @@ namespace Isis { virtual ~GainUnitConversion() { } private: - std::string _units; + QString _units; void init(HiCalConf &conf) { _history.clear(); diff --git a/isis/src/mro/apps/hicalbeta/HiBlob.h b/isis/src/mro/apps/hicalbeta/HiBlob.h index 81a6a9d7df..b4fabd5ad9 100644 --- a/isis/src/mro/apps/hicalbeta/HiBlob.h +++ b/isis/src/mro/apps/hicalbeta/HiBlob.h @@ -1,4 +1,4 @@ -#if !defined(HiBlob_h) +#ifndef HiBlob_h #define HiBlob_h /** * @file @@ -59,9 +59,9 @@ namespace Isis { /** * @brief Constructor providing interface to an ISIS Cube object */ - HiBlob(Cube &cube, const std::string &tblname, - const std::string &field, - const std::string &name = "HiBlob") : + HiBlob(Cube &cube, const QString &tblname, + const QString &field, + const QString &name = "HiBlob") : Blobber(cube, tblname, field, name) { } /** Destructor */ diff --git a/isis/src/mro/apps/hicalbeta/HiCalConf.cpp b/isis/src/mro/apps/hicalbeta/HiCalConf.cpp index 9bcec18c23..d092bc3324 100644 --- a/isis/src/mro/apps/hicalbeta/HiCalConf.cpp +++ b/isis/src/mro/apps/hicalbeta/HiCalConf.cpp @@ -21,7 +21,7 @@ * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ -#include +#include #include #include #include @@ -69,7 +69,7 @@ bool HiCalConf::_naifLoaded = false; * @param label Label from HiRISE cube file * @param conf Name of configuration file to use */ - HiCalConf::HiCalConf(Pvl &label, const std::string &conf) : + HiCalConf::HiCalConf(Pvl &label, const QString &conf) : DbAccess(Pvl(filepath(conf)).FindObject("Hical", PvlObject::Traverse)) { _profName.clear(); init(label); @@ -95,13 +95,13 @@ bool HiCalConf::_naifLoaded = false; * * @param fname File specification with or without versioning patterns * - * @return string Expanded filename but not the filepath + * @return QString Expanded filename but not the filepath */ - string HiCalConf::filepath(const std::string &fname) const { + QString HiCalConf::filepath(const QString &fname) const { FileName efile(fname); if (efile.isVersioned()) { - string path(efile.originalPath()); - if (!path.empty()) path += "/"; + QString path(efile.originalPath()); + if (!path.isEmpty()) path += "/"; efile = efile.highestVersion(); @@ -120,7 +120,7 @@ bool HiCalConf::_naifLoaded = false; * * @param conf Name of configuration file to use */ - void HiCalConf::setConf(const std::string &conf) { + void HiCalConf::setConf(const QString &conf) { load(Pvl(filepath(conf)).FindObject("Hical", PvlObject::Traverse)); } @@ -133,7 +133,7 @@ bool HiCalConf::_naifLoaded = false; * * @param profile Name of existing profile in the configuration file */ - void HiCalConf::selectProfile(const std::string &profile) { + void HiCalConf::selectProfile(const QString &profile) { _profName = profile; return; } @@ -143,9 +143,9 @@ bool HiCalConf::_naifLoaded = false; * * This method returns the selected profile name. * - * @return string Selected profile name + * @return QString Selected profile name */ - string HiCalConf::getProfileName() const { + QString HiCalConf::getProfileName() const { return (_profName); } @@ -155,14 +155,14 @@ bool HiCalConf::_naifLoaded = false; * This method returns the name of a matrix file reference variable from the * \b Matrices keyword as determined from the fully option profile. It then * expands the filename portion (not the filepath!) and returns the result as - * a string for subsequent use. See also getMatrixList and getMatrix. + * a QString for subsequent use. See also getMatrixList and getMatrix. * * @param name Name of Matrix to resolve. It must be one in the \b Matrices * keyword from the configuration file * - * @return std::string The expanded file name reference for the matrix + * @return QString The expanded file name reference for the matrix */ - std::string HiCalConf::getMatrixSource(const std::string &name) const { + QString HiCalConf::getMatrixSource(const QString &name) const { return (getMatrixSource(name, getMatrixProfile())); } @@ -172,18 +172,18 @@ bool HiCalConf::_naifLoaded = false; * This method returns the name of a matrix file reference variable from the * \b Matrices keyword as determined from the specified profile. It then * expands the filename portion (not the filepath!) and returns the result as - * a string for subsequent use. See also getMatrixList and getMatrix. + * a QString for subsequent use. See also getMatrixList and getMatrix. * * @param name Name of Matrix to resolve. It must be one in the \b Matrices * keyword from the configuration file * @param matconf Profile to extract the named matrix source from * - * @return std::string The expanded file name reference for the matrix + * @return QString The expanded file name reference for the matrix */ - std::string HiCalConf::getMatrixSource(const std::string &name, + QString HiCalConf::getMatrixSource(const QString &name, const DbProfile &matconf) const { - std::string mfile = parser(matconf.value(name), + QString mfile = parser(matconf.value(name), getList(matconf,"OptionKeywords"), matconf); @@ -191,13 +191,13 @@ bool HiCalConf::_naifLoaded = false; return (filepath(mfile)); } - HiVector HiCalConf::getMatrix(const std::string &name, + HiVector HiCalConf::getMatrix(const QString &name, int expected_size) const { return (getMatrix(name,getMatrixProfile(), expected_size)); } - std::string HiCalConf::resolve(const std::string &composite, + QString HiCalConf::resolve(const QString &composite, const DbProfile &matconf) const { return (parser(composite,getList(matconf,"OptionKeywords"), matconf)); } @@ -227,11 +227,11 @@ bool HiCalConf::_naifLoaded = false; * * @return HiCalConf::HiVector Returns the extracted band from the cube */ - HiVector HiCalConf::getMatrix(const std::string &name, + HiVector HiCalConf::getMatrix(const QString &name, const DbProfile &profile, int expected_size) const { - std::string mfile = getMatrixSource(name, profile); + QString mfile = getMatrixSource(name, profile); // Crack the file and read the appropriate band Cube cube; @@ -277,7 +277,7 @@ bool HiCalConf::_naifLoaded = false; * * @return HiCalConf::HiVector Values of scalar constants */ - HiVector HiCalConf::getScalar(const std::string &name, + HiVector HiCalConf::getScalar(const QString &name, const DbProfile &profile, int expected_size) const { int nvals = profile.count(name); @@ -311,20 +311,20 @@ bool HiCalConf::_naifLoaded = false; double HiCalConf::sunDistanceAU() { loadNaifTiming(); - string scStartTime = getKey("SpacecraftClockStartCount", "Instrument"); + QString scStartTime = getKey("SpacecraftClockStartCount", "Instrument"); double obsStartTime; - scs2e_c (-74999,scStartTime.c_str(),&obsStartTime); + scs2e_c (-74999,scStartTime.toAscii().data(),&obsStartTime); - string targetName = getKey("TargetName", "Instrument"); - if ( (IString::Equal(targetName, "Sky")) || - (IString::Equal(targetName, "Cal")) || - (IString::Equal(targetName, "Phobos")) || - (IString::Equal(targetName, "Deimos")) ) { + QString targetName = getKey("TargetName", "Instrument"); + if (targetName.toLower() == "sky" || + targetName.toLower() == "cal" || + targetName.toLower() == "phobos" || + targetName.toLower() == "deimos") { targetName = "Mars"; } double sunv[3]; double lt; - (void) spkpos_c(targetName.c_str(), obsStartTime, "J2000", "LT+S", "sun", + (void) spkpos_c(targetName.toAscii().data(), obsStartTime, "J2000", "LT+S", "sun", sunv, <); double sunkm = vnorm_c(sunv); // Return in AU units @@ -373,16 +373,16 @@ bool HiCalConf::_naifLoaded = false; * @brief Generic profile keyword value extractor * * This method retrieves a profile keyword from the given profile and returns - * all its values a a list of strings. An exception will be thrown + * all its values a a list of QStrings. An exception will be thrown * incidentally if the keyword does not exist. * * @param profile Profile containing the keyword to extract * @param key Name of keyword to retrieve * - * @return std::vector List of values from profile keyword + * @return std::vector List of values from profile keyword */ HiCalConf::ValueList HiCalConf::getList(const DbProfile &profile, - const std::string &key) const { + const QString &key) const { ValueList slist; // Get keyword parameters @@ -414,12 +414,12 @@ void HiCalConf::loadNaifTiming( ) { pck = pck.highestVersion(); // Load the kernels - string lsk = leapseconds.expanded(); - string sClock = sclk.expanded(); - string pConstants = pck.expanded(); - furnsh_c(lsk.c_str()); - furnsh_c(sClock.c_str()); - furnsh_c(pConstants.c_str()); + QString lsk = leapseconds.expanded(); + QString sClock = sclk.expanded(); + QString pConstants = pck.expanded(); + furnsh_c(lsk.toAscii().data()); + furnsh_c(sClock.toAscii().data()); + furnsh_c(pConstants.toAscii().data()); // Ensure it is loaded only once _naifLoaded = true; @@ -461,9 +461,9 @@ void HiCalConf::init(Pvl &label) { * * @return PvlKeyword& Reference to retrieved label keyword */ -PvlKeyword &HiCalConf::getKey(const std::string &key, - const std::string &group) { - if (!group.empty()) { +PvlKeyword &HiCalConf::getKey(const QString &key, + const QString &group) { + if (!group.isEmpty()) { PvlGroup &grp = _label.FindGroup(group, Pvl::Traverse); return (grp[key]); } @@ -490,8 +490,8 @@ PvlKeyword &HiCalConf::getKey(const std::string &key, * default profile if this parameter is not provided (empty). * @return DbProfile Returns a fully optioned profile */ -DbProfile HiCalConf::getMatrixProfile(const std::string &profile) const { - string myprof = (!profile.empty()) ? profile : _profName; +DbProfile HiCalConf::getMatrixProfile(const QString &profile) const { + QString myprof = (!profile.isEmpty()) ? profile : _profName; DbProfile matconf = getProfile(myprof); if (!matconf.isValid()) { ostringstream mess; @@ -509,9 +509,9 @@ DbProfile HiCalConf::getMatrixProfile(const std::string &profile) const { // Load any optional ones ValueList profkeys = getList(matconf,"OptionKeywords"); ValueList proforder = getList(matconf,"ProfileOptions"); - string pName(matconf.Name()); + QString pName(matconf.Name()); for (unsigned int i = 0 ; i < proforder.size() ; i++) { - std::string profile = parser(proforder[i], profkeys, matconf); + QString profile = parser(proforder[i], profkeys, matconf); if (profileExists(profile)) { pName += "+[" + profile + "]"; matconf = DbProfile(matconf,getProfile(profile), pName); @@ -527,7 +527,7 @@ DbProfile HiCalConf::getLabelProfile(const DbProfile &profile) const { int ngroups = profile.count("LabelGroups"); Pvl label = _label; for ( int g = 0 ; g < ngroups ; g++ ) { - string group = profile("LabelGroups", g); + QString group = profile("LabelGroups", g); PvlGroup grp = label.FindGroup(group, Pvl::Traverse); lblprof = DbProfile(lblprof,DbProfile(grp)); } @@ -567,30 +567,30 @@ DbProfile HiCalConf::makeParameters(const DbProfile &profile) const { return (parms); } -std::string HiCalConf::makePattern(const std::string &str) const { - return (string("{" + str + "}")); +QString HiCalConf::makePattern(const QString &str) const { + return (QString("{" + str + "}")); } /** - * @brief Performs a search and replace operation for the given string + * @brief Performs a search and replace operation for the given QString * - * This method will search the input string s for predefined keywords (FILTER, + * This method will search the input QString s for predefined keywords (FILTER, * TDI, BIN, CCD and CHANNEL) delimited by {} and replace these occurances with * the textual equivalent. * * @param s String to conduct search/replace of values * - * @return std::string Results of search/replace + * @return QString Results of search/replace */ -std::string HiCalConf::parser(const std::string &s, const ValueList &vlist, - const DbProfile &prof) const { - string sout(s); +QString HiCalConf::parser(const QString &s, const ValueList &vlist, + const DbProfile &prof) const { + QString sout(s); ValueList::const_iterator ciVlist; for ( ciVlist = vlist.begin() ; ciVlist != vlist.end() ; ++ciVlist ) { - std::string str(*ciVlist); + QString str(*ciVlist); if ( prof.exists(str) ) { - sout = IString::Replace(sout, makePattern(str), prof(str)); + sout = sout.replace(makePattern(str), prof(str)); } } diff --git a/isis/src/mro/apps/hicalbeta/HiCalConf.h b/isis/src/mro/apps/hicalbeta/HiCalConf.h index 447f03ff60..80527cde12 100644 --- a/isis/src/mro/apps/hicalbeta/HiCalConf.h +++ b/isis/src/mro/apps/hicalbeta/HiCalConf.h @@ -1,4 +1,4 @@ -#if !defined(HiCalConf_h) +#ifndef HiCalConf_h #define HiCalConf_h /** * @file @@ -92,53 +92,53 @@ namespace Isis { class HiCalConf : public DbAccess { public: typedef enum { Matrix, Scalar, Keyword } CalType; - typedef std::vector ValueList; + typedef std::vector ValueList; public: // Constructors and Destructor HiCalConf(); HiCalConf(Pvl &label); - HiCalConf(Pvl &label, const std::string &conf); + HiCalConf(Pvl &label, const QString &conf); /** Destructor ensures everything is cleaned up properly */ virtual ~HiCalConf () { } void setLabel(Pvl &label); - PvlKeyword &getKey(const std::string &key, const std::string &group = ""); + PvlKeyword &getKey(const QString &key, const QString &group = ""); - std::string filepath(const std::string &fname) const; - void setConf(const std::string &conf); - void selectProfile(const std::string &profile = ""); + QString filepath(const QString &fname) const; + void setConf(const QString &conf); + void selectProfile(const QString &profile = ""); - std::string getProfileName() const; - std::string getMatrixSource(const std::string &name) const; - std::string getMatrixSource(const std::string &name, + QString getProfileName() const; + QString getMatrixSource(const QString &name) const; + QString getMatrixSource(const QString &name, const DbProfile &matconf) const; - HiVector getMatrix(const std::string &name, int expected_size = 0) const; - HiVector getMatrix(const std::string &name, const DbProfile &profile, + HiVector getMatrix(const QString &name, int expected_size = 0) const; + HiVector getMatrix(const QString &name, const DbProfile &profile, int expected_size = 0) const; - HiVector getScalar(const std::string &name, const DbProfile &profile, + HiVector getScalar(const QString &name, const DbProfile &profile, int expected_size) const; int getMatrixBand() const; int getMatrixBand(const DbProfile &p) const; double sunDistanceAU(); - DbProfile getMatrixProfile(const std::string &profile = "") const; - ValueList getList(const DbProfile &profile, const std::string &key) const; - std::string resolve(const std::string &composite, + DbProfile getMatrixProfile(const QString &profile = "") const; + ValueList getList(const DbProfile &profile, const QString &key) const; + QString resolve(const QString &composite, const DbProfile &matconf) const; private: static bool _naifLoaded; //!< Ensures one instance of NAIF kernels - std::string _profName; //!< Specified name of profile + QString _profName; //!< Specified name of profile Pvl _label; //!< Hold label for future references int _ccd; //!< CCD Number int _channel; //!< Channel number int _tdi; //!< TDI mode of operation int _binMode; //!< Binning mode - std::string _filter; //!< Filter set name (RED, IR, BG) + QString _filter; //!< Filter set name (RED, IR, BG) void init(); @@ -148,9 +148,9 @@ namespace Isis { int getChannelIndex(const int &ccd, const int &channel) const; DbProfile makeParameters(Pvl &label) const; DbProfile makeParameters(const DbProfile &profile) const; - std::string makePattern(const std::string &str) const; - std::string parser(const std::string &s, const ValueList &options, - const DbProfile &prof ) const; + QString makePattern(const QString &str) const; + QString parser(const QString &s, const ValueList &options, + const DbProfile &prof ) const; }; } // namespace Isis diff --git a/isis/src/mro/apps/hicalbeta/HiCalData.h b/isis/src/mro/apps/hicalbeta/HiCalData.h index 9928a8476a..9f797d097e 100644 --- a/isis/src/mro/apps/hicalbeta/HiCalData.h +++ b/isis/src/mro/apps/hicalbeta/HiCalData.h @@ -1,4 +1,4 @@ -#if !defined(HiCalData_h) +#ifndef HiCalData_h #define HiCalData_h /** * @file diff --git a/isis/src/mro/apps/hicalbeta/HiCalTypes.h b/isis/src/mro/apps/hicalbeta/HiCalTypes.h index d55e835eb9..50ce0b7b4f 100644 --- a/isis/src/mro/apps/hicalbeta/HiCalTypes.h +++ b/isis/src/mro/apps/hicalbeta/HiCalTypes.h @@ -1,4 +1,4 @@ -#if !defined(HiCalTypes_h) +#ifndef HiCalTypes_h #define HiCalTypes_h /** * @file @@ -31,6 +31,8 @@ #include "tnt_array1d_utils.h" #include "tnt_array2d.h" #include "tnt_array2d_utils.h" + +#include "IString.h" #include "PvlKeyword.h" namespace Isis { @@ -48,8 +50,12 @@ class HiHistory { * @return std::ostream& Returns new state of stream */ friend std::ostream &operator<<(std::ostream &o, const HiHistory &h) { - std::copy(h._events.begin(), h._events.end(), - std::ostream_iterator(o,"; ")); + std::vector::const_iterator it = h._events.begin(); + + while (it != h._events.end()) { + o << *it << "; "; + it++; + } return (o); } @@ -59,19 +65,19 @@ class HiHistory { virtual ~HiHistory() { } inline int size() const { return (_events.size()); } - void add(const std::string &event) { _events.push_back(event); } - std::string get(unsigned int index = 0) const { + void add(const QString &event) { _events.push_back(event); } + QString get(unsigned int index = 0) const { if (index < _events.size()) { return (_events[index]); } else { - return (std::string("")); + return (QString("")); } } void clear() { _events.clear(); } - PvlKeyword makekey(const std::string &name = "History") const { + PvlKeyword makekey(const QString &name = "History") const { PvlKeyword key(name); for (unsigned int i = 0 ; i < _events.size() ; i++) { key.AddValue(_events[i]); @@ -80,7 +86,7 @@ class HiHistory { } private: - std::vector _events; + std::vector _events; }; }; diff --git a/isis/src/mro/apps/hicalbeta/HiCalUtil.h b/isis/src/mro/apps/hicalbeta/HiCalUtil.h index 61795001ce..4298bf408c 100644 --- a/isis/src/mro/apps/hicalbeta/HiCalUtil.h +++ b/isis/src/mro/apps/hicalbeta/HiCalUtil.h @@ -1,4 +1,4 @@ -#if !defined(HiCalUtil_h) +#ifndef HiCalUtil_h #define HiCalUtil_h /** * @file @@ -85,8 +85,8 @@ inline int InValidCount(const HiVector &v) { inline int CpmmToCcd(int cpmm) { const int cpmm2ccd[] = {0,1,2,3,12,4,10,11,5,13,6,7,8,9}; if ( (cpmm < 0) || (cpmm >= (int)(sizeof(cpmm2ccd)/sizeof(int))) ) { - std::string mess = "CpmmToCdd: Bad CpmmNumber (" + IString(cpmm) + ")"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString mess = "CpmmToCdd: Bad CpmmNumber (" + toString(cpmm) + ")"; + throw IException(IException::User, mess, _FILEINFO_); } return (cpmm2ccd[cpmm]); } @@ -97,13 +97,13 @@ inline int CpmmToCcd(int cpmm) { * * @param ccd Ccd number of device */ -inline std::string CcdToFilter(int ccd) { +inline QString CcdToFilter(int ccd) { if ( (ccd < 0) || (ccd > 13) ) { - std::string mess = "CcdToFilter: Bad Ccd Number (" + IString(ccd) + ")"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString mess = "CcdToFilter: Bad Ccd Number (" + toString(ccd) + ")"; + throw IException(IException::User, mess, _FILEINFO_); } - std::string filter; + QString filter; if ( ccd <= 9 ) { filter = "RED"; } else if (ccd <= 11) { filter = "IR"; } else { filter = "BG"; } @@ -216,11 +216,11 @@ inline HiVector averageSamples(const HiMatrix &m, int ssamp = 0, * */ template - T ConfKey(const DbProfile &conf, const std::string &keyname, const T &defval, + T ConfKey(const DbProfile &conf, const QString &keyname, const T &defval, int index = 0) { if (!conf.exists(keyname)) { return (defval); } if (conf.count(keyname) < index) { return (defval); } - IString iValue(conf.value(keyname, index)); + QString iValue(conf.value(keyname, index)); T value = iValue; // This makes it work with a string? return (value); } @@ -234,7 +234,7 @@ template * @return int Converted value */ template int ToInteger(const T &value) { - return (IString(value).Trim(" \r\t\n").ToInteger()); + return toInt(QString(value).trimmed()); } /** @@ -246,7 +246,7 @@ template int ToInteger(const T &value) { * @return double Converted value */ template double ToDouble(const T &value) { - return (IString(value).Trim(" \r\t\n").ToDouble()); + return toDouble(QString(value).trimmed()); } /** @@ -257,8 +257,8 @@ template double ToDouble(const T &value) { * * @return string Converted value */ -template std::string ToString(const T &value) { - return (IString(value).Trim(" \r\t\n")); +template QString ToString(const T &value) { + return (toString(value).trimmed()); } /** @@ -269,8 +269,8 @@ template std::string ToString(const T &value) { * * @return bool True if they are equal w/o regard to case */ -inline bool IsEqual(const std::string &v1, const std::string &v2 = "TRUE") { - return (IString::UpCase(v1) == IString::UpCase(v2)); +inline bool IsEqual(const QString &v1, const QString &v2 = "TRUE") { + return (v1.toUpper() == v2.toUpper()); } /** @@ -287,8 +287,8 @@ inline bool IsEqual(const std::string &v1, const std::string &v2 = "TRUE") { * @return bool Returns true only if the keyword exists in the profile and it is * the value expected. */ -inline bool IsTrueValue(const DbProfile &prof, const std::string &key, - const std::string &value = "TRUE") { +inline bool IsTrueValue(const DbProfile &prof, const QString &key, + const QString &value = "TRUE") { if ( prof.exists(key) ) { return (IsEqual(prof(key), value)); } @@ -459,10 +459,10 @@ inline HiVector rebin(const HiVector &v, int n) { inline void RemoveHiBlobs(Pvl &label) { for ( int blob = 0 ; blob < label.Objects() ; blob++ ) { if ( label.Object(blob).IsNamed("Table") ) { - std::string name = label.Object(blob)["Name"][0]; - if ( IString::Equal(name,"HiRISE Calibration Ancillary") || - IString::Equal(name,"HiRISE Calibration Image") || - IString::Equal(name,"HiRISE Ancillary") ) { + QString name = label.Object(blob)["Name"][0]; + if ( name.toLower() == "hirise calibration ancillary" || + name.toLower() == "hirise calibration images" || + name.toLower() == "hirise ancillary") { label.DeleteObject(blob); blob--; } diff --git a/isis/src/mro/apps/hicalbeta/LoadCSV.cpp b/isis/src/mro/apps/hicalbeta/LoadCSV.cpp index 3ffde7dafa..9729db2fc7 100644 --- a/isis/src/mro/apps/hicalbeta/LoadCSV.cpp +++ b/isis/src/mro/apps/hicalbeta/LoadCSV.cpp @@ -21,7 +21,7 @@ * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ -#include +#include #include #include #include @@ -38,13 +38,13 @@ namespace Isis { LoadCSV::LoadCSV() : _base(), _csvSpecs("LoadCSV"), _data(0,0), _history() { } - LoadCSV::LoadCSV(const std::string &base, const HiCalConf &conf, + LoadCSV::LoadCSV(const QString &base, const HiCalConf &conf, const DbProfile &profile) : _base(), _csvSpecs("LoadCSV"), _data(0,0), _history() { load(base, conf, profile); } - void LoadCSV::load(const std::string &base, const HiCalConf &conf, + void LoadCSV::load(const QString &base, const HiCalConf &conf, const DbProfile &profile) { // Initialize the object with necessary info @@ -53,12 +53,12 @@ namespace Isis { // Set up access to the CSV table. Note that HiCalConf.getMatrixSource() // method is typically used, but the parsing has been broken up here for // implementation purposes. - string csvfile(conf.filepath(getValue())); + QString csvfile(conf.filepath(getValue())); addHistory("File", csvfile); CSVReader csv; // Retrieve information regarding the format within the CSV - bool colHeader(IsEqual(ConfKey(_csvSpecs,makeKey("Header"), string("FALSE")), "TRUE")); + bool colHeader(IsEqual(ConfKey(_csvSpecs,makeKey("Header"), QString("FALSE")), "TRUE")); bool rowHeader(colHeader); // Both default to state of the {BASE}Header if (IsEqual(getValue("ColumnHeader"), "TRUE")) colHeader = true; if (IsEqual(getValue("RowHeader"), "TRUE")) rowHeader = true; @@ -66,17 +66,17 @@ namespace Isis { if (_csvSpecs.exists(makeKey("RowName") )) rowHeader = true; // Skip lines, comment headers and separator - int skip = ConfKey(_csvSpecs, makeKey("SkipLines"), 0); + int skip = toInt(ConfKey(_csvSpecs, makeKey("SkipLines"), QString("0"))); addHistory("SkipLines", ToString(skip)); - bool comments = IsEqual(ConfKey(_csvSpecs, makeKey("IgnoreComments"), string("TRUE"))); - string separator = ConfKey(_csvSpecs, makeKey("Separator"), string(",")); - if (separator.empty()) separator = ","; // Guarantees content + bool comments = IsEqual(ConfKey(_csvSpecs, makeKey("IgnoreComments"), QString("TRUE"))); + QString separator = ConfKey(_csvSpecs, makeKey("Separator"), QString(",")); + if (separator.isEmpty()) separator = ","; // Guarantees content // Apply conditions csv.setComment(comments); csv.setSkip(skip); csv.setHeader(colHeader); - csv.setDelimiter(separator[0]); + csv.setDelimiter(separator[0].toAscii()); if (separator[0] == ' ') csv.setSkipEmptyParts(); // Now read the file @@ -85,7 +85,7 @@ namespace Isis { try { csv.read(csvfile); } catch (IException &ie) { - string mess = "Could not read CSV file \'" + csvfile + "\'"; + QString mess = "Could not read CSV file \'" + csvfile + "\'"; throw IException(ie, IException::User, mess, _FILEINFO_); } @@ -98,20 +98,20 @@ namespace Isis { int startRow(0), endRow(nrows-1); // Update columns - string colName(getValue("ColumnName")); - if (!colName.empty()) { + QString colName(getValue("ColumnName")); + if (!colName.isEmpty()) { addHistory("ColumnName", colName); CSVReader::CSVAxis chead = csv.getHeader(); startColumn = getAxisIndex(colName, chead); if (startColumn < 0) { - string mess = "Column name " + colName + + QString mess = "Column name " + colName + " not found in CSV file " + csvfile; throw IException(IException::User, mess, _FILEINFO_); } endColumn = startColumn; addHistory("ColumnIndex", ToString(startColumn)); } - else if (!(getValue("ColumnIndex").empty())) { + else if (!(getValue("ColumnIndex").isEmpty())) { startColumn = ToInteger(getValue("ColumnIndex")) + ((rowHeader) ? 1 : 0); endColumn = startColumn; @@ -120,23 +120,23 @@ namespace Isis { } // Update row indicies - string rowName(getValue("RowName")); - if (!rowName.empty()) { + QString rowName(getValue("RowName")); + if (!rowName.isEmpty()) { addHistory("RowName", rowName); if (!rowHeader) { - string mess = "Row name given but config does not specify presence of row header!"; + QString mess = "Row name given but config does not specify presence of row header!"; throw IException(IException::User, mess, _FILEINFO_); } CSVReader::CSVAxis rhead = csv.getColumn(0); startRow = getAxisIndex(rowName, rhead); if (startRow < 0) { - string mess = "Row name " + rowName + " not found in CSV file " + csvfile; + QString mess = "Row name " + rowName + " not found in CSV file " + csvfile; throw IException(IException::User, mess, _FILEINFO_); } endRow = startRow; addHistory("RowIndex", ToString(startRow)); } - else if (!(getValue("RowIndex").empty())) { + else if (!(getValue("RowIndex").isEmpty())) { startRow = ToInteger(getValue("RowIndex")); if (rowHeader) startRow++; endRow = startRow; @@ -148,7 +148,7 @@ namespace Isis { int drows(endRow-startRow+1); int dcols(endColumn-startColumn+1); HiMatrix d(drows, dcols); - vector errors; + vector errors; for (int r = startRow, hr = 0 ; r <= endRow ; r++, hr++) { CSVReader::CSVAxis row = csv.getRow(r); for (int c = startColumn, hc = 0 ; c <= endColumn ; c++, hc++) { @@ -158,10 +158,10 @@ namespace Isis { catch (...) { std::ostringstream mess; mess << "Invalid real value (" << row[c] << ") in row index " << r; - if (!rowName.empty()) mess << " (Name:" << rowName << ")"; + if (!rowName.isEmpty()) mess << " (Name:" << rowName << ")"; mess << ", column index " << c; - if (!colName.empty()) mess << " (Name:" << colName << ")"; - errors.push_back(mess.str()); + if (!colName.isEmpty()) mess << " (Name:" << colName << ")"; + errors.push_back(mess.str().c_str()); d[hr][hc] = Null; } } @@ -175,15 +175,20 @@ namespace Isis { //iException::Clear(); Not sure how this could ever do anything std::ostringstream mess; mess << "Conversion errors in CSV file " + csvfile + ": Errors: "; - std::copy(errors.begin(), errors.end(), - std::ostream_iterator(mess,"; ")); - throw IException(IException::User, mess.str(), _FILEINFO_); + + std::vector::const_iterator it = errors.begin(); + + while (it != errors.end()) { + mess << *it << "; "; + it++; + } + throw IException(IException::User, mess.str().c_str(), _FILEINFO_); } return; } - std::string LoadCSV::filename() const { + QString LoadCSV::filename() const { return (getValue()); } @@ -216,17 +221,17 @@ namespace Isis { void LoadCSV::History(HiHistory &history) const { std::ostringstream mess; mess << "LoadCSV("; - string comma(""); + QString comma(""); for (unsigned int i = 0 ; i < _history.size() ; i++) { mess << comma << _history[i]; comma = ","; } mess << ")"; - history.add(mess.str()); + history.add(mess.str().c_str()); return; } - void LoadCSV::init(const std::string &base, const HiCalConf &conf, + void LoadCSV::init(const QString &base, const HiCalConf &conf, const DbProfile &profile) { _base = base; _csvSpecs = ResolveKeys(base, conf, profile); @@ -234,15 +239,15 @@ namespace Isis { return; } - void LoadCSV::addHistory(const std::string &element, - const std::string &desc) { + void LoadCSV::addHistory(const QString &element, + const QString &desc) { std::ostringstream mess; mess << element << "[" << desc << "]"; - _history.push_back(mess.str()); + _history.push_back(mess.str().c_str()); } - void LoadCSV::getKeyList(const std::string &base, - std::vector &keys) const { + void LoadCSV::getKeyList(const QString &base, + std::vector &keys) const { keys.clear(); keys.push_back(base); keys.push_back(base+"IgnoreComments"); @@ -258,44 +263,44 @@ namespace Isis { return; } - DbProfile LoadCSV::ResolveKeys(const std::string &base, const HiCalConf &conf, + DbProfile LoadCSV::ResolveKeys(const QString &base, const HiCalConf &conf, const DbProfile &prof) const { - vector keys; + vector keys; getKeyList(base, keys); DbProfile keyprof("LoadCSV"); for (unsigned int i = 0 ; i < keys.size() ; i++) { - string kvalue = ParsedKey(keys[i], conf, prof); - if (!kvalue.empty()) keyprof.add(keys[i], kvalue); + QString kvalue = ParsedKey(keys[i], conf, prof); + if (!kvalue.isEmpty()) keyprof.add(keys[i], kvalue); } return (keyprof); } - std::string LoadCSV::ParsedKey(const std::string &key, const HiCalConf &conf, + QString LoadCSV::ParsedKey(const QString &key, const HiCalConf &conf, const DbProfile &prof) const { - string value(""); + QString value(""); if (prof.exists(key)) { value = conf.resolve(prof(key), prof); } return (value); } - std::string LoadCSV::makeKey(const std::string &suffix) const { - string key = _base + suffix; + QString LoadCSV::makeKey(const QString &suffix) const { + QString key = _base + suffix; return (key); } - std::string LoadCSV::getValue(const std::string &suffix) const { - string key = makeKey(suffix); - string value(""); + QString LoadCSV::getValue(const QString &suffix) const { + QString key = makeKey(suffix); + QString value(""); if (_csvSpecs.exists(key)) value = _csvSpecs(key); return (value); } - int LoadCSV::getAxisIndex(const std::string &name, + int LoadCSV::getAxisIndex(const QString &name, const CSVReader::CSVAxis &header) const { - std::string head = IString(name).Trim(" \r\n\t"); + QString head = name.trimmed(); for (int i = 0 ; i < header.dim() ; i++) { - if (IString::Equal(head,IString(header[i]).Trim(" \r\n\t"))) { + if (head.toLower() == header[i].toLower().trimmed()) { return (i); } } diff --git a/isis/src/mro/apps/hicalbeta/LoadCSV.h b/isis/src/mro/apps/hicalbeta/LoadCSV.h index e18d40ec2d..0d7a90a514 100644 --- a/isis/src/mro/apps/hicalbeta/LoadCSV.h +++ b/isis/src/mro/apps/hicalbeta/LoadCSV.h @@ -1,4 +1,4 @@ -#if !defined(LoadCSV_h) +#ifndef LoadCSV_h #define LoadCSV_h /** * @file @@ -68,16 +68,16 @@ namespace Isis { public: // Constructors and Destructor LoadCSV(); - LoadCSV(const std::string &base, const HiCalConf &conf, + LoadCSV(const QString &base, const HiCalConf &conf, const DbProfile &profile); /** Destructor */ virtual ~LoadCSV() { } - void load(const std::string &base, const HiCalConf &conf, + void load(const QString &base, const HiCalConf &conf, const DbProfile &profile); - std::string filename() const; + QString filename() const; int size() const; bool validateSize(const int &expected, @@ -90,24 +90,24 @@ namespace Isis { void History(HiHistory &history) const; private: - std::string _base; + QString _base; DbProfile _csvSpecs; HiMatrix _data; - std::vector _history; + std::vector _history; - void init(const std::string &base, const HiCalConf &conf, + void init(const QString &base, const HiCalConf &conf, const DbProfile &profile); - void addHistory(const std::string &element, const std::string &desc); - void getKeyList(const std::string &base, std::vector &keys) + void addHistory(const QString &element, const QString &desc); + void getKeyList(const QString &base, std::vector &keys) const; - DbProfile ResolveKeys(const std::string &base, const HiCalConf &conf, + DbProfile ResolveKeys(const QString &base, const HiCalConf &conf, const DbProfile &prof) const; - std::string ParsedKey(const std::string &key, const HiCalConf &conf, + QString ParsedKey(const QString &key, const HiCalConf &conf, const DbProfile &prof) const; - std::string makeKey(const std::string &ksuffix = "") const; - std::string getValue(const std::string &ksuffix = "") const; + QString makeKey(const QString &ksuffix = "") const; + QString getValue(const QString &ksuffix = "") const; HiMatrix extract (const CSVReader &csv); - int getAxisIndex(const std::string &name, + int getAxisIndex(const QString &name, const CSVReader::CSVAxis &header) const; }; diff --git a/isis/src/mro/apps/hicalbeta/LowPassFilter.h b/isis/src/mro/apps/hicalbeta/LowPassFilter.h index 98ffa06027..56e7d1aed3 100644 --- a/isis/src/mro/apps/hicalbeta/LowPassFilter.h +++ b/isis/src/mro/apps/hicalbeta/LowPassFilter.h @@ -1,4 +1,4 @@ -#if !defined(LowPassFilter_h) +#ifndef LowPassFilter_h #define LowPassFilter_h /** * @file @@ -81,8 +81,8 @@ namespace Isis { int _width; //!< Filter width int _iterations; // Number iterations to apply filter - std::string formHistory() { - return (std::string("LowPassFilter(Width[" + ToString(_width) + + QString formHistory() { + return (QString("LowPassFilter(Width[" + ToString(_width) + "],Iters["+ToString(_iterations)+"])")); } diff --git a/isis/src/mro/apps/hicalbeta/Module.h b/isis/src/mro/apps/hicalbeta/Module.h index 024f74a4d6..0547d2d296 100644 --- a/isis/src/mro/apps/hicalbeta/Module.h +++ b/isis/src/mro/apps/hicalbeta/Module.h @@ -1,4 +1,4 @@ -#if !defined(Module_h) +#ifndef Module_h #define Module_h /** * @file @@ -62,13 +62,13 @@ namespace Isis { // Constructors and Destructor Module() : _name("Module"), _csvFile(""), _data(), _history(), _fmtWidth(DefaultWidth), _fmtPrecision(DefaultPrecision) { } - Module(const std::string &name) : _name(name), _csvFile(""), _data(), + Module(const QString &name) : _name(name), _csvFile(""), _data(), _history(),_fmtWidth(DefaultWidth), _fmtPrecision(DefaultPrecision) { } - Module(const std::string &name, const HiHistory &history) : + Module(const QString &name, const HiHistory &history) : _name(name), _csvFile(""), _data(), _history(history), _fmtWidth(DefaultWidth), _fmtPrecision(DefaultPrecision) { } - Module(const std::string &name, const Module &c) : _name(name), + Module(const QString &name, const Module &c) : _name(name), _csvFile(c._csvFile), _data(c._data), _history(c._history), _fmtWidth(c._fmtWidth),_fmtPrecision(c._fmtPrecision) { } Module(const Module &c) : _name(c._name), _csvFile(c._csvFile), @@ -81,9 +81,9 @@ namespace Isis { virtual ~Module() { } /** Returns name of component */ - inline std::string name() const { return (_name); } + inline QString name() const { return (_name); } /** Returns expanded name of last CSV file loaded by loadCsv */ - inline std::string getcsvFile() const { return (_csvFile); } + inline QString getcsvFile() const { return (_csvFile); } /** Returns the size (number of elements) of data array */ inline int size() const { return (_data.dim()); } @@ -113,7 +113,7 @@ namespace Isis { * * @return HiVector */ - HiVector loadCsv(const std::string &csvBase, const HiCalConf &conf, + HiVector loadCsv(const QString &csvBase, const HiCalConf &conf, const DbProfile &prof, const int &elements = 0) { LoadCSV csv(csvBase, conf, prof); _csvFile = csv.filename(); @@ -132,7 +132,7 @@ namespace Isis { /** Record history in Pvl group object */ virtual void record(PvlGroup &pvl, - const std::string keyname = "ModuleHistory") + const QString keyname = "ModuleHistory") const { pvl += _history.makekey(keyname); return; @@ -143,12 +143,12 @@ namespace Isis { * * @param fname Name of file to dump contents to */ - void Dump(const std::string &fname) const { + void Dump(const QString &fname) const { FileName dumpc(fname); - std::string dumpcFile = dumpc.expanded(); - std::ofstream ofile(dumpcFile.c_str(), std::ios::out); + QString dumpcFile = dumpc.expanded(); + std::ofstream ofile(dumpcFile.toAscii().data(), std::ios::out); if (!ofile) { - std::string mess = "Unable to open/create module dump file " + + QString mess = "Unable to open/create module dump file " + dumpc.expanded(); throw IException(IException::User, mess, _FILEINFO_); } @@ -161,8 +161,8 @@ namespace Isis { protected: enum { DefaultWidth = 10, DefaultPrecision = 6}; - std::string _name; //!< Name of component - std::string _csvFile; //!< Fully expanded name of CSV file if present + QString _name; //!< Name of component + QString _csvFile; //!< Fully expanded name of CSV file if present HiVector _data; //!< Data vector HiHistory _history; //!< Hierarchial component history int _fmtWidth; //!< Default field with of double @@ -181,16 +181,16 @@ namespace Isis { * @param[in] (int) prec Precision used to format the value * @return (string) Formatted double value */ - inline std::string formatDbl(const double &value) const { + inline QString formatDbl(const double &value) const { std::ostringstream ostr; if (IsSpecial(value)) { ostr << std::setw(_fmtWidth) << PixelToString(value); - return (std::string(ostr.str())); + return (QString(ostr.str().c_str())); } else { // Its not special so format to callers specs ostr << std::setw(_fmtWidth) << std::setprecision(_fmtPrecision) << value; - return (std::string(ostr.str())); + return (QString(ostr.str().c_str())); } } diff --git a/isis/src/mro/apps/hicalbeta/NonLinearLSQ.h b/isis/src/mro/apps/hicalbeta/NonLinearLSQ.h index 72d3abec3f..2d173c7f80 100644 --- a/isis/src/mro/apps/hicalbeta/NonLinearLSQ.h +++ b/isis/src/mro/apps/hicalbeta/NonLinearLSQ.h @@ -1,4 +1,4 @@ -#if !defined(NonLinearLSQ_h) +#ifndef NonLinearLSQ_h #define NonLinearLSQ_h /** * @file diff --git a/isis/src/mro/apps/hicalbeta/SplineFill.h b/isis/src/mro/apps/hicalbeta/SplineFill.h index 49a46501ae..992f9496ff 100644 --- a/isis/src/mro/apps/hicalbeta/SplineFill.h +++ b/isis/src/mro/apps/hicalbeta/SplineFill.h @@ -1,4 +1,4 @@ -#if !defined(SplineFill_h) +#ifndef SplineFill_h #define SplineFill_h /** * @file @@ -81,9 +81,9 @@ namespace Isis { private: int _filled; //!< Number values replaced - std::string formHistory() { - IString cfilled(_filled); - return (std::string("SplineFill(Cubic,Filled[" + cfilled + "])")); + QString formHistory() { + QString cfilled(toString(_filled)); + return (QString("SplineFill(Cubic,Filled[" + cfilled + "])")); } void fill(const HiVector &v) { diff --git a/isis/src/mro/apps/hicalbeta/ZeroBufferFit.cpp b/isis/src/mro/apps/hicalbeta/ZeroBufferFit.cpp index 662fc6ed09..1c9c25f3d4 100644 --- a/isis/src/mro/apps/hicalbeta/ZeroBufferFit.cpp +++ b/isis/src/mro/apps/hicalbeta/ZeroBufferFit.cpp @@ -57,26 +57,26 @@ namespace Isis { _timet.setBin(ToInteger(prof("Summing"))); _timet.setLineTime(ToDouble(prof("ScanExposureDuration"))); - _skipFit = IsEqual(ConfKey(prof, "ZeroBufferFitSkipFit", std::string("TRUE")), "TRUE"); + _skipFit = IsEqual(ConfKey(prof, "ZeroBufferFitSkipFit", QString("TRUE")), "TRUE"); _useLinFit = IsTrueValue(prof, "ZeroBufferFitOnFailUseLinear"); - _absErr = ConfKey(prof, "AbsoluteError", 1.0E-4); - _relErr = ConfKey(prof, "RelativeError", 1.0E-4); + _absErr = toDouble(ConfKey(prof, "AbsoluteError", QString("1.0E-4"))); + _relErr = toDouble(ConfKey(prof, "RelativeError", QString("1.0E-4"))); - _sWidth = ConfKey(prof, "GuessFilterWidth", 17); - _sIters = ConfKey(prof, "GuessFilterIterations", 1); + _sWidth = toInt(ConfKey(prof, "GuessFilterWidth", QString("17"))); + _sIters = toInt(ConfKey(prof, "GuessFilterIterations", QString("1"))); if ( prof.exists("MaximumIterations") ) { setMaxIters(ToInteger(prof("MaximumIterations"))); } - _maxLog = ConfKey(prof, "MaximumLog", 709.0); + _maxLog = toDouble(ConfKey(prof, "MaximumLog", QString("709.0"))); _badLines = ToInteger(prof("TrimLines"))/ToInteger(prof("Summing")); - _minLines = ConfKey(prof,"ZeroBufferFitMinimumLines", 100); + _minLines = toInt(ConfKey(prof,"ZeroBufferFitMinimumLines", QString("100"))); - string histstr = "ZeroBufferFit(AbsErr[" + ToString(_absErr) + + QString histstr = "ZeroBufferFit(AbsErr[" + ToString(_absErr) + "],RelErr[" + ToString(_relErr) + "],MaxIter[" + ToString(maxIters()) + "])"; _history.add(histstr); @@ -118,7 +118,7 @@ namespace Isis { } hist << "SkipFit(TRUE: Not using LMFit)"; - _history.add(hist.str()); + _history.add(hist.str().c_str()); } else { hist << "Fit("; @@ -128,7 +128,7 @@ namespace Isis { _uncert = uncert(); hist << "Solved,#Iters[" << nIterations() << "],ChiSq[" << Chisq() << "],DoF[" << DoF() << "])"; - _history.add(hist.str()); + _history.add(hist.str().c_str()); _history.add("a0("+ToString(_coefs[0])+"+-"+ToString(_uncert[0])+")"); _history.add("a1("+ToString(_coefs[1])+"+-"+ToString(_uncert[1])+")"); _history.add("a2("+ToString(_coefs[2])+"+-"+ToString(_uncert[2])+")"); @@ -146,7 +146,7 @@ namespace Isis { hist << "Failed::Reason("<< statusstr() << "),#Iters[" << nIterations() << "])"; - _history.add(hist.str()); + _history.add(hist.str().c_str()); _history.add("a0("+ToString(_coefs[0])+")"); _history.add("a1("+ToString(_coefs[1])+")"); _history.add("a2("+ToString(_coefs[2])+")"); diff --git a/isis/src/mro/apps/hicalbeta/ZeroBufferFit.h b/isis/src/mro/apps/hicalbeta/ZeroBufferFit.h index b6be5b712d..7ac9bb1a68 100644 --- a/isis/src/mro/apps/hicalbeta/ZeroBufferFit.h +++ b/isis/src/mro/apps/hicalbeta/ZeroBufferFit.h @@ -1,4 +1,4 @@ -#if !defined(ZeroBufferFit_h) +#ifndef ZeroBufferFit_h #define ZeroBufferFit_h /** * @file diff --git a/isis/src/mro/apps/hicalbeta/ZeroBufferSmooth.h b/isis/src/mro/apps/hicalbeta/ZeroBufferSmooth.h index 23eb09d69c..8b91ef8df1 100644 --- a/isis/src/mro/apps/hicalbeta/ZeroBufferSmooth.h +++ b/isis/src/mro/apps/hicalbeta/ZeroBufferSmooth.h @@ -1,4 +1,4 @@ -#if !defined(ZeroBufferSmooth_h) +#ifndef ZeroBufferSmooth_h #define ZeroBufferSmooth_h /** * @file @@ -113,15 +113,15 @@ namespace Isis { _history.clear(); _history.add("Profile["+ prof.Name()+"]"); - int samp0 = ConfKey(prof,"ZeroBufferSmoothFirstSample",0); - int sampN = ConfKey(prof,"ZeroBufferSmoothLastSample",11); + int samp0 = toInt(ConfKey(prof,"ZeroBufferSmoothFirstSample",QString("0"))); + int sampN = toInt(ConfKey(prof,"ZeroBufferSmoothLastSample",QString("11"))); _buffer = averageSamples(cal.getBuffer(), samp0, sampN); _history.add("AveCols(Buffer["+ToString(samp0)+","+ToString(sampN)+"])"); // Smooth/filter the averages LowPassFilter bufter(_buffer, _history, - ConfKey(prof,"ZeroBufferSmoothFilterWidth",201), - ConfKey(prof,"ZeroBufferSmoothFilterIterations",2)); + toInt(ConfKey(prof,"ZeroBufferSmoothFilterWidth",QString("201"))), + toInt(ConfKey(prof,"ZeroBufferSmoothFilterIterations",QString("2")))); // If need be, fill the data with a cubic spline SplineFill spline(bufter); _data = spline.ref(); diff --git a/isis/src/mro/apps/hicalbeta/ZeroDark.h b/isis/src/mro/apps/hicalbeta/ZeroDark.h index 97bea85b12..a36d069c31 100644 --- a/isis/src/mro/apps/hicalbeta/ZeroDark.h +++ b/isis/src/mro/apps/hicalbeta/ZeroDark.h @@ -1,4 +1,4 @@ -#if !defined(ZeroDark_h) +#ifndef ZeroDark_h #define ZeroDark_h /** * @file @@ -107,11 +107,11 @@ namespace Isis { _intercept = loadCsv("DarkIntercept", conf, prof, 256); // Get temperation normalization factor - _refTemp = ConfKey(prof, "FpaReferenceTemperature", 21.0); + _refTemp = toDouble(ConfKey(prof, "FpaReferenceTemperature", toString(21.0))); // Smooth/filter if requested - int width = ConfKey(prof,"ZeroDarkFilterWidth",3); - int iters = ConfKey(prof,"ZerDarkFilterIterations",0); + int width = toInt(ConfKey(prof,"ZeroDarkFilterWidth",toString(3))); + int iters = toInt(ConfKey(prof,"ZerDarkFilterIterations",toString(0))); LowPassFilter smooth(width, iters); _history.add("Smooth(Width["+ToString(width)+"],Iters["+ToString(iters)+"])"); diff --git a/isis/src/mro/apps/hicalbeta/ZeroReverse.h b/isis/src/mro/apps/hicalbeta/ZeroReverse.h index bafaaa7d3a..f2eeec4be8 100644 --- a/isis/src/mro/apps/hicalbeta/ZeroReverse.h +++ b/isis/src/mro/apps/hicalbeta/ZeroReverse.h @@ -1,4 +1,4 @@ -#if !defined(ZeroReverse_h) +#ifndef ZeroReverse_h #define ZeroReverse_h /** * @file @@ -107,9 +107,9 @@ namespace Isis { _history.clear(); _history.add("Profile["+ prof.Name()+"]"); - int line0 = ConfKey(prof,"ZeroReverseFirstLine",0); - int lineN = ConfKey(prof,"ZeroReverseLastLine",19); - std::string tfile= conf.getMatrixSource("ReverseClockStatistics",prof); + int line0 = toInt(ConfKey(prof,"ZeroReverseFirstLine",QString("0"))); + int lineN = toInt(ConfKey(prof,"ZeroReverseLastLine",QString("19"))); + QString tfile= conf.getMatrixSource("ReverseClockStatistics",prof); HiMatrix revclk = cropLines(cal.getReverseClock(), line0, lineN); _stats.Reset(); @@ -124,18 +124,18 @@ namespace Isis { "],NulPixels["+ToString(_stats.NullPixels())+ "])"); DbAccess triggers(Pvl(tfile).FindObject("ReverseClockStatistics")); - std::string tprofName = conf.resolve("{FILTER}{CCD}_{CHANNEL}_{BIN}",prof); + QString tprofName = conf.resolve("{FILTER}{CCD}_{CHANNEL}_{BIN}",prof); _history.add("ReverseClockStatistics(File["+tfile+ "],Profile["+tprofName+"])"); _triggered= false; if (triggers.profileExists(tprofName)) { DbProfile tprof(prof, triggers.getProfile(tprofName), tprofName); - double revmean = ConfKey(tprof,"RevMeanTrigger", _stats.Average()); - double revstddev = ConfKey(tprof,"RevStdDevTrigger", DBL_MAX); - int lisTol = ConfKey(tprof, "RevLisTolerance", 1); - int hisTol = ConfKey(tprof, "RevHisTolerance", 1); - int nulTol = ConfKey(tprof, "RevNulTolerance", 1); + double revmean = toDouble(ConfKey(tprof,"RevMeanTrigger", toString(_stats.Average()))); + double revstddev = toDouble(ConfKey(tprof,"RevStdDevTrigger", toString(DBL_MAX))); + int lisTol = toInt(ConfKey(tprof, "RevLisTolerance", toString(1))); + int hisTol = toInt(ConfKey(tprof, "RevHisTolerance", toString(1))); + int nulTol = toInt(ConfKey(tprof, "RevNulTolerance", toString(1))); _history.add("TriggerLimits(RevMeanTrigger["+ToString(revmean) + "],RevStdDevTrigger["+ToString(revstddev)+ diff --git a/isis/src/mro/apps/hicalbeta/hicalbeta.cpp b/isis/src/mro/apps/hicalbeta/hicalbeta.cpp index 88e81eff10..5cbb5202b1 100644 --- a/isis/src/mro/apps/hicalbeta/hicalbeta.cpp +++ b/isis/src/mro/apps/hicalbeta/hicalbeta.cpp @@ -38,7 +38,7 @@ using namespace Isis; using namespace std; //!< Define the matrix container for systematic processing -typedef CollectorMap MatrixList; +typedef CollectorMap MatrixList; // Calibration parameter container MatrixList *calVars = 0; @@ -107,14 +107,14 @@ void calibrate(Buffer &in, Buffer &out) { void IsisMain(){ - const std::string hical_program = "hicalbeta"; - const std::string hical_version = "5.0"; - const std::string hical_revision = "$Revision: 1.15 $"; - const std::string hical_runtime = Application::DateTime(); + const QString hical_program = "hicalbeta"; + const QString hical_version = "5.0"; + const QString hical_revision = "$Revision: 1.15 $"; + const QString hical_runtime = Application::DateTime(); UserInterface &ui = Application::GetUserInterface(); - string procStep("prepping phase"); + QString procStep("prepping phase"); try { // The output from the last processing is the input into subsequent processing ProcessByLine p; @@ -124,7 +124,7 @@ void IsisMain(){ int nlines = hifrom->getLineCount(); // Initialize the configuration file - string conf(ui.GetAsString("CONF")); + QString conf(ui.GetAsString("CONF")); HiCalConf hiconf(*(hifrom->getLabel()), conf); DbProfile hiprof = hiconf.getMatrixProfile(); @@ -150,7 +150,7 @@ void IsisMain(){ } // Do I/F output DN conversions - string units = ui.GetString("UNITS"); + QString units = ui.GetString("UNITS"); // Allocate the calibration list calVars = new MatrixList; @@ -386,17 +386,17 @@ void IsisMain(){ // Get the default profile for logging purposes hiprof = hiconf.getMatrixProfile(); - const std::string conf_file = hiconf.filepath(conf); + const QString conf_file = hiconf.filepath(conf); // Quitely dumps parameter history to alternative format file. This // is completely controlled by the configuration file if ( hiprof.exists("DumpHistoryFile") ) { procStep = "logging/reporting phase"; FileName hdump(hiconf.getMatrixSource("DumpHistoryFile",hiprof)); - string hdumpFile = hdump.expanded(); - ofstream ofile(hdumpFile.c_str(), ios::out); + QString hdumpFile = hdump.expanded(); + ofstream ofile(hdumpFile.toAscii().data(), ios::out); if (!ofile) { - string mess = "Unable to open/create history dump file " + + QString mess = "Unable to open/create history dump file " + hdump.expanded(); IException(IException::User, mess, _FILEINFO_).print(); } @@ -432,7 +432,7 @@ void IsisMain(){ } // Ensure the RadiometricCalibration group is out there - const std::string rcalGroup("RadiometricCalibration"); + const QString rcalGroup("RadiometricCalibration"); if (!ocube->hasGroup(rcalGroup)) { PvlGroup temp(rcalGroup); ocube->putGroup(temp); @@ -456,7 +456,7 @@ void IsisMain(){ // Record parameter generation history. Controllable in configuration // file. Note this is optional because of a BUG!! in the ISIS label // writer as this application was initially developed - if ( IsEqual(ConfKey(hiprof,"LogParameterHistory",string("TRUE")),"TRUE")) { + if ( IsEqual(ConfKey(hiprof,"LogParameterHistory",QString("TRUE")),"TRUE")) { rcal += ZbsHist.makekey("ZeroBufferSmooth"); rcal += ZbfHist.makekey("ZeroBufferFit"); rcal += ZrHist.makekey("ZeroReverse"); @@ -474,8 +474,8 @@ void IsisMain(){ catch (IException &ie) { delete calVars; calVars = 0; - string mess = "Failed in " + procStep; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString mess = "Failed in " + procStep; + throw IException(ie, IException::User, mess, _FILEINFO_); } // Clean up parameters diff --git a/isis/src/mro/apps/hicalproc/hicalproc.cpp b/isis/src/mro/apps/hicalproc/hicalproc.cpp index 294f10c26b..371fe2ad62 100644 --- a/isis/src/mro/apps/hicalproc/hicalproc.cpp +++ b/isis/src/mro/apps/hicalproc/hicalproc.cpp @@ -20,13 +20,13 @@ enum eCoefficients {CCD_CH, R0, R1, R2, MAX_LINE}; CSVReader::CSVAxis csvArr; void GetCCD_Channel_Coefficients(Pvl & pCubeLabel); -void ReadCoefficientFile(string psCoeffile, string psCcd, int piChannel); -void AnalyzeCubenormStats(string psStatsFile, int piSumming, double & pdMinDN, double & pdMaxDN); -void CleanUp(vector & psTempFiles, string psInfile); +void ReadCoefficientFile(QString psCoeffile, QString psCcd, int piChannel); +void AnalyzeCubenormStats(QString psStatsFile, int piSumming, double & pdMinDN, double & pdMaxDN); +void CleanUp(vector & psTempFiles, QString psInfile); void IsisMain() { - vector sTempFiles; - string inFile, outFile; + vector sTempFiles; + QString inFile, outFile; try { // Get user interface @@ -45,15 +45,15 @@ void IsisMain() { outFile = ui.GetFileName("TO"); Pvl cubeLabel; if (bIngestion) { - int sDotPos = outFile.find('.'); - string sIngestedFile = outFile.substr (0, sDotPos); + int sDotPos = outFile.indexOf('.'); + QString sIngestedFile = outFile.mid(0, sDotPos); cubeLabel = Pvl(sIngestedFile + ".lev2.cub"); } else { cubeLabel = Pvl(inFile); } // Get the Summing from the label - int iSumming = int (cubeLabel.FindObject("IsisCube").FindGroup("Instrument").FindKeyword("Summing")[0]); + int iSumming = toInt(cubeLabel.FindObject("IsisCube").FindGroup("Instrument").FindKeyword("Summing")[0]); Pipeline p1("hicalproc1"); p1.SetInputFile("FROM"); @@ -160,8 +160,8 @@ void IsisMain() { p2.Application("mask").SetContinue(true); p2.Application("mask").SetInputParameter("FROM", false); p2.Application("mask").SetOutputParameter("TO", "mask2"); - p2.Application("mask").AddConstParameter("MINIMUM", IString(dMinDN)); - p2.Application("mask").AddConstParameter("MAXIMUM", IString(dMaxDN)); + p2.Application("mask").AddConstParameter("MINIMUM", toString(dMinDN)); + p2.Application("mask").AddConstParameter("MAXIMUM", toString(dMaxDN)); p2.Application("mask").AddConstParameter("PRESERVE", "INSIDE"); p2.Application("mask").AddConstParameter("SPIXELS", "NONE"); if (!bNoiseFilter) { @@ -179,8 +179,9 @@ void IsisMain() { p2.Application("fx").SetInputParameter("F1", false); p2.Application("fx").SetOutputParameter("TO", "gnfx"); p2.Application("fx").AddConstParameter("MODE", "CUBES"); - IString sEquation = "\\((F1/(" + csvArr[R0]+ "+( " + csvArr[R1] + "*line)+(" + csvArr[R2]; + QString sEquation = "\\((F1/(" + csvArr[R0]+ "+( " + csvArr[R1] + "*line)+(" + csvArr[R2]; sEquation += "*line*line))) *(line<" + csvArr[MAX_LINE]+ ") + (F1*(line>=" + csvArr[MAX_LINE] + ")))"; + sEquation = sEquation.simplified(); p2.Application("fx").AddConstParameter("EQUATION", sEquation); #ifdef _DEBUG_ cerr << "FX Equation=" << sEquation << endl; @@ -272,7 +273,7 @@ void IsisMain() { p5.AddToPipeline("hinoise"); p5.Application("hinoise").SetInputParameter ("FROM", false); p5.Application("hinoise").SetOutputParameter("TO", "hinoise"); - p5.Application("hinoise").AddConstParameter ("REMOVE", IString(bRemoveTempFiles)); + p5.Application("hinoise").AddConstParameter ("REMOVE", QString(bRemoveTempFiles)); // Values got from HiCal configuration file // Lowpass options @@ -391,12 +392,12 @@ void IsisMain() { } catch(std::exception const &se) { CleanUp(sTempFiles, inFile); - string message = "std::exception: " + (IString)se.what(); + QString message = "std::exception: " + (QString)se.what(); throw IException(IException::User, message, _FILEINFO_); } catch(...) { CleanUp(sTempFiles, inFile); - string message = "Other Error"; + QString message = "Other Error"; throw IException(IException::User, message, _FILEINFO_); } } @@ -406,22 +407,22 @@ void IsisMain() { * * @author Sharmila Prasad (2/14/2011) */ -void CleanUp(vector & psTempFiles, string psInfile) +void CleanUp(vector & psTempFiles, QString psInfile) { // more clean up for (int i=0; i<(int)psTempFiles.size(); i++) { - remove(psTempFiles[i].c_str()); + remove(psTempFiles[i].toAscii().data()); } psTempFiles.clear(); // Cleanup log files - int ipos = psInfile.find(".cub"); - if (ipos != (int)string::npos) { - string sLogFile = psInfile.replace(ipos, 4, ".hical.log"); - ipos = sLogFile.rfind("/"); + int ipos = psInfile.indexOf(".cub"); + if (ipos != -1) { + QString sLogFile = psInfile.replace(ipos, 4, ".hical.log"); + ipos = sLogFile.lastIndexOf("/"); sLogFile.replace(0, ipos+1, "./"); //cerr << "Log=" << sLogFile << endl; - remove(sLogFile.c_str()); + remove(sLogFile.toAscii().data()); } } @@ -436,27 +437,27 @@ void CleanUp(vector & psTempFiles, string psInfile) void GetCCD_Channel_Coefficients(Pvl & pCubeLabel) { int iChannel=-1, iSumming=-1; - string sCcd=""; + QString sCcd=""; PvlGroup instrGrp = pCubeLabel.FindObject("IsisCube").FindGroup("Instrument"); // Summing keyword if (!instrGrp.HasKeyword("Summing")) { - string sMsg = "Summing keyword not found"; + QString sMsg = "Summing keyword not found"; throw IException(IException::User, sMsg, _FILEINFO_); } else { PvlKeyword binKey = instrGrp.FindKeyword("Summing"); - iSumming = (int)binKey[0]; + iSumming = toInt(binKey[0]); if (iSumming != 1 && iSumming != 2 && iSumming != 4) { - string sMsg = "Invalid Summing value in input file, must be 1,2,or 4"; + QString sMsg = "Invalid Summing value in input file, must be 1,2,or 4"; throw IException(IException::User, sMsg, _FILEINFO_); } } // CCD Keyword if (!instrGrp.HasKeyword("CcdId")) { - string sMsg = "CcdId keyword not found"; + QString sMsg = "CcdId keyword not found"; throw IException(IException::User, sMsg, _FILEINFO_); } else { @@ -466,17 +467,17 @@ void GetCCD_Channel_Coefficients(Pvl & pCubeLabel) // Channel Keyword if (!instrGrp.HasKeyword("ChannelNumber")) { - string sMsg = "ChannelNumber keyword not found"; + QString sMsg = "ChannelNumber keyword not found"; throw IException(IException::User, sMsg, _FILEINFO_); } else { PvlKeyword channelKey = instrGrp.FindKeyword("ChannelNumber"); - iChannel = channelKey[0]; + iChannel = toInt(channelKey[0]); } // Get the coefficient file name - IString dCoeffFile = "$mro/calibration/HiRISE_Gain_Drift_Correction_Bin" + IString(iSumming) + ".0001.csv"; - //IString dCoeffFile = "/home/sprasad/isis3/isis/src/mro/apps/hicalproc/HiRISE_Gain_Drift_Correction_Bin" + IString(iSumming) + ".0001.csv"; + QString dCoeffFile = "$mro/calibration/HiRISE_Gain_Drift_Correction_Bin" + toString(iSumming) + ".0001.csv"; + //QString dCoeffFile = "/home/sprasad/isis3/isis/src/mro/apps/hicalproc/HiRISE_Gain_Drift_Correction_Bin" + toString(iSumming) + ".0001.csv"; #ifdef _DEBUG_ cout << dCoeffFile << endl; #endif @@ -492,14 +493,14 @@ void GetCCD_Channel_Coefficients(Pvl & pCubeLabel) * * @param psCoeffFile = Coefficient file name */ -void ReadCoefficientFile(string psCoeffile, string psCcd, int piChannel) +void ReadCoefficientFile(QString psCoeffile, QString psCcd, int piChannel) { CSVReader coefFile(psCoeffile, true, 1, ',', false, true); double dCoeff[5]; int iRows = coefFile.rows(); int iRowIndex = -1; - IString sColName = psCcd + "_" + IString(piChannel); + QString sColName = psCcd + "_" + toString(piChannel); #ifdef _DEBUG_ cout << endl << "Col name=" << sColName << "Rows=" << iRows << endl; #endif @@ -515,12 +516,11 @@ void ReadCoefficientFile(string psCoeffile, string psCcd, int piChannel) if (iRowIndex != -1) { int iArrSize = csvArr.dim(); for (int i=1; i iMaxValidPoints) { iMaxValidPoints = iCurrValidPoints; } @@ -565,15 +564,15 @@ void AnalyzeCubenormStats(string psStatsFile, int piSumming, double & pdMinDN, d } // Get the Standard deviation if (j==5) { - dStdDev.push_back(csvArr[j]); + dStdDev.push_back(toDouble(csvArr[j])); } // Get the Maximum and Minimum values if (j==6) { - dMinimum.push_back(csvArr[j]); + dMinimum.push_back(toDouble(csvArr[j])); } if (j==7) { - dMaximum.push_back(csvArr[j]); + dMaximum.push_back(toDouble(csvArr[j])); } } } diff --git a/isis/src/mro/apps/hiccdstitch/hiccdstitch.cpp b/isis/src/mro/apps/hiccdstitch/hiccdstitch.cpp index 292cf8a3df..4bb292c9cf 100644 --- a/isis/src/mro/apps/hiccdstitch/hiccdstitch.cpp +++ b/isis/src/mro/apps/hiccdstitch/hiccdstitch.cpp @@ -23,8 +23,8 @@ using namespace Isis; //helper button functins in the code void helperButtonLog(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonLog"] = (void *) helperButtonLog; return helper; } @@ -33,8 +33,8 @@ map GuiHelpers() { typedef struct { Cube *cube; // Cube object Portal *portal; // Portal for interpolation - string filename; // Name of the CCD file - string ccdName; // Name of ccd + QString filename; // Name of the CCD file + QString ccdName; // Name of ccd int ccdNumber; int mosOrder; // Mosaic order, default is summing mode int summing; // Summing mode @@ -107,7 +107,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); list.read(ui.GetFileName("FROMLIST")); if(list.size() < 1) { - string msg = "The list file[" + ui.GetFileName("FROMLIST") + + QString msg = "The list file[" + ui.GetFileName("FROMLIST") + " does not contain any filenames"; throw IException(IException::User, msg, _FILEINFO_); } @@ -116,7 +116,7 @@ void IsisMain() { // Commented out as HiRISE Team is requesting a single file to be processed // to simplify pipeline logic if(list.size() == 1) { - string msg = "The list file[" + ui.GetFileName("FROMLIST") + + QString msg = "The list file[" + ui.GetFileName("FROMLIST") + " must contain at least two filenames"; throw iException::Message(iException::User, msg, _FILEINFO_); } @@ -133,7 +133,7 @@ void IsisMain() { interp = new Interpolator(Interpolator::CubicConvolutionType); } else { - string msg = "Unknow value for INTERP [" + + QString msg = "Unknow value for INTERP [" + ui.GetString("INTERP") + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -149,7 +149,7 @@ void IsisMain() { bool gotNir = false; bool gotBg = false; bool first = true; - string obsId; // ObservationId keyword value + QString obsId; // ObservationId keyword value int maxBands = 0; for(int i = 0; i < list.size(); i++) { @@ -159,12 +159,12 @@ void IsisMain() { PvlGroup arch = cube->getLabel()->FindGroup("Archive", Pvl::Traverse); if(first) { - obsId = (string) arch["ObservationId"]; + obsId = (QString) arch["ObservationId"]; first = false; } else { - if(obsId != (string) arch["ObservationId"]) { - string msg = "Input file " + list[i].toString() + if(obsId != (QString) arch["ObservationId"]) { + QString msg = "Input file " + list[i].toString() + " has a different ObservationId"; throw IException(IException::User, msg, _FILEINFO_); } @@ -173,7 +173,7 @@ void IsisMain() { PvlGroup inst = cube->getLabel()->FindGroup("Instrument", Pvl::Traverse); int chan = inst["ChannelNumber"]; if(chan != 2) { - string msg = "Input file " + list[i].toString() + " contains a single channel"; + QString msg = "Input file " + list[i].toString() + " contains a single channel"; throw IException(IException::User, msg, _FILEINFO_); } int cpmm = inst["CpmmNumber"]; @@ -221,11 +221,11 @@ void IsisMain() { CCDinfo.mosOrder = (int)(1. / (float)CCDinfo.summing * 10. + 14.); // Determine if a shift of the CCD exists in the definitions file - // Combine summing/tdi into a string - std::string sumTdi = Isis::IString(CCDinfo.summing) + "/" + - Isis::IString(CCDinfo.tdi); + // Combine summing/tdi into a QString + QString sumTdi = toString(CCDinfo.summing) + "/" + + toString(CCDinfo.tdi); - std::string ccdId = ccdNames[ccd]; + QString ccdId = ccdNames[ccd]; if(stitch.HasObject(ccdId)) { PvlObject &ccddef = stitch.FindObject(ccdId, Pvl::Traverse); if(ccddef.HasKeyword("MosaicOrder")) { @@ -262,7 +262,7 @@ void IsisMain() { // Check for consistent filters if((gotRed && gotNir) || (gotRed && gotBg) || (gotNir && gotBg)) { - string msg = "Cannot stitch together different filter images"; + QString msg = "Cannot stitch together different filter images"; throw IException(IException::User, msg, _FILEINFO_); } @@ -274,7 +274,7 @@ void IsisMain() { int prevCCD = CCDlist[0].ccdNumber; for(vec_sz i = 1; i < CCDlist.size(); ++i) { if(CCDlist[i].ccdNumber != prevCCD + 1) { - string msg = "CCD numbers are not adjacent"; + QString msg = "CCD numbers are not adjacent"; throw IException(IException::User, msg, _FILEINFO_); } prevCCD = CCDlist[i].ccdNumber; @@ -322,7 +322,7 @@ void IsisMain() { CCDlist[i].outss = ((CCDlist[i].fpsamp - CCDlist[0].fpsamp) / minSum) + 1; // Check for appropriate bands if(CCDlist[i].nb != maxBands) { - std::ostringstream mess; + ostringstream mess; mess << "File " << CCDlist[i].filename << " does not have the required " << maxBands << " bands, but only " << CCDlist[i].nb; IException(IException::User, mess.str(), _FILEINFO_); @@ -332,8 +332,8 @@ void IsisMain() { // If we find any band count inconsistancies, gotta give up the ghost if(nBandErrs > 0) { - std::string mess = "Band count inconsistancies exist in input cubes!"; - throw IException(IException::User, mess.c_str(), _FILEINFO_); + QString mess = "Band count inconsistancies exist in input cubes!"; + throw IException(IException::User, mess, _FILEINFO_); } // Compute number of samples in output file @@ -369,14 +369,14 @@ void IsisMain() { PvlGroup ccdGroup(CCDlist[CCDindex].ccdName); ccdGroup += PvlKeyword("File", CCDlist[CCDindex].filename); - ccdGroup += PvlKeyword("FocalPlaneSample", CCDlist[CCDindex].fpsamp); - ccdGroup += PvlKeyword("FocalPlaneLine", CCDlist[CCDindex].fpline); - ccdGroup += PvlKeyword("ImageSample", CCDlist[CCDindex].outss); - ccdGroup += PvlKeyword("ImageLine", CCDlist[CCDindex].outsl); + ccdGroup += PvlKeyword("FocalPlaneSample", toString(CCDlist[CCDindex].fpsamp)); + ccdGroup += PvlKeyword("FocalPlaneLine", toString(CCDlist[CCDindex].fpline)); + ccdGroup += PvlKeyword("ImageSample", toString(CCDlist[CCDindex].outss)); + ccdGroup += PvlKeyword("ImageLine", toString(CCDlist[CCDindex].outsl)); int ccd = CCDlist[CCDindex].ccdNumber; - ccdGroup += PvlKeyword("SampleOffset", CCDlist[CCDindex].fpsamp - xoffset[ccd]); - ccdGroup += PvlKeyword("LineOffset", CCDlist[CCDindex].fpline - yoffset[ccd]); + ccdGroup += PvlKeyword("SampleOffset", toString(CCDlist[CCDindex].fpsamp - xoffset[ccd])); + ccdGroup += PvlKeyword("LineOffset", toString(CCDlist[CCDindex].fpline - yoffset[ccd])); results.AddGroup(ccdGroup); } @@ -393,9 +393,9 @@ void IsisMain() { // Write the object if requested if(ui.WasEntered("PLACEMENT")) { - std::string placefile = ui.GetFileName("PLACEMENT"); + QString placefile = ui.GetFileName("PLACEMENT"); std::ofstream pfile; - pfile.open(placefile.c_str(), std::ios::out | std::ios::trunc); + pfile.open(placefile.toAscii().data(), std::ios::out | std::ios::trunc); pfile << results << endl; pfile.close(); } @@ -518,7 +518,7 @@ void PlaceCCD(Buffer &buf) { //Helper function to output the regdeft file to log. void helperButtonLog() { UserInterface &ui = Application::GetUserInterface(); - string file(ui.GetFileName("SHIFTDEF")); + QString file(ui.GetFileName("SHIFTDEF")); Pvl p; p.Read(file); Application::GuiLog(p); diff --git a/isis/src/mro/apps/hicolormos/hicolormos.cpp b/isis/src/mro/apps/hicolormos/hicolormos.cpp index 5df1ecac61..8b94595afc 100644 --- a/isis/src/mro/apps/hicolormos/hicolormos.cpp +++ b/isis/src/mro/apps/hicolormos/hicolormos.cpp @@ -26,7 +26,7 @@ void IsisMain() { // Get the values for the from 1 cube UserInterface &ui = Application::GetUserInterface(); - string from1 = ui.GetFileName("FROM1"); + QString from1 = ui.GetFileName("FROM1"); // Make a temporary list file for automos FileName tempFile = FileName::createTempFile("$TEMPORARY/hicolormos.temp.lis"); @@ -38,22 +38,22 @@ void IsisMain() { PvlGroup from1Mosaic = from1lab.FindGroup("Mosaic", Pvl::Traverse); // Make the procuct ID (from1 archive group) - string ProdId = from1lab.FindGroup("Archive", Pvl::Traverse)["ObservationId"]; + QString ProdId = from1lab.FindGroup("Archive", Pvl::Traverse)["ObservationId"]; ProdId += "_COLOR"; // Prep for second image if we have one Pvl from2lab; PvlGroup from2Mosaic("Mosaic"); if(ui.WasEntered("FROM2")) { - string from2 = ui.GetFileName("FROM2"); + QString from2 = ui.GetFileName("FROM2"); //Add from2 file to the temporary automos input list tf.PutLine(from2 + "\n"); from2lab.Read(from2); // Test the observation ID between from1 and from2 - if((string)from1lab.FindGroup("Archive", Pvl::Traverse)["ObservationId"] != - (string)from2lab.FindGroup("Archive", Pvl::Traverse)["ObservationId"]) { - string msg = "Images not from the same observation"; + if((QString)from1lab.FindGroup("Archive", Pvl::Traverse)["ObservationId"] != + (QString)from2lab.FindGroup("Archive", Pvl::Traverse)["ObservationId"]) { + QString msg = "Images not from the same observation"; throw IException(IException::User, msg, _FILEINFO_); } @@ -190,23 +190,23 @@ void IsisMain() { } if(runXY) { - string tmp(tempFile.expanded()); - remove(tmp.c_str()); - string msg = "Camera did not intersect images to gather stats"; + QString tmp(tempFile.expanded()); + remove(tmp.toAscii().data()); + QString msg = "Camera did not intersect images to gather stats"; throw IException(IException::User, msg, _FILEINFO_); } //work on the times (from mosaic group) - string startTime = from1Mosaic["StartTime"]; - string stopTime = from1Mosaic["StopTime"]; - string startClk = from1Mosaic["SpacecraftClockStartCount"]; - string stopClk = from1Mosaic["SpacecraftClockStopCount"]; + QString startTime = from1Mosaic["StartTime"]; + QString stopTime = from1Mosaic["StopTime"]; + QString startClk = from1Mosaic["SpacecraftClockStartCount"]; + QString stopClk = from1Mosaic["SpacecraftClockStopCount"]; if(ui.WasEntered("FROM2")) { - if((string)from2Mosaic["StartTime"] < startTime) startTime = (string)from2Mosaic["StartTime"]; - if((string)from2Mosaic["StopTime"] > stopTime) stopTime = (string)from2Mosaic["StopTime"]; - if((string)from2Mosaic["SpacecraftClockStartCount"] < startClk) startClk = (string)from2Mosaic["SpacecraftClockStartCount"]; - if((string)from2Mosaic["SpacecraftClockStopCount"] < stopClk) stopClk = (string)from2Mosaic["SpacecraftClockStopCount"]; + if((QString)from2Mosaic["StartTime"] < startTime) startTime = (QString)from2Mosaic["StartTime"]; + if((QString)from2Mosaic["StopTime"] > stopTime) stopTime = (QString)from2Mosaic["StopTime"]; + if((QString)from2Mosaic["SpacecraftClockStartCount"] < startClk) startClk = (QString)from2Mosaic["SpacecraftClockStartCount"]; + if((QString)from2Mosaic["SpacecraftClockStopCount"] < stopClk) stopClk = (QString)from2Mosaic["SpacecraftClockStopCount"]; } // Get TDI and summing array @@ -229,9 +229,9 @@ void IsisMain() { // automos step - string MosaicPriority = ui.GetString("PRIORITY"); + QString MosaicPriority = ui.GetString("PRIORITY"); - string parameters = "FROMLIST=" + tempFile.expanded() + + QString parameters = "FROMLIST=" + tempFile.expanded() + " MOSAIC=" + ui.GetFileName("TO") + " PRIORITY=" + MosaicPriority; ProgramLauncher::RunIsisProgram("automos", parameters); @@ -243,13 +243,13 @@ void IsisMain() { mos += PvlKeyword("SpacecraftClockStartCount ", startClk); mos += PvlKeyword("StopTime ", stopTime); mos += PvlKeyword("SpacecraftClockStopCount ", stopClk); - mos += PvlKeyword("IncidenceAngle ", Cincid, "DEG"); - mos += PvlKeyword("EmissionAngle ", Cemiss, "DEG"); - mos += PvlKeyword("PhaseAngle ", Cphase, "DEG"); - mos += PvlKeyword("LocalTime ", ClocalSolTime, "LOCALDAY/24"); - mos += PvlKeyword("SolarLongitude ", CsolarLong, "DEG"); - mos += PvlKeyword("SubSolarAzimuth ", CsunAzimuth, "DEG"); - mos += PvlKeyword("NorthAzimuth ", CnorthAzimuth, "DEG"); + mos += PvlKeyword("IncidenceAngle ", toString(Cincid), "DEG"); + mos += PvlKeyword("EmissionAngle ", toString(Cemiss), "DEG"); + mos += PvlKeyword("PhaseAngle ", toString(Cphase), "DEG"); + mos += PvlKeyword("LocalTime ", toString(ClocalSolTime), "LOCALDAY/24"); + mos += PvlKeyword("SolarLongitude ", toString(CsolarLong), "DEG"); + mos += PvlKeyword("SubSolarAzimuth ", toString(CsunAzimuth), "DEG"); + mos += PvlKeyword("NorthAzimuth ", toString(CnorthAzimuth), "DEG"); mos += cpmmTdiFlag; mos += cpmmSummingFlag; mos += specialProcessingFlag; @@ -265,8 +265,8 @@ void IsisMain() { c.close(); // Clean up the temporary automos list file - string tmp(tempFile.expanded()); - remove(tmp.c_str()); + QString tmp(tempFile.expanded()); + remove(tmp.toAscii().data()); } // end of isis main diff --git a/isis/src/mro/apps/hicrop/hicrop.cpp b/isis/src/mro/apps/hicrop/hicrop.cpp index f81b5b27bb..59f7f80a58 100644 --- a/isis/src/mro/apps/hicrop/hicrop.cpp +++ b/isis/src/mro/apps/hicrop/hicrop.cpp @@ -44,8 +44,8 @@ pair ckBeginEndTimes(IString ckFileName); // methods for converting between lines/times/clock counts iTime line2time(double lineNumber, double lineRate, double originalStartEt); double et2line(double et, double lineRate, double originalStartEt); -IString time2clock(iTime time); -iTime clock2time(IString spacecraftClockCount); +QString time2clock(iTime time); +iTime clock2time(QString spacecraftClockCount); // method to validate calculated or user-entered cropped line and time values void validateCropLines(); void validateCropTimes(double cropStart, double cropStop, @@ -64,7 +64,7 @@ void IsisMain() { // get user inputs for input cube and open UserInterface &ui = Application::GetUserInterface(); - IString inputFileName = ui.GetFileName("FROM"); + QString inputFileName = ui.GetFileName("FROM"); try { CubeAttributeInput inAtt(inputFileName); g_cube.setVirtualBands(inAtt.bands()); @@ -106,14 +106,14 @@ void IsisMain() { // actual start time of the input cube Pvl &inLabels = *g_cube.getLabel(); PvlGroup &inputInst = inLabels.FindObject("IsisCube").FindGroup("Instrument"); - IString instId = string(inputInst["InstrumentId"]); - if (instId.UpCase() != "HIRISE") { + QString instId = (inputInst["InstrumentId"]); + if (instId.toUpper() != "HIRISE") { IString msg = "Input cube has invalid InstrumentId = [" + instId + "]. " "A HiRise image is required."; throw IException(IException::Io, msg, _FILEINFO_); } double tdiMode = inputInst["Tdi"]; //Original Instrument - string labelStartClockCount = inputInst["SpacecraftClockStartCount"]; + QString labelStartClockCount = inputInst["SpacecraftClockStartCount"]; double binMode = inputInst["Summing"]; double deltaLineTimerCount = inputInst["DeltaLineTimerCount"]; @@ -147,24 +147,24 @@ void IsisMain() { } else if (ui.GetString("SOURCE") == "JITTERFILE") { // Read the start and end times from the jitter file - IString jitterFileName = ui.GetFileName("JITTER"); + QString jitterFileName = ui.GetFileName("JITTER"); TextFile jitterFile(jitterFileName); jitterFile.SetComment("#"); - IString currLine; + QString currLine; jitterFile.GetLine(currLine, true); - QString firstFileLine = currLine.ToQt().simplified(); - double firstSampleOffset = (double) IString(firstFileLine.split(" ")[0]); - double firstLineOffset = (double) IString(firstFileLine.split(" ")[1]); + QString firstFileLine = currLine.simplified(); + double firstSampleOffset = (double) toDouble(firstFileLine.split(" ")[0]); + double firstLineOffset = (double) toDouble(firstFileLine.split(" ")[1]); if (firstSampleOffset == 0.0 && firstLineOffset == 0.0) { jitterFile.GetLine(currLine, true); } - iTime time = (double) IString( - currLine.ToQt().simplified().split(" ").last()); + iTime time = (double) toDouble( + currLine.simplified().split(" ").last()); firstValidTime = time.Et(); lastValidTime = time.Et(); while (jitterFile.GetLine(currLine)) { - time = (double) IString( - currLine.ToQt().simplified().split(" ").last()); + time = (double) toDouble( + currLine.simplified().split(" ").last()); if (time.Et() < firstValidTime) { firstValidTime = time.Et(); } @@ -276,10 +276,10 @@ void IsisMain() { // spacecraft clock start count for the labels of the cropped cube iTime adjustedCropStartTime = labelClockCountTime(cropStartTime, tdiMode, unbinnedRate, binMode); - IString adjustedCropStartClockCount = time2clock(adjustedCropStartTime); + QString adjustedCropStartClockCount = time2clock(adjustedCropStartTime); iTime adjustedCropStopTime = labelClockCountTime(cropStopTime, tdiMode, unbinnedRate, binMode); - IString adjustedCropStopClockCount = time2clock(adjustedCropStopTime); + QString adjustedCropStopClockCount = time2clock(adjustedCropStopTime); @@ -342,11 +342,11 @@ void IsisMain() { // Construct a label with the results PvlGroup results("Results"); - results += PvlKeyword("InputLines", inputLineCount); - results += PvlKeyword("NumberOfLinesCropped", inputLineCount-g_cropLineCount); - results += PvlKeyword("OututStartingLine", g_cropStartLine); - results += PvlKeyword("OututEndingLine", g_cropEndLine); - results += PvlKeyword("OututLineCount", g_cropLineCount); + results += PvlKeyword("InputLines", toString(inputLineCount)); + results += PvlKeyword("NumberOfLinesCropped", toString(inputLineCount-g_cropLineCount)); + results += PvlKeyword("OututStartingLine", toString(g_cropStartLine)); + results += PvlKeyword("OututEndingLine", toString(g_cropEndLine)); + results += PvlKeyword("OututLineCount", toString(g_cropLineCount)); results += PvlKeyword("OututStartTime", cropStartTime.UTC()); results += PvlKeyword("OututStopTime", cropStopTime.UTC()); //??? adjustedCropStopTime results += PvlKeyword("OututStartClock", adjustedCropStartClockCount); @@ -577,7 +577,7 @@ double et2line(double et, double lineRate, double originalStartEt) { * @return A string containing the spacecraft clock count corresponding * to the given time. */ -IString time2clock(iTime time) { +QString time2clock(iTime time) { // char char stringOutput[19]; double et = time.Et(); @@ -596,13 +596,13 @@ IString time2clock(iTime time) { * * @see Spice::getClockTime(clockCountString, sclkCode) */ -iTime clock2time(IString spacecraftClockCount) { +iTime clock2time(QString spacecraftClockCount) { // Convert the spacecraft clock count to ephemeris time SpiceDouble timeOutput; // The -74999 is the code to select the transformation from // high-precision MRO SCLK to ET NaifStatus::CheckErrors(); - scs2e_c(-74999, spacecraftClockCount.c_str(), &timeOutput); + scs2e_c(-74999, spacecraftClockCount.toAscii().data(), &timeOutput); NaifStatus::CheckErrors(); QVariant clockTime = timeOutput; iTime time = clockTime.toDouble(); diff --git a/isis/src/mro/apps/hicrop/tsts/cropByJitterFile/Makefile b/isis/src/mro/apps/hicrop/tsts/cropByJitterFile/Makefile index 3fc0038dfa..ed5885a062 100644 --- a/isis/src/mro/apps/hicrop/tsts/cropByJitterFile/Makefile +++ b/isis/src/mro/apps/hicrop/tsts/cropByJitterFile/Makefile @@ -42,6 +42,6 @@ commands: source=jitterfile \ jitter=$(INPUT)/PSP_008469_2040_zeroLineOffset.txt >& $(OUTPUT)/resultsLog4.txt; catlab from=$(OUTPUT)/cropped4.cub to=$(OUTPUT)/croppedLabel4.pvl; - cubediff from=$(OUTPUT)/cropped1.cub from2=$(OUTPUT)/cropped2.cub >& $(OUTPUT)/cubediff12.txt; - cubediff from=$(OUTPUT)/cropped2.cub from2=$(OUTPUT)/cropped3.cub >& $(OUTPUT)/cubediff23.txt; - cubediff from=$(OUTPUT)/cropped3.cub from2=$(OUTPUT)/cropped4.cub >& $(OUTPUT)/cubediff34.txt; + cubediff from=$(OUTPUT)/cropped1.cub from2=$(OUTPUT)/cropped2.cub | grep -v "Processed" >& $(OUTPUT)/cubediff12.txt; + cubediff from=$(OUTPUT)/cropped2.cub from2=$(OUTPUT)/cropped3.cub | grep -v "Processed" >& $(OUTPUT)/cubediff23.txt; + cubediff from=$(OUTPUT)/cropped3.cub from2=$(OUTPUT)/cropped4.cub | grep -v "Processed" >& $(OUTPUT)/cubediff34.txt; diff --git a/isis/src/mro/apps/hicubeit/hicubeit.cpp b/isis/src/mro/apps/hicubeit/hicubeit.cpp index 9c09898a5c..aae636c599 100644 --- a/isis/src/mro/apps/hicubeit/hicubeit.cpp +++ b/isis/src/mro/apps/hicubeit/hicubeit.cpp @@ -4,16 +4,16 @@ #include "Cube.h" #include "OriginalLabel.h" #include "ProgramLauncher.h" -#include +#include using namespace std; using namespace Isis; void IsisMain() { UserInterface &ui = Application::GetUserInterface(); - string redFile = ui.GetFileName("RED"); - string irFile = ui.GetFileName("IR"); - string bgFile = ui.GetFileName("BG"); + QString redFile = ui.GetFileName("RED"); + QString irFile = ui.GetFileName("IR"); + QString bgFile = ui.GetFileName("BG"); FileName tempFile = FileName::createTempFile("$TEMPORARY/hicubeit.temp.lis"); TextFile tf; @@ -23,11 +23,11 @@ void IsisMain() { tf.PutLine(bgFile + "\n"); tf.Close(); - string parameters = string(" FROMLIST = ") + tempFile.expanded() + - string(" TO = ") + ui.GetFileName("TO") + - string(" PROPLAB = ") + redFile; + QString parameters = QString(" FROMLIST = ") + tempFile.expanded() + + QString(" TO = ") + ui.GetFileName("TO") + + QString(" PROPLAB = ") + redFile; ProgramLauncher::RunIsisProgram("cubeit", parameters); - remove(tempFile.expanded().c_str()); + remove(tempFile.expanded().toAscii().data()); // Get the instrument group from each file Pvl redLab(redFile); @@ -41,37 +41,37 @@ void IsisMain() { // Error check to make sure the proper ccds are stacked if((int)redInst["CpmmNumber"] == 5) { if(((int)irInst["CpmmNumber"] != 6) || ((int)bgInst["CpmmNumber"] != 4)) { - string msg = "You can only stack color images with RED4, IR10, and BG12 "; + QString msg = "You can only stack color images with RED4, IR10, and BG12 "; msg += "or RED5, IR11, and BG13"; throw IException(IException::User, msg, _FILEINFO_); } } else if((int)redInst["CpmmNumber"] == 8) { if(((int)irInst["CpmmNumber"] != 7) || ((int)bgInst["CpmmNumber"] != 9)) { - string msg = "You can only stack color images with RED4, IR10, and BG12 "; + QString msg = "You can only stack color images with RED4, IR10, and BG12 "; msg += "or RED5, IR11, and BG13"; throw IException(IException::User, msg, _FILEINFO_); } } else { - string msg = "You can only stack color images with RED4, IR10, and BG12 "; + QString msg = "You can only stack color images with RED4, IR10, and BG12 "; msg += "or RED5, IR11, and BG13"; throw IException(IException::User, msg, _FILEINFO_); } // Concatenate all the source products into one keyword PvlKeyword sourceProductId("SourceProductId"); - sourceProductId += (string)bgInst["StitchedProductIds"][0]; + sourceProductId += (QString)bgInst["StitchedProductIds"][0]; if(bgInst["StitchedProductIds"].Size() > 1) { - sourceProductId += (string)bgInst["StitchedProductIds"][1]; + sourceProductId += (QString)bgInst["StitchedProductIds"][1]; } - sourceProductId += (string)redInst["StitchedProductIds"][0]; + sourceProductId += (QString)redInst["StitchedProductIds"][0]; if(redInst["StitchedProductIds"].Size() > 1) { - sourceProductId += (string)redInst["StitchedProductIds"][1]; + sourceProductId += (QString)redInst["StitchedProductIds"][1]; } - sourceProductId += (string)irInst["StitchedProductIds"][0]; + sourceProductId += (QString)irInst["StitchedProductIds"][0]; if(irInst["StitchedProductIds"].Size() > 1) { - sourceProductId += (string)irInst["StitchedProductIds"][1]; + sourceProductId += (QString)irInst["StitchedProductIds"][1]; } // Get min start and max stop time @@ -80,31 +80,31 @@ void IsisMain() { PvlKeyword startClk = redInst["SpacecraftClockStartCount"]; PvlKeyword stopClk = redInst["SpacecraftClockStopCount"]; - if((string) irInst["StartTime"] < (string)startTime) { + if((QString) irInst["StartTime"] < (QString)startTime) { startTime = irInst["StartTime"]; } - if((string) bgInst["StartTime"] < (string)startTime) { + if((QString) bgInst["StartTime"] < (QString)startTime) { startTime = bgInst["StartTime"]; } - if((string) irInst["StopTime"] > (string)stopTime) { + if((QString) irInst["StopTime"] > (QString)stopTime) { stopTime = irInst["StopTime"]; } - if((string) bgInst["StopTime"] > (string)stopTime) { + if((QString) bgInst["StopTime"] > (QString)stopTime) { stopTime = bgInst["StopTime"]; } - if((string) irInst["SpacecraftClockStartCount"] < (string)startClk) { + if((QString) irInst["SpacecraftClockStartCount"] < (QString)startClk) { startClk = irInst["SpacecraftClockStartCount"]; } - if((string) bgInst["SpacecraftClockStartCount"] < (string)startClk) { + if((QString) bgInst["SpacecraftClockStartCount"] < (QString)startClk) { startClk = bgInst["SpacecraftClockStartCount"]; } - if((string) irInst["SpacecraftClockStopCount"] > (string)stopClk) { + if((QString) irInst["SpacecraftClockStopCount"] > (QString)stopClk) { stopClk = irInst["SpacecraftClockStopCount"]; } - if((string) bgInst["SpacecraftClockStopCount"] > (string)stopClk) { + if((QString) bgInst["SpacecraftClockStopCount"] > (QString)stopClk) { stopClk = bgInst["SpacecraftClockStopCount"]; } @@ -122,42 +122,42 @@ void IsisMain() { PvlKeyword cpmmTdiFlag("cpmmTdiFlag"); for(int i = 0; i < 14; i++) { - cpmmTdiFlag += (string) ""; + cpmmTdiFlag += (QString) ""; } - cpmmTdiFlag[(int)redInst["CpmmNumber"]] = (string) redGrp["MRO:TDI"]; - cpmmTdiFlag[(int)irInst["CpmmNumber"]] = (string) irGrp["MRO:TDI"]; - cpmmTdiFlag[(int)bgInst["CpmmNumber"]] = (string) bgGrp["MRO:TDI"]; + cpmmTdiFlag[(int)redInst["CpmmNumber"]] = (QString) redGrp["MRO:TDI"]; + cpmmTdiFlag[(int)irInst["CpmmNumber"]] = (QString) irGrp["MRO:TDI"]; + cpmmTdiFlag[(int)bgInst["CpmmNumber"]] = (QString) bgGrp["MRO:TDI"]; // Concatenate all summing modes into one keyword PvlKeyword cpmmSummingFlag("cpmmSummingFlag"); for(int i = 0; i < 14; i++) { - cpmmSummingFlag += (string) ""; + cpmmSummingFlag += (QString) ""; } - cpmmSummingFlag[(int)redInst["CpmmNumber"]] = (string) redGrp["MRO:BINNING"]; - cpmmSummingFlag[(int)irInst["CpmmNumber"]] = (string) irGrp["MRO:BINNING"]; - cpmmSummingFlag[(int)bgInst["CpmmNumber"]] = (string) bgGrp["MRO:BINNING"]; + cpmmSummingFlag[(int)redInst["CpmmNumber"]] = (QString) redGrp["MRO:BINNING"]; + cpmmSummingFlag[(int)irInst["CpmmNumber"]] = (QString) irGrp["MRO:BINNING"]; + cpmmSummingFlag[(int)bgInst["CpmmNumber"]] = (QString) bgGrp["MRO:BINNING"]; //Concatenate all the Special_Processing_Flag into one keyword PvlKeyword specialProcessingFlag("SpecialProcessingFlag"); for(int i = 0; i < 14; i++) { - specialProcessingFlag += (string) ""; + specialProcessingFlag += (QString) ""; } //keyword Special_Processing_Flag may not be present so need to test // if not present set to NOMINAL if(redInst.HasKeyword("Special_Processing_Flag")) { - specialProcessingFlag[redInst["CpmmNumber"]] = (string) redInst["Special_Processing_Flag"]; + specialProcessingFlag[redInst["CpmmNumber"]] = (QString) redInst["Special_Processing_Flag"]; } else { specialProcessingFlag[redInst["CpmmNumber"]] = "NOMINAL"; } if(irInst.HasKeyword("Special_Processing_Flag")) { - specialProcessingFlag[irInst["CpmmNumber"]] = (string) irInst["Special_Processing_Flag"]; + specialProcessingFlag[irInst["CpmmNumber"]] = (QString) irInst["Special_Processing_Flag"]; } else { specialProcessingFlag[irInst["CpmmNumber"]] = "NOMINAL"; } if(bgInst.HasKeyword("Special_Processing_Flag")) { - specialProcessingFlag[bgInst["CpmmNumber"]] = (string) bgInst["Special_Processing_Flag"]; + specialProcessingFlag[bgInst["CpmmNumber"]] = (QString) bgInst["Special_Processing_Flag"]; } else { specialProcessingFlag[bgInst["CpmmNumber"]] = "NOMINAL"; diff --git a/isis/src/mro/apps/hicubenorm/hicubenorm.cpp b/isis/src/mro/apps/hicubenorm/hicubenorm.cpp index 1d26025d4a..85dfbc633b 100644 --- a/isis/src/mro/apps/hicubenorm/hicubenorm.cpp +++ b/isis/src/mro/apps/hicubenorm/hicubenorm.cpp @@ -1,7 +1,7 @@ #include "Isis.h" // system include files go first -#include +#include #include #include #include @@ -42,13 +42,13 @@ enum Mode {SUBTRACT, DIVIDE}; void getStats (Buffer &in); void multiply (Buffer &in, Buffer &out); void subtract (Buffer &in, Buffer &out); -void pvlOut (const string &pv); -void tableOut (const string &pv); +void pvlOut (const QString &pv); +void tableOut (const QString &pv); void PVLIn (const Isis::FileName &filename); void tableIn (const Isis::FileName &filename); void keepSame (int &totalBands, int &rowcol, Mode mode); void filterStats (vector &filter, int &filtsize, bool &pause_crop,int &channel); -void CorrectCubenormStats(int piFilterSize, bool pbPauseCrop, int piChannelNum, string psMode); +void CorrectCubenormStats(int piFilterSize, bool pbPauseCrop, int piChannelNum, QString psMode); // Main Program void IsisMain() { @@ -64,7 +64,7 @@ void IsisMain() { // parameters. UserInterface &ui = Application::GetUserInterface(); if(!(ui.WasEntered("TO")) && !(ui.WasEntered("STATS"))) { - string msg = "User must specify a TO and/or STATS file."; + QString msg = "User must specify a TO and/or STATS file."; throw IException(IException::User, msg, _FILEINFO_); } @@ -100,8 +100,8 @@ void IsisMain() { // Check to make sure the first vector has as many elements as the last // vector, and that there is a vector element for each row/col if(!bNewVersion && band.size() != (unsigned int)(rowcol * totalBands)) { - string message = "You have entered an invalid input file " + - ui.GetFileName("FROMSTATS"); + QString message = "You have entered an invalid input file " + + ui.GetFileName("FROMSTATS"); throw IException(IException::Io, message, _FILEINFO_); } @@ -126,7 +126,7 @@ void IsisMain() { // If a STATS file was specified then create statistics file if(ui.WasEntered("STATS")) { - string op = ui.GetString("FORMAT"); + QString op = ui.GetString("FORMAT"); if(op == "PVL"){ pvlOut(ui.GetFileName("STATS")); } @@ -153,7 +153,7 @@ void IsisMain() { if(ui.GetString("MODE") == "MULTIPLY") { for(unsigned int i = 0; i < band.size(); i++) { if(IsValidPixel(normalizer[i]) && normalizer[i] <= 0.0) { - string msg = "Cube file can not be normalized with [MULTIPLY] "; + QString msg = "Cube file can not be normalized with [MULTIPLY] "; msg += "option, some column averages <= 0.0"; throw IException(IException::User, msg, _FILEINFO_); } @@ -240,25 +240,25 @@ void getStats(Buffer &in) { //******************************************************** // Create PVL output of statistics //******************************************************* -void pvlOut(const string &StatFile) { +void pvlOut(const QString &StatFile) { PvlGroup results("Results"); for(unsigned int i = 0; i < band.size(); i++) { - results += PvlKeyword("Band", band[i]); - results += PvlKeyword("RowCol", element[i]); - results += PvlKeyword("ValidPixels", validpixels[i]); + results += PvlKeyword("Band", toString(band[i])); + results += PvlKeyword("RowCol", toString(element[i])); + results += PvlKeyword("ValidPixels", toString(validpixels[i])); if(validpixels[i] > 0) { - results += PvlKeyword("Mean", average[i]); - results += PvlKeyword("Median", median[i]); - results += PvlKeyword("Std", stddev[i]); - results += PvlKeyword("Minimum", minimum[i]); - results += PvlKeyword("Maximum", maximum[i]); + results += PvlKeyword("Mean", toString(average[i])); + results += PvlKeyword("Median", toString(median[i])); + results += PvlKeyword("Std", toString(stddev[i])); + results += PvlKeyword("Minimum", toString(minimum[i])); + results += PvlKeyword("Maximum", toString(maximum[i])); } else { - results += PvlKeyword("Mean", 0.0); - results += PvlKeyword("Median", 0.0); - results += PvlKeyword("Std", 0.0); - results += PvlKeyword("Minimum", 0.0); - results += PvlKeyword("Maximum", 0.0); + results += PvlKeyword("Mean", toString(0.0)); + results += PvlKeyword("Median", toString(0.0)); + results += PvlKeyword("Std", toString(0.0)); + results += PvlKeyword("Minimum", toString(0.0)); + results += PvlKeyword("Maximum", toString(0.0)); } } @@ -270,11 +270,11 @@ void pvlOut(const string &StatFile) { //******************************************************** // Create Tabular output of statistics //******************************************************* -void tableOut(const string &StatFile) { +void tableOut(const QString &StatFile) { // Open output file // TODO check status and throw error ofstream out; - out.open(StatFile.c_str(), std::ios::out); + out.open(StatFile.toAscii().data(), std::ios::out); // Output a header out << std::setw(8) << "Band"; @@ -327,21 +327,21 @@ void PVLIn(const Isis::FileName &filename) { PvlObject::PvlKeywordIterator itr = results.Begin(); while(itr != results.End()) { - band.push_back((*itr)[0]); + band.push_back(toInt((*itr)[0])); itr++; - element.push_back((*itr)[0]); + element.push_back(toInt((*itr)[0])); itr++; - validpixels.push_back((*itr)[0]); + validpixels.push_back(toInt((*itr)[0])); itr++; - average.push_back((*itr)[0]); + average.push_back(toDouble((*itr)[0])); itr++; - median.push_back((*itr)[0]); + median.push_back(toDouble((*itr)[0])); itr++; - stddev.push_back((*itr)[0]); + stddev.push_back(toDouble((*itr)[0])); itr++; - minimum.push_back((*itr)[0]); + minimum.push_back(toDouble((*itr)[0])); itr++; - maximum.push_back((*itr)[0]); + maximum.push_back(toDouble((*itr)[0])); itr++; } } @@ -351,12 +351,12 @@ void PVLIn(const Isis::FileName &filename) { //******************************************************* void tableIn(const Isis::FileName &filename) { ifstream in; - string expanded(filename.expanded()); - in.open(expanded.c_str(), std::ios::in); + QString expanded(filename.expanded()); + in.open(expanded.toAscii().data(), std::ios::in); if(!in) { - string message = "Error opening " + filename.expanded(); + QString message = "Error opening " + filename.expanded(); throw IException(IException::Io, message, _FILEINFO_); } @@ -495,7 +495,7 @@ void filterStats(vector &filter, int &filtsize, bool &pause_crop, const int ch_pause_cnt = 3; const int ch_pause[2][ch_pause_cnt] = {{252, 515, 778}, {247, 510, 773}}; const int ch_width[2][ch_pause_cnt] = {{11, 11, 11}, {11, 11, 11}}; - const string ch_direc[2] = {"RIGHT", "LEFT"}; + const QString ch_direc[2] = {"RIGHT", "LEFT"}; const int iterations = 10; vector filtin; vector filtout; @@ -581,14 +581,14 @@ void filterStats(vector &filter, int &filtsize, bool &pause_crop, * @param piChannelNum - Input image Channel number * @param psMode - Highpass Mode (Divide/Subtract) */ -void CorrectCubenormStats(int piFilterSize, bool pbPauseCrop, int piChannelNum, string psMode) +void CorrectCubenormStats(int piFilterSize, bool pbPauseCrop, int piChannelNum, QString psMode) { const int MARKER = -999999; const int iChannelSize = 3; const int iIterations = 50; const int iChannelPause[2][iChannelSize] = {{252, 515, 778}, {247, 510, 773}}; const int iChannelWidth[2][iChannelSize] = {{17, 17, 17}, {17, 17, 17}}; - const string sChannelDirection[2] = {"RIGHT", "LEFT"}; + const QString sChannelDirection[2] = {"RIGHT", "LEFT"}; int iLeftCut = 6; int iRightCut = 6; diff --git a/isis/src/mro/apps/hideal2pds/hideal2pds.cpp b/isis/src/mro/apps/hideal2pds/hideal2pds.cpp index 91c7f4566e..c33752415f 100644 --- a/isis/src/mro/apps/hideal2pds/hideal2pds.cpp +++ b/isis/src/mro/apps/hideal2pds/hideal2pds.cpp @@ -42,25 +42,25 @@ void IsisMain() { PvlObject *isisCubeLab = inputCube->getLabel(); // Error check to make sure this is a valid cube for this program - IString origInstrument = isisCubeLab->FindObject("IsisCube") + QString origInstrument = isisCubeLab->FindObject("IsisCube") .FindGroup("OriginalInstrument")["InstrumentId"][0]; if (origInstrument != "HIRISE") { - IString msg = "Input cube must from a HiRISE image. The original " + QString msg = "Input cube must from a HiRISE image. The original " "InstrumentId = [" + origInstrument + "] is unsupported by hideal2pds."; throw IException(IException::Io, msg, _FILEINFO_); } - IString instrumentId = isisCubeLab->FindObject("IsisCube") + QString instrumentId = isisCubeLab->FindObject("IsisCube") .FindGroup("Instrument")["InstrumentId"][0]; if (instrumentId != "IdealCamera") { - IString msg = "Input cube must be IdealCamera. InstrumentId = [" + QString msg = "Input cube must be IdealCamera. InstrumentId = [" + instrumentId + "] is unsupported by hideal2pds."; throw IException(IException::Io, msg, _FILEINFO_); } - IString target = isisCubeLab->FindObject("IsisCube") + QString target = isisCubeLab->FindObject("IsisCube") .FindGroup("Instrument")["TargetName"][0]; - if (target.UpCase() != "MARS") { - IString msg = "Input cube must from a HiRise image. The target = [" + if (target.toUpper() != "MARS") { + QString msg = "Input cube must from a HiRise image. The target = [" + target + "] is unsupported by hideal2pds."; throw IException(IException::Io, msg, _FILEINFO_); } @@ -86,12 +86,12 @@ void IsisMain() { // output PDS file with detached labels and tables for this application FileName outPdsFile(ui.GetFileName("TO", "img")); - IString pdsLabelFile = outPdsFile.path() + "/" + outPdsFile.baseName() + ".lbl"; + QString pdsLabelFile = outPdsFile.path() + "/" + outPdsFile.baseName() + ".lbl"; p.SetDetached(pdsLabelFile); // create generic pds label - this will be finalized with proper line/byte counts later Pvl &pdsLabel = p.StandardPdsLabel(ProcessExportPds::Image); - IString isisLabelFile = ui.GetFileName("FROM"); + QString isisLabelFile = ui.GetFileName("FROM"); // Translate the keywords from the input cube label that go in the PDS label PvlTranslationManager cubeLab(*(inputCube->getLabel()), @@ -120,7 +120,7 @@ void IsisMain() { // already been set in the labels by the ExportTable call. This is not // a problem since our tables are detached. However, it could be a // problem if we decide to allow attached PDS products in the future. - IString pdsTableFile = ""; + QString pdsTableFile = ""; pdsTableFile = outPdsFile.baseName() + "_INSTRUMENT_POINTING_TABLE.dat"; Table instRotationTable = cam->instrumentRotation()->Cache("InstrumentPointing"); p.ExportTable(instRotationTable, pdsTableFile); @@ -186,8 +186,8 @@ void IsisMain() { } else { tableKeyword = PvlKeyword("SOLAR_LONGITUDE", - cam->solarLongitude().force360Domain() - .positiveEast(Angle::Degrees), + toString(cam->solarLongitude().force360Domain() + .positiveEast(Angle::Degrees)), "DEGREES"); } bodyRotTabLab += tableKeyword; @@ -222,8 +222,8 @@ void IsisMain() { // now that all translations/additions/modifications to the labels have been // completed p.OutputDetachedLabel(); - string outFileName(outPdsFile.expanded()); - ofstream outputStream(outFileName.c_str()); + QString outFileName(outPdsFile.expanded()); + ofstream outputStream(outFileName.toAscii().data()); p.StartProcess(outputStream); p.EndProcess(); outputStream.close(); @@ -314,7 +314,7 @@ void updatePdsLabelImageObject(PvlObject *isisCubeLab, Pvl &pdsLabel) { // The given input cube is not supported for export to PDS. The AlphaCube // group values indicate that this cube has been not only cropped, but // also scaled (reduced or enlarged) - IString msg = "The AlphaCube group values of the input Isis cube indicate " + QString msg = "The AlphaCube group values of the input Isis cube indicate " "that this cube has been scaled. Unable to export scaled " "cubes to PDS using hideal2pds."; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -324,17 +324,17 @@ void updatePdsLabelImageObject(PvlObject *isisCubeLab, Pvl &pdsLabel) { firstSample = alphaStartingSample; firstLine = alphaStartingLine; } - image += PvlKeyword("SOURCE_LINE_SAMPLES", sourceSamples); - image += PvlKeyword("SOURCE_LINES", sourceLines); - image += PvlKeyword("FIRST_LINE_SAMPLE", firstSample); - image += PvlKeyword("FIRST_LINE", firstLine); + image += PvlKeyword("SOURCE_LINE_SAMPLES", toString(sourceSamples)); + image += PvlKeyword("SOURCE_LINES", toString(sourceLines)); + image += PvlKeyword("FIRST_LINE_SAMPLE", toString(firstSample)); + image += PvlKeyword("FIRST_LINE", toString(firstLine)); // Add center wavelength and bandwidth with correct units to the IMAGE object PvlKeyword &oldCenter = image["CENTER_FILTER_WAVELENGTH"]; PvlKeyword newCenter("CENTER_FILTER_WAVELENGTH"); for(int val = 0; val < oldCenter.Size(); ++val) { - if(((IString)(oldCenter.Unit(val))).UpCase() == "NANOMETERS") { + if(((QString)(oldCenter.Unit(val))).toUpper() == "NANOMETERS") { newCenter.AddValue(oldCenter[val], "NM"); } else { @@ -346,7 +346,7 @@ void updatePdsLabelImageObject(PvlObject *isisCubeLab, Pvl &pdsLabel) { PvlKeyword &oldBandWidth = image["BAND_WIDTH"]; PvlKeyword newBandWidth("BAND_WIDTH"); for(int val = 0; val < oldBandWidth.Size(); ++val) { - if(((IString)(oldBandWidth.Unit(val))).UpCase() == "NANOMETERS") { + if(((QString)(oldBandWidth.Unit(val))).toUpper() == "NANOMETERS") { newBandWidth.AddValue(oldBandWidth[val], "NM"); } else { @@ -399,8 +399,8 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, pdsLabel.AddKeyword(rationale, PvlContainer::Replace); } else if ( !pdsLabel.HasKeyword("RATIONALE_DESC") - || string(pdsLabel["RATIONALE_DESC"]) == "NULL" ){ - IString msg = "Unable to export HiRise product to PDS without " + || QString(pdsLabel["RATIONALE_DESC"]) == "NULL" ){ + QString msg = "Unable to export HiRise product to PDS without " "RationaleDescription value. The input cube value for this " "keyword is Null, the user is required to enter a value."; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -408,15 +408,15 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, pdsLabel += PvlKeyword("PRODUCT_VERSION_ID", ui.GetString("VERSION")); // Add the N/A constant keyword to the ROOT object - pdsLabel += PvlKeyword("NOT_APPLICABLE_CONSTANT", -9998); + pdsLabel += PvlKeyword("NOT_APPLICABLE_CONSTANT", toString(-9998)); // Compute and add SOFTWARE_NAME to the ROOT object - IString sfname; + QString sfname; sfname.clear(); sfname += "Isis " + Application::Version() + " " + Application::GetUserInterface().ProgramName(); pdsLabel += PvlKeyword("SOFTWARE_NAME", sfname); - IString matchedCube = isisCubeLab->FindObject("IsisCube").FindGroup("Instrument") + QString matchedCube = isisCubeLab->FindObject("IsisCube").FindGroup("Instrument") .FindKeyword("MatchedCube")[0]; FileName matchedCubeFileNoPath(matchedCube); pdsLabel += PvlKeyword("MATCHED_CUBE", matchedCubeFileNoPath.name()); @@ -425,16 +425,16 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, bool jitter = false; if (isisCubeLab->FindObject("IsisCube").FindGroup("Instrument") .HasKeyword("ImageJitterCorrected")) { - jitter = int(isisCubeLab->FindObject("IsisCube") + jitter = toInt(isisCubeLab->FindObject("IsisCube") .FindGroup("Instrument")["ImageJitterCorrected"][0]); - pdsLabel += PvlKeyword("IMAGE_JITTER_CORRECTED", jitter); + pdsLabel += PvlKeyword("IMAGE_JITTER_CORRECTED", toString((int)jitter)); } else { pdsLabel += PvlKeyword("IMAGE_JITTER_CORRECTED", "UNK"); } // Add Isis Kernels group keywords to the ROOT object - IString shapeModel = isisCubeLab->FindObject("IsisCube").FindGroup("Kernels") + QString shapeModel = isisCubeLab->FindObject("IsisCube").FindGroup("Kernels") .FindKeyword("ShapeModel")[0]; FileName shapeModelFileNoPath(shapeModel); pdsLabel += PvlKeyword("SHAPE_MODEL", shapeModelFileNoPath.name()); @@ -443,7 +443,7 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, // mosaic input cube. // Add NaifKeywords Object values to the ROOT object - IString radiiName = "BODY" + IString(cam->naifBodyCode()) + "_RADII"; + QString radiiName = "BODY" + QString(cam->naifBodyCode()) + "_RADII"; PvlObject naifKeywordGroup = cam->getStoredNaifKeywords(); if (naifKeywordGroup.HasKeyword(radiiName)) { @@ -455,30 +455,30 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, else { Distance naifBodyRadii[3]; cam->radii(naifBodyRadii); - pdsLabel += PvlKeyword("A_AXIS_RADIUS", naifBodyRadii[0].kilometers(), "KILOMETERS"); - pdsLabel += PvlKeyword("B_AXIS_RADIUS", naifBodyRadii[1].kilometers(), "KILOMETERS"); - pdsLabel += PvlKeyword("C_AXIS_RADIUS", naifBodyRadii[2].kilometers(), "KILOMETERS"); + pdsLabel += PvlKeyword("A_AXIS_RADIUS", toString(naifBodyRadii[0].kilometers()), "KILOMETERS"); + pdsLabel += PvlKeyword("B_AXIS_RADIUS", toString(naifBodyRadii[1].kilometers()), "KILOMETERS"); + pdsLabel += PvlKeyword("C_AXIS_RADIUS", toString(naifBodyRadii[2].kilometers()), "KILOMETERS"); } if (naifKeywordGroup.HasKeyword("BODY_FRAME_CODE")) { pdsLabel += naifKeywordGroup.FindKeyword("BODY_FRAME_CODE"); } else { - pdsLabel += PvlKeyword("BODY_FRAME_CODE", cam->naifBodyFrameCode()); + pdsLabel += PvlKeyword("BODY_FRAME_CODE", toString(cam->naifBodyFrameCode())); } if (naifKeywordGroup.HasKeyword("IDEAL_FOCAL_LENGTH")) { pdsLabel += naifKeywordGroup.FindKeyword("IDEAL_FOCAL_LENGTH"); } else { - pdsLabel += PvlKeyword("IDEAL_FOCAL_LENGTH", cam->FocalLength()); + pdsLabel += PvlKeyword("IDEAL_FOCAL_LENGTH", toString(cam->FocalLength())); } if (naifKeywordGroup.HasKeyword("IDEAL_PIXEL_PITCH")) { pdsLabel += naifKeywordGroup.FindKeyword("IDEAL_PIXEL_PITCH"); } else { - pdsLabel += PvlKeyword("IDEAL_PIXEL_PITCH", cam->PixelPitch()); + pdsLabel += PvlKeyword("IDEAL_PIXEL_PITCH", toString(cam->PixelPitch())); } if (naifKeywordGroup.HasKeyword("IDEAL_TRANSX")) { @@ -488,7 +488,7 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, const double *transXValues = cam->FocalPlaneMap()->TransX(); PvlKeyword transX("IDEAL_TRANSX"); for (int i = 0; i < 3; i++) { - transX += transXValues[i]; + transX += toString(transXValues[i]); } pdsLabel += transX; } @@ -500,7 +500,7 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, const double *transYValues = cam->FocalPlaneMap()->TransY(); PvlKeyword transY("IDEAL_TRANSY"); for (int i = 0; i < 3; i++) { - transY += transYValues[i]; + transY += toString(transYValues[i]); } pdsLabel += transY; } @@ -512,7 +512,7 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, const double *transSValues = cam->FocalPlaneMap()->TransS(); PvlKeyword transS("IDEAL_TRANSS"); for (int i = 0; i < 3; i++) { - transS += transSValues[i]; + transS += toString(transSValues[i]); } pdsLabel += transS; } @@ -524,7 +524,7 @@ void updatePdsLabelRootObject(PvlObject *isisCubeLab, Pvl &pdsLabel, const double *transLValues = cam->FocalPlaneMap()->TransL(); PvlKeyword transL("IDEAL_TRANSL"); for (int i = 0; i < 3; i++) { - transL += transLValues[i]; + transL += toString(transLValues[i]); } pdsLabel += transL; } @@ -546,7 +546,7 @@ void updatePdsLabelTimeParametersGroup(Pvl &pdsLabel) { struct tm *tmbuf = gmtime(&startTime); char timestr[80]; strftime(timestr, 80, "%Y-%m-%dT%H:%M:%S", tmbuf); - string dateTime = (string) timestr; + QString dateTime = (QString) timestr; iTime tmpDateTime(dateTime); PvlGroup &timeParam = pdsLabel.FindGroup("TIME_PARAMETERS"); timeParam += PvlKeyword("PRODUCT_CREATION_TIME", tmpDateTime.UTC()); diff --git a/isis/src/mro/apps/hidestripe/hidestripe.cpp b/isis/src/mro/apps/hidestripe/hidestripe.cpp index 9b3248847e..0cef74fa7a 100644 --- a/isis/src/mro/apps/hidestripe/hidestripe.cpp +++ b/isis/src/mro/apps/hidestripe/hidestripe.cpp @@ -1,7 +1,7 @@ #include "Isis.h" // system include files go first -#include +#include #include #include #include @@ -54,7 +54,7 @@ void IsisMain() { //Check to make sure we got the cube properly if(!inputCube.isOpen()) { - string msg = "Could not open FROM cube" + fromFile.expanded(); + QString msg = "Could not open FROM cube" + fromFile.expanded(); throw IException(IException::User, msg, _FILEINFO_); } @@ -92,12 +92,12 @@ void IsisMain() { //Phases must be able to stretch across the entire cube if(totalSamples != phases[3]) { - IString required_samples(phases[3]); - IString bin_string(binning_mode); - string msg = "image must have exactly "; + QString required_samples(phases[3]); + QString bin_QString(binning_mode); + QString msg = "image must have exactly "; msg += required_samples; msg += " samples per line for binning mode "; - msg += bin_string; + msg += bin_QString; throw IException(IException::User, msg, _FILEINFO_); } @@ -112,7 +112,7 @@ void IsisMain() { // ones (2, 4, 6, etc.). The below algorithm determines which of these is the // case. - string parity = ui.GetString("PARITY"); + QString parity = ui.GetString("PARITY"); if(parity == "EVEN") { offset = 1; } @@ -290,7 +290,7 @@ void fix(Buffer &in, Buffer &out) { void DestripeForOtherBinningModes(int piSamples) { int iBoxSample = (2 * piSamples) - 1; - IString sSamples(iBoxSample); + QString sSamples(toString(iBoxSample)); Pipeline p("hidestripe"); p.SetInputFile("FROM"); diff --git a/isis/src/mro/apps/hidtmgen/hidtmgen.cpp b/isis/src/mro/apps/hidtmgen/hidtmgen.cpp index bb20fb2e39..3e66d5d855 100644 --- a/isis/src/mro/apps/hidtmgen/hidtmgen.cpp +++ b/isis/src/mro/apps/hidtmgen/hidtmgen.cpp @@ -36,8 +36,8 @@ void IsisMain() { // Verify HiRISE if (inCube->getBandCount() > 1 || inCube->getLabel()->HasObject("Instrument")) { - string msg = "Input cube [" + ui.GetFileName("FROM") + "] does not appear" - + "to be a DTM"; + QString msg = "Input cube [" + ui.GetFileName("FROM") + "] does not appear" + + "to be a DTM"; throw IException(IException::User, msg, _FILEINFO_); } @@ -105,20 +105,20 @@ void IsisMain() { // Convert radius to KM newRadius /= 1000; - mapping.FindKeyword("A_AXIS_RADIUS").SetValue(newRadius); + mapping.FindKeyword("A_AXIS_RADIUS").SetValue(toString(newRadius)); mapping.FindKeyword("A_AXIS_RADIUS").SetUnits("KM"); - mapping.FindKeyword("B_AXIS_RADIUS").SetValue(newRadius); + mapping.FindKeyword("B_AXIS_RADIUS").SetValue(toString(newRadius)); mapping.FindKeyword("B_AXIS_RADIUS").SetUnits("KM"); - mapping.FindKeyword("C_AXIS_RADIUS").SetValue(newRadius); + mapping.FindKeyword("C_AXIS_RADIUS").SetValue(toString(newRadius)); mapping.FindKeyword("C_AXIS_RADIUS").SetUnits("KM"); } else if (mapping["MAP_PROJECTION_TYPE"][0] == "POLAR STEREOGRAPHIC") { - double clat = ((mapping["MAXIMUM_LATITUDE"][0].ToDouble() - - mapping["MINIMUM_LATITUDE"][0].ToDouble() ) / 2) + - mapping["MINIMUM_LATITUDE"][0].ToDouble() ; - double clon = ((mapping["EASTERNMOST_LONGITUDE"][0].ToDouble() - - mapping["WESTERNMOST_LONGITUDE"][0].ToDouble() ) / 2) + - mapping["WESTERNMOST_LONGITUDE"][0].ToDouble() ; + double clat = ((toDouble(mapping["MAXIMUM_LATITUDE"][0]) - + toDouble(mapping["MINIMUM_LATITUDE"][0]) ) / 2) + + toDouble(mapping["MINIMUM_LATITUDE"][0]) ; + double clon = ((toDouble(mapping["EASTERNMOST_LONGITUDE"][0]) - + toDouble(mapping["WESTERNMOST_LONGITUDE"][0]) ) / 2) + + toDouble(mapping["WESTERNMOST_LONGITUDE"][0]) ; isEquirectangular = false; // North polar case @@ -139,7 +139,7 @@ void IsisMain() { } // Unsupported projection else { - string msg = "The projection type [" + + QString msg = "The projection type [" + mapping["MAP_PROJECTION_TYPE"][0] + "] is not supported"; throw IException(IException::User, msg, _FILEINFO_); @@ -150,7 +150,7 @@ void IsisMain() { // Create and then add object, this will be used later in orthos as well. PvlObject viewingParameters("VIEWING_PARAMETERS"); - viewingParameters.AddKeyword(PvlKeyword("NORTH_AZIMUTH",northAzimuth,"DEG")); + viewingParameters.AddKeyword(PvlKeyword("NORTH_AZIMUTH",toString(northAzimuth),"DEG")); pdsLabel.AddObject(viewingParameters); @@ -191,7 +191,7 @@ void IsisMain() { form->Add(format); pdsLabel.SetFormat(form); - string note = "Pixel values in this file represent elevations in meters " + QString note = "Pixel values in this file represent elevations in meters " "above the martian equipotential surface (Mars 2000 Datum) defined by " "Smith, et al. (2001). Conversion from pixel units to geophysical " "units is given by the keyvalues for SCALING_FACTOR and OFFSET. This " @@ -224,7 +224,7 @@ void IsisMain() { FileName ortho1(ui.GetFileName("ORTHO1")); FileName ortho3(ui.GetFileName("ORTHO3")); - IString vers; // Version string, will be used in orthos + QString vers; // Version string, will be used in orthos if (!defaultNames) { IString pId = ui.GetFileName("DTMTO"); pId.substr(0, pId.find_first_of('.')+1); @@ -233,18 +233,18 @@ void IsisMain() { } else { // Set projection letter - IString pId = "DTE"; + QString pId = "DTE"; pId += isEquirectangular ? "E" : "P"; // Find scale letter pId += findScaleLetter(projection.FindKeyword("MAP_SCALE")); // Product ids of orthos - pId += ortho1.baseName().substr(3,12); - pId += ortho3.baseName().substr(3,12); - IString producing = inputParameters["PRODUCING_INSTITUTION"][0]; + pId += ortho1.baseName().mid(3,12); + pId += ortho3.baseName().mid(3,12); + QString producing = inputParameters["PRODUCING_INSTITUTION"][0]; if (producing.size() > 1) { - string msg = "PRODUCTING_INSTITUTION value [" + producing + "] must be a single character"; + QString msg = "PRODUCTING_INSTITUTION value [" + producing + "] must be a single character"; throw IException(IException::User, msg, _FILEINFO_); } pId += "_" + producing; @@ -258,30 +258,30 @@ void IsisMain() { // >10, takes first two digits // The number found here is used in ortho images as well. if (version >= 10.0) { - vers = IString(version).substr(0,2); + vers = IString(IString(version).substr(0,2)).ToQt(); } else if (version >= 1.0) { - vers = IString(version); + vers = IString(version).ToQt(); bool wasInt = false; // Checking for integer values, if so, make #.0 into 0# // necessary because in DTMgen version 1.0 corresponded to a 01 in names. if (vers.size() == 3) { if (vers.at(2) == '0') { - vers = "0" + vers.substr(0,1); + vers = "0" + IString(vers.mid(0,1)).ToQt(); wasInt = true; } } // Wasn't int, make #.# into ## if (!wasInt) { - vers = IString(version).Remove("."); - if (vers.size() > 2) vers = vers.substr(0,2); + vers = IString(IString(version).Remove(".")).ToQt(); + if (vers.size() > 2) vers = vers.mid(0,2); } } // 0 - <1, if 0.#, is 0#, is 0.#####, is first two ## else if (version >= 0.001) { // Any less and we get E... not dealing with that. - vers = IString(version).Remove("."); - int nonZero = vers.find_first_not_of('0'); - if (vers.size() > 2) vers = vers.substr(nonZero-1,2); + vers = IString(IString(version).Remove(".")).ToQt(); + int nonZero = vers.lastIndexOf('0'); + if (vers.size() > 2) vers = vers.mid(nonZero-1,2); } // It was negative, or something else crazy? else { @@ -294,9 +294,9 @@ void IsisMain() { pdsLabel.AddKeyword(PvlKeyword("PRODUCT_ID",pId)); // Source product ids - IString orthoS1 = ortho1.baseName().substr(0,15); - IString orthoS3 = ortho3.baseName().substr(0,15); - IString sourceId = "("+orthoS1+","+orthoS3+")"; // (######_####,######_####) + QString orthoS1 = ortho1.baseName().mid(0,15); + QString orthoS3 = ortho3.baseName().mid(0,15); + QString sourceId = "("+orthoS1+","+orthoS3+")"; // (######_####,######_####) pdsLabel.AddKeyword(PvlKeyword("SOURCE_PRODUCT_ID",sourceId)); } // End scope of defaultNames true @@ -318,16 +318,16 @@ void IsisMain() { // Create statistics and add to image group Statistics * stat = inCube->getStatistics(); - image.AddKeyword(PvlKeyword("VALID_MINIMUM",stat->Minimum())); - image.AddKeyword(PvlKeyword("VALID_MAXIMUM",stat->Maximum())); + image.AddKeyword(PvlKeyword("VALID_MINIMUM",toString(stat->Minimum()))); + image.AddKeyword(PvlKeyword("VALID_MAXIMUM",toString(stat->Maximum()))); // The output directory, will be used for ortho images as well FileName outDir = FileName(ui.GetString("OUTPUTDIR")); if (!outDir.fileExists()) { outDir.dir().mkpath("."); } - string outDirString = outDir.expanded(); - if (outDirString.substr(outDirString.size()-1, 1) != "/") { + QString outDirString = outDir.expanded(); + if (outDirString.mid(outDirString.size()-1, 1) != "/") { outDirString += "/"; outDir = FileName(outDirString); } @@ -335,13 +335,13 @@ void IsisMain() { // Output the DTM, it should be ready FileName outFile; if (defaultNames) { - string dir = outDir.expanded(); + QString dir = outDir.expanded(); outFile = FileName(dir + pdsLabel.FindKeyword("PRODUCT_ID")[0] + ".IMG"); } else { outFile = FileName(ui.GetFileName("DTMTO")); } - ofstream oCube(outFile.expanded().c_str()); + ofstream oCube(outFile.expanded().toAscii().data()); p.OutputLabel(oCube); @@ -387,13 +387,13 @@ void IsisMain() { // Loop through 4 ortho images for (int i = 0; i < 4; /*4 = Number of ortho images*/ i++) { - IString ortho("ORTHO" + IString(i + 1)); + QString ortho("ORTHO" + toString(i + 1)); Cube * orthoInCube = p.SetInputCube(ortho); Pvl & orthoLabel = p.StandardPdsLabel(ProcessExportPds::Image); PvlObject & orthoMap = orthoLabel.FindObject("IMAGE_MAP_PROJECTION"); - IString orthoOut; + QString orthoOut; if (!defaultNames) { orthoOut = ui.GetFileName(ortho); } @@ -409,11 +409,11 @@ void IsisMain() { orthoOut += findScaleLetter(orthoMap.FindKeyword("MAP_SCALE")); // continue building name - orthoOut += ortho1.baseName().substr(3,12); - orthoOut += ortho3.baseName().substr(3,12); - IString producing = inputParameters["PRODUCING_INSTITUTION"][0]; + orthoOut += ortho1.baseName().mid(3,12); + orthoOut += ortho3.baseName().mid(3,12); + QString producing = inputParameters["PRODUCING_INSTITUTION"][0]; if (producing.size() > 1) { - string msg = "PRODUCTING_INSTITUTION value [" + producing + "] must be a single character"; + QString msg = "PRODUCTING_INSTITUTION value [" + producing + "] must be a single character"; throw IException(IException::User, msg, _FILEINFO_); } orthoOut += "_" + producing; @@ -433,11 +433,11 @@ void IsisMain() { // Convert radius to KM newRadius /= 1000; - orthoMap.FindKeyword("A_AXIS_RADIUS").SetValue(newRadius); + orthoMap.FindKeyword("A_AXIS_RADIUS").SetValue(toString(newRadius)); orthoMap.FindKeyword("A_AXIS_RADIUS").SetUnits("KM"); - orthoMap.FindKeyword("B_AXIS_RADIUS").SetValue(newRadius); + orthoMap.FindKeyword("B_AXIS_RADIUS").SetValue(toString(newRadius)); orthoMap.FindKeyword("B_AXIS_RADIUS").SetUnits("KM"); - orthoMap.FindKeyword("C_AXIS_RADIUS").SetValue(newRadius); + orthoMap.FindKeyword("C_AXIS_RADIUS").SetValue(toString(newRadius)); orthoMap.FindKeyword("C_AXIS_RADIUS").SetUnits("KM"); } // Else case for Polar Stereographic is unnecessary as all it does is @@ -457,9 +457,9 @@ void IsisMain() { orthoLabel.AddKeyword(PvlKeyword("SOURCE_PRODUCT_ID",ui.GetString("SOURCE_PRODUCT_ID"))); } else { - IString orthoS1 = ortho1.baseName().substr(0,15); - IString orthoS3 = ortho3.baseName().substr(0,15); - IString sourceId = "("+orthoS1+","+orthoS3+")"; // (######_####,######_####) + QString orthoS1 = ortho1.baseName().mid(0,15); + QString orthoS3 = ortho3.baseName().mid(0,15); + QString sourceId = "("+orthoS1+","+orthoS3+")"; // (######_####,######_####) orthoLabel.AddKeyword(PvlKeyword("SOURCE_PRODUCT_ID",sourceId)); } @@ -493,14 +493,14 @@ void IsisMain() { FileName orthoFile; if (defaultNames) { - string dir = outDir.expanded(); + QString dir = outDir.expanded(); orthoFile = FileName(dir + orthoLabel.FindKeyword("PRODUCT_ID")[0] + ".IMG"); } else { orthoFile = FileName(ui.GetFileName(ortho + "TO")); } - ofstream orthoPdsOut(orthoFile.expanded().c_str()); + ofstream orthoPdsOut(orthoFile.expanded().toAscii().data()); p.OutputLabel(orthoPdsOut); p.StartProcess(orthoPdsOut); orthoPdsOut.close(); diff --git a/isis/src/mro/apps/hiequal/hiequal.cpp b/isis/src/mro/apps/hiequal/hiequal.cpp index aa9a04870b..92cb946d32 100644 --- a/isis/src/mro/apps/hiequal/hiequal.cpp +++ b/isis/src/mro/apps/hiequal/hiequal.cpp @@ -10,7 +10,7 @@ void IsisMain() { // Make sure the user enters an "OUTSTATS" file if the CALCULATE option // is selected - std::string processOpt = ui.GetString("PROCESS"); + QString processOpt = ui.GetString("PROCESS"); if (processOpt == "CALCULATE") { if (!ui.WasEntered("OUTSTATS")) { std::string msg = "If the CALCULATE option is selected, you must enter"; diff --git a/isis/src/mro/apps/hifringe/hifringe.cpp b/isis/src/mro/apps/hifringe/hifringe.cpp index 804c624c2c..cef174c006 100644 --- a/isis/src/mro/apps/hifringe/hifringe.cpp +++ b/isis/src/mro/apps/hifringe/hifringe.cpp @@ -33,7 +33,7 @@ using namespace std; using namespace Isis; -void pvlOut(Statistics stats1, Statistics stats2, string name, int start, +void pvlOut(Statistics stats1, Statistics stats2, QString name, int start, int end, PvlObject *one, PvlObject *two); static const char *const @@ -48,7 +48,7 @@ void IsisMain() { //Check to make sure we got the cube properly if(!inputCube.isOpen()) { - string msg = "Could not open FROM cube" + fromFile.expanded(); + QString msg = "Could not open FROM cube" + fromFile.expanded(); throw IException(IException::User, msg, _FILEINFO_); } Process p; @@ -70,7 +70,7 @@ void IsisMain() { int numSections = ui.GetInteger("SECTIONS"); if(numSections > 9) { - string msg = "You may have no more than 9 sections per side"; + QString msg = "You may have no more than 9 sections per side"; throw IException(IException::User, msg, _FILEINFO_); } @@ -149,8 +149,7 @@ void IsisMain() { // Write the results to the output file if the user specified one PvlObject leftSide("LeftSide"), rightSide("RightSide"); for(int i = 0 ; i < numSections ; i++) { - IString sectionNumber = i + 1; - string sectionName = "Section" + sectionNumber; + QString sectionName = "Section" + toString(i + 1); pvlOut(sections[i][0], //Stats to add to the left Object sections[i][1], //Stats to add to the right Object sectionName, //Name for the new groups @@ -189,31 +188,31 @@ void IsisMain() { outputPvl.Write(ui.GetFileName("TO")); } -void pvlOut(Statistics stats1, Statistics stats2, string name, int start, +void pvlOut(Statistics stats1, Statistics stats2, QString name, int start, int end, PvlObject *one, PvlObject *two) { PvlGroup left(name); - left += PvlKeyword("StartLine", start + 1); - left += PvlKeyword("EndLine", end); - left += PvlKeyword("TotalPixels", stats1.TotalPixels()); - left += PvlKeyword("ValidPixels", stats1.ValidPixels()); + left += PvlKeyword("StartLine", toString(start + 1)); + left += PvlKeyword("EndLine", toString(end)); + left += PvlKeyword("TotalPixels", toString(stats1.TotalPixels())); + left += PvlKeyword("ValidPixels", toString(stats1.ValidPixels())); if(stats1.ValidPixels() > 0) { - left += PvlKeyword("Mean", stats1.Average()); - left += PvlKeyword("StandardDeviation", stats1.StandardDeviation()); - left += PvlKeyword("Minimum", stats1.Minimum()); - left += PvlKeyword("Maximum", stats1.Maximum()); + left += PvlKeyword("Mean", toString(stats1.Average())); + left += PvlKeyword("StandardDeviation", toString(stats1.StandardDeviation())); + left += PvlKeyword("Minimum", toString(stats1.Minimum())); + left += PvlKeyword("Maximum", toString(stats1.Maximum())); } one->AddGroup(left); PvlGroup right(name); - right += PvlKeyword("StartLine", start + 1); - right += PvlKeyword("EndLine", end); - right += PvlKeyword("TotalPixels", stats2.TotalPixels()); - right += PvlKeyword("ValidPixels", stats2.ValidPixels()); + right += PvlKeyword("StartLine", toString(start + 1)); + right += PvlKeyword("EndLine", toString(end)); + right += PvlKeyword("TotalPixels", toString(stats2.TotalPixels())); + right += PvlKeyword("ValidPixels", toString(stats2.ValidPixels())); if(stats2.ValidPixels() > 0) { - right += PvlKeyword("Mean", stats2.Average()); - right += PvlKeyword("StandardDeviation", stats2.StandardDeviation()); - right += PvlKeyword("Minimum", stats2.Minimum()); - right += PvlKeyword("Maximum", stats2.Maximum()); + right += PvlKeyword("Mean", toString(stats2.Average())); + right += PvlKeyword("StandardDeviation", toString(stats2.StandardDeviation())); + right += PvlKeyword("Minimum", toString(stats2.Minimum())); + right += PvlKeyword("Maximum", toString(stats2.Maximum())); } two->AddGroup(right); } diff --git a/isis/src/mro/apps/hifurrows/hifurrows.cpp b/isis/src/mro/apps/hifurrows/hifurrows.cpp index ddb38b0fb5..4d1c4aa2c9 100644 --- a/isis/src/mro/apps/hifurrows/hifurrows.cpp +++ b/isis/src/mro/apps/hifurrows/hifurrows.cpp @@ -125,7 +125,7 @@ void IsisMain() { ss >> finish; } label += "Column" + begin + "to" + finish; - stats += PvlKeyword(label, furrows[i].mvstats[j].Correlation()); + stats += PvlKeyword(label.c_str(), toString(furrows[i].mvstats[j].Correlation())); } } Application::Log(stats); @@ -240,7 +240,7 @@ void RemoveFurrows_Version_1_42(void) #endif // apply trim filter if furrows found - IString sTempFile("./FixFurrows.cub"); + QString sTempFile("./FixFurrows.cub"); if(bFurrowsFound) { Pipeline p; p.SetInputFile(FileName(ui.GetFileName("TO"))); @@ -280,7 +280,7 @@ void RemoveFurrows_Version_1_42(void) procSample.EndProcess(); // clean up - remove(sTempFile.c_str()); + remove(sTempFile.toAscii().data()); } } diff --git a/isis/src/mro/apps/higlob/higlob.cpp b/isis/src/mro/apps/higlob/higlob.cpp index 307d67923b..3daf8b382a 100644 --- a/isis/src/mro/apps/higlob/higlob.cpp +++ b/isis/src/mro/apps/higlob/higlob.cpp @@ -31,7 +31,7 @@ void IsisMain() { // Open the input cube UserInterface &ui = Application::GetUserInterface(); - string from = ui.GetFileName("FROM"); + QString from = ui.GetFileName("FROM"); g_cube.open(from); samples = g_cube.getSampleCount(); diff --git a/isis/src/mro/apps/hijitreg/HiJitCube.cpp b/isis/src/mro/apps/hijitreg/HiJitCube.cpp index d69d2a6dab..66a9083399 100644 --- a/isis/src/mro/apps/hijitreg/HiJitCube.cpp +++ b/isis/src/mro/apps/hijitreg/HiJitCube.cpp @@ -34,7 +34,6 @@ #include "FileName.h" using namespace UA::HiRISE; -using std::string; using std::endl; using std::ostringstream; @@ -59,7 +58,7 @@ namespace Isis { /** * @brief Constructor with file to open */ - HiJitCube::HiJitCube(const std::string &filename) { + HiJitCube::HiJitCube(const QString &filename) { initLocal(); OpenCube(filename); } @@ -67,7 +66,7 @@ namespace Isis { /** * @brief Constructor with file to open and potential shift applied */ - HiJitCube::HiJitCube(const std::string &filename, PvlObject &shift) { + HiJitCube::HiJitCube(const QString &filename, PvlObject &shift) { initLocal(); OpenCube(filename, shift); } @@ -94,13 +93,13 @@ namespace Isis { } - void HiJitCube::OpenCube(const std::string &filename) { + void HiJitCube::OpenCube(const QString &filename) { open(filename); Init(); return; } - void HiJitCube::OpenCube(const std::string &filename, PvlObject &shift) { + void HiJitCube::OpenCube(const QString &filename, PvlObject &shift) { OpenCube(filename); // Determine if a shift of the CCD exists in the definitions file @@ -159,10 +158,10 @@ namespace Isis { sclk = sclk.highestVersion(); // Load the kernels - string lsk = leapseconds.expanded(); - string sClock = sclk.expanded(); - furnsh_c(lsk.c_str()); - furnsh_c(sClock.c_str()); + QString lsk = leapseconds.expanded(); + QString sClock = sclk.expanded(); + furnsh_c(lsk.toAscii().data()); + furnsh_c(sClock.toAscii().data()); // Ensure it is loaded only once naifLoaded = true; @@ -179,9 +178,9 @@ namespace Isis { / 1000000.0); jdata.linerate = jdata.unBinnedRate * ((double) jdata.summing); - if(!jdata.scStartTime.empty()) { - string scStartTimeString = jdata.scStartTime; - scs2e_c(-74999, scStartTimeString.c_str(), &jdata.obsStartTime); + if(!jdata.scStartTime.isEmpty()) { + QString scStartTimeString = jdata.scStartTime; + scs2e_c(-74999, scStartTimeString.toAscii().data(), &jdata.obsStartTime); // Adjust the start time so that it is the effective time for // the first line in the image file jdata.obsStartTime -= (jdata.unBinnedRate * (((double(jdata.tdiMode / 2.0) @@ -227,7 +226,7 @@ namespace Isis { Isis::PvlGroup idinst; jdata.filename = getFileName(); Isis::PvlGroup &archive = label->FindGroup("Archive", Isis::Pvl::Traverse); - jdata.productId = (string) archive["ProductId"]; + jdata.productId = (QString) archive["ProductId"]; jdata.lines = getLineCount(); if(label->FindObject("IsisCube").HasGroup("OriginalInstrument")) { @@ -267,8 +266,8 @@ namespace Isis { } jdata.ccdName = Instrument::CCD_NAMES[jdata.cpmmNumber]; jdata.dltCount = inst["DeltaLineTimerCount"]; - jdata.UTCStartTime = (string) inst["StartTime"]; - jdata.scStartTime = (string) inst["SpacecraftClockStartCount"]; + jdata.UTCStartTime = (QString) inst["StartTime"]; + jdata.scStartTime = (QString) inst["SpacecraftClockStartCount"]; try { if(originst) { diff --git a/isis/src/mro/apps/hijitreg/HiJitCube.h b/isis/src/mro/apps/hijitreg/HiJitCube.h index 4b3dff4748..b90a037a1f 100644 --- a/isis/src/mro/apps/hijitreg/HiJitCube.h +++ b/isis/src/mro/apps/hijitreg/HiJitCube.h @@ -59,8 +59,8 @@ namespace Isis { * Structure that contains all pertinent data for the cube */ struct JitInfo { - std::string filename; - std::string productId; + QString filename; + QString productId; int lines; int samples; int sampOffset; @@ -69,10 +69,10 @@ namespace Isis { int summing; int channelNumber; int cpmmNumber; - std::string ccdName; + QString ccdName; double dltCount; - std::string UTCStartTime; - std::string scStartTime; + QString UTCStartTime; + QString scStartTime; double obsStartTime; double unBinnedRate; double linerate; @@ -102,8 +102,8 @@ namespace Isis { public: HiJitCube(); - HiJitCube(const std::string &filename); - HiJitCube(const std::string &filename, PvlObject &shift); + HiJitCube(const QString &filename); + HiJitCube(const QString &filename, PvlObject &shift); ~HiJitCube(); void setSampleOffset(int soff); @@ -122,8 +122,8 @@ namespace Isis { return (jdata.lineOffset); } - void OpenCube(const std::string &filename); - void OpenCube(const std::string &filename, PvlObject &shift); + void OpenCube(const QString &filename); + void OpenCube(const QString &filename, PvlObject &shift); inline const JitInfo &GetInfo() const { return (jdata); } @@ -140,8 +140,8 @@ namespace Isis { /** * Returns the string representation of the overlapping region */ - std::string PolyToString() const { - return (fpGeom->toString()); + QString PolyToString() const { + return (fpGeom->toString().c_str()); } private: diff --git a/isis/src/mro/apps/hijitreg/hijitreg.cpp b/isis/src/mro/apps/hijitreg/hijitreg.cpp index 484569ff68..1d56596649 100644 --- a/isis/src/mro/apps/hijitreg/hijitreg.cpp +++ b/isis/src/mro/apps/hijitreg/hijitreg.cpp @@ -49,7 +49,7 @@ struct JitterParms { HiJitCube::JitInfo matchJit; HiJitCube::Corners fromCorns; HiJitCube::Corners matchCorns; - std::string regFile; + QString regFile; int rows; int cols; double lSpacing; @@ -85,7 +85,7 @@ void IsisMain() { // Open the first cube. It will be matched to the second input cube. HiJitCube trans; CubeAttributeInput &attTrans = ui.GetInputAttribute("FROM"); - vector bandTrans = attTrans.bands(); + vector bandTrans = attTrans.bands(); trans.setVirtualBands(bandTrans); trans.OpenCube(ui.GetFileName("FROM"), stitch); @@ -94,13 +94,13 @@ void IsisMain() { // first to this one by attempting to compute a sample/line translation HiJitCube match; CubeAttributeInput &attMatch = ui.GetInputAttribute("MATCH"); - vector bandMatch = attMatch.bands(); + vector bandMatch = attMatch.bands(); match.setVirtualBands(bandMatch); match.OpenCube(ui.GetFileName("MATCH"), stitch); // Ensure only one band if((trans.getBandCount() != 1) || (match.getBandCount() != 1)) { - string msg = "Input Cubes must have only one band!"; + QString msg = "Input Cubes must have only one band!"; throw IException(IException::User, msg, _FILEINFO_); } @@ -109,7 +109,7 @@ void IsisMain() { // Determine intersection if(!trans.intersects(match)) { - string msg = "Input Cubes do not overlap!"; + QString msg = "Input Cubes do not overlap!"; throw IException(IException::User, msg, _FILEINFO_); } @@ -183,8 +183,8 @@ void IsisMain() { cn.SetCreatedDate(iTime::CurrentLocalTime()); // Get serial numbers for input cubes - string transSN = SerialNumber::Compose(trans, true); - string matchSN = SerialNumber::Compose(match, true); + QString transSN = SerialNumber::Compose(trans, true); + QString matchSN = SerialNumber::Compose(match, true); PvlGroup &instrument = trans.getLabel()->FindGroup("Instrument", Pvl::Traverse); cn.SetTarget(instrument["TargetName"][0]); @@ -276,8 +276,8 @@ void IsisMain() { #if defined(ISIS_DEBUG) ostringstream tstr; tstr << "R" << r << "C" << c << "_chip.cub"; - string fcname("from" + tstr.str()); - string mcname("match" + tstr.str()); + QString fcname("from" + tstr.str()); + QString mcname("match" + tstr.str()); pchip.Write(mcname); fchip.Write(fcname); @@ -310,7 +310,7 @@ void IsisMain() { } // Add the measures to a control point - string str = "Row " + IString(r) + " Column " + IString(c); + QString str = "Row " + toString(r) + " Column " + toString(c); ControlPoint * cp = new ControlPoint(str); cp->SetType(ControlPoint::Free); cp->Add(cmTrans); @@ -326,10 +326,10 @@ void IsisMain() { // The flatfile is comma seperated and can be imported into an excel // spreadsheet if(ui.WasEntered("FLATFILE")) { - string fFile = ui.GetFileName("FLATFILE"); + QString fFile = ui.GetFileName("FLATFILE"); ofstream os; - string fFileExpanded = FileName(fFile).expanded(); - os.open(fFileExpanded.c_str(), ios::out); + QString fFileExpanded = FileName(fFile).expanded(); + os.open(fFileExpanded.toAscii().data(), ios::out); dumpResults(os, reglist, jparms, *ar); } @@ -348,9 +348,9 @@ void IsisMain() { if(jparms.sStats.ValidPixels() > 0) { double sTrans = (int)(jparms.sStats.Average() * 100.0) / 100.0; double lTrans = (int)(jparms.lStats.Average() * 100.0) / 100.0; - results += PvlKeyword("Sample", sTrans); - results += PvlKeyword("Line", lTrans); - results += PvlKeyword("NSuspects", jparms.nSuspects); + results += PvlKeyword("Sample", toString(sTrans)); + results += PvlKeyword("Line", toString(lTrans)); + results += PvlKeyword("NSuspects", toString(jparms.nSuspects)); } else { results += PvlKeyword("Sample", "NULL"); diff --git a/isis/src/mro/apps/hijitter/hijitter.cpp b/isis/src/mro/apps/hijitter/hijitter.cpp index c8fb8635bc..436aac6adf 100644 --- a/isis/src/mro/apps/hijitter/hijitter.cpp +++ b/isis/src/mro/apps/hijitter/hijitter.cpp @@ -25,13 +25,13 @@ using namespace Isis; void init(FileList &inList); FileName masterCcdFileName(FileList &inList, int masterCcdNumber); void processNoprojFiles(Pipeline &p); -void cropLines(const string inFile, double eTime1, double eTime2, int & line1, int & line2, int & numLines); -void ephemerisTimeFromJitterFile(const string jitterFile, double & eTime1, double & eTime2); +void cropLines(QString inFile, double eTime1, double eTime2, int & line1, int & line2, int & numLines); +void ephemerisTimeFromJitterFile(QString jitterFile, double & eTime1, double & eTime2); // global variable declarations -vector g_ccdFiles; -vector g_tempFiles; +vector g_ccdFiles; +vector g_tempFiles; vector g_ccdNumbers; int g_firstFilter; int g_numFiles; @@ -164,7 +164,7 @@ void IsisMain() { mainPipeline.Prepare(); - IString masterFile = mainPipeline.Application("cubeatt").GetOutputs()[masterFileNum - g_firstFilter]; + QString masterFile = mainPipeline.Application("cubeatt").GetOutputs()[masterFileNum - g_firstFilter]; mainPipeline.Application("appjit").AddConstParameter("MASTER", masterFile); mainPipeline.Run(); @@ -190,7 +190,7 @@ void IsisMain() { // the outputs from this pipeline are temporary files created by cubeatt for (int i = 0; i < g_numFiles; i++) { g_tempFiles.push_back(FileName("$TEMPORARY/noproj.FROM" - + IString(i + 1) + ".cub").expanded()); + + toString(i + 1) + ".cub").expanded()); } // Do some calculations, delete the final outputs from the pipeline @@ -221,12 +221,12 @@ void IsisMain() { mainPipeline.Application("editlab").AddConstParameter("OPTIONS", "SETKEY"); mainPipeline.Application("editlab").AddConstParameter("GRPNAME", "Instrument"); mainPipeline.Application("editlab").AddConstParameter("KEYWORD", "ImageJitterCorrected"); - mainPipeline.Application("editlab").AddConstParameter("VALUE", true); + mainPipeline.Application("editlab").AddConstParameter("VALUE", "1"); mainPipeline.Run(); if (ui.WasEntered("JITTERCK")) { - IString params = "FROM=" + masterFile + " TO=" + ui.GetFileName("JITTERCK"); + QString params = "FROM=" + masterFile + " TO=" + ui.GetFileName("JITTERCK"); try { Progress ckwriterProg; @@ -238,7 +238,7 @@ void IsisMain() { ProgramLauncher::RunIsisProgram("ckwriter", params); } catch(IException &e) { - IString msg = "Creation of the output ck, " + + QString msg = "Creation of the output ck, " + ui.GetFileName("JITTERCK") + " failed."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -260,7 +260,7 @@ void IsisMain() { // Crop the lines using the jitter file if crop is ebabled if (ui.GetBoolean("CROP")) { double eTime1, eTime2; - string jitterFile = ui.GetAsString("JITTER"); + QString jitterFile = ui.GetAsString("JITTER"); ephemerisTimeFromJitterFile(jitterFile, eTime1, eTime2); Progress cropProg; @@ -272,13 +272,13 @@ void IsisMain() { int line1 = 0, line2 = 0; int numLines = 0; - cropLines(mainPipeline.FinalOutput(i).c_str(), eTime1, eTime2, line1, line2, numLines); + cropLines(mainPipeline.FinalOutput(i), eTime1, eTime2, line1, line2, numLines); Pipeline pcrop("Crop Pipeline"); pcrop.KeepTemporaryFiles(false); - IString tag = "crop" + IString(i); - string inFile(mainPipeline.FinalOutput(i).c_str()); - string outFile = "temp_"+tag+".cub"; + QString tag = "crop" + toString(i); + QString inFile(mainPipeline.FinalOutput(i)); + QString outFile = "temp_"+tag+".cub"; pcrop.SetInputFile(FileName(inFile)); pcrop.SetOutputFile(FileName(outFile)); @@ -286,18 +286,18 @@ void IsisMain() { pcrop.AddToPipeline("crop", tag); pcrop.Application(tag).SetInputParameter ("FROM", false); pcrop.Application(tag).SetOutputParameter("TO", "crop"); - pcrop.Application(tag).AddConstParameter ("LINE", line1); - pcrop.Application(tag).AddConstParameter ("NLINES", numLines); + pcrop.Application(tag).AddConstParameter ("LINE", toString(line1)); + pcrop.Application(tag).AddConstParameter ("NLINES", toString(numLines)); pcrop.Run(); - remove(inFile.c_str()); - rename(outFile.c_str(), inFile.c_str()); + remove(inFile.toAscii().data()); + rename(outFile.toAscii().data(), inFile.toAscii().data()); cropProg.CheckStatus(); } } for (unsigned int tempFile = 0; tempFile < g_tempFiles.size(); tempFile++) { - remove(g_tempFiles[tempFile].c_str()); + remove(g_tempFiles[tempFile].toAscii().data()); } @@ -319,11 +319,11 @@ void IsisMain() { */ FileName masterCcdFileName(FileList &inList, int masterCcdNumber) { if (g_ccdFiles.empty()) { - IString msg = "Global variables are not initialized."; + QString msg = "Global variables are not initialized."; throw IException(IException::Programmer, msg, _FILEINFO_); } - if (!g_ccdFiles.empty() && g_ccdFiles[masterCcdNumber].empty()) { - IString msg = "File containing master CCD [" + IString(masterCcdNumber) + "] is not in the input file list."; + if (!g_ccdFiles.empty() && g_ccdFiles[masterCcdNumber].isEmpty()) { + QString msg = "File containing master CCD [" + toString(masterCcdNumber) + "] is not in the input file list."; throw IException(IException::User, msg, _FILEINFO_); } return g_ccdFiles[masterCcdNumber]; @@ -339,7 +339,7 @@ FileName masterCcdFileName(FileList &inList, int masterCcdNumber) { void init(FileList &inList) { if (!g_ccdFiles.empty()) { - IString msg = "Global variable have already been initialized."; + QString msg = "Global variable have already been initialized."; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -353,26 +353,26 @@ void init(FileList &inList) { Pvl labels(currentFileName.expanded()); PvlGroup &inst = labels.FindGroup("Instrument", Pvl::Traverse); - IString ccdKeywordValue = (string)inst["CcdId"]; + QString ccdKeywordValue = (QString)inst["CcdId"]; int ccdNumber = 0; - if (ccdKeywordValue.find("RED") == 0) { - ccdNumber = (int) ((IString)ccdKeywordValue.substr(3)); + if (ccdKeywordValue.indexOf("RED") == 0) { + ccdNumber = (int) toInt((QString)ccdKeywordValue.mid(3)); } - else if (ccdKeywordValue.find("IR") == 0) { - ccdNumber = (int) ((IString)ccdKeywordValue.substr(2)); + else if (ccdKeywordValue.indexOf("IR") == 0) { + ccdNumber = (int) toInt((QString)ccdKeywordValue.mid(2)); } - else if (ccdKeywordValue.find("BG") == 0) { - ccdNumber = (int) ((IString)ccdKeywordValue.substr(2)); + else if (ccdKeywordValue.indexOf("BG") == 0) { + ccdNumber = (int) toInt((QString)ccdKeywordValue.mid(2)); } else { - IString msg = "CcdId value of [" + ccdKeywordValue + "] found in [" + QString msg = "CcdId value of [" + ccdKeywordValue + "] found in [" + inList[i].toString() + "] not supported. Valid values " "include RED0-RED9, IR10-IR11, BG12-BG13"; throw IException(IException::Programmer, msg, _FILEINFO_); } if (ccdNumber < 0 || ccdNumber > 13) { - IString msg = "CcdId value of [" + ccdKeywordValue + "] found in [" + QString msg = "CcdId value of [" + ccdKeywordValue + "] found in [" + inList[i].toString() + "] not supported. Valid values " "include RED0-RED9, IR10-IR11, BG12-BG13"; throw IException(IException::Programmer, msg, _FILEINFO_); @@ -388,7 +388,7 @@ void init(FileList &inList) { g_numFiles++; } else { // last CCD number was larger than this CCD number - IString msg = "The input file list must be in ascending order from RED0 to BG13"; + QString msg = "The input file list must be in ascending order from RED0 to BG13"; throw IException(IException::User, msg, _FILEINFO_); } @@ -396,7 +396,7 @@ void init(FileList &inList) { g_ccdNumbers.push_back(ccdNumber); } catch(IException &e) { - IString msg = "File [" + inList[i].toString() + "] is not a valid MRO cube"; + QString msg = "File [" + inList[i].toString() + "] is not a valid MRO cube"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -407,25 +407,25 @@ void init(FileList &inList) { // bool foundFirstRedCcd = false; // bool foundLastRedCcd = false; -// IString lastRedCcdFound = ""; +// QString lastRedCcdFound = ""; // for (unsigned int i = 0; i < 10; i++) { // if (!foundFirstRedCcd && !g_ccdFiles[i].empty()) { // foundFirstRedCcd = true; // } // else if (foundFirstRedCcd && !foundLastRedCcd && g_ccdFiles[i].empty()) { // foundLastRedCcd = true; -// lastRedCcdFound = IString(i-1); +// lastRedCcdFound = toString(i-1); // } // else if (foundFirstRedCcd && foundLastRedCcd && !g_ccdFiles[i].empty()) { -// IString msg = "Invalid file list. All red CCDs listed must be consecutive. " +// QString msg = "Invalid file list. All red CCDs listed must be consecutive. " // "Input list has files containing [RED" + lastRedCcdFound -// + "] and [RED" + IString((int)i) + "], but the CCDs between " +// + "] and [RED" + toString((int)i) + "], but the CCDs between " // "are not represented in the given file list."; // throw IException(IException::User, msg, _FILEINFO_); // } // } // if ( foundFirstRedCcd && !foundLastRedCcd ) { -// IString msg = "Invalid file list. Adjacent CCD not in the input file list " +// QString msg = "Invalid file list. Adjacent CCD not in the input file list " // "for [RED" + g_firstFilter + "]."; // throw IException(IException::User, msg, _FILEINFO_); // } @@ -434,13 +434,13 @@ void init(FileList &inList) { // Verify that each ccds has at least one overlapping ccd bool previousCcdEmpty = false; for (unsigned int i = 0; i < g_ccdFiles.size(); i++) { - if (g_ccdFiles[i].empty()) { + if (g_ccdFiles[i].isEmpty()) { previousCcdEmpty = true; } else { // this ccd is present in the list files bool nextCcdEmpty = true; if (i != 13) { - nextCcdEmpty = g_ccdFiles[i+1].empty(); + nextCcdEmpty = g_ccdFiles[i+1].isEmpty(); } // if no overlapping CCD is in the list, throw an error: if ( (i < 9 && previousCcdEmpty && nextCcdEmpty) @@ -450,24 +450,24 @@ void init(FileList &inList) { || (i == 12 && nextCcdEmpty) || (i == 13 && previousCcdEmpty) ) { - IString color = ""; + QString color = ""; if (i < 10) color = "RED"; else if (i < 12) color = "IR"; else color = "BG"; - IString overlappingCcds = ""; + QString overlappingCcds = ""; if (i == 0 || i == 10 || i == 12) { - overlappingCcds = "CCD [" + color + IString((int) (i+1) ) + "] is"; + overlappingCcds = "CCD [" + color + toString((int) (i+1) ) + "] is"; } else if (i == 9 || i == 11 || i == 13) { - overlappingCcds = "CCD [" + color + IString((int) (i-1)) + "] is"; + overlappingCcds = "CCD [" + color + toString((int) (i-1)) + "] is"; } else { - overlappingCcds = "CCDs [RED" + IString((int) (i-1)) - + "] and [RED" + IString((int) (i+1)) + "] are"; + overlappingCcds = "CCDs [RED" + toString((int) (i-1)) + + "] and [RED" + toString((int) (i+1)) + "] are"; } - IString msg = "Invalid file list. A file containing the CCD [" + color - + IString((int) i) + "] is in the input file list, " + QString msg = "Invalid file list. A file containing the CCD [" + color + + toString((int) i) + "] is in the input file list, " "but adjacent " + overlappingCcds + " not in the list."; throw IException(IException::User, msg, _FILEINFO_); } @@ -501,7 +501,6 @@ void processNoprojFiles(Pipeline &p) { hijitregProg.CheckStatus(); for (int i = 0; i < g_numFiles - 1; i++) { - // If this CCD and the consecutive CCD are both in the input list, // use the current cubes in the pipeline to create an output flat // file for this overlap from the hijireg program. This will @@ -514,12 +513,12 @@ void processNoprojFiles(Pipeline &p) { if (g_ccdNumbers[i] != 9 && g_ccdNumbers[i] != 11 && g_ccdNumbers[i] != 13 && g_ccdNumbers[i+1] == g_ccdNumbers[i] + 1) { - IString tempDir = FileName("$TEMPORARY").expanded(); - IString flatFileName = tempDir + "/first" + IString(g_ccdNumbers[i]) - + "-" + IString(g_ccdNumbers[i+1]) + ".flat"; - IString params = ""; - params += "FROM=" + tempDir + "/noproj.FROM" + IString(i + 1) + ".cub"; - params += " MATCH=" + tempDir + "/noproj.FROM" + IString(i + 2) + ".cub"; + QString tempDir = FileName("$TEMPORARY").expanded(); + QString flatFileName = tempDir + "/first" + toString(g_ccdNumbers[i]) + + "-" + toString(g_ccdNumbers[i+1]) + ".flat"; + QString params = ""; + params += "FROM=" + tempDir + "/noproj.FROM" + toString(i + 1) + ".cub"; + params += " MATCH=" + tempDir + "/noproj.FROM" + toString(i + 2) + ".cub"; params += " REGDEF=" + ui.GetFileName("REGDEF"); params += " FLAT=" + flatFileName; @@ -548,47 +547,47 @@ void processNoprojFiles(Pipeline &p) { offsetIndex = 9; } if (g_ccdNumbers[i] == 12) { - offsetIndex = 10; + offsetIndex = 10; } g_avgOffsets[offsetIndex][0] = Isis::Null; g_avgOffsets[offsetIndex][1] = Isis::Null; - string line; + QString line; try { while( flatFile.GetLine(line, false) && (g_avgOffsets[offsetIndex][0] == Isis::Null || g_avgOffsets[offsetIndex][1] == Isis::Null) ) { - line = IString(line).Compress(); - string::size_type pos = line.find("Average Sample Offset: "); + line = QString(line).simplified(); + int pos = line.indexOf("Average Sample Offset: "); - if (pos != string::npos) { + if (pos != -1) { // cut off text before our number (start pos + strlen + 1) - line = line.substr(pos + strlen("Average Sample Offset: ")); + line = line.mid(pos + strlen("Average Sample Offset: ")); // cut off text after our number - line = line.substr(0, line.find(" ")); + line = line.mid(0, line.indexOf(" ")); - g_avgOffsets[offsetIndex][0] = (double)(IString)line; - pos = string::npos; + g_avgOffsets[offsetIndex][0] = (double)toDouble((QString)line); + pos = -1; } - pos = line.find("Average Line Offset: "); + pos = line.indexOf("Average Line Offset: "); - if (pos != string::npos) { + if (pos != -1) { // cut off text before our number (start pos + strlen + 1) - line = line.substr(pos + strlen("Average Line Offset: ")); + line = line.mid(pos + strlen("Average Line Offset: ")); // cut off text after our number - line = line.substr(0, line.find(" ")); + line = line.mid(0, line.indexOf(" ")); - g_avgOffsets[offsetIndex][1] = (double)(IString)line; - pos = string::npos; + g_avgOffsets[offsetIndex][1] = (double)toDouble((QString)line); + pos = -1; } } } catch(IException &e) { - //IString msg = "Unable to find average sample/line offsets in hijitreg results for CCDs [" + IString(i) + "-" + IString(i+1) + "]"; + //QString msg = "Unable to find average sample/line offsets in hijitreg results for CCDs [" + toString(i) + "-" + toString(i+1) + "]"; //throw iException::Message(e, iException::Programmer, msg, _FILEINFO_); // numOffsets--; continue; // to next file in for loop @@ -599,7 +598,7 @@ void processNoprojFiles(Pipeline &p) { } if (offsetIndices.size() == 0) { - IString msg = "Unable to calculate average sample/line offsets from hijitreg results"; + QString msg = "Unable to calculate average sample/line offsets from hijitreg results"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -631,8 +630,8 @@ void processNoprojFiles(Pipeline &p) { yaw += atan(g_avgOffsets[index][0] / g_lineOff[index]) / numOffsets; } - p.Application("appjit").AddConstParameter("PITCHRATE", IString(pitchRate)); - p.Application("appjit").AddConstParameter("YAW", IString(yaw)); + p.Application("appjit").AddConstParameter("PITCHRATE", toString(pitchRate)); + p.Application("appjit").AddConstParameter("YAW", toString(yaw)); return; } @@ -645,7 +644,7 @@ void processNoprojFiles(Pipeline &p) { * @param eTime1 - Start time * @param eTime2 - End time */ -void ephemerisTimeFromJitterFile(const string jitterFile, double & eTime1, double & eTime2) { +void ephemerisTimeFromJitterFile(const QString jitterFile, double & eTime1, double & eTime2) { CSVReader jitter(jitterFile, true, 0, ' ', false, true); int iRows = jitter.rows(); CSVReader::CSVAxis csvArr; @@ -657,9 +656,8 @@ void ephemerisTimeFromJitterFile(const string jitterFile, double & eTime1, doubl csvArr = jitter.getRow(j); int iArrSize = csvArr.dim(); for (int i=0; iopen(inFile); diff --git a/isis/src/mro/apps/hijitter/tsts/default/Makefile b/isis/src/mro/apps/hijitter/tsts/default/Makefile index 655107afa6..f8918126e8 100644 --- a/isis/src/mro/apps/hijitter/tsts/default/Makefile +++ b/isis/src/mro/apps/hijitter/tsts/default/Makefile @@ -14,7 +14,7 @@ commands: JITTER=$(INPUT)/PSP_007556_2010.cropped.txt \ JITTERCK=$(OUTPUT)/jitter.bc \ REGDEF=$(INPUT)/hijitreg.p0745.s1570.def \ - TO=$(OUTPUT)/outlist.lis > $(OUTPUT)/output.txt; + TO=$(OUTPUT)/outlist.lis | grep -v "Processed" > $(OUTPUT)/output.txt; $(CP) $(INPUT)/PSP_007556_2010_RED5.balance.cropped.cub $(OUTPUT)/red5.cub; spiceinit from=$(OUTPUT)/red5.cub \ ck=$(OUTPUT)/jitter.bc > /dev/null; diff --git a/isis/src/mro/apps/hijitter/tsts/withCrop/Makefile b/isis/src/mro/apps/hijitter/tsts/withCrop/Makefile index 7db5c999bf..38d9a4225f 100644 --- a/isis/src/mro/apps/hijitter/tsts/withCrop/Makefile +++ b/isis/src/mro/apps/hijitter/tsts/withCrop/Makefile @@ -15,7 +15,7 @@ commands: JITTERCK=$(OUTPUT)/jitter.bc \ REGDEF=$(INPUT)/hijitreg.p0745.s1570.def \ crop=true \ - TO=$(OUTPUT)/outlist.lis > $(OUTPUT)/output.txt; + TO=$(OUTPUT)/outlist.lis | grep -v "Processed" > $(OUTPUT)/output.txt; $(CP) $(INPUT)/PSP_007556_2010_RED5.balance.cropped.cub $(OUTPUT)/red5.cub; spiceinit from=$(OUTPUT)/red5.cub \ ck=$(OUTPUT)/jitter.bc > /dev/null; diff --git a/isis/src/mro/apps/himos/himos.cpp b/isis/src/mro/apps/himos/himos.cpp index 483d8ed45f..4fb2c61a13 100644 --- a/isis/src/mro/apps/himos/himos.cpp +++ b/isis/src/mro/apps/himos/himos.cpp @@ -35,8 +35,8 @@ void IsisMain() { vector clist; try { if(flist.size() < 1) { - string msg = "the list file [" + ui.GetFileName("FROMLIST") + - "does not contain any data"; + QString msg = "the list file [" + ui.GetFileName("FROMLIST") + + "does not contain any data"; throw IException(IException::User, msg, _FILEINFO_); } @@ -53,7 +53,7 @@ void IsisMain() { // run the compair function here. This will conpair the // labels of the first cube to the labels of each following cube. PvlKeyword sourceProductId("SourceProductId"); - string ProdId; + QString ProdId; for(int i = 0; i < (int)clist.size(); i++) { Pvl *pmatch = clist[0]->getLabel(); Pvl *pcomp = clist[i]->getLabel(); @@ -65,9 +65,9 @@ void IsisMain() { sourceProductId += g["stitchedProductIds"][j]; } } - ProdId = (string)pmatch->FindGroup("Archive", Pvl::Traverse)["ObservationId"]; - IString bandname = (string)pmatch->FindGroup("BandBin", Pvl::Traverse)["Name"]; - bandname = bandname.UpCase(); + ProdId = (QString)pmatch->FindGroup("Archive", Pvl::Traverse)["ObservationId"]; + QString bandname = (QString)pmatch->FindGroup("BandBin", Pvl::Traverse)["Name"]; + bandname = bandname.toUpper(); ProdId = ProdId + "_" + bandname; } bool runXY = true; @@ -172,36 +172,36 @@ void IsisMain() { } } if(runXY) { - string msg = "Camera did not intersect images to gather stats"; + QString msg = "Camera did not intersect images to gather stats"; throw IException(IException::User, msg, _FILEINFO_); } - // get the min and max SCLK values ( do this with string comp.) + // get the min and max SCLK values ( do this with QString comp.) // get the value from the original label blob - string startClock; - string stopClock; - string startTime; - string stopTime; + QString startClock; + QString stopClock; + QString startTime; + QString stopTime; for(int i = 0; i < (int)clist.size(); i++) { OriginalLabel origLab; clist[i]->read(origLab); PvlGroup timegrp = origLab.ReturnLabels().FindGroup("TIME_PARAMETERS", Pvl::Traverse); if(i == 0) { - startClock = (string)timegrp["SpacecraftClockStartCount"]; - stopClock = (string)timegrp["SpacecraftClockStopCount"]; - startTime = (string)timegrp["StartTime"]; - stopTime = (string)timegrp["StopTime"]; + startClock = (QString)timegrp["SpacecraftClockStartCount"]; + stopClock = (QString)timegrp["SpacecraftClockStopCount"]; + startTime = (QString)timegrp["StartTime"]; + stopTime = (QString)timegrp["StopTime"]; } else { - string testStartTime = (string)timegrp["StartTime"]; - string testStopTime = (string)timegrp["StopTime"]; + QString testStartTime = (QString)timegrp["StartTime"]; + QString testStopTime = (QString)timegrp["StopTime"]; if(testStartTime < startTime) { startTime = testStartTime; - startClock = (string)timegrp["SpacecraftClockStartCount"]; + startClock = (QString)timegrp["SpacecraftClockStartCount"]; } if(testStopTime > stopTime) { stopTime = testStopTime; - stopClock = (string)timegrp["spacecraftClockStopCount"]; + stopClock = (QString)timegrp["spacecraftClockStopCount"]; } } } @@ -211,9 +211,9 @@ void IsisMain() { PvlKeyword cpmmSummingFlag("cpmmSummingFlag"); PvlKeyword specialProcessingFlag("SpecialProcessingFlag"); for(int i = 0; i < 14; i++) { - cpmmTdiFlag += (string)""; - cpmmSummingFlag += (string)""; - specialProcessingFlag += (string)""; + cpmmTdiFlag += (QString)""; + cpmmSummingFlag += (QString)""; + specialProcessingFlag += (QString)""; } for(int i = 0; i < (int)clist.size(); i++) { @@ -222,11 +222,11 @@ void IsisMain() { OriginalLabel cOrgLab; clist[i]->read(cOrgLab); PvlGroup cGrp = cOrgLab.ReturnLabels().FindGroup("INSTRUMENT_SETTING_PARAMETERS", Pvl::Traverse); - cpmmTdiFlag[(int)cInst["CpmmNumber"]] = (string) cGrp["MRO:TDI"]; - cpmmSummingFlag[(int)cInst["CpmmNumber"]] = (string) cGrp["MRO:BINNING"]; + cpmmTdiFlag[(int)cInst["CpmmNumber"]] = (QString) cGrp["MRO:TDI"]; + cpmmSummingFlag[(int)cInst["CpmmNumber"]] = (QString) cGrp["MRO:BINNING"]; if(cInst.HasKeyword("Special_Processing_Flag")) { - specialProcessingFlag[cInst["CpmmNumber"]] = (string) cInst["Special_Processing_Flag"]; + specialProcessingFlag[cInst["CpmmNumber"]] = (QString) cInst["Special_Processing_Flag"]; } else { // there may not be the keyword Special_Processing_Flag if no @@ -248,11 +248,11 @@ void IsisMain() { clist.clear(); // automos step - string list = ui.GetFileName("FROMLIST"); - string toMosaic = ui.GetFileName("TO"); - string MosaicPriority = ui.GetString("PRIORITY"); + QString list = ui.GetFileName("FROMLIST"); + QString toMosaic = ui.GetFileName("TO"); + QString MosaicPriority = ui.GetString("PRIORITY"); - string parameters = "FROMLIST=" + list + " MOSAIC=" + toMosaic + " PRIORITY=" + MosaicPriority; + QString parameters = "FROMLIST=" + list + " MOSAIC=" + toMosaic + " PRIORITY=" + MosaicPriority; ProgramLauncher::RunIsisProgram("automos", parameters); // write out new information to new group mosaic @@ -264,13 +264,13 @@ void IsisMain() { mos += PvlKeyword("SpacecraftClockStartCount ", startClock); mos += PvlKeyword("StopTime ", stopTime); mos += PvlKeyword("SpacecraftClockStopCount ", stopClock); - mos += PvlKeyword("IncidenceAngle ", Cincid, "DEG"); - mos += PvlKeyword("EmissionAngle ", Cemiss, "DEG"); - mos += PvlKeyword("PhaseAngle ", Cphase, "DEG"); - mos += PvlKeyword("LocalTime ", ClocalSolTime, "LOCALDAY/24"); - mos += PvlKeyword("SolarLongitude ", CsolarLong, "DEG"); - mos += PvlKeyword("SubSolarAzimuth ", CsunAzimuth, "DEG"); - mos += PvlKeyword("NorthAzimuth ", CnorthAzimuth, "DEG"); + mos += PvlKeyword("IncidenceAngle ", toString(Cincid), "DEG"); + mos += PvlKeyword("EmissionAngle ", toString(Cemiss), "DEG"); + mos += PvlKeyword("PhaseAngle ", toString(Cphase), "DEG"); + mos += PvlKeyword("LocalTime ", toString(ClocalSolTime), "LOCALDAY/24"); + mos += PvlKeyword("SolarLongitude ", toString(CsolarLong), "DEG"); + mos += PvlKeyword("SubSolarAzimuth ", toString(CsunAzimuth), "DEG"); + mos += PvlKeyword("NorthAzimuth ", toString(CnorthAzimuth), "DEG"); mos += cpmmTdiFlag; mos += cpmmSummingFlag; mos += specialProcessingFlag; @@ -289,7 +289,7 @@ void IsisMain() { clist[i]->close(); delete clist[i]; } - string msg = "The mosaic [" + ui.GetFileName("TO") + "] was NOT created"; + QString msg = "The mosaic [" + ui.GetFileName("TO") + "] was NOT created"; throw IException(IException::User, msg, _FILEINFO_); } } // end of isis main @@ -299,22 +299,22 @@ void CompareLabels(Pvl &pmatch, Pvl &pcomp) { // test of the ObservationId PvlGroup matchgrp = pmatch.FindGroup("Archive", Pvl::Traverse); PvlGroup compgrp = pcomp.FindGroup("Archive", Pvl::Traverse); - string obsMatch = matchgrp["ObservationId"]; - string obsComp = compgrp["ObservationId"]; + QString obsMatch = matchgrp["ObservationId"]; + QString obsComp = compgrp["ObservationId"]; if(obsMatch != obsComp) { - string msg = "Images not from the same observation"; + QString msg = "Images not from the same observation"; throw IException(IException::User, msg, _FILEINFO_); } // Test of the BandBin filter name PvlGroup bmatchgrp = pmatch.FindGroup("BandBin", Pvl::Traverse); PvlGroup bcompgrp = pcomp.FindGroup("BandBin", Pvl::Traverse); - string bandMatch = bmatchgrp["Name"]; - string bandComp = bcompgrp["Name"]; + QString bandMatch = bmatchgrp["Name"]; + QString bandComp = bcompgrp["Name"]; if(bandMatch != bandComp) { - string msg = "Images not the same filter"; + QString msg = "Images not the same filter"; throw IException(IException::User, msg, _FILEINFO_); } } diff --git a/isis/src/mro/apps/hinoise/hinoise.cpp b/isis/src/mro/apps/hinoise/hinoise.cpp index 8112fd20af..4ecf4aaeb1 100644 --- a/isis/src/mro/apps/hinoise/hinoise.cpp +++ b/isis/src/mro/apps/hinoise/hinoise.cpp @@ -1,6 +1,6 @@ #include "Isis.h" #include -#include +#include #include #include "CSVReader.h" #include "FileName.h" @@ -14,7 +14,7 @@ using namespace Isis; // For Debugging //#define _DEBUG_ -vector sTempFiles; +vector sTempFiles; // Global values int giLpfLines, giLpfSamples, giLpfMinPer; @@ -33,19 +33,19 @@ double gdClearFrac, gdNonValidFrac; double gdHardFilter, gdHighEndPercent, gdHardHighEndPercent; // Create temporary file names -string gsCubeStats1, gsCubeStats2; -string gsTempFile; +QString gsCubeStats1, gsCubeStats2; +QString gsTempFile; -void GetValuesFromHistogram(string psHistFile, double & pdLisPer, double & pdMaxDN, double & pdStdDev); -void ProcessCubeNormStats(string psStatsFile, int piChannel, int piSumming); +void GetValuesFromHistogram(QString psHistFile, double & pdLisPer, double & pdMaxDN, double & pdStdDev); +void ProcessCubeNormStats(QString psStatsFile, int piChannel, int piSumming); void IsisMain() { try { UserInterface &ui = Application::GetUserInterface(); - string sInputFile = ui.GetAsString("FROM"); - string sOutputFile = ui.GetAsString("TO"); - string sInBaseName = FileName(sInputFile).baseName(); + QString sInputFile = ui.GetAsString("FROM"); + QString sOutputFile = ui.GetAsString("TO"); + QString sInBaseName = FileName(sInputFile).baseName(); bool bRemove = ui.GetBoolean("REMOVE"); @@ -79,14 +79,14 @@ void IsisMain() { // Get Summing, CcdId and Channel Number from the cube label Pvl cubeLabel = Pvl(sInputFile); - int iSumming = int (cubeLabel.FindObject("IsisCube").FindGroup("Instrument").FindKeyword("Summing")[0]); - int iChannel = int (cubeLabel.FindObject("IsisCube").FindGroup("Instrument").FindKeyword("ChannelNumber")[0]); - string sCcdId = cubeLabel.FindObject("IsisCube").FindGroup("Instrument").FindKeyword("CcdId"); + int iSumming = toInt (cubeLabel.FindObject("IsisCube").FindGroup("Instrument").FindKeyword("Summing")[0]); + int iChannel = toInt (cubeLabel.FindObject("IsisCube").FindGroup("Instrument").FindKeyword("ChannelNumber")[0]); + QString sCcdId = cubeLabel.FindObject("IsisCube").FindGroup("Instrument").FindKeyword("CcdId"); // Get the image histogram Pipeline p1("hinoise1"); p1.SetInputFile("FROM"); - string sTempHistFile = "$TEMPORARY/" + sInBaseName + "_hist.txt"; + QString sTempHistFile = "$TEMPORARY/" + sInBaseName + "_hist.txt"; p1.SetOutputFile(FileName(sTempHistFile)); sTempFiles.push_back(FileName(sTempHistFile).expanded()); p1.KeepTemporaryFiles(!bRemove); @@ -108,7 +108,7 @@ void IsisMain() { Pipeline p2("hinoise2"); p2.SetInputFile("FROM"); - string sTempFile2 = "$TEMPORARY/" + sInBaseName + "_cubenorm.txt"; + QString sTempFile2 = "$TEMPORARY/" + sInBaseName + "_cubenorm.txt"; p2.SetOutputFile(FileName(sTempFile2)); sTempFiles.push_back(FileName(sTempFile2).expanded()); p2.KeepTemporaryFiles(!bRemove); @@ -137,7 +137,7 @@ void IsisMain() { // Clear the bad colmns for the highpass filter Pipeline p3("hinoise3"); p3.SetInputFile("FROM"); - string sTempFile3 = "$TEMPORARY/" + sInBaseName + "_Temp_p3_out.cub"; + QString sTempFile3 = "$TEMPORARY/" + sInBaseName + "_Temp_p3_out.cub"; p3.SetOutputFile(FileName(sTempFile3)); sTempFiles.push_back(FileName(sTempFile3).expanded()); p3.KeepTemporaryFiles(!bRemove); @@ -161,7 +161,7 @@ void IsisMain() { // Clear the bad colmns for the lowpass filter Pipeline p4("hinoise4"); p4.SetInputFile("FROM"); - string sTempFile4 = "$TEMPORARY/" + sInBaseName + "_Temp_p4_out.cub"; + QString sTempFile4 = "$TEMPORARY/" + sInBaseName + "_Temp_p4_out.cub"; p4.SetOutputFile(FileName(sTempFile4)); sTempFiles.push_back(FileName(sTempFile4).expanded()); p4.KeepTemporaryFiles(!bRemove); @@ -185,7 +185,7 @@ void IsisMain() { // **************************************************************************** // a. Lowpass Pipeline p5("hinoise5"); - string sTempFile5 = "$TEMPORARY/" + sInBaseName + "_Temp_p5_out.cub"; + QString sTempFile5 = "$TEMPORARY/" + sInBaseName + "_Temp_p5_out.cub"; p5.SetInputFile(FileName(sTempFile4)); p5.SetOutputFile(FileName(sTempFile5)); sTempFiles.push_back(FileName(sTempFile5).expanded()); @@ -194,11 +194,11 @@ void IsisMain() { p5.AddToPipeline("lowpass"); p5.Application("lowpass").SetInputParameter ("FROM", false); p5.Application("lowpass").SetOutputParameter("TO", "lowpass.p5"); - p5.Application("lowpass").AddConstParameter ("SAMPLES", IString(giLpfSamples)); - p5.Application("lowpass").AddConstParameter ("LINES", IString(giLpfLines)); + p5.Application("lowpass").AddConstParameter ("SAMPLES", toString(giLpfSamples)); + p5.Application("lowpass").AddConstParameter ("LINES", toString(giLpfLines)); p5.Application("lowpass").AddConstParameter ("MINOPT", "PERCENT"); p5.Application("lowpass").AddConstParameter ("LIS", "FALSE"); - p5.Application("lowpass").AddConstParameter ("MINIMUM", IString(giLpfMinPer)); + p5.Application("lowpass").AddConstParameter ("MINIMUM", toString(giLpfMinPer)); p5.Application("lowpass").AddConstParameter ("REPLACE", "NULL"); #ifdef _DEBUG_ cout << p5 << endl; @@ -209,7 +209,7 @@ void IsisMain() { // b. Highpass Pipeline p6("hinoise6"); p6.SetInputFile (FileName(sTempFile3)); - string sTempFile6 = "$TEMPORARY/" + sInBaseName + "_Temp_p6_out.cub"; + QString sTempFile6 = "$TEMPORARY/" + sInBaseName + "_Temp_p6_out.cub"; p6.SetOutputFile(FileName(sTempFile6)); sTempFiles.push_back(FileName(sTempFile6).expanded()); p6.KeepTemporaryFiles(!bRemove); @@ -217,9 +217,9 @@ void IsisMain() { p6.AddToPipeline("highpass"); p6.Application("highpass").SetInputParameter ("FROM", false); p6.Application("highpass").SetOutputParameter("TO", "highpass.p6"); - p6.Application("highpass").AddConstParameter ("SAMPLES", IString(giHpfSamples)); - p6.Application("highpass").AddConstParameter ("LINES", IString(giHpfLines)); - p6.Application("highpass").AddConstParameter ("MINIMUM", IString(giHpfMinPer)); + p6.Application("highpass").AddConstParameter ("SAMPLES", toString(giHpfSamples)); + p6.Application("highpass").AddConstParameter ("LINES", toString(giHpfLines)); + p6.Application("highpass").AddConstParameter ("MINIMUM", toString(giHpfMinPer)); p6.Application("highpass").AddConstParameter ("MINOPT", "PERCENT"); #ifdef _DEBUG_ cout << p6 << endl; @@ -228,11 +228,11 @@ void IsisMain() { p6.Run(); // Enter the outputs of lowpass and highpass filenames to a list file - string sTempListFile = "$TEMPORARY/" + sInBaseName + "_TempList.lis"; + QString sTempListFile = "$TEMPORARY/" + sInBaseName + "_TempList.lis"; gsTempFile = FileName(sTempListFile).expanded(); sTempFiles.push_back(gsTempFile); fstream ostm; - ostm.open(gsTempFile.c_str(), std::ios::out); + ostm.open(gsTempFile.toAscii().data(), std::ios::out); ostm << FileName(sTempFile5).expanded() << endl; ostm << FileName(sTempFile6).expanded() << endl; ostm.close(); @@ -240,7 +240,7 @@ void IsisMain() { // c. algebra (lowpass + highpass) Pipeline p7("hinoise7"); p7.SetInputFile (FileName(sTempListFile)); - string sTempFile7 = "$TEMPORARY/" + sInBaseName + "_Temp_p7_out.cub"; + QString sTempFile7 = "$TEMPORARY/" + sInBaseName + "_Temp_p7_out.cub"; p7.SetOutputFile(FileName(sTempFile7)); sTempFiles.push_back(FileName(sTempFile7).expanded()); p7.KeepTemporaryFiles(!bRemove); @@ -256,14 +256,14 @@ void IsisMain() { #endif p7.Run(); - remove(gsTempFile.c_str()); + remove(gsTempFile.toAscii().data()); // **************************************************************************** // Perform noise filter 3 times // **************************************************************************** Pipeline p8("hinoise8"); p8.SetInputFile (FileName(sTempFile7)); - string sTempFile8 = "$TEMPORARY/" + sInBaseName + "_Temp_p8_out.cub"; + QString sTempFile8 = "$TEMPORARY/" + sInBaseName + "_Temp_p8_out.cub"; p8.SetOutputFile(FileName(sTempFile8)); sTempFiles.push_back(FileName(sTempFile8).expanded()); p8.KeepTemporaryFiles(!bRemove); @@ -281,15 +281,15 @@ void IsisMain() { p8.AddToPipeline("noisefilter", "noisefilter_pass1"); p8.Application("noisefilter_pass1").SetInputParameter ("FROM", false); p8.Application("noisefilter_pass1").SetOutputParameter("TO", "noisefilter.1"); - p8.Application("noisefilter_pass1").AddConstParameter ("FLATTOL", IString(gdFlatTol)); + p8.Application("noisefilter_pass1").AddConstParameter ("FLATTOL", toString(gdFlatTol)); p8.Application("noisefilter_pass1").AddConstParameter ("TOLDEF", "STDDEV"); - p8.Application("noisefilter_pass1").AddConstParameter ("LOW", IString(gdMinValue)); - p8.Application("noisefilter_pass1").AddConstParameter ("HIGH", IString(dMaxDN)); - p8.Application("noisefilter_pass1").AddConstParameter ("TOLMIN", IString(gdTolMin)); - p8.Application("noisefilter_pass1").AddConstParameter ("TOLMAX", IString(gdTolMax)); + p8.Application("noisefilter_pass1").AddConstParameter ("LOW", toString(gdMinValue)); + p8.Application("noisefilter_pass1").AddConstParameter ("HIGH", toString(dMaxDN)); + p8.Application("noisefilter_pass1").AddConstParameter ("TOLMIN", toString(gdTolMin)); + p8.Application("noisefilter_pass1").AddConstParameter ("TOLMAX", toString(gdTolMax)); p8.Application("noisefilter_pass1").AddConstParameter ("REPLACE", "NULL"); - p8.Application("noisefilter_pass1").AddConstParameter ("SAMPLE", IString(giNoiseSamples)); - p8.Application("noisefilter_pass1").AddConstParameter ("LINE", IString(giNoiseLines)); + p8.Application("noisefilter_pass1").AddConstParameter ("SAMPLE", toString(giNoiseSamples)); + p8.Application("noisefilter_pass1").AddConstParameter ("LINE", toString(giNoiseLines)); p8.Application("noisefilter_pass1").AddConstParameter ("LISISNOISE", "TRUE"); p8.Application("noisefilter_pass1").AddConstParameter ("LRSISNOISE", "TRUE"); @@ -297,15 +297,15 @@ void IsisMain() { p8.AddToPipeline("noisefilter", "noisefilter_pass2"); p8.Application("noisefilter_pass2").SetInputParameter ("FROM", false); p8.Application("noisefilter_pass2").SetOutputParameter("TO", "noisefilter.2"); - p8.Application("noisefilter_pass2").AddConstParameter ("FLATTOL", IString(gdFlatTol)); + p8.Application("noisefilter_pass2").AddConstParameter ("FLATTOL", toString(gdFlatTol)); p8.Application("noisefilter_pass2").AddConstParameter ("TOLDEF", "STDDEV"); - p8.Application("noisefilter_pass2").AddConstParameter ("LOW", IString(gdMinValue)); - p8.Application("noisefilter_pass2").AddConstParameter ("HIGH", IString(dMaxDN)); - p8.Application("noisefilter_pass2").AddConstParameter ("TOLMIN", IString(gdTolMin)); - p8.Application("noisefilter_pass2").AddConstParameter ("TOLMAX", IString(gdTolMax)); + p8.Application("noisefilter_pass2").AddConstParameter ("LOW", toString(gdMinValue)); + p8.Application("noisefilter_pass2").AddConstParameter ("HIGH", toString(dMaxDN)); + p8.Application("noisefilter_pass2").AddConstParameter ("TOLMIN", toString(gdTolMin)); + p8.Application("noisefilter_pass2").AddConstParameter ("TOLMAX", toString(gdTolMax)); p8.Application("noisefilter_pass2").AddConstParameter ("REPLACE", "NULL"); - p8.Application("noisefilter_pass2").AddConstParameter ("SAMPLE", IString(giNoiseSamples)); - p8.Application("noisefilter_pass2").AddConstParameter ("LINE", IString(giNoiseLines)); + p8.Application("noisefilter_pass2").AddConstParameter ("SAMPLE", toString(giNoiseSamples)); + p8.Application("noisefilter_pass2").AddConstParameter ("LINE", toString(giNoiseLines)); p8.Application("noisefilter_pass2").AddConstParameter ("LISISNOISE", "TRUE"); p8.Application("noisefilter_pass2").AddConstParameter ("LRSISNOISE", "TRUE"); @@ -313,15 +313,15 @@ void IsisMain() { p8.AddToPipeline("noisefilter", "noisefilter_pass3"); p8.Application("noisefilter_pass3").SetInputParameter ("FROM", false); p8.Application("noisefilter_pass3").SetOutputParameter("TO", "noisefilter.3"); - p8.Application("noisefilter_pass3").AddConstParameter ("FLATTOL", IString(gdFlatTol)); + p8.Application("noisefilter_pass3").AddConstParameter ("FLATTOL", toString(gdFlatTol)); p8.Application("noisefilter_pass3").AddConstParameter ("TOLDEF", "STDDEV"); - p8.Application("noisefilter_pass3").AddConstParameter ("LOW", IString(gdMinValue)); - p8.Application("noisefilter_pass3").AddConstParameter ("HIGH", IString(dMaxDN)); - p8.Application("noisefilter_pass3").AddConstParameter ("TOLMIN", IString(gdTolMin)); - p8.Application("noisefilter_pass3").AddConstParameter ("TOLMAX", IString(gdTolMax)); + p8.Application("noisefilter_pass3").AddConstParameter ("LOW", toString(gdMinValue)); + p8.Application("noisefilter_pass3").AddConstParameter ("HIGH", toString(dMaxDN)); + p8.Application("noisefilter_pass3").AddConstParameter ("TOLMIN", toString(gdTolMin)); + p8.Application("noisefilter_pass3").AddConstParameter ("TOLMAX", toString(gdTolMax)); p8.Application("noisefilter_pass3").AddConstParameter ("REPLACE", "NULL"); - p8.Application("noisefilter_pass3").AddConstParameter ("SAMPLE", IString(giNoiseSamples)); - p8.Application("noisefilter_pass3").AddConstParameter ("LINE", IString(giNoiseLines)); + p8.Application("noisefilter_pass3").AddConstParameter ("SAMPLE", toString(giNoiseSamples)); + p8.Application("noisefilter_pass3").AddConstParameter ("LINE", toString(giNoiseLines)); p8.Application("noisefilter_pass3").AddConstParameter ("LISISNOISE", "TRUE"); p8.Application("noisefilter_pass3").AddConstParameter ("LRSISNOISE", "TRUE"); #ifdef _DEBUG_ @@ -337,7 +337,7 @@ void IsisMain() { // a. Lowpass Pipeline p9("hinoise9"); p9.SetInputFile (FileName(sTempFile8)); - string sTempFile9 = "$TEMPORARY/" + sInBaseName + "_Temp_p9_out.cub"; + QString sTempFile9 = "$TEMPORARY/" + sInBaseName + "_Temp_p9_out.cub"; p9.SetOutputFile(FileName(sTempFile9)); sTempFiles.push_back(FileName(sTempFile9).expanded()); p9.KeepTemporaryFiles(!bRemove); @@ -345,10 +345,10 @@ void IsisMain() { p9.AddToPipeline("lowpass"); p9.Application("lowpass").SetInputParameter ("FROM", false); p9.Application("lowpass").SetOutputParameter("TO", "lowpass.p9"); - p9.Application("lowpass").AddConstParameter ("SAMPLES", IString(giLpfSamples)); - p9.Application("lowpass").AddConstParameter ("LINES", IString(giLpfLines)); + p9.Application("lowpass").AddConstParameter ("SAMPLES", toString(giLpfSamples)); + p9.Application("lowpass").AddConstParameter ("LINES", toString(giLpfLines)); p9.Application("lowpass").AddConstParameter ("MINOPT", "PERCENT"); - p9.Application("lowpass").AddConstParameter ("MINIMUM", IString(giLpfMinPer)); + p9.Application("lowpass").AddConstParameter ("MINIMUM", toString(giLpfMinPer)); p9.Application("lowpass").AddConstParameter ("REPLACE", "NULL"); p9.Application("lowpass").AddConstParameter ("NULL", "FALSE"); p9.Application("lowpass").AddConstParameter ("HRS", "FALSE"); @@ -364,7 +364,7 @@ void IsisMain() { // b. Highpass Pipeline p10("hinoise10"); p10.SetInputFile (FileName(sTempFile8)); - string sTempFile10 = "$TEMPORARY/" + sInBaseName + "_Temp_p10_out.cub"; + QString sTempFile10 = "$TEMPORARY/" + sInBaseName + "_Temp_p10_out.cub"; p10.SetOutputFile(FileName(sTempFile10)); sTempFiles.push_back(FileName(sTempFile10).expanded()); p10.KeepTemporaryFiles(!bRemove); @@ -372,9 +372,9 @@ void IsisMain() { p10.AddToPipeline("highpass"); p10.Application("highpass").SetInputParameter ("FROM", false); p10.Application("highpass").SetOutputParameter("TO", "highpass.p10"); - p10.Application("highpass").AddConstParameter ("SAMPLES", IString(giHpfSamples)); - p10.Application("highpass").AddConstParameter ("LINES", IString(giHpfLines)); - p10.Application("highpass").AddConstParameter ("MINIMUM", IString(giHpfMinPer)); + p10.Application("highpass").AddConstParameter ("SAMPLES", toString(giHpfSamples)); + p10.Application("highpass").AddConstParameter ("LINES", toString(giHpfLines)); + p10.Application("highpass").AddConstParameter ("MINIMUM", toString(giHpfMinPer)); p10.Application("highpass").AddConstParameter ("MINOPT", "PERCENT"); #ifdef _DEBUG_ cout << p10 << endl; @@ -385,7 +385,7 @@ void IsisMain() { // Enter the outputs of lowpass and highpass filenames to a list file gsTempFile = FileName(sTempListFile).expanded(); sTempFiles.push_back(gsTempFile); - ostm.open(gsTempFile.c_str(), std::ios::out); + ostm.open(gsTempFile.toAscii().data(), std::ios::out); ostm << FileName(sTempFile9).expanded() << endl; ostm << FileName(sTempFile10).expanded() << endl; ostm.close(); @@ -393,7 +393,7 @@ void IsisMain() { // c. algebra (lowpass + highpass) Pipeline p11("hinoise11"); p11.SetInputFile (FileName(sTempListFile)); - string sTempFile11; + QString sTempFile11; if (sCcdId == "RED") { sTempFile11 = "$TEMPORARY/" + sInBaseName + "_Temp_p11_out.cub"; p11.SetOutputFile(FileName(sTempFile11)); @@ -445,10 +445,10 @@ void IsisMain() { p12.AddToPipeline("lowpass", "lowpass_pass2"); p12.Application("lowpass_pass2").SetInputParameter ("FROM", false); p12.Application("lowpass_pass2").SetOutputParameter("TO", "lowpass.p12.2"); - p12.Application("lowpass_pass2").AddConstParameter ("SAMPLES", IString(gdLpfzSamples)); - p12.Application("lowpass_pass2").AddConstParameter ("LINES", IString(gdLpfzLines)); + p12.Application("lowpass_pass2").AddConstParameter ("SAMPLES", toString(gdLpfzSamples)); + p12.Application("lowpass_pass2").AddConstParameter ("LINES", toString(gdLpfzLines)); p12.Application("lowpass_pass2").AddConstParameter ("MINOPT", "COUNT"); - p12.Application("lowpass_pass2").AddConstParameter ("MINIMUM", IString(iMin)); + p12.Application("lowpass_pass2").AddConstParameter ("MINIMUM", toString(iMin)); p12.Application("lowpass_pass2").AddConstParameter ("FILTER", "OUTSIDE"); p12.Application("lowpass_pass2").AddConstParameter ("NULL", "TRUE"); p12.Application("lowpass_pass2").AddConstParameter ("HRS", "FALSE"); @@ -464,7 +464,7 @@ void IsisMain() { // more clean up for (int i=0; i<(int)sTempFiles.size(); i++) { - remove(sTempFiles[i].c_str()); + remove(sTempFiles[i].toAscii().data()); } sTempFiles.clear(); } @@ -472,11 +472,11 @@ void IsisMain() { throw; } catch(std::exception const &se) { - string sErrMsg = "std::exception: " + (IString)se.what(); + QString sErrMsg = "std::exception: " + (QString)se.what(); throw IException(IException::User, sErrMsg, _FILEINFO_); } catch(...) { - string sErrMsg = "Other Error"; + QString sErrMsg = "Other Error"; throw IException(IException::User, sErrMsg, _FILEINFO_); } } @@ -490,7 +490,7 @@ void IsisMain() { * @param piChannel - Channel Number 0/1 * @param piSumming - Summing mode */ -void ProcessCubeNormStats(string psStatsFile, int piChannel, int piSumming) +void ProcessCubeNormStats(QString psStatsFile, int piChannel, int piSumming) { CSVReader::CSVAxis csvArr; CSVReader statsFile(psStatsFile, false, 0, ' ', false, true); @@ -498,7 +498,7 @@ void ProcessCubeNormStats(string psStatsFile, int piChannel, int piSumming) int iMaxValidPoints = 1; vector dNorm1, dNorm2; vector iValidPoints, iBand, iRowCol; - IString sHeader=" "; + QString sHeader=" "; #ifdef _DEBUG_ cerr << "Rows="<< iRows << endl; @@ -537,7 +537,7 @@ void ProcessCubeNormStats(string psStatsFile, int piChannel, int piSumming) // Determine if the pause point pixels need to be zapped if (piSumming == 1) { QList iChannelPause, iChannelWidth; - string sChDirection; + QString sChDirection; if (piChannel == 0 ) { iChannelPause << 1 << 252 << 515 << 778; // Channel 0 pause point sample locations (1st pixel = index 1) @@ -602,8 +602,8 @@ void ProcessCubeNormStats(string psStatsFile, int piChannel, int piSumming) // Write the results of the filtered cubenorm data into 2 output files FILE * file1, *file2; - file1 = fopen(gsCubeStats1.c_str(), "w"); - file2 = fopen(gsCubeStats2.c_str(), "w"); + file1 = fopen(gsCubeStats1.toAscii().data(), "w"); + file2 = fopen(gsCubeStats2.toAscii().data(), "w"); fprintf (file1, "%8s%8s%15s%15s%15s%15s%15s%15s\n","Band", "RowCol", "ValidPoints", "Average", "Median", "StdDev", "Minimum", "Maximim"); @@ -629,7 +629,7 @@ void ProcessCubeNormStats(string psStatsFile, int piChannel, int piSumming) * @param pdMaxDN - caculated Max Dn Value * @param pdStdDev - std deviation from the histogram */ -void GetValuesFromHistogram(string psHistFile, double & pdLisPer, double & pdMaxDN, double & pdStdDev) +void GetValuesFromHistogram(QString psHistFile, double & pdLisPer, double & pdMaxDN, double & pdStdDev) { int iTotalPixels=0, iNullPixels=0, iLisPixels=0; diff --git a/isis/src/mro/apps/hirdr2isis/hirdr2isis.cpp b/isis/src/mro/apps/hirdr2isis/hirdr2isis.cpp index 5fa8ce1482..b9861576bd 100644 --- a/isis/src/mro/apps/hirdr2isis/hirdr2isis.cpp +++ b/isis/src/mro/apps/hirdr2isis/hirdr2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "ProcessImportPds.h" @@ -17,7 +17,7 @@ void IsisMain() { Pvl label; UserInterface &ui = Application::GetUserInterface(); - string labelFile = ui.GetFileName("FROM"); + QString labelFile = ui.GetFileName("FROM"); p.SetPdsFile(labelFile, "", label); Cube *ocube = p.SetOutputCube("TO"); @@ -30,7 +30,7 @@ void IsisMain() { // Get the directory where the MRO HiRISE RDR translation tables are. PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Mro"] + "/translations/"; + QString transDir = (QString) dataDir["Mro"] + "/translations/"; // Translate the BandBin group FileName transFile(transDir + "hiriseRdrBandBin.trn"); @@ -67,12 +67,12 @@ void IsisMain() { // Modify the output Mosaic group if the Projection is of type // Equirectangular. PvlGroup mapgrp = otherLabels.FindGroup("Mapping"); - if(IString::UpCase(mapgrp["ProjectionName"]) == "EQUIRECTANGULAR") { + if(mapgrp["ProjectionName"][0].toUpper() == "EQUIRECTANGULAR") { static bool pckLoaded(false); if(!pckLoaded) { FileName pck("$base/kernels/pck/pck?????.tpc"); pck = pck.highestVersion(); - furnsh_c(pck.expanded().c_str()); + furnsh_c(pck.expanded().toAscii().data()); pckLoaded = true; } @@ -80,7 +80,7 @@ void IsisMain() { PvlKeyword &target = label.FindKeyword("TargetName", PvlObject::Traverse); SpiceInt tcode; SpiceBoolean found; - (void) bodn2c_c(target[0].c_str(), &tcode, &found); + (void) bodn2c_c(target[0].toAscii().data(), &tcode, &found); if(found) { // Get radii and fix labels SpiceInt n; @@ -97,8 +97,8 @@ void IsisMain() { clatrad.SetName("CenterLatitudeRadius"); // Assign the proper radii to the group keywords - eqRadius.SetValue(IString(radii[0] * 1000.0), "meters"); - polRadius.SetValue(IString(radii[2] * 1000.0), "meters"); + eqRadius.SetValue(toString(radii[0] * 1000.0), "meters"); + polRadius.SetValue(toString(radii[2] * 1000.0), "meters"); mapgrp += clatrad; // Don't do this before updating the above // keyword references! Bad things happen! } diff --git a/isis/src/mro/apps/hirdrgen/hirdrgen.cpp b/isis/src/mro/apps/hirdrgen/hirdrgen.cpp index 7fa1564760..4c9b6f76e0 100644 --- a/isis/src/mro/apps/hirdrgen/hirdrgen.cpp +++ b/isis/src/mro/apps/hirdrgen/hirdrgen.cpp @@ -32,14 +32,14 @@ void writeJP2Image(Buffer &in); void IsisMain() { - string projName; + QString projName; Process pHist; Cube *icube = pHist.SetInputCube("FROM"); // Check to see if the input cube looks like a HiRISE RDR if (icube->getBandCount() > 3) { - string msg = "Input file [" + + QString msg = "Input file [" + Application::GetUserInterface().GetFileName("FROM") + "] does not appear to be a HiRISE RDR product. Number of " + "bands is greater than 3"; @@ -102,7 +102,7 @@ void IsisMain() { if (enctype.Equal("jp2")) { g_jp2buf = new char* [icube2->getBandCount()]; FileName lblFile(ui.GetFileName("TO")); - string lblFileName = lblFile.path() + "/" + lblFile.baseName() + ".lbl"; + QString lblFileName = lblFile.path() + "/" + lblFile.baseName() + ".lbl"; p.SetDetached(lblFileName); p.SetFormat(ProcessExport::JP2); } @@ -197,16 +197,16 @@ void IsisMain() { struct tm *tmbuf = gmtime(&startTime); char timestr[80]; strftime(timestr, 80, "%Y-%m-%dT%H:%M:%S", tmbuf); - string dateTime = (string) timestr; + QString dateTime = (QString) timestr; iTime tmpDateTime(dateTime); PvlGroup &timeParam = pdsLabel.FindGroup("TIME_PARAMETERS"); timeParam += PvlKeyword("PRODUCT_CREATION_TIME", tmpDateTime.UTC()); // Add the N/A constant keyword to the ROOT - pdsLabel += PvlKeyword("NOT_APPLICABLE_CONSTANT", -9998); + pdsLabel += PvlKeyword("NOT_APPLICABLE_CONSTANT", toString(-9998)); // Add SOFTWARE_NAME to the ROOT - IString sfname; + QString sfname; sfname.clear(); sfname += "Isis " + Application::Version() + " " + Application::GetUserInterface().ProgramName(); @@ -239,7 +239,7 @@ void IsisMain() { ccdTdi.AddValue(cpmmTdi[cpmmByCcd[ccd]] != "Null" ? cpmmTdi[cpmmByCcd[ccd]] : "-9998"); IString tmp = cpmmSpecial[cpmmByCcd[ccd]]; tmp.Trim("\""); - ccdSpecial.AddValue(tmp); + ccdSpecial.AddValue(tmp.ToQt()); } if (!pdsLabel.HasGroup("INSTRUMENT_SETTING_PARAMETERS")) { @@ -299,9 +299,9 @@ void IsisMain() { Projection *proj = ProjectionFactory::CreateFromCube(*icube2); PvlGroup &mapping = icube2->getLabel()->FindGroup("MAPPING", Pvl::Traverse); double radius = proj->LocalRadius((double)mapping["CenterLatitude"]) / 1000.0; - mapObject["A_AXIS_RADIUS"].SetValue(radius, "KM"); - mapObject["B_AXIS_RADIUS"].SetValue(radius, "KM"); - mapObject["C_AXIS_RADIUS"].SetValue(radius, "KM"); + mapObject["A_AXIS_RADIUS"].SetValue(toString(radius), "KM"); + mapObject["B_AXIS_RADIUS"].SetValue(toString(radius), "KM"); + mapObject["C_AXIS_RADIUS"].SetValue(toString(radius), "KM"); } projName = mapObject["MAP_PROJECTION_TYPE"][0]; @@ -312,11 +312,11 @@ void IsisMain() { // The input to output mapping is opposite from the one above double slope = (p.GetOutputMaximum() - p.GetOutputMinimum()) / (maxmax - minmin); double intercept = p.GetOutputMaximum() - slope * maxmax; - PvlKeyword minimum("MRO:MINIMUM_STRETCH", slope * g_min[0] + intercept); - PvlKeyword maximum("MRO:MAXIMUM_STRETCH", slope * g_max[0] + intercept); + PvlKeyword minimum("MRO:MINIMUM_STRETCH", toString(slope * g_min[0] + intercept)); + PvlKeyword maximum("MRO:MAXIMUM_STRETCH", toString(slope * g_max[0] + intercept)); for (int band = 1; band < icube2->getBandCount(); ++band) { - minimum += slope * g_min[band] + intercept; - maximum += slope * g_max[band] + intercept; + minimum += toString(slope * g_min[band] + intercept); + maximum += toString(slope * g_max[band] + intercept); } if (enctype.Equal("jp2")) { @@ -327,15 +327,15 @@ void IsisMain() { imagejp2 += PvlKeyword("DESCRIPTION", "HiRISE projected and mosaicked product"); // Add the SCALLING_FACTOR and OFFSET keywords - imagejp2.AddKeyword(PvlKeyword("SCALING_FACTOR", slope), Pvl::Replace); - imagejp2.AddKeyword(PvlKeyword("OFFSET", intercept), Pvl::Replace); + imagejp2.AddKeyword(PvlKeyword("SCALING_FACTOR", toString(slope)), Pvl::Replace); + imagejp2.AddKeyword(PvlKeyword("OFFSET", toString(intercept)), Pvl::Replace); // Reformat some keyword units in the image object // This is lame, but PDS units are difficult to work with, so for now??? PvlKeyword &oldFilterNamejp2 = imagejp2["FILTER_NAME"]; PvlKeyword newFilterName("FILTER_NAME"); for (int val = 0; val < oldFilterNamejp2.Size(); ++val) { - IString filtname(oldFilterNamejp2[val].UpCase()); + QString filtname(oldFilterNamejp2[val].toUpper()); if (filtname == "BLUEGREEN") filtname = "BLUE-GREEN"; else if (filtname == "NEARINFRARED") filtname = "NEAR-INFRARED"; newFilterName.AddValue(filtname); @@ -374,7 +374,7 @@ void IsisMain() { // ProcessExportPds if (nbits != 8 && nbits != 16) { imagejp2.AddKeyword(PvlKeyword("SAMPLE_BIT_MASK", - (int)pow(2.0, (double)ui.GetInteger("BITS")) - 1), + toString((int)pow(2.0, (double)ui.GetInteger("BITS")) - 1)), Pvl::Replace); } } @@ -395,15 +395,15 @@ void IsisMain() { // ??? unneccessary calculation - this is done by ProcessExportPds class. double slope = (maxmax - minmin) / (p.GetOutputMaximum() - p.GetOutputMinimum()); double intercept = maxmax - slope * p.GetOutputMaximum(); - image.AddKeyword(PvlKeyword("SCALING_FACTOR", slope), Pvl::Replace); - image.AddKeyword(PvlKeyword("OFFSET", intercept), Pvl::Replace); + image.AddKeyword(PvlKeyword("SCALING_FACTOR", toString(slope)), Pvl::Replace); + image.AddKeyword(PvlKeyword("OFFSET", toString(intercept)), Pvl::Replace); // Reformat some keyword units in the image object // This is lame, but PDS units are difficult to work with, so for now PvlKeyword &oldFilterName = image["FILTER_NAME"]; PvlKeyword newFilterName("FILTER_NAME"); for (int val = 0; val < oldFilterName.Size(); ++val) { - IString filtname(oldFilterName[val].UpCase()); + QString filtname(oldFilterName[val].toUpper()); if (filtname == "BLUEGREEN") filtname = "BLUE-GREEN"; else if (filtname == "NEARINFRARED") filtname = "NEAR-INFRARED"; newFilterName.AddValue(filtname); @@ -442,7 +442,7 @@ void IsisMain() { // ProcessExportPds if (nbits != 8 && nbits != 16) { image.AddKeyword(PvlKeyword("SAMPLE_BIT_MASK", - (int)pow(2.0, (double)ui.GetInteger("BITS")) - 1), + toString((int)pow(2.0, (double)ui.GetInteger("BITS")) - 1)), Pvl::Replace); } } @@ -453,26 +453,26 @@ void IsisMain() { // PvlKeyword &incidence = viewGroup["INCIDENCE_ANGLE"]; // IString tstr = incidence.Unit(); -// if (tstr.UpCase() == "DEG") incidence.SetValue((string)incidence, "deg"); +// if (tstr.UpCase() == "DEG") incidence.SetValue((QString)incidence, "deg"); // PvlKeyword &emission = viewGroup["EMISSION_ANGLE"]; // tstr = emission.Unit(); -// if (tstr.UpCase() == "DEG") emission.SetValue((string)emission, "deg"); +// if (tstr.UpCase() == "DEG") emission.SetValue((QString)emission, "deg"); // PvlKeyword &phase = viewGroup["PHASE_ANGLE"]; // tstr = phase.Unit(); -// if (tstr.UpCase() == "DEG") phase.SetValue((string)phase, "deg"); +// if (tstr.UpCase() == "DEG") phase.SetValue((QString)phase, "deg"); // PvlKeyword &solarLon = viewGroup["SOLAR_LONGITUDE"]; // tstr = solarLon.Unit(); q -// if (tstr.UpCase() == "DEG") solarLon.SetValue((string)solarLon, "deg"); +// if (tstr.UpCase() == "DEG") solarLon.SetValue((QString)solarLon, "deg"); // PvlKeyword &localTime = viewGroup["LOCAL_TIME"]; // tstr = localTime.Unit(); -// if (tstr.UpCase() == "LOCALDAY/24") localTime.SetValue((string)localTime, "local day/24"); +// if (tstr.UpCase() == "LOCALDAY/24") localTime.SetValue((QString)localTime, "local day/24"); // } - // Add a keyword type (i.e., string, bool, int...) file to the PDS label Pvl + // Add a keyword type (i.e., QString, bool, int...) file to the PDS label Pvl PvlFormat *formatter = pdsLabel.GetFormat(); formatter->Add("$mro/translations/hirisePdsRdrExtras.typ"); @@ -513,7 +513,7 @@ void IsisMain() { } else { FileName outFile(ui.GetFileName("TO")); - ofstream oCube(outFile.expanded().c_str()); + ofstream oCube(outFile.expanded().toAscii().data()); p.OutputLabel(oCube); p.StartProcess(oCube); oCube.close(); diff --git a/isis/src/mro/apps/hisharpen/hisharpen.cpp b/isis/src/mro/apps/hisharpen/hisharpen.cpp index 8684e2a3ca..3b88d1587b 100644 --- a/isis/src/mro/apps/hisharpen/hisharpen.cpp +++ b/isis/src/mro/apps/hisharpen/hisharpen.cpp @@ -25,28 +25,28 @@ void IsisMain() { // This is the equation that hisharpen needs to perform // Final magnitude/phase equations - IString magniEq = "sqrt( oreal^2 + oimag^2 )"; - IString phaseEq = "atan2( oimag , oreal )"; + QString magniEq = "sqrt( oreal^2 + oimag^2 )"; + QString phaseEq = "atan2( oimag , oreal )"; // Insert oreal/oimag - magniEq.Replace("oreal", "((real*freal + imag*fimag)/(freal*freal + fimag*fimag))"); - phaseEq.Replace("oreal", "((real*freal + imag*fimag)/(freal*freal + fimag*fimag))"); - magniEq.Replace("oimag", "((imag*freal - real*fimag)/(freal*freal + fimag*fimag))"); - phaseEq.Replace("oimag", "((imag*freal - real*fimag)/(freal*freal + fimag*fimag))"); + magniEq.replace("oreal", "((real*freal + imag*fimag)/(freal*freal + fimag*fimag))"); + phaseEq.replace("oreal", "((real*freal + imag*fimag)/(freal*freal + fimag*fimag))"); + magniEq.replace("oimag", "((imag*freal - real*fimag)/(freal*freal + fimag*fimag))"); + phaseEq.replace("oimag", "((imag*freal - real*fimag)/(freal*freal + fimag*fimag))"); // Insert real/freal (real/psf real), imag/fimag (imaginary/psf imaginary) - magniEq.Replace("freal", "(f2*cos(f3))"); - phaseEq.Replace("freal", "(f2*cos(f3))"); - magniEq.Replace("real", "(f1*cos(f4))"); - phaseEq.Replace("real", "(f1*cos(f4))"); - magniEq.Replace("fimag", "(f2*sin(f3))"); - phaseEq.Replace("fimag", "(f2*sin(f3))"); - magniEq.Replace("imag", "(f1*sin(f4))"); - phaseEq.Replace("imag", "(f1*sin(f4))"); + magniEq.replace("freal", "(f2*cos(f3))"); + phaseEq.replace("freal", "(f2*cos(f3))"); + magniEq.replace("real", "(f1*cos(f4))"); + phaseEq.replace("real", "(f1*cos(f4))"); + magniEq.replace("fimag", "(f2*sin(f3))"); + phaseEq.replace("fimag", "(f2*sin(f3))"); + magniEq.replace("imag", "(f1*sin(f4))"); + phaseEq.replace("imag", "(f1*sin(f4))"); // Strip spaces - phaseEq.Replace(" ", ""); - magniEq.Replace(" ", ""); + phaseEq.replace(" ", ""); + magniEq.replace(" ", ""); Pipeline p; @@ -124,7 +124,7 @@ void CreatePsf(Pipeline &p) { UserInterface &ui = Application::GetUserInterface(); // calculate the temp file filename - IString tmpFile = p.TemporaryFolder() + "/"; + QString tmpFile = p.TemporaryFolder() + "/"; tmpFile += FileName(ui.GetAsString("TO")).baseName(); tmpFile += ".psf.cub"; @@ -135,42 +135,42 @@ void CreatePsf(Pipeline &p) { // Verify the image looks like a hirise image try { const PvlGroup &instGrp = fromCube.getLabel()->FindGroup("Instrument", Pvl::Traverse); - IString instrument = (std::string)instGrp["InstrumentId"]; + QString instrument = (QString)instGrp["InstrumentId"]; if(instrument != "HIRISE") { - IString message = "This program is meant to be run on HiRISE images only, found " + QString message = "This program is meant to be run on HiRISE images only, found " "[InstrumentId] to be [" + instrument + "] and was expecting [HIRISE]"; throw IException(IException::User, message, _FILEINFO_); } } catch(IException &e) { - IString message = "The [FROM] file is not a valid HIRISE cube. " + QString message = "The [FROM] file is not a valid HIRISE cube. " "Please make sure it was imported using hi2isis."; throw IException(IException::User, message, _FILEINFO_); } if(fromCube.getLineCount() != fromCube.getSampleCount()) { - IString message = "This program only works on square cubes, the number of samples [" + - IString(fromCube.getSampleCount()) + "] must match the number of lines [" + - IString(fromCube.getLineCount()) + "]"; + QString message = "This program only works on square cubes, the number of samples [" + + QString(fromCube.getSampleCount()) + "] must match the number of lines [" + + QString(fromCube.getLineCount()) + "]"; throw IException(IException::User, message, _FILEINFO_); } // Let's figure out which point spread function we're supposed to be using - IString psfFile = "$mro/calibration/psf/PSF_"; - IString filter = (std::string)fromCube.getLabel()->FindGroup("Instrument", Pvl::Traverse)["CcdId"]; + QString psfFile = "$mro/calibration/psf/PSF_"; + QString filter = (QString)fromCube.getLabel()->FindGroup("Instrument", Pvl::Traverse)["CcdId"]; - if(filter.find("RED") != string::npos) { + if(filter.contains("RED")) { psfFile += "RED"; } - else if(filter.find("BG") != string::npos) { + else if(filter.contains("BG")) { psfFile += "BG"; } - else if(filter.find("IR") != string::npos) { + else if(filter.contains("IR")) { psfFile += "IR"; } else { - IString message = "The filter [" + filter + "] does not have a default point spread function. Please provide one using the [PSF] parameter."; + QString message = "The filter [" + filter + "] does not have a default point spread function. Please provide one using the [PSF] parameter."; throw IException(IException::Programmer, message, _FILEINFO_); } @@ -180,14 +180,14 @@ void CreatePsf(Pipeline &p) { psfCube.open(psfFile); if(psfCube.getLineCount() > fromCube.getLineCount()) { - IString message = "The input cube dimensions must be at least [" + IString(psfCube.getLineCount()); + QString message = "The input cube dimensions must be at least [" + QString(psfCube.getLineCount()); message += "] pixels in the line and sample dimensions"; throw IException(IException::User, message, _FILEINFO_); } if(!IsPowerOf2(fromCube.getLineCount())) { - IString message = "The input cube dimensions must be a power of 2 (found [" + - IString(fromCube.getLineCount()) + "])"; + QString message = "The input cube dimensions must be a power of 2 (found [" + + QString(fromCube.getLineCount()) + "])"; throw IException(IException::User, message, _FILEINFO_); } @@ -244,10 +244,10 @@ void CleanPsf() { UserInterface &ui = Application::GetUserInterface(); if(!manualPsf) { - IString psfTempFile = FileName(ui.GetAsString("PSF")).expanded(); + QString psfTempFile = FileName(ui.GetAsString("PSF")).expanded(); if(ui.GetBoolean("CLEANUP")) { - remove(psfTempFile.c_str()); + remove(psfTempFile.toAscii().data()); } ui.Clear("PSF"); diff --git a/isis/src/mro/apps/histat/histat.cpp b/isis/src/mro/apps/histat/histat.cpp index 988645de7e..c8404a5fb8 100644 --- a/isis/src/mro/apps/histat/histat.cpp +++ b/isis/src/mro/apps/histat/histat.cpp @@ -11,8 +11,8 @@ using namespace std; using namespace Isis; -PvlGroup PvlStats(Statistics &stats, const string &name); -void ThrowException(int, int, int, string); +PvlGroup PvlStats(Statistics &stats, const QString &name); +void ThrowException(int, int, int, QString); const int LINES_POSTRAMP = 30; @@ -57,7 +57,7 @@ void IsisMain() { //Check to make sure we got the cube properly if(!inputCube.isOpen()) { - string msg = "Could not open FROM cube" + fromFile.expanded(); + QString msg = "Could not open FROM cube " + fromFile.expanded(); throw IException(IException::User, msg, _FILEINFO_); } @@ -305,28 +305,28 @@ void IsisMain() { } // Return a PVL group containing the statistical information -PvlGroup PvlStats(Statistics &stats, const string &name) { +PvlGroup PvlStats(Statistics &stats, const QString &name) { // Construct a label with the results PvlGroup results(name); if(stats.ValidPixels() != 0) { - results += PvlKeyword("Average", stats.Average()); - results += PvlKeyword("StandardDeviation", stats.StandardDeviation()); - results += PvlKeyword("Variance", stats.Variance()); - results += PvlKeyword("Minimum", stats.Minimum()); - results += PvlKeyword("Maximum", stats.Maximum()); + results += PvlKeyword("Average", toString(stats.Average())); + results += PvlKeyword("StandardDeviation", toString(stats.StandardDeviation())); + results += PvlKeyword("Variance", toString(stats.Variance())); + results += PvlKeyword("Minimum", toString(stats.Minimum())); + results += PvlKeyword("Maximum", toString(stats.Maximum())); } - results += PvlKeyword("TotalPixels", stats.TotalPixels()); - results += PvlKeyword("ValidPixels", stats.ValidPixels()); - results += PvlKeyword("NullPixels", stats.NullPixels()); - results += PvlKeyword("LisPixels", stats.LisPixels()); - results += PvlKeyword("LrsPixels", stats.LrsPixels()); - results += PvlKeyword("HisPixels", stats.HisPixels()); - results += PvlKeyword("HrsPixels", stats.HrsPixels()); + results += PvlKeyword("TotalPixels", toString(stats.TotalPixels())); + results += PvlKeyword("ValidPixels", toString(stats.ValidPixels())); + results += PvlKeyword("NullPixels", toString(stats.NullPixels())); + results += PvlKeyword("LisPixels", toString(stats.LisPixels())); + results += PvlKeyword("LrsPixels", toString(stats.LrsPixels())); + results += PvlKeyword("HisPixels", toString(stats.HisPixels())); + results += PvlKeyword("HrsPixels", toString(stats.HrsPixels())); return results; } -void ThrowException(int vectorSize, int left, int right, string name) { - string err; +void ThrowException(int vectorSize, int left, int right, QString name) { + QString err; err = "You are trying to skip as many or more samples of the " + name + " than exist"; throw IException(IException::User, err, _FILEINFO_); diff --git a/isis/src/mro/apps/histitch/histitch.cpp b/isis/src/mro/apps/histitch/histitch.cpp index 75e0b4867a..f9fd54a0df 100644 --- a/isis/src/mro/apps/histitch/histitch.cpp +++ b/isis/src/mro/apps/histitch/histitch.cpp @@ -41,7 +41,7 @@ double average1 = Isis::Null; HiVector f0LineAvg; HiVector f1LineAvg; double coeff; -string balance; +QString balance; int seamSize; int skipSize; @@ -121,14 +121,14 @@ void IsisMain() { int filterWidth = ui.GetInteger("WIDTH"); bool fillNull = ui.GetBoolean("FILL"); int hiChannel = ui.GetInteger("CHANNEL"); - string fixop = ui.GetString("OPERATOR"); + QString fixop = ui.GetString("OPERATOR"); coeff = 1; // Define the processing to be by line ProcessByLine p; //Set string to gather ProductIds. - string stitchedProductIds; + QString stitchedProductIds; // Obtain lines and samples of the input files. Note that conditions // are obtained from the first input file only unless provided from a @@ -140,8 +140,8 @@ void IsisMain() { fromData[0].add = HiVector(icube1->getLineCount(), 0.0); if(seamSize + skipSize > icube1->getSampleCount()) { - string msg = "SEAMSIZE [" + IString(seamSize) + "] + SKIP [" + IString(skipSize) + "] must "; - msg += " be less than the number of samples [" + IString(icube1->getSampleCount()) + "] in "; + QString msg = "SEAMSIZE [" + toString(seamSize) + "] + SKIP [" + toString(skipSize) + "] must "; + msg += " be less than the number of samples [" + toString(icube1->getSampleCount()) + "] in "; msg += "[" + ui.GetAsString("FROM1") + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -150,7 +150,7 @@ void IsisMain() { PvlGroup &from1Instrument = icube1->getGroup("INSTRUMENT"); fromData[0].ChnNumber = from1Instrument["ChannelNumber"]; - stitchedProductIds = (string)from1Archive["ProductId"][0]; + stitchedProductIds = (QString)from1Archive["ProductId"][0]; // Set initial conditions for one input file if(fromData[0].ChnNumber == 1) { @@ -173,8 +173,8 @@ void IsisMain() { fromData[1].add = HiVector(icube2->getLineCount(), 0.0); if(seamSize + skipSize > icube2->getSampleCount()) { - string msg = "SEAMSIZE [" + IString(seamSize) + "] + SKIP [" + IString(skipSize) + "] must "; - msg += " be less than the number of samples [" + IString(icube2->getSampleCount()) + " in "; + QString msg = "SEAMSIZE [" + toString(seamSize) + "] + SKIP [" + toString(skipSize) + "] must "; + msg += " be less than the number of samples [" + toString(icube2->getSampleCount()) + " in "; msg += "[" + ui.GetAsString("FROM2") + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -183,20 +183,20 @@ void IsisMain() { PvlGroup &from2Archive = icube2->getGroup("ARCHIVE"); //Make sure observation id's are the same - string from1ObsId = from1Archive["ObservationId"]; - string from2ObsId = from2Archive["ObservationId"]; + QString from1ObsId = from1Archive["ObservationId"]; + QString from2ObsId = from2Archive["ObservationId"]; if(from1ObsId != from2ObsId) { - string msg = "The input files Observation Id's are not compatable"; + QString msg = "The input files Observation Id's are not compatable"; throw IException(IException::User, msg, _FILEINFO_); } stitchedProductIds = "(" + stitchedProductIds + ", " + - (string)from2Archive["ProductId"][0] + ")"; + (QString)from2Archive["ProductId"][0] + ")"; PvlGroup &from2Instrument = icube2->getGroup("INSTRUMENT"); //Make sure CCD Id's are the same - string from1CcdId = from1Instrument["CCDId"]; - string from2CcdId = from2Instrument["CCDId"]; + QString from1CcdId = from1Instrument["CCDId"]; + QString from2CcdId = from2Instrument["CCDId"]; if(from1CcdId != from2CcdId) { string msg = "The input files CCD Id's are not compatable"; throw IException(IException::User, msg, _FILEINFO_); @@ -229,7 +229,7 @@ void IsisMain() { // Change Channel Number on output cube to 2 PvlGroup &InstrumentOut = ocube->getGroup("INSTRUMENT"); - InstrumentOut["ChannelNumber"] = 2; + InstrumentOut["ChannelNumber"] = "2"; // Set StitchedChannels and Stitched ProductIds keywords if(ui.WasEntered("FROM2")) { @@ -237,7 +237,7 @@ void IsisMain() { InstrumentOut += PvlKeyword("StitchedProductIds", stitchedProductIds); } else { - InstrumentOut += PvlKeyword("StitchedChannels", IString(fromData[0].ChnNumber)); + InstrumentOut += PvlKeyword("StitchedChannels", toString(fromData[0].ChnNumber)); InstrumentOut += PvlKeyword("StitchedProductIds", stitchedProductIds); } @@ -285,15 +285,15 @@ void IsisMain() { fromData[ch0Index].mult = coeff; } } - results += PvlKeyword("TruthChannel", hiChannel); - results += PvlKeyword("BalanceRatio", coeff); + results += PvlKeyword("TruthChannel", toString(hiChannel)); + results += PvlKeyword("BalanceRatio", toString(coeff)); } else { // Store off original averages for table HiVector ch0_org = f0LineAvg; HiVector ch1_org = f1LineAvg; - results += PvlKeyword("FilterWidth", filterWidth); + results += PvlKeyword("FilterWidth", toString(filterWidth)); if(filterWidth > 0) { f0LineAvg = filter(f0LineAvg, filterWidth); f1LineAvg = filter(f1LineAvg, filterWidth); @@ -303,12 +303,12 @@ void IsisMain() { if(fillNull) { int nfilled; f0LineAvg = filler(f0LineAvg, nfilled); - results += PvlKeyword("Channel0Filled", nfilled); + results += PvlKeyword("Channel0Filled", toString(nfilled)); f1LineAvg = filler(f1LineAvg, nfilled); - results += PvlKeyword("Channel1Filled", nfilled); + results += PvlKeyword("Channel1Filled", toString(nfilled)); } - results += PvlKeyword("TruthChannel", hiChannel); + results += PvlKeyword("TruthChannel", toString(hiChannel)); results += PvlKeyword("Operator", fixop); int nunfilled(0); HiVector ch0_fixed(icube1->getLineCount(), 1.0); @@ -335,7 +335,7 @@ void IsisMain() { ch1_fixed = 0.0; } } - results += PvlKeyword("UnFilled", nunfilled); + results += PvlKeyword("UnFilled", toString(nunfilled)); // Add a table to the output file of the data values TableField f1("Channel1Original", Isis::TableField::Double); diff --git a/isis/src/mro/apps/marci2isis/marci2isis.cpp b/isis/src/mro/apps/marci2isis/marci2isis.cpp index 064ff414a5..c3af54ca9d 100644 --- a/isis/src/mro/apps/marci2isis/marci2isis.cpp +++ b/isis/src/mro/apps/marci2isis/marci2isis.cpp @@ -20,7 +20,7 @@ std::vector padding; Isis::Brick *flipDataBrick1 = NULL; Isis::Brick *flipDataBrick2 = NULL; -const std::string knownFilters[] = { +const QString knownFilters[] = { "NIR", "RED", "ORANGE", @@ -49,7 +49,7 @@ void IsisMain() { //Checks if in file is rdr Pvl lab(inFile.expanded()); if(lab.HasObject("IMAGE_MAP_PROJECTION")) { - string msg = "[" + inFile.name() + "] appears to be an rdr file."; + QString msg = "[" + inFile.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -80,10 +80,10 @@ void IsisMain() { // find the filter num int filtNum = 0; - int numKnownFilters = sizeof(knownFilters) / sizeof(std::string); + int numKnownFilters = sizeof(knownFilters) / sizeof(QString); while(filtNum < numKnownFilters && - (std::string)pdsLab["FILTER_NAME"][filter] != knownFilters[filtNum]) { + (QString)pdsLab["FILTER_NAME"][filter] != knownFilters[filtNum]) { filtNum ++; } @@ -116,8 +116,8 @@ void IsisMain() { outputCubes[1]->setDimensions(numSamples, numLines, numFilters); FileName outputFile(ui.GetFileName("TO")); - IString evenFile = outputFile.path() + "/" + outputFile.baseName() + ".even.cub"; - IString oddFile = outputFile.path() + "/" + outputFile.baseName() + ".odd.cub"; + QString evenFile = outputFile.path() + "/" + outputFile.baseName() + ".even.cub"; + QString oddFile = outputFile.path() + "/" + outputFile.baseName() + ".odd.cub"; outputCubes[0]->create(evenFile); outputCubes[1]->create(oddFile); @@ -140,7 +140,7 @@ void IsisMain() { // Add original labels OriginalLabel origLabel(pdsLab); - std::vector framelets; + std::vector framelets; framelets.push_back("Even"); framelets.push_back("Odd"); @@ -274,41 +274,41 @@ void translateMarciLabels(Pvl &pdsLabel, Pvl &cubeLabel) { PvlGroup arch("Archive"); if(pdsLabel.HasKeyword("SAMPLE_BIT_MODE_ID")) { - arch += PvlKeyword("SampleBitModeId", (string)pdsLabel["SAMPLE_BIT_MODE_ID"]); + arch += PvlKeyword("SampleBitModeId", (QString)pdsLabel["SAMPLE_BIT_MODE_ID"]); } PvlGroup inst("Instrument"); - if((string)pdsLabel["SPACECRAFT_NAME"] == "MARS_RECONNAISSANCE_ORBITER") { + if((QString)pdsLabel["SPACECRAFT_NAME"] == "MARS_RECONNAISSANCE_ORBITER") { inst += PvlKeyword("SpacecraftName", "MARS RECONNAISSANCE ORBITER"); } else { throw IException(IException::User, "The input file does not appear to be a MARCI image", _FILEINFO_); } - if((string)pdsLabel["INSTRUMENT_ID"] == "MARCI") { + if((QString)pdsLabel["INSTRUMENT_ID"] == "MARCI") { inst += PvlKeyword("InstrumentId", "Marci"); } else { throw IException(IException::User, "The input file does not appear to be a MARCI image", _FILEINFO_); } - inst += PvlKeyword("TargetName", (string)pdsLabel["TARGET_NAME"]); - inst += PvlKeyword("SummingMode", (string)pdsLabel["SAMPLING_FACTOR"]); - inst += PvlKeyword("StartTime", (string) pdsLabel["START_TIME"]); - inst += PvlKeyword("StopTime", (string) pdsLabel["STOP_TIME"]); - inst += PvlKeyword("SpacecraftClockCount", (string)pdsLabel["SPACECRAFT_CLOCK_START_COUNT"]); - inst += PvlKeyword("DataFlipped", (flip == 1)); - inst += PvlKeyword("ColorOffset", colorOffset); - inst += PvlKeyword("InterframeDelay", (IString)((double)pdsLabel["INTERFRAME_DELAY"]), "seconds"); - inst += PvlKeyword("ExposureDuration", (IString)((double)pdsLabel["LINE_EXPOSURE_DURATION"] / 1000.0), "seconds"); + inst += PvlKeyword("TargetName", (QString)pdsLabel["TARGET_NAME"]); + inst += PvlKeyword("SummingMode", (QString)pdsLabel["SAMPLING_FACTOR"]); + inst += PvlKeyword("StartTime", (QString) pdsLabel["START_TIME"]); + inst += PvlKeyword("StopTime", (QString) pdsLabel["STOP_TIME"]); + inst += PvlKeyword("SpacecraftClockCount", (QString)pdsLabel["SPACECRAFT_CLOCK_START_COUNT"]); + inst += PvlKeyword("DataFlipped", toString((int)(flip == 1))); + inst += PvlKeyword("ColorOffset", toString(colorOffset)); + inst += PvlKeyword("InterframeDelay", toString((double)pdsLabel["INTERFRAME_DELAY"]), "seconds"); + inst += PvlKeyword("ExposureDuration", toString((double)pdsLabel["LINE_EXPOSURE_DURATION"] / 1000.0), "seconds"); PvlGroup bandBin("BandBin"); PvlKeyword filterName("FilterName"); PvlKeyword origBands("OriginalBand"); for(int filter = 0; filter < pdsLabel["FILTER_NAME"].Size(); filter++) { filterName += pdsLabel["FILTER_NAME"][filter]; - origBands += IString(filter + 1); + origBands += toString(filter + 1); } bandBin += filterName; @@ -320,25 +320,25 @@ void translateMarciLabels(Pvl &pdsLabel, Pvl &cubeLabel) { isisCube.AddGroup(arch); // Map VIS/UV to NaifIkCode - std::map naifIkCodes; - naifIkCodes.insert(std::pair("MRO_MARCI", -74400)); - naifIkCodes.insert(std::pair("MRO_MARCI_VIS", -74410)); - naifIkCodes.insert(std::pair("MRO_MARCI_UV", -74420)); + std::map naifIkCodes; + naifIkCodes.insert(std::pair("MRO_MARCI", -74400)); + naifIkCodes.insert(std::pair("MRO_MARCI_VIS", -74410)); + naifIkCodes.insert(std::pair("MRO_MARCI_UV", -74420)); // Map from filter name to VIS/UV - std::map bandUvVis; - bandUvVis.insert(std::pair("BLUE", "MRO_MARCI_VIS")); - bandUvVis.insert(std::pair("GREEN", "MRO_MARCI_VIS")); - bandUvVis.insert(std::pair("ORANGE", "MRO_MARCI_VIS")); - bandUvVis.insert(std::pair("RED", "MRO_MARCI_VIS")); - bandUvVis.insert(std::pair("NIR", "MRO_MARCI_VIS")); - bandUvVis.insert(std::pair("LONG_UV", "MRO_MARCI_UV")); - bandUvVis.insert(std::pair("SHORT_UV", "MRO_MARCI_UV")); + std::map bandUvVis; + bandUvVis.insert(std::pair("BLUE", "MRO_MARCI_VIS")); + bandUvVis.insert(std::pair("GREEN", "MRO_MARCI_VIS")); + bandUvVis.insert(std::pair("ORANGE", "MRO_MARCI_VIS")); + bandUvVis.insert(std::pair("RED", "MRO_MARCI_VIS")); + bandUvVis.insert(std::pair("NIR", "MRO_MARCI_VIS")); + bandUvVis.insert(std::pair("LONG_UV", "MRO_MARCI_UV")); + bandUvVis.insert(std::pair("SHORT_UV", "MRO_MARCI_UV")); PvlGroup kerns("Kernels"); - string uvvis = bandUvVis.find((std::string)bandBin["FilterName"][0])->second; + QString uvvis = bandUvVis.find((QString)bandBin["FilterName"][0])->second; int iakCode = naifIkCodes.find(uvvis)->second; - kerns += PvlKeyword("NaifIkCode", iakCode); + kerns += PvlKeyword("NaifIkCode", toString(iakCode)); isisCube.AddGroup(kerns); } diff --git a/isis/src/mro/apps/marcical/marcical.cpp b/isis/src/mro/apps/marcical/marcical.cpp index f176aa1376..60c8c7d990 100644 --- a/isis/src/mro/apps/marcical/marcical.cpp +++ b/isis/src/mro/apps/marcical/marcical.cpp @@ -40,13 +40,13 @@ void IsisMain() { } } catch(IException &) { - string msg = "This program is intended for use on MARCI images only. ["; + QString msg = "This program is intended for use on MARCI images only. ["; msg += inFileName.expanded() + "] does not appear to be a MARCI image."; throw IException(IException::User, msg, _FILEINFO_); } if(icube.getGroup("Archive")["SampleBitModeId"][0] != "SQROOT") { - string msg = "Sample bit mode [" + icube.getGroup("Archive")["SampleBitModeId"][0] + "] is not supported."; + QString msg = "Sample bit mode [" + icube.getGroup("Archive")["SampleBitModeId"][0] + "] is not supported."; throw IException(IException::User, msg, _FILEINFO_); } @@ -62,7 +62,7 @@ void IsisMain() { decimation.push_back(1.0); } - IString startTime = icube.getLabel()->FindGroup("Instrument", Pvl::Traverse)["StartTime"][0]; + QString startTime = icube.getLabel()->FindGroup("Instrument", Pvl::Traverse)["StartTime"][0]; iTime start(startTime); iTime changeTime("November 6, 2006 21:30:00 UTC"); @@ -80,10 +80,10 @@ void IsisMain() { // Create the stretch pairs stretch.ClearPairs(); for(int i = 0; i < stretchPairs.LineCount(); i++) { - IString line; + QString line; stretchPairs.GetLine(line, true); - int temp1 = line.Token(" "); - int temp2 = line.Trim(" "); + int temp1 = toInt(line.split(" ").first()); + int temp2 = toInt(line.split(" ").last()); stretch.AddPair(temp1, temp2); } @@ -100,8 +100,8 @@ void IsisMain() { // Check our coefficient file if(calibrationData.Objects() != 7) { - IString msg = "Calibration file [" + calFile.expanded() + "] must contain data for 7 filters in ascending order;"; - msg += " only [" + IString(calibrationData.Objects()) + "] objects were found"; + QString msg = "Calibration file [" + calFile.expanded() + "] must contain data for 7 filters in ascending order;"; + msg += " only [" + QString(calibrationData.Objects()) + "] objects were found"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -110,7 +110,7 @@ void IsisMain() { PvlObject &calObj = calibrationData.Object(obj); if((int)calObj["FilterNumber"] != obj + 1) { - IString msg = "Calibration file [" + calFile.expanded() + "] must have the filters in ascending order"; + QString msg = "Calibration file [" + calFile.expanded() + "] must have the filters in ascending order"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -120,11 +120,11 @@ void IsisMain() { vector flatcubes; vector fcubeMgrs; - int summing = icube.getGroup("Instrument")["SummingMode"][0]; + int summing = toInt(icube.getGroup("Instrument")["SummingMode"][0]); // Read in the flat files for(int band = 0; band < 7; band++) { - string filePattern = "$mro/calibration/marci/"; + QString filePattern = "$mro/calibration/marci/"; if(band < 5) { filePattern += "vis"; @@ -139,8 +139,8 @@ void IsisMain() { continue; } - filePattern += "flat_band" + IString(band + 1); - filePattern += "_summing" + IString(summing) + "_v???.cub"; + filePattern += "flat_band" + toString(band + 1); + filePattern += "_summing" + toString(summing) + "_v???.cub"; FileName flatFile = FileName(filePattern).highestVersion(); Cube *fcube = new Cube(); @@ -170,14 +170,14 @@ void IsisMain() { vector filter; // Conversion from filter name to filter index - map filterNameToFilterIndex; - filterNameToFilterIndex.insert(pair("BLUE", 1)); - filterNameToFilterIndex.insert(pair("GREEN", 2)); - filterNameToFilterIndex.insert(pair("ORANGE", 3)); - filterNameToFilterIndex.insert(pair("RED", 4)); - filterNameToFilterIndex.insert(pair("NIR", 5)); - filterNameToFilterIndex.insert(pair("SHORT_UV", 6)); - filterNameToFilterIndex.insert(pair("LONG_UV", 7)); + map filterNameToFilterIndex; + filterNameToFilterIndex.insert(pair("BLUE", 1)); + filterNameToFilterIndex.insert(pair("GREEN", 2)); + filterNameToFilterIndex.insert(pair("ORANGE", 3)); + filterNameToFilterIndex.insert(pair("RED", 4)); + filterNameToFilterIndex.insert(pair("NIR", 5)); + filterNameToFilterIndex.insert(pair("SHORT_UV", 6)); + filterNameToFilterIndex.insert(pair("LONG_UV", 7)); PvlKeyword &filtNames = icube.getLabel()->FindGroup("BandBin", Pvl::Traverse)["FilterName"];; for(int i = 0; i < filtNames.Size(); i++) { @@ -185,7 +185,7 @@ void IsisMain() { filter.push_back(filterNameToFilterIndex.find(filtNames[i])->second); } else { - IString msg = "Unrecognized filter name [" + IString(filtNames[i]) + "]"; + QString msg = "Unrecognized filter name [" + QString(filtNames[i]) + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } } diff --git a/isis/src/mro/apps/marciflip/marciflip.cpp b/isis/src/mro/apps/marciflip/marciflip.cpp index 8066ee7d09..41e7d5ba8f 100644 --- a/isis/src/mro/apps/marciflip/marciflip.cpp +++ b/isis/src/mro/apps/marciflip/marciflip.cpp @@ -33,7 +33,7 @@ void IsisMain() { PvlGroup inst = icube->getGroup("Instrument"); // change flipped keyword - inst["DataFlipped"] = ((int)inst["DataFlipped"] + 1) % 2; + inst["DataFlipped"] = toString(((int)inst["DataFlipped"] + 1) % 2); outputCube->getLabel()->FindObject("IsisCube").AddGroup(inst); } diff --git a/isis/src/mro/apps/mroctx2isis/mroctx2isis.cpp b/isis/src/mro/apps/mroctx2isis/mroctx2isis.cpp index dba767fc24..a6c8c886de 100644 --- a/isis/src/mro/apps/mroctx2isis/mroctx2isis.cpp +++ b/isis/src/mro/apps/mroctx2isis/mroctx2isis.cpp @@ -37,7 +37,7 @@ void IsisMain() { bool projected; try { Pvl lab(inFile.expanded()); - id = (string) lab.FindKeyword("DATA_SET_ID"); + id = (QString) lab.FindKeyword("DATA_SET_ID"); projected = lab.HasObject("IMAGE_MAP_PROJECTION"); if(lab.HasKeyword("SPATIAL_SUMMING")) { sumMode = (int)lab.FindKeyword("SPATIAL_SUMMING"); @@ -46,7 +46,7 @@ void IsisMain() { sumMode = (int)lab.FindKeyword("SAMPLING_FACTOR"); } - bitMode = (string) lab.FindKeyword("SAMPLE_BIT_MODE_ID"); + bitMode = (QString) lab.FindKeyword("SAMPLE_BIT_MODE_ID"); if(lab.HasKeyword("EDIT_MODE_ID")) { editMode = (int)lab.FindKeyword("EDIT_MODE_ID"); } @@ -56,14 +56,14 @@ void IsisMain() { } catch(IException &e) { - string msg = "Unable to read [DATA_SET_ID] from input file [" + - inFile.expanded() + "]"; + QString msg = "Unable to read [DATA_SET_ID] from input file [" + + inFile.expanded() + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } //Checks if in file is rdr if(projected) { - string msg = "[" + inFile.name() + "] appears to be an rdr file."; + QString msg = "[" + inFile.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -72,8 +72,8 @@ void IsisMain() { id.Compress(); id.Trim(" "); if(id != "MRO-M-CTX-2-EDR-L0-V1.0") { - string msg = "Input file [" + inFile.expanded() + "] does not appear to be " + - "in MRO-CTX EDR format. DATA_SET_ID is [" + id + "]"; + QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + + "in MRO-CTX EDR format. DATA_SET_ID is [" + id.ToQt() + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -165,10 +165,10 @@ void IsisMain() { // Create the stretch pairs stretch.ClearPairs(); for(int i = 0; i < stretchPairs->LineCount(); i++) { - IString line; + QString line; stretchPairs->GetLine(line, true); - int temp1 = line.Token(" "); - int temp2 = line.Trim(" "); + int temp1 = toInt(line.split(" ").first()); + int temp2 = toInt(line.split(" ").last()); stretch.AddPair(temp1, temp2); } @@ -180,7 +180,7 @@ void IsisMain() { // Do 8 bit to 12 bit conversion fillGap = ui.GetBoolean("FILLGAP"); ProcessByLine p2; - string ioFile = ui.GetFileName("TO"); + QString ioFile = ui.GetFileName("TO"); CubeAttributeInput att; p2.SetInputCube(ioFile, att, ReadWrite); p2.Progress()->SetText("Converting 8 bit pixels to 16 bit"); @@ -207,7 +207,7 @@ void TranslateMroCtxLabels(FileName &labelFile, Cube *ocube) { Pvl outLabel; //Set up the directory where the translations are PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory")); - IString transDir = (string) dataDir["Mro"] + "/translations/"; + QString transDir = (QString) dataDir["Mro"] + "/translations/"; Pvl labelPvl(labelFile.expanded()); //Translate the Instrument group @@ -223,12 +223,12 @@ void TranslateMroCtxLabels(FileName &labelFile, Cube *ocube) { // Set up the BandBin groups PvlGroup bbin("BandBin"); bbin += PvlKeyword("FilterName", "BroadBand"); - bbin += PvlKeyword("Center", 0.650, "micrometers"); - bbin += PvlKeyword("Width", 0.150, "micrometers"); + bbin += PvlKeyword("Center", toString(0.650), "micrometers"); + bbin += PvlKeyword("Width", toString(0.150), "micrometers"); //Set up the Kernels group PvlGroup kern("Kernels"); - kern += PvlKeyword("NaifFrameCode", -74021); + kern += PvlKeyword("NaifFrameCode", toString(-74021)); Pvl lab(labelFile.expanded()); int sumMode, startSamp; @@ -245,8 +245,8 @@ void TranslateMroCtxLabels(FileName &labelFile, Cube *ocube) { startSamp = (int)lab.FindKeyword("SAMPLE_FIRST_PIXEL"); } PvlGroup inst = outLabel.FindGroup("Instrument", Pvl::Traverse); - inst += PvlKeyword("SpatialSumming", sumMode); - inst += PvlKeyword("SampleFirstPixel", startSamp); + inst += PvlKeyword("SpatialSumming", toString(sumMode)); + inst += PvlKeyword("SampleFirstPixel", toString(startSamp)); //Add all groups to the output cube ocube->putGroup(inst); diff --git a/isis/src/mro/apps/pds2hideal/pds2hideal.cpp b/isis/src/mro/apps/pds2hideal/pds2hideal.cpp index fa6f72ddc9..09f7ebeac2 100644 --- a/isis/src/mro/apps/pds2hideal/pds2hideal.cpp +++ b/isis/src/mro/apps/pds2hideal/pds2hideal.cpp @@ -21,14 +21,14 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); // Copy the input image to specified output cube in BSQ format FileName from = ui.GetFileName("FROM"); - IString pdsLabelFile = from.expanded(); + QString pdsLabelFile = from.expanded(); Pvl pdsLabelPvl; ProcessImportPds p; p.SetPdsFile(pdsLabelFile, "", pdsLabelPvl); - IString instId = pdsLabelPvl["INSTRUMENT_ID"][0]; + QString instId = pdsLabelPvl["INSTRUMENT_ID"][0]; if(instId != "HIRISE_IDEAL_CAMERA") { - IString msg = "Invalid PDS label [" + from.expanded() + "]. The PDS product" + QString msg = "Invalid PDS label [" + from.expanded() + "]. The PDS product" " must be from an Ideal camera model derived from a HiRISE" " image. The INSTRUMENT_ID = [" + instId + "] is unsupported" " by pds2hideal."; @@ -51,16 +51,16 @@ void IsisMain() { outputCube->putGroup(otherGroups.FindGroup("Archive")); PvlGroup kernelGroup("Kernels"); - kernelGroup += PvlKeyword("NaifIkCode", IString(-74699)); + kernelGroup += PvlKeyword("NaifIkCode", toString(-74699)); kernelGroup += PvlKeyword("TargetPosition", "Table"); kernelGroup += PvlKeyword("InstrumentPointing", "Table"); kernelGroup += PvlKeyword("InstrumentPosition", "Table"); - QString shapeModelPath = IString(ui.GetString("SHAPEMODELPATH")).ToQt(); + QString shapeModelPath = ui.GetString("SHAPEMODELPATH"); if (!shapeModelPath.endsWith('/')) { shapeModelPath += "/"; } - QString shapeModelValue = shapeModelPath + QString::fromStdString(pdsLabelPvl["SHAPE_MODEL"]); - kernelGroup += PvlKeyword("ShapeModel", shapeModelValue.toStdString()); + QString shapeModelValue = shapeModelPath + pdsLabelPvl["SHAPE_MODEL"][0]; + kernelGroup += PvlKeyword("ShapeModel", shapeModelValue); outputCube->putGroup(kernelGroup); @@ -71,14 +71,14 @@ void IsisMain() { PvlObject &naifKeywords = isisLabel->FindObject("NaifKeywords"); PvlKeyword bodyRadii("BODY499_RADII"); - bodyRadii.AddValue(double(pdsLabelPvl["A_AXIS_RADIUS"])); - bodyRadii.AddValue(double(pdsLabelPvl["B_AXIS_RADIUS"])); - bodyRadii.AddValue(double(pdsLabelPvl["C_AXIS_RADIUS"])); + bodyRadii.AddValue(QString(pdsLabelPvl["A_AXIS_RADIUS"])); + bodyRadii.AddValue(QString(pdsLabelPvl["B_AXIS_RADIUS"])); + bodyRadii.AddValue(QString(pdsLabelPvl["C_AXIS_RADIUS"])); naifKeywords += bodyRadii; PvlObject &isisCubeObject = isisLabel->FindObject("IsisCube"); // Compute and add SOFTWARE_NAME to the Archive Group - IString sfname = "Isis " + Application::Version() + " " + + QString sfname = "Isis " + Application::Version() + " " + Application::GetUserInterface().ProgramName(); PvlGroup &archiveGroup = isisCubeObject.FindGroup("Archive"); archiveGroup += PvlKeyword("SOFTWARE_NAME", sfname); @@ -93,14 +93,14 @@ void IsisMain() { if (sourceLines != lines) { // this image is cropped, create an AlphaCube group PvlGroup alphaCube("AlphaCube"); - alphaCube += PvlKeyword("AlphaSamples", sourceSamps); - alphaCube += PvlKeyword("AlphaLines", sourceLines); - alphaCube += PvlKeyword("AlphaStartingSample", firstSamp); - alphaCube += PvlKeyword("AlphaEndingSample", (double) firstSamp + samples); - alphaCube += PvlKeyword("AlphaStartingLine", firstLine); - alphaCube += PvlKeyword("AlphaEndingLine", (double) firstLine + lines); - alphaCube += PvlKeyword("BetaSamples", samples); - alphaCube += PvlKeyword("BetaLines", lines); + alphaCube += PvlKeyword("AlphaSamples", toString(sourceSamps)); + alphaCube += PvlKeyword("AlphaLines", toString(sourceLines)); + alphaCube += PvlKeyword("AlphaStartingSample", toString(firstSamp)); + alphaCube += PvlKeyword("AlphaEndingSample", toString((double) firstSamp + samples)); + alphaCube += PvlKeyword("AlphaStartingLine", toString(firstLine)); + alphaCube += PvlKeyword("AlphaEndingLine", toString((double) firstLine + lines)); + alphaCube += PvlKeyword("BetaSamples", toString(samples)); + alphaCube += PvlKeyword("BetaLines", toString(lines)); isisCubeObject += alphaCube; } diff --git a/isis/src/mro/objs/CTXCamera/CTXCamera.cpp b/isis/src/mro/objs/CTXCamera/CTXCamera.cpp index 28fa04054a..4b0d6ba551 100644 --- a/isis/src/mro/objs/CTXCamera/CTXCamera.cpp +++ b/isis/src/mro/objs/CTXCamera/CTXCamera.cpp @@ -48,7 +48,7 @@ namespace Isis { // Get the start time from labels PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - string stime = inst["SpacecraftClockCount"]; + QString stime = inst["SpacecraftClockCount"]; double etStart = getClockTime(stime).Et(); // Get other info from labels @@ -68,10 +68,10 @@ namespace Isis { CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); // Retrieve boresight location from instrument kernel (IK) (addendum?) - IString ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_SAMPLE"; + QString ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_SAMPLE"; double sampleBoreSight = getDouble(ikernKey); - ikernKey = "INS" + IString((int)naifIkCode()) + "_BORESIGHT_LINE"; + ikernKey = "INS" + toString((int)naifIkCode()) + "_BORESIGHT_LINE"; double lineBoreSight = getDouble(ikernKey); focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight); diff --git a/isis/src/mro/objs/HiEqualization/HiEqualization.cpp b/isis/src/mro/objs/HiEqualization/HiEqualization.cpp index 400fd1a72a..e6e6f2cb39 100644 --- a/isis/src/mro/objs/HiEqualization/HiEqualization.cpp +++ b/isis/src/mro/objs/HiEqualization/HiEqualization.cpp @@ -19,7 +19,7 @@ using std::vector; namespace Isis { - HiEqualization::HiEqualization(string fromListName) : + HiEqualization::HiEqualization(QString fromListName) : Equalization() { loadInputs(fromListName); } @@ -32,7 +32,7 @@ namespace Isis { void HiEqualization::calculateStatistics() { // TODO member variable const FileList &imageList = getInputs(); - IString maxCubeStr((int) imageList.size()); + QString maxCubeStr = toString((int) imageList.size()); // Adds statistics for whole and side regions of every cube vector statsList; @@ -43,13 +43,13 @@ namespace Isis { Statistics *statsLeft = new Statistics(); Statistics *statsRight = new Statistics(); - IString cubeStr((int) img + 1); + QString cubeStr = toString((int) img + 1); ProcessByLine p; p.Progress()->SetText("Calculating Statistics for Cube " + cubeStr + " of " + maxCubeStr); CubeAttributeInput att; - const string inp = imageList[img].toString(); + QString inp = imageList[img].toString(); p.SetInputCube(inp, att); HiCalculateFunctor func(stats, statsLeft, statsRight, 100.0); p.ProcessCubeInPlace(func, false); @@ -89,8 +89,8 @@ namespace Isis { } - void HiEqualization::fillOutList(FileList &outList, string toListName) { - if (toListName.empty()) { + void HiEqualization::fillOutList(FileList &outList, QString toListName) { + if (toListName.isEmpty()) { generateOutputs(outList); } else { @@ -104,12 +104,12 @@ namespace Isis { } - void HiEqualization::errorCheck(string fromListName) { + void HiEqualization::errorCheck(QString fromListName) { const FileList &imageList = getInputs(); // Ensures number of images is within bound if (imageList.size() > 10) { - string msg = "The input file [" + fromListName + + QString msg = "The input file [" + fromListName + "] cannot contain more than 10 file names"; throw IException(IException::User, msg, _FILEINFO_); } @@ -132,14 +132,14 @@ namespace Isis { movedIndices.push_back(i); } catch (IException &e) { - string msg = "The [" + imageList[i].toString() + + QString msg = "The [" + imageList[i].toString() + "] file is not a valid HiRise image"; throw IException(e, IException::User, msg, _FILEINFO_); } catch (...) { // If any part of the above didn't work, we can safely assume the // current file is not a valid HiRise image - string msg = "The [" + imageList[i].toString() + + QString msg = "The [" + imageList[i].toString() + "] file is not a valid HiRise image"; throw IException(IException::User, msg, _FILEINFO_); } @@ -160,7 +160,7 @@ namespace Isis { // Insertion sorts a list of filenames by their CCD numbers for (int i = 1; i < imageList.size(); i++) { - string temp = imageList[i].toString(); + QString temp = imageList[i].toString(); int ccd1 = ccds[i]; int movedIndex = movedIndices[i]; diff --git a/isis/src/mro/objs/HiEqualization/HiEqualization.h b/isis/src/mro/objs/HiEqualization/HiEqualization.h index 24b4ce63b5..627b9f420b 100644 --- a/isis/src/mro/objs/HiEqualization/HiEqualization.h +++ b/isis/src/mro/objs/HiEqualization/HiEqualization.h @@ -25,11 +25,9 @@ #include "Equalization.h" -// TODO Qt instead #include #include -// TODO Don't include #include "FileList.h" @@ -74,14 +72,14 @@ namespace Isis { }; public: - HiEqualization(std::string fromListName); + HiEqualization(QString fromListName); virtual ~HiEqualization(); void calculateStatistics(); protected: - virtual void fillOutList(FileList &outList, std::string toListName); - virtual void errorCheck(std::string fromListName); + virtual void fillOutList(FileList &outList, QString toListName); + virtual void errorCheck(QString fromListName); private: int getCCDType(int ccd); diff --git a/isis/src/mro/objs/HiEqualization/unitTest.cpp b/isis/src/mro/objs/HiEqualization/unitTest.cpp index 257f67533d..806ea3d469 100644 --- a/isis/src/mro/objs/HiEqualization/unitTest.cpp +++ b/isis/src/mro/objs/HiEqualization/unitTest.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { try { FileName fromList("FromList.lst"); - string holdList = "HoldList.lst"; + QString holdList = "HoldList.lst"; cout << "UnitTest for Equalization" << endl; HiEqualization equalizer(fromList.toString()); @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) { for (int i = 0; i < imageList.size(); i++) { ProcessByLine p; CubeAttributeInput att; - const string inp = imageList[i].toString(); + QString inp = imageList[i].toString(); Cube *inputCube = p.SetInputCube(inp, att); TestFunctor func(&equalizer, inputCube->getLineCount(), i); p.ProcessCubeInPlace(func, false); diff --git a/isis/src/mro/objs/HiriseCamera/HiriseCamera.cpp b/isis/src/mro/objs/HiriseCamera/HiriseCamera.cpp index 65c17ffe6b..cc5182a340 100644 --- a/isis/src/mro/objs/HiriseCamera/HiriseCamera.cpp +++ b/isis/src/mro/objs/HiriseCamera/HiriseCamera.cpp @@ -57,7 +57,7 @@ namespace Isis { int chan = inst["ChannelNumber"]; int cpmm = inst["CpmmNumber"]; double deltaLineTimerCount = inst["DeltaLineTimerCount"]; - string stime = inst["SpacecraftClockStartCount"]; + QString stime = inst["SpacecraftClockStartCount"]; // Convert CPMM number to CCD number static int cpmm2ccd[] = {0, 1, 2, 3, 12, 4, 10, 11, 5, 13, 6, 7, 8, 9}; diff --git a/isis/src/mro/objs/MarciCamera/MarciCamera.cpp b/isis/src/mro/objs/MarciCamera/MarciCamera.cpp index b6e264ef0d..e4fc82a2b1 100644 --- a/isis/src/mro/objs/MarciCamera/MarciCamera.cpp +++ b/isis/src/mro/objs/MarciCamera/MarciCamera.cpp @@ -55,7 +55,7 @@ namespace Isis { // Set up the camera characteristics SetFocalLength(); - string pixelPitchKey = "INS" + IString((int)naifIkCode()) + "_PIXEL_SIZE"; + QString pixelPitchKey = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE"; SetPixelPitch(getDouble(pixelPitchKey)); // Get necessary variables @@ -65,41 +65,41 @@ namespace Isis { // Get the start and end time double et; - string stime = inst["SpacecraftClockCount"]; + QString stime = inst["SpacecraftClockCount"]; et = getClockTime(stime).Et(); p_etStart = et - ((p_exposureDur / 1000.0) / 2.0); p_nframelets = ParentLines() / sumMode; // These numbers came from "MARCI_CTX_Cal_Report_v1.5.pdf" page 7 (Bandpasses & downlinked detector rows) - std::map filterToDetectorOffset; - filterToDetectorOffset.insert(pair("BLUE", 709)); - filterToDetectorOffset.insert(pair("GREEN", 734)); - filterToDetectorOffset.insert(pair("ORANGE", 760)); - filterToDetectorOffset.insert(pair("RED", 786)); - filterToDetectorOffset.insert(pair("NIR", 811)); - filterToDetectorOffset.insert(pair("LONG_UV", 266)); - filterToDetectorOffset.insert(pair("SHORT_UV", 293)); - - std::map filterToFilterNumbers; - filterToFilterNumbers.insert(pair("BLUE", 0)); - filterToFilterNumbers.insert(pair("GREEN", 1)); - filterToFilterNumbers.insert(pair("ORANGE", 2)); - filterToFilterNumbers.insert(pair("RED", 3)); - filterToFilterNumbers.insert(pair("NIR", 4)); - filterToFilterNumbers.insert(pair("LONG_UV", 5)); - filterToFilterNumbers.insert(pair("SHORT_UV", 6)); + map filterToDetectorOffset; + filterToDetectorOffset.insert(pair("BLUE", 709)); + filterToDetectorOffset.insert(pair("GREEN", 734)); + filterToDetectorOffset.insert(pair("ORANGE", 760)); + filterToDetectorOffset.insert(pair("RED", 786)); + filterToDetectorOffset.insert(pair("NIR", 811)); + filterToDetectorOffset.insert(pair("LONG_UV", 266)); + filterToDetectorOffset.insert(pair("SHORT_UV", 293)); + + map filterToFilterNumbers; + filterToFilterNumbers.insert(pair("BLUE", 0)); + filterToFilterNumbers.insert(pair("GREEN", 1)); + filterToFilterNumbers.insert(pair("ORANGE", 2)); + filterToFilterNumbers.insert(pair("RED", 3)); + filterToFilterNumbers.insert(pair("NIR", 4)); + filterToFilterNumbers.insert(pair("LONG_UV", 5)); + filterToFilterNumbers.insert(pair("SHORT_UV", 6)); int frameletOffsetFactor = inst["ColorOffset"]; if((int)inst["DataFlipped"] != 0) frameletOffsetFactor *= -1; - std::map filterToFrameletOffset; - filterToFrameletOffset.insert(pair("NIR", 0 * frameletOffsetFactor)); - filterToFrameletOffset.insert(pair("RED", 1 * frameletOffsetFactor)); - filterToFrameletOffset.insert(pair("ORANGE", 2 * frameletOffsetFactor)); - filterToFrameletOffset.insert(pair("GREEN", 3 * frameletOffsetFactor)); - filterToFrameletOffset.insert(pair("BLUE", 4 * frameletOffsetFactor)); - filterToFrameletOffset.insert(pair("LONG_UV", 5 * frameletOffsetFactor)); - filterToFrameletOffset.insert(pair("SHORT_UV", 6 * frameletOffsetFactor)); + map filterToFrameletOffset; + filterToFrameletOffset.insert(pair("NIR", 0 * frameletOffsetFactor)); + filterToFrameletOffset.insert(pair("RED", 1 * frameletOffsetFactor)); + filterToFrameletOffset.insert(pair("ORANGE", 2 * frameletOffsetFactor)); + filterToFrameletOffset.insert(pair("GREEN", 3 * frameletOffsetFactor)); + filterToFrameletOffset.insert(pair("BLUE", 4 * frameletOffsetFactor)); + filterToFrameletOffset.insert(pair("LONG_UV", 5 * frameletOffsetFactor)); + filterToFrameletOffset.insert(pair("SHORT_UV", 6 * frameletOffsetFactor)); // Get the keywords from labels const PvlGroup &bandBin = lab.FindGroup("BandBin", Pvl::Traverse); @@ -107,7 +107,7 @@ namespace Isis { for(int i = 0; i < filtNames.Size(); i++) { if(filterToDetectorOffset.find(filtNames[i]) == filterToDetectorOffset.end()) { - string msg = "Unrecognized filter name [" + filtNames[i] + "]"; + QString msg = "Unrecognized filter name [" + filtNames[i] + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/mro/objs/MarciCamera/MarciDistortionMap.cpp b/isis/src/mro/objs/MarciCamera/MarciDistortionMap.cpp index beed7cc5f8..447fd9cf26 100644 --- a/isis/src/mro/objs/MarciCamera/MarciDistortionMap.cpp +++ b/isis/src/mro/objs/MarciCamera/MarciDistortionMap.cpp @@ -39,7 +39,7 @@ namespace Isis { * */ MarciDistortionMap::MarciDistortionMap(Camera *parent, int naifIkCode) : CameraDistortionMap(parent) { - std::string odkkey = "INS" + Isis::IString(naifIkCode) + "_DISTORTION_COEFFS"; + QString odkkey = "INS" + toString(naifIkCode) + "_DISTORTION_COEFFS"; for(int i = 0; i < 4; i++) { p_odk.push_back(p_camera->getDouble(odkkey, i)); diff --git a/isis/src/odyssey/apps/thm2isis/thm2isis.cpp b/isis/src/odyssey/apps/thm2isis/thm2isis.cpp index cc5052d1c6..70cc87c72c 100644 --- a/isis/src/odyssey/apps/thm2isis/thm2isis.cpp +++ b/isis/src/odyssey/apps/thm2isis/thm2isis.cpp @@ -35,26 +35,24 @@ void IsisMain() { try { Pvl lab(in.expanded()); projected = lab.HasObject("IMAGE_MAP_PROJECTION"); - IString id; - id = (string)lab["DATA_SET_ID"]; - id.ConvertWhiteSpace(); - id.Compress(); - id.Trim(" "); - if(id.find("ODY-M-THM") == string::npos) { - string msg = "Invalid DATA_SET_ID [" + id + "]"; + QString id; + id = (QString)lab["DATA_SET_ID"]; + id = id.simplified().trimmed(); + if(!id.startsWith("ODY-M-THM")) { + QString msg = "Invalid DATA_SET_ID [" + id + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } } catch(IException &e) { - string msg = "Input file [" + in.expanded() + - "] does not appear to be " + - "in Themis EDR/RDR format"; + QString msg = "Input file [" + in.expanded() + + "] does not appear to be " + + "in Themis EDR/RDR format"; throw IException(IException::Io, msg, _FILEINFO_); } //Checks if in file is rdr if(projected) { - string msg = "[" + in.name() + "] appears to be an rdr file."; + QString msg = "[" + in.name() + "] appears to be an rdr file."; msg += " Use pds2isis."; throw IException(IException::User, msg, _FILEINFO_); } @@ -72,7 +70,7 @@ void IsisMain() { FileName outFile(ui.GetFileName("TO")); PvlGroup &inst = isis3Lab.FindGroup("Instrument", Pvl::Traverse); - if((string)inst["InstrumentId"] == "THEMIS_VIS") { + if((QString)inst["InstrumentId"] == "THEMIS_VIS") { Cube *even = new Cube(); Cube *odd = new Cube(); @@ -81,8 +79,8 @@ void IsisMain() { odd->setDimensions(p.Samples(), p.Lines(), p.Bands()); odd->setPixelType(Isis::Real); - string evenFile = outFile.path() + "/" + outFile.baseName() + ".even.cub"; - string oddFile = outFile.path() + "/" + outFile.baseName() + ".odd.cub"; + QString evenFile = outFile.path() + "/" + outFile.baseName() + ".even.cub"; + QString oddFile = outFile.path() + "/" + outFile.baseName() + ".odd.cub"; even->create(evenFile); odd->create(oddFile); @@ -112,10 +110,10 @@ void IsisMain() { if(outputCubes.size() != 1) { int numFramelets = p.Lines() / frameletLines; isis3Lab.FindGroup("Instrument").AddKeyword( - PvlKeyword("NumFramelets", numFramelets), Pvl::Replace + PvlKeyword("NumFramelets", toString(numFramelets)), Pvl::Replace ); - string frameletType = ((i == 0) ? "Odd" : "Even"); + QString frameletType = ((i == 0) ? "Odd" : "Even"); isis3Lab.FindGroup("Instrument").AddKeyword( PvlKeyword("Framelets", frameletType), Pvl::Replace ); @@ -164,37 +162,37 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3, int numBands) { // Create the Instrument Group PvlGroup inst("Instrument"); inst += PvlKeyword("SpacecraftName", "MARS_ODYSSEY"); - string instId = (string) pdsLab["InstrumentId"] + "_" + - (string) pdsLab["DetectorId"]; + QString instId = (QString) pdsLab["InstrumentId"] + "_" + + (QString) pdsLab["DetectorId"]; inst += PvlKeyword("InstrumentId", instId); - inst += PvlKeyword("TargetName", (string) pdsLab["TargetName"]); - inst += PvlKeyword("MissionPhaseName", (string) pdsLab["MissionPhaseName"]); - inst += PvlKeyword("StartTime", (string)pdsLab["StartTime"]); - inst += PvlKeyword("StopTime", (string)pdsLab["StopTime"]); + inst += PvlKeyword("TargetName", (QString) pdsLab["TargetName"]); + inst += PvlKeyword("MissionPhaseName", (QString) pdsLab["MissionPhaseName"]); + inst += PvlKeyword("StartTime", (QString)pdsLab["StartTime"]); + inst += PvlKeyword("StopTime", (QString)pdsLab["StopTime"]); inst += PvlKeyword("SpacecraftClockCount", - (string) pdsLab["SpacecraftClockStartCount"]); + (QString) pdsLab["SpacecraftClockStartCount"]); PvlObject &sqube = pdsLab.FindObject("SPECTRAL_QUBE"); if(instId == "THEMIS_IR") { - inst += PvlKeyword("GainNumber", (string)sqube["GainNumber"]); - inst += PvlKeyword("OffsetNumber", (string)sqube["OffsetNumber"]); - inst += PvlKeyword("MissingScanLines", (string)sqube["MissingScanLines"]); + inst += PvlKeyword("GainNumber", (QString)sqube["GainNumber"]); + inst += PvlKeyword("OffsetNumber", (QString)sqube["OffsetNumber"]); + inst += PvlKeyword("MissingScanLines", (QString)sqube["MissingScanLines"]); inst += PvlKeyword("TimeDelayIntegration", - (string)sqube["TimeDelayIntegrationFlag"]); + (QString)sqube["TimeDelayIntegrationFlag"]); if(sqube.HasKeyword("SpatialSumming")) { - inst += PvlKeyword("SpatialSumming", (string)sqube["SpatialSumming"]); + inst += PvlKeyword("SpatialSumming", (QString)sqube["SpatialSumming"]); } } else { - inst += PvlKeyword("ExposureDuration", (string)sqube["ExposureDuration"]); - inst += PvlKeyword("InterframeDelay", (string)sqube["InterframeDelay"]); - inst += PvlKeyword("SpatialSumming", (string)sqube["SpatialSumming"]); + inst += PvlKeyword("ExposureDuration", (QString)sqube["ExposureDuration"]); + inst += PvlKeyword("InterframeDelay", (QString)sqube["InterframeDelay"]); + inst += PvlKeyword("SpatialSumming", (QString)sqube["SpatialSumming"]); } // Add at time offset to the Instrument group UserInterface &ui = Application::GetUserInterface(); double spacecraftClockOffset = ui.GetDouble("TIMEOFFSET"); - inst += PvlKeyword("SpacecraftClockOffset", spacecraftClockOffset, "seconds"); + inst += PvlKeyword("SpacecraftClockOffset", toString(spacecraftClockOffset), "seconds"); isis3.AddGroup(inst); @@ -202,7 +200,7 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3, int numBands) { PvlGroup bandBin("BandBin"); PvlKeyword originalBand("OriginalBand"); for(int i = 1; i <= numBands; i++) { - originalBand.AddValue(i); + originalBand.AddValue(toString(i)); } bandBin += originalBand; bandBin += sqube.FindGroup("BandBin")["BandBinCenter"]; @@ -215,29 +213,29 @@ void TranslateLabels(Pvl &pdsLab, Pvl &isis3, int numBands) { // Create the archive Group PvlGroup arch("Archive"); - arch += PvlKeyword("DataSetId", (string)pdsLab["DataSetId"]); - arch += PvlKeyword("ProducerId", (string)pdsLab["ProducerId"]); - arch += PvlKeyword("ProductId", (string)pdsLab["ProductId"]); + arch += PvlKeyword("DataSetId", (QString)pdsLab["DataSetId"]); + arch += PvlKeyword("ProducerId", (QString)pdsLab["ProducerId"]); + arch += PvlKeyword("ProductId", (QString)pdsLab["ProductId"]); arch += PvlKeyword("ProductCreationTime", - (string)pdsLab["ProductCreationTime"]); - arch += PvlKeyword("ProductVersionId", (string)pdsLab["ProductVersionId"]); + (QString)pdsLab["ProductCreationTime"]); + arch += PvlKeyword("ProductVersionId", (QString)pdsLab["ProductVersionId"]); // arch += PvlKeyword("ReleaseId",(string)pdsLab["ReleaseId"]); - arch += PvlKeyword("OrbitNumber", (string)pdsLab["OrbitNumber"]); + arch += PvlKeyword("OrbitNumber", (QString)pdsLab["OrbitNumber"]); arch += PvlKeyword("FlightSoftwareVersionId", - (string)sqube["FlightSoftwareVersionId"]); + (QString)sqube["FlightSoftwareVersionId"]); arch += PvlKeyword("CommandSequenceNumber", - (string)sqube["CommandSequenceNumber"]); - arch += PvlKeyword("Description", (string)sqube["Description"]); + (QString)sqube["CommandSequenceNumber"]); + arch += PvlKeyword("Description", (QString)sqube["Description"]); isis3.AddGroup(arch); // Create the Kernel Group PvlGroup kerns("Kernels"); if(instId == "THEMIS_IR") { - kerns += PvlKeyword("NaifFrameCode", -53031); + kerns += PvlKeyword("NaifFrameCode", toString(-53031)); } else { - kerns += PvlKeyword("NaifFrameCode", -53032); + kerns += PvlKeyword("NaifFrameCode", toString(-53032)); } isis3.AddGroup(kerns); } diff --git a/isis/src/odyssey/apps/thmbasemap1/thmbasemap1.cpp b/isis/src/odyssey/apps/thmbasemap1/thmbasemap1.cpp index 231d76064d..1971763e42 100644 --- a/isis/src/odyssey/apps/thmbasemap1/thmbasemap1.cpp +++ b/isis/src/odyssey/apps/thmbasemap1/thmbasemap1.cpp @@ -26,16 +26,16 @@ void IsisMain(){ // Input file options FileList cubes; Pvl &pref = Preference::Preferences(); - string pathName = (string)pref.FindGroup("DataDirectory")["Temporary"] + "/"; + QString pathName = (QString)pref.FindGroup("DataDirectory")["Temporary"] + "/"; if (ui.WasEntered("TOPATH")) { - pathName = (string)ui.GetString("TOPATH") + "/"; + pathName = (QString)ui.GetString("TOPATH") + "/"; } - string outFile; + QString outFile; if (ui.WasEntered("FROMLIST")) { cubes.read(ui.GetFileName("FROMLIST")); } else { - string msg = "Error: FROMLIST file must be specified"; + QString msg = "Error: FROMLIST file must be specified"; throw IException(IException::User, msg, _FILEINFO_); } @@ -46,7 +46,7 @@ void IsisMain(){ // Output Information for GIS Software Package bool logCamStats = ui.GetBoolean("INFO"); bool footPrintInit = false; - string logFileName; + QString logFileName; if (logCamStats) { footPrintInit = ui.GetBoolean("FOOTPRINT"); if (!ui.WasEntered("TOSTAT")) { @@ -62,10 +62,10 @@ void IsisMain(){ if (logCamStats) { FileName logFile(logFileName); if (logFile.fileExists()) { - logFileos.open(logFileName.c_str(),ios::app); + logFileos.open(logFileName.toAscii().data(),ios::app); } else { - logFileos.open(logFileName.c_str(),ios::out); + logFileos.open(logFileName.toAscii().data(),ios::out); logFileos << "Filename," << "Duration," << "Summing,"<< "IncidenceAverage," << "ResolutionAverage,"<< "IncidenceMinimum," << "IncidenceMaximum," << "Gaps,"< 90, then exit if (!processNight && incAngle >= 90) { - remove (tstat1.expanded().c_str()); + remove (tstat1.expanded().toAscii().data()); if (rmHiIncInput) { if (reportHiInc) { hiIncListos << infile.baseName() << endl; } if (!pdsSanFile) { - remove(inFileStr.c_str()); - remove(input.c_str()); + remove(inFileStr.toAscii().data()); + remove(input.toAscii().data()); } } if (reportNoFile) { noFileListos << infile.baseName() << " not processed because average incidence angle >= 90 and DAY images requested" << endl; - remove(output.c_str()); + remove(output.toAscii().data()); } - string msg = "The average incidence angle of [" + cubes[i].toString() + "] is over 90"; + QString msg = "The average incidence angle of [" + cubes[i].toString() + "] is over 90"; throw IException(IException::User, msg, _FILEINFO_); } // if process night and incidence angle < 90, then exit if (processNight && incAngle < 90) { - remove (tstat1.expanded().c_str()); + remove (tstat1.expanded().toAscii().data()); if (rmHiIncInput) { if (reportHiInc) { hiIncListos << infile.baseName() << endl; } if (!pdsSanFile) { - remove(inFileStr.c_str()); - remove(input.c_str()); + remove(inFileStr.toAscii().data()); + remove(input.toAscii().data()); } } if (reportNoFile) { noFileListos << infile.baseName() << " not processed because average incidence angle < 90 and NIGHT images requested" << endl; - remove(output.c_str()); + remove(output.toAscii().data()); } - string msg = "The average incidence angle of [" + cubes[i].toString() + "] is over 90"; + QString msg = "The average incidence angle of [" + cubes[i].toString() + "] is over 90"; throw IException(IException::User,msg,_FILEINFO_); } @@ -287,16 +287,16 @@ void IsisMain(){ // Note we use wavelength 12.57um in geologic mosaics. if (band14_88 && incAngle < 90 && !ignoreAtmCorr) { output = (infile.baseName()) + "_driftcorr.cub"; - parameters = "FROM=" + input + "+" + IString(procBand) + - " ATM=" + input + "+" + IString(atmosBand) + " TO=" + output; + parameters = "FROM=" + input + "+" + toString(procBand) + + " ATM=" + input + "+" + toString(atmosBand) + " TO=" + output; ProgramLauncher::RunIsisProgram("thmdriftcor", parameters); - remove (input.c_str()); + remove (input.toAscii().data()); } else { output = (infile.baseName()) + "_no_driftcorr.cub"; - parameters = "FROM=" + input + "+" + IString(procBand) + " TO=" + output; + parameters = "FROM=" + input + "+" + toString(procBand) + " TO=" + output; ProgramLauncher::RunIsisProgram("stretch", parameters); - remove (input.c_str()); + remove (input.toAscii().data()); } // Run cosi, for incidence < 90 (day images) @@ -306,7 +306,7 @@ void IsisMain(){ output = (infile.baseName()) + "_cosi.cub"; parameters = "FROM=" + input + " TO=" + output; ProgramLauncher::RunIsisProgram("cosi", parameters); - remove (input.c_str()); + remove (input.toAscii().data()); } // Run cubenorm @@ -314,25 +314,25 @@ void IsisMain(){ output = (infile.baseName()) + "cubenorm.cub"; parameters = "FROM=" + input + " TO=" + output; ProgramLauncher::RunIsisProgram("cubenorm", parameters); - remove (input.c_str()); + remove (input.toAscii().data()); //Run lineeq input=output; outFile = pathName + infile.baseName() + ".lev1.cub"; parameters ="FROM=" + input + " TO=" + outFile; ProgramLauncher::RunIsisProgram("lineeq", parameters); - remove (input.c_str()); + remove (input.toAscii().data()); - remove (tstat1.expanded().c_str()); + remove (tstat1.expanded().toAscii().data()); //************************************ // Run findgaps // Create temporary pvl for gaps - string sgap = "no"; + QString sgap = "no"; FileName tgaps; - string tmpstats1 = infile.baseName() + "_tmpstats1"; + QString tmpstats1 = infile.baseName() + "_tmpstats1"; tgaps = FileName::createTempFile("$TEMPORARY/" + tmpstats1 + ".pvl"); - string tempgaps = tgaps.expanded(); + QString tempgaps = tgaps.expanded(); //parameters = "FROM=" + IString(ui.GetFileName("TO")) + // " TO=" + tempgaps + " CORTOL=.3"; @@ -342,8 +342,8 @@ void IsisMain(){ ProgramLauncher::RunIsisProgram("stats", parameters); Pvl tg; tg.Read(tempgaps); - string totalpixels = tg.FindGroup("Results",Pvl::Traverse)["TotalPixels"]; - string validpixels = tg.FindGroup("Results",Pvl::Traverse)["ValidPixels"]; + QString totalpixels = tg.FindGroup("Results",Pvl::Traverse)["TotalPixels"]; + QString validpixels = tg.FindGroup("Results",Pvl::Traverse)["ValidPixels"]; //if (tg.HasGroup("Gap")) { if (IString(totalpixels).ToInteger() != IString(validpixels).ToInteger()) { cout << tg << endl; @@ -352,13 +352,13 @@ void IsisMain(){ imageGapListos << infile.baseName() << endl; } } - remove (tgaps.expanded().c_str()); + remove (tgaps.expanded().toAscii().data()); // Create temporary pvl and fill with camstats FileName tstat2; - string tmpcamstats2 = infile.baseName() + "_tmpcamstats2"; + QString tmpcamstats2 = infile.baseName() + "_tmpcamstats2"; tstat2 = FileName::createTempFile("$TEMPORARY/" + tmpcamstats2 + ".pvl"); - string tempstat2 = tstat2.expanded(); + QString tempstat2 = tstat2.expanded(); parameters = "FROM=" + outFile + " TO=" + tempstat2 + " linc = 100 sinc = 100"; @@ -366,11 +366,11 @@ void IsisMain(){ Pvl p2; p2.Read(tempstat2); - string incavg = p2.FindGroup("IncidenceAngle",Pvl::Traverse)["IncidenceAverage"]; - string resavg = p2.FindGroup("Resolution",Pvl::Traverse)["ResolutionAverage"]; - string incmin = p2.FindGroup("IncidenceAngle",Pvl::Traverse)["IncidenceMinimum"]; - string incmax = p2.FindGroup("IncidenceAngle",Pvl::Traverse)["IncidenceMaximum"]; - remove (tstat2.expanded().c_str()); + QString incavg = p2.FindGroup("IncidenceAngle",Pvl::Traverse)["IncidenceAverage"]; + QString resavg = p2.FindGroup("Resolution",Pvl::Traverse)["ResolutionAverage"]; + QString incmin = p2.FindGroup("IncidenceAngle",Pvl::Traverse)["IncidenceMinimum"]; + QString incmax = p2.FindGroup("IncidenceAngle",Pvl::Traverse)["IncidenceMaximum"]; + remove (tstat2.expanded().toAscii().data()); double summing = 1; FileName tosum = FileName(outFile); @@ -390,13 +390,13 @@ void IsisMain(){ // Run footprint stuff if requested for GIS input if (footPrintInit) { parameters = "FROM=" + outFile + - " TO=" + (IString)(infile.baseName()) + ".gml" + - " LABEL=" + (IString)(infile.baseName()); + " TO=" + (QString)(infile.baseName()) + ".gml" + + " LABEL=" + (QString)(infile.baseName()); ProgramLauncher::RunIsisProgram("isis2gml", parameters); } if (rmInput && !pdsSanFile) { - remove(inFileStr.c_str()); + remove(inFileStr.toAscii().data()); } } catch(IException &e) { diff --git a/isis/src/odyssey/apps/thmnoseam/thmnoseam.cpp b/isis/src/odyssey/apps/thmnoseam/thmnoseam.cpp index ffe33769d0..d89f8fbeb2 100644 --- a/isis/src/odyssey/apps/thmnoseam/thmnoseam.cpp +++ b/isis/src/odyssey/apps/thmnoseam/thmnoseam.cpp @@ -1,6 +1,6 @@ #include "Isis.h" -#include +#include #include #include @@ -92,7 +92,7 @@ void IsisMain() { } } catch(IException &) { - string msg = "This program is intended for use on THEMIS VIS images only"; + QString msg = "This program is intended for use on THEMIS VIS images only"; msg += " [" + ui.GetFileName("INEVEN") + "] does not appear to be a "; msg += "THEMIS VIS image."; throw IException(IException::User, msg, _FILEINFO_); @@ -104,27 +104,27 @@ void IsisMain() { } } catch(IException &e) { - string msg = "This program is intended for use on THEMIS VIS images only"; + QString msg = "This program is intended for use on THEMIS VIS images only"; msg += " [" + ui.GetFileName("INODD") + "] does not appear to be a "; msg += "THEMIS VIS image."; throw IException(IException::User, msg, _FILEINFO_); } if (evenCube->getGroup("Instrument")["Framelets"][0] != "Even") { - string msg = "The image [" + ui.GetFileName("INEVEN") + "] does not appear " + QString msg = "The image [" + ui.GetFileName("INEVEN") + "] does not appear " "to contain the EVEN framelets of a Themis VIS cube"; throw IException(IException::User, msg, _FILEINFO_); } if (oddCube->getGroup("Instrument")["Framelets"][0] != "Odd") { - string msg = "The image [" + ui.GetFileName("ODDEVEN") + "] does not appear " + QString msg = "The image [" + ui.GetFileName("ODDEVEN") + "] does not appear " "to contain the ODD framelets of a Themis VIS cube"; throw IException(IException::User, msg, _FILEINFO_); } PvlGroup &inputInstrumentGrp = evenCube->getGroup("Instrument"); PvlKeyword &spatialSumming = inputInstrumentGrp["SpatialSumming"]; - frameletSize = 192 / (int)spatialSumming[0]; + frameletSize = 192 / toInt(spatialSumming[0]); overlapSize = FrameletOverlapSize(); if(overlapSize == 0) { @@ -322,7 +322,7 @@ int FrameletOverlapSize() { Camera *camOdd = oddCube->getCamera(); if(camEven == NULL || camOdd == NULL) { - string msg = "A camera is required to automatically calculate the overlap " + QString msg = "A camera is required to automatically calculate the overlap " "between framelets. Please run spiceinit on the input cube"; throw IException(IException::Unknown, msg, _FILEINFO_); } diff --git a/isis/src/odyssey/apps/thmproc/thmproc.cpp b/isis/src/odyssey/apps/thmproc/thmproc.cpp index 322378ac43..c73a157202 100644 --- a/isis/src/odyssey/apps/thmproc/thmproc.cpp +++ b/isis/src/odyssey/apps/thmproc/thmproc.cpp @@ -10,15 +10,15 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); if(!ui.GetBoolean("INGESTION") && !ui.GetBoolean("MAPPING")) { - string msg = "You must pick one of [INGESTION,MAPPING]"; + QString msg = "You must pick one of [INGESTION,MAPPING]"; throw IException(IException::User, msg, _FILEINFO_); } if(ui.GetBoolean("INGESTION")) { Pvl labels(ui.GetFileName("FROM")); - if((IString)labels["DETECTOR_ID"][0] == "VIS") { - if(((string)labels["DATA_SET_ID"]).find("RDR") != string::npos) { + if((QString)labels["DETECTOR_ID"][0] == "VIS") { + if(((QString)labels["DATA_SET_ID"]).contains("RDR")) { ProcessVis(true); } else { diff --git a/isis/src/odyssey/apps/thmvisflat/thmvisflat.cpp b/isis/src/odyssey/apps/thmvisflat/thmvisflat.cpp index 0cdd25e6f5..92af8dfc0f 100644 --- a/isis/src/odyssey/apps/thmvisflat/thmvisflat.cpp +++ b/isis/src/odyssey/apps/thmvisflat/thmvisflat.cpp @@ -25,25 +25,25 @@ void IsisMain() { FileName inFileName = ui.GetFileName("FROM"); try { if(icube.getGroup("Instrument")["InstrumentID"][0] != "THEMIS_VIS") { - string msg = "This program is intended for use on THEMIS VIS images only. ["; + QString msg = "This program is intended for use on THEMIS VIS images only. ["; msg += inFileName.expanded() + "] does not appear to be a THEMIS VIS image."; throw IException(IException::User, msg, _FILEINFO_); } } catch(IException &e) { - string msg = "This program is intended for use on THEMIS VIS images only. ["; + QString msg = "This program is intended for use on THEMIS VIS images only. ["; msg += inFileName.expanded() + "] does not appear to be a THEMIS VIS image."; throw IException(e, IException::User, msg, _FILEINFO_); } vector flatcubes; vector fcubeMgrs; - int summing = icube.getGroup("Instrument")["SpatialSumming"][0]; + int summing = toInt(icube.getGroup("Instrument")["SpatialSumming"][0]); for(int filt = 0; filt < 5; filt++) { - string filePattern = "$odyssey/calibration/flat_filter_"; - filePattern += IString(filt + 1) + "_summing_"; - filePattern += IString(summing) + "_v????.cub"; + QString filePattern = "$odyssey/calibration/flat_filter_"; + filePattern += toString(filt + 1) + "_summing_"; + filePattern += toString(summing) + "_v????.cub"; FileName flatFile = FileName(filePattern).highestVersion(); Cube *fcube = new Cube(); fcube->open(flatFile.expanded()); @@ -71,7 +71,7 @@ void IsisMain() { PvlKeyword &filtNums = icube.getLabel()->FindGroup("BandBin", Pvl::Traverse)["FilterNumber"]; for(int i = 0; i < filtNums.Size(); i++) { - filter.push_back(filtNums[i]); + filter.push_back(toInt(filtNums[i])); } LineManager ocubeMgr(ocube); diff --git a/isis/src/odyssey/apps/thmvistrim/thmvistrim.cpp b/isis/src/odyssey/apps/thmvistrim/thmvistrim.cpp index 5401901b87..afcdebab71 100644 --- a/isis/src/odyssey/apps/thmvistrim/thmvistrim.cpp +++ b/isis/src/odyssey/apps/thmvistrim/thmvistrim.cpp @@ -30,18 +30,18 @@ void IsisMain() { FileName inFileName = ui.GetFileName("FROM"); try { if(icube->getGroup("Instrument")["InstrumentID"][0] != "THEMIS_VIS") { - string msg = "This program is intended for use on THEMIS VIS images only. ["; + QString msg = "This program is intended for use on THEMIS VIS images only. ["; msg += inFileName.expanded() + "] does not appear to be a THEMIS VIS image."; throw IException(IException::User, msg, _FILEINFO_); } } catch(IException &e) { - string msg = "This program is intended for use on THEMIS VIS images only. ["; + QString msg = "This program is intended for use on THEMIS VIS images only. ["; msg += inFileName.expanded() + "] does not appear to be a THEMIS VIS image."; throw IException(e, IException::User, msg, _FILEINFO_); } - frameletSize = 192 / (int)icube->getGroup("Instrument")["SpatialSumming"][0]; + frameletSize = 192 / toInt(icube->getGroup("Instrument")["SpatialSumming"][0]); frameletTopTrimSize = ui.GetInteger("TOPTRIM"); frameletLeftTrimSize = ui.GetInteger("LEFTTRIM"); frameletRightTrimSize = ui.GetInteger("RIGHTTRIM"); diff --git a/isis/src/odyssey/objs/ThemisIrCamera/ThemisIrCamera.cpp b/isis/src/odyssey/objs/ThemisIrCamera/ThemisIrCamera.cpp index c500fbb930..7ac3f64a24 100644 --- a/isis/src/odyssey/objs/ThemisIrCamera/ThemisIrCamera.cpp +++ b/isis/src/odyssey/objs/ThemisIrCamera/ThemisIrCamera.cpp @@ -49,7 +49,7 @@ namespace Isis { // have been put in the labels during ingestion (thm2isis). This is meant // to handle a random timing errors which can be up to four pixels PvlGroup &inst = lab.FindGroup("Instrument", Pvl::Traverse); - string stime = inst["SpacecraftClockCount"]; + QString stime = inst["SpacecraftClockCount"]; p_etStart = getClockTime(stime).Et(); double offset = inst["SpacecraftClockOffset"]; @@ -61,7 +61,7 @@ namespace Isis { PvlGroup &bandBin = lab.FindGroup("BandBin", Pvl::Traverse); PvlKeyword &orgBand = bandBin["FilterNumber"]; for(int i = 0; i < orgBand.Size(); i++) { - p_originalBand.push_back(orgBand[i]); + p_originalBand.push_back(toInt(orgBand[i])); } // Themis IR had a summing mode added. This directly affects the line @@ -78,7 +78,7 @@ namespace Isis { // If the TDI mode is enabled then 16 line in the detector are summed // to improve the SNR. In the SetBand method we will the TDI mode to // determine line offset for the band. - p_tdiMode = (string) inst["TimeDelayIntegration"]; + p_tdiMode = (QString) inst["TimeDelayIntegration"]; // The detector map tells us how to convert from image coordinates to // detector coordinates. In our case, a (sample,line) to a (sample,time) diff --git a/isis/src/odyssey/objs/ThemisIrCamera/ThemisIrCamera.h b/isis/src/odyssey/objs/ThemisIrCamera/ThemisIrCamera.h index 3112ba27cc..c1bf83a5bc 100644 --- a/isis/src/odyssey/objs/ThemisIrCamera/ThemisIrCamera.h +++ b/isis/src/odyssey/objs/ThemisIrCamera/ThemisIrCamera.h @@ -98,7 +98,7 @@ namespace Isis { double p_etStart; double p_lineRate; double p_bandTimeOffset; - std::string p_tdiMode; + QString p_tdiMode; std::vector p_originalBand; }; diff --git a/isis/src/odyssey/objs/ThemisVisCamera/ThemisVisCamera.cpp b/isis/src/odyssey/objs/ThemisVisCamera/ThemisVisCamera.cpp index 9a6148f864..464dfac1d0 100644 --- a/isis/src/odyssey/objs/ThemisVisCamera/ThemisVisCamera.cpp +++ b/isis/src/odyssey/objs/ThemisVisCamera/ThemisVisCamera.cpp @@ -67,7 +67,7 @@ namespace Isis { // Get the start and end time double et; - string stime = inst["SpacecraftClockCount"]; + QString stime = inst["SpacecraftClockCount"]; et = getClockTime(stime).Et(); double offset = inst["SpacecraftClockOffset"]; @@ -78,7 +78,7 @@ namespace Isis { PvlGroup &bandBin = lab.FindGroup("BandBin", Pvl::Traverse); PvlKeyword &orgBand = bandBin["OriginalBand"]; for(int i = 0; i < orgBand.Size(); i++) { - p_originalBand.push_back(orgBand[i]); + p_originalBand.push_back(toInt(orgBand[i])); } // Setup detector map diff --git a/isis/src/qisis/apps/cneteditor/AbstractTreeModel.cpp b/isis/src/qisis/apps/cneteditor/AbstractTreeModel.cpp index 5ed0f4fc56..18c6ae4439 100644 --- a/isis/src/qisis/apps/cneteditor/AbstractTreeModel.cpp +++ b/isis/src/qisis/apps/cneteditor/AbstractTreeModel.cpp @@ -199,7 +199,7 @@ namespace Isis if (!start) { - IString msg = "The first item passed to getItems(AbstractTreeItem*, " + QString msg = "The first item passed to getItems(AbstractTreeItem*, " "AbstractTreeItem*) is not visible in this model's tree"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -228,7 +228,7 @@ namespace Isis if (!curItem) { - IString msg = "The second item passed to getItems(AbstractTreeItem*, " + QString msg = "The second item passed to getItems(AbstractTreeItem*, " "AbstractTreeItem*) is not visible in this model's tree"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/qisis/apps/cneteditor/CnetDisplayProperties.cpp b/isis/src/qisis/apps/cneteditor/CnetDisplayProperties.cpp index 179da3b385..76107d0b5d 100644 --- a/isis/src/qisis/apps/cneteditor/CnetDisplayProperties.cpp +++ b/isis/src/qisis/apps/cneteditor/CnetDisplayProperties.cpp @@ -282,12 +282,12 @@ namespace Isis for (int i = 0; *interruptFlag == 0 && i < fileNames.size(); i++) { - IString fileName = fileNames[i]; + QString fileName = fileNames[i]; Cube cube; cube.open(fileName); - newMap.insert(SerialNumber::Compose(fileName).c_str(), fileNames[i]); + newMap.insert(SerialNumber::Compose(fileName), fileNames[i]); composedCount->fetchAndAddRelaxed(1); } diff --git a/isis/src/qisis/apps/cneteditor/CnetEditorWindow.cpp b/isis/src/qisis/apps/cneteditor/CnetEditorWindow.cpp index 3b0ba754f0..2e520aacb1 100644 --- a/isis/src/qisis/apps/cneteditor/CnetEditorWindow.cpp +++ b/isis/src/qisis/apps/cneteditor/CnetEditorWindow.cpp @@ -362,7 +362,7 @@ namespace Isis void CnetEditorWindow::readSettings() { QSettings settings(FileName( - "$HOME/.Isis/cneteditor/cneteditor.config").expanded().c_str(), + "$HOME/.Isis/cneteditor/cneteditor.config").expanded(), QSettings::NativeFormat); // load window position and size @@ -380,7 +380,7 @@ namespace Isis void CnetEditorWindow::writeSettings() { QSettings settings(FileName( - "$HOME/.Isis/cneteditor/cneteditor.config").expanded().c_str(), + "$HOME/.Isis/cneteditor/cneteditor.config").expanded(), QSettings::NativeFormat); // save window position and size @@ -702,7 +702,7 @@ namespace Isis { cnet = net; editorWidget = new CnetEditorWidget(cnet, FileName( - "$HOME/.Isis/cneteditor/cneteditor.config").expanded().c_str()); + "$HOME/.Isis/cneteditor/cneteditor.config").expanded()); populateMenus(); populateToolBars(); connect(editorWidget, SIGNAL(cnetModified()), this, SLOT(setDirty())); @@ -719,7 +719,7 @@ namespace Isis editorWidget->connectionFilterWidget()); setFileState(HasFile, *curFile); - saveAsPvl = !Pvl((IString) *curFile).HasObject("ProtoBuffer"); + saveAsPvl = !Pvl(*curFile).HasObject("ProtoBuffer"); } diff --git a/isis/src/qisis/apps/cneteditor/PointTableDelegate.cpp b/isis/src/qisis/apps/cneteditor/PointTableDelegate.cpp index de79a7230f..c42ad949a5 100644 --- a/isis/src/qisis/apps/cneteditor/PointTableDelegate.cpp +++ b/isis/src/qisis/apps/cneteditor/PointTableDelegate.cpp @@ -99,7 +99,7 @@ namespace Isis return new QLineEdit(); } - IString msg = "Could not create delegate widget for column [" + QString msg = "Could not create delegate widget for column [" + col->getTitle() + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/qisis/apps/qnet/QnetCubeNameFilter.cpp b/isis/src/qisis/apps/qnet/QnetCubeNameFilter.cpp index 48cb8d32d9..4e9897f24e 100644 --- a/isis/src/qisis/apps/qnet/QnetCubeNameFilter.cpp +++ b/isis/src/qisis/apps/qnet/QnetCubeNameFilter.cpp @@ -61,7 +61,7 @@ namespace Isis { rx.setPatternSyntax(QRegExp::Wildcard); if (rx.isEmpty()) { QMessageBox::information((QWidget *)parent(), - "Error", "Enter search string"); + "Error", "Enter search QString"); return; } @@ -69,9 +69,9 @@ namespace Isis { // Loop through each image in the filtered list // Loop in reverse order since removal list of elements affects index number for (int i = g_filteredImages.size() - 1; i >= 0; i--) { - string tempFileName = g_serialNumberList->FileName(g_filteredImages[i]); - // this name contains the string, keep it in the filtered list - if (rx.indexIn(QString(tempFileName.c_str())) != -1) { + QString tempFileName = g_serialNumberList->FileName(g_filteredImages[i]); + // this name contains the QString, keep it in the filtered list + if (rx.indexIn(QString(tempFileName)) != -1) { continue; } // if there is no match, remove image from filtered list diff --git a/isis/src/qisis/apps/qnet/QnetFileTool.cpp b/isis/src/qisis/apps/qnet/QnetFileTool.cpp index b13ba31e38..9f4c500e19 100644 --- a/isis/src/qisis/apps/qnet/QnetFileTool.cpp +++ b/isis/src/qisis/apps/qnet/QnetFileTool.cpp @@ -136,7 +136,7 @@ namespace Isis { return; // Find directory and save for use in file dialog for net file - FileName file(list.toStdString()); + FileName file(list); QString dir = file.path(); QApplication::setOverrideCursor(Qt::WaitCursor); @@ -146,7 +146,7 @@ namespace Isis { delete g_serialNumberList; g_serialNumberList = NULL; } - g_serialNumberList = new SerialNumberList(list.toStdString()); + g_serialNumberList = new SerialNumberList(list); if (g_controlNetwork != NULL) { delete g_controlNetwork; @@ -155,8 +155,8 @@ namespace Isis { } catch (IException &e) { QString message = "Error processing cube list. \n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::information((QWidget *)parent(), "Error", message); QApplication::restoreOverrideCursor(); return; @@ -186,13 +186,13 @@ namespace Isis { else { try { Progress progress; - g_controlNetwork = new ControlNet(cNetFileName.toStdString(), + g_controlNetwork = new ControlNet(cNetFileName, &progress); } catch (IException &e) { QString message = "Invalid control network. \n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::information((QWidget *)parent(), "Error", message); QApplication::restoreOverrideCursor(); return; @@ -206,8 +206,8 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot initialize images in control network. \n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::information((QWidget *)parent(), "Error", message); QApplication::restoreOverrideCursor(); return; @@ -259,7 +259,7 @@ namespace Isis { * */ void QnetFileTool::save() { - g_controlNetwork->Write(p_cnetFileName.toStdString()); + g_controlNetwork->Write(p_cnetFileName); p_saveNet = false; } @@ -284,12 +284,12 @@ namespace Isis { ".", filter); if (!fn.isEmpty()) { try { - g_controlNetwork->Write(fn.toStdString()); + g_controlNetwork->Write(fn); } catch (IException &e) { QString message = "Error saving control network. \n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::information((QWidget *)parent(), "Error", message); return; } @@ -324,14 +324,14 @@ namespace Isis { */ void QnetFileTool::loadImage(const QString &serialNumber) { - string tempFileName = g_serialNumberList->FileName(serialNumber.toStdString()); - QString filename = tempFileName.c_str(); + QString tempFileName = g_serialNumberList->FileName(serialNumber); + QString filename = tempFileName; QVector< MdiCubeViewport * > * cvpList = g_vpMainWindow->workspace()->cubeViewportList(); bool found = false; for (int i = 0; i < (int)cvpList->size(); i++) { - string sn = SerialNumber::Compose(*((*cvpList)[i]->cube())); - if (sn == serialNumber.toStdString()) { + QString sn = SerialNumber::Compose(*((*cvpList)[i]->cube())); + if (sn == serialNumber) { g_vpMainWindow->workspace()-> setActiveSubWindow((QMdiSubWindow *)(*cvpList)[i]->parentWidget()->parent()); found = true; @@ -355,8 +355,8 @@ namespace Isis { */ void QnetFileTool::loadPointImages(ControlPoint *point) { for (int i = 0; i < point->GetNumMeasures(); i++) { - string cubeSN = (*point)[i]->GetCubeSerialNumber(); - loadImage(cubeSN.c_str()); + QString cubeSN = (*point)[i]->GetCubeSerialNumber(); + loadImage(cubeSN); } } diff --git a/isis/src/qisis/apps/qnet/QnetFileTool.h b/isis/src/qisis/apps/qnet/QnetFileTool.h index 63f7055365..2e13241f07 100644 --- a/isis/src/qisis/apps/qnet/QnetFileTool.h +++ b/isis/src/qisis/apps/qnet/QnetFileTool.h @@ -32,9 +32,6 @@ class QWidget; namespace Isis { class ControlNet; class ControlPoint; -} - -namespace Isis { /** * @brief Qnet File operations diff --git a/isis/src/qisis/apps/qnet/QnetFixedPointDialog.cpp b/isis/src/qisis/apps/qnet/QnetFixedPointDialog.cpp index 0f2df623ef..030f5add64 100644 --- a/isis/src/qisis/apps/qnet/QnetFixedPointDialog.cpp +++ b/isis/src/qisis/apps/qnet/QnetFixedPointDialog.cpp @@ -113,7 +113,7 @@ namespace Isis { // Add all files to list , selecting those in pointFiles which are // those files which contain the point. for (int i=0; iSize(); i++) { - IString label = g_serialNumberList->FileName(i); + QString label = g_serialNumberList->FileName(i); QListWidgetItem *item = new QListWidgetItem(label); // if this entry of the SerialNumberList is also in the pointFiles then diff --git a/isis/src/qisis/apps/qnet/QnetFixedPointDialog.h b/isis/src/qisis/apps/qnet/QnetFixedPointDialog.h index 40002600ae..86f9532965 100644 --- a/isis/src/qisis/apps/qnet/QnetFixedPointDialog.h +++ b/isis/src/qisis/apps/qnet/QnetFixedPointDialog.h @@ -11,12 +11,10 @@ class QPushButton; class QString; class QStringList; + namespace Isis { class ControlPoint; -} - -namespace Isis { /** * @author ????-??-?? Unknown * @internal diff --git a/isis/src/qisis/apps/qnet/QnetNavTool.cpp b/isis/src/qisis/apps/qnet/QnetNavTool.cpp index 551929fe9b..795c6c73c0 100644 --- a/isis/src/qisis/apps/qnet/QnetNavTool.cpp +++ b/isis/src/qisis/apps/qnet/QnetNavTool.cpp @@ -216,7 +216,7 @@ namespace Isis { gridLayout->addLayout(layout, 3, 0, 1, 2); p_navDialog->setLayout(gridLayout); - QSettings settings(FileName("$HOME/.Isis/qnet/NavTool.config").expanded().c_str(), + QSettings settings(FileName("$HOME/.Isis/qnet/NavTool.config").expanded(), QSettings::NativeFormat); p_navDialog->resize(settings.value("size").toSize()); @@ -235,7 +235,7 @@ namespace Isis { QnetNavTool::~QnetNavTool() { - QSettings settings(FileName("$HOME/.Isis/qnet/NavTool.config").expanded().c_str(), + QSettings settings(FileName("$HOME/.Isis/qnet/NavTool.config").expanded(), QSettings::NativeFormat); settings.setValue("size", p_navDialog->size()); @@ -465,8 +465,8 @@ namespace Isis { this, SLOT(editPoint(QListWidgetItem *))); //p_listBox->setSelectionMode(QAbstractItemView::SingleSelection); for (int i = 0; i < g_controlNetwork->GetNumPoints(); i++) { - string cNetId = (*g_controlNetwork)[i]->GetId(); - QString itemString = cNetId.c_str(); + QString cNetId = (*g_controlNetwork)[i]->GetId(); + QString itemString = cNetId; p_listBox->insertItem(i, itemString); int images = (*g_controlNetwork)[i]->GetNumMeasures(); p_listBox->item(i)->setToolTip(QString::number(images) + " image(s) in point"); @@ -487,8 +487,8 @@ namespace Isis { //p_listBox->setSelectionMode(QAbstractItemView::ExtendedSelection); for (int i = 0; i < g_serialNumberList->Size(); i++) { FileName filename = FileName(g_serialNumberList->FileName(i)); - string tempFileName = filename.name(); - p_listBox->insertItem(i, tempFileName.c_str()); + QString tempFileName = filename.name(); + p_listBox->insertItem(i, tempFileName); } QString msg = "Filter Count: " + QString::number(p_listBox->count()) + " / " + QString::number(g_serialNumberList->Size()); @@ -574,8 +574,8 @@ namespace Isis { // We are dealing with points so output the point numbers if (p_listCombo->currentIndex() == Points) { for (int i = 0; i < g_filteredPoints.size(); i++) { - string cNetId = (*g_controlNetwork)[g_filteredPoints[i]]->GetId(); - QString itemString = cNetId.c_str(); + QString cNetId = (*g_controlNetwork)[g_filteredPoints[i]]->GetId(); + QString itemString = cNetId; p_listBox->insertItem(i, itemString); int images = (*g_controlNetwork)[g_filteredPoints[i]]->GetNumMeasures(); p_listBox->item(i)->setToolTip(QString::number(images) + " image(s) in point"); @@ -588,8 +588,8 @@ namespace Isis { else if (p_listCombo->currentIndex() == Cubes) { for (int i = 0; i < g_filteredImages.size(); i++) { FileName filename = FileName(g_serialNumberList->FileName(g_filteredImages[i])); - string tempFileName = filename.name(); - p_listBox->insertItem(i, tempFileName.c_str()); + QString tempFileName = filename.name(); + p_listBox->insertItem(i, tempFileName); } QString msg = "Filter Count: " + QString::number(p_listBox->count()) + " / " + QString::number(g_serialNumberList->Size()); @@ -644,13 +644,13 @@ namespace Isis { // Tell the filetool to load the given image else if (p_listCombo->currentIndex() == Cubes) { if (g_filteredImages.size() == 0) { - string serialNumberList = (*g_serialNumberList).SerialNumber(index); - QString sn = serialNumberList.c_str(); + QString serialNumberList = (*g_serialNumberList).SerialNumber(index); + QString sn = serialNumberList; emit loadImage(sn); } else { - string serialNumberList = (*g_serialNumberList).SerialNumber(g_filteredImages[index]); - QString sn = serialNumberList.c_str(); + QString serialNumberList = (*g_serialNumberList).SerialNumber(g_filteredImages[index]); + QString sn = serialNumberList; emit loadImage(sn); } } diff --git a/isis/src/qisis/apps/qnet/QnetNewMeasureDialog.cpp b/isis/src/qisis/apps/qnet/QnetNewMeasureDialog.cpp index 3b473555c9..4e8e854a4a 100644 --- a/isis/src/qisis/apps/qnet/QnetNewMeasureDialog.cpp +++ b/isis/src/qisis/apps/qnet/QnetNewMeasureDialog.cpp @@ -70,14 +70,14 @@ namespace Isis { // Add all entries in the SerialNumberList for (int i = 0; i < g_serialNumberList->Size(); i++) { - IString curSerialNum = g_serialNumberList->SerialNumber(i); + QString curSerialNum = g_serialNumberList->SerialNumber(i); // Don't add if already in this point if (point.HasSerialNumber(curSerialNum)) continue; // build new item... - IString label(g_serialNumberList->FileName(i)); + QString label(g_serialNumberList->FileName(i)); QListWidgetItem *item = new QListWidgetItem(label); // if this entry of the SerialNumberList is also in the pointFiles then diff --git a/isis/src/qisis/apps/qnet/QnetNewMeasureDialog.h b/isis/src/qisis/apps/qnet/QnetNewMeasureDialog.h index d5954e2dc4..33aae45281 100644 --- a/isis/src/qisis/apps/qnet/QnetNewMeasureDialog.h +++ b/isis/src/qisis/apps/qnet/QnetNewMeasureDialog.h @@ -9,12 +9,10 @@ class QPushButton; class QString; class QStringList; + namespace Isis { class ControlPoint; -} - -namespace Isis { /** * @author ????-??-?? Unknown * diff --git a/isis/src/qisis/apps/qnet/QnetNewPointDialog.cpp b/isis/src/qisis/apps/qnet/QnetNewPointDialog.cpp index 6bca1fda3e..c0bf4d8506 100644 --- a/isis/src/qisis/apps/qnet/QnetNewPointDialog.cpp +++ b/isis/src/qisis/apps/qnet/QnetNewPointDialog.cpp @@ -95,7 +95,7 @@ namespace Isis { for (int i = 0; i < g_serialNumberList->Size(); i++) { // build new item... - IString label = g_serialNumberList->FileName(i); + QString label = g_serialNumberList->FileName(i); QListWidgetItem *item = new QListWidgetItem(label); // if this entry of the SerialNumberList is also in the pointFiles then diff --git a/isis/src/qisis/apps/qnet/QnetPointCubeNameFilter.cpp b/isis/src/qisis/apps/qnet/QnetPointCubeNameFilter.cpp index 9a7e97c340..c6c6cecfa8 100644 --- a/isis/src/qisis/apps/qnet/QnetPointCubeNameFilter.cpp +++ b/isis/src/qisis/apps/qnet/QnetPointCubeNameFilter.cpp @@ -76,7 +76,7 @@ namespace Isis { for (int i = 0; i < selected.size(); i++) { int index = p_listBox->row(selected[i]); - string selectedCubeSerNum = (*g_serialNumberList).SerialNumber(index); + QString selectedCubeSerNum = (*g_serialNumberList).SerialNumber(index); // Loop through each value of the filtered points list // checking the types of each control measure for each @@ -121,8 +121,8 @@ namespace Isis { for (int i = 0; i < g_serialNumberList->Size(); i++) { FileName filename = FileName(g_serialNumberList->FileName(i)); - string tempFileName = filename.name(); - p_listBox->insertItem(i, tempFileName.c_str()); + QString tempFileName = filename.name(); + p_listBox->insertItem(i, tempFileName); } } } diff --git a/isis/src/qisis/apps/qnet/QnetPointIdFilter.cpp b/isis/src/qisis/apps/qnet/QnetPointIdFilter.cpp index 20df5e95e1..b6d3b5a0b0 100644 --- a/isis/src/qisis/apps/qnet/QnetPointIdFilter.cpp +++ b/isis/src/qisis/apps/qnet/QnetPointIdFilter.cpp @@ -72,8 +72,8 @@ namespace Isis { // Loop in reverse order since removal list of elements affects index number for (int i = g_filteredPoints.size() - 1; i >= 0; i--) { - string cNetId = (*g_controlNetwork)[g_filteredPoints[i]]->GetId(); - if (rx.indexIn(QString(cNetId.c_str())) != -1) { + QString cNetId = (*g_controlNetwork)[g_filteredPoints[i]]->GetId(); + if (rx.indexIn(QString(cNetId)) != -1) { continue; } else diff --git a/isis/src/qisis/apps/qnet/QnetSetAprioriDialog.cpp b/isis/src/qisis/apps/qnet/QnetSetAprioriDialog.cpp index bf7385dcec..161712f26c 100644 --- a/isis/src/qisis/apps/qnet/QnetSetAprioriDialog.cpp +++ b/isis/src/qisis/apps/qnet/QnetSetAprioriDialog.cpp @@ -247,7 +247,7 @@ void QnetSetAprioriDialog::setApriori() { } catch (IException &e) { QString message = "Error setting sigmas. \n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical((QWidget *)parent(),"Error",message); QApplication::restoreOverrideCursor(); // Sigmas failed, but surface pt coordinate was set diff --git a/isis/src/qisis/apps/qnet/QnetTool.cpp b/isis/src/qisis/apps/qnet/QnetTool.cpp index 9895661012..720c1bb830 100644 --- a/isis/src/qisis/apps/qnet/QnetTool.cpp +++ b/isis/src/qisis/apps/qnet/QnetTool.cpp @@ -203,7 +203,7 @@ namespace Isis { // addMeasureLayout->addStretch(); p_templateFileNameLabel = new QLabel("Template File: " + - QString::fromStdString(p_pointEditor->templateFileName())); + (p_pointEditor->templateFileName())); p_templateFileNameLabel->setToolTip("Sub-pixel registration template File."); // QString patternMatchDoc = // FileName("$ISISROOT/doc/documents/PatternMatch/PatternMatch.html").fileName(); @@ -863,8 +863,8 @@ namespace Isis { if (response == QMessageBox::Yes) { // Update measure file combo boxes: old reference normal font, // new reference bold font - IString file = g_serialNumberList->FileName(p_leftMeasure->GetCubeSerialNumber()); - QString fname = FileName(file).name().c_str(); + QString file = g_serialNumberList->FileName(p_leftMeasure->GetCubeSerialNumber()); + QString fname = FileName(file).name(); int iref = p_leftCombo->findText(fname); // Save normal font from new reference measure @@ -874,7 +874,7 @@ namespace Isis { p_rightCombo->setItemData(iref,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole); file = g_serialNumberList->FileName(refMeasure->GetCubeSerialNumber()); - fname = FileName(file).name().c_str(); + fname = FileName(file).name(); iref = p_leftCombo->findText(fname); p_leftCombo->setItemData(iref,font,Qt::FontRole); iref = p_rightCombo->findText(fname); @@ -1039,7 +1039,7 @@ namespace Isis { message += "Latitude = " + QString::number(lat); message += " Longitude = " + QString::number(lon); message += " Radius = " + QString::number(radius) + "\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(p_qnetTool,"Error",message); } p_editPoint->SetAprioriSurfacePointSource(p_groundSurfacePointSource); @@ -1344,7 +1344,7 @@ namespace Isis { return; } emit qnetToolSave(); - //g_controlNetwork->Write(p_cnetFileName.toStdString()); + //g_controlNetwork->Write(p_cnetFileName); } @@ -1445,8 +1445,8 @@ namespace Isis { MdiCubeViewport *cvp = cubeViewport(); if (cvp == NULL) return; - IString file = cvp->cube()->getFileName(); - IString sn = g_serialNumberList->SerialNumber(file); + QString file = cvp->cube()->getFileName(); + QString sn = g_serialNumberList->SerialNumber(file); double samp,line; cvp->viewportToCube(p.x(),p.y(),samp,line); @@ -1469,7 +1469,7 @@ namespace Isis { } // Find closest control point in network - IString sn = g_serialNumberList->SerialNumber(file); + QString sn = g_serialNumberList->SerialNumber(file); ControlPoint *point = g_controlNetwork->FindClosest(sn, samp, line); modifyPoint(point); @@ -1494,7 +1494,7 @@ namespace Isis { deletePoint(point); } else if (s == Qt::RightButton) { - p_leftFile = file.c_str(); + p_leftFile = file; UniversalGroundMap *gmap = cvp->universalGroundMap(); if (!gmap->SetImage(samp,line)) { QString message = "Invalid latitude or longitude at this point. "; @@ -1576,7 +1576,7 @@ namespace Isis { double line = cam->Line(); if (samp >= 1 && samp <= cam->Samples() && line >= 1 && line <= cam->Lines()) { - pointFiles<FileName(i).c_str(); + pointFiles<FileName(i); } } } @@ -1586,14 +1586,14 @@ namespace Isis { if (newPointDialog->exec()) { ControlPoint *newPoint = - new ControlPoint(newPointDialog->ptIdValue->text().toStdString()); + new ControlPoint(newPointDialog->ptIdValue->text()); // If this ControlPointId already exists, message box pops up and user is // asked to enter a new value. if (g_controlNetwork->ContainsPoint(newPoint->GetId())) { - IString message = "A ControlPoint with Point Id = [" + newPoint->GetId(); + QString message = "A ControlPoint with Point Id = [" + newPoint->GetId(); message += "] already exists. Re-enter Point Id for this ControlPoint."; - QMessageBox::warning(p_qnetTool, "New Point Id", message.c_str()); + QMessageBox::warning(p_qnetTool, "New Point Id", message); pointFiles.clear(); delete newPoint; newPoint = NULL; @@ -1601,7 +1601,7 @@ namespace Isis { return; } - newPoint->SetId(newPointDialog->ptIdValue->text().toStdString()); + newPoint->SetId(newPointDialog->ptIdValue->text()); newPoint->SetChooserName(Application::UserName()); for (int i=0; ifileList->count(); i++) { @@ -1610,11 +1610,11 @@ namespace Isis { // Create measure for any file selected ControlMeasure *m = new ControlMeasure; // Find serial number for this file - IString sn = - g_serialNumberList->SerialNumber(item->text().toStdString()); + QString sn = + g_serialNumberList->SerialNumber(item->text()); m->SetCubeSerialNumber(sn); int camIndex = - g_serialNumberList->FileNameIndex(item->text().toStdString()); + g_serialNumberList->FileNameIndex(item->text()); cam = g_controlNetwork->Camera(camIndex); cam->SetUniversalGround(lat,lon); m->SetCoordinate(cam->Sample(),cam->Line()); @@ -1644,7 +1644,7 @@ namespace Isis { p_qnetTool->setShown(true); p_qnetTool->raise(); - loadTemplateFile(QString::fromStdString( + loadTemplateFile(( p_pointEditor->templateFileName())); @@ -1691,7 +1691,7 @@ namespace Isis { double line = cam->Line(); if (samp >= 1 && samp <= cam->Samples() && line >= 1 && line <= cam->Lines()) { - pointFiles<FileName(i).c_str(); + pointFiles<FileName(i); } } } @@ -1706,7 +1706,7 @@ namespace Isis { fixedPointDialog->SetFiles(pointFiles); if (fixedPointDialog->exec()) { ControlPoint *fixedPoint = - new ControlPoint(fixedPointDialog->ptIdValue->text().toStdString()); + new ControlPoint(fixedPointDialog->ptIdValue->text()); if (fixedPointDialog->fixed->isChecked()) { fixedPoint->SetType(ControlPoint::Fixed); @@ -1718,9 +1718,9 @@ namespace Isis { // If this ControlPointId already exists, message box pops up and user is // asked to enter a new value. if (g_controlNetwork->ContainsPoint(fixedPoint->GetId())) { - string message = "A ControlPoint with Point Id = [" + fixedPoint->GetId(); + QString message = "A ControlPoint with Point Id = [" + fixedPoint->GetId(); message += "] already exists. Re-enter Point Id for this ControlPoint."; - QMessageBox::warning(p_qnetTool, "New Point Id", message.c_str()); + QMessageBox::warning(p_qnetTool, "New Point Id", message); pointFiles.clear(); delete fixedPoint; fixedPoint = NULL; @@ -1736,14 +1736,14 @@ namespace Isis { // Create measure for any file selected ControlMeasure *m = new ControlMeasure; // Find serial number for this file - string sn = - g_serialNumberList->SerialNumber(item->text().toStdString()); + QString sn = + g_serialNumberList->SerialNumber(item->text()); // If ground, do not add measure, it will be added in loadPoint if (sn == p_groundSN) continue; m->SetCubeSerialNumber(sn); int camIndex = - g_serialNumberList->FileNameIndex(item->text().toStdString()); + g_serialNumberList->FileNameIndex(item->text()); cam = g_controlNetwork->Camera(camIndex); cam->SetUniversalGround(lat,lon); m->SetCoordinate(cam->Sample(),cam->Line()); @@ -1863,13 +1863,13 @@ namespace Isis { emit editPointChanged(p_editPoint->GetId()); QnetDeletePointDialog *deletePointDialog = new QnetDeletePointDialog; - IString CPId = p_editPoint->GetId(); - deletePointDialog->pointIdValue->setText(CPId.c_str()); + QString CPId = p_editPoint->GetId(); + deletePointDialog->pointIdValue->setText(CPId); // Need all files for this point for (int i=0; iGetNumMeasures(); i++) { ControlMeasure &m = *(*p_editPoint)[i]; - IString file = g_serialNumberList->FileName(m.GetCubeSerialNumber()); - deletePointDialog->fileList->addItem(file.c_str()); + QString file = g_serialNumberList->FileName(m.GetCubeSerialNumber()); + deletePointDialog->fileList->addItem(file); } if (deletePointDialog->exec()) { @@ -1939,7 +1939,7 @@ namespace Isis { p_qnetTool->setShown(true); p_qnetTool->raise(); - loadTemplateFile(QString::fromStdString( + loadTemplateFile(( p_pointEditor->templateFileName())); } @@ -2002,7 +2002,7 @@ namespace Isis { loadPoint(); p_qnetTool->setShown(true); p_qnetTool->raise(); - loadTemplateFile(QString::fromStdString( + loadTemplateFile(( p_pointEditor->templateFileName())); // emit signal so the nav tool can update edit point @@ -2034,7 +2034,7 @@ namespace Isis { void QnetTool::loadPoint () { // Write pointId - IString CPId = p_editPoint->GetId(); + QString CPId = p_editPoint->GetId(); QString ptId("Point ID: "); ptId += (QString) CPId; p_ptIdValue->setText(ptId); @@ -2118,9 +2118,9 @@ namespace Isis { // Need all files for this point for (int i=0; iGetNumMeasures(); i++) { ControlMeasure &m = *(*p_editPoint)[i]; - IString file = g_serialNumberList->FileName(m.GetCubeSerialNumber()); + QString file = g_serialNumberList->FileName(m.GetCubeSerialNumber()); p_pointFiles<addItem(tempFileName); p_rightCombo->addItem(tempFileName); if (p_editPoint->IsReferenceExplicit() && @@ -2225,7 +2225,7 @@ namespace Isis { int column = 0; ControlMeasure &m = *(*p_editPoint)[row]; - QString file = QString::fromStdString( + QString file = ( g_serialNumberList->FileName(m.GetCubeSerialNumber())); QTableWidgetItem *tableItem = new QTableWidgetItem(QString(file)); p_measureTable->setItem(row,column++,tableItem); @@ -2337,7 +2337,7 @@ namespace Isis { tableItem = new QTableWidgetItem("False"); p_measureTable->setItem(row,column++,tableItem); - tableItem = new QTableWidgetItem(QString::fromStdString( + tableItem = new QTableWidgetItem(( ControlMeasure::MeasureTypeToString(m.GetType()))); p_measureTable->setItem(row,column,tableItem); @@ -2529,9 +2529,9 @@ namespace Isis { * reference, lock the measure. */ void QnetTool::selectLeftMeasure(int index) { - IString file = p_pointFiles[index]; + QString file = p_pointFiles[index]; - IString serial = g_serialNumberList->SerialNumber(file); + QString serial = g_serialNumberList->SerialNumber(file); // Make sure to clear out leftMeasure before making a copy of the selected // measure. @@ -2567,9 +2567,9 @@ namespace Isis { */ void QnetTool::selectRightMeasure(int index) { - IString file = p_pointFiles[index]; + QString file = p_pointFiles[index]; - IString serial = g_serialNumberList->SerialNumber(file); + QString serial = g_serialNumberList->SerialNumber(file); // Make sure to clear out rightMeasure before making a copy of the selected // measure. @@ -2812,7 +2812,7 @@ namespace Isis { double line = cam->Line(); if (samp >= 1 && samp <= cam->Samples() && line >= 1 && line <= cam->Lines()) { - pointFiles<FileName(i).c_str(); + pointFiles<FileName(i); } } } @@ -2826,10 +2826,10 @@ namespace Isis { // Create measure for any file selected ControlMeasure *m = new ControlMeasure; // Find serial number for this file - IString sn = g_serialNumberList->SerialNumber((IString) item->text()); + QString sn = g_serialNumberList->SerialNumber((QString) item->text()); m->SetCubeSerialNumber(sn); int camIndex = - g_serialNumberList->FileNameIndex(item->text().toStdString()); + g_serialNumberList->FileNameIndex(item->text()); cam = g_controlNetwork->Camera(camIndex); cam->SetUniversalGround(lat,lon); m->SetCoordinate(cam->Sample(),cam->Line()); @@ -2843,7 +2843,7 @@ namespace Isis { p_qnetTool->setShown(true); p_qnetTool->raise(); - loadTemplateFile(QString::fromStdString( + loadTemplateFile(( p_pointEditor->templateFileName())); @@ -2945,14 +2945,14 @@ namespace Isis { // Don't show the measurments on cubes not in the serial number list // TODO: Should we show them anyway // TODO: Should we add the SN to the viewPort - string serialNumber = SerialNumber::Compose(*vp->cube(), true); + QString serialNumber = SerialNumber::Compose(*vp->cube(), true); if (serialNumber == p_groundSN) { drawGroundMeasures(vp, painter); return; } if (!g_controlNetwork->GetCubeSerials().contains( - QString::fromStdString(serialNumber))) return; + (serialNumber))) return; if (!g_serialNumberList->HasSerialNumber(serialNumber)) return; QList measures = g_controlNetwork->GetMeasuresInCube(serialNumber); @@ -3117,7 +3117,7 @@ namespace Isis { */ void QnetTool::loadTemplateFile(QString fn) { - QFile file(QString::fromStdString(FileName((IString) fn).expanded())); + QFile file((FileName((QString) fn).expanded())); if (!file.open(QIODevice::ReadOnly)) { QString msg = "Failed to open template file \"" + fn + "\""; QMessageBox::warning(p_qnetTool, "IO Error", msg); @@ -3150,7 +3150,7 @@ namespace Isis { if (!p_templateModified) return; - QString filename = QString::fromStdString( + QString filename = ( p_pointEditor->templateFileName()); writeTemplateFile(filename); @@ -3182,7 +3182,7 @@ namespace Isis { // catch errors in Pvl format when populating pvl object stringstream ss; - ss << contents.toStdString(); + ss << contents; try { Pvl pvl; ss >> pvl; @@ -3193,8 +3193,8 @@ namespace Isis { return; } - QString expandedFileName(QString::fromStdString( - FileName((IString) fn).expanded())); + QString expandedFileName(( + FileName((QString) fn).expanded())); QFile file(expandedFileName); @@ -3239,12 +3239,12 @@ namespace Isis { // to view and/or edit the template PvlEditDialog registrationDialog(templatePvl); registrationDialog.setWindowTitle("View or Edit Template File: " - + QString::fromStdString(templatePvl.FileName())); + + (templatePvl.FileName())); registrationDialog.resize(550,360); registrationDialog.exec(); } catch (IException &e) { - QString message = e.toString().c_str(); + QString message = e.toString(); QMessageBox::information(p_qnetTool, "Error", message); } } @@ -3426,16 +3426,16 @@ namespace Isis { if (ground.isEmpty()) return; // First off, find serial number of new ground, it is needed for a couple of error checks. - IString newGroundSN = SerialNumber::Compose(ground.toStdString(), true); + QString newGroundSN = SerialNumber::Compose(ground, true); // If new ground same file as old ground file simply set as active window. - if (p_groundOpen && p_groundFile == FileName(ground).name().ToQt()) { + if (p_groundOpen && p_groundFile == FileName(ground).name()) { // See if ground source is already opened in a cubeviewport. If so, simply // activate the viewport and return. MdiCubeViewport *vp; for (int i=0; i<(int)cubeViewportList()->size(); i++) { vp = (*(cubeViewportList()))[i]; - if (vp->cube()->getFileName() == ground.toStdString()) { + if (vp->cube()->getFileName() == ground) { g_vpMainWindow->workspace()->setActiveSubWindow( (QMdiSubWindow *)vp->parentWidget()->parent()); return; @@ -3477,10 +3477,10 @@ namespace Isis { // loaded) p_groundCube = new Cube(); try { - p_groundCube->open(ground.toStdString()); + p_groundCube->open(ground); p_groundGmap = new UniversalGroundMap(*p_groundCube); - p_groundFile = FileName(p_groundCube->getFileName()).name().c_str(); - g_serialNumberList->Add(ground.toStdString(), true); + p_groundFile = FileName(p_groundCube->getFileName()).name(); + g_serialNumberList->Add(ground, true); } catch (IException &e) { QApplication::restoreOverrideCursor(); @@ -3525,8 +3525,8 @@ namespace Isis { // TODO p_groundRadiusSource = ControlPoint::RadiusSource::Basemap; p_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid; PvlGroup mapping = p_groundCube->getGroup("Mapping"); - p_demFile = QString::fromStdString(mapping ["EquatorialRadius"]) - + ", " + QString::fromStdString(mapping ["PolarRadius"]); + p_demFile = (mapping ["EquatorialRadius"][0]) + + ", " + (mapping ["PolarRadius"][0]); // p_radiusSourceFile = ""; } @@ -3538,7 +3538,7 @@ namespace Isis { if (!p_demOpen) { // If level 1, determine the shape model PvlGroup kernels = p_groundCube->getGroup("Kernels"); - QString shapeFile = QString::fromStdString(kernels ["ShapeModel"]); + QString shapeFile = (kernels ["ShapeModel"]); if (shapeFile.contains("dem")) { p_groundRadiusSource = ControlPoint::RadiusSource::DEM; p_radiusSourceFile = shapeFile; @@ -3549,7 +3549,7 @@ namespace Isis { p_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid; p_demFile = "Ellipsoid"; // Find pck file from Kernels group - p_radiusSourceFile = (string) kernels["TargetAttitudeShape"]; + p_radiusSourceFile = (QString) kernels["TargetAttitudeShape"]; } } } @@ -3629,8 +3629,8 @@ namespace Isis { p_demCube = new Cube(); try { - p_demCube->open(demFile.toStdString()); - p_demFile = FileName(p_demCube->getFileName()).name().c_str(); + p_demCube->open(demFile); + p_demFile = FileName(p_demCube->getFileName()).name(); } catch (IException &e) { QString message = e.toString(); QMessageBox::critical(p_qnetTool, "Error", message); @@ -3781,7 +3781,7 @@ namespace Isis { * * @author 2011-07-06 Tracie Sucharski */ - bool QnetTool::IsMeasureLocked (IString serialNumber) { + bool QnetTool::IsMeasureLocked (QString serialNumber) { if (p_editPoint == NULL) return false; @@ -3806,7 +3806,7 @@ namespace Isis { */ void QnetTool::readSettings() { FileName config("$HOME/.Isis/qnet/QnetTool.config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings((config.expanded()), QSettings::NativeFormat); QPoint pos = settings.value("pos", QPoint(300, 100)).toPoint(); QSize size = settings.value("size", QSize(900, 500)).toSize(); @@ -3826,7 +3826,7 @@ namespace Isis { visible at the time of closing the application*/ if(!p_qnetTool->isVisible()) return; FileName config("$HOME/.Isis/qnet/QnetTool.config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings((config.expanded()), QSettings::NativeFormat); settings.setValue("pos", p_qnetTool->pos()); settings.setValue("size", p_qnetTool->size()); diff --git a/isis/src/qisis/apps/qnet/QnetTool.h b/isis/src/qisis/apps/qnet/QnetTool.h index 5da922bbaf..8c5c995a1a 100644 --- a/isis/src/qisis/apps/qnet/QnetTool.h +++ b/isis/src/qisis/apps/qnet/QnetTool.h @@ -30,19 +30,16 @@ class QWidget; namespace Isis { class ControlMeasure; class ControlNet; - class Cube; - class IString; - class Stretch; - class UniversalGroundMap; -} - -namespace Isis { class ControlPointEdit; + class Cube; class CubeViewport; class MainWindow; class MdiCubeViewport; class QnetHoldPointDialog; + class Stretch; class ToolPad; + class UniversalGroundMap; + /** * @brief Qnet tool operations * @@ -321,7 +318,7 @@ namespace Isis { void initDem(QString demFile); double demRadius(double latitude, double longitude); void clearGroundSource(); - bool IsMeasureLocked(IString serialNumber); + bool IsMeasureLocked(QString serialNumber); void readSettings(); void writeSettings() const; @@ -415,7 +412,7 @@ namespace Isis { QString p_groundFile; Cube *p_groundCube; - IString p_groundSN; + QString p_groundSN; UniversalGroundMap *p_groundGmap; bool p_groundOpen; ControlPoint::SurfacePointSource::Source p_groundSurfacePointSource; @@ -423,8 +420,8 @@ namespace Isis { // TODO: Combine the following p_groundSourceFile, p_radiusSourceFile // with p_groundFile and p_demFile. Is it just a matter of // full path vs filename only? - IString p_groundSourceFile; - IString p_radiusSourceFile; + QString p_groundSourceFile; + QString p_radiusSourceFile; QString p_demFile; bool p_demOpen; Cube *p_demCube; diff --git a/isis/src/qisis/apps/qnet/qnet.cpp b/isis/src/qisis/apps/qnet/qnet.cpp index c89b4972fa..130312893b 100644 --- a/isis/src/qisis/apps/qnet/qnet.cpp +++ b/isis/src/qisis/apps/qnet/qnet.cpp @@ -58,13 +58,13 @@ int main(int argc, char *argv[]) { PvlGroup &uiPref = Preference::Preferences().FindGroup( "UserInterface"); if (uiPref.HasKeyword("GuiStyle")) { - string style = uiPref["GuiStyle"]; - QApplication::setStyle((IString) style); + QString style = uiPref["GuiStyle"]; + QApplication::setStyle((QString) style); } // Add the Qt plugin directory to the library path FileName qtpluginpath("$ISISROOT/3rdParty/plugins"); - QCoreApplication::addLibraryPath(qtpluginpath.expanded().c_str()); + QCoreApplication::addLibraryPath(qtpluginpath.expanded()); Qnet::g_vpMainWindow = new ViewportMainWindow("qnet"); diff --git a/isis/src/qisis/apps/qtie/QtieFileTool.cpp b/isis/src/qisis/apps/qtie/QtieFileTool.cpp index f82061cb59..9c5175b586 100644 --- a/isis/src/qisis/apps/qtie/QtieFileTool.cpp +++ b/isis/src/qisis/apps/qtie/QtieFileTool.cpp @@ -98,12 +98,12 @@ namespace Isis { } // Find directory and save for use in file dialog for match cube - FileName fname(baseFile.toStdString()); - dir = fname.path().ToQt(); + FileName fname(baseFile); + dir = fname.path(); // Make sure base is projected try { - baseCube->open(baseFile.toStdString()); + baseCube->open(baseFile); try { baseCube->getProjection(); } @@ -120,8 +120,8 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot initialize universal ground map for basemap.\n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::critical((QWidget *)parent(), "Error", message); baseCube->close(); continue; @@ -154,7 +154,7 @@ namespace Isis { //Make sure match is not projected try { - matchCube->open(matchFile.toStdString()); + matchCube->open(matchFile); try { if (matchCube->hasGroup("Mapping")) { @@ -176,8 +176,8 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot initialize universal ground map for match cube.\n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::critical((QWidget *)parent(), "Error", message); matchCube->close(); continue; @@ -190,11 +190,11 @@ namespace Isis { } // Find target - IString target = matchCube->getCamera()->target()->name(); + QString target = matchCube->getCamera()->target()->name(); // Find directory and save for use in file dialog for control net - FileName fname(matchFile.toStdString()); - dir = fname.path().ToQt(); + FileName fname(matchFile); + dir = fname.path(); bool netOk = false; @@ -218,7 +218,7 @@ namespace Isis { else { try { QApplication::setOverrideCursor(Qt::WaitCursor); - cnet = new ControlNet(cnetFile.toStdString()); + cnet = new ControlNet(cnetFile); QApplication::restoreOverrideCursor(); netOk = checkNet(baseCube, baseGM, matchCube, matchGM, cnet); @@ -229,8 +229,8 @@ namespace Isis { } catch (IException &e) { QString message = "Invalid control network. \n"; - std::string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::information((QWidget *)parent(), "Error", message); } } @@ -306,7 +306,7 @@ namespace Isis { baseLine < 1 || baseLine > baseCube->getLineCount()) { // throw error? point not on base QString message = "Error parsing input control net. Lat/Lon for Point Id: " + - QString::fromStdString(p.GetId()) + " computes to a sample/line off " + + (p.GetId()) + " computes to a sample/line off " + "the edge of the basemap cube. This point will be skipped."; QMessageBox::critical((QWidget *)parent(), "Invalid Control Net", message); return false; @@ -316,7 +316,7 @@ namespace Isis { // throw error? point not on base cube qDebug()<<"SetGround else"; QString message = "Error parsing input control net. Point Id: " + - QString::fromStdString(p.GetId()) + " does not exist on basemap. " + (p.GetId()) + " does not exist on basemap. " "This point will be skipped."; QMessageBox::critical((QWidget *)parent(), "Invalid Control Network", message); return false; @@ -325,7 +325,7 @@ namespace Isis { catch (IException &e) { qDebug()<<"catch"; QString message = "Error in SetGround. Error parsing input control net. Point Id: " + - QString::fromStdString(p.GetId()) + " does not exist on basemap. " + (p.GetId()) + " does not exist on basemap. " "This point will be skipped."; QMessageBox::critical((QWidget *)parent(), "Invalid Control Network", message); return false; diff --git a/isis/src/qisis/apps/qtie/QtieTool.cpp b/isis/src/qisis/apps/qtie/QtieTool.cpp index 6c8ad3d5a7..d490ace012 100644 --- a/isis/src/qisis/apps/qtie/QtieTool.cpp +++ b/isis/src/qisis/apps/qtie/QtieTool.cpp @@ -316,8 +316,8 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot initialize universal ground map for basemap.\n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::critical((QWidget *)parent(), "Error", message); return; } @@ -326,8 +326,8 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot initialize universal ground map for match cube.\n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::critical((QWidget *)parent(), "Error", message); return; } @@ -405,7 +405,7 @@ namespace Isis { message += "Latitude = " + QString::number(lat); message += " Longitude = " + QString::number(lon); message += " Radius = " + QString::number(radius.meters()) + "\n"; - message += e.toString().ToQt(); + message += e.toString(); QMessageBox::critical((QWidget *)parent(),"Error",message); } @@ -444,8 +444,8 @@ namespace Isis { // ??? do we only allow mouse clicks on level1??? // If we allow on both, need to find samp,line on level1 if // they clicked on basemap. - std::string file = cvp->cube()->getFileName(); - std::string sn = p_serialNumberList->SerialNumber(file); + QString file = cvp->cube()->getFileName(); + QString sn = p_serialNumberList->SerialNumber(file); double samp, line; cvp->viewportToCube(p.x(), p.y(), samp, line); @@ -465,7 +465,7 @@ namespace Isis { catch (IException &e) { QString message = "No points found for editing. Create points "; message += "using the right mouse button."; - message += e.toString().ToQt(); + message += e.toString(); QMessageBox::critical((QWidget *)parent(), "Error", message); return; } @@ -566,9 +566,9 @@ namespace Isis { } else { // Make sure Id doesn't already exist - newPoint = new ControlPoint(id.toStdString()); + newPoint = new ControlPoint(id); if (p_controlNet->ContainsPoint(newPoint->GetId())) { - IString message = "A ControlPoint with Point Id = [" + + QString message = "A ControlPoint with Point Id = [" + newPoint->GetId() + "] already exists. Re-enter unique Point Id."; QMessageBox::warning((QWidget *)parent(), "Unique Point Id", message); @@ -675,7 +675,7 @@ namespace Isis { p_matchCube, p_controlPoint->GetId()); // Write pointId - IString ptId = "Point ID: " + p_controlPoint->GetId(); + QString ptId = "Point ID: " + p_controlPoint->GetId(); p_ptIdValue->setText(ptId); } @@ -708,7 +708,7 @@ namespace Isis { return; // Draw all measures - std::string serialNumber = SerialNumber::Compose(*vp->cube(), true); + QString serialNumber = SerialNumber::Compose(*vp->cube(), true); for (int i = 0; i < p_controlNet->GetNumPoints(); i++) { ControlPoint &p = *p_controlNet->GetPoint(i); if (p_controlPoint != NULL && p.GetId() == p_controlPoint->GetId()) { @@ -829,8 +829,8 @@ namespace Isis { } catch (IException &e) { QString message = "Bundle Solution failed.\n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; // message += "\n\nMaximum Error = " + QString::number(net.MaximumResiudal()); // message += "\nAverage Error = " + QString::number(net.AverageResidual()); message += "\n\nMaximum Error = " + QString::number(net.GetMaximumResidual()); @@ -863,8 +863,8 @@ namespace Isis { catch (IException &e) { QString message = "Could not read cube history, " "will not update history.\n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::warning((QWidget *)parent(), "Warning", message); return; } @@ -927,7 +927,7 @@ namespace Isis { // to view and/or edit the template PvlEditDialog registrationDialog(templatePvl); registrationDialog.setWindowTitle("View or Edit Template File: " - + QString::fromStdString(templatePvl.FileName())); + + (templatePvl.FileName())); registrationDialog.resize(550, 360); registrationDialog.exec(); } @@ -971,12 +971,12 @@ namespace Isis { net.AddPoint(pt); } - net.Write(fn.toStdString()); + net.Write(fn); } catch (IException &e) { QString message = "Error saving control network. \n"; - string errors = e.toString(); - message += errors.c_str(); + QString errors = e.toString(); + message += errors; QMessageBox::information((QWidget *)parent(), "Error", message); return; } diff --git a/isis/src/qisis/apps/qtie/QtieTool.h b/isis/src/qisis/apps/qtie/QtieTool.h index c2223f869a..84978d1295 100644 --- a/isis/src/qisis/apps/qtie/QtieTool.h +++ b/isis/src/qisis/apps/qtie/QtieTool.h @@ -138,8 +138,8 @@ namespace Isis { Cube *p_baseCube; Cube *p_matchCube; - std::string p_baseSN; - std::string p_matchSN; + QString p_baseSN; + QString p_matchSN; UniversalGroundMap *p_baseGM; UniversalGroundMap *p_matchGM; diff --git a/isis/src/qisis/apps/qview/qview.cpp b/isis/src/qisis/apps/qview/qview.cpp index e6912ffe6b..6dcd30abd9 100644 --- a/isis/src/qisis/apps/qview/qview.cpp +++ b/isis/src/qisis/apps/qview/qview.cpp @@ -61,11 +61,11 @@ int main(int argc, char *argv[]) { } } - std::string p_socketFile = "/tmp/isis_qview_" + Application::UserName(); + QString p_socketFile = "/tmp/isis_qview_" + Application::UserName(); if(newWindow < 0) { struct sockaddr_un p_socketName; p_socketName.sun_family = AF_UNIX; - strcpy(p_socketName.sun_path, p_socketFile.c_str()); + strcpy(p_socketName.sun_path, p_socketFile.toAscii().data()); int p_socket; if(((FileName)p_socketFile).fileExists()) { @@ -74,22 +74,22 @@ int main(int argc, char *argv[]) { // Try to connect to the socket if((connect(p_socket, (struct sockaddr *)&p_socketName, sizeof(p_socketName))) >= 0) { - std::string temp; + QString temp; for(int i = 1; i < argc; i++) { temp += QFileInfo( - FileName(argv[i]).expanded()).absoluteFilePath().toStdString() + FileName(argv[i]).expanded()).absoluteFilePath() + " "; } temp += "raise "; // Try to send data to the socket - if(send(p_socket, temp.c_str(), temp.size(), 0) >= 0) { + if(send(p_socket, temp.toAscii().data(), temp.size(), 0) >= 0) { // Success, the other qview will open this file. exit(0); } else { - std::string msg = "Unable to write to socket"; + QString msg = "Unable to write to socket"; std::cout << msg << std::endl; - remove(p_socketFile.c_str()); + remove(p_socketFile.toAscii().data()); } } @@ -97,13 +97,13 @@ int main(int argc, char *argv[]) { // socket is no longer running & remove the tmp file...it falls out & // create a new one. This happens if qview is not already running. else { - remove(p_socketFile.c_str()); + remove(p_socketFile.toAscii().data()); } } else { - std::string msg = "Unable to create socket"; + QString msg = "Unable to create socket"; std::cout << msg << std::endl; - remove(p_socketFile.c_str()); + remove(p_socketFile.toAscii().data()); } } } @@ -116,13 +116,13 @@ int main(int argc, char *argv[]) { PvlGroup &uiPref = Preference::Preferences().FindGroup( "UserInterface"); if(uiPref.HasKeyword("GuiStyle")) { - std::string style = uiPref["GuiStyle"]; - QApplication::setStyle((IString) style); + QString style = uiPref["GuiStyle"]; + QApplication::setStyle((QString) style); } // Add the Qt plugin directory to the library path FileName qtpluginpath("$ISISROOT/3rdParty/plugins"); - QCoreApplication::addLibraryPath(qtpluginpath.expanded().c_str()); + QCoreApplication::addLibraryPath(qtpluginpath.expanded().toAscii().data()); ViewportMainWindow *vw = new ViewportMainWindow("qview"); @@ -256,7 +256,7 @@ int main(int argc, char *argv[]) { temp->wait(); // wait for the stop to finish delete temp; - remove(p_socketFile.c_str()); + remove(p_socketFile.toAscii().data()); } delete helpTool; diff --git a/isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.cpp b/isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.cpp index 70e4c0df98..c4d8b5cb46 100644 --- a/isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.cpp +++ b/isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.cpp @@ -284,10 +284,10 @@ namespace Isis { // Write out the path, filename, and serial number FileName fname = FileName(cvp->cube()->getFileName()).expanded(); - std::string fnamePath = fname.path(); - std::string fnameName = fname.name(); - p_tableWin->table()->item(row, PATH)->setText(fnamePath.c_str()); - p_tableWin->table()->item(row, FILENAME)->setText(fnameName.c_str()); + QString fnamePath = fname.path(); + QString fnameName = fname.name(); + p_tableWin->table()->item(row, PATH)->setText(fnamePath); + p_tableWin->table()->item(row, FILENAME)->setText(fnameName); //p_tableWin->table()->item(row,34)->setText(SerialNumber::Compose(*cvp->cube()).c_str()); // If we are outside of the image then we are done @@ -299,13 +299,13 @@ namespace Isis { // Otherwise write out col 4 (Pixel value) if(cvp->isGray()) { - std::string grayPixel = PixelToString(cvp->grayPixel(isample, iline)); - QString p = grayPixel.c_str(); + QString grayPixel = PixelToString(cvp->grayPixel(isample, iline)); + QString p = grayPixel; p_tableWin->table()->item(row, PIXEL)->setText(p); } else { - std::string redPixel = PixelToString(cvp->redPixel(isample, iline)); - QString p = redPixel.c_str(); + QString redPixel = PixelToString(cvp->redPixel(isample, iline)); + QString p = redPixel; p_tableWin->table()->item(row, PIXEL)->setText(p); } @@ -401,8 +401,8 @@ namespace Isis { // Always write out columns et and utc iTime time(cvp->camera()->time()); p_tableWin->table()->item(row, EPHEMERIS_TIME)->setText(QString::number(time.Et(), 'f', 15)); - std::string time_utc = time.UTC(); - p_tableWin->table()->item(row, UTC)->setText(time_utc.c_str()); + QString time_utc = time.UTC(); + p_tableWin->table()->item(row, UTC)->setText(time_utc); // Always out columns spacecraft position double pos[3]; @@ -455,13 +455,13 @@ namespace Isis { // Track the Mosaic Origin - Index (Zero based) and FileName int iMosaicOrigin = -1; - std::string sSrcFileName = ""; - std::string sSrcSerialNum = ""; + QString sSrcFileName = ""; + QString sSrcSerialNum = ""; TrackMosaicOrigin(cvp, iline, isample, iMosaicOrigin, sSrcFileName, sSrcSerialNum); p_tableWin->table()->item(row, TRACK_MOSAIC_INDEX)->setText(QString::number(iMosaicOrigin)); - p_tableWin->table()->item(row, TRACK_MOSAIC_FILENAME)->setText(QString(sSrcFileName.c_str())); + p_tableWin->table()->item(row, TRACK_MOSAIC_FILENAME)->setText(QString(sSrcFileName)); p_tableWin->table()->item(row, TRACK_MOSAIC_SERIAL_NUM)-> - setText(QString(sSrcSerialNum.c_str())); + setText(QString(sSrcSerialNum)); } @@ -482,8 +482,8 @@ namespace Isis { * @return void */ void AdvancedTrackTool::TrackMosaicOrigin(MdiCubeViewport *cvp, int piLine, - int piSample, int &piOrigin, std::string &psSrcFileName, - std::string &psSrcSerialNum) { + int piSample, int &piOrigin, QString &psSrcFileName, + QString &psSrcSerialNum) { Cube *cCube = cvp->cube(); int iTrackBand = -1; @@ -527,8 +527,8 @@ namespace Isis { cCube->read(cFileTable); int iRecs = cFileTable.Records(); if(piOrigin >= 0 && piOrigin < iRecs) { - psSrcFileName = std::string(cFileTable[piOrigin][0]); - psSrcSerialNum = std::string(cFileTable[piOrigin][1]); + psSrcFileName = QString(cFileTable[piOrigin][0]); + psSrcSerialNum = QString(cFileTable[piOrigin][1]); } } } @@ -693,6 +693,6 @@ namespace Isis { FileName config(FileName("$HOME/.Isis/" + QApplication::applicationName() + "/").path() + "/" + "advancedTrackTool.config"); - return config.expanded().ToQt(); + return config.expanded(); } } diff --git a/isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.h b/isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.h index 5e307e69a4..7d17a40634 100644 --- a/isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.h +++ b/isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.h @@ -97,8 +97,8 @@ namespace Isis { void record(); void updateID(); void TrackMosaicOrigin(MdiCubeViewport *cvp, int piLine, int piSample, - int &piOrigin, std::string &psSrcFileName, - std::string &psSrcSerialNum); + int &piOrigin, QString &psSrcFileName, + QString &psSrcSerialNum); void helpDialog(); private: diff --git a/isis/src/qisis/objs/BandSpinBox/BandSpinBox.cpp b/isis/src/qisis/objs/BandSpinBox/BandSpinBox.cpp index 2c4bc77964..81ecbcb349 100644 --- a/isis/src/qisis/objs/BandSpinBox/BandSpinBox.cpp +++ b/isis/src/qisis/objs/BandSpinBox/BandSpinBox.cpp @@ -56,10 +56,10 @@ namespace Isis { list.clear(); if(bandBin[i].Size() == p_bands) { for(int j = 0; j < bandBin[i].Size(); j++) { - list.push_back(QString(bandBin[i][j].c_str())); + list.push_back(QString(bandBin[i][j])); } - std::string bandBinName = bandBin[i].Name(); - p_map[bandBinName.c_str()] = list; + QString bandBinName = bandBin[i].Name(); + p_map[bandBinName] = list; } } } diff --git a/isis/src/qisis/objs/BandTool/BandTool.cpp b/isis/src/qisis/objs/BandTool/BandTool.cpp index bb03bb22f1..27ee5d7d38 100644 --- a/isis/src/qisis/objs/BandTool/BandTool.cpp +++ b/isis/src/qisis/objs/BandTool/BandTool.cpp @@ -220,10 +220,10 @@ namespace Isis { p_blueDisplay->setVisible(true); for(int i = 0; i < bandBin.Keywords(); i++) { - if(bandBin[i].Name() == p_comboBox->currentText().toStdString()) { + if(bandBin[i].Name() == p_comboBox->currentText()) { p_lineEditValueList.clear(); for(int j = 0; j < bandBin[i].Size(); j++) { - p_lineEditValueList.push_back(QString(bandBin[i][j].c_str())); + p_lineEditValueList.push_back(QString(bandBin[i][j])); } } } @@ -281,8 +281,8 @@ namespace Isis { for(int i = 0; i < bandBin.Keywords(); i++) { //only add band bin keywords have a size that equals the number of bands if(bandBin[i].Size() == p_bands) { - std::string bandBinName = bandBin[i].Name(); - p_comboBox->addItem(QString(bandBinName.c_str())); + QString bandBinName = bandBin[i].Name(); + p_comboBox->addItem(QString(bandBinName)); } } diff --git a/isis/src/qisis/objs/BlinkTool/BlinkTool.cpp b/isis/src/qisis/objs/BlinkTool/BlinkTool.cpp index 9943a53e00..b0e4c2dee6 100644 --- a/isis/src/qisis/objs/BlinkTool/BlinkTool.cpp +++ b/isis/src/qisis/objs/BlinkTool/BlinkTool.cpp @@ -175,10 +175,10 @@ namespace Isis { * */ void BlinkTool::updateTool() { - std::string unlinkedIcon = FileName("$base/icons/unlinked.png").expanded(); - static QIcon unlinked(unlinkedIcon.c_str()); - std::string linkedIcon = FileName("$base/icons/linked.png").expanded(); - static QIcon linked(linkedIcon.c_str()); + QString unlinkedIcon = FileName("$base/icons/unlinked.png").expanded(); + static QIcon unlinked(unlinkedIcon); + QString linkedIcon = FileName("$base/icons/linked.png").expanded(); + static QIcon linked(linkedIcon); p_listWidget->clear(); for(int i = 0; i < (int)cubeViewportList()->size(); i++) { MdiCubeViewport *d = (*(cubeViewportList()))[i]; diff --git a/isis/src/qisis/objs/ChipViewport/ChipViewport.cpp b/isis/src/qisis/objs/ChipViewport/ChipViewport.cpp index d82e97394c..07bbe9aadd 100644 --- a/isis/src/qisis/objs/ChipViewport/ChipViewport.cpp +++ b/isis/src/qisis/objs/ChipViewport/ChipViewport.cpp @@ -244,9 +244,9 @@ namespace Isis { p_circleSize, p_circleSize); } - string serialNumber = SerialNumber::Compose(*p_chipCube); + QString serialNumber = SerialNumber::Compose(*p_chipCube); if (p_controlNet && p_controlNet->GetCubeSerials().contains( - QString::fromStdString(serialNumber))) { + serialNumber)) { // draw measure locations if we have a control network // If the serial number is Unknown, we probably have a ground source // file or level 2 which means it does not exist in the network @@ -543,7 +543,7 @@ namespace Isis { } catch (IException &e) { QString msg = "Cannot geom chip.\n"; - msg += e.toString().ToQt(); + msg += e.toString(); QMessageBox::information((QWidget *)parent(), "Error", msg); return; } @@ -566,7 +566,7 @@ namespace Isis { } catch (IException &e) { QString msg = "Cannot load no geom chip.\n"; - msg += e.toString().ToQt(); + msg += e.toString(); QMessageBox::information((QWidget *)parent(), "Error", msg); return; } @@ -595,7 +595,7 @@ namespace Isis { } catch (IException &e) { QString msg = "Cannot load rotated chip.\n"; - msg += e.toString().ToQt(); + msg += e.toString(); QMessageBox::information((QWidget *)parent(), "Error", msg); return; } @@ -634,7 +634,7 @@ namespace Isis { } catch (IException &e) { QString msg = "Cannot reload chip.\n"; - msg += e.toString().ToQt(); + msg += e.toString(); QMessageBox::information((QWidget *)parent(), "Error", msg); return; } @@ -646,7 +646,7 @@ namespace Isis { } catch (IException &e) { QString msg = "Cannot reload chip.\n"; - msg += e.toString().ToQt(); + msg += e.toString(); QMessageBox::information((QWidget *)parent(), "Error", msg); return; } diff --git a/isis/src/qisis/objs/ConcurrentControlNetReader/ConcurrentControlNetReader.cpp b/isis/src/qisis/objs/ConcurrentControlNetReader/ConcurrentControlNetReader.cpp index fb5ea45575..32c273b06f 100644 --- a/isis/src/qisis/objs/ConcurrentControlNetReader/ConcurrentControlNetReader.cpp +++ b/isis/src/qisis/objs/ConcurrentControlNetReader/ConcurrentControlNetReader.cpp @@ -157,15 +157,15 @@ namespace Isis { ControlNetFileHeaderV0002 &header = m_versionerFile->GetNetworkHeader(); if (header.has_targetname()) - net->SetTarget(header.targetname()); + net->SetTarget(header.targetname().c_str()); else net->SetTarget(""); - net->SetDescription(header.description()); - net->SetUserName(header.username()); - net->SetCreatedDate(header.created()); - net->SetNetworkId(header.networkid()); - net->SetModifiedDate(header.lastmodified()); + net->SetDescription(header.description().c_str()); + net->SetUserName(header.username().c_str()); + net->SetCreatedDate(header.created().c_str()); + net->SetNetworkId(header.networkid().c_str()); + net->SetModifiedDate(header.lastmodified().c_str()); delete m_versionerFile; m_versionerFile = NULL; @@ -192,7 +192,7 @@ namespace Isis { LatestControlNetFile * ConcurrentControlNetReader::ReadNetworkFunctor::operator()() const { - return ControlNetVersioner::Read(FileName(m_networkFileName.toStdString())); + return ControlNetVersioner::Read(FileName(m_networkFileName)); } @@ -203,7 +203,7 @@ namespace Isis { m_targetThread = targetThread; if (!target.isEmpty()) { - PvlGroup pvlRadii = Projection::TargetRadii(target.toStdString()); + PvlGroup pvlRadii = Projection::TargetRadii(target); m_majorRad = new Distance(pvlRadii["EquatorialRadius"], Distance::Meters); m_minorRad = new Distance(pvlRadii["EquatorialRadius"], Distance::Meters); m_polarRad = new Distance(pvlRadii["PolarRadius"], Distance::Meters); diff --git a/isis/src/qisis/objs/ControlPointEdit/ControlPointEdit.cpp b/isis/src/qisis/objs/ControlPointEdit/ControlPointEdit.cpp index 570701a8d0..16e3b46e60 100644 --- a/isis/src/qisis/objs/ControlPointEdit/ControlPointEdit.cpp +++ b/isis/src/qisis/objs/ControlPointEdit/ControlPointEdit.cpp @@ -121,8 +121,8 @@ namespace Isis { // grid row int row = 0; - std::string tempFileName = FileName("$base/icons").expanded(); - QString toolIconDir = tempFileName.c_str(); + QString tempFileName = FileName("$base/icons").expanded(); + QString toolIconDir = tempFileName; QSize isize(27, 27); // Add zoom buttons @@ -158,7 +158,7 @@ namespace Isis { // Add arrows for panning leftPanUp = new QToolButton(parent); leftPanUp->setIcon(QIcon(FileName("$base/icons/up.png"). - expanded().c_str())); + expanded())); leftPanUp->setIconSize(isize); leftPanUp->setToolTip("Move up 1 screen pixel"); leftPanUp->setStatusTip("Move up 1 screen pixel"); @@ -166,7 +166,7 @@ namespace Isis { leftPanDown = new QToolButton(parent); leftPanDown->setIcon(QIcon(FileName("$base/icons/down.png"). - expanded().c_str())); + expanded())); leftPanDown->setIconSize(isize); leftPanDown->setToolTip("Move down 1 screen pixel"); leftPanDown->setStatusTip("Move down 1 screen pixel"); @@ -174,7 +174,7 @@ namespace Isis { leftPanLeft = new QToolButton(parent); leftPanLeft->setIcon(QIcon(FileName("$base/icons/back.png"). - expanded().c_str())); + expanded())); leftPanLeft->setIconSize(isize); leftPanLeft->setToolTip("Move left 1 screen pixel"); leftPanLeft->setWhatsThis("Move the left measure to the left by 1 screen" @@ -182,7 +182,7 @@ namespace Isis { leftPanRight = new QToolButton(parent); leftPanRight->setIcon(QIcon(FileName("$base/icons/forward.png"). - expanded().c_str())); + expanded())); leftPanRight->setIconSize(isize); leftPanRight->setToolTip("Move right 1 screen pixel"); leftPanRight->setWhatsThis("Move the left measure to the right by 1" @@ -205,7 +205,7 @@ namespace Isis { p_rightZoomOut = new QToolButton(); p_rightZoomOut->setIcon(QIcon(FileName("$base/icons/viewmag-.png"). - expanded().c_str())); + expanded())); p_rightZoomOut->setIconSize(isize); p_rightZoomOut->setToolTip("Zoom Out 2x"); p_rightZoomOut->setWhatsThis("Zoom Out 2x on right measure."); @@ -224,21 +224,21 @@ namespace Isis { // Add arrows for panning QToolButton *rightPanUp = new QToolButton(parent); rightPanUp->setIcon(QIcon(FileName("$base/icons/up.png"). - expanded().c_str())); + expanded())); rightPanUp->setIconSize(isize); rightPanUp->setToolTip("Move up 1 screen pixel"); rightPanUp->setWhatsThis("Move the right measure up 1 screen pixel."); QToolButton *rightPanDown = new QToolButton(parent); rightPanDown->setIcon(QIcon(FileName("$base/icons/down.png"). - expanded().c_str())); + expanded())); rightPanDown->setIconSize(isize); rightPanDown->setToolTip("Move down 1 screen pixel"); rightPanUp->setWhatsThis("Move the right measure down 1 screen pixel."); QToolButton *rightPanLeft = new QToolButton(parent); rightPanLeft->setIcon(QIcon(FileName("$base/icons/back.png"). - expanded().c_str())); + expanded())); rightPanLeft->setIconSize(isize); rightPanLeft->setToolTip("Move left 1 screen pixel"); rightPanLeft->setWhatsThis("Move the right measure to the left by 1 screen" @@ -246,7 +246,7 @@ namespace Isis { QToolButton *rightPanRight = new QToolButton(parent); rightPanRight->setIcon(QIcon(FileName("$base/icons/forward.png"). - expanded().c_str())); + expanded())); rightPanRight->setIconSize(isize); rightPanRight->setToolTip("Move right 1 screen pixel"); rightPanRight->setWhatsThis("Move the right measure to the right by 1" @@ -651,7 +651,7 @@ namespace Isis { * different control point. */ void ControlPointEdit::setLeftMeasure(ControlMeasure *leftMeasure, - Cube *leftCube, std::string pointId) { + Cube *leftCube, QString pointId) { // Make sure registration is turned off if ( p_autoRegShown ) { @@ -705,7 +705,7 @@ namespace Isis { * */ void ControlPointEdit::setRightMeasure(ControlMeasure *rightMeasure, - Cube *rightCube, std::string pointId) { + Cube *rightCube, QString pointId) { // Make sure registration is turned off if ( p_autoRegShown ) { @@ -951,7 +951,7 @@ namespace Isis { } catch (IException &e) { QString msg = "Cannot register this point, unable to Load chips.\n"; - msg += e.toString().ToQt(); + msg += e.toString(); QMessageBox::information((QWidget *)parent(), "Error", msg); return; } @@ -1010,7 +1010,7 @@ namespace Isis { } catch (IException &e) { QString msg = "Cannot register this point.\n"; - msg += e.toString().ToQt(); + msg += e.toString(); QMessageBox::information((QWidget *)parent(), "Error", msg); return; } @@ -1443,13 +1443,13 @@ namespace Isis { AutoReg *reg = NULL; // save original template filename - std::string temp = p_templateFileName; + QString temp = p_templateFileName; try { // set template filename to user chosen pvl file - p_templateFileName = fn.toStdString(); + p_templateFileName = fn; // Create PVL object with this file - Pvl pvl(fn.toStdString()); + Pvl pvl(fn); // try to register file reg = AutoRegFactory::Create(pvl); @@ -1457,7 +1457,7 @@ namespace Isis { delete p_autoRegFact; p_autoRegFact = reg; - p_templateFileName = fn.toStdString(); + p_templateFileName = fn; return true; } catch (IException &e) { @@ -1465,7 +1465,7 @@ namespace Isis { p_templateFileName = temp; IException fullError(e, IException::Io, "Cannot create AutoRegFactory for " + - fn.toStdString() + + fn + ". As a result, current template file will remain set to " + p_templateFileName, _FILEINFO_); QString message = fullError.toString(); @@ -1529,13 +1529,13 @@ namespace Isis { } // Save chips - pattern, search and fit - std::string baseFile = p_pointId + "_" + - IString((int)(p_leftMeasure ->GetSample())) + "_" + - IString((int)(p_leftMeasure ->GetLine())) + "_" + - IString((int)(p_rightMeasure->GetSample())) + "_" + - IString((int)(p_rightMeasure->GetLine())) + "_"; - std::string fname = baseFile + "Search.cub"; - std::string command = "$ISISROOT/bin/qview " + fname; + QString baseFile = p_pointId + "_" + + toString((int)(p_leftMeasure ->GetSample())) + "_" + + toString((int)(p_leftMeasure ->GetLine())) + "_" + + toString((int)(p_rightMeasure->GetSample())) + "_" + + toString((int)(p_rightMeasure->GetLine())) + "_"; + QString fname = baseFile + "Search.cub"; + QString command = "$ISISROOT/bin/qview " + fname; p_autoRegFact->RegistrationSearchChip()->Write(fname); fname = baseFile + "Pattern.cub"; command += " " + fname; diff --git a/isis/src/qisis/objs/ControlPointEdit/ControlPointEdit.h b/isis/src/qisis/objs/ControlPointEdit/ControlPointEdit.h index c7156a5b0d..61cd8ce68c 100644 --- a/isis/src/qisis/objs/ControlPointEdit/ControlPointEdit.h +++ b/isis/src/qisis/objs/ControlPointEdit/ControlPointEdit.h @@ -23,18 +23,14 @@ class QVBoxLayout; namespace Isis { class AutoReg; class Chip; + class ChipViewport; class ControlMeasure; class ControlNet; class Cube; - class Stretch; - class UniversalGroundMap; -} - -namespace Isis { - class ChipViewport; class CubeViewport; + class Stretch; class Tool; - + class UniversalGroundMap; /** * @brief Point Editor Widget @@ -135,7 +131,7 @@ namespace Isis { ControlPointEdit(ControlNet * cnetQ, QWidget *parent = 0, bool allowLeftMouse = false, bool useGeometry = true); ~ControlPointEdit(); - std::string templateFileName() { + QString templateFileName() { return p_templateFileName; }; bool setTemplateFile(QString); @@ -150,9 +146,9 @@ namespace Isis { public slots: void setLeftMeasure(ControlMeasure *leftMeasure, - Cube *leftCube, std::string pointId); + Cube *leftCube, QString pointId); void setRightMeasure(ControlMeasure *rightMeasure, - Cube *rightCube, std::string pointId); + Cube *rightCube, QString pointId); void colorizeSaveButton(); void refreshChips(); void saveChips(); @@ -185,7 +181,7 @@ namespace Isis { bool p_allowLeftMouse; bool p_useGeometry; - std::string p_templateFileName; + QString p_templateFileName; QLabel *p_leftZoomFactor; QLabel *p_rightZoomFactor; QLabel *p_leftSampLinePosition; @@ -234,7 +230,7 @@ namespace Isis { UniversalGroundMap *p_rightGroundMap; AutoReg *p_autoRegFact; - std::string p_pointId; + QString p_pointId; int p_rotation; bool p_geomIt; diff --git a/isis/src/qisis/objs/CubeDisplayProperties/CubeDisplayProperties.cpp b/isis/src/qisis/objs/CubeDisplayProperties/CubeDisplayProperties.cpp index 1ca346860c..6b6669d097 100644 --- a/isis/src/qisis/objs/CubeDisplayProperties/CubeDisplayProperties.cpp +++ b/isis/src/qisis/objs/CubeDisplayProperties/CubeDisplayProperties.cpp @@ -57,14 +57,14 @@ namespace Isis { m_emissionAngle = Null; try { - Table table("CameraStatistics", m_filename.toStdString()); + Table table("CameraStatistics", m_filename); //Table table("CameraStatistics", m_filename.Name()); for (int i = 0; i < table.Records(); i++) { for (int j = 0; j < table[i].Fields(); j++) { QString label; if (table[i][j].isText()) { - label = QString::fromStdString((std::string)table[i][j]); + label = (QString)table[i][j]; label.truncate(10); } @@ -138,7 +138,7 @@ namespace Isis { void CubeDisplayProperties::fromPvl(const PvlObject &pvl) { - QByteArray hexValues(pvl["Values"][0].c_str()); + QByteArray hexValues(pvl["Values"][0].toAscii()); QDataStream valuesStream(QByteArray::fromHex(hexValues)); valuesStream >> *m_propertyValues; } @@ -213,7 +213,7 @@ namespace Isis { Cube *CubeDisplayProperties::cube() { if (!m_cube) { m_cube = new Cube; - m_cube->open(m_filename.toStdString()); + m_cube->open(m_filename); } return m_cube; @@ -226,7 +226,7 @@ namespace Isis { */ UniversalGroundMap *CubeDisplayProperties::groundMap() { if (m_gMap == NULL) { - Pvl lab(m_filename.toStdString()); + Pvl lab(m_filename); m_gMap = new UniversalGroundMap(lab); } @@ -238,7 +238,7 @@ namespace Isis { * Returns the display name */ QString CubeDisplayProperties::displayName() const { - return FileName(m_filename.toStdString()).name(); + return FileName(m_filename).name(); } diff --git a/isis/src/qisis/objs/CubePlotCurve/CubePlotCurve.cpp b/isis/src/qisis/objs/CubePlotCurve/CubePlotCurve.cpp index 8bec903135..14fb88e71d 100644 --- a/isis/src/qisis/objs/CubePlotCurve/CubePlotCurve.cpp +++ b/isis/src/qisis/objs/CubePlotCurve/CubePlotCurve.cpp @@ -272,7 +272,7 @@ namespace Isis { int band) { if (cvp) { - m_sourceCube << cvp->cube()->getFileName().ToQt(); + m_sourceCube << cvp->cube()->getFileName(); if (m_renameAutomatically) { setTitle(title().text() + " - " + diff --git a/isis/src/qisis/objs/CubeViewport/CubeViewport.cpp b/isis/src/qisis/objs/CubeViewport/CubeViewport.cpp index 6e2ee700f5..5e4d4f89ea 100644 --- a/isis/src/qisis/objs/CubeViewport/CubeViewport.cpp +++ b/isis/src/qisis/objs/CubeViewport/CubeViewport.cpp @@ -174,8 +174,8 @@ namespace Isis { // Setup context sensitive help - string cubeFileName = p_cube->getFileName(); - p_whatsThisText = QString("Function: Viewport to ") + cubeFileName.c_str(); + QString cubeFileName = p_cube->getFileName(); + p_whatsThisText = QString("Function: Viewport to ") + cubeFileName; p_cubeWhatsThisText = "

Cube Dimensions: \ @@ -518,7 +518,7 @@ namespace Isis { // Enter == button 0, Escape == button 2 switch(QMessageBox::information(this, tr("Confirm Save"), tr("The cube [%1] contains unsaved changes. " - "Do you want to save the changes before exiting?").arg(cube()->getFileName().ToQt()), + "Do you want to save the changes before exiting?").arg(cube()->getFileName()), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel)) { //Save changes and close viewport case QMessageBox::Save: @@ -978,8 +978,8 @@ namespace Isis { * */ void CubeViewport::setCaption() { - string cubeFileName = p_cube->getFileName(); - QString str = QFileInfo(cubeFileName.c_str()).fileName(); + QString cubeFileName = p_cube->getFileName(); + QString str = QFileInfo(cubeFileName).fileName(); str += QString(" @ "); str += QString::number(p_scale * 100.0); str += QString("% "); @@ -1363,15 +1363,15 @@ namespace Isis { whatsThisObj += PvlKeyword("Cube", p_cube->getFileName()); PvlGroup cubeGrp("CubeDimensions"); - cubeGrp += PvlKeyword("Samples", p_cube->getSampleCount()); - cubeGrp += PvlKeyword("Lines", p_cube->getLineCount()); - cubeGrp += PvlKeyword("Bands", p_cube->getBandCount()); + cubeGrp += PvlKeyword("Samples", toString(p_cube->getSampleCount())); + cubeGrp += PvlKeyword("Lines", toString(p_cube->getLineCount())); + cubeGrp += PvlKeyword("Bands", toString(p_cube->getBandCount())); whatsThisObj += cubeGrp; // Get Viewport Info PvlGroup viewportGrp("ViewportDimensions"); - viewportGrp += PvlKeyword("Samples", viewport()->width()); - viewportGrp += PvlKeyword("Lines", viewport()->height()); + viewportGrp += PvlKeyword("Samples", toString(viewport()->width())); + viewportGrp += PvlKeyword("Lines", toString(viewport()->height())); whatsThisObj += viewportGrp; // Get Cube area Info @@ -1391,14 +1391,14 @@ namespace Isis { bandGrp += PvlKeyword("Color", "RGB"); - virtualKey = iRedBand; - virtualKey += iGreenBand; - virtualKey += iBlueBand; + virtualKey = toString(iRedBand); + virtualKey += toString(iGreenBand); + virtualKey += toString(iBlueBand); bandGrp += virtualKey; - physicalKey = p_cube->getPhysicalBand(iRedBand); - physicalKey += p_cube->getPhysicalBand(iGreenBand); - physicalKey += p_cube->getPhysicalBand(iBlueBand); + physicalKey = toString(p_cube->getPhysicalBand(iRedBand)); + physicalKey += toString(p_cube->getPhysicalBand(iGreenBand)); + physicalKey += toString(p_cube->getPhysicalBand(iBlueBand)); bandGrp += physicalKey; if(iFilterSize) { @@ -1430,8 +1430,8 @@ namespace Isis { bandGrp += PvlKeyword("Color", "Gray"); - bandGrp += PvlKeyword("Virtual", iGrayBand); - bandGrp += PvlKeyword("Physical", p_cube->getPhysicalBand(iGrayBand)); + bandGrp += PvlKeyword("Virtual", toString(iGrayBand)); + bandGrp += PvlKeyword("Physical", toString(p_cube->getPhysicalBand(iGrayBand))); if(iFilterSize && iGrayBand <= iFilterSize) { bandGrp += PvlKeyword("FilterName", filterName[iGrayBand-1]); @@ -1441,10 +1441,10 @@ namespace Isis { //start, end line and sample double sl, ss, es, el; getCubeArea(ss, es, sl, el); - cubeAreaPvl += PvlKeyword("StartSample", int(ss + 0.5)); - cubeAreaPvl += PvlKeyword("EndSample", int(es + 0.5)); - cubeAreaPvl += PvlKeyword("StartLine", int(sl + 0.5)); - cubeAreaPvl += PvlKeyword("EndLine", int(el + 0.5)); + cubeAreaPvl += PvlKeyword("StartSample", toString(int(ss + 0.5))); + cubeAreaPvl += PvlKeyword("EndSample", toString(int(es + 0.5))); + cubeAreaPvl += PvlKeyword("StartLine", toString(int(sl + 0.5))); + cubeAreaPvl += PvlKeyword("EndLine", toString(int(el + 0.5))); cubeAreaPvl += bandGrp; whatsThisObj += cubeAreaPvl; pWhatsThisPvl += whatsThisObj; @@ -2077,7 +2077,7 @@ namespace Isis { */ void CubeViewport::stretchGray(const QString &string) { Stretch stretch; - stretch.Parse(string.toStdString()); + stretch.Parse(string); stretchGray(stretch); } @@ -2089,7 +2089,7 @@ namespace Isis { */ void CubeViewport::stretchRed(const QString &string) { Stretch stretch; - stretch.Parse(string.toStdString()); + stretch.Parse(string); stretchRed(stretch); } @@ -2101,7 +2101,7 @@ namespace Isis { */ void CubeViewport::stretchGreen(const QString &string) { Stretch stretch; - stretch.Parse(string.toStdString()); + stretch.Parse(string); stretchGreen(stretch); } @@ -2113,7 +2113,7 @@ namespace Isis { */ void CubeViewport::stretchBlue(const QString &string) { Stretch stretch; - stretch.Parse(string.toStdString()); + stretch.Parse(string); stretchBlue(stretch); } diff --git a/isis/src/qisis/objs/FeatureNomenclature/FeatureNomenclature.cpp b/isis/src/qisis/objs/FeatureNomenclature/FeatureNomenclature.cpp index a7ba5177c2..2c163342ec 100644 --- a/isis/src/qisis/objs/FeatureNomenclature/FeatureNomenclature.cpp +++ b/isis/src/qisis/objs/FeatureNomenclature/FeatureNomenclature.cpp @@ -96,7 +96,7 @@ namespace Isis { * @param endLat The maximum latitude of the ground range to search * @param endLon The maximum longitude of the ground range to search */ - void FeatureNomenclature::queryFeatures(IString target, + void FeatureNomenclature::queryFeatures(QString target, Latitude startLat, Longitude startLon, Latitude endLat, Longitude endLon) { @@ -267,10 +267,10 @@ namespace Isis { layout->addWidget(titleLabel, row, 0, 1, 2); row++; - QList< QPair > + QList< QPair > displayValues; - QPair + QPair displayValue; displayValue.first = "Feature Name:"; @@ -377,7 +377,7 @@ namespace Isis { displayValues.append(displayValue); for (int i = 0; i < displayValues.count(); i++) { - QLabel *titleLabel = new QLabel(displayValues[i].first.ToQt()); + QLabel *titleLabel = new QLabel(displayValues[i].first); QLabel *valueLabel = new QLabel( (this->*(displayValues[i].second))() ); valueLabel->setOpenExternalLinks(true); valueLabel->setWordWrap(true); @@ -401,15 +401,15 @@ namespace Isis { /** * @return The feature ID (typically a number) */ - IString FeatureNomenclature::Feature::id() const { + QString FeatureNomenclature::Feature::id() const { return getTagText("id"); } /** - * @return The feature name (not always compatible with IString) + * @return The feature name (not always compatible with QString) */ - IString FeatureNomenclature::Feature::name() const { + QString FeatureNomenclature::Feature::name() const { return getTagText("name"); } @@ -417,7 +417,7 @@ namespace Isis { /** * @return The 'clean' feature name (non-ascii characters cleaned up) */ - IString FeatureNomenclature::Feature::cleanName() const { + QString FeatureNomenclature::Feature::cleanName() const { return getTagText("cleanName"); } @@ -427,15 +427,15 @@ namespace Isis { * This is implied by what's currently available for targets, since * the database does not return this information. */ - IString FeatureNomenclature::Feature::controlNet() const { - IString targetStr = target(); - IString cnet = ""; + QString FeatureNomenclature::Feature::controlNet() const { + QString targetStr = target(); + QString cnet = ""; - if (targetStr.UpCase() == "MOON") + if (targetStr.toUpper() == "MOON") cnet = "LOLA"; - else if (targetStr.UpCase() == "MARS") + else if (targetStr.toUpper() == "MARS") cnet = "MDIM 2.1"; - else if (targetStr.UpCase() == "MERCURY") + else if (targetStr.toUpper() == "MERCURY") cnet = "Preliminary MESSENGER"; return cnet; @@ -445,11 +445,11 @@ namespace Isis { /** * @return The recommended feature name to display to the users */ - IString FeatureNomenclature::Feature::displayName() const { - IString nameString = name(); - IString cleanNameString = cleanName(); + QString FeatureNomenclature::Feature::displayName() const { + QString nameString = name(); + QString cleanNameString = cleanName(); - IString displayNameString = nameString; + QString displayNameString = nameString; if (nameString != cleanNameString) displayNameString = nameString + " (" + cleanNameString + ")"; @@ -461,7 +461,7 @@ namespace Isis { /** * @return The target name */ - IString FeatureNomenclature::Feature::target() const { + QString FeatureNomenclature::Feature::target() const { return getTagText("target"); } @@ -469,7 +469,7 @@ namespace Isis { /** * @return The target's system (i.e. Target: Moon, System: Earth) */ - IString FeatureNomenclature::Feature::system() const { + QString FeatureNomenclature::Feature::system() const { return getTagText("system"); } @@ -481,7 +481,7 @@ namespace Isis { Distance result; try { - result = Distance((double)getTagText("diameter"), + result = Distance(toDouble(getTagText("diameter")), Distance::Kilometers); } catch (IException &) { @@ -494,7 +494,7 @@ namespace Isis { /** * @return The feature's diameter as a human readable string. */ - IString FeatureNomenclature::Feature::diameterString() const { + QString FeatureNomenclature::Feature::diameterString() const { return diameter().toString(); } @@ -506,7 +506,7 @@ namespace Isis { Latitude result; try { - result = Latitude((double)getTagText("centerlatitude"), Angle::Degrees); + result = Latitude(toDouble(getTagText("centerlatitude")), Angle::Degrees); } catch (IException &) { } @@ -518,7 +518,7 @@ namespace Isis { /** * @return The feature's center latitude as a human readable string. */ - IString FeatureNomenclature::Feature::centerLatitudeString() const { + QString FeatureNomenclature::Feature::centerLatitudeString() const { return centerLatitude().toString(); } @@ -530,7 +530,7 @@ namespace Isis { Longitude result; try { - result = Longitude((double)getTagText("centerlongitude"), + result = Longitude(toDouble(getTagText("centerlongitude")), Angle::Degrees); } catch (IException &) { @@ -543,7 +543,7 @@ namespace Isis { /** * @return The feature's center longitude as a human readable string. */ - IString FeatureNomenclature::Feature::centerLongitudeString() const { + QString FeatureNomenclature::Feature::centerLongitudeString() const { return centerLongitude().toString(); } @@ -555,7 +555,7 @@ namespace Isis { Latitude result; try { - result = Latitude((double)getTagText("northernLatitude"), Angle::Degrees); + result = Latitude(toDouble(getTagText("northernLatitude")), Angle::Degrees); } catch (IException &) { } @@ -568,7 +568,7 @@ namespace Isis { * @return The feature's northernmost (max) latitude as a human readable * string. */ - IString FeatureNomenclature::Feature::northernLatitudeString() const { + QString FeatureNomenclature::Feature::northernLatitudeString() const { return northernLatitude().toString(); } @@ -580,7 +580,7 @@ namespace Isis { Latitude result; try { - result = Latitude((double)getTagText("southernLatitude"), Angle::Degrees); + result = Latitude(toDouble(getTagText("southernLatitude")), Angle::Degrees); } catch (IException &) { } @@ -593,7 +593,7 @@ namespace Isis { * @return The feature's southernmost (min) latitude as a human readable * string. */ - IString FeatureNomenclature::Feature::southernLatitudeString() const { + QString FeatureNomenclature::Feature::southernLatitudeString() const { return southernLatitude().toString(); } @@ -605,7 +605,7 @@ namespace Isis { Longitude result; try { - result = Longitude((double)getTagText("easternLongitude"), + result = Longitude(toDouble(getTagText("easternLongitude")), Angle::Degrees); } catch (IException &) { @@ -619,7 +619,7 @@ namespace Isis { * @return The feature's easternmost (max) longitude as a human readable * string. */ - IString FeatureNomenclature::Feature::easternLongitudeString() const { + QString FeatureNomenclature::Feature::easternLongitudeString() const { return easternLongitude().toString(); } @@ -631,7 +631,7 @@ namespace Isis { Longitude result; try { - result = Longitude((double)getTagText("westernLongitude"), + result = Longitude(toDouble(getTagText("westernLongitude")), Angle::Degrees); } catch (IException &) { @@ -645,7 +645,7 @@ namespace Isis { * @return The feature's westernmost (min) longitude as a human readable * string. */ - IString FeatureNomenclature::Feature::westernLongitudeString() const { + QString FeatureNomenclature::Feature::westernLongitudeString() const { return westernLongitude().toString(); } @@ -654,7 +654,7 @@ namespace Isis { * @return The continent from which the person who named the feature * originated. */ - IString FeatureNomenclature::Feature::originatingContinent() const { + QString FeatureNomenclature::Feature::originatingContinent() const { return getTagText("continent"); } @@ -662,7 +662,7 @@ namespace Isis { /** * @return The ethnicity of the person who named the feature. */ - IString FeatureNomenclature::Feature::originatingEthnicity() const { + QString FeatureNomenclature::Feature::originatingEthnicity() const { return getTagText("ethnicity"); } @@ -670,7 +670,7 @@ namespace Isis { /** * @return The IAU approval status of the feature. */ - IString FeatureNomenclature::Feature::approvalStatus() const { + QString FeatureNomenclature::Feature::approvalStatus() const { return getTagText("approvalstatus"); } @@ -678,7 +678,7 @@ namespace Isis { /** * @return The approval date of the feature. */ - IString FeatureNomenclature::Feature::approvalDate() const { + QString FeatureNomenclature::Feature::approvalDate() const { return getTagText("approvaldate"); } @@ -686,7 +686,7 @@ namespace Isis { /** * @return The type of feature (for example, crater) */ - IString FeatureNomenclature::Feature::featureType() const { + QString FeatureNomenclature::Feature::featureType() const { return getTagText("featuretype"); } @@ -694,7 +694,7 @@ namespace Isis { /** * @return The feature's reference (bibliography) information */ - IString FeatureNomenclature::Feature::referenceString() const { + QString FeatureNomenclature::Feature::referenceString() const { return getTagText("reference"); } @@ -702,7 +702,7 @@ namespace Isis { /** * @return The feature's origin */ - IString FeatureNomenclature::Feature::origin() const { + QString FeatureNomenclature::Feature::origin() const { return getTagText("origin"); } @@ -710,7 +710,7 @@ namespace Isis { /** * @return The feature's last updated time as a string. */ - IString FeatureNomenclature::Feature::lastUpdated() const { + QString FeatureNomenclature::Feature::lastUpdated() const { return getTagText("lastUpdated"); } @@ -719,14 +719,14 @@ namespace Isis { * @return The feature's online URL. */ QUrl FeatureNomenclature::Feature::referenceUrl() const { - return QUrl("http://planetarynames.wr.usgs.gov/Feature/" + id().ToQt()); + return QUrl("http://planetarynames.wr.usgs.gov/Feature/" + id()); } /** * @return The feature's online URL as a HTML string (it is hyperlinked). */ - IString FeatureNomenclature::Feature::referenceUrlString() const { + QString FeatureNomenclature::Feature::referenceUrlString() const { return "" + referenceUrl().toString() + ""; @@ -775,12 +775,12 @@ namespace Isis { * want * @return The data in the tag */ - IString FeatureNomenclature::Feature::getTagText(IString tagName) const { - IString text; + QString FeatureNomenclature::Feature::getTagText(QString tagName) const { + QString text; if (m_xmlRepresenation) { QDomNodeList nodes = - m_xmlRepresenation->elementsByTagName(tagName.ToQt()); + m_xmlRepresenation->elementsByTagName(tagName); if (nodes.count()) text = nodes.at(0).toElement().text().trimmed(); @@ -822,8 +822,8 @@ namespace Isis { "from the nomenclature database. " "The XML result was invalid. The parse is [" + errorMsg + "] on line [" + - IString(errorLine).ToQt() +"], column [" + - IString(errorCol).ToQt() + "]"); + QString(errorLine) +"], column [" + + QString(errorCol) + "]"); } } else { @@ -897,9 +897,9 @@ namespace Isis { * @param endLat The maximum latitude of the ground range to search * @param endLon The maximum longitude of the ground range to search */ - void FeatureNomenclature::runQuery(IString target, - Latitude startLat, Longitude startLon, - Latitude endLat, Longitude endLon) { + void FeatureNomenclature::runQuery(QString target, + Latitude startLat, Longitude startLon, + Latitude endLat, Longitude endLon) { QUrl encodedFormData; @@ -946,7 +946,7 @@ namespace Isis { encodedFormData.addQueryItem("reference", ""); encodedFormData.addQueryItem("system", ""); - encodedFormData.addQueryItem("target", target.UpCase().ToQt()); + encodedFormData.addQueryItem("target", target.toUpper()); encodedFormData.addQueryItem("easternLongitude", QString::number(endLon.degrees())); encodedFormData.addQueryItem("westernLongitude", @@ -958,4 +958,4 @@ namespace Isis { m_networkMgr->post(*m_request, QByteArray(encodedFormData.encodedQuery())); } -} \ No newline at end of file +} diff --git a/isis/src/qisis/objs/FeatureNomenclature/FeatureNomenclature.h b/isis/src/qisis/objs/FeatureNomenclature/FeatureNomenclature.h index 04e0e20870..3bd4295696 100644 --- a/isis/src/qisis/objs/FeatureNomenclature/FeatureNomenclature.h +++ b/isis/src/qisis/objs/FeatureNomenclature/FeatureNomenclature.h @@ -11,6 +11,7 @@ class QDomElement; class QNetworkAccessManager; class QNetworkReply; class QNetworkRequest; +class QString; class QUrl; class QWidget; @@ -18,7 +19,6 @@ template class QList; namespace Isis { class Distance; - class IString; class iTime; class Latitude; class Longitude; @@ -79,7 +79,7 @@ namespace Isis { FeatureNomenclature(const FeatureNomenclature &other); ~FeatureNomenclature(); - void queryFeatures(IString target, + void queryFeatures(QString target, Latitude startLat, Longitude startLon, Latitude endLat, Longitude endLon); @@ -118,44 +118,44 @@ namespace Isis { QWidget *toWidget() const; - IString id() const; - IString name() const; - IString cleanName() const; - IString controlNet() const; - IString displayName() const; - IString target() const; - IString system() const; + QString id() const; + QString name() const; + QString cleanName() const; + QString controlNet() const; + QString displayName() const; + QString target() const; + QString system() const; Distance diameter() const; - IString diameterString() const; + QString diameterString() const; Latitude centerLatitude() const; - IString centerLatitudeString() const; + QString centerLatitudeString() const; Longitude centerLongitude() const; - IString centerLongitudeString() const; + QString centerLongitudeString() const; Latitude northernLatitude() const; - IString northernLatitudeString() const; + QString northernLatitudeString() const; Latitude southernLatitude() const; - IString southernLatitudeString() const; + QString southernLatitudeString() const; Longitude easternLongitude() const; - IString easternLongitudeString() const; + QString easternLongitudeString() const; Longitude westernLongitude() const; - IString westernLongitudeString() const; - IString originatingContinent() const; - IString originatingEthnicity() const; - IString approvalStatus() const; - IString approvalDate() const; - IString featureType() const; - IString referenceString() const; - IString origin() const; - IString lastUpdated() const; + QString westernLongitudeString() const; + QString originatingContinent() const; + QString originatingEthnicity() const; + QString approvalStatus() const; + QString approvalDate() const; + QString featureType() const; + QString referenceString() const; + QString origin() const; + QString lastUpdated() const; QUrl referenceUrl() const; - IString referenceUrlString() const; + QString referenceUrlString() const; IAUStatus status() const; void swap(Feature &other); Feature &operator=(const Feature &rhs); private: - IString getTagText(IString tagName) const; + QString getTagText(QString tagName) const; private: /** @@ -179,7 +179,7 @@ namespace Isis { private: void readSearchResults(QDomElement); - void runQuery(IString target, + void runQuery(QString target, Latitude startLat, Longitude startLon, Latitude endLat, Longitude endLon); diff --git a/isis/src/qisis/objs/FeatureNomenclatureTool/FeatureNomenclatureTool.cpp b/isis/src/qisis/objs/FeatureNomenclatureTool/FeatureNomenclatureTool.cpp index 89a369e93e..27f9521c59 100644 --- a/isis/src/qisis/objs/FeatureNomenclatureTool/FeatureNomenclatureTool.cpp +++ b/isis/src/qisis/objs/FeatureNomenclatureTool/FeatureNomenclatureTool.cpp @@ -582,7 +582,7 @@ namespace Isis { features = viewportFeatureDisplay(vp)->features(); QProgressDialog updatingFeaturesProgress( - tr("Projecting Features for [%1]").arg(vp->cube()->getFileName().ToQt().section('/',-1)), + tr("Projecting Features for [%1]").arg(vp->cube()->getFileName().section('/',-1)), QString(), 0, 100); updatingFeaturesProgress.setWindowModality(Qt::WindowModal); @@ -608,10 +608,10 @@ namespace Isis { if ( !m_showApprovedOnly || (m_showApprovedOnly && feature.status() == FeatureNomenclature::Approved) ) { - QString displayName = feature.cleanName().ToQt() + - " (" + FileName(vp->cube()->getFileName()).name().ToQt() + ")"; + QString displayName = feature.cleanName() + + " (" + FileName(vp->cube()->getFileName()).name() + ")"; - QString targetName = feature.target().UpCase().ToQt(); + QString targetName = feature.target().toUpper(); // never insert above the blank (at 0) int insertPos = 1; @@ -738,7 +738,7 @@ namespace Isis { if (!ugm) throw IException(); - IString target; + QString target; if (vp->camera()) { target = vp->camera()->target()->name(); } @@ -761,7 +761,7 @@ namespace Isis { (*m_nomenclatureSearchers)[vp] = searcher; toolStateChanged(); - (*m_nomenclatureSearchers)[vp]->queryFeatures(target.UpCase(), + (*m_nomenclatureSearchers)[vp]->queryFeatures(target.toUpper(), minLat, minLon, maxLat, maxLon); } @@ -986,7 +986,7 @@ namespace Isis { void FeatureNomenclatureTool::readSettings() { FileName config("$HOME/.Isis/qview/nomenclature.config"); QSettings settings( - QString::fromStdString(config.expanded()), QSettings::NativeFormat); + config.expanded(), QSettings::NativeFormat); m_fontSize = settings.value("fontSize", m_fontSize).toInt(); *m_fontColor = settings.value("fontColor", *m_fontColor).value(); @@ -1008,7 +1008,7 @@ namespace Isis { void FeatureNomenclatureTool::writeSettings() { FileName config("$HOME/.Isis/qview/nomenclature.config"); QSettings settings( - QString::fromStdString(config.expanded()), QSettings::NativeFormat); + config.expanded(), QSettings::NativeFormat); settings.setValue("fontSize", m_fontSize); settings.setValue("fontColor", qVariantFromValue(*m_fontColor)); settings.setValue("defaultEnabled", m_defaultEnabled); @@ -1512,7 +1512,7 @@ namespace Isis { */ void FeatureNomenclatureTool::ViewportFeatureDisplay::centerFeature( FeatureNomenclature::Feature feature) { - IString displayName = feature.displayName(); + QString displayName = feature.displayName(); int foundIndex = -1; for (int i = 0; foundIndex == -1 && i < m_features->count(); i++) { diff --git a/isis/src/qisis/objs/FeatureNomenclatureTool/FeatureNomenclatureTool.h b/isis/src/qisis/objs/FeatureNomenclatureTool/FeatureNomenclatureTool.h index 7af9101881..aad5f0ad21 100644 --- a/isis/src/qisis/objs/FeatureNomenclatureTool/FeatureNomenclatureTool.h +++ b/isis/src/qisis/objs/FeatureNomenclatureTool/FeatureNomenclatureTool.h @@ -15,12 +15,12 @@ class QLineEdit; class QMenu; class QProgressBar; class QPushButton; +class QString; template class QMap; template class QPair; namespace Isis { - class IString; class MdiCubeViewport; class UniversalGroundMap; diff --git a/isis/src/qisis/objs/FileDialog/FileDialog.cpp b/isis/src/qisis/objs/FileDialog/FileDialog.cpp index a448cfc52f..260eb31b10 100644 --- a/isis/src/qisis/objs/FileDialog/FileDialog.cpp +++ b/isis/src/qisis/objs/FileDialog/FileDialog.cpp @@ -17,7 +17,7 @@ namespace Isis { this->setFileMode(QFileDialog::ExistingFiles); if(parent != 0) { parent->installEventFilter(this); - p_appName = parent->windowTitle().toStdString(); + p_appName = parent->windowTitle(); } connect(this, SIGNAL(accepted()), this, SLOT(sendSignal())); @@ -136,13 +136,13 @@ namespace Isis { */ void FileDialog::readSettings() { if(p_appName == "") { - p_appName = this->windowTitle().toStdString(); + p_appName = this->windowTitle(); } - std::string instanceName = this->windowTitle().toStdString(); + QString instanceName = this->windowTitle(); // FileName is a QFileDialog enum for DialogLabel Isis::FileName config("$HOME/.Isis/" + p_appName + "/" + instanceName + ".config"); - QSettings settings(QString::fromStdString(config.expanded()), QSettings::NativeFormat); + QSettings settings(config.expanded(), QSettings::NativeFormat); QPoint pos = settings.value("pos", QPoint(300, 100)).toPoint(); QSize size = settings.value("size", QSize(355, 350)).toSize(); resize(size); @@ -161,13 +161,13 @@ namespace Isis { if(!this->isVisible()) return; if(p_appName == "") { - p_appName = this->windowTitle().toStdString(); + p_appName = this->windowTitle(); } - std::string instanceName = this->windowTitle().toStdString(); + QString instanceName = this->windowTitle(); // FileName is a QFileDialog enum for DialogLabel Isis::FileName config("$HOME/.Isis/" + p_appName + "/" + instanceName + ".config"); - QSettings settings(QString::fromStdString(config.expanded()), QSettings::NativeFormat); + QSettings settings(config.expanded(), QSettings::NativeFormat); settings.setValue("pos", pos()); settings.setValue("size", size()); diff --git a/isis/src/qisis/objs/FileDialog/FileDialog.h b/isis/src/qisis/objs/FileDialog/FileDialog.h index f045db6952..4642cd4c58 100644 --- a/isis/src/qisis/objs/FileDialog/FileDialog.h +++ b/isis/src/qisis/objs/FileDialog/FileDialog.h @@ -49,7 +49,7 @@ namespace Isis { private: QList p_comboBoxes; QList p_allPButtons; - std::string p_appName; + QString p_appName; QDialog *p_mainDialog; QWidget *p_parent; QPushButton *p_filterButton; diff --git a/isis/src/qisis/objs/FileTool/FileTool.cpp b/isis/src/qisis/objs/FileTool/FileTool.cpp index 98758bc4d4..0a96321626 100644 --- a/isis/src/qisis/objs/FileTool/FileTool.cpp +++ b/isis/src/qisis/objs/FileTool/FileTool.cpp @@ -309,7 +309,7 @@ namespace Isis { QVector< MdiCubeViewport *> *vwportList = p_workSpace->cubeViewportList(); QVector::iterator it; for (it = vwportList->begin(); it != vwportList->end(); ++it){ - if(QString((*it)->cube()->getFileName().c_str()) == psOutFile) { + if(QString((*it)->cube()->getFileName()) == psOutFile) { QMessageBox::information((QWidget *)parent(), "Error", "Output File is already open\n\""+ psOutFile + "\""); return; @@ -318,7 +318,7 @@ namespace Isis { //If the filename is the same as the current cube's filename, just save it if(p_saveAsDialog->getSaveAsType() == SaveAsDialog::FullImage && - psOutFile.toStdString() == cubeViewport()->cube()->getFileName()) { + psOutFile == cubeViewport()->cube()->getFileName()) { save(); return; } @@ -389,7 +389,7 @@ namespace Isis { try { ProcessRubberSheet p; p.SetInputCube (icube); - Cube *ocube = p.SetOutputCube(psOutFile.toStdString(), CubeAttributeOutput(" "), + Cube *ocube = p.SetOutputCube(psOutFile, CubeAttributeOutput(" "), ons , onl, icube->getBandCount()); Interpolator *interp = new Interpolator(Interpolator::NearestNeighborType); @@ -436,13 +436,13 @@ namespace Isis { onl = (int)ceil(inl * dScale); CubeAttributeInput cai(icube->getFileName()); - vector bands = cai.bands(); + std::vector bands = cai.bands(); int inb = bands.size(); if(inb == 0) { inb = cubeViewport()->cube()->getBandCount(); for(int i = 1; i <= inb; i++) { - bands.push_back((IString)i); + bands.push_back(toString(i)); } } @@ -450,7 +450,7 @@ namespace Isis { p.SetInputCube (icube); Cube *ocube = NULL; try { - ocube = p.SetOutputCube(psOutFile.toStdString(), CubeAttributeOutput(""), ons+1, onl+1, inb); + ocube = p.SetOutputCube(psOutFile, CubeAttributeOutput(""), ons+1, onl+1, inb); // Our processing routine only needs 1 // the original set was for info about the cube only p.ClearInputCubes(); @@ -512,7 +512,7 @@ namespace Isis { void FileTool::copyCubeDetails(const QString & psOutFile, Cube *icube, Cube *ocube, int piNumSamples, int piNumLines, int piNumBands) { //Create the default output attribute with the output filename - CubeAttributeOutput outAtt(psOutFile.toStdString()); + CubeAttributeOutput outAtt(psOutFile); //Propagate all labels, tables, blobs, etc from the input to output cube try { @@ -540,13 +540,13 @@ namespace Isis { else if((ocube->getPixelType() != Real) && (ocube->getPixelType() != UnsignedByte) && (ocube->getPixelType() != SignedWord)) { - std::string msg = "Looks like your refactoring to add different pixel types"; + QString msg = "Looks like your refactoring to add different pixel types"; msg += " you'll need to make changes here"; throw IException(IException::Programmer, msg, _FILEINFO_); } else { - std::string msg = "You've chosen to reduce your output PixelType for [" + - psOutFile.toStdString() + "] you must specify the output pixel range too"; + QString msg = "You've chosen to reduce your output PixelType for [" + + psOutFile + "] you must specify the output pixel range too"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -561,7 +561,7 @@ namespace Isis { } // Allocate the cube - ocube->create(psOutFile.toStdString()); + ocube->create(psOutFile); // Transfer labels from the first input cube PvlObject &incube = icube->getLabel()->FindObject("IsisCube"); @@ -574,7 +574,7 @@ namespace Isis { Pvl &inlab = *icube->getLabel(); for(int i = 0; i < inlab.Objects(); i++) { if(inlab.Object(i).IsNamed("Table")) { - Blob t((std::string)inlab.Object(i)["Name"], inlab.Object(i).Name()); + Blob t((QString)inlab.Object(i)["Name"], inlab.Object(i).Name()); icube->read(t); ocube->write(t); } @@ -584,7 +584,7 @@ namespace Isis { inlab = *icube->getLabel(); for(int i = 0; i < inlab.Objects(); i++) { if(inlab.Object(i).IsNamed("Polygon")) { - Blob t((std::string)inlab.Object(i)["Name"], inlab.Object(i).Name()); + Blob t((QString)inlab.Object(i)["Name"], inlab.Object(i).Name()); icube->read(t); ocube->write(t); } @@ -704,7 +704,7 @@ namespace Isis { Pvl whatsThisPvl; cubeViewport()->getAllWhatsThisInfo(whatsThisPvl); - whatsThisPvl.Write(output.toStdString()); + whatsThisPvl.Write(output); } /** @@ -765,7 +765,7 @@ namespace Isis { QPixmap pm = QPixmap::grabWidget(cubeViewport()->viewport()); - //if (!cubeViewport()->pixmap().save(output,format.toStdString().c_str())) { + //if (!cubeViewport()->pixmap().save(output,format)) { if(!pm.save(output)) { QMessageBox::information((QWidget *)parent(), "Error", "Unable to save " + output); diff --git a/isis/src/qisis/objs/HelpTool/HelpTool.cpp b/isis/src/qisis/objs/HelpTool/HelpTool.cpp index c5c1453657..15774927e4 100644 --- a/isis/src/qisis/objs/HelpTool/HelpTool.cpp +++ b/isis/src/qisis/objs/HelpTool/HelpTool.cpp @@ -58,15 +58,15 @@ namespace Isis { * @author 2007-06-12 Tracie Sucharski */ void HelpTool::aboutProgram() { - FileName file((std::string) - "$ISISROOT/doc/Application/presentation/PrinterFriendly/" + - QApplication::applicationName().toStdString() + "/" + - QApplication::applicationName().toStdString() + ".html"); + FileName file( + "$ISISROOT/doc/Application/presentation/PrinterFriendly/" + + QApplication::applicationName() + "/" + + QApplication::applicationName() + ".html"); PvlGroup &uig = Preference::Preferences().FindGroup("UserInterface"); - std::string command = (std::string) uig["GuiHelpBrowser"] + - (std::string)" file:" + file.expanded() + " &"; - if(system(command.c_str()) != 0) { + QString command = (QString) uig["GuiHelpBrowser"] + + (QString)" file:" + file.expanded() + " &"; + if(system(command.toAscii().data()) != 0) { IString msg = "Failed to execute [" + command + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } diff --git a/isis/src/qisis/objs/MatchTool/MatchTool.cpp b/isis/src/qisis/objs/MatchTool/MatchTool.cpp index 3fb6f768b0..6c0aac4f3f 100644 --- a/isis/src/qisis/objs/MatchTool/MatchTool.cpp +++ b/isis/src/qisis/objs/MatchTool/MatchTool.cpp @@ -86,8 +86,8 @@ namespace Isis { // QStatusBar *m_statusBar = qobject_cast(parent)->statusBar(); // m_statusBar->showMessage("STATUS BAR TEST"); -// std::string warn = "TEST TEST TEST"; -// std::string warn2 = "JUNK"; +// QString warn = "TEST TEST TEST"; +// QString warn2 = "JUNK"; // qobject_cast(parent)->displayWarning(warn,warn2); m_parent = parent; connect(this, SIGNAL(toolActivated()), this, SLOT(activateTool())); @@ -190,7 +190,7 @@ namespace Isis { m_cnetFileNameLabel->setWhatsThis("Name of opened control network file."); m_templateFileNameLabel = new QLabel("Template File: " + - QString::fromStdString(m_pointEditor->templateFileName())); + m_pointEditor->templateFileName()); m_templateFileNameLabel->setToolTip("Sub-pixel registration template File."); // QString patternMatchDoc = // FileName("$ISISROOT/doc/documents/PatternMatch/PatternMatch.html").fileName(); @@ -642,7 +642,7 @@ namespace Isis { // Attempt to Compose Serial number and see if list already has duplicate. If so, // use filenames as serial numbers for both cubes. This needs to be checked because // coreg networks will often have 2 cubes with the same serial number.make cl - std::string sn = SerialNumber::Compose(mvp->cube()->getFileName(), true); + QString sn = SerialNumber::Compose(mvp->cube()->getFileName(), true); if (list.HasSerialNumber(sn)) { // TODO Before removing serial number, make sure current network does not have // measures with old serial number. If it does, now what? Print error? @@ -667,9 +667,9 @@ namespace Isis { - std::string MatchTool::serialNumber(MdiCubeViewport *mvp) { + QString MatchTool::serialNumber(MdiCubeViewport *mvp) { - std::string serialNumber; + QString serialNumber; try { SerialNumberList list = serialNumberList(); serialNumber = list.SerialNumber(mvp->cube()->getFileName()); @@ -929,8 +929,8 @@ namespace Isis { if (response == QMessageBox::Yes) { // Update measure file combo boxes: old reference normal font, // new reference bold font - IString file = serialNumberList().FileName(m_leftMeasure->GetCubeSerialNumber()); - QString fname = FileName(file).name().c_str(); + QString file = serialNumberList().FileName(m_leftMeasure->GetCubeSerialNumber()); + QString fname = FileName(file).name(); int iref = m_leftCombo->findText(fname); // Save normal font from new reference measure @@ -940,7 +940,7 @@ namespace Isis { m_rightCombo->setItemData(iref,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole); file = serialNumberList().FileName(refMeasure->GetCubeSerialNumber()); - fname = FileName(file).name().c_str(); + fname = FileName(file).name(); iref = m_leftCombo->findText(fname); m_leftCombo->setItemData(iref,font,Qt::FontRole); iref = m_rightCombo->findText(fname); @@ -992,8 +992,8 @@ namespace Isis { if (response == QMessageBox::Yes) { // Update measure file combo boxes: old reference normal font, // new reference bold font - IString file = serialNumberList().FileName(m_leftMeasure->GetCubeSerialNumber()); - QString fname = FileName(file).name().c_str(); + QString file = serialNumberList().FileName(m_leftMeasure->GetCubeSerialNumber()); + QString fname = FileName(file).name(); int iref = m_leftCombo->findText(fname); // Save normal font from new reference measure @@ -1003,7 +1003,7 @@ namespace Isis { m_rightCombo->setItemData(iref,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole); file = serialNumberList().FileName(refMeasure->GetCubeSerialNumber()); - fname = FileName(file).name().c_str(); + fname = FileName(file).name(); iref = m_leftCombo->findText(fname); m_leftCombo->setItemData(iref,font,Qt::FontRole); iref = m_rightCombo->findText(fname); @@ -1293,7 +1293,7 @@ namespace Isis { if (!m_cnetFileName.isEmpty()) { try { Progress progress; - m_controlNet = new ControlNet(m_cnetFileName.toStdString(), &progress); + m_controlNet = new ControlNet(m_cnetFileName, &progress); m_coregNet = false; m_coregReferenceSN = ""; if (m_controlNet->GetNetworkId() == "Coreg") { @@ -1306,7 +1306,7 @@ namespace Isis { catch (IException &e) { QApplication::restoreOverrideCursor(); QString message = "Invalid control network. \n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_matchTool, "Error", message); m_cnetFileName.clear(); delete m_controlNet; @@ -1336,7 +1336,7 @@ namespace Isis { return; } try { - m_controlNet->Write(m_cnetFileName.toStdString()); + m_controlNet->Write(m_cnetFileName); m_netChanged = false; } catch (IException &e) { @@ -1360,7 +1360,7 @@ namespace Isis { //Make sure the filename is valid if(!fn.isEmpty()) { try { - m_controlNet->Write(fn.toStdString()); + m_controlNet->Write(fn); m_netChanged = false; } catch (IException &e) { @@ -1398,7 +1398,7 @@ namespace Isis { * @history 2012-01-11 Tracie Sucharski - Add error check for invalid lat, lon * when creating new control point. * @history 2012-05-08 Tracie Sucharski - Clear m_leftFile, only set if creating - * new point. Change m_leftFile from a std::string to + * new point. Change m_leftFile from a QString to * a QString. * @history 2012-10-02 Tracie Sucharski - The member variable leftFile was never set. It is now * set when a new point is created and cleared after all measures have @@ -1409,8 +1409,8 @@ namespace Isis { MdiCubeViewport *mvp = cubeViewport(); if (mvp == NULL) return; - IString file = mvp->cube()->getFileName(); - IString sn = serialNumberList().SerialNumber(file); + QString file = mvp->cube()->getFileName(); + QString sn = serialNumberList().SerialNumber(file); double samp,line; mvp->viewportToCube(p.x(),p.y(),samp,line); @@ -1425,14 +1425,14 @@ namespace Isis { } // Find closest control point in network - IString sn = serialNumberList().SerialNumber(file); + QString sn = serialNumberList().SerialNumber(file); ControlPoint *point = NULL; try { point = m_controlNet->FindClosest(sn, samp, line); } catch (IException &e) { QString message = "Cannot find point for editing."; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::warning(m_matchTool, "Warning", message); return; } @@ -1466,11 +1466,11 @@ namespace Isis { else { try { createPoint(mvp, samp, line); - m_leftFile = mvp->cube()->getFileName().ToQt(); + m_leftFile = mvp->cube()->getFileName(); } catch (IException &e) { QString message = "Cannot create control point.\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_matchTool, "Error", message); return; } @@ -1510,13 +1510,13 @@ namespace Isis { QStringList images; for (int i = 0; i < (int)cubeViewportList()->size(); i++) { FileName cubeFile = (*(cubeViewportList()))[i]->cube()->getFileName(); - images<setFiles(images); m_newPointDialog->show(); // Highlight the current cubeViewport - QString current = FileName(cvp->cube()->getFileName()).name().ToQt(); + QString current = FileName(cvp->cube()->getFileName()).name(); m_newPointDialog->highlightFile(current); m_newPoint = new ControlPoint(); @@ -1539,7 +1539,7 @@ namespace Isis { void MatchTool::addMeasure(MdiCubeViewport *cvp, double sample, double line) { // Highlight the current cubeViewport - QString current = FileName(cvp->cube()->getFileName()).name().ToQt(); + QString current = FileName(cvp->cube()->getFileName()).name(); m_newPointDialog->highlightFile(current); m_newPointDialog->raise(); @@ -1564,7 +1564,7 @@ namespace Isis { void MatchTool::doneWithMeasures() { m_lastUsedPointId = m_newPointDialog->pointId(); - m_newPoint->SetId(m_lastUsedPointId.toStdString()); + m_newPoint->SetId(m_lastUsedPointId); // // Add new control point to control network // m_controlNet->AddPoint(m_newPoint); // // Read newly added point @@ -1576,7 +1576,7 @@ namespace Isis { if (m_coregNet) { if (!m_newPoint->HasSerialNumber(m_coregReferenceSN)) { QString message = "This is a coreg network which needs the cube with serial number " + - m_coregReferenceSN.ToQt() + " as the reference measure. This new control point does " + m_coregReferenceSN + " as the reference measure. This new control point does " "not have a measure for that serial number, so this point cannot be created until " "the cube listed above is added (Right-click on cube)."; QMessageBox::critical(m_matchTool, "Error", message); @@ -1686,19 +1686,19 @@ namespace Isis { } MatchToolDeletePointDialog *deletePointDialog = new MatchToolDeletePointDialog; - IString CPId = m_editPoint->GetId(); - deletePointDialog->pointIdValue->setText(CPId.c_str()); + QString CPId = m_editPoint->GetId(); + deletePointDialog->pointIdValue->setText(CPId); // Need all files for this point for (int i=0; iGetNumMeasures(); i++) { ControlMeasure &m = *(*m_editPoint)[i]; - IString file; + QString file; if (serialNumberList().HasSerialNumber(m.GetCubeSerialNumber())) { file = serialNumberList().FileName(m.GetCubeSerialNumber()); } else { file = m.GetCubeSerialNumber(); } - deletePointDialog->fileList->addItem(file.c_str()); + deletePointDialog->fileList->addItem(file); } if (deletePointDialog->exec()) { @@ -1762,8 +1762,8 @@ namespace Isis { m_matchTool->setShown(true); m_matchTool->raise(); - loadTemplateFile(QString::fromStdString( - m_pointEditor->templateFileName())); + loadTemplateFile( + m_pointEditor->templateFileName()); } // Since the delete point is not loaded into the editor for saving by the user, we need // to save the point. @@ -1833,8 +1833,8 @@ namespace Isis { loadPoint(); m_matchTool->setShown(true); m_matchTool->raise(); - loadTemplateFile(QString::fromStdString( - m_pointEditor->templateFileName())); + loadTemplateFile( + m_pointEditor->templateFileName()); // emit signal so the nav tool can update edit point emit editPointChanged(); @@ -1858,14 +1858,14 @@ namespace Isis { * ground measure-use AprioriSurface point, not lat,lon * of reference measure unless there is no apriori * surface point. - * @history 2012-05-08 Tracie Sucharski - m_leftFile changed from std::string to QString. + * @history 2012-05-08 Tracie Sucharski - m_leftFile changed from QString to QString. * @history 2012-10-02 Tracie Sucharski - When creating a new point, load the cube the user * clicked on first on the left side, use m_leftFile. */ void MatchTool::loadPoint () { // Write pointId - IString CPId = m_editPoint->GetId(); + QString CPId = m_editPoint->GetId(); QString ptId("Point ID: "); ptId += (QString) CPId; m_ptIdValue->setText(ptId); @@ -1889,9 +1889,9 @@ namespace Isis { // Need all files for this point for (int i=0; iGetNumMeasures(); i++) { ControlMeasure &m = *(*m_editPoint)[i]; - IString file = serialNumberList().FileName(m.GetCubeSerialNumber()); + QString file = serialNumberList().FileName(m.GetCubeSerialNumber()); m_pointFiles<addItem(tempFileName); m_rightCombo->addItem(tempFileName); if (m_editPoint->IsReferenceExplicit() && @@ -1917,7 +1917,7 @@ namespace Isis { } else { if (!m_leftFile.isEmpty()) { - leftIndex = m_leftCombo->findText(FileName(m_leftFile).name().c_str()); + leftIndex = m_leftCombo->findText(FileName(m_leftFile).name()); // Sanity check if (leftIndex < 0 ) leftIndex = 0; m_leftFile.clear(); @@ -1978,8 +1978,7 @@ namespace Isis { int column = 0; ControlMeasure &m = *(*m_editPoint)[row]; - QString file = QString::fromStdString( - serialNumberList().FileName(m.GetCubeSerialNumber())); + QString file = serialNumberList().FileName(m.GetCubeSerialNumber()); QTableWidgetItem *tableItem = new QTableWidgetItem(QString(file)); m_measureTable->setItem(row,column++,tableItem); @@ -2090,8 +2089,8 @@ namespace Isis { tableItem = new QTableWidgetItem("False"); m_measureTable->setItem(row,column++,tableItem); - tableItem = new QTableWidgetItem(QString::fromStdString( - ControlMeasure::MeasureTypeToString(m.GetType()))); + tableItem = new QTableWidgetItem( + ControlMeasure::MeasureTypeToString(m.GetType())); m_measureTable->setItem(row,column,tableItem); // If reference measure set font on this row to bold @@ -2169,21 +2168,21 @@ namespace Isis { * make sure old measure is retained. */ void MatchTool::selectLeftMeasure(int index) { - IString file = m_pointFiles[index]; + QString file = m_pointFiles[index]; - IString serial; + QString serial; try { serial = serialNumberList().SerialNumber(file); } catch (IException &e) { QString message = "Make sure the correct cube is opened.\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_matchTool, "Error", message); // Set index of combo back to what it was before user selected new. Find the index // of current left measure. - IString file = serialNumberList().FileName(m_leftMeasure->GetCubeSerialNumber()); - int i = m_leftCombo->findText(FileName(file).name().c_str()); + QString file = serialNumberList().FileName(m_leftMeasure->GetCubeSerialNumber()); + int i = m_leftCombo->findText(FileName(file).name()); if (i < 0) i = 0; m_leftCombo->setCurrentIndex(i); return; @@ -2225,21 +2224,21 @@ namespace Isis { */ void MatchTool::selectRightMeasure(int index) { - IString file = m_pointFiles[index]; + QString file = m_pointFiles[index]; - IString serial; + QString serial; try { serial = serialNumberList().SerialNumber(file); } catch (IException &e) { QString message = "Make sure the correct cube is opened.\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_matchTool, "Error", message); // Set index of combo back to what it was before user selected new. Find the index // of current left measure. - IString file = serialNumberList().FileName(m_rightMeasure->GetCubeSerialNumber()); - int i = m_rightCombo->findText(FileName(file).name().c_str()); + QString file = serialNumberList().FileName(m_rightMeasure->GetCubeSerialNumber()); + int i = m_rightCombo->findText(FileName(file).name()); if (i < 0) i = 0; m_rightCombo->setCurrentIndex(i); return; @@ -2505,8 +2504,8 @@ namespace Isis { m_editPoint == NULL) return; - std::string sn = serialNumber(mvp); -// std::string serialNumber = SerialNumber::Compose(*vp->cube(), true); + QString sn = serialNumber(mvp); +// QString serialNumber = SerialNumber::Compose(*vp->cube(), true); // In the middle of creating a new point if (m_newPoint != NULL) { @@ -2530,7 +2529,7 @@ namespace Isis { // If viewport serial number not found in control net, return if (!m_controlNet->GetCubeSerials().contains( - QString::fromStdString(sn))) return; + sn)) return; // if (!m_controlNet->GetCubeSerials().contains( // QString::fromStdString(sn))) return; @@ -2648,7 +2647,7 @@ namespace Isis { */ void MatchTool::loadTemplateFile(QString fn) { - QFile file(QString::fromStdString(FileName((IString) fn).expanded())); + QFile file(FileName((QString) fn).expanded()); if (!file.open(QIODevice::ReadOnly)) { QString msg = "Failed to open template file \"" + fn + "\""; QMessageBox::warning(m_matchTool, "IO Error", msg); @@ -2683,8 +2682,8 @@ namespace Isis { if (!m_templateModified) return; - QString filename = QString::fromStdString( - m_pointEditor->templateFileName()); + QString filename = + m_pointEditor->templateFileName(); writeTemplateFile(filename); } @@ -2717,7 +2716,7 @@ namespace Isis { // catch errors in Pvl format when populating pvl object stringstream ss; - ss << contents.toStdString(); + ss << contents; try { Pvl pvl; ss >> pvl; @@ -2728,8 +2727,8 @@ namespace Isis { return; } - QString expandedFileName(QString::fromStdString( - FileName((IString) fn).expanded())); + QString expandedFileName( + FileName((QString) fn).expanded()); QFile file(expandedFileName); @@ -2775,12 +2774,12 @@ namespace Isis { // to view and/or edit the template PvlEditDialog registrationDialog(templatePvl); registrationDialog.setWindowTitle("View or Edit Template File: " - + QString::fromStdString(templatePvl.FileName())); + + templatePvl.FileName()); registrationDialog.resize(550,360); registrationDialog.exec(); } catch (IException &e) { - QString message = e.toString().c_str(); + QString message = e.toString(); QMessageBox::information(m_matchTool, "Error", message); } } @@ -2908,7 +2907,7 @@ namespace Isis { * * @author 2011-07-06 Tracie Sucharski */ - bool MatchTool::IsMeasureLocked (IString serialNumber) { + bool MatchTool::IsMeasureLocked (QString serialNumber) { if (m_editPoint == NULL) return false; @@ -2933,7 +2932,7 @@ namespace Isis { */ void MatchTool::readSettings() { FileName config("$HOME/.Isis/qview/MatchTool.config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings(config.expanded(), QSettings::NativeFormat); QPoint pos = settings.value("pos", QPoint(300, 100)).toPoint(); QSize size = settings.value("size", QSize(900, 500)).toSize(); @@ -2953,7 +2952,7 @@ namespace Isis { visible at the time of closing the application*/ if (!m_matchTool->isVisible()) return; FileName config("$HOME/.Isis/qview/MatchTool.config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings(config.expanded(), QSettings::NativeFormat); settings.setValue("pos", m_matchTool->pos()); settings.setValue("size", m_matchTool->size()); diff --git a/isis/src/qisis/objs/MatchTool/MatchTool.h b/isis/src/qisis/objs/MatchTool/MatchTool.h index 1dfab64264..541c122812 100644 --- a/isis/src/qisis/objs/MatchTool/MatchTool.h +++ b/isis/src/qisis/objs/MatchTool/MatchTool.h @@ -33,21 +33,18 @@ class QWidget; namespace Isis { class ControlMeasure; class ControlNet; - class Cube; - class IString; - class MatchToolNewPointDialog; - class Stretch; - class UniversalGroundMap; -} - -namespace Isis { class ControlPointEdit; + class Cube; class CubeViewport; class MainWindow; + class MatchToolNewPointDialog; class MdiCubeViewport; class MatchHoldPointDialog; class SerialNumberList; + class Stretch; class ToolPad; + class UniversalGroundMap; + /** * @brief Match tool operations * @@ -182,7 +179,7 @@ namespace Isis { * already handled in ControlPointEdit::saveMeasure. * @history 2012-05-08 Tracie Sucharski - Fixed bug where m_leftFile was not * being reset in mouseButtonRelease. Change m_leftFile - * from a std::string to a QString. + * from a QString to a QString. * @history 2012-06-12 Tracie Sucharski - Change made to measureSaved on 2012-04-26 caused a * bug where if no ground is loaded the checkReference was not being * called and reference measure could not be changed and there was no @@ -314,7 +311,7 @@ namespace Isis { void createTemplateEditorWidget(); void loadTemplateFile(QString); bool okToContinue(); - bool IsMeasureLocked(IString serialNumber); + bool IsMeasureLocked(QString serialNumber); void addMeasure(MdiCubeViewport *mvp, double sample, double line); bool validateMeasureChange(ControlMeasure *m); @@ -322,7 +319,7 @@ namespace Isis { // TODO pointer, reference, what??? SerialNumberList serialNumberList(); - std::string serialNumber(MdiCubeViewport *mvp); + QString serialNumber(MdiCubeViewport *mvp); void addViewportToSerialNumberList(MdiCubeViewport *mvp); void readSettings(); @@ -338,7 +335,7 @@ namespace Isis { QString m_cnetFileName; QLabel *m_cnetFileNameLabel; bool m_coregNet; - IString m_coregReferenceSN; + QString m_coregReferenceSN; bool m_netChanged; QAction *m_createPoint; diff --git a/isis/src/qisis/objs/MdiCubeViewport/MdiCubeViewport.cpp b/isis/src/qisis/objs/MdiCubeViewport/MdiCubeViewport.cpp index 623c3370e9..63c3c77860 100644 --- a/isis/src/qisis/objs/MdiCubeViewport/MdiCubeViewport.cpp +++ b/isis/src/qisis/objs/MdiCubeViewport/MdiCubeViewport.cpp @@ -41,8 +41,8 @@ namespace Isis { QWidget *parent) : CubeViewport(cube, cdt, parent) { p_linked = false; - string unlinkedIcon = FileName("$base/icons/unlinked.png").expanded(); - static QIcon unlinked(unlinkedIcon.c_str()); + QString unlinkedIcon = FileName("$base/icons/unlinked.png").expanded(); + static QIcon unlinked(unlinkedIcon); parentWidget()->setWindowIcon(unlinked); } @@ -71,10 +71,10 @@ namespace Isis { if(!parentWidget() || !parentWidget()->parentWidget()) return; - string unlinkedIcon = FileName("$base/icons/unlinked.png").expanded(); - static QIcon unlinked(unlinkedIcon.c_str()); - string linkedIcon = FileName("$base/icons/linked.png").expanded(); - static QIcon linked(linkedIcon.c_str()); + QString unlinkedIcon = FileName("$base/icons/unlinked.png").expanded(); + static QIcon unlinked(unlinkedIcon); + QString linkedIcon = FileName("$base/icons/linked.png").expanded(); + static QIcon linked(linkedIcon); bool notify = false; if(b != p_linked) diff --git a/isis/src/qisis/objs/MeasureTool/MeasureTool.cpp b/isis/src/qisis/objs/MeasureTool/MeasureTool.cpp index cc8223687e..b85edeab6b 100644 --- a/isis/src/qisis/objs/MeasureTool/MeasureTool.cpp +++ b/isis/src/qisis/objs/MeasureTool/MeasureTool.cpp @@ -404,8 +404,8 @@ namespace Isis { m_tableWin->table()->item(row, AreaMIndex)->setText("N/A"); } - m_tableWin->table()->item(row, PathIndex)->setText(m_path.c_str()); - m_tableWin->table()->item(row, FileNameIndex)->setText(m_fname.c_str()); + m_tableWin->table()->item(row, PathIndex)->setText(m_path); + m_tableWin->table()->item(row, FileNameIndex)->setText(m_fname); } @@ -484,8 +484,8 @@ namespace Isis { m_tableWin->table()->item(row + i, DistanceMIndex)->setText("N/A"); } - m_tableWin->table()->item(row + i, PathIndex)->setText(m_path.c_str()); - m_tableWin->table()->item(row + i, FileNameIndex)->setText(m_fname.c_str()); + m_tableWin->table()->item(row + i, PathIndex)->setText(m_path); + m_tableWin->table()->item(row + i, FileNameIndex)->setText(m_fname); distanceSum = (Distance(distanceSum, Distance::Kilometers) + Distance(m_distanceSegments[i], Distance::Kilometers)).kilometers(); diff --git a/isis/src/qisis/objs/MeasureTool/MeasureTool.h b/isis/src/qisis/objs/MeasureTool/MeasureTool.h index 2884635747..82a87a3d69 100644 --- a/isis/src/qisis/objs/MeasureTool/MeasureTool.h +++ b/isis/src/qisis/objs/MeasureTool/MeasureTool.h @@ -10,14 +10,11 @@ #include "IString.h" +class QComboBox; class QDialog; class QMenu; class QLineEdit; -class QComboBox; - -namespace Isis { - class IString; -} +class QString; namespace Isis { class MdiCubeViewport; @@ -172,8 +169,8 @@ namespace Isis { int m_numLinked;//!< number of linked viewports - IString m_path;//!< filename path - IString m_fname;//!< filename + QString m_path;//!< filename path + QString m_fname;//!< filename TableMainWindow *m_tableWin;//!< table window RubberBandComboBox *m_rubberBand;//!< rubberband combo box diff --git a/isis/src/qisis/objs/MosaicFileList/MosaicFileListWidget.cpp b/isis/src/qisis/objs/MosaicFileList/MosaicFileListWidget.cpp index e9f4e03f53..16788dd3ab 100644 --- a/isis/src/qisis/objs/MosaicFileList/MosaicFileListWidget.cpp +++ b/isis/src/qisis/objs/MosaicFileList/MosaicFileListWidget.cpp @@ -55,7 +55,7 @@ namespace Isis { IString key = MosaicTreeWidgetItem::treeColumnToString(col) + "Visible"; key = key.Convert(" ", '_'); - bool visible = (int)pvl[key][0]; + bool visible = toBool(pvl[key][0]); if(visible) { p_tree->showColumn(col); @@ -85,7 +85,7 @@ namespace Isis { for(int cubeGrp = 0; cubeGrp < pvl.Objects(); cubeGrp ++) { PvlObject &cubes = pvl.Object(cubeGrp); - QTreeWidgetItem *newCubeGrp = p_tree->addGroup(cubes.Name().c_str()); + QTreeWidgetItem *newCubeGrp = p_tree->addGroup(cubes.Name()); if (cubes.HasKeyword("Expanded")) { bool expanded = (cubes["Expanded"][0] != "No"); @@ -96,7 +96,7 @@ namespace Isis { cubeFileNameIndex < cubes.Keywords(); cubeFileNameIndex ++) { if (cubes[cubeFileNameIndex].IsNamed("Cube")) { - IString cubeFileName = cubes[cubeFileNameIndex][0]; + QString cubeFileName = cubes[cubeFileNameIndex][0]; newCubeGrp->addChild(takeItem(cubeFileName, allCubes)); } } @@ -123,21 +123,21 @@ namespace Isis { MosaicTreeWidgetItem::TreeColumn col = MosaicTreeWidgetItem::FootprintColumn; while(col < MosaicTreeWidgetItem::BlankColumn) { - IString key = MosaicTreeWidgetItem::treeColumnToString(col) + "Visible"; - key = key.Convert(" ", '_'); + QString key = MosaicTreeWidgetItem::treeColumnToString(col) + "Visible"; + key = key.replace(" ", "_"); bool visible = !p_tree->isColumnHidden(col); - output += PvlKeyword(key, visible); + output += PvlKeyword(key, toString(visible)); col = (MosaicTreeWidgetItem::TreeColumn)(col + 1); } - output += PvlKeyword("SortColumn", p_tree->sortColumn()); + output += PvlKeyword("SortColumn", toString(p_tree->sortColumn())); // Now store groups and the cubes that are in those groups for(int i = 0; i < p_tree->topLevelItemCount(); i++) { QTreeWidgetItem *group = p_tree->topLevelItem(i); PvlObject cubeGroup( - group->text(MosaicTreeWidgetItem::NameColumn).toStdString()); + group->text(MosaicTreeWidgetItem::NameColumn)); cubeGroup += PvlKeyword("Expanded", group->isExpanded() ? "Yes" : "No"); for(int j = 0; j < group->childCount(); j++) { @@ -257,7 +257,7 @@ namespace Isis { QString("List File (*.lis);;Text File (*.txt);;All Files (*.*)")); if(output.isEmpty()) return; - TextFile file(output.toStdString(), "overwrite"); + TextFile file(output, "overwrite"); for(int i = 0; i < p_tree->topLevelItemCount(); i++) { QTreeWidgetItem *group = p_tree->topLevelItem(i); @@ -267,7 +267,7 @@ namespace Isis { if(item->type() == QTreeWidgetItem::UserType) { MosaicTreeWidgetItem *cubeItem = (MosaicTreeWidgetItem *)item; - file.PutLine(cubeItem->cubeDisplay()->fileName().toStdString()); + file.PutLine(cubeItem->cubeDisplay()->fileName()); } } } diff --git a/isis/src/qisis/objs/MosaicMainWindow/MosaicController.cpp b/isis/src/qisis/objs/MosaicMainWindow/MosaicController.cpp index bef53b41d0..6a2b334541 100644 --- a/isis/src/qisis/objs/MosaicMainWindow/MosaicController.cpp +++ b/isis/src/qisis/objs/MosaicMainWindow/MosaicController.cpp @@ -131,7 +131,7 @@ namespace Isis { projFile += p_fileList->toPvl(); projFile += p_scene->toPvl(); - projFile.Write(projFileName.toStdString()); + projFile.Write(projFileName); } @@ -206,7 +206,7 @@ namespace Isis { const QString &filename) { try { CubeDisplayProperties *prop = new CubeDisplayProperties( - QString(FileName(filename.toStdString()).expanded().c_str()), + QString(FileName(filename).expanded()), m_mutex); prop->setShowFill(m_openFilled); @@ -463,7 +463,7 @@ namespace Isis { void MosaicController::readProject(QString filename) { try { - m_projectPvl = new Pvl(filename.toStdString()); + m_projectPvl = new Pvl(filename); PvlObject &cubes(m_projectPvl->FindObject("Cubes")); QList cubesList; @@ -494,11 +494,11 @@ namespace Isis { QString("List File (*.lis);;Text File (*.txt);;All Files (*.*)")); if(output.isEmpty()) return; - TextFile file(output.toStdString(), "output"); + TextFile file(output, "output"); CubeDisplayProperties *cube; foreach(cube, p_cubes) { - file.PutLine( cube->fileName().toStdString() ); + file.PutLine( cube->fileName() ); } } diff --git a/isis/src/qisis/objs/MosaicMainWindow/MosaicMainWindow.cpp b/isis/src/qisis/objs/MosaicMainWindow/MosaicMainWindow.cpp index 0d2cf9fd59..d90ec89130 100644 --- a/isis/src/qisis/objs/MosaicMainWindow/MosaicMainWindow.cpp +++ b/isis/src/qisis/objs/MosaicMainWindow/MosaicMainWindow.cpp @@ -19,7 +19,7 @@ namespace Isis { MosaicMainWindow::MosaicMainWindow(QString title, QWidget *parent) : MainWindow(title, parent), - m_settings(FileName("$HOME/.Isis/qmos/qmos.config").expanded().c_str(), + m_settings(FileName("$HOME/.Isis/qmos/qmos.config").expanded(), QSettings::NativeFormat) { m_filename = ""; m_fileMenu = NULL; @@ -104,8 +104,8 @@ namespace Isis { filesToOpen.append(argument); } else if (cubeListName.exactMatch(argument)) { - TextFile fileList(argument.toStdString()); - IString line; + TextFile fileList(argument); + QString line; while(fileList.GetLine(line)) { filesToOpen.append(line); @@ -611,10 +611,10 @@ namespace Isis { if (selected != "") { m_lastOpenedFile = QFileInfo(selected); - TextFile fileList((IString) selected); + TextFile fileList((QString) selected); QStringList filesInList; - IString line; + QString line; while(fileList.GetLine(line)) { filesInList.append(line); diff --git a/isis/src/qisis/objs/MosaicMainWindow/MosaicMainWindow.h b/isis/src/qisis/objs/MosaicMainWindow/MosaicMainWindow.h index c72d287f15..888ed84d9c 100644 --- a/isis/src/qisis/objs/MosaicMainWindow/MosaicMainWindow.h +++ b/isis/src/qisis/objs/MosaicMainWindow/MosaicMainWindow.h @@ -5,14 +5,12 @@ #include "MainWindow.h" -namespace Isis { - class ToolPad; -} +class QString; namespace Isis { class Cube; - class IString; class MosaicController; + class ToolPad; /** * @brief diff --git a/isis/src/qisis/objs/MosaicSceneWidget/ControlNetGraphicsItem.cpp b/isis/src/qisis/objs/MosaicSceneWidget/ControlNetGraphicsItem.cpp index cdc638865d..1414de0738 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/ControlNetGraphicsItem.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/ControlNetGraphicsItem.cpp @@ -135,7 +135,7 @@ namespace Isis { if(filename.size() > 0) { if((*m_cubeToGroundMap)[filename] == NULL) { - Pvl label(FileName(filename.toStdString()).expanded()); + Pvl label(FileName(filename).expanded()); UniversalGroundMap *groundMap = new UniversalGroundMap(label); (*m_cubeToGroundMap)[filename] = groundMap; } @@ -182,8 +182,7 @@ namespace Isis { if(m_serialNumbers && m_serialNumbers->Size()) { try { - result = QString::fromStdString( - m_serialNumbers->FileName(sn.toStdString())); + result = m_serialNumbers->FileName(sn); } catch(IException &) { } @@ -232,7 +231,7 @@ namespace Isis { QString filename; foreach(filename, cubeFiles) { try { - m_serialNumbers->Add(filename.toStdString()); + m_serialNumbers->Add(filename); } catch(IException &) { } diff --git a/isis/src/qisis/objs/MosaicSceneWidget/ControlPointGraphicsItem.cpp b/isis/src/qisis/objs/MosaicSceneWidget/ControlPointGraphicsItem.cpp index 631722fc01..930f4e6ff1 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/ControlPointGraphicsItem.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/ControlPointGraphicsItem.cpp @@ -8,6 +8,7 @@ #include #include +#include "Constants.h" #include "ControlPoint.h" #include "FileName.h" #include "MosaicGraphicsView.h" @@ -111,7 +112,7 @@ namespace Isis { QMenu menu; QAction *title = menu.addAction( - QString::fromStdString(m_controlPoint->GetId())); + m_controlPoint->GetId()); title->setEnabled(false); menu.addSeparator(); @@ -209,9 +210,9 @@ namespace Isis { QString ControlPointGraphicsItem::makeToolTip(SerialNumberList *snList) { QString toolTip = "Point ID: " + - QString::fromStdString(m_controlPoint->GetId()); + m_controlPoint->GetId(); toolTip += "\nPoint Type: " + - QString::fromStdString(m_controlPoint->GetPointTypeString()); + m_controlPoint->GetPointTypeString(); toolTip += "\nNumber of Measures: "; toolTip += QString::number(m_controlPoint->GetNumMeasures()); toolTip += "\nIgnored: "; @@ -234,7 +235,7 @@ namespace Isis { if(snList->HasSerialNumber(serialNum)) { toolTip += - FileName(snList->FileName(serialNum.toStdString())).name().ToQt(); + FileName(snList->FileName(serialNum)).name(); toolTip += " (" + serialNum + ")"; } else { diff --git a/isis/src/qisis/objs/MosaicSceneWidget/GridGraphicsItem.cpp b/isis/src/qisis/objs/MosaicSceneWidget/GridGraphicsItem.cpp index c190810481..fd1a4866dd 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/GridGraphicsItem.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/GridGraphicsItem.cpp @@ -40,8 +40,8 @@ namespace Isis { if (mappingGroup["LatitudeType"][0] == "Planetographic") { - Distance equaRad(proj->Mapping()["EquatorialRadius"][0].ToDouble(), Distance::Meters); - Distance polRad(proj->Mapping()["PolarRadius"][0].ToDouble(), Distance::Meters); + Distance equaRad(toDouble(proj->Mapping()["EquatorialRadius"][0]), Distance::Meters); + Distance polRad(toDouble(proj->Mapping()["PolarRadius"][0]), Distance::Meters); minLat = Latitude(latMin.planetographic(Angle::Degrees), mappingGroup, Angle::Degrees); diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicAreaTool.cpp b/isis/src/qisis/objs/MosaicSceneWidget/MosaicAreaTool.cpp index 9abad9f6b8..47a0f036b6 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicAreaTool.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicAreaTool.cpp @@ -287,7 +287,7 @@ namespace Isis { obj += PvlKeyword("Latitude", m_latLineEdit->text()); obj += PvlKeyword("Longitude", m_lonLineEdit->text()); obj += PvlKeyword("Area", m_areaLineEdit->text()); - obj += PvlKeyword("Visible", (m_box != NULL)); + obj += PvlKeyword("Visible", toString((m_box != NULL))); } return obj; @@ -305,14 +305,14 @@ namespace Isis { if(obj.HasKeyword("Area") && obj["Area"][0] != "Null") m_areaLineEdit->setText(obj["Area"][0]); - if((int)obj["Visible"][0] != 0) { + if(toBool(obj["Visible"][0]) != false) { userChangedBox(); } } } - IString MosaicAreaTool::projectPvlObjectName() const { + QString MosaicAreaTool::projectPvlObjectName() const { return "MosaicAreaTool"; } diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicAreaTool.h b/isis/src/qisis/objs/MosaicSceneWidget/MosaicAreaTool.h index e0be5f75ba..8c9e21d751 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicAreaTool.h +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicAreaTool.h @@ -33,7 +33,7 @@ namespace Isis { PvlObject toPvl() const; void fromPvl(const PvlObject &obj); - IString projectPvlObjectName() const; + QString projectPvlObjectName() const; protected: QAction *getPrimaryAction(); diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicControlNetTool.cpp b/isis/src/qisis/objs/MosaicSceneWidget/MosaicControlNetTool.cpp index 4d4a851578..4e70de503a 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicControlNetTool.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicControlNetTool.cpp @@ -128,27 +128,27 @@ namespace Isis { obj += PvlKeyword("FileName", m_controlNetFile); obj += PvlKeyword("Visible", - m_controlNetGraphics && m_controlNetGraphics->isVisible()); + toString(m_controlNetGraphics && m_controlNetGraphics->isVisible())); return obj; } void MosaicControlNetTool::fromPvl(const PvlObject &obj) { - m_controlNetFile = QString::fromStdString(obj["FileName"][0]); + m_controlNetFile = obj["FileName"][0]; if (m_controlNetFile == "Null") m_controlNetFile = ""; loadNetwork(); if (m_controlNetGraphics && m_displayControlNetButton) { - m_displayControlNetButton->setChecked( (int)obj["Visible"][0] ); + m_displayControlNetButton->setChecked( toBool(obj["Visible"][0]) ); displayControlNet(); } } - IString MosaicControlNetTool::projectPvlObjectName() const { + QString MosaicControlNetTool::projectPvlObjectName() const { return "MosaicControlNetTool"; } @@ -367,8 +367,8 @@ namespace Isis { // for each mosaic item //--------------------------------------------------------------- if (!netFile.isEmpty()) { - FileName controlNetFile(netFile.toStdString()); - m_controlNetFile = QString::fromStdString(controlNetFile.expanded()); + FileName controlNetFile(netFile); + m_controlNetFile = controlNetFile.expanded(); loadNetwork(); if (m_displayControlNetButton) @@ -390,7 +390,7 @@ namespace Isis { if (m_controlNetFile.size() > 0) { try { m_controlNet = new ControlNet( - m_controlNetFile.toStdString()); + m_controlNetFile); m_controlNetGraphics = new ControlNetGraphicsItem(m_controlNet, getWidget()); connect(m_controlNetGraphics, SIGNAL(destroyed(QObject *)), @@ -398,7 +398,7 @@ namespace Isis { } catch(IException &e) { QString message = "Invalid control network.\n"; - message += e.toString().ToQt(); + message += e.toString(); QMessageBox::information(getWidget(), "Error", message); return; } diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicControlNetTool.h b/isis/src/qisis/objs/MosaicSceneWidget/MosaicControlNetTool.h index 5557e02dcf..9258912453 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicControlNetTool.h +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicControlNetTool.h @@ -41,7 +41,7 @@ namespace Isis { PvlObject toPvl() const; void fromPvl(const PvlObject &obj); - IString projectPvlObjectName() const; + QString projectPvlObjectName() const; public slots: diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicFindTool.cpp b/isis/src/qisis/objs/MosaicSceneWidget/MosaicFindTool.cpp index e85b3b8423..7d85ea3d5c 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicFindTool.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicFindTool.cpp @@ -167,7 +167,7 @@ namespace Isis { obj += PvlKeyword("Latitude", p_latLineEdit->text()); obj += PvlKeyword("Longitude", p_lonLineEdit->text()); - obj += PvlKeyword("Visible", (p_findSpot != NULL)); + obj += PvlKeyword("Visible", toString(p_findSpot != NULL)); return obj; } @@ -176,13 +176,13 @@ namespace Isis { void MosaicFindTool::fromPvl(const PvlObject &obj) { p_latLineEdit->setText(obj["Latitude"][0]); p_lonLineEdit->setText(obj["Longitude"][0]); - if((int)obj["Visible"][0] != 0) { + if(toBool(obj["Visible"][0])) { getUserGroundPoint(); } } - IString MosaicFindTool::projectPvlObjectName() const { + QString MosaicFindTool::projectPvlObjectName() const { return "MosaicFindTool"; } diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicFindTool.h b/isis/src/qisis/objs/MosaicSceneWidget/MosaicFindTool.h index 1c3897651f..cfe9f54cbd 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicFindTool.h +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicFindTool.h @@ -35,7 +35,7 @@ namespace Isis { PvlObject toPvl() const; void fromPvl(const PvlObject &obj); - IString projectPvlObjectName() const; + QString projectPvlObjectName() const; protected slots: void updateTool(); diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicGridTool.cpp b/isis/src/qisis/objs/MosaicSceneWidget/MosaicGridTool.cpp index 6bd30b3b84..14a44962b8 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicGridTool.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicGridTool.cpp @@ -138,7 +138,7 @@ namespace Isis { QString MosaicGridTool::latType() { QString result; if (getWidget()->getProjection()) - result = QString::fromStdString(getWidget()->getProjection()->LatitudeTypeString()); + result = getWidget()->getProjection()->LatitudeTypeString(); return result; } @@ -151,7 +151,7 @@ namespace Isis { QString MosaicGridTool::lonDomain() { QString result; if (getWidget()->getProjection()) - result = QString::fromStdString(getWidget()->getProjection()->LongitudeDomainString()); + result = getWidget()->getProjection()->LongitudeDomainString(); return result; } @@ -292,9 +292,9 @@ namespace Isis { if (proj) { PvlGroup mappingGroup(proj->Mapping()); - Distance equatorialRadius(proj->Mapping()["EquatorialRadius"][0].ToDouble(), + Distance equatorialRadius(toDouble(proj->Mapping()["EquatorialRadius"][0]), Distance::Meters); - Distance polarRadius(proj->Mapping()["PolarRadius"][0].ToDouble(), Distance::Meters); + Distance polarRadius(toDouble(proj->Mapping()["PolarRadius"][0]), Distance::Meters); QRectF boundingRect = getWidget()->cubesBoundingRect(); @@ -523,59 +523,59 @@ namespace Isis { if (getWidget()->getProjection()) { Distance equatorialRadius( - getWidget()->getProjection()->Mapping()["EquatorialRadius"][0].ToDouble(), + toDouble(getWidget()->getProjection()->Mapping()["EquatorialRadius"][0]), Distance::Meters); Distance polarRadius( - getWidget()->getProjection()->Mapping()["PolarRadius"][0].ToDouble(), + toDouble(getWidget()->getProjection()->Mapping()["PolarRadius"][0]), Distance::Meters); if (obj["BaseLatitude"][0] != "Null") - m_baseLat = Latitude(obj["BaseLatitude"][0].ToDouble(), equatorialRadius, polarRadius, + m_baseLat = Latitude(toDouble(obj["BaseLatitude"][0]), equatorialRadius, polarRadius, Latitude::Planetocentric, Angle::Degrees); if (obj["BaseLongitude"][0] != "Null") - m_baseLon = Longitude(obj["BaseLongitude"][0].ToDouble(), Angle::Degrees); + m_baseLon = Longitude(toDouble(obj["BaseLongitude"][0]), Angle::Degrees); if (obj["LatitudeIncrement"][0] != "Null") - m_latInc = Angle(obj["LatitudeIncrement"][0].ToDouble(), Angle::Degrees); + m_latInc = Angle(toDouble(obj["LatitudeIncrement"][0]), Angle::Degrees); if (obj["LongitudeIncrement"][0] != "Null") - m_lonInc = Angle(obj["LongitudeIncrement"][0].ToDouble(), Angle::Degrees); + m_lonInc = Angle(toDouble(obj["LongitudeIncrement"][0]), Angle::Degrees); if (obj.HasKeyword("LatitudeExtentType")) { if (obj["LatitudeExtentType"][0] != "Null") - m_latExtents = (GridExtentSource)obj["LatitudeExtentType"][0].ToInteger(); + m_latExtents = (GridExtentSource)toInt(obj["LatitudeExtentType"][0]); } if (obj.HasKeyword("MinimumLatitude")) { if (obj["MinimumLatitude"][0] != "Null") - m_minLat = Latitude(obj["MinimumLatitude"][0].ToDouble(), equatorialRadius, polarRadius, + m_minLat = Latitude(toDouble(obj["MinimumLatitude"][0]), equatorialRadius, polarRadius, Latitude::Planetocentric, Angle::Degrees); } if (obj.HasKeyword("MaximumLatitude")) { if (obj["MaximumLatitude"][0] != "Null") - m_maxLat = Latitude(obj["MaximumLatitude"][0].ToDouble(), equatorialRadius, polarRadius, + m_maxLat = Latitude(toDouble(obj["MaximumLatitude"][0]), equatorialRadius, polarRadius, Latitude::Planetocentric, Angle::Degrees); } if (obj.HasKeyword("LongitudeExtentType")) { if (obj["LongitudeExtentType"][0] != "Null") - m_lonExtents = (GridExtentSource)obj["LongitudeExtentType"][0].ToInteger(); + m_lonExtents = (GridExtentSource)toInt(obj["LongitudeExtentType"][0]); } if (obj.HasKeyword("MinimumLongitude")) { if (obj["MinimumLongitude"][0] != "Null") - m_minLon = Longitude(obj["MinimumLongitude"][0].ToDouble(), Angle::Degrees); + m_minLon = Longitude(toDouble(obj["MinimumLongitude"][0]), Angle::Degrees); } if (obj.HasKeyword("MaximumLongitude")) { if (obj["MaximumLongitude"][0] != "Null") - m_maxLon = Longitude(obj["MaximumLongitude"][0].ToDouble(), Angle::Degrees); + m_maxLon = Longitude(toDouble(obj["MaximumLongitude"][0]), Angle::Degrees); } if (obj["Density"][0] != "Null") - m_density = obj["Density"][0].ToDouble(); + m_density = toDouble(obj["Density"][0]); if (obj.HasKeyword("CheckTheBoxes")) { @@ -584,7 +584,7 @@ namespace Isis { } } - if((int)obj["Visible"][0] != 0) { + if(toBool(obj["Visible"][0])) { drawGrid(); } } @@ -596,7 +596,7 @@ namespace Isis { * * @return The name in string form. */ - IString MosaicGridTool::projectPvlObjectName() const { + QString MosaicGridTool::projectPvlObjectName() const { return "MosaicGridTool"; } @@ -609,24 +609,24 @@ namespace Isis { PvlObject MosaicGridTool::toPvl() const { PvlObject obj(projectPvlObjectName()); - obj += PvlKeyword("ShouleCheckBoxes", m_shouldCheckBoxes); + obj += PvlKeyword("ShouldCheckBoxes", toString(m_shouldCheckBoxes)); - obj += PvlKeyword("BaseLatitude", m_baseLat.degrees()); - obj += PvlKeyword("BaseLongitude", m_baseLon.degrees()); + obj += PvlKeyword("BaseLatitude", toString(m_baseLat.degrees())); + obj += PvlKeyword("BaseLongitude", toString(m_baseLon.degrees())); - obj += PvlKeyword("LatitudeIncrement", m_latInc.degrees()); - obj += PvlKeyword("LongitudeIncrement", m_lonInc.degrees()); + obj += PvlKeyword("LatitudeIncrement", toString(m_latInc.degrees())); + obj += PvlKeyword("LongitudeIncrement", toString(m_lonInc.degrees())); - obj += PvlKeyword("LatitudeExtentType", m_latExtents); - obj += PvlKeyword("MaximumLatitude", m_maxLat.degrees()); - obj += PvlKeyword("MinimumLongitude", m_minLon.degrees()); + obj += PvlKeyword("LatitudeExtentType", toString(m_latExtents)); + obj += PvlKeyword("MaximumLatitude", toString(m_maxLat.degrees())); + obj += PvlKeyword("MinimumLongitude", toString(m_minLon.degrees())); - obj += PvlKeyword("LongitudeExtentType", m_lonExtents); - obj += PvlKeyword("MinimumLatitude", m_minLat.degrees()); - obj += PvlKeyword("MaximumLongitude", m_maxLon.degrees()); + obj += PvlKeyword("LongitudeExtentType", toString(m_lonExtents)); + obj += PvlKeyword("MinimumLatitude", toString(m_minLat.degrees())); + obj += PvlKeyword("MaximumLongitude", toString(m_maxLon.degrees())); - obj += PvlKeyword("Density", m_density); - obj += PvlKeyword("Visible", (m_gridItem != NULL)); + obj += PvlKeyword("Density", toString(m_density)); + obj += PvlKeyword("Visible", toString((m_gridItem))); return obj; } diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicGridTool.h b/isis/src/qisis/objs/MosaicSceneWidget/MosaicGridTool.h index 146a104bc4..358294333c 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicGridTool.h +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicGridTool.h @@ -95,7 +95,7 @@ namespace Isis { //Processors void fromPvl(const PvlObject &obj); - IString projectPvlObjectName() const; + QString projectPvlObjectName() const; PvlObject toPvl() const; signals: diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicSceneWidget.cpp b/isis/src/qisis/objs/MosaicSceneWidget/MosaicSceneWidget.cpp index 50aa7ada22..f72819201c 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicSceneWidget.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicSceneWidget.cpp @@ -160,7 +160,7 @@ namespace Isis { if(m_mapAction) { PvlKeyword projectionKeyword = mapping.FindKeyword("ProjectionName"); - QString projName = QString::fromStdString(projectionKeyword[0]); + QString projName = projectionKeyword[0]; m_mapAction->setText(projName); } @@ -228,9 +228,9 @@ namespace Isis { cam->radii(radii); mappingGrp += PvlKeyword("TargetName", cam->target()->name()); - mappingGrp += PvlKeyword("EquatorialRadius", radii[0].meters(), + mappingGrp += PvlKeyword("EquatorialRadius", toString(radii[0].meters()), "meters"); - mappingGrp += PvlKeyword("PolarRadius", radii[2].meters(), + mappingGrp += PvlKeyword("PolarRadius", toString(radii[2].meters()), "meters"); } @@ -277,7 +277,7 @@ namespace Isis { if(m_projection) { PvlKeyword projectionKeyword = m_projection->Mapping().FindKeyword("ProjectionName"); - QString projName = QString::fromStdString(projectionKeyword[0]); + QString projName = projectionKeyword[0]; m_mapAction->setText(projName); } } @@ -360,8 +360,8 @@ namespace Isis { mosaicScenePosition += PvlKeyword("ViewTransform", QString(dataBuffer.data().toHex())); PvlKeyword scrollPos("ScrollPosition"); - scrollPos += getView()->horizontalScrollBar()->value(); - scrollPos += getView()->verticalScrollBar()->value(); + scrollPos += toString(getView()->horizontalScrollBar()->value()); + scrollPos += toString(getView()->verticalScrollBar()->value()); mosaicScenePosition += scrollPos; output += mosaicScenePosition; @@ -378,8 +378,8 @@ namespace Isis { PvlObject zOrders("ZOrdering"); foreach(MosaicSceneItem * mosaicSceneItem, *m_mosaicSceneItems) { PvlKeyword zValue("ZValue"); - zValue += (IString)mosaicSceneItem->cubeDisplay()->fileName(); - zValue += mosaicSceneItem->zValue(); + zValue += mosaicSceneItem->cubeDisplay()->fileName(); + zValue += toString(mosaicSceneItem->zValue()); zOrders += zValue; } @@ -429,7 +429,7 @@ namespace Isis { (*m_mosaicSceneItems)[itemIndex]; if (mosaicSceneItem->cubeDisplay()->fileName() == filenameToFind) { - mosaicSceneItem->setZValue(zOrder[1]); + mosaicSceneItem->setZValue(toDouble(zOrder[1])); found = true; } } @@ -440,7 +440,7 @@ namespace Isis { const PvlObject &positionInfo = project.FindObject("SceneVisiblePosition"); - QByteArray hexValues(positionInfo["ViewTransform"][0].c_str()); + QByteArray hexValues(positionInfo["ViewTransform"][0].toAscii()); QDataStream transformStream(QByteArray::fromHex(hexValues)); QTransform viewTransform; @@ -448,9 +448,9 @@ namespace Isis { getView()->setTransform(viewTransform); getView()->horizontalScrollBar()->setValue( - positionInfo["ScrollPosition"][0]); + toDouble(positionInfo["ScrollPosition"][0])); getView()->verticalScrollBar()->setValue( - positionInfo["ScrollPosition"][1]); + toDouble(positionInfo["ScrollPosition"][1])); } } } @@ -1007,14 +1007,14 @@ namespace Isis { QString("List File (*.lis);;Text File (*.txt);;All Files (*.*)")); if(output.isEmpty()) return; - TextFile file(output.toStdString(), "overwrite"); + TextFile file(output, "overwrite"); QList sorted = *m_mosaicSceneItems; qSort(sorted.begin(), sorted.end(), zOrderGreaterThan); MosaicSceneItem *sceneItem; foreach(sceneItem, sorted) { - file.PutLine( sceneItem->cubeDisplay()->fileName().toStdString() ); + file.PutLine( sceneItem->cubeDisplay()->fileName() ); } } @@ -1044,13 +1044,13 @@ namespace Isis { try { PvlGroup mapping(m_projection->Mapping()); PvlKeyword minLatKeyword = mapping.FindKeyword("MinimumLatitude"); - Latitude minLat(minLatKeyword[0], mapping, Angle::Degrees); + Latitude minLat(toDouble(minLatKeyword[0]), mapping, Angle::Degrees); PvlKeyword minLonKeyword = mapping.FindKeyword("MinimumLongitude"); - Longitude minLon(minLonKeyword[0], mapping, Angle::Degrees); + Longitude minLon(toDouble(minLonKeyword[0]), mapping, Angle::Degrees); PvlKeyword maxLatKeyword = mapping.FindKeyword("MaximumLatitude"); - Latitude maxLat(maxLatKeyword[0], mapping, Angle::Degrees); + Latitude maxLat(toDouble(maxLatKeyword[0]), mapping, Angle::Degrees); PvlKeyword maxLonKeyword = mapping.FindKeyword("MaximumLongitude"); - Longitude maxLon(maxLonKeyword[0], mapping, Angle::Degrees); + Longitude maxLon(toDouble(maxLonKeyword[0]), mapping, Angle::Degrees); Angle increment(1, Angle::Degrees); if(m_projection->SetUniversalGround(minLat.degrees(), @@ -1112,9 +1112,8 @@ namespace Isis { } catch(IException &e) { - std::string msg = e.toString(); - QMessageBox::information(this, "Error", QString::fromStdString(msg), - QMessageBox::Ok); + QString msg = e.toString(); + QMessageBox::information(this, "Error", msg, QMessageBox::Ok); //m_showReference->setChecked(Qt::Unchecked); return; } @@ -1160,35 +1159,35 @@ namespace Isis { try { Pvl pvl; - pvl.Read(mapFile.toStdString()); + pvl.Read(mapFile); PvlGroup &mapping = pvl.FindGroup("Mapping", Pvl::Traverse); if(!mapping.HasKeyword("MinimumLatitude")) - mapping += PvlKeyword("MinimumLatitude", -90); + mapping += PvlKeyword("MinimumLatitude", toString(-90)); if(!mapping.HasKeyword("MaximumLatitude")) - mapping += PvlKeyword("MaximumLatitude", 90); + mapping += PvlKeyword("MaximumLatitude", toString(90)); if(!mapping.HasKeyword("MinimumLongitude")) { if(mapping["LongitudeDomain"][0] == "360") mapping += PvlKeyword("MinimumLongitude", 0); else - mapping += PvlKeyword("MinimumLongitude", -180); + mapping += PvlKeyword("MinimumLongitude", toString(-180)); } if(!mapping.HasKeyword("MaximumLongitude")) { if(mapping["LongitudeDomain"][0] == "360") - mapping += PvlKeyword("MaximumLongitude", 360); + mapping += PvlKeyword("MaximumLongitude", toString(360)); else - mapping += PvlKeyword("MaximumLongitude", 180); + mapping += PvlKeyword("MaximumLongitude", toString(180)); } setProjection(mapping); } catch(IException &e) { - std::string msg = e.toString(); - QMessageBox::information(this, "Error", QString::fromStdString(msg), QMessageBox::Ok); + QString msg = e.toString(); + QMessageBox::information(this, "Error", msg, QMessageBox::Ok); return; } } diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicTool.cpp b/isis/src/qisis/objs/MosaicSceneWidget/MosaicTool.cpp index ab5fa2ac1c..eb7e38267b 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicTool.cpp +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicTool.cpp @@ -106,14 +106,14 @@ namespace Isis { } - IString MosaicTool::projectPvlObjectName() const { + QString MosaicTool::projectPvlObjectName() const { return ""; } - QPixmap MosaicTool::getIcon(IString iconName) const { - IString path = FileName("$base/icons").expanded(); - QString fullPathToFile = IString(path + "/" + iconName); + QPixmap MosaicTool::getIcon(QString iconName) const { + QString path = FileName("$base/icons").expanded(); + QString fullPathToFile = QString(path + "/" + iconName); return QPixmap(fullPathToFile); } diff --git a/isis/src/qisis/objs/MosaicSceneWidget/MosaicTool.h b/isis/src/qisis/objs/MosaicSceneWidget/MosaicTool.h index b167915fb6..a3f3e3743c 100644 --- a/isis/src/qisis/objs/MosaicSceneWidget/MosaicTool.h +++ b/isis/src/qisis/objs/MosaicSceneWidget/MosaicTool.h @@ -12,16 +12,13 @@ class QGraphicsView; class QMenu; class QPixmap; class QPoint; +class QString; class QToolBar; namespace Isis { - class ToolPad; -} - -namespace Isis { - class IString; class MosaicSceneWidget; class PvlObject; + class ToolPad; /** * @brief Base class for the MosaicTools @@ -61,7 +58,7 @@ namespace Isis { * * @return QString */ - QPixmap getIcon(IString iconName) const; + QPixmap getIcon(QString iconName) const; virtual void addTo(QMenu *menu) {} virtual void addTo(ToolPad *toolPad); @@ -71,7 +68,7 @@ namespace Isis { virtual PvlObject toPvl() const; virtual void fromPvl(const PvlObject &obj); - virtual IString projectPvlObjectName() const; + virtual QString projectPvlObjectName() const; signals: void activated(bool); diff --git a/isis/src/qisis/objs/PaletteWindow/PaletteWindow.cpp b/isis/src/qisis/objs/PaletteWindow/PaletteWindow.cpp index 30c072d8bf..1cc2d2da63 100644 --- a/isis/src/qisis/objs/PaletteWindow/PaletteWindow.cpp +++ b/isis/src/qisis/objs/PaletteWindow/PaletteWindow.cpp @@ -12,7 +12,7 @@ namespace Isis { PaletteWindow::PaletteWindow(QWidget *parent) : QMainWindow(parent) { readSettings(); parent->installEventFilter(this); - p_appName = parent->windowTitle().toStdString(); + p_appName = parent->windowTitle(); } @@ -44,9 +44,9 @@ namespace Isis { * */ void PaletteWindow::readSettings() { - std::string instanceName = this->windowTitle().toStdString(); + QString instanceName = this->windowTitle(); FileName config("$HOME/.Isis/" + p_appName + "/" + instanceName + ".config"); - QSettings settings(QString::fromStdString(config.expanded()), QSettings::NativeFormat); + QSettings settings(config.expanded(), QSettings::NativeFormat); QPoint pos = settings.value("pos", QPoint(300, 100)).toPoint(); QSize size = settings.value("size", QSize(900, 500)).toSize(); resize(size); @@ -65,9 +65,9 @@ namespace Isis { visible at the time of closing the application*/ if(!this->isVisible()) return; - std::string instanceName = this->windowTitle().toStdString(); + QString instanceName = this->windowTitle(); FileName config("$HOME/.Isis/" + p_appName + "/" + instanceName + ".config"); - QSettings settings(QString::fromStdString(config.expanded()), QSettings::NativeFormat); + QSettings settings(config.expanded(), QSettings::NativeFormat); settings.setValue("pos", pos()); settings.setValue("size", size()); } diff --git a/isis/src/qisis/objs/PaletteWindow/PaletteWindow.h b/isis/src/qisis/objs/PaletteWindow/PaletteWindow.h index 8f484a816b..48bcf3e7a7 100644 --- a/isis/src/qisis/objs/PaletteWindow/PaletteWindow.h +++ b/isis/src/qisis/objs/PaletteWindow/PaletteWindow.h @@ -25,7 +25,7 @@ namespace Isis { bool eventFilter(QObject *o, QEvent *e); private: - std::string p_appName; //!< Application name. + QString p_appName; //!< Application name. }; diff --git a/isis/src/qisis/objs/PanTool/PanTool.cpp b/isis/src/qisis/objs/PanTool/PanTool.cpp index 39ca8c8b84..6d6b086b36 100644 --- a/isis/src/qisis/objs/PanTool/PanTool.cpp +++ b/isis/src/qisis/objs/PanTool/PanTool.cpp @@ -257,14 +257,14 @@ namespace Isis { void PanTool::writeSettings() { FileName config("$HOME/.Isis/qview/Pan Tool.config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings(config.expanded(), QSettings::NativeFormat); settings.setValue("rate", p_lineEdit->text()); } void PanTool::readSettings() { FileName config("$HOME/.Isis/qview/Pan Tool.config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings(config.expanded(), QSettings::NativeFormat); QString rate = settings.value("rate", "75").toString(); diff --git a/isis/src/qisis/objs/ScatterPlotTool/ScatterPlotWindow.cpp b/isis/src/qisis/objs/ScatterPlotTool/ScatterPlotWindow.cpp index 90afaeaf22..7f33229077 100644 --- a/isis/src/qisis/objs/ScatterPlotTool/ScatterPlotWindow.cpp +++ b/isis/src/qisis/objs/ScatterPlotTool/ScatterPlotWindow.cpp @@ -153,9 +153,9 @@ namespace Isis { replot(); - std::string instanceName = windowTitle().toStdString(); + QString instanceName = windowTitle(); FileName config("$HOME/.Isis/qview/" + instanceName + ".config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings(config.expanded(), QSettings::NativeFormat); m_alarmPlot = settings.value("alarmOntoPlot", true).toBool(); m_alarmViewport = settings.value("alarmOntoViewport", true).toBool(); @@ -179,9 +179,9 @@ namespace Isis { ScatterPlotWindow::~ScatterPlotWindow() { - std::string instanceName = windowTitle().toStdString(); + QString instanceName = windowTitle(); FileName config("$HOME/.Isis/qview/" + instanceName + ".config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings(config.expanded(), QSettings::NativeFormat); settings.setValue("alarmOntoPlot", m_alarmPlot); settings.setValue("alarmOntoViewport", m_alarmViewport); diff --git a/isis/src/qisis/objs/SocketThread/SocketThread.cpp b/isis/src/qisis/objs/SocketThread/SocketThread.cpp index acf9095cf3..bdb30dd78c 100644 --- a/isis/src/qisis/objs/SocketThread/SocketThread.cpp +++ b/isis/src/qisis/objs/SocketThread/SocketThread.cpp @@ -31,7 +31,7 @@ namespace Isis { //! Starts the socket thread void SocketThread::run() { - std::string p_socketFile = "/tmp/isis_qview_" + Application::UserName(); + std::string p_socketFile = ("/tmp/isis_qview_" + Application::UserName()).toAscii().data(); struct sockaddr_un p_socketName; p_socketName.sun_family = AF_UNIX; strcpy(p_socketName.sun_path, p_socketFile.c_str()); diff --git a/isis/src/qisis/objs/SpecialPixelTool/SpecialPixelTool.cpp b/isis/src/qisis/objs/SpecialPixelTool/SpecialPixelTool.cpp index cdfdf07b49..95c991f2c3 100644 --- a/isis/src/qisis/objs/SpecialPixelTool/SpecialPixelTool.cpp +++ b/isis/src/qisis/objs/SpecialPixelTool/SpecialPixelTool.cpp @@ -457,13 +457,13 @@ namespace Isis { */ void SpecialPixelTool::readSettings() { /*Now read the settings that are specific to this window.*/ - std::string appName = p_parent->windowTitle().toStdString(); + QString appName = p_parent->windowTitle(); /*Now read the settings that are specific to this window.*/ - std::string instanceName = p_dialog->windowTitle().toStdString(); + QString instanceName = p_dialog->windowTitle(); FileName config("$HOME/.Isis/" + appName + "/" + instanceName + ".config"); - p_settings = new QSettings(QString::fromStdString(config.expanded()), QSettings::NativeFormat); + p_settings = new QSettings(config.expanded(), QSettings::NativeFormat); //For each special pixel value, if it exists set it, otherwise set //it to the system defaults. @@ -540,14 +540,14 @@ namespace Isis { * */ void SpecialPixelTool::writeSettings() { - std::string appName = p_parent->windowTitle().toStdString(); + QString appName = p_parent->windowTitle(); /*Now read the settings that are specific to this window.*/ - std::string instanceName = p_dialog->windowTitle().toStdString(); + QString instanceName = p_dialog->windowTitle(); //Write all of the special pixel value colors FileName config("$HOME/.Isis/" + appName + "/" + instanceName + ".config"); - QSettings settings(QString::fromStdString(config.expanded()), QSettings::NativeFormat); + QSettings settings(config.expanded(), QSettings::NativeFormat); settings.setValue("defaultNull", p_nullDefault); settings.setValue("defaultLis", p_lisDefault); settings.setValue("defaultLrs", p_lrsDefault); diff --git a/isis/src/qisis/objs/SpectralPlotTool/SpectralPlotTool.cpp b/isis/src/qisis/objs/SpectralPlotTool/SpectralPlotTool.cpp index 4f977a9699..8d1c3b2b8d 100644 --- a/isis/src/qisis/objs/SpectralPlotTool/SpectralPlotTool.cpp +++ b/isis/src/qisis/objs/SpectralPlotTool/SpectralPlotTool.cpp @@ -651,7 +651,7 @@ namespace Isis { if (bandBin.HasKeyword("Center")) { PvlKeyword &wavelength = bandBin.FindKeyword("Center"); if (wavelength.Size() > (band - 1)) { - labels.push_back(wavelength[band-1]); + labels.push_back(toDouble(wavelength[band-1])); } } } diff --git a/isis/src/qisis/objs/SpectralPlotTool/SpectralPlotWindow.cpp b/isis/src/qisis/objs/SpectralPlotTool/SpectralPlotWindow.cpp index fac63da113..9f1bc14428 100644 --- a/isis/src/qisis/objs/SpectralPlotTool/SpectralPlotWindow.cpp +++ b/isis/src/qisis/objs/SpectralPlotTool/SpectralPlotWindow.cpp @@ -120,7 +120,7 @@ namespace Isis { /*This is were we need to set the x value to the band number.*/ if (grayBand > 0) { if (xAxisUnits() == PlotCurve::Wavelength) { - m_grayBandLine->setXValue(wavelengths[grayBand-1]); + m_grayBandLine->setXValue(toDouble(wavelengths[grayBand-1])); } else { m_grayBandLine->setXValue(grayBand); @@ -135,7 +135,7 @@ namespace Isis { if (redBand > 0) { if (xAxisUnits() == PlotCurve::Wavelength) { - m_redBandLine->setXValue(wavelengths[redBand-1]); + m_redBandLine->setXValue(toDouble(wavelengths[redBand-1])); } else { m_redBandLine->setXValue(redBand); @@ -149,7 +149,7 @@ namespace Isis { } if (greenBand > 0) { if (xAxisUnits() == PlotCurve::Wavelength) { - m_greenBandLine->setXValue(wavelengths[greenBand-1]); + m_greenBandLine->setXValue(toDouble(wavelengths[greenBand-1])); } else { m_greenBandLine->setXValue(greenBand); @@ -164,7 +164,7 @@ namespace Isis { if (blueBand > 0) { if (xAxisUnits() == PlotCurve::Wavelength) { - m_blueBandLine->setXValue(wavelengths[blueBand-1]); + m_blueBandLine->setXValue(toDouble(wavelengths[blueBand-1])); } else { m_blueBandLine->setXValue(blueBand); diff --git a/isis/src/qisis/objs/StatisticsTool/StatisticsTool.cpp b/isis/src/qisis/objs/StatisticsTool/StatisticsTool.cpp index 10098421fb..c5d421c0aa 100644 --- a/isis/src/qisis/objs/StatisticsTool/StatisticsTool.cpp +++ b/isis/src/qisis/objs/StatisticsTool/StatisticsTool.cpp @@ -673,7 +673,7 @@ namespace Isis { if (!IsSpecial(dn)) p.drawText(rect, Qt::AlignCenter, QString::number(dn)); else - p.drawText(rect, Qt::AlignCenter, QString::fromStdString(PixelToString(dn))); + p.drawText(rect, Qt::AlignCenter, PixelToString(dn)); } else { p.fillRect(rect, c); @@ -730,7 +730,7 @@ namespace Isis { emit setLine(QString("Line: %1").arg(p_ulLine + y - 1)); double dn = p_pixelData[y-1][x-1]; if(IsSpecial(dn)) - emit setDn(QString("DN: %1").arg(PixelToString(dn).c_str())); + emit setDn(QString("DN: %1").arg(PixelToString(dn))); else emit setDn(QString("DN: %1").arg(dn)); } diff --git a/isis/src/qisis/objs/StereoTool/StereoTool.cpp b/isis/src/qisis/objs/StereoTool/StereoTool.cpp index d4e072bb46..560d24eed6 100644 --- a/isis/src/qisis/objs/StereoTool/StereoTool.cpp +++ b/isis/src/qisis/objs/StereoTool/StereoTool.cpp @@ -604,7 +604,7 @@ namespace Isis { } catch (IException &e) { QString message = "Invalid base radius entered."; - message += e.toString().c_str(); + message += e.toString(); m_radiusLineEdit->setText(""); QMessageBox::critical(m_stereoTool, "Error", message); m_baseRadius = Distance(0., Distance::Meters); @@ -815,8 +815,8 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot initialize universal ground map for " + - QString(m_leftCube->getFileName().c_str()) + ".\n"; - message += e.toString().c_str(); + m_leftCube->getFileName() + ".\n"; + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); return; } @@ -825,8 +825,8 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot initialize universal ground map for" + - QString(m_rightCube->getFileName().c_str()) + ".\n"; - message += e.toString().c_str(); + m_rightCube->getFileName() + ".\n"; + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); return; } @@ -861,7 +861,7 @@ namespace Isis { message += " Longitude = " + QString::number(lon); message += " Radius = " + QString::number(m_targetRadius.meters(), 'f', 6) + "\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); } @@ -893,7 +893,7 @@ namespace Isis { setupFiles(); } catch (IException &e) { - QString message = e.toString().c_str(); + QString message = e.toString(); QMessageBox::critical(m_stereoTool, "Error setting stereo pair", message); RubberBandTool::clear(); return; @@ -903,8 +903,8 @@ namespace Isis { if (cvp == NULL) return; - std::string file = cvp->cube()->getFileName(); - std::string sn; + QString file = cvp->cube()->getFileName(); + QString sn; try { sn = m_serialNumberList->SerialNumber(file); } @@ -935,7 +935,7 @@ namespace Isis { catch (IException &e) { QString message = "No points found for editing. Create points "; message += "using the right mouse button."; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); return; } @@ -971,7 +971,7 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot create control point.\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); m_startPoint = NULL; RubberBandTool::clear(); @@ -997,7 +997,7 @@ namespace Isis { message += "create end points individually using the right mouse "; message += "button. Or, create profile end points by clicking and "; message += "dragging with the right mouse button.\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); m_startPoint = NULL; RubberBandTool::clear(); @@ -1018,7 +1018,7 @@ namespace Isis { message += "create end points individually using the right mouse "; message += "button. Or, create profile end points by clicking and "; message += "dragging with the right mouse button.\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); m_startPoint = NULL; m_endPoint = NULL; @@ -1083,7 +1083,7 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot create control point.\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); delete m_profileDialog; m_profileDialog = NULL; @@ -1120,7 +1120,7 @@ namespace Isis { } catch (IException &e) { QString message = "Cannot create control point.\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); m_startPoint = NULL; delete m_profileDialog; @@ -1216,10 +1216,10 @@ namespace Isis { } else { // Make sure Id doesn't already exist - newPoint = new ControlPoint(id.toStdString()); + newPoint = new ControlPoint(id); if (m_controlNet->GetNumPoints() > 0 && m_controlNet->ContainsPoint(newPoint->GetId())) { - IString message = "A ControlPoint with Point Id = [" + + QString message = "A ControlPoint with Point Id = [" + newPoint->GetId() + "] already exists. Re-enter unique Point Id."; QMessageBox::warning(m_stereoTool, "Unique Point Id", message); @@ -1324,7 +1324,7 @@ namespace Isis { m_rightCube, m_editPoint->GetId()); // Write pointId - IString ptId = "Point ID: " + m_editPoint->GetId(); + QString ptId = "Point ID: " + m_editPoint->GetId(); m_ptIdValue->setText(ptId); updateLabels(); @@ -1333,7 +1333,7 @@ namespace Isis { void StereoTool::paintProfile(MdiCubeViewport *vp, QPainter *painter, - string serialNumber) { + QString serialNumber) { // Draw profile int x1, y1, x2, y2; @@ -1366,11 +1366,11 @@ namespace Isis { if (m_controlNet == NULL || m_controlNet->GetNumPoints() == 0) return; - std::string serialNumber = SerialNumber::Compose(*vp->cube(), true); + QString serialNumber = SerialNumber::Compose(*vp->cube(), true); // If viewport serial number not found in control net, return if (!m_controlNet->GetCubeSerials().contains( - QString::fromStdString(serialNumber))) return; + serialNumber)) return; // Draw profile if it exists // if (m_startPoint != NULL && m_endPoint != NULL) { @@ -1549,12 +1549,12 @@ namespace Isis { // to view and/or edit the template PvlEditDialog registrationDialog(templatePvl); registrationDialog.setWindowTitle("View or Edit Template File: " - + QString::fromStdString(templatePvl.FileName())); + + templatePvl.FileName()); registrationDialog.resize(550, 360); registrationDialog.exec(); } catch (IException &e) { - QString message = e.toString().c_str(); + QString message = e.toString(); QMessageBox::warning(m_stereoTool, "Error", message); } } @@ -1620,7 +1620,7 @@ namespace Isis { for (int i = 0; i < m_controlNet->GetNumPoints(); i++) { ControlPoint &p = *((*m_controlNet)[i]); SurfacePoint apriori = p.GetAprioriSurfacePoint(); - data = QString::fromStdString(p.GetId()) + "," + + data = p.GetId() + "," + QString::number(apriori.GetLatitude().degrees()) + "," + QString::number(apriori.GetLongitude().degrees()) + "," + QString::number(p.GetMeasure(Left)->GetDiameter(), 'f', 6) + @@ -1792,7 +1792,7 @@ namespace Isis { message += " Line = " + QString::number(shortLine); message += "\nImage 2 Sample = " + QString::number(longSamp); message += " Line = " + QString::number(longLine) + "\n\n"; - message += e.toString().c_str(); + message += e.toString(); QMessageBox::critical(m_stereoTool, "Error", message); RubberBandTool::clear(); } @@ -1895,7 +1895,7 @@ namespace Isis { void StereoTool::readSettings() { FileName config("$HOME/.Isis/qview/Stereo Tool.config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings(config.expanded(), QSettings::NativeFormat); m_showWarning = settings.value("showWarning", true).toBool(); @@ -1905,7 +1905,7 @@ namespace Isis { void StereoTool::writeSettings() { FileName config("$HOME/.Isis/qview/Stereo Tool.config"); - QSettings settings(QString::fromStdString(config.expanded()), + QSettings settings(config.expanded(), QSettings::NativeFormat); settings.setValue("showWarning", m_showWarning); diff --git a/isis/src/qisis/objs/StereoTool/StereoTool.h b/isis/src/qisis/objs/StereoTool/StereoTool.h index 40bfb38a8f..ed8cb902cb 100644 --- a/isis/src/qisis/objs/StereoTool/StereoTool.h +++ b/isis/src/qisis/objs/StereoTool/StereoTool.h @@ -100,7 +100,7 @@ namespace Isis { void setFiles(Cube *leftCube, Cube *rightCube); void clearFiles(); void paintProfile(MdiCubeViewport *vp, QPainter *painter, - std::string serialNumber); + QString serialNumber); void calculateElevation(ControlPoint *point); void createMenus(); @@ -146,8 +146,8 @@ namespace Isis { Cube *m_leftCube; Cube *m_rightCube; - std::string m_leftSN; - std::string m_rightSN; + QString m_leftSN; + QString m_rightSN; UniversalGroundMap *m_leftGM; UniversalGroundMap *m_rightGM; diff --git a/isis/src/qisis/objs/StretchTool/AdvancedStretch.h b/isis/src/qisis/objs/StretchTool/AdvancedStretch.h index b76c84b07c..acd80e8f32 100644 --- a/isis/src/qisis/objs/StretchTool/AdvancedStretch.h +++ b/isis/src/qisis/objs/StretchTool/AdvancedStretch.h @@ -8,14 +8,11 @@ class QLayout; class QString; class QColor; -namespace Isis { - class Stretch; - class Histogram; -}; - namespace Isis { class AdvancedStretch; class CubeViewport; + class Histogram; + class Stretch; /** * @brief Advanced Stretch Dialog diff --git a/isis/src/qisis/objs/StretchTool/BinaryStretchType.h b/isis/src/qisis/objs/StretchTool/BinaryStretchType.h index 49e95ff40b..e659f9f7c5 100644 --- a/isis/src/qisis/objs/StretchTool/BinaryStretchType.h +++ b/isis/src/qisis/objs/StretchTool/BinaryStretchType.h @@ -3,17 +3,15 @@ #include "StretchType.h" -namespace Isis { - class Stretch; - class Histogram; -} - -class QSlider; +class QColor; class QLineEdit; +class QSlider; class QString; -class QColor; namespace Isis { + class Histogram; + class Stretch; + /** * @brief This handles the advanced binary stretch * diff --git a/isis/src/qisis/objs/StretchTool/LinearStretchType.h b/isis/src/qisis/objs/StretchTool/LinearStretchType.h index 18f2221ec9..1ca66618ec 100644 --- a/isis/src/qisis/objs/StretchTool/LinearStretchType.h +++ b/isis/src/qisis/objs/StretchTool/LinearStretchType.h @@ -3,17 +3,14 @@ #include "StretchType.h" -namespace Isis { - class Stretch; - class Histogram; -} - -class QSlider; +class QColor; class QLineEdit; +class QSlider; class QString; -class QColor; namespace Isis { + class Histogram; + class Stretch; /** * @brief This handles the advanced linear stretch diff --git a/isis/src/qisis/objs/StretchTool/ManualStretchType.cpp b/isis/src/qisis/objs/StretchTool/ManualStretchType.cpp index 66197cb16c..4ae247c0c5 100644 --- a/isis/src/qisis/objs/StretchTool/ManualStretchType.cpp +++ b/isis/src/qisis/objs/StretchTool/ManualStretchType.cpp @@ -143,8 +143,8 @@ namespace Isis { } } catch (IException &e) { - p_errorMessage->setText(QString::fromStdString( - "" + e.toString() + "")); + p_errorMessage->setText( + "" + e.toString() + ""); } return stretch; diff --git a/isis/src/qisis/objs/StretchTool/SawtoothStretchType.h b/isis/src/qisis/objs/StretchTool/SawtoothStretchType.h index 4ce5623476..1da8bda35b 100644 --- a/isis/src/qisis/objs/StretchTool/SawtoothStretchType.h +++ b/isis/src/qisis/objs/StretchTool/SawtoothStretchType.h @@ -3,17 +3,15 @@ #include "StretchType.h" -namespace Isis { - class Stretch; - class Histogram; -} - -class QSlider; -class QLineEdit; class QColor; +class QLineEdit; +class QSlider; class QString; namespace Isis { + class Stretch; + class Histogram; + /** * @brief This handles the advanced sawtooth stretch * diff --git a/isis/src/qisis/objs/StretchTool/StretchType.cpp b/isis/src/qisis/objs/StretchTool/StretchType.cpp index 057497a43f..2ee369aed0 100644 --- a/isis/src/qisis/objs/StretchTool/StretchType.cpp +++ b/isis/src/qisis/objs/StretchTool/StretchType.cpp @@ -169,7 +169,7 @@ namespace Isis { Stretch stretch = getStretch(); //Add the pairs to the file - stream << stretch.Text().c_str() << endl; + stream << stretch.Text() << endl; outfile.close(); } diff --git a/isis/src/qisis/objs/SunShadowTool/SunShadowTool.cpp b/isis/src/qisis/objs/SunShadowTool/SunShadowTool.cpp index 3c0b32ace7..6f2c976c45 100644 --- a/isis/src/qisis/objs/SunShadowTool/SunShadowTool.cpp +++ b/isis/src/qisis/objs/SunShadowTool/SunShadowTool.cpp @@ -401,8 +401,8 @@ namespace Isis { m_tableWin->table()->item(row, IncidenceAngleRadiansIndex)->setText("N/A"); } - m_tableWin->table()->item(row, PathIndex)->setText(m_path.c_str()); - m_tableWin->table()->item(row, FileNameIndex)->setText(m_fileName.c_str()); + m_tableWin->table()->item(row, PathIndex)->setText(m_path); + m_tableWin->table()->item(row, FileNameIndex)->setText(m_fileName); } @@ -565,11 +565,11 @@ namespace Isis { switch (displayUnits) { case Distance::Meters: m_shadowHeightLineEdit->setText( - IString(m_shadowHeight->meters())); + toString(m_shadowHeight->meters())); break; case Distance::Kilometers: m_shadowHeightLineEdit->setText( - IString(m_shadowHeight->kilometers())); + toString(m_shadowHeight->kilometers())); break; case Distance::Pixels: m_shadowHeightLineEdit->setText("Not Supported"); diff --git a/isis/src/qisis/objs/SunShadowTool/SunShadowTool.h b/isis/src/qisis/objs/SunShadowTool/SunShadowTool.h index 49430a086f..7eea022abe 100644 --- a/isis/src/qisis/objs/SunShadowTool/SunShadowTool.h +++ b/isis/src/qisis/objs/SunShadowTool/SunShadowTool.h @@ -3,20 +3,20 @@ #include "Tool.h" -// FIXME: remove these includes #include -#include "TableMainWindow.h" + #include "IString.h" +#include "TableMainWindow.h" +class QComboBox; class QDialog; -class QMenu; class QLineEdit; -class QComboBox; +class QMenu; +class QString; namespace Isis { class Angle; class Distance; - class IString; class MdiCubeViewport; class SurfacePoint; @@ -129,9 +129,9 @@ namespace Isis { Distance *m_shadowLength; //! Current cube file path - IString m_path; + QString m_path; //! Current cube file name - IString m_fileName; + QString m_fileName; //! Table window for displaying all of the table information TableMainWindow *m_tableWin; diff --git a/isis/src/qisis/objs/TableMainWindow/TableMainWindow.cpp b/isis/src/qisis/objs/TableMainWindow/TableMainWindow.cpp index d634e4e5de..08231ede1e 100644 --- a/isis/src/qisis/objs/TableMainWindow/TableMainWindow.cpp +++ b/isis/src/qisis/objs/TableMainWindow/TableMainWindow.cpp @@ -53,7 +53,7 @@ namespace Isis { setWindowFlags(Qt::Tool); #endif -#if !defined(__APPLE__) +#ifndef __APPLE__ setWindowFlags(Qt::Dialog); #endif diff --git a/isis/src/qisis/objs/Tool/Tool.cpp b/isis/src/qisis/objs/Tool/Tool.cpp index 2ccd60e576..9a88107bf9 100644 --- a/isis/src/qisis/objs/Tool/Tool.cpp +++ b/isis/src/qisis/objs/Tool/Tool.cpp @@ -28,8 +28,8 @@ namespace Isis { p_active = false; p_toolPadAction = NULL; p_toolBarWidget = NULL; - std::string tempFileName = FileName("$base/icons").expanded(); - p_toolIconDir = tempFileName.c_str(); + QString tempFileName = FileName("$base/icons").expanded(); + p_toolIconDir = tempFileName; } diff --git a/isis/src/qisis/objs/WarningWidget/WarningWidget.cpp b/isis/src/qisis/objs/WarningWidget/WarningWidget.cpp index 3f489508b3..0959b9012f 100644 --- a/isis/src/qisis/objs/WarningWidget/WarningWidget.cpp +++ b/isis/src/qisis/objs/WarningWidget/WarningWidget.cpp @@ -20,8 +20,8 @@ namespace Isis { WarningWidget::WarningWidget(QStatusBar *pParent): QObject(pParent) { mSBar = pParent; - std::string sToolIconDir = FileName("$base/icons").expanded(); - QString qsIconFile(sToolIconDir.c_str()); + QString sToolIconDir = FileName("$base/icons").expanded(); + QString qsIconFile(sToolIconDir); // default Action - No warning mNoWarning = new QPushButton(mSBar); diff --git a/isis/src/qisis/objs/Workspace/Workspace.cpp b/isis/src/qisis/objs/Workspace/Workspace.cpp index dabeeb003c..bf66a62cf0 100644 --- a/isis/src/qisis/objs/Workspace/Workspace.cpp +++ b/isis/src/qisis/objs/Workspace/Workspace.cpp @@ -116,12 +116,12 @@ namespace Isis { Cube *cube = new Cube; //Read in the CubeAttribueInput from the cube name - CubeAttributeInput inAtt(cubename.toStdString()); - std::vector bands = inAtt.bands(); + CubeAttributeInput inAtt(cubename); + std::vector bands = inAtt.bands(); //Set the virtual bands to the bands specified by the input cube->setVirtualBands(bands); - cube->open(cubename.toStdString()); + cube->open(cubename); MdiCubeViewport *cvp = addCubeViewport(cube); @@ -173,7 +173,7 @@ namespace Isis { throw IException(e, IException::Programmer, tr("Error when attempting to show cube [%1]") - .arg(cube->getFileName().ToQt()), + .arg(cube->getFileName()), _FILEINFO_); } diff --git a/isis/src/rolo/apps/rolo2isis/rolo2isis.cpp b/isis/src/rolo/apps/rolo2isis/rolo2isis.cpp index c3439a3421..3b02655fd9 100644 --- a/isis/src/rolo/apps/rolo2isis/rolo2isis.cpp +++ b/isis/src/rolo/apps/rolo2isis/rolo2isis.cpp @@ -10,7 +10,7 @@ using namespace Isis; void IsisMain() { UserInterface &ui = Application::GetUserInterface(); - string labelFile = ui.GetFileName("FROM"); + QString labelFile = ui.GetFileName("FROM"); ProcessImportPds p; Pvl label; @@ -19,7 +19,7 @@ void IsisMain() { p.StartProcess(); PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); - IString transDir = (string) dataDir["Rolo"]; + QString transDir = (QString) dataDir["Rolo"]; FileName transFile; Pvl inputLabel(labelFile); diff --git a/isis/src/system/apps/blobdump/blobdump.cpp b/isis/src/system/apps/blobdump/blobdump.cpp index a42627cb99..e6cb3bec4d 100644 --- a/isis/src/system/apps/blobdump/blobdump.cpp +++ b/isis/src/system/apps/blobdump/blobdump.cpp @@ -14,12 +14,12 @@ using namespace std; using namespace Isis; int pos = 0; -string previousFile = ""; +QString previousFile = ""; void helperButtonGetBlobList(); -map GuiHelpers() { - map helper; +map GuiHelpers() { + map helper; helper ["helperButtonGetBlobList"] = (void *) helperButtonGetBlobList; return helper; } @@ -27,8 +27,8 @@ map GuiHelpers() { void IsisMain() { UserInterface &ui = Application::GetUserInterface(); FileName file = ui.GetFileName("FROM"); - string blobname = ui.GetString("NAME"); - string blobtype = ui.GetString("TYPE"); + QString blobname = ui.GetString("NAME"); + QString blobtype = ui.GetString("TYPE"); Blob blob(blobname, blobtype, file.expanded()); FileName outfname = ui.GetFileName("TO"); blob.Write(outfname.expanded()); @@ -36,11 +36,11 @@ void IsisMain() { // Function to find the available blob names/types and put them into the GUI void helperButtonGetBlobList() { - string name, type; + QString name, type; bool match = false; UserInterface &ui = Application::GetUserInterface(); - string currentFile = ui.GetFileName("FROM"); + QString currentFile = ui.GetFileName("FROM"); const Pvl label(FileName(currentFile).expanded()); // Check to see if the "FILE" parameter has changed since last press @@ -57,7 +57,7 @@ void helperButtonGetBlobList() { // If we've gone through all objects and found nothing, throw an exception if(cnt >= label.Objects()) { pos = 0; - string msg = "Parameter [FROM] has no blobs."; + QString msg = "Parameter [FROM] has no blobs."; throw IException(IException::User, msg, _FILEINFO_); } // When the end of the objects is hit, @@ -73,7 +73,7 @@ void helperButtonGetBlobList() { label.Object(pos).HasKeyword("Name") && label.Object(pos).HasKeyword("StartByte") && label.Object(pos).HasKeyword("Bytes")) { - name = label.Object(pos)["Name"][0].c_str(); + name = label.Object(pos)["Name"][0]; type = label.Object(pos).Name(); match = true; pos++; diff --git a/isis/src/system/apps/csspckgen/csspckgen.cpp b/isis/src/system/apps/csspckgen/csspckgen.cpp index 7e7ce3156b..7a7a014c5b 100644 --- a/isis/src/system/apps/csspckgen/csspckgen.cpp +++ b/isis/src/system/apps/csspckgen/csspckgen.cpp @@ -34,7 +34,7 @@ void IsisMain() { PvlGroup dependencies("Dependencies"); FileName lskName("$base/kernels/lsk/naif????.tls"); lskName = lskName.highestVersion(); - IString lskString = lskName.originalPath() + "/" + lskName.name(); + QString lskString = lskName.originalPath() + "/" + lskName.name(); dependencies += PvlKeyword("LeapsecondKernel", lskString); latestMain += dependencies; @@ -54,7 +54,7 @@ void IsisMain() { FileName pckName(keyword[0]); if (pckName.isDateVersioned()) { pckName = pckName.highestVersion(); - IString latestPck = pckName.originalPath() + "/" + pckName.name(); + QString latestPck = pckName.originalPath() + "/" + pckName.name(); // Replace the date-versioned filename with the direct path to the // latest PCK @@ -73,7 +73,7 @@ void IsisMain() { latestMain.AddGroup(group); // Add comment specifying that this PCK is hardcoded for legacy support - IString comment = "This PCK is hardcoded to support versions of " + QString comment = "This PCK is hardcoded to support versions of " "Isis prior to v3.3.2"; latestGroup.AddComment(comment); diff --git a/isis/src/system/apps/dempack/dempack.cpp b/isis/src/system/apps/dempack/dempack.cpp index 69defe9042..efee1bdd76 100644 --- a/isis/src/system/apps/dempack/dempack.cpp +++ b/isis/src/system/apps/dempack/dempack.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -19,8 +19,6 @@ using namespace Isis; using std::endl; using std::ios; using std::ofstream; -using std::string; - void IsisMain() { UserInterface &ui = Application::GetUserInterface(); @@ -32,7 +30,7 @@ void IsisMain() { } else { // If not provided, assume the latest DB file in the data area - string demFile("$base/dems/kernels.????.db"); + QString demFile("$base/dems/kernels.????.db"); dbFileName = FileName(demFile).highestVersion(); } @@ -49,14 +47,14 @@ void IsisMain() { // The third element in the Match keyword describes the DEM target (e.g. // Mars) - QString target = QString::fromStdString(match[2]); + QString target = match[2]; // The first element of the File keyword gives the "mission" associated // with the keyword (currently, always "base"). The second element gives // the path from "base" to the actual DEM cube. - string mission = file[0]; - string area = "$" + file[0]; - string pattern = file[1]; + QString mission = file[0]; + QString area = "$" + file[0]; + QString pattern = file[1]; // Some DEMs are hardcoded, but others are versioned. FileName demFileName(area + "/" + pattern); @@ -70,25 +68,25 @@ void IsisMain() { // If the mission name maps to a data area in the Isis Preferences file, // then replace the variable $MISSION with the path to that area if (dataDir.HasKeyword(mission)) { - area = (string) dataDir[mission]; + area = (QString) dataDir[mission]; } } // Construct the relative path with environment variable placeholders in // tact for outputting to XML - string filePath = area + "/dems/" + demFileName.name(); + QString filePath = area + "/dems/" + demFileName.name(); // Add this filename to the list of DEMs corresponding to its target. If // that list doesn't already exist, create it first. if (!demMap.contains(target)) demMap.insert(target, QList()); - demMap[target].append(QString::fromStdString(filePath)); + demMap[target].append(filePath); } } // Prepare to write out the output XML. FileName outFile = ui.GetFileName("TO"); ofstream os; - os.open(outFile.expanded().c_str(), ios::out); + os.open(outFile.expanded().toAscii().data(), ios::out); // Write the installation XML os << ""; diff --git a/isis/src/system/apps/isiscomplete/isiscomplete.cpp b/isis/src/system/apps/isiscomplete/isiscomplete.cpp index 3a0b8985e7..1d090795f1 100644 --- a/isis/src/system/apps/isiscomplete/isiscomplete.cpp +++ b/isis/src/system/apps/isiscomplete/isiscomplete.cpp @@ -6,9 +6,9 @@ using namespace std; using namespace Isis; -void MakeCompletion(const string &appName); -string GetParamCompletion(int grp, int param); -string BuildStaticCompletes(std::string paramList); +void MakeCompletion(const QString &appName); +QString GetParamCompletion(int grp, int param); +QString BuildStaticCompletes(QString paramList); void PrintHelp(); int main(int argc, char *argv[]) { @@ -33,10 +33,12 @@ void PrintHelp() { cout << "Usage: isiscomplete isisappname [isisappname2 isisappname3 ...]" << endl; } -void MakeCompletion(const string &appName) { +void MakeCompletion(const QString &appName) { char *argv[2] = { 0, 0 }; int argc = 2; - argv[0] = (char *)appName.c_str(); + + QByteArray appNameBytes = appName.toAscii(); + argv[0] = appNameBytes.data(); argv[1] = new char[16]; strcpy(argv[1], "-nogui"); @@ -62,7 +64,7 @@ void MakeCompletion(const string &appName) { } if(appName.compare("isisui") == 0) { - string binPath = FileName("$ISISROOT/bin").expanded(); + QString binPath = FileName("$ISISROOT/bin").expanded(); cout << "complete isisui 'n@*@F:" << binPath << "/@'; "; return; } @@ -72,13 +74,13 @@ void MakeCompletion(const string &appName) { Application app(argc, argv); UserInterface &ui = Application::GetUserInterface(); - string paramList = ""; - string completeCommand; - vector paramDetails; + QString paramList = ""; + QString completeCommand; + vector paramDetails; for(int grp = 0; grp < ui.NumGroups(); grp++) { for(int param = 0; param < ui.NumParams(grp); param++) { - paramList += " " + IString(ui.ParamName(grp, param)).DownCase(); + paramList += " " + ui.ParamName(grp, param).toLower(); paramDetails.push_back(GetParamCompletion(grp, param)); } } @@ -96,8 +98,8 @@ void MakeCompletion(const string &appName) { argv[1] = 0; } -string BuildStaticCompletes(std::string paramList) { - string completion = ""; +QString BuildStaticCompletes(QString paramList) { + QString completion = ""; // Batchlist completion += " 'c/-[bB][aA][tT][cC][hH][lL][iI][sS][tT]=/f/'"; @@ -132,17 +134,17 @@ string BuildStaticCompletes(std::string paramList) { return completion; } -string GetParamCompletion(int grp, int param) { - string completion = "c/"; +QString GetParamCompletion(int grp, int param) { + QString completion = "c/"; UserInterface &ui = Application::GetUserInterface(); - string paramName = ui.ParamName(grp, param); - for(unsigned int curIndex = 0; curIndex < paramName.length(); curIndex++) { - if(isalpha(paramName[curIndex])) { + QString paramName = ui.ParamName(grp, param); + for(int curIndex = 0; curIndex < paramName.length(); curIndex++) { + if(paramName[curIndex].isLetter()) { completion += "["; - completion += toupper(paramName[curIndex]); - completion += tolower(paramName[curIndex]); + completion += paramName[curIndex].toUpper(); + completion += paramName[curIndex].toLower(); completion += "]"; } else { @@ -151,7 +153,7 @@ string GetParamCompletion(int grp, int param) { } completion += "=/"; - string type = ui.ParamType(grp, param); + QString type = ui.ParamType(grp, param); if(type == "cube") { completion += "f:*.[cC][uU][bB]"; diff --git a/isis/src/system/apps/kerneldbgen/SpiceDbGen.cpp b/isis/src/system/apps/kerneldbgen/SpiceDbGen.cpp index b576ccad3b..e528775fa9 100644 --- a/isis/src/system/apps/kerneldbgen/SpiceDbGen.cpp +++ b/isis/src/system/apps/kerneldbgen/SpiceDbGen.cpp @@ -38,7 +38,7 @@ const char *SpiceDbGen::calForm = "YYYY MON DD HR:MN:SC.### TDB ::TDB"; * * @param type The type of kernel to be processed. Either, "SPK" or "CK. */ -SpiceDbGen::SpiceDbGen(IString type) { +SpiceDbGen::SpiceDbGen(QString type) { p_type = type; // calForm = "YYYY MON DD HR:MN:SC.### TDB ::TDB"; } @@ -53,7 +53,7 @@ SpiceDbGen::SpiceDbGen(IString type) { * * @param location The directory in which the method searches for kernels. * - * @param filter Vector of strings containing regular expression used to + * @param filter Vector of QStrings containing regular expression used to * match kernels of a particular quality. This parameter is * used to distinguish between kernels of different qualities * and/or different missions that may be placed in the same @@ -67,10 +67,10 @@ SpiceDbGen::SpiceDbGen(IString type) { * * @throws Isis::iException::Message */ -PvlObject SpiceDbGen::Direct(IString quality, IString location, - std::vector &filter) { +PvlObject SpiceDbGen::Direct(QString quality, QString location, + std::vector &filter) { PvlObject result; - IString type = "none"; + QString type = "none"; for(unsigned int i = 0; i < filter.size(); ++i) { //Create a list of all of the files matching the current filter @@ -80,13 +80,13 @@ PvlObject SpiceDbGen::Direct(IString quality, IString location, // Throw an error if no files are being added to this database for // this filter/regex if(files.size() == 0) { - string message = "Your filter [" + location + "/" + filter[i] + "]" + QString message = "Your filter [" + location + "/" + filter[i] + "]" + "has not detected any " + quality + " kernels"; throw IException(IException::User, message, _FILEINFO_); } for(int fileNum = 0 ; fileNum < files.size() ; fileNum++) { - FileName currFile((string) location + "/" + files[fileNum].toStdString()); + FileName currFile((QString) location + "/" + files[fileNum]); PvlGroup selection = AddSelection(currFile); selection += PvlKeyword("Type", quality); result.AddGroup(selection); @@ -110,7 +110,7 @@ PvlObject SpiceDbGen::Direct(IString quality, IString location, grp++; } else { - string message = "A kernel of type [" + grp->Name() + "] has been found in a directory for type [" + type + "]" ; + QString message = "A kernel of type [" + grp->Name() + "] has been found in a directory for type [" + type + "]" ; throw IException(IException::Programmer, message, _FILEINFO_); break; } @@ -143,9 +143,9 @@ PvlObject SpiceDbGen::Direct(IString quality, IString location, * @return QStringList * */ -QStringList SpiceDbGen::GetFiles(FileName location, IString filter) { - filter.Remove("\\"); - QDir dir(location.expanded().c_str(), filter.c_str(), +QStringList SpiceDbGen::GetFiles(FileName location, QString filter) { + filter.remove("\\"); + QDir dir(location.expanded(), filter, QDir::Name, QDir::Files); return dir.entryList(); } @@ -164,15 +164,15 @@ PvlGroup SpiceDbGen::AddSelection(FileName fileIn) { NaifStatus::CheckErrors(); //finalize the filename so that it may be used in spice routines - std::string tmp = fileIn.expanded(); + QString tmp = fileIn.expanded(); // const char* file = fileIn.expanded().c_str(); - furnsh_c(tmp.c_str()); + furnsh_c(tmp.toAscii().data()); SpiceChar fileType[32], source[2048]; SpiceInt handle; SpiceBoolean found; - kinfo_c(tmp.c_str(), 32, 2048, fileType, source, &handle, &found); - IString currFile = fileType; + kinfo_c(tmp.toAscii().data(), 32, 2048, fileType, source, &handle, &found); + QString currFile = fileType; //create a spice cell capable of containing all the objects in the kernel. SPICEINT_CELL(currCell, 1000); @@ -185,10 +185,10 @@ PvlGroup SpiceDbGen::AddSelection(FileName fileIn) { //will be returned here and weeded out at the end of Direct(). This helps //to protect the user from inadvertently adding "." and ".." to their filters if(currFile == "SPK") { - spkobj_c(tmp.c_str(), &currCell); + spkobj_c(tmp.toAscii().data(), &currCell); } else if(currFile == "CK") { - ckobj_c(tmp.c_str(), &currCell); + ckobj_c(tmp.toAscii().data(), &currCell); } else if(currFile == "TEXT") { return PvlGroup("No coverage"); @@ -212,7 +212,7 @@ PvlGroup SpiceDbGen::AddSelection(FileName fileIn) { SPICEDOUBLE_CELL(cover, 2000); ssize_c(0, &cover); ssize_c(2000, &cover); - spkcov_c(tmp.c_str(), body, &cover); + spkcov_c(tmp.toAscii().data(), body, &cover); NaifStatus::CheckErrors(); @@ -223,7 +223,7 @@ PvlGroup SpiceDbGen::AddSelection(FileName fileIn) { SPICEDOUBLE_CELL(cover, 200000); ssize_c(0, &cover); ssize_c(200000, &cover); - ckcov_c(tmp.c_str(), body, SPICEFALSE, "SEGMENT", 0.0, "TDB", &cover); + ckcov_c(tmp.toAscii().data(), body, SPICEFALSE, "SEGMENT", 0.0, "TDB", &cover); NaifStatus::CheckErrors(); @@ -232,19 +232,19 @@ PvlGroup SpiceDbGen::AddSelection(FileName fileIn) { } } - IString outFile = fileIn.originalPath(); + QString outFile = fileIn.originalPath(); result += PvlKeyword("File", outFile + "/" + fileIn.name()); NaifStatus::CheckErrors(); // Unfurnishes tmp file to prevent file table overflow - unload_c(tmp.c_str()); + unload_c(tmp.toAscii().data()); return result; } -PvlGroup SpiceDbGen::FormatIntervals(SpiceCell &coverage, string type) { +PvlGroup SpiceDbGen::FormatIntervals(SpiceCell &coverage, QString type) { NaifStatus::CheckErrors(); PvlGroup result(type); @@ -259,8 +259,8 @@ PvlGroup SpiceDbGen::FormatIntervals(SpiceCell &coverage, string type) { //Convert the endpoints to TDB calendar timout_c(begin, calForm, 32, begStr); timout_c(end, calForm, 32, endStr); - result += PvlKeyword("Time", "(\"" + (string)begStr + - "\", \"" + (string)endStr + "\")"); + result += PvlKeyword("Time", "(\"" + (QString)begStr + + "\", \"" + (QString)endStr + "\")"); } NaifStatus::CheckErrors(); @@ -269,15 +269,15 @@ PvlGroup SpiceDbGen::FormatIntervals(SpiceCell &coverage, string type) { } -void SpiceDbGen::FurnishDependencies(string sclk, string lsk) { +void SpiceDbGen::FurnishDependencies(QString sclk, QString lsk) { NaifStatus::CheckErrors(); //furnish the lsk file - furnsh_c(lsk.c_str()); + furnsh_c(lsk.toAscii().data()); //get the sclk, if such a file was specified if(sclk != "") { - furnsh_c(sclk.c_str()); + furnsh_c(sclk.toAscii().data()); } NaifStatus::CheckErrors(); diff --git a/isis/src/system/apps/kerneldbgen/SpiceDbGen.h b/isis/src/system/apps/kerneldbgen/SpiceDbGen.h index 9e8308abd1..53de2f9010 100644 --- a/isis/src/system/apps/kerneldbgen/SpiceDbGen.h +++ b/isis/src/system/apps/kerneldbgen/SpiceDbGen.h @@ -25,16 +25,16 @@ */ #include + +#include + +#include + #include "FileName.h" -#include "Pvl.h" +#include "IException.h" #include "IString.h" -#include "naif/SpiceUsr.h" -#include "qstringlist.h" #include "KernelDb.h" -#include "IException.h" - -using namespace std; -using namespace Isis; +#include "Pvl.h" /** * @brief Utility for SPICE kernel interrogation and kerneldb generation @@ -43,23 +43,23 @@ using namespace Isis; * * @internal * @history 2010-04-27 Stuart Sides - Modified Direct member to use a vector - * of filters instead of a single string + * of filters instead of a single QString * */ class SpiceDbGen { public: - SpiceDbGen(IString type); - PvlObject Direct(IString quality, IString location, - std::vector & filter); - void FurnishDependencies(string sclk, string fk); + SpiceDbGen(QString type); + Isis::PvlObject Direct(QString quality, QString location, + std::vector & filter); + void FurnishDependencies(QString sclk, QString fk); private: - QStringList GetFiles(FileName location, IString filter); - PvlGroup AddSelection(FileName fileIn); - PvlGroup FormatIntervals(SpiceCell &coverage, string type); - PvlGroup GetIntervals(SpiceCell &cover); + QStringList GetFiles(Isis::FileName location, QString filter); + Isis::PvlGroup AddSelection(Isis::FileName fileIn); + Isis::PvlGroup FormatIntervals(SpiceCell &coverage, QString type); + Isis::PvlGroup GetIntervals(SpiceCell &cover); //private instance variables - IString p_type; + QString p_type; static const char *calForm; }; diff --git a/isis/src/system/apps/kerneldbgen/kerneldbgen.cpp b/isis/src/system/apps/kerneldbgen/kerneldbgen.cpp index bbf2f6de55..52dbe0eaa7 100644 --- a/isis/src/system/apps/kerneldbgen/kerneldbgen.cpp +++ b/isis/src/system/apps/kerneldbgen/kerneldbgen.cpp @@ -16,9 +16,9 @@ void IsisMain() { bool needSclk = false; FileName sclkFile(""); if(ui.WasEntered("SCLK")) { - IString sclkString = ui.GetAsString("SCLK"); + QString sclkString = ui.GetAsString("SCLK"); if(sclkString.length() != 0) { - sclkString.Trim("\\"); + sclkString.remove("\\"); sclkFile = FileName(sclkString); if (sclkFile.isVersioned()) { sclkFile = sclkFile.highestVersion(); @@ -29,8 +29,8 @@ void IsisMain() { } } - IString lskString = ui.GetAsString("LSK"); - lskString.Trim("\\"); + QString lskString = ui.GetAsString("LSK"); + lskString.remove("\\"); FileName lskFile(lskString); if (lskFile.isVersioned()) { lskFile = lskFile.highestVersion(); @@ -48,7 +48,7 @@ void IsisMain() { //Determine the type of kernel that the user wants a database for. This will //eventually become the name of the object in the output PVL - string kernelType; + QString kernelType; if(ui.GetString("TYPE") == "CK") { kernelType = "SpacecraftPointing"; } @@ -63,10 +63,10 @@ void IsisMain() { /* Removed because Nadir is not done using this*/ //if (ui.GetString("NADIRFILTER") != "none" && // ui.GetString("NADIRDIR") != "none"){ - // IString location = ""; + // QString location = ""; // location = ui.GetString("NADIRDIR"); // location.Trim("\\"); - // std::vector filter; + // std::vector filter; // ui.GetString("NADIRFILTER", filter); // PvlObject result = sdg.Direct("Nadir",location, filter); // PvlObject::PvlGroupIterator grp = result.BeginGroup(); @@ -74,10 +74,10 @@ void IsisMain() { //} if(ui.GetString("PREDICTFILTER") != "none" && ui.GetString("PREDICTDIR") != "none") { - IString location = ""; + QString location = ""; location = ui.GetString("PREDICTDIR"); - location.Trim("\\"); - std::vector filter; + location.remove("\\"); + std::vector filter; ui.GetString("PREDICTFILTER", filter); PvlObject result = sdg.Direct("Predicted", location, filter); PvlObject::PvlGroupIterator grp = result.BeginGroup(); @@ -89,10 +89,10 @@ void IsisMain() { if(ui.GetString("RECONDIR") != "none" && ui.GetString("RECONFILTER") != "none") { - IString location = ""; + QString location = ""; location = ui.GetString("RECONDIR"); - location.Trim("\\"); - std::vector filter; + location.remove("\\"); + std::vector filter; ui.GetString("RECONFILTER", filter); PvlObject result = sdg.Direct("Reconstructed", location, filter); PvlObject::PvlGroupIterator grp = result.BeginGroup(); @@ -104,10 +104,10 @@ void IsisMain() { if(ui.GetString("SMITHEDDIR") != "none" && ui.GetString("SMITHEDFILTER") != "none") { - IString location = ""; + QString location = ""; location = ui.GetString("SMITHEDDIR"); - location.Trim("\\"); - std::vector filter; + location.remove("\\"); + std::vector filter; ui.GetString("SMITHEDFILTER", filter); PvlObject result = sdg.Direct("Smithed", location, filter); PvlObject::PvlGroupIterator grp = result.BeginGroup(); @@ -120,7 +120,7 @@ void IsisMain() { //if (filter == ""){ if(!ui.WasEntered("PREDICTFILTER") && !ui.WasEntered("RECONFILTER") && !ui.WasEntered("SMITHEDFILTER")) { - string message = + QString message = "You must enter a filter AND directory for at least one type of kernel"; throw IException(IException::User, message, _FILEINFO_); } diff --git a/isis/src/system/apps/messckgen/messckgen.cpp b/isis/src/system/apps/messckgen/messckgen.cpp index 3f35adb0ec..118edd0b80 100644 --- a/isis/src/system/apps/messckgen/messckgen.cpp +++ b/isis/src/system/apps/messckgen/messckgen.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -19,8 +19,6 @@ using namespace Isis; -using std::string; - void updatePointing(PvlGroup &ckGroup, PvlObject &pivotPointing, PvlObject &atthistPointing); @@ -30,7 +28,7 @@ PvlGroup* insertGroup(PvlObject &object, PvlGroup &group, int index); void IsisMain() { UserInterface &ui = Application::GetUserInterface(); - // Convert between integer representations of months to abbreviated strings, + // Convert between integer representations of months to abbreviated QStrings, // as used in the TDB time format of the kernel date ranges QHash MONTH_TO_STRING; MONTH_TO_STRING[1] = "JAN"; @@ -53,7 +51,7 @@ void IsisMain() { } else { // If not provided, assume the latest pivot file in the data area - string pivotString("$messenger/kernels/ck/pivot_kernels.????.db"); + QString pivotString("$messenger/kernels/ck/pivot_kernels.????.db"); pivotFileName = FileName(pivotString).highestVersion(); } Pvl pivot(pivotFileName.expanded()); @@ -65,7 +63,7 @@ void IsisMain() { } else { // If not provided, assume the latest atthist file in the data area - string atthistString("$messenger/kernels/ck/atthist_kernels.????.db"); + QString atthistString("$messenger/kernels/ck/atthist_kernels.????.db"); atthistFileName = FileName(atthistString).highestVersion(); } Pvl atthist(atthistFileName.expanded()); @@ -76,7 +74,7 @@ void IsisMain() { dbFileName = ui.GetFileName("FROM"); } else { - string dbString("$messenger/kernels/ck/kernels.????.db"); + QString dbString("$messenger/kernels/ck/kernels.????.db"); dbFileName = FileName(dbString).highestVersion(); } Pvl kernelDb(dbFileName.expanded()); @@ -112,7 +110,7 @@ void IsisMain() { // We're looking for the group with a comment that says MAPPING, // signifying the beginning of the section we wish to update for (int j = 0; j < ckGroup.Comments(); j++) { - QString comment = QString::fromStdString(ckGroup.Comment(j)); + QString comment = ckGroup.Comment(j); if (comment.contains("MAPPING")) { foundMapping = true; updatePointing(ckGroup, pivotPointing, atthistPointing); @@ -126,20 +124,20 @@ void IsisMain() { for (int k = pivotSelection.Keywords() - 1; k >= 0; k--) { PvlKeyword &keyword = pivotSelection[k]; if (keyword.IsNamed("Time")) { - pivotEndRaw = QString::fromStdString(keyword[1]); + pivotEndRaw = keyword[1]; break; } } // Remove the trailing " TDB" as it confuses the time conversion - string newEnd = pivotEndRaw.toStdString(); + QString newEnd = pivotEndRaw; pivotEndRaw.remove(QRegExp(" TDB$")); - string pivotEnd = pivotEndRaw.toStdString(); + QString pivotEnd = pivotEndRaw; PvlKeyword &time = ckGroup.FindKeyword("Time"); - QString currentStartRaw = QString::fromStdString(time[0]); + QString currentStartRaw = time[0]; currentStartRaw.remove(QRegExp(" TDB$")); - string currentStart = currentStartRaw.toStdString(); + QString currentStart = currentStartRaw; // Add 7 days (in units of seconds) to the current start time to // signify a week's time from the start time @@ -164,20 +162,20 @@ void IsisMain() { // Until our covered time has exceeded a week past the current // group's start time, add new files to the current group while (coveredTime <= weekFromStart && coveredTime <= pivotEndTime) { - // Construct the string used to identify the day's BC file - string year = coveredTime.YearString(); - string month = coveredTime.MonthString(); + // Construct the QString used to identify the day's BC file + QString year = coveredTime.YearString(); + QString month = coveredTime.MonthString(); if (month.size() < 2) month = "0" + month; - string day = coveredTime.DayString(); + QString day = coveredTime.DayString(); if (day.size() < 2) day = "0" + day; - string bcFileName = "$messenger/kernels/ck/"; + QString bcFileName = "$messenger/kernels/ck/"; bcFileName += "msgr" + year + month + day + ".bc"; // Check that the current day's BC file exists - string bcExpanded = FileName(bcFileName).expanded(); - if (!QFile(QString::fromStdString(bcExpanded)).exists()) { - string msg = "The BC file [" + bcExpanded + "] does not exist"; + QString bcExpanded = FileName(bcFileName).expanded(); + if (!QFile(bcExpanded).exists()) { + QString msg = "The BC file [" + bcExpanded + "] does not exist"; throw IException(IException::User, msg, _FILEINFO_); } @@ -197,8 +195,8 @@ void IsisMain() { if (coveredTime <= pivotEndTime) { // Set the end of the previous range and the beginning of the new // range to a week past the previous beginning - IString newEndTime = weekFromStart.YearString() + " "; - newEndTime += MONTH_TO_STRING[weekFromStart.Month()].toStdString() + " "; + QString newEndTime = weekFromStart.YearString() + " "; + newEndTime += MONTH_TO_STRING[weekFromStart.Month()] + " "; newEndTime += weekFromStart.DayString() + " "; newEndTime += "00:00:00.000 TDB"; @@ -294,7 +292,7 @@ PvlGroup* insertGroup(PvlObject &object, PvlGroup &group, int index) { PvlGroup ¤tGroup = object.Group(i); bool foundMapping = false; for (int j = 0; j < currentGroup.Comments(); j++) { - QString comment = QString::fromStdString(currentGroup.Comment(j)); + QString comment = currentGroup.Comment(j); mappingComments.append(comment); if (comment.contains("MAPPING")) @@ -320,7 +318,7 @@ PvlGroup* insertGroup(PvlObject &object, PvlGroup &group, int index) { // Add all the mapping comments PvlGroup ¤tGroup = object.Group(index); for (int i = 0; i < mappingComments.size(); i++) - currentGroup.AddComment(mappingComments[i].toStdString()); + currentGroup.AddComment(mappingComments[i]); // Return the location of the new group return ¤tGroup; diff --git a/isis/src/system/apps/messspkgen/messspkgen.cpp b/isis/src/system/apps/messspkgen/messspkgen.cpp index 161e907132..8d37cbee67 100644 --- a/isis/src/system/apps/messspkgen/messspkgen.cpp +++ b/isis/src/system/apps/messspkgen/messspkgen.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include @@ -14,10 +14,9 @@ using namespace Isis; -using std::string; -string convertUtcToTdb(string utcTime); +QString convertUtcToTdb(QString utcTime); void IsisMain() { @@ -29,7 +28,7 @@ void IsisMain() { dbFileName = ui.GetFileName("FROM"); } else { - string dbString("$messenger/kernels/spk/kernels.????.db"); + QString dbString("$messenger/kernels/spk/kernels.????.db"); dbFileName = FileName(dbString).highestVersion(); } Pvl kernelDb(dbFileName.expanded()); @@ -41,7 +40,7 @@ void IsisMain() { // cutoff PvlGroup &reconstructed = position.FindGroup("Selection"); PvlKeyword &time = reconstructed[reconstructed.Keywords() - 3]; - string reconstructedEnd = time[1]; + QString reconstructedEnd = time[1]; time[1] = convertUtcToTdb(ui.GetString("TIME")); // Get the predicted group from the previous file, set the start time to the @@ -77,10 +76,10 @@ void IsisMain() { } -string convertUtcToTdb(string utcTime) { +QString convertUtcToTdb(QString utcTime) { // Remove any surrounding whitespace and the trailing " UTC", then replace // with TDB syntax - QString orbitCutoffRaw = QString::fromStdString(utcTime); + QString orbitCutoffRaw = utcTime; orbitCutoffRaw.trimmed(); orbitCutoffRaw.remove(QRegExp(" UTC$")); @@ -91,7 +90,7 @@ string convertUtcToTdb(string utcTime) { int pos = yearRx.indexIn(orbitCutoffRaw); QString year = (pos > -1) ? yearRx.cap(1) : ""; - // The day will come at the beginning of the string, and will be 1 or 2 + // The day will come at the beginning of the QString, and will be 1 or 2 // characters. If it's only 1, add an extra 0 to make it 2. QRegExp dayRx("(^\\d{1,2})"); pos = dayRx.indexIn(orbitCutoffRaw); @@ -103,7 +102,7 @@ string convertUtcToTdb(string utcTime) { orbitCutoffRaw.replace(dayRx, year); // Tack on the necessary TDB tail - string orbitCutoff = orbitCutoffRaw.toStdString(); + QString orbitCutoff = orbitCutoffRaw; orbitCutoff += ".000 TDB"; return orbitCutoff; } diff --git a/isis/src/system/apps/prtloganalyzer/ProgramAnalyzer.cpp b/isis/src/system/apps/prtloganalyzer/ProgramAnalyzer.cpp index f09d057415..3a5e2085e3 100644 --- a/isis/src/system/apps/prtloganalyzer/ProgramAnalyzer.cpp +++ b/isis/src/system/apps/prtloganalyzer/ProgramAnalyzer.cpp @@ -48,7 +48,7 @@ ProgramAnalyzer::ProgramAnalyzer() { * * @param logfile A print.prt file */ -ProgramAnalyzer::ProgramAnalyzer(const std::string &logfile) { +ProgramAnalyzer::ProgramAnalyzer(const QString &logfile) { init(); add(logfile); } @@ -56,7 +56,7 @@ ProgramAnalyzer::ProgramAnalyzer(const std::string &logfile) { /** * @brief Set the list of program exclusions * - * When provided, the string should contain names of ISIS programs that will be + * When provided, the QString should contain names of ISIS programs that will be * excluded in the analysis. If more than one program is desired, separate * them by commas. * @@ -68,14 +68,10 @@ ProgramAnalyzer::ProgramAnalyzer(const std::string &logfile) { * * @param name Comma separated list of names of programs to exclude */ -void ProgramAnalyzer::setExclude(const std::string &name) { - - vector names; - IString::Split(',', name, names); - for ( unsigned i = 0 ; i < names.size() ; i++ ) { - exclude(names[i]); +void ProgramAnalyzer::setExclude(const QString &name) { + foreach (QString singleName, name.split(",")) { + exclude(singleName); } - return; } /** @@ -92,8 +88,8 @@ void ProgramAnalyzer::setExclude(const std::string &name) { * * @param name Name of file containing program list to exclude */ -void ProgramAnalyzer::exclude(const std::string &name) { - string prog = IString(name).Trim(" \t\n"); +void ProgramAnalyzer::exclude(const QString &name) { + QString prog = name.trimmed(); if ( !_excludes.exists(prog) ) { _excludes.add(prog, 0); } @@ -104,7 +100,7 @@ void ProgramAnalyzer::exclude(const std::string &name) { /** * @brief Set the list of program inclusions * - * When provided, the string should contain names of ISIS programs that will be + * When provided, the QString should contain names of ISIS programs that will be * included in the analysis. If more than one program is desired, separate * them by commas. * @@ -121,13 +117,10 @@ void ProgramAnalyzer::exclude(const std::string &name) { * * @param name Comma separated list of names of programs to include */ -void ProgramAnalyzer::setInclude(const std::string &name) { - vector names; - IString::Split(',', name, names); - for ( unsigned i = 0 ; i < names.size() ; i++ ) { - include(names[i]); +void ProgramAnalyzer::setInclude(const QString &name) { + foreach (QString singleName, name.split(",")) { + include(singleName); } - return; } /** @@ -149,8 +142,8 @@ void ProgramAnalyzer::setInclude(const std::string &name) { * * @param name Name of file containing program list to include */ -void ProgramAnalyzer::include(const std::string &name) { - string prog = IString(name).Trim(" \t\n"); +void ProgramAnalyzer::include(const QString &name) { + QString prog = name.trimmed(); if ( !_includes.exists(prog) ) { _includes.add(prog, 0); } @@ -166,7 +159,7 @@ void ProgramAnalyzer::include(const std::string &name) { * * @param logfile An ISIS3 print.prt file */ -void ProgramAnalyzer::add(const std::string &logfile) { +void ProgramAnalyzer::add(const QString &logfile) { Pvl plog(logfile); for(int i = 0; i < plog.Objects(); i++) { add(plog.Object(i)); @@ -185,7 +178,7 @@ void ProgramAnalyzer::add(const std::string &logfile) { */ void ProgramAnalyzer::add(PvlObject &program) { _count++; - string prog(program.Name()); + QString prog(program.Name()); if ( _excludes.exists(prog) ) { _excludes.get(prog)++; return; @@ -220,19 +213,19 @@ void ProgramAnalyzer::add(PvlObject &program) { * * @return PvlGroup Pvl group containing program numbers/counts */ -PvlGroup ProgramAnalyzer::review(const std::string &name) const { +PvlGroup ProgramAnalyzer::review(const QString &name) const { PvlGroup pvl(name); - pvl += PvlKeyword("Programs", size()); - pvl += PvlKeyword("Unique", Programs()); - pvl += PvlKeyword("Included", LimitTotals(_includes)); - pvl += PvlKeyword("Excluded", LimitTotals(_excludes)); - pvl += PvlKeyword("Valid", valid()); - pvl += PvlKeyword("Errors", errors()); - pvl += PvlKeyword("ZeroTime", zerotime()); - pvl += PvlKeyword("NoData", nodata()); - pvl += PvlKeyword("BadData", baddata()); - pvl += PvlKeyword("Total", count()); + pvl += PvlKeyword("Programs", toString(size())); + pvl += PvlKeyword("Unique", toString(Programs())); + pvl += PvlKeyword("Included", toString(LimitTotals(_includes))); + pvl += PvlKeyword("Excluded", toString(LimitTotals(_excludes))); + pvl += PvlKeyword("Valid", toString(valid())); + pvl += PvlKeyword("Errors", toString(errors())); + pvl += PvlKeyword("ZeroTime", toString(zerotime())); + pvl += PvlKeyword("NoData", toString(nodata())); + pvl += PvlKeyword("BadData", toString(baddata())); + pvl += PvlKeyword("Total", toString(count())); return (pvl); } @@ -248,7 +241,7 @@ PvlGroup ProgramAnalyzer::review(const std::string &name) const { * * @return PvlGroup Pvl group containing cumulative program analysis */ -PvlGroup ProgramAnalyzer::cumulative(const std::string &name) const { +PvlGroup ProgramAnalyzer::cumulative(const QString &name) const { return (toPvl(_totals, name)); } @@ -263,7 +256,7 @@ PvlGroup ProgramAnalyzer::cumulative(const std::string &name) const { * * @return PvlGroup Pvl group containing program analysis */ -PvlGroup ProgramAnalyzer::summarize(const std::string &name) const { +PvlGroup ProgramAnalyzer::summarize(const QString &name) const { return (toPvl(_programs.get(name))); } @@ -374,14 +367,14 @@ int ProgramAnalyzer::getCount (ProgramAnalyzer::Status status) const { * @param key Name of keyword to find * @param grp Optional group within the object to find the keyword * - * @return string Value of the keyword if the keyword exists, otherwise an empty - * string is returned. + * @return QString Value of the keyword if the keyword exists, otherwise an empty + * QString is returned. */ -string ProgramAnalyzer::getKey(PvlObject &obj, const std::string &key, - const std::string &grp) const { +QString ProgramAnalyzer::getKey(PvlObject &obj, const QString &key, + const QString &grp) const { - string value(""); - if ( !grp.empty() ) { + QString value(""); + if ( !grp.isEmpty() ) { PvlGroup &g = obj.FindGroup(grp); value = findKey(g, key); } @@ -394,22 +387,21 @@ string ProgramAnalyzer::getKey(PvlObject &obj, const std::string &key, /** * @brief Converts times represented in text to digital values * - * The text string, atime, is expected to be of the format "HH:MM:SS.sss" where + * The text QString, atime, is expected to be of the format "HH:MM:SS.sss" where * "HH" is hours, "MM" is minutes and "SS.sss" is seconds.milliseconds. The * units returned are in seconds. * - * @param atime Text string containing time to convert + * @param atime Text QString containing time to convert * @param dtime Time in seconds * - * @return ProgramAnalyzer::Status Returns BADDATA if the text string is empty + * @return ProgramAnalyzer::Status Returns BADDATA if the text QString is empty * or malformed, or VALID if the conversion * succeeds. */ -ProgramAnalyzer::Status ProgramAnalyzer::convertTime(const std::string &atime, +ProgramAnalyzer::Status ProgramAnalyzer::convertTime(const QString &atime, double &dtime) const { - if ( atime.empty() ) return (BADDATA); - vector t; - IString::Split(':', atime, t); + if ( atime.isEmpty() ) return (BADDATA); + QStringList t = atime.split(":"); if ( t.size() != 3 ) { return (BADDATA); } @@ -418,7 +410,7 @@ ProgramAnalyzer::Status ProgramAnalyzer::convertTime(const std::string &atime, double toSeconds(3600.0); dtime = 0.0; for ( unsigned int i = 0 ; i < 3 ; i++ ) { - dtime += IString(t[i]).ToDouble() * toSeconds; + dtime += toDouble(t[i]) * toSeconds; toSeconds /= 60.0; } @@ -509,10 +501,10 @@ bool ProgramAnalyzer::analyze(const ProgramAnalyzer::ProgramData &data) { * @return PvlGroup Pvl group of runtime statistics */ PvlGroup ProgramAnalyzer::toPvl(const RunTimeStats &stats, - const std::string &name) const { - PvlGroup pvl((name.empty() ? stats.pname : name)); + const QString &name) const { + PvlGroup pvl((name.isEmpty() ? stats.pname : name)); - pvl += PvlKeyword("Hits", stats.contime.TotalPixels()); + pvl += PvlKeyword("Hits", toString(stats.contime.TotalPixels())); pvl += PvlKeyword("ConnectTimeMinimum", DblToStr(stats.contime.Minimum(), 2)); pvl += PvlKeyword("ConnectTimeMaximum", DblToStr(stats.contime.Maximum(), 2)); pvl += PvlKeyword("ConnectTimeAverage", DblToStr(stats.contime.Average(), 2)); @@ -532,40 +524,40 @@ PvlGroup ProgramAnalyzer::toPvl(const RunTimeStats &stats, } /** - * @brief Returns NULL for empty strings to ensure meaningful content + * @brief Returns NULL for empty QStrings to ensure meaningful content * * @param s String to test for content * - * @return IString Returns existing content if present, NULL if empty + * @return QString Returns existing content if present, NULL if empty */ -IString ProgramAnalyzer::format(const std::string &s) const { - if ( s.empty() ) return (IString("NULL")); +QString ProgramAnalyzer::format(const QString &s) const { + if ( s.isEmpty() ) return (QString("NULL")); return (s); } /** - * @brief Convert a double value to a string subject to precision specs + * @brief Convert a double value to a QString subject to precision specs * - * This method converts a double value to a string that has a prefined digitis + * This method converts a double value to a QString that has a prefined digitis * of precision. Fixed float form is used with the specified number of digits * of precision. * - * @param value Double value to convert to string + * @param value Double value to convert to QString * - * @return IString Returns the converted string + * @return QString Returns the converted QString */ - IString ProgramAnalyzer::DblToStr(const double &value, const int precision) + QString ProgramAnalyzer::DblToStr(const double &value, const int precision) const { if(IsSpecial(value)) { - return (IString("0.0")); + return (QString("0.0")); } - // Format the string to specs + // Format the QString to specs ostringstream strcnv; strcnv.setf(std::ios::fixed); strcnv << setprecision(precision) << value; - return (IString(strcnv.str())); + return (QString(strcnv.str().c_str())); } /** diff --git a/isis/src/system/apps/prtloganalyzer/ProgramAnalyzer.h b/isis/src/system/apps/prtloganalyzer/ProgramAnalyzer.h index 35b53f95c1..db99964525 100644 --- a/isis/src/system/apps/prtloganalyzer/ProgramAnalyzer.h +++ b/isis/src/system/apps/prtloganalyzer/ProgramAnalyzer.h @@ -1,4 +1,4 @@ -#if !defined(ProgramAnalyzer_h) +#ifndef ProgramAnalyzer_h #define ProgramAnalyzer_h /** * @file @@ -56,7 +56,7 @@ namespace Isis { public: // Constructors and Destructor ProgramAnalyzer(); - ProgramAnalyzer(const std::string &logfile); + ProgramAnalyzer(const QString &logfile); /** Destructor ensures everything is cleaned up properly */ virtual ~ProgramAnalyzer() { } @@ -79,17 +79,17 @@ namespace Isis { /** Returns total number of unique programs */ int Programs() const { return (_programs.size()); } - void setExclude(const std::string &name); - void exclude(const std::string &exclude); - void setInclude(const std::string &name); - void include(const std::string &include); + void setExclude(const QString &name); + void exclude(const QString &exclude); + void setInclude(const QString &name); + void include(const QString &include); - void add(const std::string &logfile); + void add(const QString &logfile); void add(PvlObject &program); - PvlGroup review(const std::string &name = "Results") const; - PvlGroup cumulative(const std::string &name = "ProgramTotals") const; - PvlGroup summarize(const std::string &name) const; + PvlGroup review(const QString &name = "Results") const; + PvlGroup cumulative(const QString &name = "ProgramTotals") const; + PvlGroup summarize(const QString &name) const; PvlGroup summarize(const int index) const; std::ostream &header(std::ostream &out) const; @@ -100,12 +100,12 @@ namespace Isis { /** Container for runtime status of a programs */ struct RunTimeStats { - std::string pname; + QString pname; Statistics contime; Statistics cputime; Statistics iotime; RunTimeStats() : pname(""), contime(), cputime(), iotime() { } - RunTimeStats(const std::string &name) : pname(name), contime(), + RunTimeStats(const QString &name) : pname(name), contime(), cputime(), iotime() { } }; @@ -113,10 +113,10 @@ namespace Isis { /** Container for program data */ struct ProgramData { Status status; - std::string name; - std::string runtime; - std::string from; - std::string to; + QString name; + QString runtime; + QString from; + QString to; double cpuTime; double connectTime; ProgramData() : status(BADDATA), name(""), runtime(""), @@ -124,8 +124,8 @@ namespace Isis { }; /* Containers for program lists */ - typedef CollectorMap LogList; - typedef CollectorMap RunList; + typedef CollectorMap LogList; + typedef CollectorMap RunList; int _count; //!< Count of all programs LogList _excludes; //!< Program exclusion list @@ -137,25 +137,25 @@ namespace Isis { void init(); int getCount (Status status) const; - std::string getKey(PvlObject &obj, const std::string &key, - const std::string &grp = "") const; + QString getKey(PvlObject &obj, const QString &key, + const QString &grp = "") const; /** Find a string in a PvlContainer */ - std::string findKey(PvlContainer &kset, const std::string &key) const { - std::string value(""); + QString findKey(PvlContainer &kset, const QString &key) const { + QString value(""); if ( kset.HasKeyword(key) ) { value = kset[key][0]; } return (value); } - Status convertTime(const std::string &time, double &ptime) const; + Status convertTime(const QString &time, double &ptime) const; bool accounting(PvlObject &obj, ProgramData &data) const; bool analyze(const ProgramData &data); - IString format(const std::string &s) const; - IString DblToStr(const double &value, const int precision = 2) const; - PvlGroup toPvl(const RunTimeStats &stats, const std::string &name = "") const; + QString format(const QString &s) const; + QString DblToStr(const double &value, const int precision = 2) const; + PvlGroup toPvl(const RunTimeStats &stats, const QString &name = "") const; int LimitTotals(const LogList &limit) const; }; } diff --git a/isis/src/system/apps/prtloganalyzer/prtloganalyzer.cpp b/isis/src/system/apps/prtloganalyzer/prtloganalyzer.cpp index 0e55a1b41c..d69649374e 100644 --- a/isis/src/system/apps/prtloganalyzer/prtloganalyzer.cpp +++ b/isis/src/system/apps/prtloganalyzer/prtloganalyzer.cpp @@ -64,13 +64,13 @@ void IsisMain() { if(ui.WasEntered("LOG")) { // Set up for opening FileName temp(ui.GetFileName("LOG")); - string file = temp.expanded(); + QString file = temp.expanded(); ofstream ostm; // Open the file - ostm.open(file.c_str(), std::ios::out); + ostm.open(file.toAscii().data(), std::ios::out); if(!ostm) { - string message = "Cannot open/create output file " + file; + QString message = "Cannot open/create output file " + file; throw IException(IException::Io, message, _FILEINFO_); } diff --git a/isis/src/system/objs/KernelDb/KernelDb.cpp b/isis/src/system/objs/KernelDb/KernelDb.cpp index 05427fb84f..2fa0460f07 100644 --- a/isis/src/system/objs/KernelDb/KernelDb.cpp +++ b/isis/src/system/objs/KernelDb/KernelDb.cpp @@ -42,7 +42,7 @@ KernelDb::KernelDb(const unsigned int kernelTypes) { // Create a new KernelDb object using a filename -KernelDb::KernelDb(const std::string &dbName, const unsigned int kernelTypes) : +KernelDb::KernelDb(const QString &dbName, const unsigned int kernelTypes) : p_kernelData(dbName) { p_filename = dbName; p_kernelTypes = kernelTypes; @@ -123,7 +123,7 @@ Kernel KernelDb::Dem(Pvl &lab) { return FindLast("Dem", lab); } -Kernel KernelDb::FindLast(const std::string &entry, Isis::Pvl &lab) { +Kernel KernelDb::FindLast(const QString &entry, Isis::Pvl &lab) { std::priority_queue< Kernel > all = FindAll(entry, lab); Kernel last; @@ -134,7 +134,7 @@ Kernel KernelDb::FindLast(const std::string &entry, Isis::Pvl &lab) { return last; } -std::priority_queue< Kernel > KernelDb::FindAll(const std::string &entry, +std::priority_queue< Kernel > KernelDb::FindAll(const QString &entry, Isis::Pvl &lab) { std::priority_queue< Kernel > filesFound; Isis::PvlObject &cube = lab.FindObject("IsisCube"); @@ -144,13 +144,13 @@ std::priority_queue< Kernel > KernelDb::FindAll(const std::string &entry, if(!p_kernelData.HasObject(entry)) return filesFound; // Get the start and end time for the cube - iTime start(((string) cube.FindGroup("Instrument")["StartTime"])); + iTime start(((QString) cube.FindGroup("Instrument")["StartTime"])); iTime end; if(cube.FindGroup("Instrument").HasKeyword("StopTime")) { - end = ((string) cube.FindGroup("Instrument")["StopTime"]); + end = ((QString) cube.FindGroup("Instrument")["StopTime"]); } else { - end = ((string) cube.FindGroup("Instrument")["StartTime"]); + end = ((QString) cube.FindGroup("Instrument")["StartTime"]); } // Get the object and search through it's groups @@ -163,11 +163,11 @@ std::priority_queue< Kernel > KernelDb::FindAll(const std::string &entry, // If the group name isn't selection, skip it. if(!grp.IsNamed("Selection")) continue; - IString type = ""; + QString type = ""; // Make sure the type is better if(grp.HasKeyword("Type")) { - type = (string) grp["Type"]; + type = (QString) grp["Type"]; if(!(spiceInit::kernelTypeEnum(type) & p_kernelTypes)) { continue; } @@ -217,8 +217,8 @@ std::priority_queue< Kernel > KernelDb::FindAll(const std::string &entry, if(!key.IsNamed("Time")) continue; - iTime timeRangeStart((string)key[0]); - iTime timeRangeEnd((string)key[1]); + iTime timeRangeStart((QString)key[0]); + iTime timeRangeEnd((QString)key[1]); bool thisEndMatches = Matches(lab, endTimeGrp, timeRangeEnd, cameraVersion); endTimesMatch = endTimesMatch && thisEndMatches; @@ -232,8 +232,8 @@ std::priority_queue< Kernel > KernelDb::FindAll(const std::string &entry, // No exact match but time ranges overlap, merge the selections if(!betterMatch && endTimesMatch) { - std::vector< std::string > startMatchFiles = GetFile(grp); - std::vector< std::string > endMatchFiles = GetFile(endTimeGrp); + std::vector< QString > startMatchFiles = GetFile(grp); + std::vector< QString > endMatchFiles = GetFile(endTimeGrp); while(endMatchFiles.size()) { startMatchFiles.push_back( @@ -281,8 +281,8 @@ const bool KernelDb::Matches(Pvl &lab, PvlGroup &kernelDbGrp, if(key.IsNamed("Time")) { // Pull the selections start and end time out - iTime kernelStart = (string) key[0]; - iTime kernelEnd = (string) key[1]; + iTime kernelStart = (QString) key[0]; + iTime kernelEnd = (QString) key[1]; // If the kernel times inside of the requested times we // set the matchTime to be true. @@ -292,20 +292,14 @@ const bool KernelDb::Matches(Pvl &lab, PvlGroup &kernelDbGrp, } else if(key.IsNamed("Match")) { try { - IString matchGroup = key[0]; - IString matchKey = key[1]; - IString matchValue = key[2]; + QString matchGroup = key[0]; + QString matchKey = key[1]; + QString matchValue = key[2]; - IString cubeValue = (string)cube.FindGroup(matchGroup)[matchKey]; - cubeValue.ConvertWhiteSpace(); - cubeValue.Compress(); - cubeValue.Trim(" "); - cubeValue.UpCase(); + QString cubeValue = cube.FindGroup(matchGroup)[matchKey]; + cubeValue = cubeValue.simplified().trimmed().toUpper(); - matchValue.ConvertWhiteSpace(); - matchValue.Compress(); - matchValue.Trim(" "); - matchValue.UpCase(); + matchValue = matchValue.simplified().trimmed().toUpper(); // If strings are not the same, match automatically fails if(cubeValue.compare(matchValue) != 0) { @@ -324,11 +318,11 @@ const bool KernelDb::Matches(Pvl &lab, PvlGroup &kernelDbGrp, camVersionKeyIndex++) { bool versionMatch = false; - IString val = (std::string)key[camVersionKeyIndex]; + IString val = (QString)key[camVersionKeyIndex]; IString commaTok; - while((commaTok = val.Token(",")).length() > 0) { - if(commaTok.find('-') != std::string::npos) { + while((commaTok = val.Token(",").ToQt()).length() > 0) { + if(commaTok.find('-') != string::npos) { IString dashTok; int start = commaTok.Token("-").ToInteger(); int end = commaTok.Token("-").ToInteger(); @@ -367,14 +361,14 @@ const bool KernelDb::Matches(Pvl &lab, PvlGroup &kernelDbGrp, } // Load the DB with the defined BASE and MISSION info for each type of kernel -void KernelDb::LoadSystemDb(const std::string &mission) { +void KernelDb::LoadSystemDb(const QString &mission) { // Get the base DataDirectory PvlGroup &datadir = Preference::Preferences().FindGroup("DataDirectory"); - string baseDir = datadir["Base"]; + QString baseDir = datadir["Base"]; // Get the mission DataDirectory - string missionDir = datadir[mission]; + QString missionDir = datadir[mission]; // Load the leapsecond DB Isis::FileName lsDb(baseDir + "/" + "kernels/lsk/kernels.????.db"); @@ -443,8 +437,8 @@ void KernelDb::LoadSystemDb(const std::string &mission) { p_kernelData.Read(iakDb.expanded()); } -std::vector KernelDb::GetFile(PvlGroup &grp) { - std::vector files; +std::vector KernelDb::GetFile(PvlGroup &grp) { + std::vector files; //PvlKeyword kfile = grp["File"]; for(int i = 0; i < grp.Keywords(); i++) { @@ -455,8 +449,8 @@ std::vector KernelDb::GetFile(PvlGroup &grp) { // indicates an ISIS preference in the DataDirectory section // and a filename if(kfile.Size() == 2) { - string pref = kfile[0]; - string version = kfile[1]; + QString pref = kfile[0]; + QString version = kfile[1]; Isis::FileName filename("$" + pref + "/" + version); if (filename.isVersioned()) filename = filename.highestVersion(); @@ -470,7 +464,7 @@ std::vector KernelDb::GetFile(PvlGroup &grp) { files.push_back(filename.originalPath() + "/" + filename.name()); } else { - string msg = "Invalid File keyword value in [Group = "; + QString msg = "Invalid File keyword value in [Group = "; msg += grp.Name() + "] in database file ["; msg += p_filename + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); @@ -480,8 +474,8 @@ std::vector KernelDb::GetFile(PvlGroup &grp) { return files; } -const bool KernelDb::Better(const std::string newType, - const std::string oldType) { +const bool KernelDb::Better(const QString newType, + const QString oldType) { return Better(spiceInit::kernelTypeEnum(newType), spiceInit::kernelTypeEnum(oldType)); } diff --git a/isis/src/system/objs/KernelDb/KernelDb.h b/isis/src/system/objs/KernelDb/KernelDb.h index bab9a987ac..bc90529e37 100644 --- a/isis/src/system/objs/KernelDb/KernelDb.h +++ b/isis/src/system/objs/KernelDb/KernelDb.h @@ -27,9 +27,10 @@ #include #include -#include "Pvl.h" +#include + #include "iTime.h" -#include "IString.h" +#include "Pvl.h" namespace spiceInit { @@ -40,12 +41,9 @@ namespace spiceInit { Smithed = 8 }; - inline kernelTypes kernelTypeEnum(const std::string &type) { - Isis::IString strng = type; - strng.ConvertWhiteSpace(); - strng.Compress(); - strng.Trim(" "); - strng.UpCase(); + inline kernelTypes kernelTypeEnum(const QString &type) { + QString strng = type.simplified().trimmed().toUpper(); + if(strng == "PREDICTED") return Predicted; if(strng == "NADIR") return Nadir; if(strng == "RECONSTRUCTED") return Reconstructed; @@ -105,7 +103,7 @@ class KernelDb { public: // constructor KernelDb(const unsigned int kernelTypes); - KernelDb(const std::string &dbName, const unsigned int kernelTypes); + KernelDb(const QString &dbName, const unsigned int kernelTypes); KernelDb(std::istream &dbStream, const unsigned int kernelTypes); // destructor @@ -123,25 +121,25 @@ class KernelDb { Kernel InstrumentAddendum(Isis::Pvl &lab); Kernel Dem(Isis::Pvl &lab); - Kernel FindLast(const std::string &entry, Isis::Pvl &lab); - std::priority_queue< Kernel > FindAll(const std::string &entry, + Kernel FindLast(const QString &entry, Isis::Pvl &lab); + std::priority_queue< Kernel > FindAll(const QString &entry, Isis::Pvl &lab); - void LoadSystemDb(const std::string &mission); + void LoadSystemDb(const QString &mission); // Returns true if the newType is allowed and better than // the oldType - const bool Better(const std::string newType, const std::string oldType); + const bool Better(const QString newType, const QString oldType); const bool Better(const spiceInit::kernelTypes newType, const spiceInit::kernelTypes oldType); const bool Matches(Isis::Pvl &lab, Isis::PvlGroup &kernelDbGrp, Isis::iTime timeToMatch, int cameraVersion); protected: - std::string p_filename; + QString p_filename; private: - std::vector GetFile(Isis::PvlGroup &grp); + std::vector GetFile(Isis::PvlGroup &grp); unsigned int p_kernelTypes; Isis::Pvl p_kernelData; }; @@ -157,7 +155,7 @@ class Kernel { kernelType = (spiceInit::kernelTypes)0; } - Kernel(spiceInit::kernelTypes type, const std::vector &data) { + Kernel(spiceInit::kernelTypes type, const std::vector &data) { kernelType = type; kernels = data; } @@ -169,19 +167,19 @@ class Kernel { const int size() { return kernels.size(); } - void push_back(const std::string &str) { + void push_back(const QString &str) { kernels.push_back(str); } - std::string &operator[](const int index) { + QString &operator[](const int index) { return kernels[index]; } - std::string operator[](const int index) const { + QString operator[](const int index) const { return kernels[index]; } spiceInit::kernelTypes kernelType; - std::vector kernels; + std::vector kernels; }; #endif diff --git a/isis/src/system/objs/KernelDb/unitTest.cpp b/isis/src/system/objs/KernelDb/unitTest.cpp index b60d6623ed..e2b38dca27 100644 --- a/isis/src/system/objs/KernelDb/unitTest.cpp +++ b/isis/src/system/objs/KernelDb/unitTest.cpp @@ -4,23 +4,24 @@ #include "Preference.h" #include "Pvl.h" +using namespace Isis; using namespace std; int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); + Preference::Preferences(true); KernelDb kdb("test.db", 15); - Isis::Pvl lab; - Isis::PvlObject obj("IsisCube"); - Isis::PvlGroup group("Instrument"); - Isis::PvlGroup group2("TestGroup"); - Isis::PvlKeyword keyword("TestKeyword", "TestValue"); - Isis::PvlKeyword startKey("StartTime", "2005 JUN 15 12:00:00.000 TDB"); - Isis::PvlKeyword spacecraft("SpacecraftName", "IdealSpacecraft"); - Isis::PvlKeyword instrument("InstrumentId", "IdealCamera"); - Isis::PvlKeyword endKey("StopTime", "2005 DEC 15 12:00:00.000 TDB"); - Isis::PvlKeyword endKey2("StopTime", "2005 JUN 15 12:14:00.000 TDB"); + Pvl lab; + PvlObject obj("IsisCube"); + PvlGroup group("Instrument"); + PvlGroup group2("TestGroup"); + PvlKeyword keyword("TestKeyword", "TestValue"); + PvlKeyword startKey("StartTime", "2005 JUN 15 12:00:00.000 TDB"); + PvlKeyword spacecraft("SpacecraftName", "IdealSpacecraft"); + PvlKeyword instrument("InstrumentId", "IdealCamera"); + PvlKeyword endKey("StopTime", "2005 DEC 15 12:00:00.000 TDB"); + PvlKeyword endKey2("StopTime", "2005 JUN 15 12:14:00.000 TDB"); group2.AddKeyword(keyword); group.AddKeyword(startKey); group.AddKeyword(endKey); @@ -29,11 +30,11 @@ int main(int argc, char *argv[]) { obj.AddGroup(group); obj.AddGroup(group2); lab.AddObject(obj); - std::vector temp; + std::vector temp; - Isis::Pvl lab2; - Isis::PvlObject obj2("IsisCube"); - group.AddKeyword(endKey2, Isis::Pvl::Replace); + Pvl lab2; + PvlObject obj2("IsisCube"); + group.AddKeyword(endKey2, Pvl::Replace); obj2.AddGroup(group); obj2.AddGroup(group2); lab2.AddObject(obj2); diff --git a/isis/src/viking/apps/vik2isis/vik2isis.cpp b/isis/src/viking/apps/vik2isis/vik2isis.cpp index a626bc4c11..3c7f20e30e 100644 --- a/isis/src/viking/apps/vik2isis/vik2isis.cpp +++ b/isis/src/viking/apps/vik2isis/vik2isis.cpp @@ -1,7 +1,7 @@ #include "Isis.h" #include -#include +#include #include "stdlib.h" #include "ProcessImportPds.h" @@ -22,7 +22,7 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); FileName in = ui.GetFileName("FROM"); - string tempName = "$TEMPORARY/" + in.baseName() + ".img"; + QString tempName = "$TEMPORARY/" + in.baseName() + ".img"; FileName temp(tempName); bool tempFile = false; @@ -40,11 +40,11 @@ void IsisMain() { } catch(IException &e) { tempFile = true; - string command = "$ISISROOT/bin/vdcomp " + in.expanded() + " " + + QString command = "$ISISROOT/bin/vdcomp " + in.expanded() + " " + temp.expanded() + " > /dev/null 2>&1"; - int returnValue = system(command.c_str()) >> 8; + int returnValue = system(command.toAscii().data()) >> 8; if(returnValue) { - string msg = "Error running vdcomp"; + QString msg = "Error running vdcomp"; IException::ErrorType msgTarget = IException::Programmer; switch(returnValue) { case 1: @@ -53,7 +53,7 @@ void IsisMain() { break; case 2: msg = "vdcomp could not write its output file.\n" + - msg += "Check disk space or for duplicate filename."; + msg + "Check disk space or for duplicate filename."; break; case 3: msg = "vdcomp could not open the input file!"; @@ -87,7 +87,7 @@ void IsisMain() { p.SetPdsFile(in.expanded(), "", pdsLabel); } catch(IException &e) { - string msg = "Input file [" + in.expanded() + + QString msg = "Input file [" + in.expanded() + "] does not appear to be a Viking PDS product"; throw IException(e, IException::User, msg, _FILEINFO_); } @@ -97,42 +97,42 @@ void IsisMain() { TranslateVikingLabels(pdsLabel, ocube); p.EndProcess(); - if(tempFile) remove(temp.expanded().c_str()); + if(tempFile) remove(temp.expanded().toAscii().data()); return; } void TranslateVikingLabels(Pvl &pdsLabel, Cube *ocube) { // Setup the archive group PvlGroup arch("Archive"); - arch += PvlKeyword("DataSetId", (string)pdsLabel["DATA_SET_ID"]); - arch += PvlKeyword("ProductId", (string)pdsLabel["IMAGE_ID"]); - arch += PvlKeyword("MissonPhaseName", (string)pdsLabel["MISSION_PHASE_NAME"]); - arch += PvlKeyword("ImageNumber", (string)pdsLabel["IMAGE_NUMBER"]); - arch += PvlKeyword("OrbitNumber", (string)pdsLabel["ORBIT_NUMBER"]); + arch += PvlKeyword("DataSetId", (QString)pdsLabel["DATA_SET_ID"]); + arch += PvlKeyword("ProductId", (QString)pdsLabel["IMAGE_ID"]); + arch += PvlKeyword("MissonPhaseName", (QString)pdsLabel["MISSION_PHASE_NAME"]); + arch += PvlKeyword("ImageNumber", (QString)pdsLabel["IMAGE_NUMBER"]); + arch += PvlKeyword("OrbitNumber", (QString)pdsLabel["ORBIT_NUMBER"]); ocube->putGroup(arch); // Setup the instrument group // Note SpacecraftClockCount used to be FDS_COUNT PvlGroup inst("Instrument"); - inst += PvlKeyword("SpacecraftName", (string)pdsLabel["SPACECRAFT_NAME"]); - inst += PvlKeyword("InstrumentId", (string)pdsLabel["INSTRUMENT_NAME"]); - inst += PvlKeyword("TargetName", (string)pdsLabel["TARGET_NAME"]); + inst += PvlKeyword("SpacecraftName", (QString)pdsLabel["SPACECRAFT_NAME"]); + inst += PvlKeyword("InstrumentId", (QString)pdsLabel["INSTRUMENT_NAME"]); + inst += PvlKeyword("TargetName", (QString)pdsLabel["TARGET_NAME"]); - IString stime = (string) pdsLabel["IMAGE_TIME"]; - stime.Trim("Z"); + QString stime = (QString) pdsLabel["IMAGE_TIME"]; + stime.remove(QRegExp("Z$")); inst += PvlKeyword("StartTime", stime); inst += PvlKeyword("ExposureDuration", - (string)pdsLabel["EXPOSURE_DURATION"], "seconds"); - inst += PvlKeyword("SpacecraftClockCount", (string)pdsLabel["IMAGE_NUMBER"]); - inst += PvlKeyword("FloodModeId", (string)pdsLabel["FLOOD_MODE_ID"]); - inst += PvlKeyword("GainModeId", (string)pdsLabel["GAIN_MODE_ID"]); - inst += PvlKeyword("OffsetModeId", (string)pdsLabel["OFFSET_MODE_ID"]); + (QString)pdsLabel["EXPOSURE_DURATION"], "seconds"); + inst += PvlKeyword("SpacecraftClockCount", (QString)pdsLabel["IMAGE_NUMBER"]); + inst += PvlKeyword("FloodModeId", (QString)pdsLabel["FLOOD_MODE_ID"]); + inst += PvlKeyword("GainModeId", (QString)pdsLabel["GAIN_MODE_ID"]); + inst += PvlKeyword("OffsetModeId", (QString)pdsLabel["OFFSET_MODE_ID"]); ocube->putGroup(inst); // Setup the band bin group PvlGroup bandBin("BandBin"); - string filterName = pdsLabel["FILTER_NAME"]; + QString filterName = pdsLabel["FILTER_NAME"]; bandBin += PvlKeyword("FilterName", filterName); int filterId; @@ -168,31 +168,31 @@ void TranslateVikingLabels(Pvl &pdsLabel, Cube *ocube) { filterCenter = 0.590000; filterWidth = 0.150000; } - bandBin += PvlKeyword("FilterId", filterId); - bandBin += PvlKeyword("Center", filterCenter, "micrometers"); - bandBin += PvlKeyword("Width", filterWidth, "micrometers"); + bandBin += PvlKeyword("FilterId", toString(filterId)); + bandBin += PvlKeyword("Center", toString(filterCenter), "micrometers"); + bandBin += PvlKeyword("Width", toString(filterWidth), "micrometers"); ocube->putGroup(bandBin); // Setup the kernel group PvlGroup kern("Kernels"); int spn; - if((string) pdsLabel["SPACECRAFT_NAME"] == "VIKING_ORBITER_1") { - if((string) pdsLabel["INSTRUMENT_NAME"] == + if((QString) pdsLabel["SPACECRAFT_NAME"] == "VIKING_ORBITER_1") { + if((QString) pdsLabel["INSTRUMENT_NAME"] == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A") { - kern += PvlKeyword("NaifFrameCode", -27001); + kern += PvlKeyword("NaifFrameCode", "-27001"); } else { - kern += PvlKeyword("NaifFrameCode", -27002); + kern += PvlKeyword("NaifFrameCode", "-27002"); } spn = 1; } else { - if((string) pdsLabel["INSTRUMENT_NAME"] == + if((QString) pdsLabel["INSTRUMENT_NAME"] == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A") { - kern += PvlKeyword("NaifFrameCode", -30001); + kern += PvlKeyword("NaifFrameCode", "-30001"); } else { - kern += PvlKeyword("NaifFrameCode", -30002); + kern += PvlKeyword("NaifFrameCode", "-30002"); } spn = 2; } @@ -200,15 +200,15 @@ void TranslateVikingLabels(Pvl &pdsLabel, Cube *ocube) { // Set up the nominal reseaus group PvlGroup res("Reseaus"); - Pvl nomRes("$viking" + IString(spn) + "/reseaus/nominal.pvl"); + Pvl nomRes("$viking" + toString(spn) + "/reseaus/nominal.pvl"); PvlKeyword samps, lines, type, valid; lines = PvlKeyword("Line"); samps = PvlKeyword("Sample"); type = PvlKeyword("Type"); valid = PvlKeyword("Valid"); - string prefix; - if((string) pdsLabel["SPACECRAFT_NAME"] == "VIKING_ORBITER_1") { - if((string) pdsLabel["INSTRUMENT_NAME"] == + QString prefix; + if((QString) pdsLabel["SPACECRAFT_NAME"] == "VIKING_ORBITER_1") { + if((QString) pdsLabel["INSTRUMENT_NAME"] == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A") { prefix = "VO1_VISA_"; } @@ -217,7 +217,7 @@ void TranslateVikingLabels(Pvl &pdsLabel, Cube *ocube) { } } else { - if((string) pdsLabel["INSTRUMENT_NAME"] == + if((QString) pdsLabel["INSTRUMENT_NAME"] == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A") { prefix = "VO2_VISA_"; } diff --git a/isis/src/viking/apps/vikcal/CalParameters.cpp b/isis/src/viking/apps/vikcal/CalParameters.cpp index 6102587852..3d975aad96 100644 --- a/isis/src/viking/apps/vikcal/CalParameters.cpp +++ b/isis/src/viking/apps/vikcal/CalParameters.cpp @@ -30,48 +30,49 @@ #include "naif/SpiceUsr.h" #include "naif/SpiceZfc.h" #include "naif/SpiceZmc.h" -#include +#include #include using namespace std; namespace Isis { - CalParameters::CalParameters(const string &fname) { + CalParameters::CalParameters(const QString &fname) { try { // Extract Pvl Information from the file - Pvl pvl(fname); + Pvl pvl(fname.toAscii().data()); // Get keywords from input cube label PvlGroup &instrument = pvl.FindGroup("INSTRUMENT", Pvl::Traverse); // Make sure it is a viking mission - IString spacecraft = (string)instrument["SPACECRAFTNAME"]; - IString mission = spacecraft.Token("_"); + QString spacecraft = (QString)instrument["SPACECRAFTNAME"]; + QString mission = spacecraft.split("_").first(); + spacecraft = spacecraft.split("_").last(); if(mission != "VIKING") { - string msg = "Invalid Keyword [SpacecraftName]. " + spacecraft + + QString msg = "Invalid Keyword [SpacecraftName]. " + spacecraft + "must start with 'VIKING'"; throw IException(IException::User, msg, _FILEINFO_); } int spn = 0; - if((char)spacecraft[spacecraft.size() - 1] == '1') spn = 1; - if((char)spacecraft[spacecraft.size() - 1] == '2') spn = 2; + if((QChar)spacecraft[spacecraft.size() - 1] == '1') spn = 1; + if((QChar)spacecraft[spacecraft.size() - 1] == '2') spn = 2; if(spn == 0) { - string msg = "Invalid Keyword [SpacecraftName]. " + spacecraft + + QString msg = "Invalid Keyword [SpacecraftName]. " + spacecraft + "must terminate with '1' or '2'"; throw IException(IException::User, msg, _FILEINFO_); } double clock = instrument["SPACECRAFTCLOCKCOUNT"]; - IString instId = (string)instrument["INSTRUMENTID"]; + QString instId = (QString)instrument["INSTRUMENTID"]; int cam; // Camera State 4 is used to indicate an extended mission. This is // necessary because the dust spot changed position during the extended // mission, requiring a new set of calibration files. int cs4 = 0; - if((char)instId[instId.size() - 1] == 'A') { + if((QChar)instId[instId.size() - 1] == 'A') { if(spn == 1) cam = 7; else cam = 8; } - else if((char)instId[instId.size() - 1] == 'B') { + else if((QChar)instId[instId.size() - 1] == 'B') { if(spn == 1) { cam = 4; if(clock > 44800000) cs4 = 1; @@ -79,24 +80,24 @@ namespace Isis { else cam = 6; } else { - string msg = "Invalid Keyword [InstrumentID]. " + instId; + QString msg = "Invalid Keyword [InstrumentID]. " + instId; msg += "must terminate with an 'A' or 'B'"; throw IException(IException::User, msg, _FILEINFO_); } - string startTime = instrument["STARTTIME"]; + QString startTime = instrument["STARTTIME"]; CalcSunDist(startTime); p_labexp = (double)instrument["EXPOSUREDURATION"] * 1000.0; // convert to msec - string target = " "; + QString target = " "; PvlKeyword cs1 = instrument["FLOODMODEID"]; - if((string)cs1 == "ON") cs1 = 1; - else if((string)cs1 == "OFF") cs1 = 0; + if((QString)cs1 == "ON") cs1 = "1"; + else if((QString)cs1 == "OFF") cs1 = "0"; PvlKeyword cs2 = instrument["GAINMODEID"]; - if((string)cs2 == "LOW") cs2 = 0; - else if((string)cs2 == "HIGH") cs2 = 1; + if((QString)cs2 == "LOW") cs2 = "0"; + else if((QString)cs2 == "HIGH") cs2 = "1"; PvlKeyword cs3 = instrument["OFFSETMODEID"]; - if((string)cs3 == "ON") cs3 = 1; - else if((string)cs3 == "OFF") cs3 = 0; + if((QString)cs3 == "ON") cs3 = "1"; + else if((QString)cs3 == "OFF") cs3 = "0"; PvlKeyword wav = pvl.FindGroup("BANDBIN", Pvl::Traverse)["FILTERID"]; // Set up calibration, linearity, and offset variables for the input file @@ -105,7 +106,7 @@ namespace Isis { vikoffSetup(mission, spn, target, cam, clock, (int)cs3); } catch(IException &e) { - string msg = "Input file [" + fname + "] does not appear to be a viking image"; + QString msg = "Input file [" + fname + "] does not appear to be a viking image"; throw IException(IException::User, msg, _FILEINFO_); } } @@ -128,65 +129,46 @@ namespace Isis { * * @throws Isis::IException::Programmer - Could not find match in vikcal.sav */ - void CalParameters::vikcalSetup(string mission, int spn, string target, - int cam, string wav, int cs1, int cs2, int cs3, int cs4) { - vector line; + void CalParameters::vikcalSetup(QString mission, int spn, QString target, + int cam, QString wav, int cs1, int cs2, int cs3, int cs4) { + vector line; // Read in vikcal.sav calibration file - TextFile cal("$viking" + IString(spn) + "/calibration/vikcal.sav", + TextFile cal("$viking" + toString(spn) + "/calibration/vikcal.sav", "input", line, 0, true); // Search for a line in the vikcal.sav file that matches our data from the // input label for(int i = 0; i < (int)line.size(); i++) { - IString temp = line[i]; - temp.ConvertWhiteSpace(); - IString token = temp.Token(" "); - temp.TrimHead(" "); - if(token != mission) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != spn) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cam) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(token != wav) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cs1) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cs2) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cs3) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cs4) continue; + QString temp = line[i].simplified(); + + QStringList tokens = temp.split(" "); + + if(tokens.count() < 15) continue; + if(tokens[0] != mission) continue; + if(toInt(tokens[1]) != spn) continue; + if(toInt(tokens[2]) != cam) continue; + if(tokens[3] != wav) continue; + if(toInt(tokens[4]) != cs1) continue; + if(toInt(tokens[5]) != cs2) continue; + if(toInt(tokens[6]) != cs3) continue; + if(toInt(tokens[7]) != cs4) continue; // The line is a match for our data, so set all the // Calibration variables to their correct values - p_w0 = temp.Token(" "); - temp.TrimHead(" "); - p_dist = temp.Token(" "); - temp.TrimHead(" "); - p_gain = temp.Token(" "); - temp.TrimHead(" "); - p_offset = temp.Token(" "); - temp.TrimHead(" "); - p_exp = temp.Token(" "); - temp.TrimHead(" "); - p_gainFile = "$viking" + IString(spn) + "/calibration/" + temp.Token(" ") + p_w0 = toDouble(tokens[8]); + p_dist = toDouble(tokens[9]); + p_gain = toDouble(tokens[10]); + p_offset = toDouble(tokens[11]); + p_exp = toDouble(tokens[12]); + p_gainFile = "$viking" + toString(spn) + "/calibration/" + tokens[13] + ".cub"; - temp.TrimHead(" "); - p_offsetFile = "$viking" + IString(spn) + "/calibration/" + - temp.Token(" ") + ".cub"; + p_offsetFile = "$viking" + toString(spn) + "/calibration/" + + tokens[14] + ".cub"; return; } - string msg = "Could not find match in [vikcal.sav] calibration file"; + QString msg = "Could not find match in [vikcal.sav] calibration file"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -229,47 +211,34 @@ namespace Isis { * * @throws Isis::IException::Programmer - Could not find match in viklin.sav */ - void CalParameters::viklinSetup(string mission, int spn, string target, - int cam, string wav, int cs1, int cs2, int cs3, int cs4) { + void CalParameters::viklinSetup(QString mission, int spn, QString target, + int cam, QString wav, int cs1, int cs2, int cs3, int cs4) { - vector line; - TextFile lin("$viking" + IString(spn) + "/calibration/viklin.sav", + vector line; + TextFile lin("$viking" + toString(spn) + "/calibration/viklin.sav", "input", line, 0, true); for(int i = 0; i < (int)line.size(); i++) { - IString temp = line[i]; - temp.ConvertWhiteSpace(); - IString token = temp.Token(" "); - temp.TrimHead(" "); - if(token != mission) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != spn) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cam) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(token != wav) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cs1) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cs2) continue; - token = temp.Token(" "); - temp.TrimHead(" "); - if(int(token) != cs3) continue; + QString temp = line[i].simplified(); + + QStringList tokens = temp.split(" "); + + if(tokens.count() < 10) continue; + if(tokens[0] != mission) continue; + if(toInt(tokens[1]) != spn) continue; + if(toInt(tokens[2]) != cam) continue; + if(tokens[3] != wav) continue; + if(toInt(tokens[4]) != cs1) continue; + if(toInt(tokens[5]) != cs2) continue; + if(toInt(tokens[6]) != cs3) continue; // Set all Linearity variables to the correct values - p_b = temp.Token(" "); - temp.TrimHead(" "); - p_k = temp.Token(" "); - temp.TrimHead(" "); - p_normpow = temp.Token(" "); + p_b = toDouble(tokens[7]); + p_k = toDouble(tokens[8]); + p_normpow = toDouble(tokens[9]); return; } - string msg = "Could not find match in [viklin.sav] calibration file"; + QString msg = "Could not find match in [viklin.sav] calibration file"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -287,14 +256,14 @@ namespace Isis { * * @throws Isis::IException::Programmer - Could not find match in vikoff.sav */ - void CalParameters::vikoffSetup(string mission, int spn, string target, + void CalParameters::vikoffSetup(QString mission, int spn, QString target, int cam, double clock, int cs3) { - vector line; + vector line; // Get the correct offset file - depends on which camera the input image is // from - string fname = "$viking" + IString(spn) + "/calibration/vikoffcam" + - IString(cam) + ".sav"; + QString fname = "$viking" + toString(spn) + "/calibration/vikoffcam" + + toString(cam) + ".sav"; TextFile off(fname, "input", line, 0, true); vector pp[5], off3; double pp1_off[5], pp2_off[5], pp_off[5]; @@ -302,72 +271,56 @@ namespace Isis { double frm1 = -1.0; double frm2 = -1.0; for(int i = 0; i < (int)line.size(); i++) { - IString temp = line[i]; - temp.ConvertWhiteSpace(); - temp.TrimHead(" "); - IString token = temp.Token(" "); - temp.TrimHead(" "); + QString temp = line[i].simplified(); + + QStringList tokens = temp.split(" "); + + if(tokens.isEmpty()) continue; // Go through the first line of the offset file and set all the principle // point locations - if(token == "VIKING") { - if(int(temp.Token(" ")) == spn) { } - temp.TrimHead(" "); - if(int(temp.Token(" ")) == cam) { } - temp.TrimHead(" "); - pp[0].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[0].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[1].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[1].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[2].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[2].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[3].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[3].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[4].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp[4].push_back((double)temp.Token(" ")); - temp.TrimHead(" "); + if(tokens[0] == "VIKING") { + if (tokens.count() < 12) continue; + + if(toInt(tokens[1]) == spn) { } + if(toInt(tokens[2]) == cam) { } + pp[0].push_back(toDouble(tokens[3])); + pp[0].push_back(toDouble(tokens[4])); + pp[1].push_back(toDouble(tokens[5])); + pp[1].push_back(toDouble(tokens[6])); + pp[2].push_back(toDouble(tokens[7])); + pp[2].push_back(toDouble(tokens[8])); + pp[3].push_back(toDouble(tokens[9])); + pp[3].push_back(toDouble(tokens[10])); + pp[4].push_back(toDouble(tokens[11])); + pp[4].push_back(toDouble(tokens[12])); continue; } - if(double(token) < clock) { - frm1 = token; - off3.push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp1_off[2] = temp.Token(" "); - temp.TrimHead(" "); - pp1_off[0] = pp1_off[2] + (double)temp.Token(" "); - temp.TrimHead(" "); - pp1_off[1] = pp1_off[2] + (double)temp.Token(" "); - temp.TrimHead(" "); - pp1_off[3] = pp1_off[2] + (double)temp.Token(" "); - temp.TrimHead(" "); - pp1_off[4] = pp1_off[2] + (double)temp.Token(" "); + if(toDouble(tokens[0]) < clock) { + if (tokens.count() < 7) continue; + + frm1 = toDouble(tokens[0]); + off3.push_back(toDouble(tokens[1])); + pp1_off[2] = toDouble(tokens[2]); + pp1_off[0] = pp1_off[2] + toDouble(tokens[3]); + pp1_off[1] = pp1_off[2] + toDouble(tokens[4]); + pp1_off[3] = pp1_off[2] + toDouble(tokens[5]); + pp1_off[4] = pp1_off[2] + toDouble(tokens[6]); continue; } else { - frm2 = token; - off3.push_back((double)temp.Token(" ")); - temp.TrimHead(" "); - pp2_off[2] = temp.Token(" "); - temp.TrimHead(" "); - pp2_off[0] = pp2_off[2] + (double)temp.Token(" "); - temp.TrimHead(" "); - pp2_off[1] = pp2_off[2] + (double)temp.Token(" "); - temp.TrimHead(" "); - pp2_off[3] = pp2_off[2] + (double)temp.Token(" "); - temp.TrimHead(" "); - pp2_off[4] = pp2_off[2] + (double)temp.Token(" "); + if (tokens.count() < 7) continue; + + frm2 = toDouble(tokens[0]); + off3.push_back(toDouble(tokens[1])); + pp2_off[2] = toDouble(tokens[2]); + pp2_off[0] = pp2_off[2] + toDouble(tokens[3]); + pp2_off[1] = pp2_off[2] + toDouble(tokens[4]); + pp2_off[3] = pp2_off[2] + toDouble(tokens[5]); + pp2_off[4] = pp2_off[2] + toDouble(tokens[6]); } if(frm1 == -1.0 || frm2 == -1.0) { - string msg = "Could not find match in [vikoff.sav] calibration file"; + QString msg = "Could not find match in [vikoff.sav] calibration file"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -412,7 +365,7 @@ namespace Isis { return; } - string msg = "Could not find match in [vikoff.sav] calibration file"; + QString msg = "Could not find match in [vikoff.sav] calibration file"; throw IException(IException::Programmer, msg, _FILEINFO_); } @@ -421,16 +374,16 @@ namespace Isis { * * @param t iTime */ - void CalParameters::CalcSunDist(string t) { + void CalParameters::CalcSunDist(QString t) { double sunv[3]; SpiceDouble lt, et; FileName fname1 = (FileName)"$base/kernels/lsk/naif0007.tls"; FileName fname2 = (FileName)"$base/kernels/spk/de405.bsp"; - string tempfname1 = fname1.expanded(); - string tempfname2 = fname2.expanded(); - furnsh_c(tempfname1.c_str()); - furnsh_c(tempfname2.c_str()); - utc2et_c(t.c_str(), &et); + QString tempfname1 = fname1.expanded(); + QString tempfname2 = fname2.expanded(); + furnsh_c(tempfname1.toAscii().data()); + furnsh_c(tempfname2.toAscii().data()); + utc2et_c(t.toAscii().data(), &et); spkezp_c(10, et, "J2000", "LT+S", 499, sunv, <); p_dist1 = sqrt(sunv[0] * sunv[0] + sunv[1] * sunv[1] + sunv[2] * sunv[2]); } diff --git a/isis/src/viking/apps/vikcal/CalParameters.h b/isis/src/viking/apps/vikcal/CalParameters.h index dbd7ba0659..8732a03b72 100644 --- a/isis/src/viking/apps/vikcal/CalParameters.h +++ b/isis/src/viking/apps/vikcal/CalParameters.h @@ -22,9 +22,10 @@ * http://www.usgs.gov/privacy.html. */ -#include #include +#include + namespace Isis { /** * @brief Sets up calibration parameters for Viking images @@ -47,7 +48,7 @@ namespace Isis { class CalParameters { public: // Constructor - CalParameters(const std::string &fname); + CalParameters(const QString &fname); /** * Calculates and returns time based offset at specified line and sample @@ -112,7 +113,7 @@ namespace Isis { * * @return string Gain file */ - inline std::string GainFile() { + inline QString GainFile() { return p_gainFile; } @@ -121,7 +122,7 @@ namespace Isis { * * @return string Offset file */ - inline std::string OffsetFile() { + inline QString OffsetFile() { return p_offsetFile; } @@ -224,13 +225,13 @@ namespace Isis { } private: - void vikcalSetup(std::string mission, int spn, std::string target, - int cam, std::string wav, int cs1, int cs2, int cs3, int cs4); - void viklinSetup(std::string mission, int spn, std::string target, - int cam, std::string wav, int cs1, int cs2, int cs3, int cs4); - void vikoffSetup(std::string mission, int spn, std::string target, + void vikcalSetup(QString mission, int spn, QString target, + int cam, QString wav, int cs1, int cs2, int cs3, int cs4); + void viklinSetup(QString mission, int spn, QString target, + int cam, QString wav, int cs1, int cs2, int cs3, int cs4); + void vikoffSetup(QString mission, int spn, QString target, int cam, double clock, int cs3); - void CalcSunDist(std::string t); + void CalcSunDist(QString t); double p_labexp; //!GainFile()).expanded(); - const string offsetFile = (string)FileName(calParam->OffsetFile()).expanded(); + const QString gainFile = (QString)FileName(calParam->GainFile()).expanded(); + const QString offsetFile = (QString)FileName(calParam->OffsetFile()).expanded(); // Setup the input cubes p.SetInputCube("FROM"); @@ -64,24 +64,24 @@ void IsisMain() { calgrp.AddComment("DI(l,s) = (1.0/(exp*w1))*G(l,s)*(gain*DR(l,s)+DC(l,s)+offt+offc)"); calgrp.AddComment("with w1 = w0*((dist0*dist0) / (dist1*dist1))"); calgrp.AddComment("and offt(l,s) = A*l + B*l*l + C*s + D*l*s + E"); - calgrp += PvlKeyword("offc", calParam->Offset()); - calgrp += PvlKeyword("exp", calParam->Exposure()); - calgrp += PvlKeyword("gain", calParam->Gain()); + calgrp += PvlKeyword("offc", toString(calParam->Offset())); + calgrp += PvlKeyword("exp", toString(calParam->Exposure())); + calgrp += PvlKeyword("gain", toString(calParam->Gain())); calgrp += PvlKeyword("DR", in); calgrp += PvlKeyword("DC", calParam->OffsetFile()); calgrp += PvlKeyword("G", calParam->GainFile()); - calgrp += PvlKeyword("w0", calParam->Omega0()); - calgrp += PvlKeyword("w1", calParam->Omega1()); - calgrp += PvlKeyword("dist0", calParam->Distance()); - calgrp += PvlKeyword("dist1", calParam->Dist1()); - calgrp += PvlKeyword("1.0/exp*w1", 1.0 / (calParam->Exposure() * calParam->Omega1())); - - calgrp += PvlKeyword("Acoeff", calParam->Acoeff()); - calgrp += PvlKeyword("Bcoeff", calParam->Bcoeff()); - calgrp += PvlKeyword("Ccoeff", calParam->Ccoeff()); - calgrp += PvlKeyword("Dcoeff", calParam->Dcoeff()); - calgrp += PvlKeyword("Ecoeff", calParam->Ecoeff()); + calgrp += PvlKeyword("w0", toString(calParam->Omega0())); + calgrp += PvlKeyword("w1", toString(calParam->Omega1())); + calgrp += PvlKeyword("dist0", toString(calParam->Distance())); + calgrp += PvlKeyword("dist1", toString(calParam->Dist1())); + calgrp += PvlKeyword("1.0/exp*w1", toString(1.0 / (calParam->Exposure() * calParam->Omega1()))); + + calgrp += PvlKeyword("Acoeff", toString(calParam->Acoeff())); + calgrp += PvlKeyword("Bcoeff", toString(calParam->Bcoeff())); + calgrp += PvlKeyword("Ccoeff", toString(calParam->Ccoeff())); + calgrp += PvlKeyword("Dcoeff", toString(calParam->Dcoeff())); + calgrp += PvlKeyword("Ecoeff", toString(calParam->Ecoeff())); ocube->putGroup(calgrp); diff --git a/isis/src/viking/apps/viknobutter/viknobutter.cpp b/isis/src/viking/apps/viknobutter/viknobutter.cpp index 6efd18f0ee..dc4cbc66d2 100644 --- a/isis/src/viking/apps/viknobutter/viknobutter.cpp +++ b/isis/src/viking/apps/viknobutter/viknobutter.cpp @@ -18,18 +18,18 @@ void IsisMain() { Pvl p(ui.GetFileName("FROM")); PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); int spn; - string scn = (string)inst["SpacecraftName"]; + QString scn = (QString)inst["SpacecraftName"]; if(scn == "VIKING_ORBITER_1") spn = 1; else if(scn == "VIKING_ORBITER_2") spn = 2; else { - string msg = "Invalid spacecraftname [" + scn + "]"; + QString msg = "Invalid spacecraftname [" + scn + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } // determine if # of cols is even or odd bool even = true; PvlGroup &arch = p.FindGroup("Archive", Pvl::Traverse); - string id = (string)arch["ProductId"]; - int num = IString(id.substr(5, 1)).ToInteger(); + QString id = (QString)arch["ProductId"]; + int num = toInt(id.mid(5, 1)); if(num == 1 || num == 3 || num == 5 || num == 7 || num == 9) even = false; // Run a standard deviation filter on the cube @@ -59,8 +59,8 @@ void IsisMain() { pipeline.Application("mask").SetInputParameter("FROM", false); pipeline.Application("mask").SetOutputParameter("TO", "step3"); - IString maskParameter = "$ISIS3DATA/viking" + IString(spn) + - "/calibration/vik" + IString(spn); + QString maskParameter = "$ISIS3DATA/viking" + toString(spn) + + "/calibration/vik" + toString(spn); if(even) maskParameter += "evenMask.cub"; else maskParameter += "oddMask.cub"; pipeline.Application("mask").AddConstParameter("mask", maskParameter); diff --git a/isis/src/viking/objs/VikingCamera/VikingCamera.cpp b/isis/src/viking/objs/VikingCamera/VikingCamera.cpp index 0e02e97d09..742caf5a09 100644 --- a/isis/src/viking/objs/VikingCamera/VikingCamera.cpp +++ b/isis/src/viking/objs/VikingCamera/VikingCamera.cpp @@ -60,9 +60,9 @@ namespace Isis { // Find out what camera is being used, and set the focal length, altinstcode, // raster orientation, cone, crosscone, and camera PvlGroup inst = lab.FindGroup("Instrument", Pvl::Traverse); - IString spacecraft = (string)inst["SPACECRAFTNAME"]; - IString instId = (string)inst["INSTRUMENTID"]; - string cam; + QString spacecraft = inst["SPACECRAFTNAME"]; + QString instId = inst["INSTRUMENTID"]; + QString cam; int spn; double raster, cone, crosscone; int altinstcode = 0; @@ -87,8 +87,8 @@ namespace Isis { raster = 90.022800; } else { - string msg = "File does not appear to be a Viking image. InstrumentId [" - + instId + "] is invalid Viking value."; + QString msg = "File does not appear to be a Viking image. InstrumentId [" + + instId + "] is invalid Viking value."; throw IException(IException::User, msg, _FILEINFO_); } } @@ -113,13 +113,13 @@ namespace Isis { raster = 89.663790; } else { - string msg = "File does not appear to be a Viking image. InstrumentId [" - + instId + "] is invalid Viking value."; + QString msg = "File does not appear to be a Viking image. InstrumentId [" + + instId + "] is invalid Viking value."; throw IException(IException::User, msg, _FILEINFO_); } } else { - string msg = "File does not appear to be a Viking image. SpacecraftName [" + QString msg = "File does not appear to be a Viking image. SpacecraftName [" + spacecraft + "] is invalid Viking value."; throw IException(IException::User, msg, _FILEINFO_); } @@ -143,7 +143,7 @@ namespace Isis { *****************************************************************************/ // Get clock count and convert it to a time - string spacecraftClock = inst["SpacecraftClockCount"]; + QString spacecraftClock = inst["SpacecraftClockCount"]; double etClock = getClockTime(spacecraftClock, altinstcode).Et(); // exposure duration keyword value is measured in seconds @@ -172,8 +172,8 @@ namespace Isis { focalMap->SetDetectorOrigin(602.0, 528.0); // Setup distortion map - const string fname = FileName("$viking" + IString(spn) + "/reseaus/vik" + cam - + "MasterReseaus.pvl").expanded(); + QString fname = FileName("$viking" + toString(spn) + "/reseaus/vik" + cam + + "MasterReseaus.pvl").expanded(); new ReseauDistortionMap(this, lab, fname); // Setup the ground and sky map diff --git a/isis/src/viking/objs/VikingCamera/unitTest.cpp b/isis/src/viking/objs/VikingCamera/unitTest.cpp index 637289371b..9f97bc8947 100644 --- a/isis/src/viking/objs/VikingCamera/unitTest.cpp +++ b/isis/src/viking/objs/VikingCamera/unitTest.cpp @@ -69,9 +69,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; diff --git a/isis/src/voyager/apps/voy2isis/voy2isis.cpp b/isis/src/voyager/apps/voy2isis/voy2isis.cpp index 72cdef7e68..415a06b7a9 100644 --- a/isis/src/voyager/apps/voy2isis/voy2isis.cpp +++ b/isis/src/voyager/apps/voy2isis/voy2isis.cpp @@ -2,7 +2,8 @@ #include #include -#include +#include +#include #include "FileName.h" #include "IException.h" @@ -32,16 +33,16 @@ void IsisMain() { UserInterface &ui = Application::GetUserInterface(); FileName in = ui.GetFileName("FROM"); - string tempName = "$TEMPORARY/" + in.baseName() + ".img"; + QString tempName = "$TEMPORARY/" + in.baseName() + ".img"; FileName temp(tempName); bool tempFile = false; // input files are compressed, use vdcomp to decompress - IString ext = IString(in.extension()).UpCase(); + QString ext = in.extension().toUpper(); if(ext == "IMQ") { try { - string command = "$ISISROOT/bin/vdcomp " + in.expanded() + " " + temp.expanded(); + QString command = "$ISISROOT/bin/vdcomp " + in.expanded() + " " + temp.expanded(); // don't pretend vdcomp is a standard Isis program, just run it ProgramLauncher::RunSystemCommand(command); in = temp.expanded(); @@ -58,7 +59,7 @@ void IsisMain() { // Do nothing } else { - string msg = "Input file [" + in.name() + + QString msg = "Input file [" + in.name() + "] does not appear to be a Voyager EDR"; throw IException(IException::User, msg, _FILEINFO_); } @@ -68,7 +69,7 @@ void IsisMain() { p.SetPdsFile(in.expanded(), "", pdsLabel); } catch(IException &e) { - string msg = "Unable to set PDS file. Decompressed input file [" + QString msg = "Unable to set PDS file. Decompressed input file [" + in.name() + "] does not appear to be a PDS product"; throw IException(IException::User, msg, _FILEINFO_); } @@ -78,7 +79,7 @@ void IsisMain() { TranslateVoyagerLabels(pdsLabel, ocube); p.EndProcess(); - if(tempFile) remove(temp.expanded().c_str()); + if(tempFile) QFile::remove(temp.expanded()); } /** @@ -94,20 +95,20 @@ void ConvertComments(FileName file) { unsigned int lineStartPos = 0; fstream stream; - IString filename = file.expanded(); - stream.open(filename.c_str(), fstream::in | fstream::out | fstream::binary); + QString filename = file.expanded(); + stream.open(filename.toAscii().data(), fstream::in | fstream::out | fstream::binary); lineStartPos = stream.tellg(); stream.getline(tmp, sizeof(tmp) / sizeof(char)); - while(IString(tmp).find("END") != 0 && stream.good()) { - IString lineOfData(tmp); + while(!QString(tmp).startsWith("END") && stream.good()) { + QString lineOfData(tmp); - if(lineOfData.find("/*") != string::npos && - lineOfData.find("*/") == string::npos) { - lineOfData = lineOfData.substr(0, lineOfData.find("/*")) + "# " + - lineOfData.substr(lineOfData.find("/*") + 2); + if(lineOfData.contains("/*") && + !lineOfData.contains("*/")) { + lineOfData = lineOfData.mid(0, lineOfData.indexOf("/*")) + "# " + + lineOfData.mid(lineOfData.indexOf("/*") + 2); stream.seekp(lineStartPos); - stream.write(lineOfData.c_str(), lineOfData.length()); + stream.write(lineOfData.toAscii().data(), lineOfData.length()); } lineStartPos = stream.tellg(); @@ -129,7 +130,7 @@ void ConvertComments(FileName file) { void TranslateVoyagerLabels(Pvl &inputLabel, Cube *ocube) { // Get the directory where the Voyager translation tables are PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory"); - IString missionDir = (string) dataDir[(string)inputLabel["SpacecraftName"]]; + QString missionDir = (QString) dataDir[(QString)inputLabel["SpacecraftName"]]; FileName transFile(missionDir + "/translations/voyager.trn"); // Get the translation manager ready @@ -147,11 +148,11 @@ void TranslateVoyagerLabels(Pvl &inputLabel, Cube *ocube) { // Camera_State_2 is from ShutterModeId and is 1 or 0, it is only 1 if // it is WA and BSIMAN or BOTSIM PvlKeyword sModeId = inst["ScanModeId"]; - string cs1 = sModeId[0].Token(":"); + QString cs1 = sModeId[0].split(":").first(); inst.AddKeyword(PvlKeyword("CameraState1",cs1)); - string shutterMode = inst["ShutterModeId"]; - string cam = inst["InstrumentId"]; + QString shutterMode = inst["ShutterModeId"]; + QString cam = inst["InstrumentId"]; if (cam == "WIDE_ANGLE_CAMERA" && (shutterMode == "BOTSIM" || shutterMode == "BSIMAN")) { inst.AddKeyword(PvlKeyword("CameraState2","1")); } @@ -160,7 +161,7 @@ void TranslateVoyagerLabels(Pvl &inputLabel, Cube *ocube) { } // Translate the band bin group information - if((string)inst["InstrumentId"] == "WIDE_ANGLE_CAMERA") { + if((QString)inst["InstrumentId"] == "WIDE_ANGLE_CAMERA") { FileName bandBinTransFile(missionDir + "/translations/voyager_wa_bandbin.trn"); PvlTranslationManager labelXlater(inputLabel, bandBinTransFile.expanded()); labelXlater.Auto(*(outputLabel)); @@ -180,62 +181,62 @@ void TranslateVoyagerLabels(Pvl &inputLabel, Cube *ocube) { // Setup the kernel group PvlGroup kern("Kernels"); - IString spacecraftNumber; + QString spacecraftNumber; int spacecraftCode = 0; - IString instId = (string) inst.FindKeyword("InstrumentId"); - if((string) inst.FindKeyword("SpacecraftName") == "VOYAGER_1") { + QString instId = (QString) inst.FindKeyword("InstrumentId"); + if((QString) inst.FindKeyword("SpacecraftName") == "VOYAGER_1") { spacecraftNumber = "1"; if(instId == "NARROW_ANGLE_CAMERA") { spacecraftCode = -31101; - kern += PvlKeyword("NaifFrameCode", spacecraftCode); + kern += PvlKeyword("NaifFrameCode", toString(spacecraftCode)); instId = "issna"; } else if (instId == "WIDE_ANGLE_CAMERA") { spacecraftCode = -31102; - kern += PvlKeyword("NaifFrameCode", spacecraftCode); + kern += PvlKeyword("NaifFrameCode", toString(spacecraftCode)); instId = "isswa"; } else { - string msg = "Instrument ID [" + instId + "] does not match Narrow or" + + QString msg = "Instrument ID [" + instId + "] does not match Narrow or" + "Wide angle camera"; throw IException(IException::User, msg, _FILEINFO_); } } - else if((string) inst.FindKeyword("SpacecraftName") == "VOYAGER_2") { + else if((QString) inst.FindKeyword("SpacecraftName") == "VOYAGER_2") { spacecraftNumber = "2"; if(instId == "NARROW_ANGLE_CAMERA") { spacecraftCode = -32101; - kern += PvlKeyword("NaifFrameCode", spacecraftCode); + kern += PvlKeyword("NaifFrameCode", toString(spacecraftCode)); instId = "issna"; } else if (instId == "WIDE_ANGLE_CAMERA") { spacecraftCode = -32102; - kern += PvlKeyword("NaifFrameCode", spacecraftCode); + kern += PvlKeyword("NaifFrameCode", toString(spacecraftCode)); instId = "isswa"; } else { - string msg = "Instrument ID [" + instId + "] does not match Narrow or" + + QString msg = "Instrument ID [" + instId + "] does not match Narrow or" + "Wide angle camera"; throw IException(IException::User, msg, _FILEINFO_); } } else { - string msg = "Spacecraft name [" + (string)inst.FindKeyword("SpacecraftName") + + QString msg = "Spacecraft name [" + (QString)inst.FindKeyword("SpacecraftName") + "] does not match Voyager1 or Voyager2 spacecraft"; throw IException(IException::User, msg, _FILEINFO_); } ocube->putGroup(kern); // Modify time to remove Z from end - IString time = inst.FindKeyword("StartTime")[0]; - time.Remove("Z"); + QString time = inst.FindKeyword("StartTime")[0]; + time.remove("Z"); inst.FindKeyword("StartTime").SetValue(time); // Fix image number - remove the period, if Wide angle camera and one of two // shutter modes, we must fix the wide angle image number for use below. // Before #####.## After ####### - IString imgNumber = inst["SpacecraftClockCount"][0]; - imgNumber.Replace(".", ""); + QString imgNumber = inst["SpacecraftClockCount"][0]; + imgNumber.replace(".", ""); // Save this change inst["SpacecraftClockCount"] = imgNumber; @@ -252,14 +253,14 @@ void TranslateVoyagerLabels(Pvl &inputLabel, Cube *ocube) { if((inst["ShutterModeId"][0] == "BSIMAN" || inst["ShutterModeId"][0] == "BOTSIM") && inst["InstrumentId"][0] == "WIDE_ANGLE_CAMERA") { - IString scanId = inst["ScanModeId"][0]; - int scanNum = IString(scanId.substr(0, 1)).ToInteger(); - int imgNum = imgNumber.ToInteger(); + QString scanId = inst["ScanModeId"][0]; + int scanNum = toInt(scanId.mid(0, 1)); + int imgNum = toInt(imgNumber); // We'll use this later, however, we do not write it to the labels. // if we didn't get in here, we'll be using the original image number, // otherwise, we'll use this modified image number. - imgNumber = IString((imgNum - scanNum)); + imgNumber = QString((imgNum - scanNum)); } // This next section handles modifying the starttime slightly and requires @@ -307,31 +308,31 @@ void TranslateVoyagerLabels(Pvl &inputLabel, Cube *ocube) { NaifStatus::CheckErrors(); //* 3 *// // Leapsecond kernel - string lsk = "$ISIS3DATA/base/kernels/lsk/naif????.tls"; + QString lsk = "$ISIS3DATA/base/kernels/lsk/naif????.tls"; FileName lskName(lsk); lskName = lskName.highestVersion(); - furnsh_c(lskName.expanded().c_str()); + furnsh_c(lskName.expanded().toAscii().data()); // Spacecraft clock kernel - string sclk = "$ISIS3DATA/voyager"; + QString sclk = "$ISIS3DATA/voyager"; sclk.append(spacecraftNumber); sclk.append("/kernels/sclk/vg"); sclk.append(spacecraftNumber); sclk.append("?????.tsc"); FileName sclkName(sclk); sclkName = sclkName.highestVersion(); - furnsh_c(sclkName.expanded().c_str()); + furnsh_c(sclkName.expanded().toAscii().data()); // The purpose of the next two steps, getting the spacecraft clock count, // are simply to get get the partition, the very first number 1/... double approxEphemeris = 0.0; - utc2et_c(inst["StartTime"][0].c_str(), &approxEphemeris); + utc2et_c(inst["StartTime"][0].toAscii().data(), &approxEphemeris); char approxSpacecraftClock[80]; // sce2s_c requires the spacecraft number, not the instrument number as // we've found elsewhere, either -31 or -32 in this case. int spacecraftClockNumber = -30; - spacecraftClockNumber -= spacecraftNumber.ToInteger(); + spacecraftClockNumber -= toInt(spacecraftNumber); sce2s_c(spacecraftClockNumber, approxEphemeris, 80, approxSpacecraftClock); /* @@ -352,21 +353,21 @@ void TranslateVoyagerLabels(Pvl &inputLabel, Cube *ocube) { */ // Get first digit and the / - IString newClockCount = string(approxSpacecraftClock).substr(0, 2); + QString newClockCount = QString(approxSpacecraftClock).mid(0, 2); // Get first five digits of imgNumber and append - newClockCount.append(imgNumber.substr(0, 5)); + newClockCount.append(imgNumber.mid(0, 5)); // I'll stop commenting now, you can read code as well as me newClockCount.append(":"); // I lied ;) get the last two digits. - newClockCount.append(imgNumber.substr(5, 2)); + newClockCount.append(imgNumber.mid(5, 2)); - scs2e_c(spacecraftClockNumber, newClockCount.c_str(), &approxEphemeris); + scs2e_c(spacecraftClockNumber, newClockCount.toAscii().data(), &approxEphemeris); //* 4 *// char utcOut[25]; et2utc_c(approxEphemeris, "ISOC", 3, 26, utcOut); NaifStatus::CheckErrors(); - inst["StartTime"].SetValue(IString(utcOut)); + inst["StartTime"].SetValue(QString(utcOut)); // Set up the nominal reseaus group PvlGroup res("Reseaus"); @@ -378,21 +379,21 @@ void TranslateVoyagerLabels(Pvl &inputLabel, Cube *ocube) { valid = PvlKeyword("Valid"); PvlKeyword key = nomRes.FindKeyword("VG" + spacecraftNumber + "_" - + instId.UpCase() + "_RESEAUS"); - int numRes = nomRes["VG" + spacecraftNumber + "_" + instId.UpCase() + + instId.toUpper() + "_RESEAUS"); + int numRes = nomRes["VG" + spacecraftNumber + "_" + instId.toUpper() + "_NUMBER_RESEAUS"]; for(int i = 0; i < numRes * 3; i += 3) { lines += key[i]; samps += key[i+1]; type += key[i+2]; - valid += 0; + valid += QString("0"); } res += lines; res += samps; res += type; res += valid; res += PvlKeyword("Template", "$voyager" + spacecraftNumber + "/reseaus/vg" - + spacecraftNumber + "." + instId.DownCase() + + spacecraftNumber + "." + instId.toLower() + ".template.cub"); res += PvlKeyword("Status", "Nominal"); ocube->putGroup(res); diff --git a/isis/src/voyager/apps/voycal/voycal.cpp b/isis/src/voyager/apps/voycal/voycal.cpp index a404520af9..562300dd97 100644 --- a/isis/src/voyager/apps/voycal/voycal.cpp +++ b/isis/src/voyager/apps/voycal/voycal.cpp @@ -22,7 +22,7 @@ using namespace Isis; void calibration(vector &in, vector &out); PvlObject fetchCoefficients(Pvl &calibration, QList &hierarchy); -void checkCoefficient(PvlObject &coefficients, IString keyName); +void checkCoefficient(PvlObject &coefficients, QString keyName); // Linearity correction bool linear; @@ -57,8 +57,8 @@ void IsisMain() { // Check for projection if (incube->isProjected()) { - string msg = "The cube [" + ui.GetFileName("FROM") + "] has a projection" + - " and cannot be radiometrically calibrated"; + QString msg = "The cube [" + ui.GetFileName("FROM") + "] has a projection" + + " and cannot be radiometrically calibrated"; throw IException(IException::User, msg, _FILEINFO_); } @@ -70,16 +70,16 @@ void IsisMain() { // Verify not radiometrically corrected if (isiscube.HasGroup("Radiometry")) { - string msg = "Cube [" + ui.GetFileName("FROM") + "] has already been" + - " radiometrically corrected"; + QString msg = "Cube [" + ui.GetFileName("FROM") + "] has already been" + + " radiometrically corrected"; throw IException(IException::User,msg,_FILEINFO_); } // Verify Voyager spacecraft and get number, 1 or 2 - string scNumber = instrument["SpacecraftName"][0]; + QString scNumber = instrument["SpacecraftName"][0]; if (scNumber != "VOYAGER_1" && scNumber != "VOYAGER_2") { - string msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + - " to be a Voyager image"; + QString msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + + " to be a Voyager image"; throw IException(IException::User, msg, _FILEINFO_); } scNumber = scNumber[8]; @@ -94,12 +94,12 @@ void IsisMain() { hierarchy.append(instrument.FindKeyword("SpacecraftName")[0]); hierarchy.append(instrument.FindKeyword("InstrumentId")[0]); hierarchy.append( - IString("ShutterMode" + instrument.FindKeyword("CameraState2")[0])); + QString("ShutterMode" + instrument.FindKeyword("CameraState2")[0])); hierarchy.append(archive.FindKeyword("MissionPhaseName")[0]); hierarchy.append( - IString("ScanRate" + instrument.FindKeyword("CameraState1")[0])); + QString("ScanRate" + instrument.FindKeyword("CameraState1")[0])); hierarchy.append( - IString(bandbin["FilterName"][0] + "_" + bandbin["FilterNumber"][0])); + QString(bandbin["FilterName"][0] + "_" + bandbin["FilterNumber"][0])); calib = fetchCoefficients(calibra, hierarchy); @@ -119,10 +119,10 @@ void IsisMain() { // Get appropriate calibration files CubeAttributeInput in1; p.SetInputCube(FileName("$voyager" + scNumber + "/calibration/" + - (string)calib["OffsetCorrectionFile"]).expanded(), in1); + (QString)calib["OffsetCorrectionFile"]).expanded(), in1); CubeAttributeInput in2; p.SetInputCube(FileName("$voyager" + scNumber + "/calibration/" + - (string)calib["GainCorrectionFile"]).expanded(), in2); + (QString)calib["GainCorrectionFile"]).expanded(), in2); // Constants from voycal.pvl for correction omegaNaught = calib["OmegaNaught"]; @@ -193,11 +193,11 @@ void IsisMain() { calgrp.AddKeyword(calib[4]); calgrp.AddKeyword(calib[5]); calgrp.AddKeyword(calib[6]); - calgrp.AddKeyword(PvlKeyword("CalcSunDistance",dist1)); + calgrp.AddKeyword(PvlKeyword("CalcSunDistance",toString(dist1))); calgrp.AddKeyword(instrument["ExposureDuration"]); - calgrp.AddKeyword(PvlKeyword("XMLT",XMLT)); - calgrp.AddKeyword(PvlKeyword("Omega_W1",w1)); - calgrp.AddKeyword(PvlKeyword("CalcExpoDuration",newExpo)); + calgrp.AddKeyword(PvlKeyword("XMLT",toString(XMLT))); + calgrp.AddKeyword(PvlKeyword("Omega_W1",toString(w1))); + calgrp.AddKeyword(PvlKeyword("CalcExpoDuration",toString(newExpo))); // Linear correction equation and constants if (linear) { @@ -209,10 +209,10 @@ void IsisMain() { linearity.AddComment("XNORM = NormalizingPower"); linearity.AddComment("KPOWER = K_PowerOfNon-Linearity"); calgrp.AddKeyword(linearity); - calgrp.AddKeyword(PvlKeyword("ACoefficient",aCoef)); - calgrp.AddKeyword(PvlKeyword("B_HighEndNon-LinearityCorrection",bHighEnd)); - calgrp.AddKeyword(PvlKeyword("K_PowerOfNon-Linearity",kPowerOf)); - calgrp.AddKeyword(PvlKeyword("NormalizingPower",normalizingPower)); + calgrp.AddKeyword(PvlKeyword("ACoefficient",toString(aCoef))); + calgrp.AddKeyword(PvlKeyword("B_HighEndNon-LinearityCorrection",toString(bHighEnd))); + calgrp.AddKeyword(PvlKeyword("K_PowerOfNon-Linearity",toString(kPowerOf))); + calgrp.AddKeyword(PvlKeyword("NormalizingPower",toString(normalizingPower))); } else { calgrp.AddKeyword(PvlKeyword("LinearityCorrection","False")); @@ -289,7 +289,7 @@ PvlObject fetchCoefficients(Pvl &calibration, QList &hierarchy) { bool validHierarchy = true; PvlObject *parent = &calibration; for (int o = 0; o < hierarchy.size() && validHierarchy; o++) { - IString objectName = hierarchy[o].toStdString(); + QString objectName = hierarchy[o]; if (parent->HasObject(objectName)) { // The object named in the hierarchy exists in the calibration file, so @@ -328,7 +328,7 @@ PvlObject fetchCoefficients(Pvl &calibration, QList &hierarchy) { } -void checkCoefficient(PvlObject &coefficients, IString keyName) { +void checkCoefficient(PvlObject &coefficients, QString keyName) { if (!coefficients.HasKeyword(keyName)) throw IException( IException::Programmer, diff --git a/isis/src/voyager/apps/voyramp/voyramp.cpp b/isis/src/voyager/apps/voyramp/voyramp.cpp index d6611367f6..bcbd8ed3ca 100644 --- a/isis/src/voyager/apps/voyramp/voyramp.cpp +++ b/isis/src/voyager/apps/voyramp/voyramp.cpp @@ -64,15 +64,15 @@ void IsisMain() { // Verify Voyager1 spacecraft if (inst["SpacecraftName"][0] != "VOYAGER_1") { - string msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + - " to be a Voyager1 image"; + QString msg = "The cube [" + ui.GetFileName("FROM") + "] does not appear" + + " to be a Voyager1 image"; throw IException(IException::User, msg, _FILEINFO_); } // Verify has been radiometrically calibrated if (!isiscube.HasGroup("Radiometry")) { - string msg = "The cube [" + ui.GetFileName("FROM") + "] has not been" + - "radiometrically corrected, run voycal first"; + QString msg = "The cube [" + ui.GetFileName("FROM") + "] has not been" + + "radiometrically corrected, run voycal first"; } // Image time @@ -84,9 +84,9 @@ void IsisMain() { // From Isis2, the time range is day 64, hours 1-16, inclusive. if (time < min || time >= max) { - string message = "The cube [" + ui.GetFileName("FROM") + "] has image" + - " time [" + time.UTC() + "] outside of allowable" + - "range [" + min.UTC() + "] to [" + max.UTC() + "]"; + QString message = "The cube [" + ui.GetFileName("FROM") + "] has image" + + " time [" + time.UTC() + "] outside of allowable" + + "range [" + min.UTC() + "] to [" + max.UTC() + "]"; throw IException(IException::User, message, _FILEINFO_); } @@ -147,10 +147,10 @@ void IsisMain() { plasmaC = detb3/deta; // Create data to go in Radiometry group - PvlKeyword top = PvlKeyword("TopCorrectiveDN", y1); + PvlKeyword top = PvlKeyword("TopCorrectiveDN", toString(y1)); top.AddComment("Voyramp plasma torus corrective DN values:"); - PvlKeyword mid = PvlKeyword("MiddleCorrectiveDN", y2); - PvlKeyword bot = PvlKeyword("BottomCorrectiveDN", y3); + PvlKeyword mid = PvlKeyword("MiddleCorrectiveDN", toString(y2)); + PvlKeyword bot = PvlKeyword("BottomCorrectiveDN", toString(y3)); // Add it radio += top; diff --git a/isis/src/voyager/objs/VoyagerCamera/VoyagerCamera.cpp b/isis/src/voyager/objs/VoyagerCamera/VoyagerCamera.cpp index c7e4a8dd46..cb78d64184 100644 --- a/isis/src/voyager/objs/VoyagerCamera/VoyagerCamera.cpp +++ b/isis/src/voyager/objs/VoyagerCamera/VoyagerCamera.cpp @@ -68,10 +68,10 @@ namespace Isis { // Find out what camera is being used, and set the focal length, altinstcode, // and camera PvlGroup inst = lab.FindGroup ("Instrument",Pvl::Traverse); - IString spacecraft = (string)inst["SpacecraftName"]; - IString instId = (string)inst["InstrumentId"]; + QString spacecraft = (QString)inst["SpacecraftName"]; + QString instId = (QString)inst["InstrumentId"]; - IString reseauFileName = ""; + QString reseauFileName = ""; // These set up which kernel and other files to access, if (spacecraft == "VOYAGER_1") { @@ -87,8 +87,8 @@ namespace Isis { reseauFileName += "wa"; } else { - string msg = "File does not appear to be a Voyager image. InstrumentId [" - + instId + "] is invalid Voyager value."; + QString msg = "File does not appear to be a Voyager image. InstrumentId [" + + instId + "] is invalid Voyager value."; throw IException(IException::User, msg, _FILEINFO_); } } @@ -105,13 +105,13 @@ namespace Isis { reseauFileName += "wa"; } else { - string msg = "File does not appear to be a Voyager image. InstrumentId [" - + instId + "] is invalid Voyager value."; + QString msg = "File does not appear to be a Voyager image. InstrumentId [" + + instId + "] is invalid Voyager value."; throw IException(IException::User, msg, _FILEINFO_); } } else { - string msg = "File does not appear to be a Voyager image. SpacecraftName [" + QString msg = "File does not appear to be a Voyager image. SpacecraftName [" + spacecraft + "] is invalid Voyager value."; throw IException(IException::User, msg, _FILEINFO_); } @@ -140,7 +140,7 @@ namespace Isis { // exposure duration keyword value is measured in seconds double exposureDuration = inst["ExposureDuration"]; iTime startTime; - startTime.setUtc((string)inst["StartTime"]); + startTime.setUtc((QString)inst["StartTime"]); // set the start (shutter open) and end (shutter close) times for the image /***************************************************************************** diff --git a/isis/src/voyager/objs/VoyagerCamera/unitTest.cpp b/isis/src/voyager/objs/VoyagerCamera/unitTest.cpp index 19b3264c71..66d6b92f68 100644 --- a/isis/src/voyager/objs/VoyagerCamera/unitTest.cpp +++ b/isis/src/voyager/objs/VoyagerCamera/unitTest.cpp @@ -68,9 +68,9 @@ int main(void) { // Test Shutter Open/Close const PvlGroup &inst = p.FindGroup("Instrument", Pvl::Traverse); double exposureDuration = ((double) inst["ExposureDuration"])/1000; - string stime = inst["StartTime"]; + QString stime = inst["StartTime"]; double et; // StartTime keyword is the center exposure time - str2et_c(stime.c_str(), &et); + str2et_c(stime.toAscii().data(), &et); pair shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration); cout << "Shutter open = " << shuttertimes.first.Et() << endl; cout << "Shutter close = " << shuttertimes.second.Et() << endl << endl; -- GitLab