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

Added support for NAIF DSK shape models. Updated naif include location in...

Added support for NAIF DSK shape models. Updated naif include location in config files so naif includes no longer require a path. Fixes #2035

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6094 41f8697f-d340-4b68-9986-7bafba869bb8
parent ca8e5d3f
Loading
Loading
Loading
Loading
+83 −0
Original line number Diff line number Diff line
/**                                                                       
 * @file                                                                  
 * $Revision$
 * $Date$
 * $Id$
 * 
 *   Unless noted otherwise, the portions of Isis written by the USGS are 
 *   public domain. See individual third-party library and package descriptions 
 *   for intellectual property information, user agreements, and related  
 *   information.                                                         
 *                                                                        
 *   Although Isis has been used by the USGS, no warranty, expressed or   
 *   implied, is made by the USGS as to the accuracy and functioning of such 
 *   software and related material nor shall the fact of distribution     
 *   constitute any such warranty, and no responsibility is assumed by the
 *   USGS in connection therewith.                                        
 *                                                                        
 *   For additional information, launch                                   
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html                
 *   in a browser or see the Privacy & Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.                                    
 */ 


#include "AbstractPlate.h"

#include <QString>

#include "Angle.h"
#include "Distance.h"
#include "Intercept.h"
#include "Latitude.h"
#include "Longitude.h"
#include "NaifDskApi.h"
#include "SurfacePoint.h"

namespace Isis {

  /**
   * Empty constructor for an AbstractPlate object. This constructor is protected. 
   */
  AbstractPlate::AbstractPlate() {}



  /**
   * Empty destructor for an AbstractPlate object.
   *
   */
  AbstractPlate::~AbstractPlate() {}


  /**
   * Gets the name of this Plate type. 
   *  
   * @return Then name of this plate, "AbstractPlate" 
   *
   */
  QString AbstractPlate::name() const {
    return "AbstractPlate";
  }



  /**
   * Construct an intercept from a clone of this plate as well as the given 
   * vertex, direction vector, and surface point. 
   * 
   * @param vertex Observer position
   * @param raydir Look direction
   * @param ipoint Surface point of the intercept location on the body 
   *  
   * @return <b>Intercept *</b> A pointer to an intercept constructed with the vertex, raydir, 
   *         ipoint and clone of this AbstractPlate.
   */
  Intercept *AbstractPlate::construct(const NaifVertex &vertex, const NaifVector &raydir,
                                      SurfacePoint *ipoint) const {
    return (new Intercept(vertex, raydir, ipoint, clone()));
  }

}
// namespace Isis
+96 −0
Original line number Diff line number Diff line
#ifndef AbstractPlate_h
#define AbstractPlate_h
/**
 * @file
 * $Revision: 1.3 $
 * $Date: 2008/05/09 18:49:25 $
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are public
 *   domain. See individual third-party library and package descriptions for
 *   intellectual property information,user agreements, and related information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or implied,
 *   is made by the USGS as to the accuracy and functioning of such software
 *   and related material nor shall the fact of distribution constitute any such
 *   warranty, and no responsibility is assumed by the USGS in connection
 *   therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html in a browser or see
 *   the Privacy &amp; Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */

#include <QString>

#include "NaifDskApi.h"

namespace Isis {

  class Angle;
  class Distance;
  class Intercept;
  class Latitude;
  class Longitude;
  class SurfacePoint;
  
  /**
   * @brief Abstract interface to a TIN plate 
   *  
   * This abstract class defines the interface for triangular plate.  The plate is 
   * assumed to be a set of 3 body-fixed vertex points that describe a portion of 
   * the surface digital elevation model (DEM). 
   *  
   * The interface allows for repeated queries (e.g., ray intersection, point 
   * containment) of the plate represented by the object containing the plate. 
   *  
   * This class is not directly instantiable but is typically provided by a 
   * distinct plate model implementation (e.g., NAIF DSK). 
   *  
   * This class can be cloned but not copied directly. 
   * 
   * @author 2014-02-25 Kris Becker 
   * @internal 
   *   @history 2014-02-15 Kris Becker - Original Version 
   *   @history 2015-03-08 Jeannie Backer - Added documentation and test. Added class to ISIS trunk.
   *                           References #2035
   */
  class AbstractPlate {
    public:
      virtual ~AbstractPlate();
  
      virtual QString name() const = 0;
  
      virtual Distance minRadius() const = 0;
      virtual Distance maxRadius() const = 0;
  
      virtual double area() const = 0;
      virtual NaifVector normal() const = 0;
      virtual Angle separationAngle(const NaifVector &raydir) const = 0;
  
      virtual bool hasIntercept(const NaifVertex &vertex, 
                                const NaifVector &raydir) const = 0;
      virtual bool hasPoint(const Latitude &lat, const Longitude &lon) const = 0;
  
      virtual Intercept    *intercept(const NaifVertex &vertex, 
                                      const NaifVector &raydir) const = 0;
      virtual SurfacePoint *point(const Latitude &lat, 
                                  const Longitude &lon) const = 0;
  
      virtual AbstractPlate *clone() const = 0;
  
