Commit be824c2c authored by Jeannie Backer's avatar Jeannie Backer
Browse files

PROG: Removing NAIF DSK classes that were previously commited with incorrect...

PROG: Removing NAIF DSK classes that were previously commited with incorrect file permissions. These will be immediately re-added to the repository.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6103 41f8697f-d340-4b68-9986-7bafba869bb8
parent 898a07a5
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
ifeq ($(ISISROOT), $(BLANK))
.SILENT:
error:
	echo "Please set ISISROOT";
else
	include $(ISISROOT)/make/isismake.apps
	NAIFLIB    += -ldsklib
endif
+0 −143
Original line number Diff line number Diff line
#include "Isis.h"

#include "AbstractPlate.h"
#include "Brick.h"
#include "CSVReader.h"
#include "FileName.h"
#include "ImportPdsTable.h"
#include "IException.h"
#include "Intercept.h"
#include "Latitude.h"
#include "Longitude.h"
#include "NaifDskApi.h"
#include "NaifDskPlateModel.h"
#include "NaifStatus.h"
#include "PixelType.h"
#include "ProcessByLine.h"
#include "Progress.h"
#include "Projection.h"
#include "ProjectionFactory.h"
#include "SpecialPixel.h"
#include "SurfacePoint.h"
#include "Table.h"
#include "TileManager.h"
#include "TProjection.h"

using namespace std;
using namespace Isis;

void initialize(Buffer &out) {
  out = Null;
  return;
}

void IsisMain() {
 
  // We will be processing by line
  ProcessByLine p;
  UserInterface &ui = Application::GetUserInterface();

  QString dskfile = ui.GetFileName("FROM");
  NaifDskPlateModel dsk(dskfile);

  cout << "Total #Plates:   " << dsk.size() << "\n";
  cout << "Total #Vertices: " << dsk.numberVertices() << "\n";

  //Get the map projection file provided by the user
  Pvl userMap;
  userMap.read(ui.GetFileName("MAP"));

  // Create the ISIS map projection
  int ns, nl;
  Projection *proj = ProjectionFactory::CreateForCube(userMap, ns, nl, true);
  PvlGroup cleanMap = proj->Mapping();
  delete proj;

  // Create the cube from the projection parameters
  Cube *ocube = p.SetOutputCube("TO", ns, nl, 1);
  ocube->putGroup(cleanMap);
  TProjection *tproj = (TProjection *) ocube->projection();

  // Initialize the output cube
  p.StartProcess(initialize);

  QString method = ui.GetString("METHOD").toLower();
  bool useGridMethod = ( "grid" == method ) ? true : false;
 
#if 0
  // Get the real tile sizes and allocate the buffer accordingly
  PvlObject &core = ocube->label()->findObject("IsisCube").findObject("Core");
  int tsamps = core["TileSamples"];
  int tlines = core["TileLines"];

  TileManager pixels(*ocube, tsamps, tlines);
#else
  TileManager pixels(*ocube, ns, 1);
#endif
  Progress mapper;
  mapper.SetText("mapping");
  mapper.SetMaximumSteps(pixels.Tiles());
  mapper.CheckStatus();

  pixels.SetTile(1);
  SurfacePoint point;

  //  Now process the table writing the output
  while ( !pixels.end() ) {
    for (int i = 0  ; i < pixels.size()  ; i++) {

      int samp(pixels.Sample(i));
      int line(pixels.Line(i));
      pixels[i] = Null;

      tproj->SetWorld(samp, line);
      double lat = tproj->UniversalLatitude();
      double lon = tproj->UniversalLongitude();
      double radius = tproj->LocalRadius(lat);

      point.SetSphericalCoordinates(Latitude(lat, Angle::Degrees), 
                                    Longitude(lon, Angle::Degrees),
                                    Distance(radius, Distance::Meters));

      // Calculate the grid point intersection of the DEM
      if ( useGridMethod ) {  // ( "grid" == method )
        // Get the grid point (lat, lon) from the DEM
        QScopedPointer<SurfacePoint> dempt(dsk.point(point.GetLatitude(), 
                                                     point.GetLongitude()));

        pixels[i] = dempt->GetLocalRadius().meters();
      }
      else { // ( "ray" == method )
        // Get the intercept of the position and look vector of point on the DEM 
        // by using the lat/lon coordinate in X/Y/Z.  This vector is scaled to
        // be outside the body by 1.5 times.  The look vector is then 
        // determined by negating the vector and an intersection is computed.
        // Grid method winds up doing the same thing - this is the direct
        // computation.
        NaifVertex observer(3);
        point.ToNaifArray(&observer[0]);
        NaifStatus::CheckErrors();
        vscl_c(1.5, &observer[0], &observer[0]);
        NaifStatus::CheckErrors();

        // Get look vector
        NaifVector raydir(3);
        vminus_c(&observer[0], &raydir[0]);
        NaifStatus::CheckErrors();

        // Check for valid intercept
        NaifVertex xpt;
        if ( dsk.isPlateIdValid(dsk.plateIdOfIntercept(observer, raydir, xpt)) ) { 
          point.FromNaifArray(&xpt[0]);
          pixels[i] = point.GetLocalRadius().meters();
        }
      }
    }
    ocube->write(pixels);
    mapper.CheckStatus();
    pixels.next();
  }

  p.EndProcess();
}
+0 −118
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>

