Skip to content
Commits on Source (5)
......@@ -8,3 +8,4 @@ cmake_install*
*.swp
CMakeCache.txt
.gradle
.idea
properties([
parameters ([
string(name: 'BUILD_NODE', defaultValue: 'ossim-build', description: 'The build node to run on'),
string(name: 'MAKE_VERBOSE', defaultValue: 'VERBOSE=true', description: ''),
booleanParam(name: 'BUILD_WITH_FORTIFY', defaultValue: false, description: 'Check to build and scan source using HP Fortify tool'),
booleanParam(name: 'SCAN_WITH_SONARQUBE', defaultValue: false, description: 'Check to perform SonarQube analysis'),
string(name: 'GIT_PUBLIC_SERVER_URL', defaultValue: 'https://github.com/ossimlabs', description: ''),
string(name: 'GIT_PRIVATE_SERVER_URL', defaultValue: 'https://github.com/Maxar-Corp', description: ''),
string(name: 'CREDENTIALS_ID', defaultValue: 'cicdGithub', description: ''),
booleanParam(name: 'CLEAN_WORKSPACE', defaultValue: true, description: 'Clean the workspace at the end of the run')
]),
pipelineTriggers([
[$class: "GitHubPushTrigger"]
]),
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/ossimlabs/tlv'],
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '3', daysToKeepStr: '', numToKeepStr: '20')),
disableConcurrentBuilds()
])
node ("${BUILD_NODE}"){
try {
stage( "Download Artifacts" ) {
dir( "ossim-ci" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PRIVATE_SERVER_URL }/ossim-ci.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "${ env.WORKSPACE }" ) {
step ([$class: "CopyArtifact",
projectName: "kakadu-build",
filter: "kakadu.tgz",
flatten: true])
sh "tar xvfz kakadu.tgz"
step ([$class: "CopyArtifact",
projectName: "opencv-build",
filter: "opencv-3.2-minimal-install.tgz",
flatten: true,
target: "${ env.WORKSPACE }/opencv-3.2-minimal-install"])
sh """
pushd opencv-3.2-minimal-install
tar xvfz opencv-3.2-minimal-install.tgz
popd
"""
}
load "ossim-ci/jenkins/variables/common-variables.groovy"
load "ossim-ci/jenkins/variables/ossim-variables.groovy"
}
stage( "Checkout" ) {
dir( "ossim" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-video" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-video.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-planet" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-planet.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-gui" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-gui.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-oms" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-oms.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-plugins" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-plugins.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-wms" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-wms.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-private" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PRIVATE_SERVER_URL }/ossim-private.git",
credentialsId: "${ CREDENTIALS_ID }"
}
}
stage( "Build" ) {
dir( "${ env.WORKSPACE }" ) {
sh """
rm -rf ${ env.WORKSPACE }/build/CMakeCache.txt
export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
${ env.WORKSPACE }/ossim-ci/scripts/ossim-build.sh
${ env.WORKSPACE }/ossim-ci/scripts/ossim-install.sh
"""
}
}
stage ( "Publish Nexus" ) {
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'nexusCredentials',
usernameVariable: 'REPOSITORY_MANAGER_USER',
passwordVariable: 'REPOSITORY_MANAGER_PASSWORD']]) {
dir( "${ env.WORKSPACE }" ) {
sh "${ env.WORKSPACE }/ossim-ci/scripts/oms-deploy.sh"
}
}
}
stage( "Archive" ) {
dir( "${ env.WORKSPACE }" ) {
sh "tar cvfz ossim-install.tgz install"
}
dir( "${ env.WORKSPACE }/artifacts" ) {
sh "mv ${ env.WORKSPACE }/ossim-install.tgz ."
sh "cp ${ env.WORKSPACE }/ossim-oms/lib/joms-*.jar ."
}
archiveArtifacts "artifacts/*"
}
if (SCAN_WITH_SONARQUBE == "true" ) {
stage( 'SonarQube analysis' ) {
withSonarQubeEnv( "${ SONARQUBE_NAME }" ) {
// requires SonarQube Scanner for Gradle 2.1+
// It's important to add --info because of SONARJNKNS-281
sh "sonar-scanner"
}
}
}
if ( BUILD_WITH_FORTIFY == "true" ) {
stage( 'Fortify SCA' ) {
dir( "${ env.WORKSPACE }/build" ) {
sh """
export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
sourceanalyzer -64 -b ossimlabs -scan -f fortifyResults-ossim.fpr
fortifyclient -url ${ HP_FORTIFY_URL } -authtoken ${ HP_FORTIFY_TOKEN } uploadFPR -file fortifyResults-ossim.fpr -project ossim -version 1.0
"""
}
}
}
}
finally {
stage( "Clean Workspace" ) {
if ( "${ CLEAN_WORKSPACE }" == "true" )
step([$class: 'WsCleanup'])
}
}
}
......@@ -25,8 +25,6 @@
using namespace std;
#define USE_UINT8 true
int main(int argc, char *argv[])
{
int returnCode = 0;
......@@ -44,7 +42,7 @@ int main(int argc, char *argv[])
ossimFilename filename = ap[1];
// Establish the image geometry's map projection:
ossimIpt image_size (32, 32);
ossimIpt image_size (416, 416);
ossimGpt observerGpt (0, 0, 0);
ossimDpt gsd (1.0, 1.0); // must be same value in both directions
ossimRefPtr<ossimEquDistCylProjection> mapProj = new ossimEquDistCylProjection();
......@@ -60,19 +58,11 @@ int main(int argc, char *argv[])
geometry->setImageSize(image_size);
// Set the destination image size:
#if USE_UINT8
ossimRefPtr<ossimImageData> outImage =
ossimImageDataFactory::instance()->create(0, OSSIM_UINT8, 1, image_size.x, image_size.y);
typedef unsigned char PIXEL_TYPE;
ossimImageDataFactory::instance()->create(0, OSSIM_UINT16, 3, image_size.x, image_size.y);
typedef uint16_t PIXEL_TYPE;
double min = 0.0;
double max = 255;
#else
ossimRefPtr<ossimImageData> outImage =
ossimImageDataFactory::instance()->create(0, OSSIM_NORMALIZED_DOUBLE, 1, image_size.x, image_size.y);
typedef double PIXEL_TYPE;
double min = 0.0;
double max = 1.0;
#endif
if(outImage.valid())
outImage->initialize();
......@@ -83,23 +73,21 @@ int main(int argc, char *argv[])
PIXEL_TYPE step = 8;
PIXEL_TYPE value = 0;
PIXEL_TYPE* buffer = ( PIXEL_TYPE*) outImage->getBuf(0);
PIXEL_TYPE* bufferR = ( PIXEL_TYPE*) outImage->getBuf(0);
PIXEL_TYPE* bufferG = ( PIXEL_TYPE*) outImage->getBuf(1);
PIXEL_TYPE* bufferB = ( PIXEL_TYPE*) outImage->getBuf(2);
ossim_uint32 i = 0;
for (int y=0; y<image_size.y; y++)
for (uint16_t y=1; y<=image_size.y; y++)
{
for (int x=0; x<image_size.x; x++)
for (uint16_t x=0; x<image_size.x; x++)
{
buffer[i++] = value;
if (value == 248)
value = 0;
else
value += step;
bufferR[i] = y;
bufferG[i] = y;
bufferB[i++] = y;
}
}
outImage->write("tile.tif");
// Create output image chain:
ossimRefPtr<ossimMemoryImageSource> memSource = new ossimMemoryImageSource;
memSource->setImage(outImage);
......
......@@ -38,6 +38,8 @@ static void usage()
int main(int argc, char *argv[])
{
// This loads ossim-preferences file specifying OSSIM configuration including the location of
// elevation data and plugin libraries:
ossimInit::instance()->initialize(argc, argv);
vector<ossimString> cmdline;
......@@ -71,12 +73,20 @@ int main(int argc, char *argv[])
if (fname.empty())
usage();
// Use OSSIM's factory pattern to open the correct input image reader object, depending on
// image file formate. Plugins are scanned for handlers if the native handler's cannot
// parse the file:
ossimRefPtr<ossimImageHandler> handler = ossimImageHandlerRegistry::instance()->open(fname);
if (!handler)
{
cout << "\nNull image handler returned for input file <"<<fname<<">!" << endl;
exit(1);
}
// The handler will use the image projection factories to instantiate the proper sensor model
// or map projection (if image is orthorectified. This may include RPC replacement model
// if the support data files are available in the image directory. This geometry defines the
// transform from image-space (x,y) to world coordinates (lat, lon):
ossimRefPtr<ossimImageGeometry> geom = handler->getImageGeometry();
if (!handler)
{
......@@ -88,6 +98,9 @@ int main(int argc, char *argv[])
ossimDpt imgUL (0,0);
ossimGpt gndUL;
// Performs image to world transform. This includes the iterative solution for intersecting the
// ray with the elevation surface (unless image is already map projected, in which case the
// elevation lookup is straightforward:
geom->localToWorld(imgUL, gndUL);
ossimDpt gsd (geom->getMetersPerPixel());
......@@ -95,6 +108,8 @@ int main(int argc, char *argv[])
cout<<" Image_UL_corner: "<<gndUL<<endl;
cout<<" Image_GSD: "<<gsd<<endl;
// Establish the view-space (u,v) transform. This trnsforms between output map image (u,v) and
// world coordinates:
ossimRefPtr<ossimMapProjection> proj;
if (doGeographic)
proj = new ossimEquDistCylProjection(ossimEllipsoid(), gndUL);
......@@ -116,16 +131,20 @@ int main(int argc, char *argv[])
ossimDpt testMapPt, testImgPt2;
// Perform x,y -> lat,lon transformations:
geom->localToWorld(testImgPt, testGndPt);
cout<<"Using_image_point: "<<testImgPt<<endl;
cout<<" Image-to-Ground: "<<testGndPt<<endl;
// Perform lat,lon to u,v transformation:
testMapPt = proj->worldToLineSample(testGndPt);
cout<<" Ground-to-Map: "<<testMapPt<<endl;
// Perform u,v back to lat, lon:
testGndPt = proj->lineSampleToWorld(testMapPt);
cout<<" Map-to-Ground: "<<testGndPt<<endl;
// Finally, lat,lon back to image x,y and check the "round-trip" error:
geom->worldToLocal(testGndPt, testImgPt2);
cout<<" Ground-to-Image: "<<testImgPt2<<endl;
......
......@@ -16,7 +16,7 @@ set(JSONCPP_FOUND "NO")
set(OSSIM_HAS_JSONCPP 0)
find_path( JSONCPP_INCLUDE_DIR json/json.h
PATHS "${CMAKE_INSTALL_PREFIX}" "/usr/include/jsoncpp" )
PATHS "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}/include/jsoncpp" "/usr/include/jsoncpp" )
find_library( JSONCPP_LIBRARY NAMES "jsoncpp")
......
ossim (2.7.2-2) UNRELEASED; urgency=medium
ossim (2.8.2-1) unstable; urgency=medium
* Team upload.
* New upstream release.
* Bump Standards-Version to 4.4.0, no changes.
* Drop unused override for pkg-js-tools-test-is-missing.
-- Bas Couwenberg <sebastic@debian.org> Wed, 10 Jul 2019 18:46:55 +0200
-- Bas Couwenberg <sebastic@debian.org> Mon, 15 Jul 2019 20:56:26 +0200
ossim (2.7.2-1) unstable; urgency=medium
......
# Not worth the effort
testsuite-autopkgtest-missing
# False positive, nodejs is not used
pkg-js-tools-test-is-missing
......@@ -70,9 +70,9 @@ public:
*/
virtual ossimString getDataObjectStatusString() const;
virtual ossim_uint32 getObjectSizeInBytes()const;
virtual ossim_uint64 getObjectSizeInBytes()const;
virtual ossim_uint32 getDataSizeInBytes()const=0;
virtual ossim_uint64 getDataSizeInBytes() const = 0;
/**
* This is to be overriden in the derived classes so they can check
......
//---
// License: MIT
//
// Description: Contains class definition for 64 bit integer point.
//---
// $Id$
#ifndef ossimIpt64_H
#define ossimIpt64_H 1
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimDpt.h>
#include <iosfwd>
// Forward class declarations.
class ossimFpt;
class ossimDpt3d;
class ossimIpt;
class ossimString;
class OSSIMDLLEXPORT ossimIpt64
{
public:
ossimIpt64() : x(0), y(0) {}
ossimIpt64(ossim_int64 anX, ossim_int64 aY) : x(anX), y(aY) {}
ossimIpt64(ossim_int32 anX, ossim_int32 aY) : x(anX), y(aY) {}
ossimIpt64(const ossimIpt64& pt) : x(pt.x), y(pt.y) {}
ossimIpt64(const ossimIpt& pt);
ossimIpt64(const ossimDpt& pt);
ossimIpt64(const ossimFpt& pt);
ossimIpt64(const ossimDpt3d &pt);
const ossimIpt64& operator=(const ossimIpt64& pt)
{
if (this != &pt)
{
x = pt.x;
y = pt.y;
}
return *this;
}
const ossimIpt64& operator=(const ossimIpt& pt);
const ossimIpt64& operator=(const ossimDpt& pt);
const ossimIpt64& operator=(const ossimFpt& pt);
bool operator==(const ossimIpt64& pt) const
{ return ( (x == pt.x) && (y == pt.y) ); }
bool operator!=(const ossimIpt64& pt) const
{ return ( (x != pt.x) || (y != pt.y) ); }
void makeNan(){x = OSSIM_INT64_NAN; y=OSSIM_INT64_NAN;}
bool hasNans()const
{
return ( (x==OSSIM_INT64_NAN) || (y==OSSIM_INT64_NAN) );
}
bool isNan()const
{
return ( (x==OSSIM_INT64_NAN) && (y==OSSIM_INT64_NAN) );
}
std::ostream& print(std::ostream& os) const;
friend OSSIMDLLEXPORT std::ostream& operator<<(std::ostream& os,
const ossimIpt64& pt);
/**
* @return ossimString representing point.
*
* Format: ( 30, -90 )
* -x- -y-
*/
std::string toString() const;
/**
* Initializes this point from string. This method opens an istream to
* s and then calls operator>>.
*
* Expected format: ( 30, -90 )
* -x- -y-
*
* @param s String to initialize from.
*
* @see operator>>
*/
void toPoint(const std::string& s);
/**
* Method to input the formatted string of the "operator<<".
*
* Expected format: ( 30, -90 )
* -x- -y-
*
* This method starts by doing a "makeNan" on pt. So if anything goes
* wrong with the stream or parsing pt could be all or partially nan.
*
* @param is Input stream istream to formatted text.
* @param pt osimIpt to be initialized from stream.
* @return istream pass in.
*/
friend OSSIMDLLEXPORT std::istream& operator>>(std::istream& is,
ossimIpt64& pt);
bool isEqualTo(const ossimIpt64& rhs,
ossimCompareType compareType=OSSIM_COMPARE_FULL)const;
/*!
* METHOD: length()
* Returns the RSS of the components.
*/
double length() const { return sqrt((double)x*x + (double)y*y); }
//***
// OPERATORS: +, -, +=, -=
// Point add/subtract with other point:
//***
ossimIpt64 operator+(const ossimIpt64& p) const
{ return ossimIpt64(x+p.x, y+p.y); }
ossimIpt64 operator-(const ossimIpt64& p) const
{ return ossimIpt64(x-p.x, y-p.y); }
const ossimIpt64& operator+=(const ossimIpt64& p)
{ x += p.x; y += p.y; return *this; }
const ossimIpt64& operator-=(const ossimIpt64& p)
{ x -= p.x; y -= p.y; return *this; }
//***
// OPERATORS: *, /
// Scale point components by scalar:
//***
ossimDpt operator*(const double& d) const
{ return ossimDpt(d*x, d*y); }
ossimDpt operator/(const double& d) const
{ return ossimDpt(x/d, y/d); }
//***
// Public data members:
//***
union {ossim_int64 x; ossim_int64 u; ossim_int64 samp;};
union {ossim_int64 y; ossim_int64 v; ossim_int64 line;};
};
#endif /* #ifndef ossimIpt64_H */
//---
//
// License: MIT
//
// Description:
//
// Contains class declaration for ossimIrect64.
//
//---
// $Id$
#ifndef ossimIrect64_H
#define ossimIrect64_H 1
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimIpt64.h>
#include <iosfwd>
// Forward class declarations.
class ossimDrect;
class ossimIrect;
class ossimKeywordlist;
/**
* @class ossimIrect64
*
* This class supports both left and right-handed coordinate systems. For both,
* the positive x-axis extends to the "right".
*
* Notes:
* 1) If size == 0, operations that return "origin + size - 1" will just return
* the origin.
* 2) No support for negative size right now. Not sure if we want to support
* that.
* 3) There are very few nan checks.
*/
class OSSIMDLLEXPORT ossimIrect64
{
public:
/** @brief Default constructor. */
ossimIrect64();
/**
* @brief Constructor that takes an origin, size and mode.
* @param origin
* @param size
* @param mode
*/
ossimIrect64(ossimIpt64 origin,
ossimIpt64 size,
ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED);
/**
* @brief Constructor that takes an origin, size and mode.
* @param origin_x
* @param origin_y
* @param size_x
* @param size_y
* @param mode
*/
ossimIrect64(ossim_int64 origin_x,
ossim_int64 origin_y,
ossim_int64 size_x,
ossim_int64 size_y,
ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED);
/**
* @brief Copy Constructor.
* @rect
*/
ossimIrect64(const ossimIrect64& rect);
/**
* @brief Constructor that takes 32 bit rect.
* @rect
*/
ossimIrect64(const ossimIrect& rect);
/**
* @brief Constructor that takes double rect.
* @rect
*/
ossimIrect64(const ossimDrect& rect);
/**
* @brief assignment operator from a 64 bit rect.
* @param rect
*/
const ossimIrect64& operator=(const ossimIrect64& rect);
/**
* @brief assignment operator from a 32 bit rect.
* @param rect
*/
const ossimIrect64& operator=(const ossimIrect& rect);
/**
* @brief assignment operator from a doubl rect.
* @param rect
*/
const ossimIrect64& operator=(const ossimDrect& rect);
/**
* @brief Access to origin data member.
*
* If orientation mode is left handed this will be the upper left; else
* lower left for right handed.
*
* @return Const reference to origin data member.
*/
const ossimIpt64& origin() const;
/**
* @brief Access to origin data member.
*
* If orientation mode is left handed this will be the upper left; else
* lower left for right handed.
*
* @return Reference to origin data member.
*/
ossimIpt64& origin();
/**
* @brief Access to size data member.
* @return Const reference to size data member.
*/
const ossimIpt64& size() const;
/**
* @brief Access to size data member.
* @return Reference to size data member.
*/
ossimIpt64& size();
/**
* @brief Access to orientation mode data member.
* @return Const reference to orientation mode data member.
*/
ossimCoordSysOrientMode orientationMode() const;
/**
* @brief Access to orientation mode data member.
* @return Reference to orientation mode data member.
*/
ossimCoordSysOrientMode orientationMode();
/**
* @brief Get the end point, i.e. origin + size - 1.
*
* If mode is left handed this is lower right.
* If mode is right handed this is upper right.
*
* @param pt Initialized by this.
*/
void end(ossimIpt64& pt) const;
/** @return the end point. */
ossimIpt64 end() const;
/**
* @brief Upper left corner.
* @param pt Initialized by this.
*/
void ul(ossimIpt64& pt) const;
/** @return Upper left corner. */
ossimIpt64 ul() const;
/**
* @brief Upper right corner.
* @param pt Initialized by this.
*/
void ur(ossimIpt64& pt) const;
/** @return Upper right corner. */
ossimIpt64 ur() const;
/**
* @brief Lower right corner.
* @param pt Initialized by this.
*/
void lr(ossimIpt64& pt) const;
/** @return Lower right corner. */
ossimIpt64 lr() const;
/**
* @brief Lower left corner.
* @param pt Initialized by this.
*/
void ll(ossimIpt64& pt) const;
/** @return Lower left corner. */
ossimIpt64 ll() const;
/**
* @brief height
* @return height
*/
ossim_uint64 height() const;
/**
* @brief width
* @return width
*/
ossim_uint64 width() const;
/**
* @brief Area
* @return width*height
*/
ossim_uint64 area() const;
/**
* @brief operator!=
* @param rect
* @return true if not equal; else, false.
*/
bool operator!=(const ossimIrect64& rect) const;
/**
* @brief operator==
* @param rect
* @return true if equal; else, false.
*/
bool operator==(const ossimIrect64& rect) const;
/**
* @brief operator+=
* @param shift Added to this.
* @return Reference to this.
*/
const ossimIrect64& operator+=(const ossimIpt64& shift);
const ossimIrect64& operator+=(const ossimIpt& shift);
const ossimIrect64& operator+=(const ossimDpt& shift);
/**
* @brief operator-=
* @param shift Subtracted from this.
* @return Reference to this.
*/
const ossimIrect64& operator-=(const ossimIpt64& shift);
const ossimIrect64& operator-=(const ossimIpt& shift);
const ossimIrect64& operator-=(const ossimDpt& shift);
/**
* @brief operator+
* @param shift Added to this.
* @return Rectangle with this + shift.
*/
ossimIrect64 operator+(const ossimIpt64& shift)const;
ossimIrect64 operator+(const ossimIpt& shift) const;
ossimIrect64 operator+(const ossimDpt& shift) const;
/**
* @brief operator-
* @param shift Subtracted from this.
* @return Rectangle with this - shift.
*/
ossimIrect64 operator-(const ossimIpt64& shift) const;
ossimIrect64 operator-(const ossimIpt& shift) const;
ossimIrect64 operator-(const ossimDpt& shift) const;
/**
* @brief Gets the bounds of the rectangle.
* @param minx
* @param miny
* @param maxx
* @param maxy
*/
void getBounds(ossim_int64& minx, ossim_int64& miny,
ossim_int64& maxx, ossim_int64& maxy) const;
/**
* Initializes center_point with center of the rectangle.
* Makes center_point nan if this rectangle has nans.
*/
void getCenter(ossimDpt& center_point) const;
/**
* @brief Assigns m_origin and m_size to OSSIM_INT64_NAN.
*/
void makeNan();
/**
* @brief Test for nans.
* @return true if any nans; false, if not.
*/
bool hasNans() const;
/**
* @brief Test for nans.
* @return true if everything is nan; false, if not.
*/
bool isNan() const;
/**
* @brief Stretches this rectangle to tile boundaries.
* @param tileWidthHeight
*/
bool stretchToTileBoundary(const ossimIpt64& tileWidthHeight);
/**
* @return ossimString representing ossimIrect64.
*
* Format: ( 30, -90, 512, 512, [LH|RH] )
* -x- -y- -w- -h- -Right or left handed-
*
* where:
* x and y are origins either upper left if LEFT HANDED (LH) or
* lower left if RIGHT HANDED (RH)
* w and h are width and height respectively
* The last value is LH or RH to indicate LeftHanded or RightHanded
*
*/
ossimString toString()const;
/**
* expected Format: form 1: ( 30, -90, 512, 512, [LH|RH] )
* -x- -y- -w- -h- -Right or left handed-
*
* form 2: ( 30, -90, 512, 512)
* -x- -y- -w- -h-
*
* NOTE: Form 2 assumes Left handed were x,y is origin upper left and y
* positive down.
*
* This method starts by doing a "makeNan" on rect.
*
* @param rectString String to initialize from.
* @return true or false to indicate successful parsing.
*/
bool toRect(const ossimString& rectString);
/**
* @brief Expands rect by padding.
* @param padding
*/
const ossimIrect64& expand(const ossimIpt64& padding);
/*!
* Returns true if "pt" falls within rectangle. Fall on an edge is also
* considered to be within.
*/
bool pointWithin(const ossimIpt64& pt) const;
/*!
* @return true if any portion of an input rectangle "rect" intersects
* "this" rectangle.
*/
bool intersects(const ossimIrect64& rect) const;
/*!
* @brief Overloaded intersect for ossimIrect.
* @return true if any portion of an input rectangle "rect" intersects
* "this" rectangle.
*/
bool intersects(const ossimIrect& rect) const;
/*!
* Returns true if "this" rectangle is contained completely within
* the input rectangular "rect".
*/
bool completely_within(const ossimIrect64& rect) const;
ossimIrect64 clipToRect(const ossimIrect64& rect)const;
ossimIpt64 midPoint()const;
void print(std::ostream& os) const;
friend OSSIM_DLL std::ostream& operator<<(std::ostream& os,
const ossimIrect64& rect);
ossimIrect64 combine(const ossimIrect64& rect)const;
bool saveState(ossimKeywordlist& kwl,
const char* prefix=0)const;
bool loadState(const ossimKeywordlist& kwl,
const char* prefix=0);
private:
// Private data members:
ossimIpt64 m_origin;
ossimIpt64 m_size;
ossimCoordSysOrientMode m_mode;
};
#endif /* #ifndef ossimIrect64_H */
......@@ -21,9 +21,9 @@ public:
ossimRectilinearDataObject(const ossimRectilinearDataObject&rhs);
ossimRectilinearDataObject(ossim_uint32 numberOfSpatialComponents,
ossimRectilinearDataObject(ossim_uint64 numberOfSpatialComponents,
ossimSource *owner,
ossim_uint32 numberOfDataComponents,
ossim_uint64 numberOfDataComponents,
ossimScalarType scalarType = OSSIM_SCALAR_UNKNOWN,
ossimDataObjectStatus status = OSSIM_NULL);
......@@ -34,8 +34,8 @@ public:
* contents equal to the value passed in to length.
*/
ossimRectilinearDataObject(ossimSource *owner,
ossim_uint32 numberOfDataComponents,
ossim_uint32 length,
ossim_uint64 numberOfDataComponents,
ossim_uint64 length,
ossimScalarType scalarType = OSSIM_SCALAR_UNKNOWN,
ossimDataObjectStatus status = OSSIM_NULL);
......@@ -47,9 +47,9 @@ public:
* height.
*/
ossimRectilinearDataObject(ossimSource *owner,
ossim_uint32 numberOfDataComponents,
ossim_uint32 width,
ossim_uint32 height,
ossim_uint64 numberOfDataComponents,
ossim_uint64 width,
ossim_uint64 height,
ossimScalarType scalarType = OSSIM_SCALAR_UNKNOWN,
ossimDataObjectStatus status = OSSIM_NULL);
......@@ -61,14 +61,13 @@ public:
* height, and depth.
*/
ossimRectilinearDataObject(ossimSource *owner,
ossim_uint32 numberOfDataComponents,
ossim_uint32 width,
ossim_uint32 height,
ossim_uint32 depth,
ossim_uint64 numberOfDataComponents,
ossim_uint64 width,
ossim_uint64 height,
ossim_uint64 depth,
ossimScalarType scalarType = OSSIM_SCALAR_UNKNOWN,
ossimDataObjectStatus status = OSSIM_NULL);
virtual ~ossimRectilinearDataObject();
/**
* How many components make up this data object. For
......@@ -77,9 +76,9 @@ public:
* RGB would be seen as a single data object being
* passed through.
*/
virtual void setNumberOfDataComponents(ossim_uint32 n);
virtual void setNumberOfDataComponents(ossim_uint64 n);
virtual void setSpatialExtents(ossim_uint32* extents, ossim_uint32 size);
virtual void setSpatialExtents(ossim_uint64 *extents, ossim_uint64 size);
/**
* See ossimScalarType in ossimConstants for a full list
......@@ -94,15 +93,15 @@ public:
*/
virtual void setScalarType(ossimScalarType type);
virtual ossim_uint32 getNumberOfDataComponents() const;
virtual ossim_uint64 getNumberOfDataComponents() const;
virtual ossim_uint32 getNumberOfSpatialComponents() const;
virtual ossim_uint64 getNumberOfSpatialComponents() const;
virtual const ossim_uint32* getSpatialExtents() const;
virtual const ossim_uint64 *getSpatialExtents() const;
virtual ossimScalarType getScalarType() const;
virtual ossim_uint32 getScalarSizeInBytes()const;
virtual ossim_uint64 getScalarSizeInBytes() const;
virtual void* getBuf();
......@@ -126,9 +125,9 @@ public:
*/
virtual void initialize();
virtual ossim_uint32 computeSpatialProduct()const;
virtual ossim_uint64 computeSpatialProduct() const;
virtual ossim_uint32 getDataSizeInBytes()const;
virtual ossim_uint64 getDataSizeInBytes()const;
virtual std::ostream& print(std::ostream& out) const;
......@@ -144,10 +143,10 @@ public:
virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
protected:
ossim_uint32 m_numberOfDataComponents;
ossim_uint64 m_numberOfDataComponents;
ossimScalarType m_scalarType;
std::vector<ossim_uint8> m_dataBuffer;
std::vector<ossim_uint32> m_spatialExtents;
std::vector<ossim_uint64> m_spatialExtents;
TYPE_DATA
};
......
......@@ -133,12 +133,12 @@ public:
/**
* @return The width of the data object.
*/
virtual ossim_uint32 getWidth()const;
virtual ossim_uint64 getWidth() const;
/**
* @return The height of the data object.
*/
virtual ossim_uint32 getHeight()const;
virtual ossim_uint64 getHeight() const;
/**
* @return The image rectangle relative to origin, height and width.
......@@ -324,15 +324,15 @@ public:
template <class T> void copyTileToFloatBuffer(
T /* dummyTemplate*/, ossim_float32* buf)const
{
const ossim_uint32 SIZE = getSizePerBand();
const ossim_uint32 BANDS = getNumberOfBands();
const ossim_uint64 SIZE = getSizePerBand();
const ossim_uint64 BANDS = getNumberOfBands();
for(ossim_uint32 band = 0; band < BANDS; ++band)
for (ossim_uint64 band = 0; band < BANDS; ++band)
{
const T* s = (T*)getBuf(band); // source
ossim_float32* d = (ossim_float32*)(buf + (band*SIZE)); // destination
for(ossim_uint32 offset = 0; offset < SIZE; ++offset)
for (ossim_uint64 offset = 0; offset < SIZE; ++offset)
{
ossim_float32 p = s[offset];
d[offset] = p;
......@@ -559,25 +559,25 @@ public:
* Returns the total number of pixels in a tile for all bands.
* Note: This is not in bytes but in pixels.
*/
virtual ossim_uint32 getSize() const;
virtual ossim_uint64 getSize() const;
/**
* Returns the number of pixels in a single band in a tile.
* Note: This is not in bytes but in pixels.
*/
virtual ossim_uint32 getSizePerBand()const;
virtual ossim_uint64 getSizePerBand() const;
/**
* Returns the number of bytes in single band of the tile.
*/
virtual ossim_uint32 getSizePerBandInBytes() const;
virtual ossim_uint64 getSizePerBandInBytes() const;
virtual ossim_uint32 getDataSizeInBytes()const;
virtual ossim_uint64 getDataSizeInBytes() const;
/**
* Returns the total number of bytes for all bands.
*/
virtual ossim_uint32 getSizeInBytes() const;
virtual ossim_uint64 getSizeInBytes() const;
/**
* Initializes data to null pixel values.
......@@ -930,9 +930,9 @@ public:
* Usage example in method: ossimTiffTileSource::loadFromScanLine
*/
virtual void copyLine(const void *src,
ossim_int32 lineNumber,
ossim_int32 lineStartSample,
ossim_int32 lineStopSample,
ossim_int64 lineNumber,
ossim_int64 lineStartSample,
ossim_int64 lineStopSample,
ossimInterleaveType lineInterleave);
/**
......@@ -963,11 +963,12 @@ public:
virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
protected:
/** @brief Templated copy line method. */
template <class T> void copyLineTemplate(T dummyTemplate,
template <class T>
void copyLineTemplate(T dummyTemplate,
const void *src,
ossim_int32 lineNumber,
ossim_int32 lineStartSample,
ossim_int32 lineStopSample,
ossim_int64 lineNumber,
ossim_int64 lineStartSample,
ossim_int64 lineStopSample,
ossimInterleaveType lineInterleave);
/**
......
......@@ -21,9 +21,12 @@ public:
virtual ossimString getShortName()const;
virtual ossimString getLongName()const;
ossim_uint32 getWidth()const;
ossim_float64 getSigma()const;
void setWidthAndSigma(ossim_uint32 w, ossim_float64 sigma);
/**
* @param percent Sets the percentage of sharpen. A value of 0 is no sharpen and a
* value of 1 is fully sharpened. The range is between and including
* 0 and 1
*/
void setSharpenPercent(ossim_float64 percent);
virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& tileRect,
ossim_uint32 resLevel=0);
......@@ -43,40 +46,31 @@ public:
const char* prefix=0)const;
protected:
virtual ~ossimImageSharpenFilter();
inline double laplacianOfGaussian(double x, double y, double sigma)
{
double r2 = x*x+y*y;
double sigma2 = sigma*sigma;
return ((1.0/(M_PI*sigma2*sigma2))*
(1.0-r2/(2.0*sigma2))*
(exp(-r2/(2.0*sigma2))));
}
void buildConvolutionMatrix();
/*!
* Convolve full means that the input data is full and has
* no null data. We don't have to compare for nulls here
*/
template <class T>
void sharpenFull(T,
void sharpenLut(T,
const ossimRefPtr<ossimImageData> &inputData,
ossimRefPtr<ossimImageData> &outputData);
/*!
* Convolve partial means that the input data is has some
* null data. We will have to compare nulls
*/
template <class T>
void sharpenPartial(T,
void sharpenLutRemap(T,
const ossimRefPtr<ossimImageData> &inputData,
ossimRefPtr<ossimImageData> &outputData);
ossimRefPtr<ossimConvolutionSource> theConvolutionSource;
ossim_uint32 theWidth;
ossim_float64 theSigma;
void buildConvolutionLuts();
void allocate();
std::vector<ossim_float64> m_posLut;
std::vector<ossim_float64> m_posNegLut;
ossim_float64 m_sharpenPercent;
ossimRefPtr<ossimImageData> m_tile;
/**
* This is a flag to indicate whether or not
* to remap values. This means we do not have a
* way to directly map values to a lut and so
* need to get remapped. to a sampled LUT.
*/
bool m_remapValue;
TYPE_DATA
};
......
......@@ -76,7 +76,7 @@ public:
*/
virtual bool isEqualTo(const ossimDataObject& /*rhs*/, bool /*deep_copy*/) const { return false; }
virtual ossim_uint32 getHashId() const { return 0; }
virtual ossim_uint32 getDataSizeInBytes() const { return 0; };
virtual ossim_uint64 getDataSizeInBytes() const { return 0; };
virtual void initialize() {};
protected:
......
......@@ -64,11 +64,12 @@ class ossimQuickbirdRpcModel : public ossimRpcModel
return theSupportData.get();
}
bool parseRpcData(const ossimFilename &file);
protected:
bool parseNitfFile(const ossimFilename &file);
bool parseTiffFile(const ossimFilename &file);
bool parseMetaData(const ossimFilename &file);
bool parseRpcData(const ossimFilename &file);
bool parseTileData(const ossimFilename &file);
//! Given an initial filename with case-agnostic extension, this method searches first for an
......
......@@ -26,6 +26,7 @@
#include <ossim/imaging/ossimSingleImageChain.h>
#include <ossim/imaging/ossimImageFileWriter.h>
#include <ossim/projection/ossimMapProjection.h>
#include <ossim/base/ossimConnectableContainer.h>
#include <map>
#include <vector>
......@@ -443,6 +444,12 @@ private:
*/
void propagateOutputProjectionToChains();
/**
* @brief loops through all chains and sets the viewport aoi. This is used
* if viewport stretch is enabled based on center tile request.
*/
void propagateViewportStretch(const ossimIrect& aoi);
/**
* @brief Combines all layers into an ossimImageMosaic.
* @return ossimRefPtr with pointer to ossimImageSource. Can be null.
......@@ -781,12 +788,21 @@ private:
/**
* @brief Gets the sharpen mode.
*
* Valid modes: light, heavy
* Valid modes: light, medium, heavy
*
* @return sharpness mode
*/
std::string getSharpenMode() const;
/**
* @brief Gets the sharpen mode.
*
* Valid percent: values between 0 and 1
*
* @return sharpen percent as string
*/
std::string getSharpenPercent() const;
int getHistoMode() const;
/** @brief Initializes arg parser and outputs usage. */
......@@ -795,6 +811,9 @@ private:
/** @brief Hidden from use copy constructor. */
ossimChipperUtil( const ossimChipperUtil& obj );
ossimRefPtr<ossimImageSource> getFinalInput(const ossimIrect& aoi, ossimRefPtr<ossimImageSource> currentSource);
void setStretch(ossimRefPtr<ossimHistogramRemapper> remapper)const;
/** @brief Hidden from use assignment operator. */
const ossimChipperUtil& operator=( const ossimChipperUtil& rhs );
......@@ -834,11 +853,17 @@ private:
mutable ossimRefPtr<ossimImageFileWriter> m_writer;
/**
* We need to support changing clips without doing a full initilization.
* We need to support changing clips without doing a full initialization.
* we will save the ImageSource pointer on first initialization
*/
ossimRefPtr<ossimImageSource> m_source;
mutable bool m_viewPortStretchEnabled;
/**
* Final container that holds any cuts or stretching, ... etc just before we output
*/
ossimRefPtr<ossimConnectableContainer> m_container;
};
#endif /* #ifndef ossimChipperUtil_HEADER */
......@@ -89,7 +89,7 @@ ossimString ossimDataObject::getDataObjectStatusString() const
return s;
}
ossim_uint32 ossimDataObject::getObjectSizeInBytes()const
ossim_uint64 ossimDataObject::getObjectSizeInBytes() const
{
return sizeof(theOwner);
}
......
//---
// License: MIT
//
// Description: Contains class declaration for 64 bit integer point.
//---
// $Id$
#include <iostream>
#include <sstream>
#include <ossim/base/ossimIpt64.h>
#include <ossim/base/ossimCommon.h>
#include <ossim/base/ossimDpt3d.h>
#include <ossim/base/ossimFpt.h>
#include <ossim/base/ossimIpt.h>
#include <ossim/base/ossimString.h>
ossimIpt64::ossimIpt64(const ossimIpt& pt)
{
if(pt.hasNans())
{
makeNan();
}
else
{
x = pt.x;
y = pt.y;
}
}
ossimIpt64::ossimIpt64(const ossimDpt& pt)
{
if(pt.hasNans())
{
makeNan();
}
else
{
x = ossim::round<ossim_int64>(pt.x);
y = ossim::round<ossim_int64>(pt.y);
}
}
ossimIpt64::ossimIpt64(const ossimFpt& pt)
{
if(pt.hasNans())
{
makeNan();
}
else
{
x = ossim::round<ossim_int64>(pt.x);
y = ossim::round<ossim_int64>(pt.y);
}
}
ossimIpt64::ossimIpt64(const ossimDpt3d &pt)
{
if(pt.hasNans())
{
makeNan();
}
else
{
x = ossim::round<ossim_int64>(pt.x);
y = ossim::round<ossim_int64>(pt.y);
}
}
const ossimIpt64& ossimIpt64::operator=(const ossimIpt& pt)
{
if(pt.hasNans())
{
makeNan();
}
else
{
x = pt.x;
y = pt.y;
}
return *this;
}
const ossimIpt64& ossimIpt64::operator=(const ossimDpt& pt)
{
if(pt.hasNans())
{
makeNan();
}
else
{
x = ossim::round<ossim_int64>(pt.x);
y = ossim::round<ossim_int64>(pt.y);
}
return *this;
}
const ossimIpt64& ossimIpt64::operator=(const ossimFpt& pt)
{
if(pt.hasNans())
{
makeNan();
}
else
{
x = ossim::round<ossim_int64>(pt.x);
y = ossim::round<ossim_int64>(pt.y);
}
return *this;
}
std::ostream& ossimIpt64::print(std::ostream& os) const
{
os << "( ";
if (x != OSSIM_INT64_NAN)
{
os << x;
}
else
{
os << "nan";
}
os << ", ";
if (y != OSSIM_INT64_NAN)
{
os << y;
}
else
{
os << "nan";
}
os << " )";
return os;
}
std::ostream& operator<<(std::ostream& os, const ossimIpt64& pt)
{
return pt.print(os);
}
std::string ossimIpt64::toString() const
{
std::ostringstream os;
os << "(";
if (x != OSSIM_INT64_NAN)
{
os << x;
}
else
{
os << "nan";
}
os << ",";
if (y != OSSIM_INT64_NAN)
{
os << y;
}
else
{
os << "nan";
}
os << ")";
return os.str();
}
void ossimIpt64::toPoint(const std::string& s)
{
std::istringstream is(s);
is >> *this;
}
std::istream& operator>>(std::istream& is, ossimIpt64 &pt)
{
//---
// Expected input format:
// ( 30, -90 )
// -x- -y-
//---
// Start with a nan point.
pt.makeNan();
// Check the stream.
if (!is) return is;
const int SZ = 64; // Handle real big number...
ossimString os;
char buf[SZ];
//---
// X SECTION:
//---
// Grab data up to the first comma.
is.get(buf, SZ, ',');
if (!is) return is;
// Copy to ossim string.
os = buf;
// Get rid of the '(' if there is any.
std::string::size_type pos = os.find('(');
if (pos != std::string::npos)
{
os.erase(pos, 1);
}
if (os.contains("nan") == false)
{
pt.x = os.toInt64();
}
else
{
pt.x = OSSIM_INT64_NAN;
}
//---
// Y SECTION:
//---
// Grab the data up to the ')'
is.get(buf, SZ, ')');
if (!is) return is;
// Copy to ossim string.
os = buf;
// Get rid of the ',' if there is any.
pos = os.find(',');
if (pos != std::string::npos)
{
os.erase(pos, 1);
}
if (os.contains("nan") == false)
{
pt.y = os.toInt64();
}
else
{
pt.y = OSSIM_INT64_NAN;
}
// Gobble the trailing ")".
char c = 0;
while (c != ')')
{
is.get(c);
if (!is) break;
}
// Finished
return is;
}
bool ossimIpt64::isEqualTo(const ossimIpt64& rhs, ossimCompareType /* compareType */)const
{
return ((x==rhs.x)&&
(y==rhs.y));
}
//---
//
// License: MIT
//
// Description:
//
// Contains class definition for osimIrect64.
//
//---
// $Id$
#include <ossim/base/ossimIrect64.h>
#include <ossim/base/ossimCommon.h>
#include <ossim/base/ossimIrect.h>
#include <ossim/base/ossimDrect.h>
#include <ossim/base/ossimKeywordlist.h>
#include <ossim/base/ossimString.h>
#include <ossim/base/ossimKeywordNames.h>
#include <ostream>
#include <sstream>
ossimIrect64::ossimIrect64()
:
m_origin(0, 0),
m_size(0, 0),
m_mode(OSSIM_LEFT_HANDED)
{}
ossimIrect64::ossimIrect64(ossimIpt64 origin,
ossimIpt64 size,
ossimCoordSysOrientMode mode)
:
m_origin(origin),
m_size(size),
m_mode(mode)
{}
ossimIrect64::ossimIrect64(ossim_int64 origin_x,
ossim_int64 origin_y,
ossim_int64 size_x,
ossim_int64 size_y,
ossimCoordSysOrientMode mode)
:
m_origin(origin_x, origin_y),
m_size(size_x, size_y),
m_mode(mode)
{}
ossimIrect64::ossimIrect64(const ossimIrect64& rect)
:
m_origin(rect.m_origin),
m_size(rect.m_size),
m_mode(rect.m_mode)
{}
ossimIrect64::ossimIrect64(const ossimIrect& rect)
:
m_origin(rect.ul()),
m_size(rect.size()),
m_mode(rect.orientationMode())
{
if ( m_mode == OSSIM_RIGHT_HANDED )
{
m_origin = rect.ll();
}
}
ossimIrect64::ossimIrect64(const ossimDrect& rect)
:
m_origin(rect.ul()),
m_size(rect.size()),
m_mode(rect.orientationMode())
{
if ( m_mode == OSSIM_RIGHT_HANDED )
{
m_origin = rect.ll();
}
}
const ossimIrect64& ossimIrect64::operator=(const ossimIrect64& rect)
{
if (this != &rect)
{
m_origin = rect.m_origin;
m_size = rect.m_size;
m_mode = rect.m_mode;
}
return *this;
}
const ossimIrect64& ossimIrect64::operator=(const ossimIrect& rect)
{
m_mode = rect.orientationMode();
if ( m_mode == OSSIM_LEFT_HANDED )
{
m_origin = rect.ul();
}
else
{
m_origin = rect.ll();
}
m_size = rect.size();
return *this;
}
const ossimIrect64& ossimIrect64::operator=(const ossimDrect& rect)
{
m_mode = rect.orientationMode();
if ( m_mode == OSSIM_LEFT_HANDED )
{
m_origin = rect.ul();
}
else
{
m_origin = rect.ll();
}
m_size = rect.size();
return *this;
}
const ossimIpt64& ossimIrect64::origin() const
{
return m_origin;
}
ossimIpt64& ossimIrect64::origin()
{
return m_origin;
}
const ossimIpt64& ossimIrect64::size() const
{
return m_size;
}
ossimIpt64& ossimIrect64::size()
{
return m_size;
}
ossimCoordSysOrientMode ossimIrect64::orientationMode() const
{
return m_mode;
}
ossimCoordSysOrientMode ossimIrect64::orientationMode()
{
return m_mode;
}
void ossimIrect64::end(ossimIpt64& pt) const
{
pt.x = m_origin.x + ( (m_size.x > 0) ? m_size.x - 1 : 0);
pt.y = m_origin.y + ( (m_size.y > 0) ? m_size.y - 1 : 0);
}
ossimIpt64 ossimIrect64::end() const
{
ossimIpt64 pt;
end( pt );
return pt;
}
void ossimIrect64::ul(ossimIpt64& pt) const
{
if ( m_mode == OSSIM_LEFT_HANDED )
{
pt = m_origin;
}
else
{
pt.x = m_origin.x;
pt.y = m_origin.y + ( (m_size.y > 0) ? m_size.y - 1 : 0);
}
}
ossimIpt64 ossimIrect64::ul() const
{
ossimIpt64 pt;
ul( pt );
return pt;
}
void ossimIrect64::ur(ossimIpt64& pt) const
{
if ( m_mode == OSSIM_LEFT_HANDED )
{
pt.x = m_origin.x + ( (m_size.x > 0) ? m_size.x - 1 : 0);
pt.y = m_origin.y;
}
else
{
end( pt );
}
}
ossimIpt64 ossimIrect64::ur() const
{
ossimIpt64 pt;
ur( pt );
return pt;
}
void ossimIrect64::lr(ossimIpt64& pt) const
{
if ( m_mode == OSSIM_LEFT_HANDED )
{
end( pt );
}
else
{
pt.x = m_origin.x + ( (m_size.x > 0) ? m_size.x - 1 : 0);
pt.y = m_origin.y;
}
}
ossimIpt64 ossimIrect64::lr() const
{
ossimIpt64 pt;
lr( pt );
return pt;
}
void ossimIrect64::ll(ossimIpt64& pt) const
{
if ( m_mode == OSSIM_LEFT_HANDED )
{
pt.x = m_origin.x;
pt.y = m_origin.y + ( (m_size.y > 0) ? m_size.y - 1 : 0);
}
else
{
pt = m_origin;
}
}
ossimIpt64 ossimIrect64::ll() const
{
ossimIpt64 pt;
ll( pt );
return pt;
}
ossim_uint64 ossimIrect64::height() const
{
return static_cast<ossim_uint64>(m_size.y);
}
ossim_uint64 ossimIrect64::width() const
{
return static_cast<ossim_uint64>(m_size.x);
}
ossim_uint64 ossimIrect64::area()const
{
return width()*height();
}
bool ossimIrect64::operator!=(const ossimIrect64& rect) const
{
return ( (m_origin != rect.m_origin) ||
(m_size != rect.m_size) ||
(m_mode != rect.m_mode) );
}
bool ossimIrect64::operator==(const ossimIrect64& rect) const
{
return ( (m_origin == rect.m_origin) &&
(m_size == rect.m_size) &&
(m_mode == rect.m_mode) );
}
const ossimIrect64& ossimIrect64::operator+=(const ossimIpt64& shift)
{
m_origin += shift;
return *this;
}
const ossimIrect64& ossimIrect64::operator+=(const ossimIpt& shift)
{
m_origin += ossimIpt64(shift);
return *this;
}
const ossimIrect64& ossimIrect64::operator+=(const ossimDpt& shift)
{
m_origin += ossimIpt64(shift);
return *this;
}
const ossimIrect64& ossimIrect64::operator-=(const ossimIpt64& shift)
{
m_origin -= shift;
return *this;
}
const ossimIrect64& ossimIrect64::operator-=(const ossimIpt& shift)
{
m_origin -= ossimIpt64(shift);
return *this;
}
const ossimIrect64& ossimIrect64::operator-=(const ossimDpt& shift)
{
m_origin -= ossimIpt64(shift);
return *this;
}
ossimIrect64 ossimIrect64::operator+(const ossimIpt64& shift)const
{
return ossimIrect64(m_origin + shift,
m_size,
m_mode);
}
ossimIrect64 ossimIrect64::operator+(const ossimIpt& shift) const
{
ossimIpt64 origin = m_origin + ossimIpt64(shift);
return ossimIrect64(origin,
m_size,
m_mode);
}
ossimIrect64 ossimIrect64::operator+(const ossimDpt& shift) const
{
ossimIpt64 origin = m_origin + ossimIpt64(shift);
return ossimIrect64(origin,
m_size,
m_mode);
}
ossimIrect64 ossimIrect64::operator-(const ossimIpt64& shift)const
{
return ossimIrect64(m_origin - shift,
m_size,
m_mode);
}
ossimIrect64 ossimIrect64::operator-(const ossimIpt& shift) const
{
ossimIpt64 origin = m_origin - ossimIpt64(shift);
return ossimIrect64(origin,
m_size,
m_mode);
}
ossimIrect64 ossimIrect64::operator-(const ossimDpt& shift)const
{
ossimIpt64 origin = m_origin - ossimIpt64(shift);
return ossimIrect64(origin,
m_size,
m_mode);
}
void ossimIrect64::getBounds(ossim_int64& minx, ossim_int64& miny,
ossim_int64& maxx, ossim_int64& maxy)const
{
minx = m_origin.x;
miny = m_origin.y;
maxx = m_origin.x + ( (m_size.x > 0) ? m_size.x - 1 : 0);
maxy = m_origin.y + ( (m_size.y > 0) ? m_size.y - 1 : 0);
}
void ossimIrect64::getCenter(ossimDpt& center_point) const
{
if ( hasNans() == false )
{
center_point.x = m_origin.x + m_size.x / 2.0;
center_point.y = m_origin.y + m_size.y / 2.0;
}
else
{
center_point.makeNan();
}
}
void ossimIrect64::makeNan()
{
m_origin.makeNan();
m_size.makeNan();
}
bool ossimIrect64::hasNans() const
{
return m_origin.hasNans() || m_size.hasNans();
}
bool ossimIrect64::isNan() const
{
return m_origin.hasNans() && m_size.hasNans();
}
bool ossimIrect64::stretchToTileBoundary(const ossimIpt64& tileWidthHeight)
{
bool result = false;
if ( ( tileWidthHeight.x > 0 ) && ( tileWidthHeight.y > 0 ) )
{
ossimIpt64 endPt;
end( endPt );
if ( m_origin.x % tileWidthHeight.x )
{
ossim_int64 x = (m_origin.x/tileWidthHeight.x) * tileWidthHeight.x;
if ( x > m_origin.x )
{
x -= tileWidthHeight.x;
}
m_origin.x = x;
}
if ( m_origin.y % tileWidthHeight.y )
{
ossim_int64 y = (m_origin.y/tileWidthHeight.y) * tileWidthHeight.y;
if ( y > m_origin.y )
{
y -= tileWidthHeight.y;
}
m_origin.y = y;
}
ossim_int64 x = (endPt.x/tileWidthHeight.x) * tileWidthHeight.x;
if ( x < endPt.x )
{
x += tileWidthHeight.x;
}
endPt.x = x - 1;
ossim_int64 y = (endPt.y/tileWidthHeight.y) * tileWidthHeight.y;
if ( y < endPt.y )
{
y += tileWidthHeight.y;
}
endPt.y = y - 1;
m_size.x = endPt.x - m_origin.x + 1;
m_size.y = endPt.y - m_origin.y + 1;
result = true;
}
return result;
}
ossimString ossimIrect64::toString()const
{
ossimString result="(";
if ( m_origin.x != OSSIM_INT64_NAN )
{
result += (ossimString::toString(m_origin.x) + ",");
}
else
{
result += "nan,";
}
if ( m_origin.y != OSSIM_INT64_NAN )
{
result += (ossimString::toString(m_origin.y) + ",");
}
else
{
result += "nan,";
}
if ( m_size.x != OSSIM_INT64_NAN )
{
result += (ossimString::toString(m_size.x) + ",");
}
else
{
result += "nan,";
}
if ( m_size.y != OSSIM_INT64_NAN )
{
result += (ossimString::toString(m_size.y) + ",");
}
else
{
result += "nan,";
}
if(m_mode == OSSIM_LEFT_HANDED)
{
result += "LH";
}
else
{
result += "RH";
}
result += ")";
return result;
}
bool ossimIrect64::toRect(const ossimString& rectString)
{
bool result = false;
makeNan();
std::istringstream in(rectString);
ossim::skipws(in);
char charString[2];
charString[1] = '\0';
ossimString interior;
if(in.peek() == '(')
{
in.ignore();
while((in.peek() != ')')&&
(in.peek() != '\n') &&
in.good())
{
charString[0] = in.get();
interior += charString;
}
if(in.peek() == ')')
{
result = true;
}
}
if(result)
{
std::vector<ossimString> splitArray;
interior.split(splitArray, ",");
// assume left handed
if(splitArray.size() >= 4)
{
if ( splitArray[0].trim() != "nan" )
{
m_origin.x = splitArray[0].toInt64();
}
else
{
m_origin.x = OSSIM_INT64_NAN;
}
if ( splitArray[1].trim() != "nan" )
{
m_origin.y = splitArray[1].toInt64();
}
else
{
m_origin.y = OSSIM_INT64_NAN;
}
if ( splitArray[2].trim() != "nan" )
{
m_size.x = splitArray[2].toInt64();
}
else
{
m_size.x = OSSIM_INT64_NAN;
}
if ( splitArray[3].trim() != "nan" )
{
m_size.y = splitArray[3].toInt64();
}
else
{
m_size.y = OSSIM_INT64_NAN;
}
ossimString orientation = "lh";
if(splitArray.size() == 5)
{
orientation = splitArray[4].downcase().trim();
}
if(orientation == "lh")
{
m_mode = OSSIM_LEFT_HANDED;
}
else // origin lower left
{
m_mode = OSSIM_RIGHT_HANDED;
}
}
else
{
result = false;
}
}
return result;
}
const ossimIrect64& ossimIrect64::expand(const ossimIpt64& padding)
{
m_origin.x -= padding.x;
m_origin.y -= padding.y;
m_size.x += padding.x;
m_size.y += padding.y;
return *this;
}
inline bool ossimIrect64::pointWithin(const ossimIpt64& pt) const
{
bool result = false;
if( hasNans() == false )
{
ossimIpt64 endPt;
end( endPt );
result = ((pt.x >= m_origin.x) &&
(pt.x <= endPt.x) &&
(pt.y >= m_origin.y) &&
(pt.y <= endPt.y));
}
return result;
}
bool ossimIrect64::intersects(const ossimIrect64& rect) const
{
bool result = false;
if( (rect.hasNans() == false) && (hasNans() == false) &&
(m_mode == rect.m_mode) )
{
ossimIpt64 endPt1;
end( endPt1 );
ossimIpt64 endPt2;
rect.end( endPt2 );
ossim_int64 x0 = ossim::max(rect.m_origin.x,m_origin.x);
ossim_int64 x1 = ossim::min(endPt2.x,endPt1.x);
ossim_int64 y0 = ossim::max(rect.m_origin.y,m_origin.y);
ossim_int64 y1 = ossim::min(endPt2.y,endPt1.y);
result = ((x0 <= x1) && (y0 <= y1));
}
return result;
}
bool ossimIrect64::intersects(const ossimIrect& rect) const
{
bool result = false;
if( (rect.hasNans() == false) && (hasNans() == false) &&
(m_mode == rect.orientationMode()) )
{
ossimIpt64 endPt1;
end( endPt1 );
ossimIpt64 origin2;
ossimIpt64 endPt2;
if ( rect.orientationMode() == OSSIM_LEFT_HANDED )
{
origin2 = rect.ul();
endPt2 = rect.lr();
}
else
{
origin2 = rect.lr();
endPt2 = rect.ur();
}
ossim_int64 x0 = ossim::max(origin2.x,m_origin.x);
ossim_int64 x1 = ossim::min(endPt2.x,endPt1.x);
ossim_int64 y0 = ossim::max(origin2.y,m_origin.y);
ossim_int64 y1 = ossim::min(endPt2.y,endPt1.y);
result = ((x0 <= x1) && (y0 <= y1));
}
return result;
}
bool ossimIrect64::completely_within(const ossimIrect64& rect) const
{
bool result = false;
if( (rect.hasNans() == false) && (hasNans() == false) &&
(m_mode == rect.m_mode) )
{
/* --------------
| 1 |
| ---------- |
| | | |
| | | |
| | 2 | |
| | | |
| | | |
| ---------- |
| |
-------------- */
ossimIpt64 endPt1;
end( endPt1 );
ossimIpt64 endPt2;
rect.end( endPt2 );
result = ( ( m_origin.x >= rect.m_origin.x ) &&
( m_origin.y >= rect.m_origin.y ) &&
( endPt1.x <= endPt2.x ) &&
( endPt1.y <= endPt2.y ) );
}
return result;
}
ossimIrect64 ossimIrect64::clipToRect(const ossimIrect64& rect)const
{
ossimIrect64 result;
result.makeNan();
if( (rect.hasNans() == false) && (hasNans() == false) &&
(m_mode == rect.m_mode) )
{
ossimIpt64 endPt1;
end( endPt1 );
ossimIpt64 endPt2;
rect.end( endPt2 );
ossim_int64 x0 = ossim::max(rect.m_origin.x, m_origin.x);
ossim_int64 x1 = ossim::min(endPt2.x, endPt1.x);
ossim_int64 y0 = ossim::max(rect.m_origin.y, m_origin.y);
ossim_int64 y1 = ossim::min(endPt2.y, endPt1.y);
if ((x0 <= x1) && (y0 <= y1)) // intersect test
{
result.m_origin.x = x0;
result.m_origin.y = y0;
result.m_size.x = x1 - x0 + 1;
result.m_size.y = y1 - y0 + 1;
result.m_mode = m_mode;
}
}
return result;
}
ossimIpt64 ossimIrect64::midPoint()const
{
ossimIpt64 result;
if( hasNans() == false )
{
ossimIpt64 endPt;
end( endPt );
double x = (m_origin.x + endPt.x) * 0.5;
double y = (m_origin.y + endPt.y) * 0.5;
result.x = ossim::round<ossim_int64>(x);
result.y = ossim::round<ossim_int64>(y);
}
else
{
result.makeNan();
}
return result;
}
void ossimIrect64::print(std::ostream& os) const
{
os << toString();
}
std::ostream& operator<<(std::ostream& os, const ossimIrect64& rect)
{
rect.print(os);
return os;
}
ossimIrect64 ossimIrect64::combine(const ossimIrect64& rect) const
{
ossimIrect64 result;
// If any rect has NANs, it is assumed uninitialized, so assign the result to just the other
if ( ( hasNans() == false ) && ( m_mode == rect.m_mode ) )
{
ossimIpt64 endPt0;
end( endPt0 );
ossimIpt64 endPt1;
rect.end( endPt1 );
result.m_origin.x = ossim::min(m_origin.x, rect.m_origin.x);
result.m_origin.y = ossim::min(m_origin.y, rect.m_origin.y);
result.m_size.x = ossim::max(endPt0.x, endPt1.x) - result.m_origin.x + 1;
result.m_size.y = ossim::max(endPt0.y, endPt1.y) - result.m_origin.y + 1;
result.m_mode = m_mode;
}
else
{
result.makeNan();
}
return result;
}
bool ossimIrect64::saveState(ossimKeywordlist& kwl,
const char* prefix)const
{
kwl.add(prefix,
ossimKeywordNames::TYPE_KW,
"ossimIrect64",
true);
kwl.add(prefix, "rect", toString());
return true;
}
bool ossimIrect64::loadState(const ossimKeywordlist& kwl,
const char* prefix)
{
makeNan();
const char* type = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
if ( type )
{
if ( std::string(type) == "ossimIrect64" )
{
const char* rect = kwl.find(prefix, "rect");
if(rect)
{
toRect(rect);
}
}
}
return true;
}
......@@ -27,6 +27,7 @@
#include <geos/opBuffer.h>
#include <cstdlib>
#include <exception>
#include <memory>
#include <vector>
#include <mutex>
......@@ -177,7 +178,7 @@ void ossimPolyArea2d::recurseVisibleGeometries(
for (idx=0; idx<nPoints; idx++)
{
std::auto_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
std::unique_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
polyList[currentPolyIdx].addPoint(point->getX(), point->getY());
}
}
......@@ -219,7 +220,7 @@ void ossimPolyArea2d::recurseHoles(std::vector<ossimPolygon>& polyList,
for (idx=0; idx<nPoints; idx++)
{
std::auto_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
std::unique_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
polyList[currentPolyIdx].addPoint(point->getX(), point->getY());
}
}
......@@ -256,7 +257,7 @@ void ossimPolyArea2d::recurseCompleteGeometries(std::vector<ossimPolyArea2d>& po
int nPoints = (int)lineString->getNumPoints();
for (int idx = 0; idx<nPoints; idx++)
{
std::auto_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
std::unique_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
shell.addPoint(point->getX(), point->getY());
}
}
......@@ -272,7 +273,7 @@ void ossimPolyArea2d::recurseCompleteGeometries(std::vector<ossimPolyArea2d>& po
std::size_t nPoints = lineString->getNumPoints();
for (std::size_t idx = 0; idx<nPoints; ++idx)
{
std::auto_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
std::unique_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
holes[holeIdx].addPoint(point->getX(), point->getY());
}
}
......