/usr/include/ossim/base/ossimRectanglePartitioner.h is in libossim-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | //----------------------------------------------------------------------------
// Copyright (C) 2004 David Burken, all rights reserved.
//
// License: MIT
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description:
// Utility class to partition up a rectangle.
//
// $Id: ossimRectanglePartitioner.h 9094 2006-06-13 19:12:40Z dburken $
//----------------------------------------------------------------------------
#ifndef ossimRectanglePartitioner_HEADER
#define ossimRectanglePartitioner_HEADER
#include <ossim/base/ossimConstants.h>
#include <vector>
class ossimIrect;
/**
* class ossimRectanglePartitioner
* Utility class to partition up a rectangle.
*/
class OSSIMDLLEXPORT ossimRectanglePartitioner
{
public:
/** default construtor */
ossimRectanglePartitioner();
/** destructor */
~ossimRectanglePartitioner();
/**
* Partitions the rectangle doing a binary split on the longest dimension
* until the total size is less than or equal to the "maxSizeInBytes".
* Initializes "result" with the resulting rectangles starting at the
* upper left corner.
*
* @param inputRectangle The source rectangle usually the bounding rectangle
* of a scene.
*
* @param result The vector of ossimIrects to hold the result.
*
* @param maxSizeInBytes Maximum size of the resulting rectangle partitions
* in bytes.
*
* @param bands The number of bands in the image.
*
* @param bytesPerPixel. The number of bytes per pixel for a single band.
*
* @param internalOverlapPixels Overlap in pixels for desired partitions.
* (default = 0) This is added to all four sides of the rectangle so
*
* @note The result rectangle passed in will be cleared for starters.
*
* @note Edge rectangles will be clipped to the inputRectangle.
*/
void binaryPartition(const ossimIrect& inputRectangle,
std::vector<ossimIrect>& result,
ossim_uint64 maxSizeInBytes,
ossim_uint32 bands,
ossim_uint32 bytesPerPixel,
ossim_uint32 internalOverlapPixels = 0) const;
private:
/**
* Recursively splits the input rectangle until the size is less than
* or equal to maxSizeInBytes.
*
* @param rect Input rectangle to split.
*
* @param maxSizeInBytes Maximum size of the resulting rectangle partitions
* in bytes.
*
* @param bands The number of bands in the image.
*
* @param bytesPerPixel. The number of bytes per pixel for a single band.
*
* @param internalOverlapPixels Overlap in pixels for desired partitions.
* (default = 0)
*
* @note Will split the longest dimension. If square will split in the
* lengthwise direction.
*/
void splitUntilLessThanMax(ossimIrect& rect,
ossim_uint64 maxSizeInBytes,
ossim_uint32 bands,
ossim_uint32 bytesPerPixel,
ossim_uint32 internalOverlapPixels = 0) const;
/**
* Splits rectangle in half rounding up if needed.
*
* @param input Rectangle to split.
*
* @note output will be a zero base rect.
*
* @notes Will split the longest dimension. If square will split in the
* lengthwise direction.
*/
void splitRect(ossimIrect& rect) const;
/**
* @param rect Rectangle to give size for in bytes.
*
* @param bands The number of bands in the image.
*
* @param bytesPerPixel. The number of bytes per pixel for a single band.
*
* @param internalOverlapPixels Overlap in pixels.
* (default = 0)
*
* @return size of rectangle in bytes.
*/
ossim_uint64 getSize(const ossimIrect& rect,
ossim_uint32 bands,
ossim_uint32 bytesPerPixel,
ossim_uint32 internalOverlapPixels = 0) const;
/**
* Convenience trace method.
*
* @param r Input rectangle.
*
* @param v Vector of resulting partitioned rectangles.
*
* @param maxSizeInBytes Maximum size of the resulting rectangle partitions
* in bytes.
*
* @param bands The number of bands in the image.
*
* @param bytesPerPixel. The number of bytes per pixel for a single band.
*/
void trace(const ossimIrect& r,
const std::vector<ossimIrect>& v,
ossim_uint64 maxSizeInBytes,
ossim_uint32 bands,
ossim_uint32 bytesPerPixel) const;
};
#endif /* End of "#ifndef ossimRectanglePartitioner_HEADER" */
|