32 static std::mutex timeMutex;
33 static ossimTrace traceDebug(
"ossimCommon:debug");
51 return ( (c ==
' ') || (c ==
'\t') || (c ==
'\n')|| (c ==
'\r') ) ;
59 char c[
sizeof(short)];
63 if (un.c[0] == 2 && un.c[1] == 1)
143 << __FILE__ <<
":" << __LINE__
144 <<
"\nUnhandled scalar type: " << scalarType << std::endl;
222 << __FILE__ <<
":" << __LINE__
223 <<
"\nUnhandled scalar type: " << scalarType << std::endl;
301 << __FILE__ <<
":" << __LINE__
302 <<
"\nUnhandled scalar type: " << scalarType << std::endl;
360 << __FILE__ <<
":" << __LINE__
361 <<
"\nUnhandled scalar type: " << scalarType << std::endl;
400 actualBitsPerPixel = 8;
405 actualBitsPerPixel = 11;
410 actualBitsPerPixel = 12;
415 actualBitsPerPixel = 13;
420 actualBitsPerPixel = 14;
425 actualBitsPerPixel = 15;
431 actualBitsPerPixel = 16;
440 actualBitsPerPixel = 32;
448 actualBitsPerPixel = 64;
453 actualBitsPerPixel = 128;
462 << __FILE__ <<
":" << __LINE__
463 <<
"\nUnhandled scalar type: " << scalarType << std::endl;
468 return actualBitsPerPixel;
516 << __FILE__ <<
":" << __LINE__
517 <<
"\nUnhandled scalar type: " << scalarType << std::endl;
528 findPreference(
"tile_size");
532 std::vector<ossimString> splitArray;
534 tempString.
split(splitArray,
" ");
536 if(splitArray.size() == 2)
538 tileSize.
x = splitArray[0].toInt32();
539 tileSize.
y = splitArray[1].toInt32();
541 else if(splitArray.size() == 1)
543 tileSize.
x = splitArray[0].toInt32();
544 tileSize.
y = splitArray[0].toInt32();
563 tileSize.
y = tileSize.
x;
577 std::string::size_type pos = 0;
578 pos = result.
find(
"&");
580 while(pos != std::string::npos)
582 std::string::size_type
size = result.
size();
587 if(test1 ==
"'")
591 else if(test1 ==
""")
595 else if(test2 ==
"&")
599 else if(test3 ==
">")
603 else if(test3 ==
"<")
607 pos = result.
find(
"&", pos+1);
620 NEWMAT::Matrix mat(rotation);
622 ossimDpt3d col1(rotation[0][0], rotation[1][0], rotation[2][0]);
635 double oneOverS = 1.0f / s;
636 for(
int i = 0; i < 3; i++ )
637 for(
int j = 0; j < 3; j++ )
638 mat[i][j] = rotation[j][i] * oneOverS;
645 if ( cp > -0.00001 && cp < 0.00001 )
661 if ( (sh == 0.0f && ch == 0.0f) || (sr == 0.0f && cr == 0.0f) )
681 const NEWMAT::Matrix& lsrMatrix,
682 const NEWMAT::Matrix& rotationalMatrix)
685 NEWMAT::Matrix invertLsr(lsrMatrix.i());
690 result =
matrixToHpr(hpr, invertLsr*rotationalMatrix);
710 const char* whitespace,
712 std::vector<std::string>& tokens,
713 bool& unbalancedQuotes)
719 const char openQuote(quotes[0]), closeQuote(quotes[1]);
722 unbalancedQuotes =
false;
725 while (start < str.length())
727 if (str[start] == openQuote)
729 int openBraceCount = 1;
731 if (start+1 < str.length())
734 if (str[start] != closeQuote)
738 while (static_cast<ossim_uint32>(end) < str.length() &&
741 if (str[end] == openQuote)
743 else if (str[end] == closeQuote)
755 if (openBraceCount == 0)
757 tokens.push_back(str.substr(start, end-1-start));
761 unbalancedQuotes =
true;
762 end = (int)str.length();
765 else if (str[start] == closeQuote)
767 unbalancedQuotes =
true;
768 end = (int)str.length();
773 end = (int)str.find_first_of(whitespace, start);
774 tokens.push_back(str.substr(start, end-start));
777 start = (
ossim_uint32)str.find_first_not_of(whitespace, end);
782 const std::vector<ossimDpt>& pointList,
786 for(;idx < pointList.size();++idx)
789 if(resultStringOfPoints.
empty())
791 resultStringOfPoints = pt;
795 resultStringOfPoints += (separator + pt);
801 const std::vector<ossimIpt>& pointList,
805 for(;idx < pointList.size();++idx)
808 if(resultStringOfPoints.
empty())
810 resultStringOfPoints = pt;
814 resultStringOfPoints += (separator + pt);
820 const std::vector<ossimGpt>& pointList,
824 for(;idx < pointList.size();++idx)
827 if(resultStringOfPoints.
empty())
829 resultStringOfPoints = pt;
833 resultStringOfPoints += (separator + pt);
841 std::vector<ossimString> splitResult;
847 while(!in.bad()&&!in.eof())
852 currentPoint += (char)in.get();
854 if(in.peek() ==
'(') in.ignore();
856 while(!in.bad()&&!in.eof()&&(in.peek() !=
')'))
858 currentPoint += (char)in.get();
862 currentPoint += (char)in.get();
863 tempPoint.
toPoint(currentPoint);
864 result.push_back(tempPoint);
878 std::vector<ossimString> splitResult;
884 while(!in.bad()&&!in.eof())
889 currentPoint += (char)in.get();
891 if(in.peek() ==
'(') in.ignore();
893 while(!in.bad()&&!in.eof()&&(in.peek() !=
')'))
895 currentPoint += (char)in.get();
899 currentPoint += (char)in.get();
900 tempPoint.
toPoint(currentPoint);
901 result.push_back(tempPoint);
914 std::vector<ossimString> splitResult;
920 while(!in.bad()&&!in.eof())
925 currentPoint += (char)in.get();
927 if(in.peek() ==
'(') in.ignore();
929 while(!in.bad()&&!in.eof()&&(in.peek() !=
')'))
931 currentPoint += (char)in.get();
935 currentPoint += (char)in.get();
936 tempPoint.
toPoint(currentPoint);
937 result.push_back(tempPoint);
954 if(stringOfPoints.
empty())
return result;
969 values.push_back(value);
984 values.push_back(value);
994 std::vector<ossimString> extractedValues;
1000 for(idx = 0; idx <
size; ++idx)
1002 result.push_back(extractedValues[idx].toUInt32());
1010 const std::vector<ossim_uint8>& valuesList)
1015 if(!valuesList.empty())
1019 for(idx = 0; idx <
size; ++idx)
1023 out << static_cast<ossim_uint32>(valuesList[
size]);
1026 result =
"("+out.str()+
")";
1031 const std::vector<ossim_float64>& valuesList)
1035 out << std::setiosflags(std::ios::fixed) << std::setprecision(20);
1036 if(!valuesList.empty())
1040 for(idx = 0; idx <
size; ++idx)
1042 out << valuesList[idx] <<
",";
1044 out << valuesList[
size];
1047 result =
"("+out.str()+
")";
1052 const std::vector<ossim_float32>& valuesList)
1056 out << std::setiosflags(std::ios::fixed) << std::setprecision(20);
1057 if(!valuesList.empty())
1061 for(idx = 0; idx <
size; ++idx)
1063 out << valuesList[idx] <<
",";
1065 out << valuesList[
size];
1068 result =
"("+out.str()+
")";
1073 const std::vector<ossimString>& valuesList)
1077 if(!valuesList.empty())
1081 for(idx = 0; idx <
size; ++idx)
1083 out << valuesList[idx] <<
",";
1085 out << valuesList[
size];
1088 result =
"("+out.str()+
")";
1094 std::vector<ossimString> extractedValues;
1100 for(idx = 0; idx <
size; ++idx)
1102 result.push_back(extractedValues[idx].toInt32());
1111 std::vector<ossimString> extractedValues;
1117 for(idx = 0; idx <
size; ++idx)
1119 result.push_back(extractedValues[idx].toUInt32());
1128 std::vector<ossimString> extractedValues;
1134 for(idx = 0; idx <
size; ++idx)
1136 result.push_back(extractedValues[idx].toInt32());
1145 std::vector<ossimString> extractedValues;
1151 for(idx = 0; idx <
size; ++idx)
1153 result.push_back(extractedValues[idx].toUInt8());
1162 std::vector<ossimString> extractedValues;
1168 for(idx = 0; idx <
size; ++idx)
1170 result.push_back(extractedValues[idx].toUInt8());
1179 std::vector<ossimString> extractedValues;
1205 const std::string& format,
bool gmtFlag, std::string& result )
1207 std::lock_guard<std::mutex> lock(timeMutex);
1211 struct tm* timeInfo;
1214 timeInfo = gmtime(&rawTime);
1218 timeInfo = localtime(&rawTime);
1224 const size_t STRING_SIZE = 196;
1225 char outStr[STRING_SIZE];
1227 size = strftime(outStr, STRING_SIZE, format.c_str(), timeInfo );
1232 outStr[STRING_SIZE-1] =
'\0';
1245 std::lock_guard<std::mutex> lock(timeMutex);
1266 if (stopDimension == 0)
1271 stopDimension = tileSize.
x < tileSize.
y ? tileSize.
x : tileSize.
y;
1277 while(largestImageDimension > stopDimension)
1279 largestImageDimension /= 2;
16 bit unsigned integer (15 bits used)
#define OSSIM_DEFAULT_MAX_PIX_UINT16
#define OSSIM_DEFAULT_NULL_PIX_UINT14
#define OSSIM_DEFAULT_MIN_PIX_UINT13
ossimString substitute(const ossimString &searchKey, const ossimString &replacementValue, bool replaceAll=false) const
Substitutes searchKey string with replacementValue and returns a string.
OSSIM_DLL ossim_uint32 computeLevels(const ossimIrect &rect)
Computes the number of decimation levels to get to the overview stop dimension.
OSSIM_DLL ossim_int64 getTime()
Gets the current time.
16 bit unsigned integer (12 bits used)
#define OSSIM_DEFAULT_NULL_PIX_UINT16
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
32 bit complex floating point
#define OSSIM_DEFAULT_MIN_PIX_UINT32
#define OSSIM_DEFAULT_MAX_PIX_DOUBLE
OSSIM_DLL void toStringList(ossimString &resultStringOfPoints, const std::vector< ossimDpt > &pointList, char separator=' ')
Will take a vector of ossimDpt and convert to a string list separated by spaces For example: (45...
#define OSSIM_DEFAULT_NULL_PIX_UINT13
16 bit unsigned integer (14 bits used)
#define OSSIM_DEFAULT_NULL_PIX_SINT16
#define OSSIM_DEFAULT_MIN_PIX_UINT11
ossim_uint32 height() const
#define OSSIM_DEFAULT_MIN_PIX_UINT15
static ossimString toString(bool aValue)
Numeric to string methods.
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
void toSimpleStringList(ossimString &result, const std::vector< T > &valuesList)
This will output a vector of values inst a string.
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
OSSIM_DLL ossimByteOrder byteOrder()
16 bit unsigned integer (14 bits used)
OSSIM_DLL ossim_uint32 getActualBitsPerPixel(ossimScalarType scalarType)
Get actual bits per pixel for a given scalar type.
ossim_uint32 toUInt32() const
16 bit unsigned integer (13 bits used)
16 bit unsigned integer (13 bits used)
#define OSSIM_DEFAULT_MIN_PIX_UINT16
unsigned short ossim_uint16
OSSIM_DLL bool extractSimpleValues(std::vector< ossimString > &values, const ossimString &stringOfPoints)
Generic function to extract a list of values into a vector of string where the string of points is of...
#define OSSIM_DEFAULT_NULL_PIX_SINT8
OSSIM_DLL ossim_uint32 getNumberOfThreads()
Get the number threads to use from ossimPreferences or ossim::Thread.
#define OSSIM_DEFAULT_TILE_WIDTH
OSSIM_DLL std::string convertHtmlSpecialCharactersToNormalCharacter(const std::string &src)
bool toSimpleVector(std::vector< T > &result, const ossimString &stringOfPoints)
#define OSSIM_DEFAULT_MAX_PIX_UINT32
#define OSSIM_DEFAULT_MAX_PIX_SINT8
#define OSSIM_DEFAULT_MIN_PIX_SINT32
#define OSSIM_DEFAULT_NULL_PIX_UINT32
OSSIM_DLL double defaultMin(ossimScalarType scalarType)
OSSIM_DLL bool isSigned(ossimScalarType scalarType)
#define OSSIM_DEFAULT_NULL_PIX_DOUBLE
#define OSSIM_DEFAULT_MAX_PIX_UINT12
#define OSSIM_DEFAULT_MIN_PIX_SINT16
#define OSSIM_DEFAULT_MIN_PIX_DOUBLE
OSSIM_DLL std::istream & skipws(std::istream &in)
const char * findPreference(const char *key) const
OSSIM_DLL void toVector(std::vector< ossimDpt > &result, const ossimString &stringOfPoints)
Will take a string list separated by spaces and convert to a vector of ossimDpts. ...
void toPoint(const std::string &s)
Initializes this point from string.
signed short ossim_sint16
OSSIM_DLL void getFormattedTime(const std::string &format, bool gmtFlag, std::string &result)
Gets the current time.
std::string::size_type size() const
#define OSSIM_DEFAULT_NULL_PIX_UINT15
OSSIM_DLL double defaultNull(ossimScalarType scalarType)
#define OSSIM_DEFAULT_MAX_PIX_UINT15
unsigned int ossim_uint32
32 bit normalized floating point
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
void toPoint(const std::string &s)
Initializes this point from string.
static ossim_uint64 getNumberOfProcessors()
Utility to return the number of processors (concurrent threads)
#define OSSIM_DEFAULT_MAX_PIX_UINT13
#define OSSIM_DEFAULT_NULL_PIX_UINT11
double atan2d(double y, double x)
#define OSSIM_DEFAULT_MIN_PIX_UINT14
OSSIM_DLL bool matrixToHpr(ossim_float64 hpr[3], const NEWMAT::Matrix &rotation)
Heading pitch roll extraction from a matrix.
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
Class lets us see bit patterns of floats.
ossim_uint32 width() const
OSSIM_DLL void lexQuotedTokens(const std::string &str, ossim_uint32 start, const char *whitespace, const char *quotes, std::vector< std::string > &tokens, bool &unbalancedQuotes)
#define OSSIM_DEFAULT_MAX_PIX_SINT16
void toPoint(const std::string &s)
Initializes this point from string.
static ossimPreferences * instance()
#define OSSIM_DEFAULT_NULL_PIX_NORM_FLOAT
OSSIM_DLL ossim_uint32 getBitsPerPixel(ossimScalarType scalarType)
Get bits per pixel for a given scalar type.
#define OSSIM_DEFAULT_MAX_PIX_FLOAT
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
16 bit unsigned integer (15 bits used)
#define OSSIM_DEFAULT_MIN_PIX_FLOAT
std::basic_istream< char > istream
Base class for char input streams.
#define OSSIM_DEFAULT_MIN_PIX_NORM_DOUBLE
OSSIM_DLL double defaultMax(ossimScalarType scalarType)
#define OSSIM_DEFAULT_MAX_PIX_UINT14
#define OSSIM_DEFAULT_MIN_PIX_UINT12
#define OSSIM_DEFAULT_MIN_PIX_UINT8
#define OSSIM_DEFAULT_MAX_PIX_UINT11
#define OSSIM_DEFAULT_MIN_PIX_NORM_FLOAT
#define OSSIM_DEFAULT_TILE_HEIGHT
#define OSSIM_DEFAULT_MAX_PIX_SINT32
#define OSSIM_DEFAULT_NULL_PIX_FLOAT
#define OSSIM_DEFAULT_MIN_PIX_SINT8
#define ossimREQUIRE(expr)
64 bit complex floating point
#define OSSIM_DEFAULT_MAX_PIX_UINT8
std::basic_istringstream< char > istringstream
Class for char input memory streams.
#define OSSIM_DEFAULT_NULL_PIX_UINT12
OSSIM_DLL bool isWhiteSpace(int c)
#define OSSIM_DEFAULT_MAX_PIX_NORM_FLOAT
static const char * OVERVIEW_STOP_DIMENSION_KW
#define OSSIM_DEFAULT_NULL_PIX_NORM_DOUBLE
16 bit unsigned integer (11 bits used)
#define OSSIM_DEFAULT_NULL_PIX_SINT32
unsigned char ossim_uint8
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
#define OSSIM_DEFAULT_MAX_PIX_NORM_DOUBLE
#define OSSIM_DEFAULT_NULL_PIX_UINT8
16 bit unsigned integer (12 bits used)