    protected:
      AbstractPlate();
      Intercept *construct(const NaifVertex &vertex, const NaifVector &raydir,
                           SurfacePoint *ipoint) const;  
    private:
      // Disallow direct copies - use clones
      AbstractPlate(const AbstractPlate &plate);
      AbstractPlate &operator=(const AbstractPlate &plate);
  };


} // namespace Isis

#endif
+8 −0
Original line number Diff line number Diff line
Unit test for Abstract Plate. 
Virtual class... first create a child 
plate name =  "AbstractPlate" 
Construct intercept from vertex (0,0,0), vector(1,1,1), and surface point(2,2,2). 
intercept plate name                 =  "AbstractPlate" 
intercept vertex (observer position) =  "( 0.0, 0.0, 0.0 )"
intercept vector (look direction)    =  "( 1.0, 1.0, 1.0 )"
intercept surface point (location)   =  2 2 2  meters 
+7 −0
Original line number Diff line number Diff line
ifeq ($(ISISROOT), $(BLANK))
.SILENT:
error:
	echo "Please set ISISROOT";
else
	include $(ISISROOT)/make/isismake.objs
endif
 No newline at end of file
+144 −0
Original line number Diff line number Diff line
/**
 * @file
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are public
 *   domain. See individual third-party library and package descriptions for
 *   intellectual property information,user agreements, and related information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or implied,
 *   is made by the USGS as to the accuracy and functioning of such software
 *   and related material nor shall the fact of distribution constitute any such
 *   warranty, and no responsibility is assumed by the USGS in connection
 *   therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html in a browser or see
 *   the Privacy &amp; Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */
#include <QDebug>

#include "AbstractPlate.h"
#include "Angle.h"
#include "Displacement.h"
#include "Distance.h"
#include "IException.h"
#include "Intercept.h"
#include "NaifDskApi.h"
#include "Preference.h"
#include "SurfacePoint.h"

using namespace Isis;

/**
 *  
 * @internal 
 *   @history 2015-02-25 Jeannie Backer - Original version.
 *                           Code coverage: 100% scope, line, and function.
 *
 */
class MyPlate : public AbstractPlate {
  public:
    MyPlate() : AbstractPlate() {
    }

    ~MyPlate() {
    }
  
    QString name() const {
      return AbstractPlate::name();
    }

    Distance minRadius() const {
      return Distance(1.0, Distance::Meters);
    }

    Distance maxRadius() const {
      return Distance(2.0, Distance::Meters);
    }
  
    double area() const {
      return 3.0;
    }

    NaifVector normal() const {
      NaifVector v;
      return v;
    }

    Angle separationAngle(const NaifVector &raydir) const {
      Angle theta;
      return theta;
    }
  
    bool hasIntercept(const NaifVertex &vertex, 
                              const NaifVector &raydir) const {
      return true;
    }

    bool hasPoint(const Latitude &lat, 
                          const Longitude &lon) const {
      return false;
    }
  
    Intercept *intercept(const NaifVertex &vertex, 
                                 const NaifVector &raydir) const {
      Intercept *i = NULL;
      return i;
    }

    SurfacePoint *point(const Latitude &lat, 
                                const Longitude &lon) const {
      SurfacePoint *s = NULL;
      return s;
    }
  
    AbstractPlate *clone() const {
      return (new MyPlate());
    }

    Intercept *construct(const NaifVertex &vertex, const NaifVector &raydir,
                         SurfacePoint *ipoint) const {
      return AbstractPlate::construct(vertex, raydir, ipoint);  
    }

};



int main(int argc, char *argv[]) {
  try {
    qDebug() << "Unit test for Abstract Plate.";
    Preference::Preferences(true);

    qDebug() << "Virtual class... first create a child";
    MyPlate mp;
    qDebug() << "plate name = " << mp.name();
    NaifVertex vertex(3);
    vertex[0] = 0.0;    vertex[1] = 0.0;    vertex[2] = 0.0;
    NaifVector raydir(3);
    raydir[0] = 1.0;    raydir[1] = 1.0;    raydir[2] = 1.0;
    SurfacePoint *ipoint = new SurfacePoint(Displacement(2.0, Displacement::Meters),
                                            Displacement(2.0, Displacement::Meters),
                                            Displacement(2.0, Displacement::Meters));
    qDebug() << "Construct intercept from vertex (0,0,0), vector(1,1,1), and surface point(2,2,2).";
    Intercept *intercept = mp.construct(vertex, raydir, ipoint);
    qDebug() << "intercept plate name                 = " << intercept->shape()->name();
    qDebug() << "intercept vertex (observer position) = " << intercept->observer();
    qDebug() << "intercept vector (look direction)    = " << intercept->lookDirectionRay();
    qDebug() << "intercept surface point (location)   = " << intercept->location().GetX().meters()
                                                          << intercept->location().GetY().meters()
                                                          << intercept->location().GetZ().meters()
                                                          << " meters";
    delete ipoint;
    ipoint = NULL;
  }
  catch (IException &e) {
    qDebug();
    qDebug();
    IException(e, IException::Programmer,
              "\n------------Unit Test Failed.------------",
              _FILEINFO_).print();
  }
}
Loading