Skip to content
Commits on Source (5)
### Jenkins Build Status
Resource | *master* | *dev* |
------------ | ------------- | -------------
OSSIM Build Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-dev&style=plastic)
Batch Test| ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-test-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-test-dev&style=plastic)
RPMS Build Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-dev&style=plastic)
RPMS Publish Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-publish-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-publish-dev&style=plastic)
OSSIM Build Centos7 | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-dev&style=plastic)
Batch Test| ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-test-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-test-dev&style=plastic)
RPMS Build Centos7 | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=rpm-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=rpm-dev&style=plastic)
RPMS Publish Centos7 | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=rpm-publish-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=rpm-publish-dev&style=plastic)
<a href="https://scan.coverity.com/projects/ossimlabs">
......
ossim (2.5.2-1) unstable; urgency=medium
* Team upload.
* New upstream release.
* Refresh patches.
-- Bas Couwenberg <sebastic@debian.org> Wed, 17 Oct 2018 07:17:12 +0200
ossim (2.5.1-1) unstable; urgency=medium
* Team upload.
......
......@@ -90,7 +90,7 @@ Author: Bas Couwenberg <sebastic@debian.org>
<< std::endl;
}
m_inputStream.reset();
@@ -764,7 +764,7 @@ std::ostream& ossimTiffInfo::print(std::
@@ -767,7 +767,7 @@ std::ostream &ossimTiffInfo::print(std::
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_WARN)
......
......@@ -389,6 +389,16 @@ public:
ossimString& downcase();
ossimString downcase()const;
/**
* @return true if the string ends in the pattern specified
*/
bool endsWith(const ossimString &pattern) const;
/**
* @return true if the string starts with the pattern specified
*/
bool startsWith(const ossimString &pattern) const;
/**
* @brief Returns a pointer to a null-terminated array of characters
* representing the string's contents.
......
......@@ -102,7 +102,8 @@ public:
void clearAttributes();
void toKwl(ossimKeywordlist& kwl,
const ossimString& prefix="")const;
const ossimString& prefix="",
bool includeTag=true)const;
void fromKwl(const ossimKeywordlist& kwlToConvert);
protected:
......
......@@ -267,6 +267,16 @@ private:
*/
ossim_uint32 getCurrentTiffRLevel() const;
/**
* @brief Convenience method to get the zero based rgb output band list.
*
*
* @param bandList Initialized by this.
* @return true on success, false if number of bands is less than 3 or if
* rgb bands could not be derived.
*/
virtual bool getRgbBandList(std::vector<ossim_uint32> &bandList) const;
ossimString getReadMethod(ossim_uint32 directory) const;
bool loadTile(const ossimIrect& tile_rect,
......
......@@ -264,13 +264,6 @@ namespace ossim
*/
ossim_float64 getDoubleValue(const ossimString& key, ossim_int32 directory=0)const;
/**
* Convenience method to get a raster type.
*
* This does not supply a way to check if a value existed or not.
*/
ossim_int32 getRasterType(ossim_int32 directory=0)const;
/**
* Convenience method to get a pcs code.
*
......@@ -390,6 +383,12 @@ namespace ossim
*/
ossim_float64 getScaleFactor(ossim_int32 directory=0)const;
/**
* Convenience method to get a raster type.
*
* This does not supply a way to check if a value existed or not.
*/
ossim_int32 getRasterType(ossim_int32 directory = 0) const;
ossim_int32 getPlanarConfig(ossim_int32 directory = 0) const;
ossim_int32 getPhotoInterpretation(ossim_int32 directory = 0) const;
ossim_int32 getCompressionType(ossim_int32 directory = 0) const;
......@@ -405,6 +404,7 @@ namespace ossim
bool isReduced(ossim_int32 directory = 0) const;
bool isPage(ossim_int32 directory = 0) const;
bool isMask(ossim_int32 directory = 0) const;
bool isDigitalGlobe()const;
ossim_int32 getSubFileType(ossim_int32 directory = 0) const;
ossim_uint32 getNumberOfDirectories()const;
bool getColorMap(std::vector<ossim_uint16> &red,
......@@ -430,7 +430,7 @@ namespace ossim
* @param directory to use
*/
bool getGeoDoubleParams(std::vector<ossim_float64>& result,
ossim_int32 directory)const;
ossim_int32 directory=0)const;
/**
* Convenience method to get a Geo double params array.
......@@ -448,9 +448,10 @@ namespace ossim
* @param directory to use
*/
bool getGeoTiePoints(std::vector<ossim_float64>& result,
ossim_int32 directory)const;
ossim_int32 directory=0)const;
bool getCitation(ossimString& citation, ossim_int32 directory)const;
bool getCitation(ossimString& citation, ossim_int32 directory=0)const;
bool getCopyright(ossimString &copyright, ossim_int32 directory = 0) const;
/**
* Convenience method to get a Geo trans matrix array.
*
......
#ifndef ossimNitfSicdXmlDes_HEADER
#define ossimNitfSicdXmlDes_HEADER
#include <ossim/support_data/ossimNitfRegisteredDes.h>
#include <ossim/base/ossimXmlDocument.h>
#include <ossim/base/ossimXmlNode.h>
class OSSIM_DLL ossimNitfSicdXmlDes : public ossimNitfRegisteredDes
{
public:
ossimNitfSicdXmlDes();
virtual void parseStream(std::istream& in);
virtual void writeStream(std::ostream& out);
virtual std::ostream& print(std::ostream& out,
const std::string& prefix=std::string()) const;
virtual void clearFields();
bool loadState(const ossimKeywordlist& kwl, const char* prefix);
bool loadValueFromXml(const ossimRefPtr<ossimXmlDocument>, const ossimString& xpath, ossimString& target) const;
protected:
ossimString m_xmlString;
ossimRefPtr<ossimXmlDocument> m_xmlDocument;
};
#endif
\ No newline at end of file
......@@ -18,8 +18,9 @@
#include <ossim/base/ossimIpt.h>
#include <ossim/base/ossimObject.h>
#include <ossim/base/ossimString.h>
#include <ossim/base/ossimKeywordlist.h>
#include <iosfwd>
#include <memory>
class ossimFilename;
class ossimKeywordlist;
......@@ -27,7 +28,22 @@ class ossimKeywordlist;
class OSSIMDLLEXPORT ossimQuickbirdMetaData : public ossimObject
{
public:
enum QbParseTypes
{
QB_PARSE_TYPE_NONE = 0,
QB_PARSE_TYPE_IMD = 1,
QB_PARSE_TYPE_GEO = 2,
QB_PARSE_TYPE_RPB = 4,
QB_PARSE_TYPE_ATT = 8,
QB_PARSE_TYPE_STE = 16,
QB_PARSE_TYPE_EPH = 32,
QB_PARSE_TYPE_TIL = 64,
QB_PARSE_TYPE_ALL = QB_PARSE_TYPE_IMD | QB_PARSE_TYPE_GEO |
QB_PARSE_TYPE_RPB | QB_PARSE_TYPE_ATT |
QB_PARSE_TYPE_STE | QB_PARSE_TYPE_EPH |
QB_PARSE_TYPE_TIL
};
/** @brief default constructor */
ossimQuickbirdMetaData();
......@@ -35,15 +51,18 @@ public:
virtual ~ossimQuickbirdMetaData();
/**
* @brief Open method that takes the image file, derives the metadata,
* header and rpc files, then calls parse methods parseMetaData,
* parseHdrData, and parseRpcData.
* @brief Open method that takes the image file. By default we just
* parse the imd, for this the most common.
*
* @param imageFile Usually in the form of "po_2619900_pan_0000000.tif".
* @param qbParseTypes The types of data to parse. These are bitwise or
* together. By default we will only do QB_PARSE_TYPE_IMD.
* if you want more just QB_PARSE_TYPE_IMD | QB_PARSE_TYPE_GEO.
*
* @return true on success, false on error.
*/
bool open(const ossimFilename& imageFile);
bool open(const ossimFilename &imageFile,
ossim_int32 qbParseTypes = QB_PARSE_TYPE_IMD);
void clearFields();
......@@ -91,6 +110,8 @@ public:
bool parseATTData(const ossimFilename &data_file);
bool parseEPHData(const ossimFilename &data_file);
bool parseRPBData(const ossimFilename &data_file);
bool parseSTEData(const ossimFilename &data_file);
/** @return theSatID */
ossimString getSatID() const;
......@@ -105,13 +126,19 @@ public:
bool getMapProjectionKwl(const ossimFilename &imd_file,
ossimKeywordlist &kwl);
const std::shared_ptr<ossimKeywordlist> getImdKwl() const;
const std::shared_ptr<ossimKeywordlist> getAttKwl() const;
const std::shared_ptr<ossimKeywordlist> getGeoKwl() const;
const std::shared_ptr<ossimKeywordlist> getEphKwl() const;
const std::shared_ptr<ossimKeywordlist> getRpbKwl() const;
const std::shared_ptr<ossimKeywordlist> getSteKwl() const;
const std::shared_ptr<ossimKeywordlist> getTilKwl() const;
/*****************************************
*parseATTData EPH GEO IMD RPB TIL
*
****************************************/
private:
ossimString theGenerationDate;
ossimString theBandId;
int theBitsPerPixel;
......@@ -125,6 +152,19 @@ private:
std::vector<double> theAbsCalFactors;
ossimString theBandNameList;
ossimIpt theImageSize;
ossim_float64 thePNiirs;
ossim_float64 theCloudCoverage;
std::shared_ptr<ossimKeywordlist> m_imdKwl;
std::shared_ptr<ossimKeywordlist> m_attKwl;
std::shared_ptr<ossimKeywordlist> m_geoKwl;
std::shared_ptr<ossimKeywordlist> m_ephKwl;
std::shared_ptr<ossimKeywordlist> m_rpbKwl;
std::shared_ptr<ossimKeywordlist> m_steKwl;
std::shared_ptr<ossimKeywordlist> m_tilKwl;
bool parse(std::shared_ptr<ossimKeywordlist> &kwl,
const ossimFilename &file);
TYPE_DATA
};
......
......@@ -628,6 +628,9 @@ private:
bool hasOneBasedTiePoints(const std::vector<ossim_float64>& ties,
ossim_uint32 width,
ossim_uint32 height) const;
std::ostream& printDigitalGlobe(std::ostream& out,
const std::string& prefix)const;
std::string m_connectionString;
mutable std::shared_ptr<ossim::istream> m_inputStream;
......
......@@ -97,6 +97,20 @@ ossimString ossimString::downcase()const
return result;
}
bool ossimString::endsWith(const ossimString &pattern) const
{
ossimString endsPattern = pattern + "$";
ossimRegExp regex(endsPattern.c_str());
return regex.find(c_str());
}
bool ossimString::startsWith(const ossimString &pattern) const
{
ossimString startsPattern = "^"+pattern;
ossimRegExp regex(startsPattern.c_str());
return regex.find(c_str());
}
char* ossimString::stringDup()const
{
char *result = 0;
......
......@@ -17,8 +17,9 @@
#include <ossim/base/ossimKeywordlist.h>
#include <ossim/base/ossimNotifyContext.h>
#include <ossim/base/ossimTrace.h>
namespace {// Anonymous namespace
#include <memory>
namespace
{ // Anonymous namespace
// Constants
const char XPATH_DELIM('/');
ossimRefPtr<ossimXmlNode> const nullNode(0);
......@@ -33,8 +34,7 @@ static std::istream& xmlskipws(std::istream& in)
{
int c = in.peek();
while (!in.fail() &&
(( (c== ' ') || (c == '\t') || (c == '\n')|| (c == '\r') || (c<0x20) || (c>=0x7f) ))
)
(((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') || (c < 0x20) || (c >= 0x7f))))
{
in.ignore(1);
c = in.peek();
......@@ -44,8 +44,7 @@ static std::istream& xmlskipws(std::istream& in)
}
ossimXmlNode::ossimXmlNode(istream &xml_stream, ossimXmlNode *parent)
:
theParentNode (parent),
: theParentNode(parent),
theCDataFlag(false)
{
read(xml_stream);
......@@ -85,7 +84,6 @@ void ossimXmlNode::duplicateAttributes(ossimXmlNode::AttributeListType result)co
{
result.push_back((ossimXmlAttribute *)theAttributes[idx]->dup());
}
}
void ossimXmlNode::duplicateChildren(ossimXmlNode::ChildListType &result) const
......@@ -137,7 +135,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -150,7 +149,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -162,7 +162,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -179,7 +180,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return true;
}
......@@ -189,7 +191,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -212,7 +215,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return true;
}
......@@ -222,7 +226,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -236,7 +241,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -250,7 +256,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -263,7 +270,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -276,7 +284,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return true;
}
......@@ -286,7 +295,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -312,7 +322,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -325,7 +336,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -338,7 +350,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return true;
}
......@@ -348,7 +361,8 @@ bool ossimXmlNode::read(std::istream& in)
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
<< "ossimXmlNode::read: leaving ......\n"
<< __LINE__ << "\n";
}
return false;
}
......@@ -363,7 +377,6 @@ bool ossimXmlNode::read(std::istream& in)
return true;
}
void ossimXmlNode::findChildNodes(const ossimString &xpath,
ossimXmlNode::ChildListType &result) const
{
......@@ -404,7 +417,6 @@ void ossimXmlNode::findChildNodes(const ossimString& xpath,
ossimXmlNode::ChildListType::const_iterator child_iter = theChildNodes.begin();
ossimXmlNode::ChildListType::const_iterator child_end = theChildNodes.end();
// No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
if (delim_pos == std::string::npos || delim_pos == xpath.size() - 1)
{
......@@ -435,7 +447,8 @@ void ossimXmlNode::findChildNodes(const ossimString& xpath,
const ossimRefPtr<ossimXmlNode> &ossimXmlNode::findFirstNode(const ossimString &xpath) const
{
if(theChildNodes.size() < 1) return nullNode;
if (theChildNodes.size() < 1)
return nullNode;
if (xpath.empty())
return nullNode;
......@@ -502,7 +515,8 @@ const ossimRefPtr<ossimXmlNode>& ossimXmlNode::findFirstNode(const ossimString&
ossimRefPtr<ossimXmlNode> ossimXmlNode::findFirstNode(const ossimString &xpath)
{
if(theChildNodes.size() < 1) return 0;
if (theChildNodes.size() < 1)
return 0;
if (xpath.empty())
return 0;
......@@ -653,7 +667,6 @@ bool ossimXmlNode::getChildTextValue(ossimString& value,
return node.valid();
}
void ossimXmlNode::setText(const ossimString &text)
{
theText = text;
......@@ -693,7 +706,8 @@ ostream& operator << (ostream& os, const ossimXmlNode* xml_node)
//
// Dump the tag opening:
//
os << "\n" << indent << "<" << xml_node->theTag;
os << "\n"
<< indent << "<" << xml_node->theTag;
//
// Dump any attributes:
......@@ -740,7 +754,8 @@ ostream& operator << (ostream& os, const ossimXmlNode* xml_node)
os << (*nodes).get();
nodes++;
}
os << "\n" << indent;
os << "\n"
<< indent;
}
//
......@@ -956,23 +971,46 @@ void ossimXmlNode::clearAttributes()
}
void ossimXmlNode::toKwl(ossimKeywordlist &kwl,
const ossimString& prefix)const
{
const ossimString &prefix,
bool includeTag) const
{
class ChildNodeMapInfo
{
public:
ChildNodeMapInfo(ossim_int32 count = 1,
ossim_int32 idx = 0) :
m_count(count),
m_idx(idx) {}
ossim_int32 m_count;
ossim_int32 m_idx;
};
ossimString name = getTag();
ossimString value = getText();
ossimString copyPrefix = prefix;
if (name != "")
{
if (includeTag)
{
copyPrefix += (name + ".");
}
}
if (theChildNodes.size() < 1)
{
if (includeTag)
{
kwl.add(prefix + name,
value,
true);
}
else
{
kwl.add(prefix,
value,
true);
}
}
ossimString attributePrefix = copyPrefix + "@";
ossim_uint32 attributeIdx = 0;
......@@ -982,12 +1020,38 @@ void ossimXmlNode::toKwl(ossimKeywordlist& kwl,
theAttributes[attributeIdx]->getValue(),
true);
}
std::map<ossimString, std::shared_ptr<ChildNodeMapInfo> > mapInfo;
for (auto childNode : theChildNodes)
{
ossimString tagName = childNode->getTag();
if (mapInfo.find(childNode->getTag()) == mapInfo.end())
{
mapInfo[childNode->getTag()] = std::make_shared<ChildNodeMapInfo>();
}
else
{
mapInfo[childNode->getTag()]->m_count++;
}
}
ossim_uint32 idx = 0;
for (idx = 0; idx < theChildNodes.size(); ++idx)
{
ossimString tagName = theChildNodes[idx]->getTag();
std::shared_ptr<ChildNodeMapInfo> mapInfoChild = mapInfo[tagName];
if (mapInfoChild->m_count > 1)
{
ossimString newPrefix = (name + "." + tagName + ossimString::toString(mapInfoChild->m_idx));
mapInfoChild->m_idx++;
theChildNodes[idx]->toKwl(kwl,
copyPrefix);
newPrefix,
false);
}
else
{
theChildNodes[idx]->toKwl(kwl,
copyPrefix,
true);
}
}
}
......@@ -1378,7 +1442,8 @@ bool ossimXmlNode::readEndTag(std::istream& in,
{
in.ignore();
readTag(in, endTag);
if(in.fail()) return false;
if (in.fail())
return false;
xmlskipws(in);
c = in.peek();
result = true;
......@@ -1396,7 +1461,8 @@ bool ossimXmlNode::readEndTag(std::istream& in,
{
in.ignore(1);
}
if(in.fail()) result = false;
if (in.fail())
result = false;
return result;
}
......@@ -161,9 +161,6 @@ void ossimSICDToDetectedImage::allocate()
{
theTile = ossimImageDataFactory::instance()->create(this, this);
if(theTile.valid())
{
}
if(theTile.valid())
{
theTile->initialize();
}
......
......@@ -61,13 +61,11 @@ static ossimTrace traceDebug("ossimTiffTileSource:debug");
//---
#define OSSIM_BUFFER_SCAN_LINE_READS 1
//*******************************************************************
// Public Constructor:
//*******************************************************************
ossimTiffTileSource::ossimTiffTileSource()
:
ossimImageHandler(),
: ossimImageHandler(),
theTiffPtr(0),
theTile(0),
theBuffer(0),
......@@ -100,7 +98,8 @@ ossimTiffTileSource::ossimTiffTileSource()
theCurrentTiffRlevel(0),
theCompressionType(0),
theOutputBandList(0)
{}
{
}
ossimTiffTileSource::~ossimTiffTileSource()
{
......@@ -442,6 +441,7 @@ bool ossimTiffTileSource::open( std::shared_ptr<ossim::istream>& str,
{
state = std::make_shared<ossim::TiffHandlerState>();
setState(state);
state->loadDefaults(str, connectionString);
//state->loadDefaults(theTiffPtr);
state->setImageHandlerType(getClassName());
......@@ -493,7 +493,8 @@ bool ossimTiffTileSource::open( std::shared_ptr<ossim::istream>& str,
theBitsPerSample = state->getBitsPerSample(theCurrentDirectory);
theSamplesPerPixel = state->getSamplesPerPixel(theCurrentDirectory);
if (!theSamplesPerPixel) theSamplesPerPixel = 1;
if (!theSamplesPerPixel)
theSamplesPerPixel = 1;
theSampleFormatUnit = state->getSampleFormat();
if (theSampleFormatUnit == SAMPLEFORMAT_COMPLEXINT)
{
......@@ -616,7 +617,6 @@ bool ossimTiffTileSource::open( std::shared_ptr<ossim::istream>& str,
ossimNotify(ossimNotifyLevel_WARN)
<< "ossimTiffTileSource::getTiffTileWidth ERROR:"
<< "\nCannot determine tile width." << endl;
}
if (!theImageTileLength[dir])
{
......@@ -696,7 +696,6 @@ bool ossimTiffTileSource::open( std::shared_ptr<ossim::istream>& str,
#else
theScalarType = OSSIM_SINT16;
#endif
}
else if (theSampleFormatUnit == SAMPLEFORMAT_UINT)
{
......@@ -835,7 +834,6 @@ bool ossimTiffTileSource::open( std::shared_ptr<ossim::istream>& str,
// Finished...
return true;
}
bool ossimTiffTileSource::open()
......@@ -856,7 +854,6 @@ bool ossimTiffTileSource::open()
}
return result;
}
ossim_uint32 ossimTiffTileSource::getNumberOfLines(ossim_uint32 resLevel) const
......@@ -1024,8 +1021,7 @@ bool ossimTiffTileSource::loadFromScanLine(const ossimIrect& clip_rect,
{
#if OSSIM_BUFFER_SCAN_LINE_READS
ossimInterleaveType type =
(thePlanarConfig[theCurrentDirectory] == PLANARCONFIG_CONTIG) ?
OSSIM_BIP : OSSIM_BIL;
(thePlanarConfig[theCurrentDirectory] == PLANARCONFIG_CONTIG) ? OSSIM_BIP : OSSIM_BIL;
if (theBufferRLevel != getCurrentTiffRLevel() ||
!clip_rect.completely_within(theBufferRect))
......@@ -1137,10 +1133,11 @@ bool ossimTiffTileSource::loadFromTile(const ossimIrect& clip_rect,
theImageTileLength[theCurrentDirectory];
if ((clip_rect.lr().x - tileOrigin.x + 1) %
theImageTileWidth[theCurrentDirectory] ) ++tiles_in_v_dir;
theImageTileWidth[theCurrentDirectory])
++tiles_in_v_dir;
if ((clip_rect.lr().y - tileOrigin.y + 1) %
theImageTileLength[theCurrentDirectory] ) ++tiles_in_u_dir;
theImageTileLength[theCurrentDirectory])
++tiles_in_u_dir;
// Tile loop in line direction.
for (ossim_uint32 u = 0; u < tiles_in_u_dir; ++u)
......@@ -1159,8 +1156,7 @@ bool ossimTiffTileSource::loadFromTile(const ossimIrect& clip_rect,
if (tiff_tile_rect.intersects(clip_rect))
{
ossimIrect tiff_tile_clip_rect
= tiff_tile_rect.clipToRect(clip_rect);
ossimIrect tiff_tile_clip_rect = tiff_tile_rect.clipToRect(clip_rect);
//---
// Since theTile's internal rectangle is relative to any sub
......@@ -1283,9 +1279,11 @@ bool ossimTiffTileSource::loadFromRgbaU8Tile(const ossimIrect& tile_rect,
theImageTileLength[theCurrentDirectory];
if ((clip_rect.lr().x - tileOrigin.x + 1) %
theImageTileWidth[theCurrentDirectory] ) ++tiles_in_v_dir;
theImageTileWidth[theCurrentDirectory])
++tiles_in_v_dir;
if ((clip_rect.lr().y - tileOrigin.y + 1) %
theImageTileLength[theCurrentDirectory] ) ++tiles_in_u_dir;
theImageTileLength[theCurrentDirectory])
++tiles_in_u_dir;
ossimIpt ulTilePt = tileOrigin;
......@@ -1301,7 +1299,6 @@ bool ossimTiffTileSource::loadFromRgbaU8Tile(const ossimIrect& tile_rect,
}
#endif
// Tile loop in line direction.
for (ossim_uint32 u = 0; u < tiles_in_u_dir; u++)
{
......@@ -1310,8 +1307,7 @@ bool ossimTiffTileSource::loadFromRgbaU8Tile(const ossimIrect& tile_rect,
// Tile loop in sample direction.
for (ossim_uint32 v = 0; v < tiles_in_v_dir; v++)
{
ossimIrect tiff_tile_rect
= ossimIrect(ulTilePt.x,
ossimIrect tiff_tile_rect = ossimIrect(ulTilePt.x,
ulTilePt.y,
ulTilePt.x +
theImageTileWidth[theCurrentDirectory] - 1,
......@@ -1435,7 +1431,8 @@ bool ossimTiffTileSource::loadFromRgbaU8Strip(const ossimIrect& tile_rect,
theRowsPerStrip[theCurrentDirectory];
ossim_uint32 strip_width = theImageWidth[theCurrentDirectory] * 4;
ossim_uint32 output_tile_offset = (clip_rect.ul().y - tile_rect.ul().y) *
OUTPUT_TILE_WIDTH + clip_rect.ul().x -
OUTPUT_TILE_WIDTH +
clip_rect.ul().x -
tile_rect.ul().x;
#if 0 /* Please keep for debug: */
CLOG << "DEBUG:"
......@@ -1485,8 +1482,9 @@ bool ossimTiffTileSource::loadFromRgbaU8Strip(const ossimIrect& tile_rect,
starting_strip,
theImageWidth[theCurrentDirectory] - 1,
(ending_strip - starting_strip) ? (ending_strip - starting_strip) *
theRowsPerStrip[theCurrentDirectory] - 1 :
theRowsPerStrip[theCurrentDirectory] - 1 );
theRowsPerStrip[theCurrentDirectory] -
1
: theRowsPerStrip[theCurrentDirectory] - 1);
}
//***
......@@ -1495,12 +1493,13 @@ bool ossimTiffTileSource::loadFromRgbaU8Strip(const ossimIrect& tile_rect,
//***
ossim_uint32 last_line = theImageLength[theCurrentDirectory] - 1;
ossim_uint32 strip_offset
= ((strip * theRowsPerStrip[theCurrentDirectory]) +
ossim_uint32 strip_offset = ((strip * theRowsPerStrip[theCurrentDirectory]) +
theRowsPerStrip[theCurrentDirectory] - 1) <
last_line ? 0 :
((strip * theRowsPerStrip[theCurrentDirectory]) +
theRowsPerStrip[theCurrentDirectory] - 1) - last_line;
last_line
? 0
: ((strip * theRowsPerStrip[theCurrentDirectory]) +
theRowsPerStrip[theCurrentDirectory] - 1) -
last_line;
ossim_uint32 total_rows = theRowsPerStrip[theCurrentDirectory] -
strip_offset;
......@@ -1508,8 +1507,7 @@ bool ossimTiffTileSource::loadFromRgbaU8Strip(const ossimIrect& tile_rect,
for (ossim_uint32 row = 0; row < total_rows; row++)
{
// Write the line if it's in the clip rectangle.
ossim_int32 current_line = strip * theRowsPerStrip[theCurrentDirectory]
+ row;
ossim_int32 current_line = strip * theRowsPerStrip[theCurrentDirectory] + row;
if (current_line >= clip_rect.ul().y &&
current_line <= clip_rect.lr().y)
{
......@@ -1522,7 +1520,9 @@ bool ossimTiffTileSource::loadFromRgbaU8Strip(const ossimIrect& tile_rect,
// accordingly.
//
ossim_uint32 *s = (ossim_uint32 *)(theBuffer + ((theRowsPerStrip[theCurrentDirectory] - row -
strip_offset - 1) * strip_width + clip_rect.ul().x * 4));
strip_offset - 1) *
strip_width +
clip_rect.ul().x * 4));
// Copy the data to the output buffer.
ossim_uint32 i = 0;
......@@ -1595,7 +1595,8 @@ bool ossimTiffTileSource::loadFromRgbaU8aStrip(const ossimIrect& tile_rect,
ossim_uint32 ending_strip = clip_rect.lr().y /
theRowsPerStrip[theCurrentDirectory];
ossim_uint32 output_tile_offset = (clip_rect.ul().y - tile_rect.ul().y) *
OUTPUT_TILE_WIDTH + clip_rect.ul().x -
OUTPUT_TILE_WIDTH +
clip_rect.ul().x -
tile_rect.ul().x;
#if 0
......@@ -1645,11 +1646,12 @@ bool ossimTiffTileSource::loadFromRgbaU8aStrip(const ossimIrect& tile_rect,
//***
ossim_uint32 last_line = theImageLength[theCurrentDirectory] - 1;
ossim_uint32 strip_offset
= ((strip * theRowsPerStrip[theCurrentDirectory]) +
theRowsPerStrip[theCurrentDirectory] - 1) < last_line ? 0 :
((strip * theRowsPerStrip[theCurrentDirectory]) +
theRowsPerStrip[theCurrentDirectory] - 1) - last_line;
ossim_uint32 strip_offset = ((strip * theRowsPerStrip[theCurrentDirectory]) +
theRowsPerStrip[theCurrentDirectory] - 1) < last_line
? 0
: ((strip * theRowsPerStrip[theCurrentDirectory]) +
theRowsPerStrip[theCurrentDirectory] - 1) -
last_line;
ossim_uint32 total_rows = theRowsPerStrip[theCurrentDirectory] -
strip_offset;
......@@ -1657,8 +1659,7 @@ bool ossimTiffTileSource::loadFromRgbaU8aStrip(const ossimIrect& tile_rect,
for (ossim_uint32 row = 0; row < total_rows; row++)
{
// Write the line if it's in the clip rectangle.
ossim_int32 current_line = strip * theRowsPerStrip[theCurrentDirectory]
+ row;
ossim_int32 current_line = strip * theRowsPerStrip[theCurrentDirectory] + row;
if (current_line >= clip_rect.ul().y &&
current_line <= clip_rect.lr().y)
{
......@@ -1861,6 +1862,62 @@ ossim_uint32 ossimTiffTileSource::getCurrentTiffRLevel() const
// return theCurrentDirectory;
}
bool ossimTiffTileSource::getRgbBandList(std::vector<ossim_uint32> &bandList) const
{
bool result = false;
ossimString copyright;
std::shared_ptr<const ossim::TiffHandlerState> state = getStateAs<ossim::TiffHandlerState>();
if (state)
{
ossimString value;
if (state->getValue(value, "tiff.imd.band_name_list"))
{
std::vector<ossimString> splitArray;
value.split(splitArray, " ");
ossim_uint32 nInputBands = getNumberOfInputBands();
if ((splitArray.size() <= nInputBands) &&
(nInputBands > 2))
{
ossim_uint32 idx = 0;
bandList.resize(3);
bandList[0] = 0;
bandList[1] = 1;
bandList[2] = 2;
result = true;
for (idx = 0; idx < splitArray.size(); ++idx)
{
ossimString tempDowncase = splitArray[idx].trim().downcase();
switch (*tempDowncase.begin())
{
case 'r':
{
bandList[0] = idx;
break;
}
case 'g':
{
bandList[1] = idx;
break;
}
case 'b':
{
bandList[2] = idx;
break;
}
default:
{
break;
}
}
}
}
}
}
return result;
}
ossimString ossimTiffTileSource::getReadMethod(ossim_uint32 directory) const
{
ossimString result = "UNKNOWN";
......@@ -2004,7 +2061,6 @@ std::ostream& ossimTiffTileSource::print(std::ostream& os) const
<< "\ntheNumberOfDirectories: " << theNumberOfDirectories
<< "\nr0_is_full_res: " << theR0isFullRes;
for (ossim_uint32 i = 0; i < theNumberOfDirectories; ++i)
{
os << "\ndirectory[" << i << "]"
......@@ -2030,7 +2086,8 @@ std::ostream& ossimTiffTileSource::print(std::ostream& os) const
if (theTile.valid())
{
os << "\nOutput tile dump:\n" << *theTile << endl;
os << "\nOutput tile dump:\n"
<< *theTile << endl;
}
if (theOverview.valid())
......
......@@ -162,12 +162,12 @@ void ossim::TiffHandlerState::loadDefaults(TIFF* tiffPtr)
}
}
TIFFSetDirectory(tiffPtr, currentDirectory);
}
void ossim::TiffHandlerState::loadDefaults(std::shared_ptr<ossim::istream> &str,
const std::string &connectionString)
{
setConnectionString(connectionString);
ossim_int64 offset = str->tellg();
ossimTiffInfo info;
std::ostringstream out;
......@@ -675,6 +675,19 @@ void ossim::TiffHandlerState::loadGeotiffTags(TIFF* tiffPtr,
GTIFFree(gtif);
}
bool ossim::TiffHandlerState::isDigitalGlobe() const
{
ossimString value;
bool result = false;
if(getValue(value, "tiff.is_digital_globe"))
{
result = value.toBool();
}
return result;
}
bool ossim::TiffHandlerState::isReduced(ossim_uint32 directory)const
{
return getSubFileType(directory)&FILETYPE_REDUCEDIMAGE;
......@@ -749,11 +762,6 @@ ossim_int32 ossim::TiffHandlerState::getLinearUnits(ossim_int32 directory)const
return getInt32Value("linear_units", directory);
}
ossim_int32 ossim::TiffHandlerState::getRasterType(ossim_int32 directory)const
{
return getInt32Value("raster_type", directory);
}
ossim_int32 ossim::TiffHandlerState::getDatumCode(ossim_int32 directory)const
{
return getInt32Value("datum_code", directory);
......@@ -1035,6 +1043,20 @@ ossim_int32 ossim::TiffHandlerState::getPlanarConfig(ossim_int32 directory) cons
return result;
}
ossim_int32 ossim::TiffHandlerState::getRasterType(ossim_int32 directory) const
{
ossimString tempStr;
ossimPixelType result = OSSIM_PIXEL_IS_POINT;
if (getValue(tempStr, directory, "raster_type"))
{
if (tempStr.contains("area"))
{
result = OSSIM_PIXEL_IS_AREA;
}
}
return result;
}
ossim_int32 ossim::TiffHandlerState::getPhotoInterpretation(ossim_int32 directory) const {
ossimString tempStr;
......@@ -1203,6 +1225,18 @@ bool ossim::TiffHandlerState::getCitation(ossimString &citation, ossim_int32 dir
return result;
}
bool ossim::TiffHandlerState::getCopyright(ossimString &copyright, ossim_int32 directory) const
{
bool result = true;
if (!getValue(copyright, directory, "copyright"))
{
result = false;
}
return result;
}
bool ossim::TiffHandlerState::load(const ossimKeywordlist& kwl,
const ossimString& prefix)
{
......
......@@ -1000,6 +1000,7 @@ bool ossimGeoTiff::readTags(std::shared_ptr<ossim::TiffHandlerState> state, ossi
theDatumCode = state->getDatumCode(entryIdx);
theAngularUnits = state->getAngularUnits(entryIdx);
theLinearUnitsCode = state->getLinearUnits(entryIdx);
theRasterType = state->getRasterType(entryIdx);
theGeoKeysPresentFlag = true;
if (theAngularUnits == ANGULAR_DMS_HEMISPHERE || theAngularUnits == 9122)
{
......@@ -1134,6 +1135,14 @@ bool ossimGeoTiff::readTags(std::shared_ptr<ossim::TiffHandlerState> state, ossi
setOssimProjectionName(state, entryIdx);
setOssimDatumName(state, entryIdx);
if(theModelType == MODEL_TYPE_GEOGRAPHIC)
{
if (theAngularUnits == 0)
{
theAngularUnits = ANGULAR_DEGREE;
}
}
return true;
}
......@@ -1709,7 +1718,7 @@ bool ossimGeoTiff::addImageGeometry(ossimKeywordlist &kwl, const char *prefix) c
{
ossimNotify(ossimNotifyLevel_WARN)
<< "WARNING ossimGeoTiff::addImageGeometry:"
<< "\nNot coded yet for unit type: "
<< "\nNot coded yet for angular unit type: "
<< theAngularUnits << endl;
return false;
}
......
......@@ -14,10 +14,12 @@
#include <ossim/support_data/ossimNitfRegisteredDesFactory.h>
#include <ossim/support_data/ossimNitfXmlDataContentDes.h>
#include <ossim/support_data/ossimNitfSicdXmlDes.h>
RTTI_DEF1(ossimNitfRegisteredDesFactory, "ossimNitfRegisteredDesFactory", ossimNitfDesFactory);
static const char XML_DATA_CONTENT_DES[] = "XML_DATA_CONTENT";
static const char SICD_XML[] = "SICD_XML";
ossimNitfRegisteredDesFactory::ossimNitfRegisteredDesFactory()
{
......@@ -42,5 +44,9 @@ ossimRefPtr<ossimNitfRegisteredDes> ossimNitfRegisteredDesFactory::create(
{
return new ossimNitfXmlDataContentDes;
}
else if(desName == SICD_XML)
{
return new ossimNitfSicdXmlDes;
}
return NULL;
}
#include <ossim/support_data/ossimNitfSicdXmlDes.h>
#include <ossim/base/ossimPreferences.h>
#include <iomanip>
#include <iostream>
#include <sstream>
ossimNitfSicdXmlDes::ossimNitfSicdXmlDes()
: ossimNitfRegisteredDes(std::string("SICD_XML"), 0),
m_xmlString()
{
clearFields();
}
void ossimNitfSicdXmlDes::parseStream(std::istream& in)
{
clearFields();
if(getSizeInBytes())
{
char* c = new char[getSizeInBytes()+1];
in.read(c, getSizeInBytes());
c[getSizeInBytes()] = '\0';
m_xmlString.string().resize(getSizeInBytes());
m_xmlString = c;
m_xmlDocument = new ossimXmlDocument;;
std::istringstream xmlStringStream(m_xmlString.string());
m_xmlDocument->read(xmlStringStream);
delete [] c;
c = 0;
}
}
void ossimNitfSicdXmlDes::writeStream(std::ostream& out)
{
}
std::ostream& ossimNitfSicdXmlDes::print(std::ostream& out,
const std::string& prefix) const
{
bool typeinfo = ossimString(ossimPreferences::instance()->findPreference("kwl_type_info")).toBool();
std::string pfx = prefix;
pfx += getDesName() + ".";
out << setiosflags(ios::left)
// Quick hack to print on one line, this will leave extra spaces in CDATA sections
<< pfx << std::setw(24) << "XML: \"\"\"" << m_xmlString << "\"\"\"\n";
return out;
}
void ossimNitfSicdXmlDes::clearFields()
{
}
bool ossimNitfSicdXmlDes::loadState(const ossimKeywordlist& kwl, const char* prefix)
{
return true;
}
bool ossimNitfSicdXmlDes::loadValueFromXml(const ossimRefPtr<ossimXmlDocument> xml, const ossimString& xpath, ossimString& target) const
{
bool result = false;
if (xml->getErrorStatus()) return result;
std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes;
xml->findNodes(xpath, xml_nodes);
if (xml_nodes.size())
{
target = xml_nodes[0]->getText();
result = true;
}
return result;
}
......@@ -86,8 +86,7 @@ std::ostream& ossimNitfXmlDataContentDes::print(std::ostream& out,
<< pfx << std::setw(24) << "DESSHLI:" << ((typeinfo) ? "(string)" : "") << m_desshli << "\n"
<< pfx << std::setw(24) << "DESSHABS:" << ((typeinfo) ? "(string)" : "") << m_desshabs << "\n"
// Quick hack to print on one line, this will leave extra spaces in CDATA sections
<< pfx << std::setw(24) << "XML:" << m_xmlString.substitute(ossimString("\n"), " ", true) << "\n"
;
<< pfx << std::setw(24) << "XML: \"\"\"" << m_xmlString << "\"\"\"\n";
return out;
}
......