<application name="dsk2isis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd">

  <brief>
    Converts NAIF DSK plate model to ISIS format
  </brief>

  <description>
      This application will convert a NAIF DSK plate model to an ISIS cube.  
      Users must  provide a valid map file to use for allocation of the ISIS 
      cube.  The scale and type of projection determine the size of the output 
      cube.
  </description>

  <history>
    <change name="Kris Becker" date="2014-02-19">
        Original Version
    </change>
    <change name="Jeannie Backer" date="2015-03-08">
        Wrote tests. Added application to ISIS trunk. References #2035
    </change>
</history>

  <category>
    <categoryItem>Map Projection</categoryItem>
  </category>

  <groups>
    <group name="Files">
      <parameter name="FROM">
        <type>filename</type>
        <fileMode>input</fileMode>
        <brief>Name of NAIF DSK DEM file</brief>
        <description>
          This parameter provides the name of the NAIF DSK file to convert to 
          ISIS format.  It is assumed to be in body fixed coordinates from which 
          intersections for each output map grid point will be computed using 
          NAIF's DSK toolkit.
        </description>
        <filter>
          *.bds
        </filter>
      </parameter>

      <parameter name="MAP">
          <type>filename</type>
        <fileMode>input</fileMode>
        <brief>Name of file containing map description</brief>
        <description>
            This paramter provides the name of a file containing a valid map 
            projection defintion. One can use the ISIS maptemplate application 
            to create a map template.
        </description>
        <filter>
          *.map
        </filter>
      </parameter>

      <parameter name="TO">
        <type>cube</type>
       <pixelType>real</pixelType>
        <fileMode>output</fileMode>
        <brief>
          Output cube
        </brief>
        <description>
          Name of the output ISIS file created by this application containing 
          the rendering of the DSK DEM into and ISIS compatible DEM for use in 
          the ISIS system.
        </description>
      </parameter>

        <parameter name="METHOD">
            <type>string</type>
            <brief>
                DEM intersection method used
            </brief>
            <description>
              <p>
                This parameter provides two different methods to compute the 
                output radius value for a given latitude, longitude map grid 
                point.
              </p>
            </description>
            <default><item>RAY</item></default>
            <list>
                <option value="RAY">
                    <brief>
                        Ray intersection from image pixel location to DEM 
                    </brief>
                    <description>
                        Calculates an intercept location on the (irregularly                     
                        shaped) body from the observer point (i.e., image pixel 
                        location) and look (or ray) direction 
                    </description>
                </option>
                <option value="GRID">
                    <brief>
                        Calculate using surface point latitude, longitude grid 
                        point  
                    </brief>
                    <description>
                         The radius value of the DEM is determined at the 
                         intercept point of the triaxial ellipsoid from the 
                         center of the body. This method extends the surface (x, 
                         y, z) body fixed coordinate of the ellisoid by 
                         extending the vector by a factor of 1.5.  This creates 
                         the obsever point.  The direction vector is then the 
                         negation of the observer point.  From this, a DEM 
                         surface intercept point is determined.
                    </description>
                </option>
            </list>
        </parameter>
    </group>
  </groups>
</application>
+0 −7
Original line number Diff line number Diff line
# history 2015-03-08 Jeannie Backer - Original Version.
#                        Code Coverage 93.75% scope, 100% line and function.
#                        Coverage Complete until we can figure out a case where plate ID is invalid.
BLANKS = "%-6s"    
LENGTH = "%-40s"

include $(ISISROOT)/make/isismake.tststree
+0 −12
Original line number Diff line number Diff line
APPNAME = dsk2isis

itokawa.truth.cub.TOLERANCE = 0.00002

include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) from=$(INPUT)/hay_a_amica_5_itokawashape_v1_0_512q.bds \
	  map=$(INPUT)/equi.map \
	  to=$(OUTPUT)/itokawa.truth.cub \
	  method=GRID \
	  > /dev/null;
Loading