Advertisement
vipulraheja

Untitled

Jun 14th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.80 KB | None | 0 0
  1. //----------------------------------------------------------------------------
  2. // File: Constants.h
  3. //
  4. // License:  See top level LICENSE.txt file.
  5. //
  6. // Author:  David Burken
  7. //
  8. // Description:  Constants for ossimjni c++ library.
  9. //
  10. //----------------------------------------------------------------------------
  11. // $Id: Constants.h 19748 2011-06-12 15:34:56Z dburken $
  12.  
  13. #ifndef ossimjniConstants_HEADER
  14. #define ossimjniConstants_HEADER 1
  15.  
  16. /**
  17.  * DLL IMPORT/EXORT SECTION
  18.  */
  19. #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(_MSC_VER) || defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)
  20. #  define OSSIMJNIEXPORT __declspec(dllexport)
  21. #  define OSSIMJNIIMPORT __declspec(dllimport)
  22. #  ifdef OSSIMJNI_LIBRARY
  23. #    define OSSIMJNIDLL       OSSIMJNIEXPORT
  24. #  else
  25. #    define OSSIMJNIDLL      OSSIMJNIIMPORT
  26. #  endif
  27. #else /* not #if defined(_MSC_VER) */
  28. #  define OSSIMJNIEXPORT
  29. #  define OSSIMJNIIMPORT
  30. #  define OSSIMJNIDLL
  31. #endif /* #if defined(_MSC_VER) */
  32.  
  33. // Primative data type typedefs
  34. typedef char               ossimjni_int8;
  35. typedef signed char        ossimjni_sint8;
  36. typedef unsigned char      ossimjni_uint8;
  37.  
  38. typedef short              ossimjni_int16;
  39. typedef unsigned short     ossimjni_uint16;
  40. typedef signed short       ossimjni_sint16;
  41.  
  42. typedef int                ossimjni_int32;
  43. typedef unsigned int       ossimjni_uint32;
  44. typedef signed int         ossimjni_sint32;
  45.  
  46. typedef long long          ossimjni_int64;
  47. typedef unsigned long long ossimjni_uint64;
  48. typedef signed long long   ossimjni_sint64;
  49.  
  50. typedef float              ossimjni_float32;
  51. typedef double             ossimjni_float64;
  52.  
  53. #endif /* #ifndef ossimjniConstants_HEADER */
  54.  
  55.  
  56.  
  57. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  58.  
  59. //-----------------------------------------------------------------------------
  60. // File:  Info.h
  61. //
  62. // License:  See top level LICENSE.txt file.
  63. //
  64. // Author:  David Burken
  65. //
  66. // Description: Class declaration for Info.
  67. //
  68. //-----------------------------------------------------------------------------
  69. // $Id: Info.h 19750 2011-06-13 15:04:07Z dburken $
  70.  
  71. #ifndef ossimjniInfo_HEADER
  72. #define ossimjniInfo_HEADER 1
  73.  
  74. #include <ossimjni/Constants.h>
  75. #include <map>
  76. #include <string>
  77.  
  78. class ossimInfo;
  79.  
  80. namespace ossimjni
  81. {
  82.    class OSSIMJNIDLL Info
  83.    {
  84.    public:
  85.  
  86.       /** @brief default constructor. */
  87.       Info();
  88.      
  89.       /** @brief destructor */
  90.       ~Info();
  91.  
  92.       /**
  93.        * @brief Initial method.
  94.        *
  95.        * Typically called from application prior to execute.  This parses
  96.        * all options and put in keyword list m_kwl.
  97.        *
  98.        * @param ap Arg parser to initialize from.
  99.        * @return true, indicating process should continue with execute.
  100.        * @note A throw with an error message of "usage" is used to get out when
  101.        * a usage is printed.
  102.        */
  103.       bool initialize(int argc, char* argv[]);
  104.  
  105.       /**
  106.        * @brief execute method.
  107.        *
  108.        * Performs the actual dump of information.  This executes any options
  109.        * set including image operations, i.e. -i -p --dno and so on.
  110.        *
  111.        * @note Throws ossimException on error.
  112.        */
  113.       void execute();
  114.  
  115.       /**
  116.        * @brief getImageInfo Method to open image "file" and get image info
  117.        * in the form of a std::map<std::string, std::string>.
  118.        *
  119.        * Flags turn on various pieces of info.  These equate to options in
  120.        * ossim-info for image information.
  121.        *
  122.        * @param file Image file to get information for.
  123.        * @param dumpFlag      ossim-info -d
  124.        * @param dnoFlag       ossim-info --dno
  125.        * @param imageGeomFlag ossim-info -p
  126.        * @param imageInfoFlag ossim-info -i
  127.        * @param metaDataFlag  ossim-info -m
  128.        * @param paletteFlag   ossim-info --palette
  129.        *
  130.        * @note Throws ossimException on error.
  131.        */
  132.       std::map<std::string, std::string> getImageInfo(
  133.          const std::string& file,
  134.          bool dumpFlag,
  135.          bool dnoFlag,
  136.          bool imageGeomFlag,
  137.          bool imageInfoFlag,
  138.          bool metaDataFlag,
  139.          bool paletteFlag) const;
  140.  
  141.    private:
  142.  
  143.       ossimInfo* m_info;
  144.    };
  145.  
  146. } // End of namespace ossimjni.
  147.  
  148. #endif /* #ifndef ossimjniInfo_HEADER */
  149.  
  150.  
  151. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  152.  
  153. //-----------------------------------------------------------------------------
  154. // File:  Init.h
  155. //
  156. // License:  See top level LICENSE.txt file.
  157. //
  158. // Author:  David Burken
  159. //
  160. // Description: Class declaration for Init.  Handles ossim initialization.
  161. //
  162. //-----------------------------------------------------------------------------
  163. // $Id: Init.h 19748 2011-06-12 15:34:56Z dburken $
  164.  
  165. #ifndef ossimjniInit_HEADER
  166. #define ossimjniInit_HEADER 1
  167.  
  168.  
  169. #include <ossimjni/Constants.h>
  170.  
  171. namespace ossimjni
  172. {
  173.    class OSSIMJNIDLL Init
  174.    {
  175.    public:
  176.  
  177.       /** @brief destructor */
  178.       ~Init();
  179.  
  180.       /**
  181.        * @brief Instance method.
  182.        *
  183.        * @return The instance of this class.
  184.        */
  185.       static ossimjni::Init* instance();
  186.  
  187.       /** @brief Initialize method. */
  188.       void initialize();
  189.      
  190.       /**
  191.        * @brief Initialize method.
  192.        *
  193.        * @param argc Argument count.
  194.        *
  195.        * @param argv Array of args.
  196.        */
  197.       void initialize(int argc, char* argv[]);
  198.  
  199.    private:
  200.      
  201.       /** @brief default constructor - hidden from use */
  202.       Init();
  203.  
  204.       /** @brief copy constructor - hidden from use */
  205.       Init(const ossimjni::Init& obj);
  206.  
  207.       /** @brief assignment operator - hidden from use */
  208.       const ossimjni::Init& operator=(const ossimjni::Init& obj);
  209.  
  210.       /** @brief The single static instance of this class. */
  211.       static ossimjni::Init* m_instance;
  212.  
  213.       /** Flag to ignore duplicate initialization calls. */
  214.       bool m_initCalledFlag;
  215.    };
  216.  
  217. } // End of namespace ossimjni.
  218.  
  219. #endif /* #ifndef ossimjniInit_HEADER */
  220.  
  221. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  222.  
  223. //-----------------------------------------------------------------------------
  224. // File:  SingleImageChain.h
  225. //
  226. // License:  See top level LICENSE.txt file.
  227. //
  228. // Author:  David Burken
  229. //
  230. // Description: Class declaration for SingleImageChain.
  231. //
  232. //-----------------------------------------------------------------------------
  233. // $Id: SingleImageChain.h 19748 2011-06-12 15:34:56Z dburken $
  234.  
  235. #ifndef ossimjniSingleImageChain_HEADER
  236. #define ossimjniSingleImageChain_HEADER 1
  237.  
  238. #include <ossimjni/Constants.h>
  239.  
  240. #include <string>
  241. #include <vector>
  242.  
  243. class ossimSingleImageChain;
  244.  
  245. namespace ossimjni
  246. {
  247.    /**
  248.     * @class SingleImageChain
  249.     *
  250.     * Interface to/from java/ossim for ossimSingleImageChain.
  251.     *
  252.     * @note Interfaces with integers signed for java.
  253.     */
  254.    class OSSIMJNIDLL SingleImageChain
  255.    {
  256.    public:
  257.  
  258.       /** @brief default constructor. */
  259.       SingleImageChain();
  260.      
  261.       /** @brief destructor */
  262.       ~SingleImageChain();
  263.  
  264.       /**
  265.        * @brief open method that takes an image file.
  266.        *
  267.        * Opens file and creates a simple chain with ossimImageHandler.
  268.        *
  269.        * @param file File to open.
  270.        *
  271.        * @return true on success, false on error.
  272.        *
  273.        * @note This will close previous chain if one was opened.
  274.        */
  275.       bool open(const std::string& file);
  276.  
  277.       /**
  278.        * @brief open method that takes an image file and an entry.
  279.        *
  280.        * Opens file and creates a simple chain with ossimImageHandler.
  281.        *
  282.        * @param file File to open.
  283.        *
  284.        * @param entry Zero based entry.
  285.        *
  286.        * @return true on success, false on error.
  287.        *
  288.        * @note This will close previous chain if one was opened.
  289.        */
  290.       bool open(const std::string& file, ossimjni_int32 entry);
  291.  
  292.       /** @return true if image handler is opened. */
  293.       bool isOpen() const;
  294.  
  295.       /** @brief close method to delete the image handler. */
  296.       void close();
  297.  
  298.       /**
  299.        * @param entryList This is the list to initialize with entry indexes.
  300.        *
  301.        * @note This implementation returns puts one entry "0" in the list.
  302.        */
  303.       std::vector<ossimjni_int32> getEntryList() const;
  304.  
  305.       /** @return The filename of the image. */
  306.       std::string getFilename() const;
  307.      
  308.       /**
  309.        * @brief Create a rendered image chain.
  310.        *
  311.        * Typical usage is to call this after "open" method returns true like:
  312.        * if ( myChain->open(myFile) == true )
  313.        * {
  314.        *    myChain->createRenderedChain();
  315.        *    code-goes-here();
  316.        * }
  317.        *
  318.        * Typical chain is:
  319.        *
  320.        * 1) image handler
  321.        * 2) band selector (optional)
  322.        * 3) histogram remapper(optional)
  323.        * 4) scalar remapper (optional)
  324.        * 5) resampler cache
  325.        * 6) resampler
  326.        * 7) band selector (optional when going one band to three)
  327.        * 8) chain cache
  328.        *
  329.        * NOTES:
  330.        * 1) If doing a sequential write where tiles to the right of the
  331.        *    resampler will not be revisited the chain cache could be
  332.        *    disabled to save memory.
  333.        */
  334.       void createRenderedChain();
  335.  
  336.       /**
  337.        * @brief selectBands
  338.        *
  339.        * Used to select which bands to use.
  340.        *
  341.        * @note Bands are zero based.
  342.        *
  343.        * @return true on success, false if not open or bands out of range.
  344.        */
  345.       bool selectBands(const std::vector<ossimjni_uint32>& bands);
  346.      
  347.       /**
  348.        * @brief getBandSelection
  349.        *
  350.        * @note Bands are zero based.
  351.        *
  352.        * @return A list of bands selected to use in the output product.
  353.        */
  354.       std::vector<ossimjni_uint32> getBandSelection() const;
  355.  
  356.       /** @return Number of bands or 0 if not open. */
  357.       ossimjni_uint32 getNumberOfBands() const;
  358.  
  359.       /**
  360.        * @brief setHistogram
  361.        *
  362.        * Used to identify a histogram file associated with the source image.
  363.        *  @param his Fully qualified path to a histogram file.
  364.        */
  365.       bool setHistogram(const std::string& his);
  366.  
  367.       /** @return Histogram file. */
  368.       std::string getHistogramFile() const;
  369.  
  370.       /** @brief setOverview */
  371.       bool setOverview(const std::string& ovr);
  372.  
  373.       /** @return overview file. */
  374.       std::string getOverviewFile() const;
  375.      
  376.    private:
  377.  
  378.       /** @returns true if bands in range, false if not or if image is not open. */
  379.       bool verifyBandRange(const std::vector<ossimjni_uint32>& bands) const;
  380.  
  381.       ossimSingleImageChain* m_img;
  382.    };
  383.  
  384. } // End of namespace ossimjni.
  385.  
  386. #endif /* #ifndef ossimjniSingleImageChain_HEADER */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement