81 theInitializedFlag(false),
84 theElevEnabledFlag(
true),
85 thePluginLoaderEnabledFlag(
true)
92 std::lock_guard<std::mutex> lock(m);
109 parser.
getApplicationUsage()->
addCommandLineOption(
"--ossim-logfile",
"takes a logfile as an argument. All output messages are redirected to the specified log file. By default there is no log file and all messages are enabled.");
110 parser.
getApplicationUsage()->
addCommandLineOption(
"--disable-notify",
"Takes an argument. Arguments are ALL, WARN, NOTICE, INFO, FATAL, DEBUG. If you want multiple disables then just do multiple --disable-notify on the command line. All argument are case insensitive. Default is all are enabled.");
122 std::lock_guard<std::mutex> lock(m);
133 std::lock_guard<std::mutex> lock(m);
139 <<
"DEBUG ossimInit::initialize(parser):" 140 <<
" Already initialized, returning......" 159 if(!traceVariable.
empty())
181 <<
"ossim preferences file: " 184 <<
"\nossimInit::initialize(parser): leaving..." << std::endl;
197 <<
"DEBUG ossimInit::initialize(parser):" 198 <<
" Already initialized, returning......" 207 argv[0] =
new char[1];
214 std::lock_guard<std::mutex> lock(m);
220 <<
"DEBUG ossimInit::initialize(): Already initialized, returning......" << std::endl;
250 <<
"ossim preferences file: " 253 <<
"\nossimInit::initialize() leaving..." 271 <<
"INFORMATION ossimInit::usage():\n" 272 <<
"Additional command-line options available are as follows: " 274 <<
"\n -P<pref_filename> -- Allows the user to override the loading " 275 <<
"\n of the default preferences with their own pref file." 277 <<
"\n -K<keyword>[=<value>] -- Allows the user to specify additional" 278 <<
"\n keyword/value pairs that are added onto the preferences " 279 <<
"\n previously loaded. Keywords specified here override those in" 280 <<
"\n the preferences file." 282 <<
"\n -T<trace_tag> -- Lets user turn on specific trace flags." 284 <<
"\n -S<session_filename> -- Allows user to specify a session file" 338 <<
"DEBUG ossimInit::parseOptions: entering..." << std::endl;
341 std::string tempString;
347 if(!prefsFile.
empty())
353 while(parser.
read(
"-P", stringParameter));
360 while(parser.
read(
"-K", stringParameter))
382 <<
"DEBUG ossimInit::parseOptions: entering..." << std::endl;
384 std::string tempString;
389 while(parser.
read(
"-T", stringParameter))
394 while(parser.
read(
"--ossim-logfile", stringParameter))
398 while(parser.
read(
"--disable-notify", stringParameter))
401 tempDownCase = tempDownCase.
downcase();
403 if(tempDownCase ==
"warn")
407 else if(tempDownCase ==
"fatal")
411 else if(tempDownCase ==
"debug")
415 else if(tempDownCase ==
"info")
419 else if(tempDownCase ==
"notice")
423 else if(tempDownCase ==
"all")
428 if(parser.
read(
"--disable-elev"))
432 if(parser.
read(
"--disable-plugin"))
440 std::string tempString;
442 while(parser.
read(
"--disable-notify", stringParameter))
445 tempDownCase = tempDownCase.
downcase();
447 if(tempDownCase ==
"warn")
451 else if(tempDownCase ==
"fatal")
455 else if(tempDownCase ==
"debug")
459 else if(tempDownCase ==
"info")
463 else if(tempDownCase ==
"notice")
467 else if(tempDownCase ==
"all")
476 std::string tempString;
478 while(parser.
read(
"--env", stringParameter))
508 <<
"DEBUG ossimInit::removeOption(argc, argv, argToRemove): entering..." 512 for (
int i=argToRemove+1; i<argc; i++)
514 argv[i - 1] = argv[i];
521 <<
"DEBUG ossimInit::removeOption(argc, argv, argToRemove): leaving..." 576 if ( numberOfPlugins )
581 const std::string PREFIX_BASE =
"plugin";
582 const std::string DOT =
".";
583 const std::string FILE_KEY =
"file";
584 const std::string OPTIONS_KEY =
"options";
591 while ( processedIndexes < MAX_INDEX )
594 pluginFile = KWL.
findKey( prefix, FILE_KEY );
595 if ( pluginFile.
size() )
597 if ( pluginFile.
exists() )
600 pluginOptions = KWL.
findKey( prefix, OPTIONS_KEY );
606 if ( processedIndexes == numberOfPlugins )
620 if ( numberOfPlugins )
625 const std::string PREFIX_BASE =
"plugin.file";
633 while ( processedIndexes < MAX_INDEX )
636 pluginFile = KWL.
findKey( fileKey );
637 if ( pluginFile.
size() )
639 if ( pluginFile.
exists() )
646 if ( processedIndexes == numberOfPlugins )
667 std::vector<int> numberList(numberOfDirs);
673 if(numberList.size()>0)
675 for(idx = 0; idx < (int)numberList.size();++idx)
679 numberList[idx] = numberStr.
toInt();
682 std::sort(numberList.begin(), numberList.end());
683 for(idx=0;idx < (int)numberList.size();++idx)
687 const char* directory = kwl.
find(newPrefix.
c_str());
699 numberList.resize(numberOfFiles);
700 if(numberList.size()>0)
702 for(idx = 0; idx < (int)numberList.size();++idx)
706 numberList[idx] = numberStr.
toInt();
709 std::sort(numberList.begin(), numberList.end());
710 for(idx=0;idx < (int)numberList.size();++idx)
714 const char* file = kwl.
find(newPrefix.
c_str());
732 std::vector<int> numberList(numberOfFiles);
734 if(numberList.size()>0)
737 for(idx = 0; idx < numberList.size();++idx)
741 numberList[idx] = numberStr.
toInt();
743 std::sort(numberList.begin(), numberList.end());
746 for(std::vector<ossim_int32>::const_iterator iter = numberList.begin();
747 iter != numberList.end();++iter)
751 pluginFile = kwl.
find((newPrefix+
"file").c_str());
752 options = kwl.
find((newPrefix+
"options").c_str());
753 if(pluginFile.exists())
760 regExpressionFile =
ossimString(
"^(") +
"plugin.file[0-9]+)";
765 numberList.resize(numberOfFiles);
767 if(numberList.size()>0)
770 for(idx = 0; idx < numberList.size();++idx)
774 numberList[idx] = numberStr.
toInt();
776 std::sort(numberList.begin(), numberList.end());
779 for(std::vector<ossim_int32>::const_iterator iter = numberList.begin();
780 iter != numberList.end();++iter)
784 pluginFile = kwl.
find(newPrefix.
c_str());
785 if(pluginFile.exists())
796 if(auto_load_plugins.
empty()) auto_load_plugins =
"false";
801 if(auto_load_plugins.
toBool())
806 if(ossimpluginsDir.
exists())
808 currentDir = ossimpluginsDir;
810 std::vector<ossimFilename> result;
816 for(idx = 0; idx < result.size(); ++idx)
828 <<
"DEBUG ossimInit::initializeElevation(): Entered..." << std::endl;
838 geoid = geoid.
dirCat(
"geoid1996");
839 geoid = geoid.
dirCat(
"egm96.grd");
870 vector<ossimString> keys =
875 <<
"of elevation_manager.elevation_source....\n";
881 <<
"DEBUG ossimInit::initializeElevation(): leaving..." << std::endl;
911 versionString +=
"Version ?.?.?";
914 versionString +=
" ";
916 #ifdef OSSIM_BUILD_DATE 919 versionString +=
"(yyyymmdd)";
922 return versionString;
931 : theInitializedFlag(false),
934 theElevEnabledFlag(
true),
935 thePluginLoaderEnabledFlag(
true)
static ossimCodecFactoryRegistry * instance()
void parseEnvOptions(ossimArgumentParser &parser)
const ossimKeywordlist & preferencesKWL() const
void addCommandLineOption(const ossimString &option, const ossimString &explanation)
static ossimTraceManager * instance()
static ossimImageGeometryRegistry * instance()
void addPrefixToKeysThatMatch(const ossimString &prefix, const ossimString ®ularExpression)
ossimString before(const ossimString &str, std::string::size_type pos=0) const
METHOD: before(str, pos) Returns string beginning at pos and ending one before the token str If strin...
void parseOptions(ossimArgumentParser &parser)
static std::shared_ptr< ossim::ImageHandlerStateFactory > instance()
const ossimString & getApplicationName() const
ossim_uint32 getNumberOfSubstringKeys(const ossimString ®ularExpression) const
OSSIMDLLEXPORT void ossimGetLogFilename(ossimFilename &logFile)
Returns the log filename if set.
void initialize(int &argc, char **argv)
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimFilename appName() const
static const ossimErrorCode OSSIM_OK
static ossimDatumFactoryRegistry * instance()
instance method
bool getFirst(ossimFilename &filename, int flags=OSSIM_DIR_DEFAULT)
const char * find(const char *key) const
void addOptions(ossimArgumentParser &parser)
static ossimBaseObjectFactory * instance()
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
bool read(const std::string &str)
search for an occurance of a string in the argument list, on sucess remove that occurance from the li...
void loadPlugins(const ossimFilename &plugin, const char *options=0)
Can take a file or a directory.
void removeOption(int &argc, char **argv, int argToRemove)
bool contains(char aChar) const
static ossimImageWriterFactoryRegistry * instance()
void operator=(const ossimInit &rhs) const
Hidden from use assignment operator.
static ossimString toString(bool aValue)
Numeric to string methods.
ossimFilename getUserOssimPluginDir() const
static ossimOverviewBuilderFactory * instance()
static instance method.
static ossimObjectFactoryRegistry * instance()
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
static StreamFactoryRegistry * instance()
OSSIMDLLEXPORT void ossimDisableNotify(ossimNotifyFlags notifyLevel=ossimNotifyFlags_ALL)
bool thePluginLoaderEnabledFlag
ossimApplicationUsage * getApplicationUsage()
void parseNotifyOption(ossimArgumentParser &parser)
bool getNext(ossimFilename &filename) const
void parsePrefsOptions(ossimArgumentParser &parser)
void initializeElevation()
void setTracePattern(const ossimString &pattern)
Sets "thePattern" to "pattern", then calls setTraceFlags(true).
ossimPreferences * thePreferences
ossimInit()
protected default constructor.
void initializeDefaultFactories()
void addFactory(T *factory)
This is for backward compatability and calls registerFactory for simple adds.
static ossimSharedPluginRegistry * instance()
std::string::size_type size() const
bool toBool() const
String to numeric methods.
unsigned int ossim_uint32
static ossimGeoidManager * instance()
Implements singelton pattern:
bool getElevEnabledFlag() const
bool loadElevationPath(const ossimFilename &path, bool set_as_first=false)
Adds a new elevation file (or multiple files if path is a directory) to the collection.
static ossimString downcase(const ossimString &aString)
virtual void addGeoid(ossimRefPtr< ossimGeoid > geoid, bool toFrontFlag=false)
Permits adding additional geoids to the list:
void registerFactory(T *factory, bool pushToFrontFlag=false)
Will register a factory to the factory list.
void setElevEnabledFlag(bool flag)
Sets theElevEnabledFlag.
static ossimPreferences * instance()
bool open(const ossimFilename &dir)
void initializeLogFile()
Initializes log file from preferences keyword lookup of "ossim.log.file" if log file has not already ...
void addPreference(const char *key, const char *value)
static ossimProjectionFactoryRegistry * instance()
std::vector< ossimString > getSubstringKeyList(const ossimString ®ularExpression) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
static ossimOverviewBuilderFactoryRegistry * instance()
instance method for access to theInstance pointer.
static ossimEnvironmentUtility * instance()
static ossimProjectionViewControllerFactory * instance()
static ossimFontFactoryRegistry * instance()
virtual ossimErrorCode getErrorStatus() const
void setPluginLoaderEnabledFlag(bool flag)
OSSIMDLLEXPORT void ossimSetLogFilename(const ossimFilename &filename)
ossimFilename dirCat(const ossimFilename &file) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
static std::shared_ptr< ImageHandlerStateRegistry > instance()
bool registerPlugin(const ossimFilename &filename, const ossimString &options="")
static ossimInit * instance()
ossimString getEnvironmentVariable(const ossimString &variable) const
static ossimImageHandlerRegistry * instance()
void setEnvironmentVariable(const char *variable, const char *value) const
static ossimInit * theInstance
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
ossimString version() const
ossimFilename path() const
static ossimImageSourceFactoryRegistry * instance()
ossimFilename getPreferencesFilename() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const