|
Isis 3.0 Application Source Code Reference |
Home |
00001 #include "Isis.h" 00002 #include "Process.h" 00003 #include "Camera.h" 00004 #include "Pvl.h" 00005 00006 using namespace std; 00007 using namespace Isis; 00008 00009 void IsisMain() { 00010 Process p; 00011 00012 // Set the input image, get the camera model, and a basic mapping 00013 // group 00014 Cube *icube = p.SetInputCube("FROM"); 00015 Camera *cam = icube->Camera(); 00016 Pvl mapping; 00017 cam->BasicMapping(mapping); 00018 PvlGroup &mapgrp = mapping.FindGroup("Mapping"); 00019 00020 // Setup the output results by first adding the filename 00021 UserInterface &ui = Application::GetUserInterface(); 00022 00023 // Get the radii 00024 double radii[3]; 00025 cam->Radii(radii); 00026 PvlGroup target("Target"); 00027 target += PvlKeyword("From",ui.GetFilename("FROM")); 00028 target += PvlKeyword("TargetName",cam->Target()); 00029 target += PvlKeyword("RadiusA",radii[0]*1000.0,"meters"); 00030 target += PvlKeyword("RadiusB",radii[1]*1000.0,"meters"); 00031 target += PvlKeyword("RadiusC",radii[2]*1000.0,"meters"); 00032 00033 // Get resolution 00034 PvlGroup res("PixelResolution"); 00035 double lowres = cam->LowestImageResolution(); 00036 double hires = cam->HighestImageResolution(); 00037 res += PvlKeyword("Lowest",lowres,"meters"); 00038 res += PvlKeyword("Highest",hires,"meters"); 00039 00040 // Get the universal ground range 00041 PvlGroup ugr("UniversalGroundRange"); 00042 double minlat,maxlat,minlon,maxlon; 00043 cam->GroundRange(minlat,maxlat,minlon,maxlon,mapping); 00044 ugr += PvlKeyword("LatitudeType","Planetocentric"); 00045 ugr += PvlKeyword("LongitudeDirection","PositiveEast"); 00046 ugr += PvlKeyword("LongitudeDomain",360); 00047 ugr += PvlKeyword("MinimumLatitude",minlat); 00048 ugr += PvlKeyword("MaximumLatitude",maxlat); 00049 ugr += PvlKeyword("MinimumLongitude",minlon); 00050 ugr += PvlKeyword("MaximumLongitude",maxlon); 00051 00052 // Get the ographic latitude range 00053 mapgrp.AddKeyword(PvlKeyword("LatitudeType","Planetographic"), 00054 Pvl::Replace); 00055 cam->GroundRange(minlat,maxlat,minlon,maxlon,mapping); 00056 PvlGroup ogr("LatitudeRange"); 00057 ogr += PvlKeyword("LatitudeType","Planetographic"); 00058 ogr += PvlKeyword("MinimumLatitude",minlat); 00059 ogr += PvlKeyword("MaximumLatitude",maxlat); 00060 00061 // Get positive west longitude coordinates in 360 domain 00062 mapgrp.AddKeyword(PvlKeyword("LongitudeDirection","PositiveWest"), 00063 Pvl::Replace); 00064 cam->GroundRange(minlat,maxlat,minlon,maxlon,mapping); 00065 PvlGroup pos360("PositiveWest360"); 00066 pos360 += PvlKeyword("LongitudeDirection","PositiveWest"); 00067 pos360 += PvlKeyword("LongitudeDomain",360); 00068 pos360 += PvlKeyword("MinimumLongitude",minlon); 00069 pos360 += PvlKeyword("MaximumLongitude",maxlon); 00070 00071 // Get positive east longitude coordinates in 180 domain 00072 mapgrp.AddKeyword(PvlKeyword("LongitudeDirection","PositiveEast"), 00073 Pvl::Replace); 00074 mapgrp.AddKeyword(PvlKeyword("LongitudeDomain","180"), 00075 Pvl::Replace); 00076 cam->GroundRange(minlat,maxlat,minlon,maxlon,mapping); 00077 PvlGroup pos180("PositiveEast180"); 00078 pos180 += PvlKeyword("LongitudeDirection","PositiveEast"); 00079 pos180 += PvlKeyword("LongitudeDomain",180); 00080 pos180 += PvlKeyword("MinimumLongitude",minlon); 00081 pos180 += PvlKeyword("MaximumLongitude",maxlon); 00082 00083 // Get positive west longitude coordinates in 180 domain 00084 mapgrp.AddKeyword(PvlKeyword("LongitudeDirection","PositiveWest"), 00085 Pvl::Replace); 00086 cam->GroundRange(minlat,maxlat,minlon,maxlon,mapping); 00087 PvlGroup neg180("PositiveWest180"); 00088 neg180 += PvlKeyword("LongitudeDirection","PositiveWest"); 00089 neg180 += PvlKeyword("LongitudeDomain",180); 00090 neg180 += PvlKeyword("MinimumLongitude",minlon); 00091 neg180 += PvlKeyword("MaximumLongitude",maxlon); 00092 00093 // Write it to the log 00094 Application::Log(target); 00095 Application::Log(res); 00096 Application::Log(ugr); 00097 Application::Log(ogr); 00098 Application::Log(pos360); 00099 Application::Log(pos180); 00100 Application::Log(neg180); 00101 00102 // Write the output file if requested 00103 if (ui.WasEntered("TO")) { 00104 Pvl temp; 00105 temp.AddGroup(target); 00106 temp.AddGroup(res); 00107 temp.AddGroup(ugr); 00108 temp.AddGroup(ogr); 00109 temp.AddGroup(pos360); 00110 temp.AddGroup(pos180); 00111 temp.AddGroup(neg180); 00112 temp.Write(ui.GetFilename("TO","txt")); 00113 } 00114 00115 p.EndProcess(); 00116 }