OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimInfo.cpp
Go to the documentation of this file.
1 //---
2 // File: ossimInfo.cpp
3 //
4 // License: MIT
5 //
6 // Author: David Burken
7 //
8 // Description: ossimInfo class definition
9 //
10 // Utility class for getting information from the ossim library.
11 //
12 //---
13 // $Id$
14 
15 #include <ossim/util/ossimInfo.h>
16 #include <ossim/ossimVersion.h>
20 #include <ossim/base/ossimDatum.h>
22 #include <ossim/base/ossimDrect.h>
30 #include <ossim/base/ossimGpt.h>
31 #include <ossim/base/ossimNotify.h>
34 #include <ossim/base/ossimString.h>
35 #include <ossim/base/ossimTrace.h>
38 #include <ossim/font/ossimFont.h>
45 #include <ossim/init/ossimInit.h>
52 
53 #include <iomanip>
54 #include <sstream>
55 #include <vector>
56 #include <memory>
57 
58 static const char BUILD_DATE_KW[] = "build_date";
59 static const char CAN_OPEN_KW[] = "can_open";
60 static const char CENTER_GROUND_KW[] = "center_ground";
61 static const char CENTER_IMAGE_KW[] = "center_image";
62 static const char CONFIGURATION_KW[] = "configuration";
63 static const char DATUMS_KW[] = "datums";
64 static const char DEG2RAD_KW[] = "deg2rad";
65 static const char DUMP_KW[] = "dump";
66 static const char DUMP_NO_OVERVIEWS_KW[] = "dump_no_overviews";
67 static const char EXTENSIONS_KW[] = "extensions";
68 static const char FACTORIES_KW[] = "factories";
69 static const char FACTORY_KEYWORD_LIST_KW[] = "factory_keyword_list";
70 static const char FONTS_KW[] = "fonts";
71 static const char FORMAT_KW[] = "format";
72 static const char FT2MTRS_KW[] = "ft2mtrs";
73 static const char FT2MTRS_US_SURVEY_KW[] = "ft2mtrs_us_survey";
74 static const char GEOM_INFO_KW[] = "geometry_info";
75 static const char HEIGHT_KW[] = "height";
76 static const char IMAGE_BOUNDS_KW[] = "image_bounds";
77 static const char IMAGE_CENTER_KW[] = "image_center";
78 static const char IMAGE_FILE_KW[] = "image_file";
79 static const char IMAGE_INFO_KW[] = "image_info";
80 static const char IMAGE_RECT_KW[] = "image_rect";
81 static const char IMG2GRD_KW[] = "img2grd";
82 static const char GRD2IMG_KW[] = "grd2img";
83 static const char METADATA_KW[] = "metadata";
84 static const char MTRS2FT_KW[] = "mtrs2ft";
85 static const char MTRS2FT_US_SURVEY_KW[] = "mtrs2ft_us_survey";
86 static const char MTRSPERDEG_KW[] = "mtrs_per_deg";
87 static const char NORTH_UP_KW[] = "north_up_angle";
88 static const char OUTPUT_FILE_KW[] = "output_file";
89 static const char OVERVIEW_TYPES_KW[] = "overview_types";
90 static const char OVERWRITE_KW[] = "overwrite";
91 static const char PALETTE_KW[] = "palette";
92 static const char PLUGINS_KW[] = "plugins";
93 static const char PLUGIN_TEST_KW[] = "plugin_test";
94 static const char PRETTY_PRINT_KW[] = "pretty_print";
95 static const char PROJECTIONS_KW[] = "projections";
96 static const char RAD2DEG_KW[] = "rad2deg";
97 static const char READER_PROPS_KW[] = "reader_props";
98 static const char RESAMPLER_FILTERS_KW[] = "resampler_filters";
99 static const char REVISION_NUMBER_KW[] = "revision_number";
100 static const char UP_IS_UP_KW[] = "up_is_up";
101 static const char UP_IS_UP_GPT_KW[] = "up_is_up_gpt";
102 static const char UP_IS_UP_IPT_KW[] = "up_is_up_ipt";
103 static const char VERSION_KW[] = "version";
104 static const char WRITERS_KW[] = "writers_kw";
105 static const char WRITER_PROPS_KW[] = "writer_props";
106 static const char ZOOM_LEVEL_GSDS_KW[] = "zoom_level_gsds";
107 static const char ECEF2LLH_KW[] = "ecef2llh";
108 static const char DUMP_STATE_KW[] = "dump_state";
109 static const char STATE_KW[] = "state";
110 
111 const char* ossimInfo::DESCRIPTION =
112  "Dumps metadata information about input image and OSSIM in general.";
113 
114 // Static trace for debugging. Use -T ossimInfo to turn on.
115 static ossimTrace traceDebug = ossimTrace("ossimInfo:debug");
116 
118  m_img(0)
119 {
120 }
121 
123 {
124 }
125 
127 {
128  // Add global usage options.
130 
131  // Set the general usage:
133  ossimString usageString = ap.getApplicationName();
134  usageString += " [options] <optional-image | optional-state>";
135  au->setCommandLineUsage(usageString);
136 
137  // Set the command line options:
138  au->addCommandLineOption("--bounds", "Will print out the edge to edge image bounds.");
139 
140  au->addCommandLineOption("--build-date", "Build date of code.");
141 
142  au->addCommandLineOption("-c", "Will print ground and image center.");
143 
144  au->addCommandLineOption("--can-open", "return can_open: true or can_open: false");
145 
146  au->addCommandLineOption("--cg", "Will print out ground center.");
147 
148  au->addCommandLineOption("--ci", "Will print out image center.");
149 
150  au->addCommandLineOption("--config", "Displays configuration info.");
151 
152  au->addCommandLineOption("-D", "A human-readable (i.e., not necessarily key:value pairs) dump of the image.");
153 
154  au->addCommandLineOption("-d", "A generic dump if one is available.");
155 
156  au->addCommandLineOption("--datums", "Prints datum list.");
157 
158  au->addCommandLineOption("--deg2rad", "<degrees> Gives radians from degrees.");
159 
160  au->addCommandLineOption("--dno", "A generic dump if one is available. This option ignores overviews.");
161 
162  au->addCommandLineOption("--dump-state", "If the image supports a state object then the state object will be dumped.");
163 
164  au->addCommandLineOption("--ecef2llh", "<X> <Y> <Z> in ECEF coordinates and returns latitude longitude height position.");
165 
166  au->addCommandLineOption("--extensions", "Prints list of supported image extensions.");
167 
168  au->addCommandLineOption("-f", "<format> Will output the information specified format [KWL | XML]. Default is KWL.");
169 
170  au->addCommandLineOption("--factories", "<keyword_list_flag> Prints factory list. If keyword_list_flag is true, the result of a saveState will be output for each object.");
171 
172  au->addCommandLineOption("--fonts", "Prints available fonts.");
173 
174  au->addCommandLineOption("--ft2mtrs", "<feet> Gives meters from feet (0.3048 meters per foot).");
175 
176  au->addCommandLineOption("--ft2mtrs-us-survey", "<feet> Gives meters from feet (0.3048006096 meters per foot).");
177 
178  au->addCommandLineOption("-h", "Display this information");
179 
180  au->addCommandLineOption("--height", "<latitude-in-degrees> <longitude-in-degrees> Returns the MSL and ellipoid height given a latitude longitude position.");
181 
182  au->addCommandLineOption("-i", "Will print out the general image information.");
183 
184  au->addCommandLineOption("--img2grd", "<x> <y> Gives ground point from zero based image point. Returns \"nan\" if point is outside of image area.");
185  au->addCommandLineOption("--grd2img", "<lat> <lon> <height> Gives full res image point from lat lon height.");
186 
187  au->addCommandLineOption("-m", "Will print out meta data image information.");
188 
189  au->addCommandLineOption("--mtrsPerDeg", "<latitude> Gives meters per degree and meters per minute for a given latitude.");
190 
191  au->addCommandLineOption("--mtrs2ft", "<meters> Gives feet from meters (0.3048 meters per foot).");
192 
193  au->addCommandLineOption("--mtrs2ft-us-survey", "<meters> Gives feet from meters (0.3048006096 meters per foot).");
194 
195  au->addCommandLineOption("-n or --north-up", "Rotation angle to North for an image.");
196 
197  au->addCommandLineOption("-o", "<output-file> Will output the information to the file specified. Default is to standard out.");
198 
199  au->addCommandLineOption("--overview-types", "Prints overview builder types.");
200 
201  au->addCommandLineOption("-p", "Will print out the image projection information.");
202 
203  au->addCommandLineOption("--palette", "Will print out the color palette if one exists.");
204 
205  au->addCommandLineOption("--plugins", "Prints plugin list.");
206 
207  au->addCommandLineOption("--plugin-test", "Test plugin passed to option.");
208 
209  au->addCommandLineOption("--projections", "Prints projections.");
210 
211  au->addCommandLineOption("-r", "Will print image rectangle.");
212 
213  au->addCommandLineOption("--rad2deg", "<radians> Gives degrees from radians.");
214 
215  au->addCommandLineOption("--reader-props", "Prints readers and properties.");
216 
217  au->addCommandLineOption("--resampler-filters", "Prints resampler filter list.");
218 
219  au->addCommandLineOption("--revision", "Revision of code.");
220 
221  au->addCommandLineOption("-s", "Force the ground rect to be the specified datum");
222 
223  au->addCommandLineOption("--up-is-up or -u", "Rotation angle to \"up is up\" for an image.\nWill return 0 if image's projection is not affected by elevation.");
224  au->addCommandLineOption("--up-is-up-gpt", "Computes up angle given gpt: <lat> <lon>");
225  au->addCommandLineOption("--up-is-up-ipt", "Computes up angle given full res image point: <x> <y>");
226  au->addCommandLineOption("-v", "Overwrite existing geometry.");
227 
228  au->addCommandLineOption("-V or --vesion", "Version of code, e.g. 1.8.20");
229 
230  au->addCommandLineOption("--writer-props", "Prints writers and properties.");
231 
232  au->addCommandLineOption("--writers", "Prints list of available writers.");
233 
234  au->addCommandLineOption("--zoom-level-gsds", "Prints zoom level gsds for projections EPSG:4326 and EPSG:3857.");
235 
236  ostringstream description;
237  description << DESCRIPTION << "\n\n Examples:\n\n"
238  << " ossim-info --version\n"
239  << " ossim-info -i ./myfile.tif\n"
240  << " prints out only general image information\n\n"
241  << " ossim-info -p ./myfile.tif\n"
242  << " prints out only image projection information\n\n"
243  << " ossim-info -p -s wge ./myfile.tif\n"
244  << " prints out only image projection information and shifts to wgs84\n\n"
245  << " ossim-info -p -i ./myfile.tif\n"
246  << " prints out both image and projection information\n\n"
247  << " ossim-info -p -i ./myfile.tif -o ./myfile.geom\n"
248  << " writes geometry file with both image and projection information\n\n"
249  << " ossim-info -p -i ./myfile.tif -v -o ./myfile.geom\n"
250  << " writes geometry file with both image and projection information\n"
251  << " while overwriting existing .geom file.\n\n"
252  << " ossim-info -f XML ./myfile.tif\n"
253  << " prints out image and projection information as an XML document\n\n"
254  << " ossim-info -d myfile.ntf\n"
255  << " Dumps all data available, in this case, all nitf tags, from file.\n\n"
256  << " ossim-info -d a.toc\n"
257  << " Dumps all data available, in this case, all nitf and rpf tags, from file.\n\n"
258  << " ossim-info --dno a.toc\n"
259  << " \"dno\" for \"dump no overviews\" Dumps all data available,\n"
260  << " in this case, all nitf and rpf tags, from file ignoring overviews.\n\n"
261  << " ossim-info -d -i -p myfile.ntf\n"
262  << " Typical usage case, i.e. do a dump of tags and print out image and\n"
263  << " projection information.\n\n"
264  << std::endl;
265  au->setDescription(description.str());
266 
267 } // void ossimInfo::addArguments(ossimArgumentParser& ap)
268 
270 {
271  static const char M[] = "ossimInfo::initialize(ossimArgumentParser&)";
272  if ( traceDebug() )
273  {
274  ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\n";
275  }
276 
277  if (!ossimTool::initialize(ap))
278  return false;
279  if (m_helpRequested)
280  return true;
281 
282  bool result = true;
283 
284  //---
285  // Start with clean options keyword list.
286  //---
287  m_kwl.clear();
288 
289  bool requiresInputImage = false;
290 
291  while ( 1 ) // While forever loop...
292  {
293  // Used throughout below:
294  std::string ts1;
296  std::string ts2;
298  std::string ts3;
300  const char TRUE_KW[] = "true";
301 
302  if( ap.read("--bounds") )
303  {
304  m_kwl.add( IMAGE_BOUNDS_KW, TRUE_KW );
305  if ( ap.argc() < 2 )
306  {
307  break;
308  }
309  }
310 
311  if( ap.read("--build-date") )
312  {
313  m_kwl.add( BUILD_DATE_KW, TRUE_KW );
314  if ( ap.argc() < 2 )
315  {
316  break;
317  }
318  }
319 
320  if( ap.read("-c") )
321  {
322  m_kwl.add( IMAGE_CENTER_KW, TRUE_KW );
323  if ( ap.argc() < 2 )
324  {
325  break;
326  }
327  }
328 
329  if( ap.read("--can-open") )
330  {
331  m_kwl.add( CAN_OPEN_KW, TRUE_KW );
332  requiresInputImage = true;
333  if ( ap.argc() < 2 )
334  {
335  break;
336  }
337  }
338 
339 
340  if( ap.read("--cg") )
341  {
342  m_kwl.add( CENTER_GROUND_KW, TRUE_KW );
343  if ( ap.argc() < 2 )
344  {
345  break;
346  }
347  }
348 
349  if( ap.read("--ci") )
350  {
351  m_kwl.add( CENTER_IMAGE_KW, TRUE_KW );
352  if ( ap.argc() < 2 )
353  {
354  break;
355  }
356  }
357 
358  if( ap.read("--config") || ap.read("--configuration") )
359  {
360  m_kwl.add( CONFIGURATION_KW, TRUE_KW );
361  if ( ap.argc() < 2 )
362  {
363  break;
364  }
365  }
366 
367  if( ap.read("--datums") )
368  {
369  m_kwl.add( DATUMS_KW, TRUE_KW );
370  if ( ap.argc() < 2 )
371  {
372  break;
373  }
374  }
375 
376  if( ap.read("--deg2rad", sp1) )
377  {
378  m_kwl.add( DEG2RAD_KW, ts1.c_str() );
379  if ( ap.argc() < 2 )
380  {
381  break;
382  }
383  }
384 
385  if( ap.read("-D") )
386  {
387  m_kwl.add( PRETTY_PRINT_KW, TRUE_KW );
388  requiresInputImage = true;
389  if ( ap.argc() < 2 )
390  {
391  break;
392  }
393  }
394 
395  if( ap.read("-d") )
396  {
397  m_kwl.add( DUMP_KW, TRUE_KW );
398  requiresInputImage = true;
399  if ( ap.argc() < 2 )
400  {
401  break;
402  }
403  }
404 
405  if( ap.read("--dump-state") )
406  {
407  m_kwl.add( DUMP_STATE_KW, TRUE_KW );
408  requiresInputImage = true;
409  if ( ap.argc() < 2 )
410  {
411  break;
412  }
413  }
414 
415  if( ap.read("--dno") )
416  {
417  m_kwl.add( DUMP_KW, TRUE_KW );
418  m_kwl.add( DUMP_NO_OVERVIEWS_KW, TRUE_KW );
419  requiresInputImage = true;
420  if ( ap.argc() < 2 )
421  {
422  break;
423  }
424  }
425 
426  if( ap.read("--extensions") )
427  {
428  m_kwl.add( EXTENSIONS_KW, TRUE_KW );
429  if ( ap.argc() < 2 )
430  break;
431  }
432 
433  if( ap.read("-f", sp1) )
434  {
435  m_kwl.add( FORMAT_KW, ts1.c_str());
436  if ( ap.argc() < 2 )
437  {
438  break;
439  }
440  }
441 
442  if( ap.read("--factories", sp1) )
443  {
444  m_kwl.add( FACTORIES_KW, TRUE_KW);
445  m_kwl.add( FACTORY_KEYWORD_LIST_KW, ts1.c_str());
446  if ( ap.argc() < 2 )
447  {
448  break;
449  }
450  }
451 
452  if( ap.read("--fonts") )
453  {
454  m_kwl.add( FONTS_KW, TRUE_KW );
455  if ( ap.argc() < 2 )
456  {
457  break;
458  }
459  }
460 
461  if( ap.read("--ft2mtrs", sp1) )
462  {
463  m_kwl.add( FT2MTRS_KW, ts1.c_str());
464  if ( ap.argc() < 2 )
465  {
466  break;
467  }
468  }
469 
470  if( ap.read("--ft2mtrs-us-survey", sp1) )
471  {
472  m_kwl.add( FT2MTRS_KW, ts1.c_str());
473  m_kwl.add( FT2MTRS_US_SURVEY_KW, TRUE_KW);
474  if ( ap.argc() < 2 )
475  {
476  break;
477  }
478  }
479 
480  if( ap.read("--height", sp1, sp2) )
481  {
482  ossimString lat = ts1;
483  ossimString lon = ts2;
484  ossimGpt gpt;
485  gpt.lat = lat.toFloat64();
486  gpt.lon = lon.toFloat64();
487  m_kwl.add( HEIGHT_KW, gpt.toString().c_str() );
488  if ( ap.argc() < 2 )
489  {
490  break;
491  }
492  }
493  if( ap.read("--ecef2llh", sp1, sp2, sp3))
494  {
495  ossimString x = ts1;
496  ossimString y = ts2;
497  ossimString z = ts3;
498  ossimEcefPoint ecefPoint(x.toFloat64(), y.toFloat64(), z.toFloat64());
499  m_kwl.add( ECEF2LLH_KW, ecefPoint.toString().c_str() );
500  if ( ap.argc() < 2 )
501  {
502  break;
503  }
504 
505  }
506  if( ap.read("-i") )
507  {
508  m_kwl.add( IMAGE_INFO_KW, TRUE_KW );
509  requiresInputImage = true;
510  if ( ap.argc() < 2 )
511  {
512  break;
513  }
514  }
515 
516  if( ap.read("--img2grd", sp1, sp2) )
517  {
518  requiresInputImage = true;
519  ossimString x = ts1;
520  ossimString y = ts2;
521  ossimDpt dpt;
522  dpt.x = x.toFloat64();
523  dpt.y = y.toFloat64();
524  m_kwl.add( IMG2GRD_KW, dpt.toString().c_str() );
525  if ( ap.argc() < 2 )
526  {
527  break;
528  }
529  }
530 
531  if( ap.read("--grd2img", sp1, sp2, sp3) )
532  {
533  requiresInputImage = true;
534  ossimString lat = ts1;
535  ossimString lon = ts2;
536  ossimString hgt = ts3;
537  ossimGpt gpt;
538  gpt.makeNan();
539  gpt.latd(lat.toFloat64());
540  gpt.lond(lon.toFloat64());
541  if(hgt != "nan")
542  {
543  gpt.height(hgt.toFloat64());
544  }
545  m_kwl.add( GRD2IMG_KW, gpt.toString().c_str() );
546  if ( ap.argc() < 2 )
547  {
548  break;
549  }
550  }
551 
552  if( ap.read("-m") )
553  {
554  m_kwl.add( METADATA_KW, TRUE_KW );
555  requiresInputImage = true;
556  if ( ap.argc() < 2 )
557  {
558  break;
559  }
560  }
561 
562  if( ap.read("--mtrs2ft", sp1) )
563  {
564  m_kwl.add( MTRS2FT_KW, ts1.c_str());
565  if ( ap.argc() < 2 )
566  {
567  break;
568  }
569  }
570 
571  if( ap.read("--mtrs2ft-us-survey", sp1) )
572  {
573  m_kwl.add( MTRS2FT_KW, ts1.c_str());
574  m_kwl.add( MTRS2FT_US_SURVEY_KW, TRUE_KW);
575  if ( ap.argc() < 2 )
576  {
577  break;
578  }
579  }
580 
581  if( ap.read("--mtrsPerDeg", sp1) )
582  {
583  m_kwl.add( MTRSPERDEG_KW, ts1.c_str());
584  if ( ap.argc() < 2 )
585  {
586  break;
587  }
588  }
589 
590  if( ap.read("-n") || ap.read("--north-up") )
591  {
592  m_kwl.add( NORTH_UP_KW, TRUE_KW );
593  if ( ap.argc() < 2 )
594  {
595  break;
596  }
597  }
598 
599  if( ap.read("-o", sp1) )
600  {
601  m_kwl.add( OUTPUT_FILE_KW, ts1.c_str());
602  if ( ap.argc() < 2 )
603  {
604  break;
605  }
606  }
607 
608  if( ap.read("--overview-types") )
609  {
610  m_kwl.add( OVERVIEW_TYPES_KW, TRUE_KW );
611  if ( ap.argc() < 2 )
612  {
613  break;
614  }
615  }
616 
617  if( ap.read("-p") )
618  {
619  m_kwl.add( GEOM_INFO_KW, TRUE_KW );
620  requiresInputImage = true;
621  if ( ap.argc() < 2 )
622  {
623  break;
624  }
625  }
626 
627  if( ap.read("--palette") )
628  {
629  m_kwl.add( PALETTE_KW, TRUE_KW );
630  requiresInputImage = true;
631  if ( ap.argc() < 2 )
632  {
633  break;
634  }
635  }
636 
637  if( ap.read("--plugins") )
638  {
639  m_kwl.add( PLUGINS_KW, TRUE_KW );
640  if ( ap.argc() < 2 )
641  {
642  break;
643  }
644  }
645 
646  if( ap.read("--plugin-test", sp1) )
647  {
648  m_kwl.add( PLUGIN_TEST_KW, ts1.c_str());
649  if ( ap.argc() < 2 )
650  {
651  break;
652  }
653  }
654 
655  if( ap.read("--projections") )
656  {
657  m_kwl.add( PROJECTIONS_KW, TRUE_KW );
658  if ( ap.argc() < 2 )
659  {
660  break;
661  }
662  }
663 
664  if( ap.read("-r") )
665  {
666  m_kwl.add( IMAGE_RECT_KW, TRUE_KW );
667  requiresInputImage = true;
668  if ( ap.argc() < 2 )
669  {
670  break;
671  }
672  }
673 
674  if( ap.read("--rad2deg", sp1) )
675  {
676  m_kwl.add( RAD2DEG_KW, ts1.c_str());
677  if ( ap.argc() < 2 )
678  {
679  break;
680  }
681  }
682 
683  if( ap.read("--reader-props") )
684  {
685  m_kwl.add( READER_PROPS_KW, TRUE_KW );
686  if ( ap.argc() < 2 )
687  {
688  break;
689  }
690  }
691 
692  if( ap.read("--resampler-filters") )
693  {
694  m_kwl.add( RESAMPLER_FILTERS_KW, TRUE_KW );
695  if ( ap.argc() < 2 )
696  {
697  break;
698  }
699  }
700 
701  if( ap.read("--revision") ||
702  ap.read("--revision-number") ) // backwards compat
703  {
704  m_kwl.add( REVISION_NUMBER_KW, TRUE_KW );
705  if ( ap.argc() < 2 )
706  {
707  break;
708  }
709  }
710 
711  if( ap.read("-u") || ap.read("--up-is-up") )
712  {
713  requiresInputImage = true;
714  m_kwl.add( UP_IS_UP_KW, TRUE_KW );
715  if ( ap.argc() < 2 )
716  {
717  break;
718  }
719  }
720  if( ap.read("--up-is-up-ipt", sp1, sp2))
721  {
722  requiresInputImage = true;
723  m_kwl.add( UP_IS_UP_KW, TRUE_KW);
724  m_kwl.add( UP_IS_UP_IPT_KW, (ts1 +" "+ts2).c_str() );
725  if ( ap.argc() < 2 )
726  {
727  break;
728  }
729  }
730  if(ap.read("--up-is-up-gpt",sp1, sp2))
731  {
732  requiresInputImage = true;
733  m_kwl.add( UP_IS_UP_KW, TRUE_KW);
734  m_kwl.add( UP_IS_UP_GPT_KW, (ts1 +" "+ ts2).c_str() );
735  if ( ap.argc() < 2 )
736  {
737  break;
738  }
739  }
740 
741  if( ap.read("-v") )
742  {
743  m_kwl.add( OVERWRITE_KW, TRUE_KW );
744  if ( ap.argc() < 2 )
745  {
746  break;
747  }
748  }
749 
750  if( ap.read("--version") || ap.read("-V") )
751  {
752  m_kwl.add( VERSION_KW, TRUE_KW );
753  if ( ap.argc() < 2 )
754  {
755  break;
756  }
757  }
758 
759  if( ap.read("--writer-props") )
760  {
761  m_kwl.add( WRITER_PROPS_KW, TRUE_KW );
762  if ( ap.argc() < 2 )
763  {
764  break;
765  }
766  }
767 
768  if( ap.read("--writers") )
769  {
770  m_kwl.add( WRITERS_KW, TRUE_KW );
771  if ( ap.argc() < 2 )
772  {
773  break;
774  }
775  }
776 
777  if( ap.read("--zoom-level-gsds") )
778  {
779  m_kwl.add( ZOOM_LEVEL_GSDS_KW, TRUE_KW );
780  if ( ap.argc() < 2 )
781  {
782  break;
783  }
784  }
785 
786  // End of arg parsing.
788  if ( ap.errors() )
789  {
791  std::string errMsg = "Unknown option...";
792  throw ossimException(errMsg);
793  }
794 
795  break; // Break from while forever.
796 
797  } // End while (forever) loop.
798 
799  if ( ap.argc() == 2 )
800  {
801  m_kwl.add( IMAGE_FILE_KW, ap[1] );
802  }
803 
804  if ( (( ap.argc() == 1 ) && requiresInputImage) || (m_kwl.getSize() == 0) )
805  {
806  if ( requiresInputImage )
807  {
808  ossimNotify(ossimNotifyLevel_NOTICE) << "\nError: Option requires input image!\n\n";
809  }
810  setUsage(ap);
812  result = false;
813 
814  }
815 
816  if ( traceDebug() )
817  {
819  << "m_kwl:\n" << m_kwl << "\n"
820  << M << " exit result = " << (result?"true":"false")
821  << "\n";
822  }
823 
824  return result;
825 }
826 
828 {
829  static const char M[] = "ossimInfo::execute()";
830 
831  const ossim_uint32 KEY_COUNT = m_kwl.getSize();
832 
833  if ( traceDebug() )
834  {
836  << M << " entered..."
837  << "\nMap size: " << KEY_COUNT << "\n";
838  }
839 
840  if ( KEY_COUNT )
841  {
842  ossim_uint32 consumedKeys = 0;
843 
844  const char* lookup;
845 
846  lookup = m_kwl.find(IMAGE_FILE_KW);
847  if ( lookup )
848  {
849  ++consumedKeys;
850  ossimFilename image = lookup;
851 
852  consumedKeys += executeImageOptions(image);
853  }
854 
855  if ( consumedKeys < KEY_COUNT )
856  {
857  ossimString value;
858 
859  if ( keyIsTrue( std::string(BUILD_DATE_KW)) )
860  {
861  getBuildDate( value.string() );
863  << BUILD_DATE_KW << ": " << value << "\n";
864  }
865 
866  lookup = m_kwl.find(CONFIGURATION_KW);
867  if ( lookup )
868  {
869  ++consumedKeys;
870  value = lookup;
871  if ( value.toBool() )
872  {
874  }
875  }
876 
877  lookup = m_kwl.find(DATUMS_KW);
878  if ( lookup )
879  {
880  ++consumedKeys;
881  value = lookup;
882  if ( value.toBool() )
883  {
884  printDatums();
885  }
886  }
887 
888  lookup = m_kwl.find(DEG2RAD_KW);
889  if ( lookup )
890  {
891  ++consumedKeys;
892  value = lookup;
893  deg2rad( value.toFloat64() );
894  }
895 
896  lookup = m_kwl.find(ECEF2LLH_KW);
897  if(lookup)
898  {
899  ++consumedKeys;
900  ossimEcefPoint ecefPoint;
901  ecefPoint.toPoint(lookup);
902 
904  }
905 
906  lookup = m_kwl.find(EXTENSIONS_KW);
907  if ( lookup )
908  {
909  ++consumedKeys;
910  value = lookup;
911  if ( value.toBool() )
912  {
913  printExtensions();
914  }
915  }
916 
917  lookup = m_kwl.find(FACTORIES_KW);
918  if ( lookup )
919  {
920  ++consumedKeys;
921  ossimString factories = lookup;
922  bool keywordListFlag = false;
923  lookup = m_kwl.find(FACTORY_KEYWORD_LIST_KW);
924  if ( lookup )
925  {
926  ++consumedKeys;
927  keywordListFlag = ossimString(lookup).toBool();
928  }
929  printFactories(keywordListFlag);
930  }
931 
932  lookup = m_kwl.find(FONTS_KW);
933  if ( lookup )
934  {
935  ++consumedKeys;
936  value = lookup;
937  if ( value.toBool() )
938  {
939  printFonts();
940  }
941  }
942 
943  lookup = m_kwl.find(FT2MTRS_KW);
944  if ( lookup )
945  {
946  ++consumedKeys;
947  value = lookup;
948  bool us_survey = false;
949  lookup = m_kwl.find(FT2MTRS_US_SURVEY_KW);
950  if ( lookup )
951  {
952  ++consumedKeys;
953  us_survey = ossimString(lookup).toBool();
954  }
955  ft2mtrs( value.toFloat64(), us_survey);
956  }
957 
958  lookup = m_kwl.find(HEIGHT_KW);
959  if ( lookup )
960  {
961  ++consumedKeys;
962  value = lookup;
963  ossimGpt gpt;
964  gpt.toPoint(value);
965  outputHeight(gpt);
966  }
967 
968  lookup = m_kwl.find(MTRS2FT_KW);
969  if ( lookup )
970  {
971  ++consumedKeys;
972  value = lookup;
973  bool us_survey = false;
974  lookup = m_kwl.find(MTRS2FT_US_SURVEY_KW);
975  if ( lookup )
976  {
977  ++consumedKeys;
978  us_survey = ossimString(lookup).toBool();
979  }
980  mtrs2ft( value.toFloat64(), us_survey);
981  }
982 
983  lookup = m_kwl.find(MTRSPERDEG_KW);
984  if ( lookup )
985  {
986  ++consumedKeys;
987  value = lookup;
988  mtrsPerDeg( value.toFloat64() );
989  }
990 
991  lookup = m_kwl.find(OVERVIEW_TYPES_KW);
992  if ( lookup )
993  {
994  ++consumedKeys;
995  value = lookup;
996  if ( value.toBool() )
997  {
999  }
1000  }
1001 
1002  lookup = m_kwl.find(PLUGINS_KW);
1003  if ( lookup )
1004  {
1005  ++consumedKeys;
1006  value = lookup;
1007  if ( value.toBool() )
1008  {
1009  printPlugins();
1010  }
1011  }
1012 
1013  lookup = m_kwl.find(PLUGIN_TEST_KW);
1014  if ( lookup )
1015  {
1016  ++consumedKeys;
1017  value = lookup;
1018  testPlugin(value);
1019  }
1020 
1021  lookup = m_kwl.find(PROJECTIONS_KW);
1022  if ( lookup )
1023  {
1024  ++consumedKeys;
1025  value = lookup;
1026  if ( value.toBool() )
1027  {
1028  printProjections();
1029  }
1030  }
1031 
1032  lookup = m_kwl.find(RAD2DEG_KW);
1033  if ( lookup )
1034  {
1035  ++consumedKeys;
1036  value = lookup;
1037  rad2deg( value.toFloat64() );
1038  }
1039 
1040  lookup = m_kwl.find(READER_PROPS_KW);
1041  if ( lookup )
1042  {
1043  ++consumedKeys;
1044  value = lookup;
1045  if ( value.toBool() )
1046  {
1047  printReaderProps();
1048  }
1049  }
1050 
1051  lookup = m_kwl.find(RESAMPLER_FILTERS_KW);
1052  if ( lookup )
1053  {
1054  ++consumedKeys;
1055  value = lookup;
1056  if ( value.toBool() )
1057  {
1059  }
1060  }
1061 
1062  if ( keyIsTrue( std::string(REVISION_NUMBER_KW) ) )
1063  {
1064  getRevisionNumber( value.string() );
1066  << REVISION_NUMBER_KW << ": " << value << "\n";
1067  }
1068 
1069  if ( keyIsTrue( std::string(VERSION_KW) ) )
1070  {
1071  getVersion( value.string() );
1073  << VERSION_KW << ": " << value << "\n";
1074  }
1075 
1076  lookup = m_kwl.find(WRITERS_KW);
1077  if ( lookup )
1078  {
1079  ++consumedKeys;
1080  value = lookup;
1081  if ( value.toBool() )
1082  {
1083  printWriters();
1084  }
1085  }
1086 
1087  lookup = m_kwl.find(WRITER_PROPS_KW);
1088  if ( lookup )
1089  {
1090  ++consumedKeys;
1091  value = lookup;
1092  if ( value.toBool() )
1093  {
1094  printWriterProps();
1095  }
1096  }
1097 
1098  lookup = m_kwl.find(ZOOM_LEVEL_GSDS_KW);
1099  if ( lookup )
1100  {
1101  ++consumedKeys;
1102  value = lookup;
1103  if ( value.toBool() )
1104  {
1106  }
1107  }
1108 
1109  } // if ( consumedKeys < KEY_COUNT )
1110 
1111  if ( traceDebug() )
1112  {
1114  << "KEY_COUNT: " << KEY_COUNT
1115  << "\nconsumedKeys: " << consumedKeys << "\n";
1116  }
1117 
1118  } // if ( KEY_COUNT )
1119 
1120  if ( traceDebug() )
1121  {
1122  ossimNotify(ossimNotifyLevel_DEBUG) << M << " exited...\n";
1123  }
1124  return true;
1125 }
1126 
1128 {
1129  static const char M[] = "ossimInfo::executeImageOptions()";
1130  if ( traceDebug() )
1131  {
1132  ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\nfile: " << file << "\n";
1133  }
1134 
1135  // Output keyword list.
1136  ossimKeywordlist okwl;
1137 
1138  ossim_uint32 consumedKeys = 0;
1139  const char* lookup = 0;
1140  ossimString value = "";
1141 
1142  bool dnoFlag = false;
1143  bool overwriteFlag = false;
1144  bool xmlOutFlag = false;
1145 
1146  lookup = m_kwl.find( OVERWRITE_KW );
1147  if ( lookup )
1148  {
1149  ++consumedKeys;
1150  value = lookup;
1151  overwriteFlag = value.toBool();
1152  }
1153 
1154  // Check for xml format option.
1155  lookup = m_kwl.find( FORMAT_KW );
1156  if ( lookup )
1157  {
1158  ++consumedKeys;
1159  ossimString format = lookup;
1160  if ( format.upcase() == "XML" )
1161  {
1162  xmlOutFlag = true;
1163  }
1164  }
1165 
1166  lookup = m_kwl.find( OUTPUT_FILE_KW );
1167  ossimFilename outputFile;
1168  if ( lookup )
1169  {
1170  ++consumedKeys;
1171  outputFile = lookup;
1172  }
1173 
1174  lookup = m_kwl.find( PRETTY_PRINT_KW );
1175  if ( lookup )
1176  {
1177  ++consumedKeys;
1178  prettyPrint(file);
1179  }
1180 
1181  // Check for dump. Does not require image to be opened.
1182  lookup = m_kwl.find( DUMP_KW );
1183  if ( lookup )
1184  {
1185  ++consumedKeys;
1186  lookup = m_kwl.find( DUMP_NO_OVERVIEWS_KW );
1187  if ( lookup )
1188  {
1189  ++consumedKeys;
1190  value = lookup;
1191  dnoFlag = value.toBool();
1192  }
1193 
1194  if ( !xmlOutFlag && ( outputFile == ossimFilename::NIL ) )
1195  {
1196  //---
1197  // Write to standard out:
1198  // This dump will come out in order so is preferred over going to
1199  // okwl(output keyword list) which will come out alphabetical.
1200  //---
1201  ossimKeywordlist kwl;
1202  dumpImage(file, dnoFlag, kwl);
1204  }
1205  else
1206  {
1207  // Save to output keyword list. Will be output later.
1208  dumpImage(file, dnoFlag, okwl);
1209  }
1210  }
1211 
1212  bool centerGroundFlag = false;
1213  bool centerImageFlag = false;
1214  bool imageBoundsFlag = false;
1215  bool imageCenterFlag = false;
1216  bool imageGeomFlag = false;
1217  bool imageInfoFlag = false;
1218  bool imageRectFlag = false;
1219  bool img2grdFlag = false;
1220  bool grd2imgFlag = false;
1221  bool metaDataFlag = false;
1222  bool northUpFlag = false;
1223  bool paletteFlag = false;
1224  bool upIsUpFlag = false;
1225  bool imageToGroundFlag = false;
1226  bool groundToImageFlag = false;
1227  bool dumpState = false;
1228  bool canOpenFlag = false;
1229 
1230  lookup = m_kwl.find( DUMP_STATE_KW );
1231  if ( lookup )
1232  {
1233  ++consumedKeys;
1234  value = lookup;
1235  dumpState = value.toBool();
1236  }
1237 
1238  // Center Ground:
1239  lookup = m_kwl.find( CENTER_GROUND_KW );
1240  if ( lookup )
1241  {
1242  ++consumedKeys;
1243  value = lookup;
1244  centerGroundFlag = value.toBool();
1245  }
1246 
1247  // Center Image:
1248  lookup = m_kwl.find( CENTER_IMAGE_KW );
1249  if ( lookup )
1250  {
1251  ++consumedKeys;
1252  value = lookup;
1253  centerImageFlag = value.toBool();
1254  }
1255 
1256  // Metadata:
1257  lookup = m_kwl.find( METADATA_KW );
1258  if ( lookup )
1259  {
1260  ++consumedKeys;
1261  value = lookup;
1262  metaDataFlag = value.toBool();
1263  }
1264 
1265  // Palette:
1266  lookup = m_kwl.find( PALETTE_KW );
1267  if ( lookup )
1268  {
1269  ++consumedKeys;
1270  value = lookup;
1271  paletteFlag = value.toBool();
1272  }
1273 
1274  // Image bounds:
1275  lookup = m_kwl.find( IMAGE_BOUNDS_KW );
1276  if ( lookup )
1277  {
1278  ++consumedKeys;
1279  value = lookup;
1280  imageBoundsFlag = value.toBool();
1281  }
1282 
1283  // Image center:
1284  lookup = m_kwl.find( IMAGE_CENTER_KW );
1285  if ( lookup )
1286  {
1287  ++consumedKeys;
1288  value = lookup;
1289  imageCenterFlag = value.toBool();
1290  }
1291 
1292  // Image rect:
1293  lookup = m_kwl.find( IMAGE_RECT_KW );
1294  if ( lookup )
1295  {
1296  ++consumedKeys;
1297  value = lookup;
1298  imageRectFlag = value.toBool();
1299  }
1300 
1301  //---
1302  // General image info:
1303  // Defaulted ON if no image options set.
1304  //---
1305  lookup = m_kwl.find( IMAGE_INFO_KW );
1306  if ( lookup )
1307  {
1308  ++consumedKeys;
1309  value = lookup;
1310  imageInfoFlag = value.toBool();
1311  }
1312 
1313  lookup = m_kwl.find( IMG2GRD_KW );
1314  if ( lookup )
1315  {
1316  ++consumedKeys;
1317  img2grdFlag = true;
1318  }
1319 
1320  lookup = m_kwl.find( GRD2IMG_KW );
1321  if ( lookup )
1322  {
1323  ++consumedKeys;
1324  grd2imgFlag = true;
1325  }
1326 
1327  //---
1328  // Image geometry info:
1329  // Defaulted on if no image options set.
1330  //---
1331  lookup = m_kwl.find( GEOM_INFO_KW );
1332  if ( lookup )
1333  {
1334  ++consumedKeys;
1335  value = lookup;
1336  imageGeomFlag = value.toBool();
1337  }
1338 
1339  // North up:
1340  lookup = m_kwl.find( NORTH_UP_KW );
1341  if ( lookup )
1342  {
1343  ++consumedKeys;
1344  value = lookup;
1345  northUpFlag = value.toBool();
1346  }
1347 
1348  // Up is up:
1349  lookup = m_kwl.find( UP_IS_UP_KW );
1350  if ( lookup )
1351  {
1352  ++consumedKeys;
1353  value = lookup;
1354  upIsUpFlag = value.toBool();
1355  }
1356 
1357  // Up is up:
1358  lookup = m_kwl.find( CAN_OPEN_KW );
1359  if ( lookup )
1360  {
1361  ++consumedKeys;
1362  value = lookup;
1363  canOpenFlag = value.toBool();
1364  }
1365 
1366  // If no options consumed default is image info and geom info:
1367  if ( consumedKeys == 0 )
1368  {
1369  imageInfoFlag = true;
1370  imageGeomFlag = true;
1371  }
1372 
1373  if ( centerGroundFlag || centerImageFlag || imageBoundsFlag || imageCenterFlag ||
1374  imageRectFlag || img2grdFlag || grd2imgFlag || metaDataFlag || paletteFlag ||
1375  imageInfoFlag || imageGeomFlag || northUpFlag || upIsUpFlag || dumpState ||
1376  imageToGroundFlag || groundToImageFlag || canOpenFlag)
1377  {
1378  // Requires open image.
1379  if ( ! m_img )
1380  {
1381  openImage(file);
1382  }
1383 
1384  if( canOpenFlag )
1385  {
1386  if(m_img)
1387  {
1388  okwl.add("can_open", "true", true);
1389  }
1390  else
1391  {
1392  okwl.add("can_open", "false", true);
1393  }
1394  }
1395 
1396  if ( centerGroundFlag )
1397  {
1398  getCenterGround(okwl);
1399  }
1400 
1401  if ( centerImageFlag )
1402  {
1403  getCenterImage(okwl);
1404  }
1405 
1406  if ( imageCenterFlag )
1407  {
1408  // -c option prints both ground and image point of center.
1409  getCenterGround(okwl);
1410  getCenterImage(okwl);
1411  }
1412 
1413  if ( imageBoundsFlag )
1414  {
1415  getImageBounds(okwl);
1416  }
1417 
1418  if ( imageRectFlag )
1419  {
1420  getImageRect(okwl);
1421  }
1422 
1423  if ( img2grdFlag )
1424  {
1425  getImg2grd(okwl);
1426  }
1427  if ( grd2imgFlag )
1428  {
1429  getGrd2img(okwl);
1430  }
1431 
1432  if ( metaDataFlag )
1433  {
1434  getImageMetadata(okwl);
1435  }
1436 
1437  if ( paletteFlag )
1438  {
1439  getImagePalette(okwl);
1440  }
1441 
1442  if ( imageInfoFlag )
1443  {
1444  getImageInfo(okwl, dnoFlag);
1445  }
1446 
1447  if ( imageGeomFlag )
1448  {
1449  getImageGeometryInfo(okwl, dnoFlag);
1450  }
1451 
1452  if ( imageRectFlag )
1453  {
1454  getImageRect(okwl);
1455  }
1456 
1457  if ( northUpFlag )
1458  {
1459  getNorthUpAngle( okwl );
1460  }
1461 
1462  if ( upIsUpFlag )
1463  {
1464  getUpIsUpAngle( okwl );
1465  }
1466 
1467  if(dumpState)
1468  {
1469  if(m_img)
1470  {
1471  if(m_img->getState())
1472  {
1473  m_img->getState()->save(okwl);
1474  }
1475  }
1476  }
1477 
1478  } // if ( metaDataFlag || paletteFlag || imageInfoFlag || imageGeomFlag )
1479 
1480  if ( okwl.getSize() ) // Output section:
1481  {
1482  if ( outputFile == ossimFilename::NIL )
1483  {
1484  // Write to standard out:
1485  if ( !xmlOutFlag )
1486  {
1487  ossimNotify(ossimNotifyLevel_INFO) << okwl << std::endl;
1488  }
1489  else
1490  {
1491  outputXml( okwl );
1492  }
1493  }
1494  else
1495  {
1496  // Write to file:
1497 
1498  if ( !overwriteFlag && outputFile.exists() )
1499  {
1501  << "ERROR: File already exists: " << outputFile
1502  << "\nUse -v option to overwrite."
1503  << std::endl;
1504  }
1505  else
1506  {
1507  if ( !xmlOutFlag )
1508  {
1509  okwl.write( outputFile );
1510  }
1511  else
1512  {
1513  outputXml( okwl, outputFile );
1514  }
1515  }
1516  }
1517 
1518  } // if ( okwl )
1519 
1520 
1521  if ( traceDebug() )
1522  {
1524  << "consumedKeys: " << consumedKeys << "\n"
1525  << M << " exited...\n";
1526  }
1527 
1528  return consumedKeys;
1529 
1530 } // ossim_uint32 ossimInfo::executeImageOptions(const ossimFilename& file)
1531 
1533  bool dumpFlag,
1534  bool dnoFlag,
1535  bool imageGeomFlag,
1536  bool imageInfoFlag,
1537  bool metaDataFlag,
1538  bool paletteFlag,
1539  ossimKeywordlist& kwl ) const
1540 {
1541  if ( dumpFlag || dnoFlag )
1542  {
1543  dumpImage(file, dnoFlag, kwl);
1544  }
1545 
1546  // These flags requires open image.
1547  if ( imageGeomFlag || imageInfoFlag || metaDataFlag || paletteFlag )
1548  {
1549  // Note: openImageHandler throws ossimException if it can't open.
1551  if ( ih.valid() )
1552  {
1553  if ( metaDataFlag )
1554  {
1555  getImageMetadata( ih.get(), kwl );
1556  }
1557  if ( paletteFlag )
1558  {
1559  getImagePalette( ih.get(), kwl );
1560  }
1561  if ( imageInfoFlag )
1562  {
1563  getImageInfo( ih.get(), kwl, dnoFlag );
1564  }
1565  if ( imageGeomFlag )
1566  {
1567  getImageGeometryInfo( ih.get(), kwl, dnoFlag) ;
1568  }
1569  }
1570  }
1571 }
1572 
1574  ossim_uint32 entry,
1575  ossimKeywordlist& kwl ) const
1576 {
1577  bool result = false;
1578 
1579  // Note: openImageHandler throws ossimException if it can't open.
1581  if ( ih.valid() )
1582  {
1583  if ( ih->setCurrentEntry( entry ) )
1584  {
1585  if ( getImageInfo( ih.get(), entry, kwl, false ) )
1586  {
1587  result = getImageGeometryInfo( ih.get(), entry, kwl, false );
1588  }
1589  }
1590  else
1591  {
1592  std::ostringstream errMsg;
1593  errMsg << "ossimInfo::getImageInfo ERROR:\nInvalid entry: " << entry
1594  << "\n";
1595  throw ossimException( errMsg.str() );
1596  }
1597  }
1598 
1599  return result;
1600 }
1601 
1603 {
1604  if(file.ext().downcase()=="kwl")
1605  {
1606  openImageFromState(file);
1607  }
1608  else
1609  {
1610  m_img = openImageHandler( file );
1611  }
1612 }
1613 
1615 {
1616  std::shared_ptr<ossim::ImageHandlerState> state;
1617  ossimKeywordlist kwl;
1618  if(kwl.addFile(file))
1619  {
1620  state = ossim::ImageHandlerStateRegistry::instance()->createState(kwl);
1621  if(state)
1622  {
1624  }
1625  }
1626 }
1627 
1628 
1630 {
1632  if(file.ext().downcase()=="kwl")
1633  {
1634  std::shared_ptr<ossim::ImageHandlerState> state;
1635  ossimKeywordlist kwl;
1636  if(kwl.addFile(file))
1637  {
1638  state = ossim::ImageHandlerStateRegistry::instance()->createState(kwl);
1639  if(state)
1640  {
1641  result = ossimImageHandlerRegistry::instance()->open(state);
1642  }
1643  }
1644  }
1645  else
1646  {
1647  // Go through new interface that passes a stream around. (drb 10 Nov. 2016)
1648  // ossimRefPtr<ossimImageHandler> result = ossimImageHandlerRegistry::instance()->open(file);
1650  openConnection(file);
1651  }
1652  // only throw an exception if the can-open option
1653  // is not specified
1654  ossimString canOpenFlag = m_kwl.find("can_open");
1655  if ( !result.valid() && !canOpenFlag.toBool())
1656  {
1657  std::string errMsg = "ossimInfo::openImage ERROR:\nCould not open: ";
1658  errMsg += file.string();
1659  throw ossimException(errMsg);
1660  }
1661  return result;
1662 }
1663 
1665 {
1666  m_img = 0;
1667 }
1668 
1670 {
1671  return m_img;
1672 }
1673 
1674 void ossimInfo::prettyPrint(const ossimFilename& file) const
1675 {
1676  std::shared_ptr<ossimInfoBase> info = ossimInfoFactoryRegistry::instance()->create(file);
1677  if (info)
1678  {
1679  //---
1680  // Old -d behavior was to dump all unless the dump no overview flag
1681  // was set. Need to see tiff tags in file order for all image file
1682  // directories(ifd's) so commenting out hard coded
1683  // info->setProcessOverviewFlag(false) that used to be settable with -d
1684  // + --dno options. Note the old -d option used to do file order for
1685  // tiffs but now dumps to a keyword list that prints alphabetical(not
1686  // file order) so can't use that anymore.
1687  //
1688  // drb - 15 Dec. 2016
1689  //---
1690  // info->setProcessOverviewFlag(false);
1691 
1692  info->print(ossimNotify(ossimNotifyLevel_INFO));
1693  info.reset();
1694  }
1695  else
1696  {
1698  << "No print available for: " << file.c_str() << std::endl;
1699  }
1700 }
1701 
1703  bool dnoFlag,
1704  ossimKeywordlist& kwl) const
1705 {
1706  std::shared_ptr<ossimInfoBase> info = ossimInfoFactoryRegistry::instance()->create(file);
1707  if (info)
1708  {
1709  if (dnoFlag) // Default info processes overviews.
1710  {
1711  info->setProcessOverviewFlag(false);
1712  }
1713  info->getKeywordlist(kwl);
1714  info.reset();
1715  }
1716  else
1717  {
1719  << "No dump available for: " << file.c_str() << std::endl;
1720  }
1721 }
1723 {
1724  if ( m_img.valid() )
1725  {
1726  getImageMetadata( m_img.get(), kwl);
1727  }
1728 }
1729 
1731 {
1732  if ( ih )
1733  {
1734  std::vector< ossimRefPtr< ossimProperty > > list;
1735  ih->getPropertyList(list);
1736  std::vector< ossimRefPtr< ossimProperty > >::const_iterator i = list.begin();
1737  while (i != list.end())
1738  {
1739  if ( (*i).valid() )
1740  {
1741  ossimString key;
1742  ossimString value;
1743 
1744  // Check for one level of nested container.
1745  if ((*i)->getClassName() == "ossimContainerProperty")
1746  {
1748  if (ptr)
1749  {
1750  std::vector< ossimRefPtr< ossimProperty > > list2;
1751  ptr->getPropertyList(list2);
1752 
1753  std::vector< ossimRefPtr< ossimProperty > >::const_iterator i2 = list2.begin();
1754  while (i2 != list2.end())
1755  {
1756  key = (*i2)->getName();
1757  value = (*i2)->valueToString();
1758  kwl.add(key.c_str(), value.c_str(), true);
1759  ++i2;
1760  }
1761  }
1762  }
1763  else // Not a container.
1764  {
1765  key = (*i)->getName();
1766  value = (*i)->valueToString();
1767  kwl.add(key.c_str(), value.c_str(), true);
1768  }
1769  }
1770  ++i;
1771  }
1772 
1773  } // if ( ih )
1774 
1775 } // End: getImageMetadata(ossimImageHandler* ih, ossimKeywordlist& kwl)
1776 
1778 {
1779  if ( m_img.valid() )
1780  {
1781  getImagePalette( m_img.get(), kwl );
1782  }
1783 }
1784 
1786 {
1787  if ( ih )
1788  {
1789  if(ih->getLut().valid())
1790  {
1791  ossim_uint32 entryIdx = 0;
1792  std::vector<ossim_uint32> entryList;
1793  ih->getEntryList(entryList);
1794  for(entryIdx = 0; entryIdx < ih->getNumberOfEntries();++entryIdx)
1795  {
1796  ih->setCurrentEntry(entryList[entryIdx]);
1797  ossimString prefix = "image";
1798  prefix = prefix + ossimString::toString(entryList[entryIdx]) + ".lut.";
1799  if(ih->getLut().valid())
1800  {
1801  ih->getLut()->saveState(kwl, prefix);
1802  }
1803  }
1804  }
1805 
1806  } // if ( ih )
1807 }
1808 
1810 {
1811  if ( m_img.valid() )
1812  {
1813  getImageInfo( m_img.get(), kwl, dnoFlag );
1814  }
1815 }
1816 
1817 void ossimInfo::getImageInfo( ossimImageHandler* ih, ossimKeywordlist& kwl, bool dnoFlag ) const
1818 {
1819  if ( ih )
1820  {
1821  ossim_uint32 numEntries = 0;
1822 
1823  std::vector<ossim_uint32> entryList;
1824  ih->getEntryList(entryList);
1825 
1826  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
1827  while ( i != entryList.end() )
1828  {
1829  if ( getImageInfo( ih, (*i), kwl, dnoFlag ) )
1830  {
1831  ++numEntries;
1832  }
1833  ++i;
1834  }
1835 
1836  kwl.add(ossimKeywordNames::NUMBER_ENTRIES_KW, numEntries, true);
1837 
1838  } // if ( ih )
1839 }
1840 
1841 bool ossimInfo::getImageInfo( ossim_uint32 entry, ossimKeywordlist& kwl, bool dnoFlag )
1842 {
1843  bool result = false;
1844  if ( m_img.valid() )
1845  {
1846  result = getImageInfo( m_img.get(), entry, kwl, dnoFlag );
1847  }
1848  return result;
1849 }
1850 
1852  ossimKeywordlist& kwl, bool dnoFlag ) const
1853 {
1854  bool result = false;
1855 
1856  if ( ih )
1857  {
1858  if ( ih->setCurrentEntry(entry) )
1859  {
1860  bool outputEntry = true;
1861  if ( dnoFlag )
1862  {
1863  if ( isImageEntryOverview() )
1864  {
1865  outputEntry = false;
1866  }
1867  }
1868 
1869  if ( outputEntry )
1870  {
1871  result = true;
1872 
1873  // Entry number:
1874  ossimString prefix = "image";
1875  prefix = prefix + ossimString::toString(entry) + ".";
1876  kwl.add(prefix.c_str(), ossimKeywordNames::ENTRY_KW, entry, true);
1877 
1878  // Get the entry_name (specialized multi-entry readers only):
1879  std::string entryName;
1880  ih->getEntryName( entry, entryName );
1881  if ( entryName.size() )
1882  {
1883  kwl.add(prefix.c_str(), "entry_name", entryName.c_str(), true);
1884  }
1885 
1886  // Type/class of reader:
1887  kwl.add(prefix, "type", ih->getClassName().c_str(), true);
1888 
1889  // Add RGB bands if available:
1890  getRgbBands( ih, entry, kwl );
1891 
1892  // Driver name if different from class name:
1893  if ( ih->getClassName() != ih->getShortName() )
1894  {
1895  kwl.add(prefix, "driver", ih->getShortName().c_str(), true);
1896  }
1897 
1898  // Type/class of overview reader:
1899  if (ih->getOverview())
1900  {
1901  kwl.add(prefix, "overview.type",
1902  ih->getOverview()->getClassName().c_str(), true);
1903  }
1904 
1905  ossimDrect boundingRect = ih->getBoundingRect();
1906  kwl.add(prefix,ossimKeywordNames::UL_X_KW, boundingRect.ul().x, true);
1907  kwl.add(prefix,ossimKeywordNames::UL_Y_KW, boundingRect.ul().y, true);
1908  kwl.add(prefix,ossimKeywordNames::LR_X_KW, boundingRect.lr().x, true);
1909  kwl.add(prefix,ossimKeywordNames::LR_Y_KW, boundingRect.lr().y, true);
1910 
1911  const ossim_uint32 BANDS = ih->getNumberOfInputBands();
1912  kwl.add(prefix,ossimKeywordNames::NUMBER_INPUT_BANDS_KW, BANDS, true);
1914  ih->getNumberOfOutputBands(), true);
1916  boundingRect.height(), true);
1918  boundingRect.width(), true);
1919 
1920  ossimScalarType scalar = ih->getOutputScalarType();
1921 
1922  for(ossim_uint32 i = 0; i < BANDS; ++i)
1923  {
1924  ossimString band = ossimString("band") + ossimString::toString(i) + ".";
1925 
1926  kwl.add(prefix, band+"null_value", ih->getNullPixelValue(i), true);
1927  kwl.add(prefix, band+"min_value", ih->getMinPixelValue(i), true);
1928  kwl.add(prefix, band+"max_value", ih->getMaxPixelValue(i), true);
1929  }
1930 
1931  // Output Radiometry.
1932  std::string rad;
1933  getRadiometry(scalar, rad);
1934  kwl.add(prefix, "radiometry", rad.c_str(), true);
1935  kwl.add(prefix,"number_decimation_levels", ih->getNumberOfDecimationLevels(), true);
1936 
1937 
1938 
1939  } // if ( outputEntry )
1940 
1941  } // if ( ih->setCurrentEntry(entry) )
1942 
1943  } // if ( ih )
1944 
1945  return result;
1946 
1947 } // End: ossimInfo::getImageInfo( ih, entry...
1948 
1950 {
1951  if ( m_img.valid() )
1952  {
1953  getImageGeometryInfo( m_img.get(), kwl, dnoFlag );
1954  }
1955 }
1956 
1958 {
1959  if ( ih )
1960  { ossim_uint32 numEntries = 0;
1961 
1962  std::vector<ossim_uint32> entryList;
1963  ih->getEntryList(entryList);
1964 
1965  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
1966  while ( i != entryList.end() )
1967  {
1968  if ( getImageGeometryInfo( ih, (*i), kwl, dnoFlag ) )
1969  {
1970  ++numEntries;
1971  }
1972  ++i;
1973  }
1974 
1975  kwl.add(ossimKeywordNames::NUMBER_ENTRIES_KW, numEntries, true);
1976 
1977  } // if ( ih )
1978 }
1979 
1981 {
1982  bool result = false;
1983  if ( m_img.valid() )
1984  {
1985  getImageGeometryInfo( m_img.get(), entry, kwl, dnoFlag );
1986  }
1987  return result;
1988 }
1989 
1991  ossim_uint32 entry,
1992  ossimKeywordlist& kwl,
1993  bool dnoFlag) const
1994 {
1995  bool result = false;
1996 
1997  if ( ih )
1998  {
1999  if ( ih->setCurrentEntry(entry) )
2000  {
2001  bool outputEntry = true;
2002  if ( dnoFlag )
2003  {
2004  if ( isImageEntryOverview() )
2005  {
2006  outputEntry = false;
2007  }
2008  }
2009 
2010  if ( outputEntry )
2011  {
2013  if(geom.valid())
2014  {
2015  result = true;
2016 
2017  ossimString prefix = "image";
2018  prefix = prefix + ossimString::toString(entry) + ossimString(".geometry.");
2019 
2020  geom->saveState(kwl, prefix);
2021 
2022  // Output support files list:
2023  ossimSupportFilesList::instance()->save(kwl, prefix);
2024 
2025  ossimGpt ulg;
2026  ossimGpt llg;
2027  ossimGpt lrg;
2028  ossimGpt urg;
2029 
2030  ossimDrect outputRect = ih->getBoundingRect();
2031 
2032  geom->localToWorld(outputRect.ul(), ulg);
2033  geom->localToWorld(outputRect.ll(), llg);
2034  geom->localToWorld(outputRect.lr(), lrg);
2035  geom->localToWorld(outputRect.ur(), urg);
2036 
2037  //---
2038  // *** HACK ***
2039  // Encountered CADRG RPF imagery where the left edge was longitude -180 and
2040  // right edge +180. The projection code above reasonably maps all -180 to +180.
2041  // This however breaks the image footprint since it would appear that the left
2042  // and right edges were coincident instead of 360 degrees apart, i.e., a line
2043  // segment instead of a rect. So added check here for coincident left and right
2044  // edges and remapping left edge to -180.
2045  //---
2046  if ((ulg.lon == 180.0) && (urg.lon == 180.0))
2047  {
2048  ulg.lon = -180.0;
2049  }
2050  if ((llg.lon == 180.0) && (lrg.lon == 180.0))
2051  {
2052  llg.lon = -180.0;
2053  }
2054 
2055  kwl.add(prefix, "ul_lat", ulg.latd(), true);
2056  kwl.add(prefix, "ul_lon", ulg.lond(), true);
2057  kwl.add(prefix, "ll_lat", llg.latd(), true);
2058  kwl.add(prefix, "ll_lon", llg.lond(), true);
2059  kwl.add(prefix, "lr_lat", lrg.latd(), true);
2060  kwl.add(prefix, "lr_lon", lrg.lond(), true);
2061  kwl.add(prefix, "ur_lat", urg.latd(), true);
2062  kwl.add(prefix, "ur_lon", urg.lond(), true);
2063 
2065  {
2066  kwl.add(prefix, ossimKeywordNames::TIE_POINT_LAT_KW, ulg.latd(), true);
2067  kwl.add(prefix, ossimKeywordNames::TIE_POINT_LON_KW, ulg.lond(), true);
2068 
2069  if ( outputRect.height()-1.0 > DBL_EPSILON )
2070  {
2072  fabs(ulg.latd()-llg.latd())/(outputRect.height()-1.0), true);
2073  }
2074 
2075  if ( outputRect.width()-1.0 > DBL_EPSILON )
2076  {
2078  fabs(ulg.lond()-urg.lond())/(outputRect.width()-1.0), true);
2079  }
2080  }
2081 
2082  ossimDpt gsd = geom->getMetersPerPixel();
2083  kwl.add(prefix, ossimKeywordNames::METERS_PER_PIXEL_X_KW, gsd.x, true);
2084  kwl.add(prefix, ossimKeywordNames::METERS_PER_PIXEL_Y_KW, gsd.y, true);
2085 
2086  } // if(geom.valid())
2087 
2088  } // if ( outputEntry )
2089 
2090  } // if ( ih->setCurrentEntry(entry) )
2091 
2092  if ( !result )
2093  {
2095  << "No geometry for file " << ih->getFilename() << std::endl;
2096  }
2097 
2098  } // if ( ih )
2099 
2100  return result;
2101 
2102 } // End: ossimInfo::getImageGeometryInfo( ih, entry...
2103 
2105 {
2106  if ( m_img.valid() )
2107  {
2108  getCenterImage( m_img.get(), kwl );
2109  }
2110 }
2111 
2113 {
2114  if ( ih )
2115  {
2116  std::vector<ossim_uint32> entryList;
2117  ih->getEntryList(entryList);
2118 
2119  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
2120  while ( i != entryList.end() )
2121  {
2122  getCenterImage( ih, (*i), kwl );
2123  ++i;
2124  }
2125  }
2126 }
2127 
2129  ossim_uint32 entry,
2130  ossimKeywordlist& kwl ) const
2131 {
2132  if ( ih )
2133  {
2134  if ( ih->setCurrentEntry(entry) )
2135  {
2136  ossimString prefix = "image";
2137  prefix = prefix + ossimString::toString(entry) + ".";
2138  ossimDrect bounds = ih->getBoundingRect();
2139 
2140  if( !bounds.hasNans() )
2141  {
2142  ossimDpt iPt = bounds.midPoint();
2143  kwl.add(prefix, "center_image", iPt.toString().c_str(), true);
2144  }
2145 
2146  } // if ( ih->setCurrentEntry(entry) )
2147  else
2148  {
2150  << "Could not get image center for: " << ih->getFilename() << std::endl;
2151  }
2152 
2153  } // if ( ih )
2154 }
2155 
2157 {
2158  if ( m_img.valid() )
2159  {
2160  getCenterGround( m_img.get(), kwl );
2161  }
2162 }
2163 
2165 {
2166  if ( ih )
2167  {
2168  std::vector<ossim_uint32> entryList;
2169  ih->getEntryList(entryList);
2170 
2171  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
2172  while ( i != entryList.end() )
2173  {
2174  getCenterGround( ih, (*i), kwl );
2175  ++i;
2176  }
2177  }
2178 }
2179 
2181  ossim_uint32 entry,
2182  ossimKeywordlist& kwl ) const
2183 {
2184  if ( ih )
2185  {
2186  if ( ih->setCurrentEntry(entry) )
2187  {
2188  ossimString prefix = "image";
2189  prefix = prefix + ossimString::toString(entry) + ".";
2190 
2192  if(geom.valid())
2193  {
2194  ossimDrect bounds;
2195  geom->getBoundingRect( bounds );
2196 
2197  if( !bounds.hasNans() )
2198  {
2199  ossimDpt iPt = bounds.midPoint();
2200  ossimGpt gPt;
2201  geom->localToWorld(iPt, gPt);
2202  kwl.add(prefix, "center_ground", gPt.toString().c_str(), true);
2203  }
2204  }
2205 
2206  } // if ( ih->setCurrentEntry(entry) )
2207  else
2208  {
2210  << "Could not get ground center for: " << ih->getFilename() << std::endl;
2211  }
2212 
2213  } // if ( ih )
2214 }
2215 
2217 {
2218  if ( m_img.valid() )
2219  {
2220  getImageBounds( m_img.get(), kwl );
2221  }
2222 }
2223 
2225 {
2226  if ( ih )
2227  {
2228  std::vector<ossim_uint32> entryList;
2229  ih->getEntryList(entryList);
2230 
2231  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
2232  while ( i != entryList.end() )
2233  {
2234  getImageBounds( ih, (*i), kwl );
2235  ++i;
2236  }
2237  }
2238 }
2239 
2241  ossim_uint32 entry,
2242  ossimKeywordlist& kwl ) const
2243 {
2244  if ( ih )
2245  {
2246  if ( ih->setCurrentEntry(entry) )
2247  {
2248  ossimString prefix = "image";
2249  prefix = prefix + ossimString::toString(entry) + ".bounds.";
2250 
2252  if(geom.valid())
2253  {
2254  ossimDrect bounds;
2255  geom->getBoundingRect( bounds );
2256 
2257  // Make edge to edge.
2258  bounds.expand( ossimDpt(0.5, 0.5) );
2259 
2260  if( !bounds.hasNans() )
2261  {
2262  ossimGpt gPt;
2263 
2264  geom->localToWorld(bounds.ul(), gPt);
2265  kwl.add(prefix, "ul", gPt.toString().c_str(), true);
2266 
2267  geom->localToWorld(bounds.ur(), gPt);
2268  kwl.add(prefix, "ur", gPt.toString().c_str(), true);
2269 
2270  geom->localToWorld(bounds.lr(), gPt);
2271  kwl.add(prefix, "lr", gPt.toString().c_str(), true);
2272 
2273  geom->localToWorld(bounds.ll(), gPt);
2274  kwl.add(prefix, "ll", gPt.toString().c_str(), true);
2275  }
2276  }
2277 
2278  } // if ( ih->setCurrentEntry(entry) )
2279  else
2280  {
2282  << "Could not get image bounds for: " << ih->getFilename() << std::endl;
2283  }
2284 
2285  } // if ( ih )
2286 }
2287 
2289 {
2290  if ( m_img.valid() )
2291  {
2292  getImg2grd( m_img.get(), kwl );
2293  }
2294 }
2295 
2297 {
2298  if ( ih )
2299  {
2300  std::vector<ossim_uint32> entryList;
2301  ih->getEntryList(entryList);
2302 
2303  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
2304  while ( i != entryList.end() )
2305  {
2306  getImg2grd( ih, (*i), kwl );
2307  ++i;
2308  }
2309  }
2310 }
2311 
2313  ossim_uint32 entry,
2314  ossimKeywordlist& kwl ) const
2315 {
2316  if ( ih )
2317  {
2318  if ( ih->setCurrentEntry(entry) )
2319  {
2320  ossimString prefix = "image";
2321  prefix = prefix + ossimString::toString(entry) + ".";
2322 
2324  if(geom.valid())
2325  {
2326 
2327  ossimDrect bounds;
2328  geom->getBoundingRect( bounds );
2329 
2330  if( !bounds.hasNans() )
2331  {
2332  //---
2333  // Expand the bounds out to edge of image so caller can do:
2334  // ossim-info --img2grd -0.5 -0.5 <image.tif>
2335  //---
2336  bounds.expand( ossimDpt(0.5, 0.5) );
2337  std::string value = m_kwl.findKey( IMG2GRD_KW );
2338  if ( value.size() )
2339  {
2340  ossimDpt ipt;
2341  ipt.toPoint( value );
2342  if ( bounds.pointWithin( ipt ) )
2343  {
2344  ossimGpt gpt;
2345  gpt.makeNan();
2346  geom->localToWorld(ipt, gpt);
2347  kwl.add(prefix, "ground_point", gpt.toString().c_str(), true);
2348  }
2349  else
2350  {
2351  kwl.add(prefix, "ground_point", "nan", true);
2352  }
2353  }
2354  }
2355  }
2356 
2357  } // if ( ih->setCurrentEntry(entry) )
2358  else
2359  {
2361  << "Could not get ground center for: " << ih->getFilename() << std::endl;
2362  }
2363 
2364  } // if ( ih )
2365 }
2366 
2368 {
2369  if ( m_img.valid() )
2370  {
2371  getGrd2img( m_img.get(), kwl );
2372  }
2373 }
2374 
2376 {
2377  if ( ih )
2378  {
2379  std::vector<ossim_uint32> entryList;
2380  ih->getEntryList(entryList);
2381 
2382  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
2383  while ( i != entryList.end() )
2384  {
2385  getGrd2img( ih, (*i), kwl );
2386  ++i;
2387  }
2388  }
2389 }
2390 
2392  ossim_uint32 entry,
2393  ossimKeywordlist& kwl ) const
2394 {
2395  if ( ih )
2396  {
2397  if ( ih->setCurrentEntry(entry) )
2398  {
2399  ossimString prefix = "image";
2400  prefix = prefix + ossimString::toString(entry) + ".";
2401 
2403  if(geom.valid())
2404  {
2405  std::string value = m_kwl.findKey( GRD2IMG_KW );
2406  if ( value.size() )
2407  {
2408  ossimGpt gpt;
2409  ossimDpt dpt;
2410  gpt.toPoint( value );
2411  dpt.makeNan();
2412  geom->worldToLocal(gpt, dpt);
2413  kwl.add(prefix, "image_point", dpt.toString().c_str(), true);
2414  }
2415  }
2416 
2417  } // if ( ih->setCurrentEntry(entry) )
2418  else
2419  {
2421  << "Could not get ground center for: " << ih->getFilename() << std::endl;
2422  }
2423 
2424  } // if ( ih )
2425 }
2426 
2428 {
2429  if ( m_img.valid() )
2430  {
2431  getUpIsUpAngle( m_img.get(), kwl );
2432  }
2433 }
2434 
2436 {
2437  if ( ih )
2438  {
2439  std::vector<ossim_uint32> entryList;
2440  ih->getEntryList(entryList);
2441 
2442  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
2443  while ( i != entryList.end() )
2444  {
2445  getUpIsUpAngle( ih, (*i), kwl );
2446  ++i;
2447  }
2448  }
2449 }
2450 
2452 {
2453  if ( m_img.valid() )
2454  {
2455  getUpIsUpAngle( m_img.get(), entry, kwl );
2456  }
2457 }
2458 
2460  ossim_uint32 entry,
2461  ossimKeywordlist& kwl ) const
2462 {
2463  if ( ih )
2464  {
2465  bool result = false;
2466 
2467  if ( ih->setCurrentEntry(entry) )
2468  {
2469  ossimString prefix = "image";
2470  prefix = prefix + ossimString::toString(entry) + ".";
2471 
2473  if(geom.valid())
2474  {
2475  ossim_float64 upIsUp = 0.0;
2476  if ( geom->isAffectedByElevation() )
2477  {
2478  ossimDpt imagePt;
2479  imagePt.makeNan();
2480  ossimString lookup = m_kwl.find(UP_IS_UP_GPT_KW);
2481  if(!lookup.empty())
2482  {
2483  std::istringstream in(lookup.c_str());
2484  ossim_float64 lat,lon;
2485  in>>lat>>lon;
2486  ossimGpt gpt(lat,lon);
2487  geom->worldToLocal(gpt, imagePt);
2488  }
2489  else
2490  {
2491  lookup = m_kwl.find(UP_IS_UP_IPT_KW);
2492  if(!lookup.empty())
2493  {
2494  std::istringstream in(lookup.c_str());
2495  ossim_float64 x,y;
2496  in>>x>>y;
2497  imagePt = ossimDpt(x,y);
2498  }
2499  }
2500  upIsUp = geom->upIsUpAngle(imagePt);
2501  kwl.add(prefix, UP_IS_UP_KW, upIsUp, true);
2502  }
2503  }
2504 
2505  result = true;
2506 
2507  } // if ( ih->setCurrentEntry(entry) )
2508 
2509  if ( !result )
2510  {
2512  << "Could not get up is up angle for: " << ih->getFilename() << std::endl;
2513  }
2514 
2515  } // if ( ih )
2516 }
2517 
2518 
2520 {
2521  if ( m_img.valid() )
2522  {
2523  getNorthUpAngle( m_img.get(), kwl );
2524  }
2525 }
2526 
2528 {
2529  if ( ih )
2530  {
2531  std::vector<ossim_uint32> entryList;
2532  ih->getEntryList(entryList);
2533 
2534  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
2535  while ( i != entryList.end() )
2536  {
2537  getNorthUpAngle( ih, (*i), kwl );
2538  ++i;
2539  }
2540  }
2541 }
2542 
2544 {
2545  if ( m_img.valid() )
2546  {
2547  getNorthUpAngle( m_img.get(), entry, kwl );
2548  }
2549 }
2550 
2552  ossim_uint32 entry,
2553  ossimKeywordlist& kwl ) const
2554 {
2555  if ( ih )
2556  {
2557  bool result = false;
2558 
2559  if ( ih->setCurrentEntry(entry) )
2560  {
2561  ossimString prefix = "image";
2562  prefix = prefix + ossimString::toString(entry) + ".";
2563 
2565  if(geom.valid())
2566  {
2567  ossim_float64 northUp = geom->northUpAngle();
2568  kwl.add(prefix, NORTH_UP_KW, northUp, true);
2569  }
2570 
2571  result = true;
2572 
2573  } // if ( ih->setCurrentEntry(entry) )
2574 
2575  if ( !result )
2576  {
2578  << "Could not get north up angle for: " << ih->getFilename() << std::endl;
2579  }
2580 
2581  } // if ( ih )
2582 }
2583 
2585 {
2586  if ( m_img.valid() )
2587  {
2588  getImageRect( m_img.get(), kwl );
2589  }
2590 }
2591 
2593 {
2594  if ( ih )
2595  {
2596  std::vector<ossim_uint32> entryList;
2597  ih->getEntryList(entryList);
2598 
2599  std::vector<ossim_uint32>::const_iterator i = entryList.begin();
2600  while ( i != entryList.end() )
2601  {
2602  getImageRect( ih, (*i), kwl );
2603  ++i;
2604  }
2605  } // if ( ih )
2606 }
2607 
2609  ossimImageHandler* ih, ossim_uint32 entry, ossimKeywordlist& kwl ) const
2610 {
2611  bool result = false;
2612  if ( ih )
2613  {
2614  std::vector<ossim_uint32> bandList;
2615  result = ih->getRgbBandList( bandList );
2616  if ( result && ( bandList.size() == 3 ) )
2617  {
2618  ossimString os;
2619  ossim::toSimpleStringList<ossim_uint32>(os, bandList);
2620  if ( os.size() )
2621  {
2622  ossimString prefix = "image";
2623  prefix = prefix + ossimString::toString(entry) + ".";
2624  kwl.add(prefix, "rgb_bands", os.c_str(), true);
2625  }
2626  }
2627  }
2628  return result;
2629 
2630 } // End: ossimInfo::getRgbBands( ... )
2631 
2633 {
2634  if ( m_img.valid() )
2635  {
2636  getImageRect( m_img.get(), entry, kwl );
2637  }
2638 }
2639 
2641  ossim_uint32 entry,
2642  ossimKeywordlist& kwl ) const
2643 {
2644  if ( ih )
2645  {
2646  if ( ih->setCurrentEntry(entry) )
2647  {
2648  ossimString prefix = "image";
2649  prefix = prefix + ossimString::toString(entry) + ".";
2650  ossimIrect outputRect = ih->getBoundingRect();
2651  kwl.add(prefix, "image_rectangle", outputRect.toString().c_str(), true);
2652 
2653  } // if ( ih->setCurrentEntry(entry) )
2654  else
2655  {
2657  << "Could not get image rectangle for: " << ih->getFilename() << std::endl;
2658  }
2659 
2660  } // if ( ih )
2661 
2662 } // End: getImageRect( ih, entry...
2663 
2664 // Note be sure to m_img->setCurrentEntry before calling.
2666 {
2667  bool result = false; // Have to prove it.
2668  if ( m_img.valid() )
2669  {
2670  result = isImageEntryOverview( m_img.get() );
2671  }
2672  return result;
2673 }
2674 
2676 {
2677  bool result = false; // Have to prove it.
2678  if ( ih )
2679  {
2680  ossimString s = "imag";
2682  if (prop.valid())
2683  {
2684  ossimString s;
2685  prop->valueToString(s);
2686  if (s.toFloat32() < 1.0)
2687  {
2688  result = true;
2689  }
2690  }
2691  }
2692  return result;
2693 }
2694 
2696 {
2698 }
2699 
2701 {
2702  out << "\npreferences_keyword_file: "
2704  << "preferences_keyword_list:\n"
2706  << std::endl;
2707  return out;
2708 }
2709 
2710 void ossimInfo::printFactories(bool keywordListFlag)const
2711 {
2712  std::vector<ossimString> typeList;
2714  for(int i = 0; i < (int)typeList.size(); ++i)
2715  {
2716  if(keywordListFlag)
2717  {
2719  if(obj)
2720  {
2721  cout << typeList[i] << endl;
2722  cout << "______________________________________________________" << endl;
2723  ossimKeywordlist kwl;
2724  obj->saveState(kwl);
2725  cout << kwl << endl;
2726  cout << "______________________________________________________" << endl;
2727  delete obj;
2728  }
2729  }
2730  else
2731  {
2732  cout << typeList[i] << endl;
2733  }
2734  }
2735 }
2736 
2738 {
2740 }
2741 
2743 {
2744  // Capture the original flags.
2745  std::ios_base::fmtflags f = out.flags();
2746 
2747  std::vector<ossimString> datumList;
2749 
2750  std::vector<ossimString>::const_iterator i = datumList.begin();
2751 
2752  while ( i != datumList.end() )
2753  {
2755  if (datum)
2756  {
2757  if ( datum->ellipsoid() )
2758  {
2759  out << setiosflags(ios::left)
2760  << setw(7)
2761  << datum->code().c_str()
2762  << setw(7)
2763  << datum->epsgCode()
2764  << setw(48)
2765  << datum->name().c_str()
2766  << setw(10)
2767  << "Ellipse:"
2768  << datum->ellipsoid()->name()
2769  << std::endl;
2770  }
2771  else
2772  {
2773  out << "No ellipsoid for code: " << (*i) << std::endl;
2774  }
2775  }
2776  else
2777  {
2778  out << "No datum for code: " << (*i) << std::endl;
2779  }
2780 
2781  ++i;
2782  }
2783 
2784  // Reset flags.
2785  out.setf(f);
2786 
2787  return out;
2788 }
2789 
2791 {
2793 }
2794 
2796 {
2797  std::vector<ossimFontInformation> fontInfoList;
2799 
2800  std::vector<ossimFontInformation>::const_iterator i = fontInfoList.begin();
2801 
2802  while ( i != fontInfoList.end() )
2803  {
2804  out << *(i) << endl;
2805  ++i;
2806  }
2807 
2808  // Get the default:
2810  if ( defaultFont.valid() )
2811  {
2812  out << "default_font: " << defaultFont->getFamilyName() << std::endl;
2813  }
2814 
2815  return out;
2816 }
2817 
2818 void ossimInfo::deg2rad(const ossim_float64& degrees) const
2819 {
2821 }
2822 
2824 {
2825  double radians = degrees * RAD_PER_DEG;
2826 
2827  // Capture the original flags.
2828  std::ios_base::fmtflags f = out.flags();
2829 
2830  out << std::setiosflags(std::ios::fixed) << std::setprecision(15)
2831  << "\n" << degrees << " degrees = "
2832  << radians << " radians.\n" << std::endl;
2833 
2834  // Reset flags.
2835  out.setf(f);
2836 
2837  return out;
2838 }
2839 
2841 {
2842  out << "ECEF: " << ecefPoint.toString() << "\n"
2843  << "lat_lon_height: " << ossimGpt(ecefPoint).toString() << "\n";
2844 
2845  return out;
2846 }
2847 
2848 void ossimInfo::rad2deg(const ossim_float64& radians) const
2849 {
2851 }
2852 
2854 {
2855  double degrees = radians * DEG_PER_RAD;
2856 
2857  // Capture the original flags.
2858  std::ios_base::fmtflags f = out.flags();
2859 
2860  out << std::setiosflags(std::ios::fixed) << std::setprecision(15)
2861  << "\n" << radians << " radians = "
2862  << degrees << " degrees.\n" << std::endl;
2863 
2864  // Reset flags.
2865  out.setf(f);
2866 
2867  return out;
2868 }
2869 
2870 void ossimInfo::ft2mtrs(const ossim_float64& feet, bool us_survey) const
2871 {
2872  ft2mtrs( feet, us_survey, ossimNotify(ossimNotifyLevel_INFO) );
2873 }
2874 
2876  bool us_survey,
2877  std::ostream& out) const
2878 {
2879  ossim_float64 meters = 0.0;
2880  std::string conversionString;
2881  if (us_survey)
2882  {
2883  meters = feet * US_METERS_PER_FT;
2884  conversionString = "0.3048006096";
2885  }
2886  else
2887  {
2888  meters = feet * MTRS_PER_FT;
2889  conversionString = "0.3048";
2890  }
2891 
2892  // Capture the original flags.
2893  std::ios_base::fmtflags f = out.flags();
2894 
2895  out << setiosflags(ios::fixed) << setprecision(15)
2896  << feet << " * " << conversionString << " = "
2897  << meters << " meters." << std::endl;
2898 
2899  // Reset flags.
2900  out.setf(f);
2901 
2902  return out;
2903 }
2904 
2905 void ossimInfo::mtrs2ft(const ossim_float64& meters, bool us_survey) const
2906 {
2907  mtrs2ft(meters, us_survey, ossimNotify(ossimNotifyLevel_INFO));
2908 }
2909 
2911  bool us_survey,
2912  std::ostream& out) const
2913 {
2914  // Capture the original flags.
2915  std::ios_base::fmtflags f = out.flags();
2916 
2917  double feet = 0.0;
2918  std::string conversionString;
2919 
2920  if (us_survey)
2921  {
2922  feet = meters / US_METERS_PER_FT;
2923  conversionString = "0.3048006096";
2924  }
2925  else
2926  {
2927  feet = meters / MTRS_PER_FT;
2928  conversionString = "0.3048";
2929  }
2930 
2931  out << setiosflags(ios::fixed) << setprecision(15)
2932  << meters << " / " << conversionString << " = "
2933  << feet << " feet." << std::endl;
2934 
2935  // Reset flags.
2936  out.setf(f);
2937 
2938  return out;
2939 }
2940 
2941 void ossimInfo::mtrsPerDeg(const ossim_float64& latitude) const
2942 {
2944 }
2945 
2947 {
2948  ossimGpt gpt(latitude, 0.0);
2949  ossimDpt mpd = gpt.metersPerDegree();
2950  ossim_float64 radius = gpt.datum()->ellipsoid()->geodeticRadius(latitude);
2951  ossim_float64 arcLengthLat = mpd.y/60.0;
2952  ossim_float64 arcLengthLon = mpd.x/60.0;
2953  out << setiosflags(ios::fixed) << setprecision(15)
2954  << "Meters per degree and minute at latitude of " << latitude << ":\n"
2955  << "Meters per degree latitude: "
2956  << setw(20) << mpd.y << "\n"
2957  << "Meters per degree longitude: "
2958  << setw(20) << mpd.x << "\n"
2959  << "Meters per minute latitude: "
2960  << setw(20) << arcLengthLat << "\n"
2961  << "Meters per minute longitude: "
2962  << setw(20) << arcLengthLon << "\n"
2963  << "Geodetic radius: "
2964  << setw(20) << radius << "\n"
2965  << std::endl;
2966  return out;
2967 }
2968 
2969 void ossimInfo::outputHeight(const ossimGpt& gpt) const
2970 {
2972 }
2973 
2975 {
2976  // Capture the original flags.
2977  std::ios_base::fmtflags f = out.flags();
2978 
2979  // Handle wrap conditions.
2980  ossimGpt copyGpt = gpt;
2981  copyGpt.wrap();
2982 
2984  ossim_float64 hgtAboveEllipsoid =
2987  ossim_float64 mslOffset = 0.0;
2988 
2989  if(ossim::isnan(hgtAboveEllipsoid)||ossim::isnan(hgtAboveMsl))
2990  {
2991  mslOffset = ossim::nan();
2992  }
2993  else
2994  {
2995  mslOffset = hgtAboveEllipsoid - hgtAboveMsl;
2996  }
2997 
2998  std::vector<ossimFilename> cellList;
3000 
3001  if (!cellList.empty())
3002  {
3003  out << "Opened cell: " << cellList[0] << "\n";
3004  }
3005  else
3006  {
3007  out << "Did not find cell for point: " << gpt << "\n";
3008  }
3009 
3010  out << "MSL to ellipsoid delta: ";
3011  if (!ossim::isnan(mslOffset))
3012  {
3013  out << std::setprecision(15) << mslOffset;
3014  }
3015  else
3016  {
3017  out << "nan";
3018  }
3019  out << "\nHeight above MSL: ";
3020  if (!ossim::isnan(hgtAboveMsl))
3021  {
3022  out << std::setprecision(15) << hgtAboveMsl;
3023  }
3024  else
3025  {
3026  out << "nan";
3027  }
3028  out << "\nHeight above ellipsoid: ";
3029  if (!ossim::isnan(hgtAboveEllipsoid))
3030  {
3031  out << std::setprecision(15) << hgtAboveEllipsoid << "\n";
3032  }
3033  else
3034  {
3035  out << "nan" << "\n";
3036  }
3037  out << "Geoid value: ";
3038 
3039  if (!ossim::isnan(geoidOffset))
3040  {
3041  out << std::setprecision(15) << geoidOffset << std::endl;
3042  }
3043  else
3044  {
3045  out << "nan" << std::endl;
3046  }
3047 
3048  // Reset flags.
3049  out.setf(f);
3050 
3051  return out;
3052 }
3053 
3055 {
3057 }
3058 
3060 {
3063  const vector<ossimString>& list = extList.getList();
3064 
3065  if (list.empty())
3066  {
3067  out << "No image file extensions handled. This should never happen!" << std::endl;
3068  return out;
3069  }
3070 
3071  out<<"\nImage Entensions Supported:"<< endl;
3072  for (const auto& extension : list)
3073  out<<" "<<extension<<endl;
3074 
3075  out<<endl;
3076  return out;
3077 }
3078 
3080 {
3082 }
3083 
3085 {
3086  if(ossimSharedPluginRegistry::instance()->getNumberOfPlugins() > 0)
3087  {
3089  }
3090  else
3091  {
3092  out << "No plugins loaded in the OSSIM core library" << std::endl;
3093  }
3094  return out;
3095 }
3096 
3097 void ossimInfo::testPlugin(const ossimFilename& plugin) const
3098 {
3100 }
3101 
3103 {
3104  if( ossimSharedPluginRegistry::instance()->registerPlugin(plugin.expand()) )
3105  {
3106  out << "Plugin loaded: " << plugin << std::endl;
3107  }
3108  else
3109  {
3110  out << "Unable to load plugin: " << plugin << std::endl;
3111  }
3112  return out;
3113 }
3114 
3116 {
3118 }
3119 
3121 {
3122  out << "\nValid overview types: " << std::endl;
3123 
3124  std::vector<ossimString> outputType;
3125 
3127  std::copy(outputType.begin(),
3128  outputType.end(),
3129  std::ostream_iterator<ossimString>(out, "\t\n"));
3130  return out;
3131 }
3132 
3134 {
3136 }
3137 
3139 {
3140  out << "Projections:\n";
3141 
3142  std::vector<ossimString> list;
3144  getAllTypeNamesFromRegistry(list);
3145 
3146  std::vector<ossimString>::const_iterator i = list.begin();
3147  while ( i != list.end() )
3148  {
3149  out << *i << "\n";
3150  ++i;
3151  }
3152  out << std::endl;
3153 
3154  return out;
3155 }
3156 
3158 {
3160 }
3161 
3163 {
3165 }
3166 
3168 {
3170 }
3171 
3173 {
3174  std::vector<ossimString> list;
3176  f.getFilterTypes(list);
3177  std::vector<ossimString>::const_iterator i = list.begin();
3178  while ( i != list.end() )
3179  {
3180  out << *i << "\n";
3181  ++i;
3182  }
3183  out << std::endl;
3184  return out;
3185 }
3186 
3188 {
3190 }
3191 
3193 {
3195 }
3196 
3198 {
3200 }
3201 
3203 {
3204  // Capture the original flags.
3205  std::ios_base::fmtflags f = out.flags();
3206 
3207  out << setprecision(15)<< setiosflags(std::ios_base::fixed|std::ios_base::right);
3208 
3209  const int MAX_LEVEL = 24;
3210  const double TILE_SIZE = 256.0;
3211  const double EPSG_4326_BOUNDS = 180.0;
3212  const double EPSG_3857_BOUNDS = 40075016.685578488;
3213 
3214  // From: ossim-info --mtrsPerDeg 0.0
3215  const double MTRS_PER_DEGREE_AT_EQUATOR = 111319.490793273565941;
3216 
3217  out << "Notes:\n"
3218  << "tile size: 256\n"
3219  << "dpp = \"degrees per pixel\"\n"
3220  << "mpp = \"meters per pixel\"\n\n";
3221 
3222  // Assuming square pixels, level 0 having (2 x 1) tiles.
3223  double level_0_gsd = EPSG_4326_BOUNDS / TILE_SIZE;
3224  double level_gsd = 0.0;
3225  int i = 0;
3226  int tilesX = 2;
3227  int tilesY = 1;
3228 
3229  out << "EPSG:4326 level info:\n"
3230  << "Note: Assuming square pixels, level 0 having (2x1) tiles.\n"
3231  << "bounds: 360.0 X 180.0\n"
3232  << "level[" << std::setw(2) << std::setfill('0') << i << "] dpp:"
3233  << std::setw(18) << std::setfill(' ') << level_0_gsd
3234  << " equivalent mpp:" << std::setw(22)
3235  << (level_0_gsd * MTRS_PER_DEGREE_AT_EQUATOR)
3236  << " (" << tilesX << "x" << tilesY << ")" << "\n";
3237 
3238  for ( i = 1; i <= MAX_LEVEL; ++i )
3239  {
3240  tilesX = tilesX << 1;
3241  tilesY = tilesY << 1;
3242  level_gsd = level_0_gsd / std::pow( 2.0, i );
3243  out << "level[" << std::setw(2) << std::setfill('0') << i << "] dpp:"
3244  << std::setw(18) << std::setfill(' ') << level_gsd
3245  << " equivalent mpp:" << std::setw(22)
3246  << (level_gsd * MTRS_PER_DEGREE_AT_EQUATOR)
3247  << " (" << tilesX << "x" << tilesY << ")"<< "\n";
3248 
3249  }
3250 
3251  // Assuming square pixels, level 0 having (1 x 1) tiles.
3252  level_0_gsd = EPSG_3857_BOUNDS / TILE_SIZE;
3253  level_gsd = 0.0;
3254  i = 0;
3255  tilesX = 1; // X and y the same.
3256 
3257  out << "\n\nEPSG:3857 level info:\n"
3258  << "Note: Assuming square pixels, level 0 having (1x1) tile.\n"
3259  << "bounds: 40075016.685578488 X 40075016.685578488\n"
3260  << "level[" << std::setw(2) << std::setfill('0') << i << "] mpp:"
3261  << std::setw(23) << std::setfill(' ') << level_0_gsd
3262  << " (" << tilesX << "x" << tilesX << ")" << "\n";
3263 
3264  for ( i = 1; i <= MAX_LEVEL; ++i )
3265  {
3266  tilesX = tilesX << 1;
3267  level_gsd = level_0_gsd / std::pow( 2.0, i );
3268  out << "level[" << std::setw(2) << std::setfill('0') << i << "] mpp:"
3269  << std::setw(23) << std::setfill(' ') << level_gsd
3270  << " (" << tilesX << "x" << tilesX << ")" << "\n";
3271  }
3272 
3273  // Reset flags.
3274  out.setf(f);
3275 
3276  return out;
3277 
3278 } // End: ossimInfo::printZoomLevelGsds(std::ostream& out)
3279 
3281 {
3283 }
3284 
3286 {
3288 }
3289 
3290 void ossimInfo::getRadiometry(ossimScalarType scalar, std::string& s) const
3291 {
3292  // Output Radiometry.
3293  switch(scalar)
3294  {
3295  case OSSIM_UINT8:
3296  {
3297  s = "8-bit";
3298  break;
3299  }
3300  case OSSIM_USHORT11:
3301  {
3302  s = "11-bit";
3303  break;
3304  }
3305  case OSSIM_USHORT12:
3306  {
3307  s = "12-bit";
3308  break;
3309  }
3310  case OSSIM_USHORT13:
3311  {
3312  s = "13-bit";
3313  break;
3314  }
3315  case OSSIM_USHORT14:
3316  {
3317  s = "14-bit";
3318  break;
3319  }
3320  case OSSIM_USHORT15:
3321  {
3322  s = "15-bit";
3323  break;
3324  }
3325  case OSSIM_UINT16:
3326  {
3327  s = "16-bit unsigned";
3328  break;
3329  }
3330  case OSSIM_SINT16:
3331  {
3332  s = "16-bit signed";
3333  break;
3334  }
3335  case OSSIM_UINT32:
3336  {
3337  s = "32-bit unsigned";
3338  break;
3339  }
3340  case OSSIM_SINT32:
3341  {
3342  s = "32-bit signed";
3343  break;
3344  }
3345  case OSSIM_FLOAT32:
3346  {
3347  s = "32-bit float";
3348  break;
3349  }
3350  case OSSIM_DOUBLE:
3351  {
3352  s = "64-bit double float";
3353  break;
3354  }
3356  {
3357  s = "normalized 32-bit float";
3358  break;
3359  }
3361  {
3362  s = "normalized 64-bit double float";
3363  break;
3364  }
3365  default:
3366  {
3367  s = "unknown";
3368  break;
3369  }
3370  }
3371 }
3372 
3373 void ossimInfo::getBuildDate(std::string& s) const
3374 {
3375 #ifdef OSSIM_BUILD_DATE
3376  s = OSSIM_BUILD_DATE;
3377 #else
3378  s = "unknown";
3379 #endif
3380 }
3381 
3382 void ossimInfo::getRevisionNumber(std::string& s) const
3383 {
3384 #ifdef OSSIM_REVISION
3385  s = OSSIM_REVISION;
3386 #else
3387  s = "unknown";
3388 #endif
3389 }
3390 
3391 void ossimInfo::getVersion(std::string& s) const
3392 {
3393 #ifdef OSSIM_VERSION
3394  s = OSSIM_VERSION;
3395 #else
3396  s = "unknown";
3397 #endif
3398 }
3399 
3400 void ossimInfo::outputXml( const ossimKeywordlist& kwl ) const
3401 {
3402  ossimXmlDocument document;
3403  document.fromKwl( kwl );
3404  ossimNotify(ossimNotifyLevel_INFO) << document << std::endl;
3405 }
3406 
3407 void ossimInfo::outputXml( const ossimKeywordlist& kwl, const ossimFilename& file ) const
3408 {
3409  ossimXmlDocument document;
3410  document.fromKwl( kwl );
3411  document.write( file );
3412 }
3413 
3414 bool ossimInfo::keyIsTrue( const std::string& key ) const
3415 {
3416  bool result = false;
3417  std::string value = m_kwl.findKey( key );
3418  if ( value.size() )
3419  {
3420  result = ossimString(value).toBool();
3421  }
3422  return result;
3423 }
16 bit unsigned integer (15 bits used)
void mtrs2ft(const ossim_float64 &meters, bool us_survey) const
Converts meters to feet and outputs to stdout.
Definition: ossimInfo.cpp:2905
virtual void valueToString(ossimString &valueResult) const =0
static const char * DESCRIPTION
Used by ossimUtilityFactory.
Definition: ossimInfo.h:40
ossim_uint32 x
void write(std::ostream &output, const UsageMap &um, unsigned int widthOfOutput=80)
std::string getApplicationName() const
return the application name, as specified by argv[0]
const ossimKeywordlist & preferencesKWL() const
#define OSSIM_REVISION
Definition: ossimVersion.h:9
void addCommandLineOption(const ossimString &option, const ossimString &explanation)
void printResamplerFilters() const
Prints resampler filters to stdout.
Definition: ossimInfo.cpp:3167
bool pointWithin(const ossimDpt &pt, double epsilon=0.0) const
Definition: ossimDrect.h:781
static const char * DECIMAL_DEGREES_PER_PIXEL_LAT
virtual void getSupportedExtensions(ossimImageHandlerFactoryBase::UniqueStringList &extensionList) const
void getPropertyList(std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
virtual std::ostream & print(std::ostream &os) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
virtual void getFilterTypes(std::vector< ossimString > &filterTypes) const
void getUpIsUpAngle(ossimKeywordlist &kwl)
Populates keyword list with up_is_up_angle.
Definition: ossimInfo.cpp:2427
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
void printReaderProps() const
Prints reader properties to stdout.
Definition: ossimInfo.cpp:3157
ossimInfo()
default constructor
Definition: ossimInfo.cpp:117
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
bool isAffectedByElevation() const
Returns TRUE if this geometry is sensitive to elevation.
void getOpenCellList(std::vector< ossimFilename > &list) const
virtual ossimRefPtr< ossimNBandLutDataObject > getLut() const
ossim_float64 width() const
Definition: ossimDrect.h:522
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
Definition: ossimFilename.h:40
16 bit unsigned integer
virtual void getPropertyList(std::vector< ossimRefPtr< ossimProperty > > &children) const
void printAllPluginInformation(std::ostream &out)
void getCenterGround(ossimKeywordlist &kwl)
Populates keyword list with image center ground point.
Definition: ossimInfo.cpp:2156
virtual ossimImageHandler * open(const ossimFilename &fileName, bool trySuffixFirst=true, bool openOverview=true) const
open that takes a filename.
void printConfiguration() const
Dumps ossim preferences/configuration data.
Definition: ossimInfo.cpp:2695
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
#define DEG_PER_RAD
Represents serializable keyword/value map.
bool addFile(const char *file)
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
bool write(const ossimFilename &file)
bool m_helpRequested
Definition: ossimTool.h:150
static const char * LR_X_KW
static ossimDatumFactoryRegistry * instance()
instance method
void getNorthUpAngle(ossimKeywordlist &kwl)
Populates keyword list with north_up_angle.
Definition: ossimInfo.cpp:2519
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
const char * find(const char *key) const
void addOptions(ossimArgumentParser &parser)
Definition: ossimInit.cpp:100
ossimRefPtr< ossimImageHandler > openImageHandler(const ossimFilename &file) const
Opens image.
Definition: ossimInfo.cpp:1629
ossimFilename expand() const
Method to do file name expansion.
virtual bool execute()
execute method.
Definition: ossimInfo.cpp:827
void rad2deg(const ossim_float64 &radians) const
Converts radians to degrees and outputs to stdout.
Definition: ossimInfo.cpp:2848
virtual ossim_uint32 epsgCode() const
Definition: ossimDatum.h:59
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...
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
void getBoundingRect(ossimIrect &bounding_rect) const
Get the bounding rect of (0, 0) to (imageSize.x-1, imageSize.y-1).
const ossimDpt & ul() const
Definition: ossimDrect.h:339
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimObject.cpp:95
bool keyIsTrue(const std::string &key) const
Definition: ossimInfo.cpp:3414
double y
Definition: ossimDpt.h:165
void openImageFromState(const ossimFilename &file)
Opens image handler and stores in m_img data member.
Definition: ossimInfo.cpp:1614
void mtrsPerDeg(const ossim_float64 &latitude) const
Get meters per degree for a given latitude and outputs to stdout.
Definition: ossimInfo.cpp:2941
virtual const ossimString & code() const
Definition: ossimDatum.h:57
static ossimImageWriterFactoryRegistry * instance()
void getRadiometry(ossimScalarType scalar, std::string &s) const
Gets the radiometry string, i.e.
Definition: ossimInfo.cpp:3290
void makeNan()
Definition: ossimGpt.h:130
static ossimString toString(bool aValue)
Numeric to string methods.
static const char * NUMBER_LINES_KW
void openImage(const ossimFilename &file)
Opens image handler and stores in m_img data member.
Definition: ossimInfo.cpp:1602
static const char * TIE_POINT_LON_KW
virtual const ossimImageHandler * getOverview() const
static const char * NUMBER_INPUT_BANDS_KW
virtual const ossimString & name() const
Definition: ossimDatum.h:58
16 bit signed integer
void printOverviewTypes() const
Prints overview types to stdout.
Definition: ossimInfo.cpp:3115
std::shared_ptr< ossim::ImageHandlerState > getState()
ossimKeywordlist m_kwl
Definition: ossimTool.h:148
virtual void getEntryName(ossim_uint32 entryIdx, std::string &name) const
Get the name of entry as a string.
static ossimObjectFactoryRegistry * instance()
void testPlugin(const ossimFilename &plugin) const
Test a plugin load and outputs to stdout.
Definition: ossimInfo.cpp:3097
static const char * NUMBER_ENTRIES_KW
16 bit unsigned integer (14 bits used)
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
std::ostream & ecef2llh(const ossimEcefPoint &ecefPoint, std::ostream &out) const
Converts ecef point to lat lon height.
Definition: ossimInfo.cpp:2840
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
16 bit unsigned integer (13 bits used)
void setCommandLineUsage(const ossimString &explanation)
32 bit floating point
void outputXml(const ossimKeywordlist &kwl) const
Convert keyword list to xml then outputs to standard out.
Definition: ossimInfo.cpp:3400
ossimApplicationUsage * getApplicationUsage()
ossimRefPtr< ossimImageHandler > getImageHandler()
Definition: ossimInfo.cpp:1669
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
void wrap()
Wrap method to maintain longitude between -180 and +180 and latitude between -90 and +90...
Definition: ossimGpt.h:305
32 bit unsigned integer
virtual bool write(const char *file, const char *comment=0) const
Methods to dump the ossimKeywordlist to a file on disk.
std::ostream & printWriterProps(std::ostream &out) const
Prints list of writers from getImageTypeList.
virtual ossimString getShortName() const
Definition: ossimObject.cpp:48
const ossimDrect & expand(const ossimDpt &padding)
Definition: ossimDrect.cpp:493
static const char * METERS_PER_PIXEL_Y_KW
void toPoint(const std::string &s)
Initializes this point from string.
void getImg2grd(ossimKeywordlist &kwl)
Populates keyword list with ground point for image point.
Definition: ossimInfo.cpp:2288
void ft2mtrs(const ossim_float64 &feet, bool us_survey) const
Converts feet to meters and outputs to stdout.
Definition: ossimInfo.cpp:2870
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
ossimRefPtr< ossimImageHandler > m_img
Holds the open image.
Definition: ossimInfo.h:805
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Retuns the min pixel value.
void getImageInfo(const ossimFilename &file, bool dumpFlag, bool dnoFlag, bool imageGeomFlag, bool imageInfoFlag, bool metaDataFlag, bool paletteFlag, ossimKeywordlist &kwl) const
getImageInfo Method to open image "file" and get image info in the form of a ossimKeywordlist.
Definition: ossimInfo.cpp:1532
void reportRemainingOptionsAsUnrecognized(ossimErrorSeverity severity=OSSIM_BENIGN)
for each remaining option report it as an unrecongnized.
ossimString toString() const
Definition: ossimIrect.cpp:332
double ossim_float64
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
void printDatums() const
Dumps datum list to stdout.
Definition: ossimInfo.cpp:2737
void printFonts() const
Prints fonts list to stdout.
Definition: ossimInfo.cpp:2790
#define US_METERS_PER_FT
void outputHeight(const ossimGpt &gpt) const
Gets the height for ground point (latitude, longitude).
Definition: ossimInfo.cpp:2969
std::shared_ptr< ossimInfoBase > create(const ossimFilename &file) const
Create method.
bool getRgbBands(ossimImageHandler *ih, ossim_uint32 entry, ossimKeywordlist &kwl) const
Populates keyword list with rgb bands if available.
Definition: ossimInfo.cpp:2608
void getFontInformation(std::vector< ossimFontInformation > &informationList) const
static const char * LR_Y_KW
void getImageMetadata(ossimKeywordlist &kwl) const
Populates keyword list with metadata.
Definition: ossimInfo.cpp:1722
static ossimSharedPluginRegistry * instance()
static const char * UL_X_KW
bool errors(ossimErrorSeverity severity=OSSIM_BENIGN) const
bool exists() const
ossim_float64 lon
Definition: ossimGpt.h:266
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimGpt.cpp:116
void fromKwl(const ossimKeywordlist &kwl)
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual const ossimFilename & getFilename() const
Returns the filename.
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
void getRevisionNumber(std::string &s) const
Gets revision number.
Definition: ossimInfo.cpp:3382
virtual ossimString getFamilyName() const
Definition: ossimFont.h:133
virtual double getHeightAboveEllipsoid(const ossimGpt &gpt)
const ossimString & name() const
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Method to populate a list of supported types of all factories registered to this registry.
32 bit signed integer
bool toBool() const
String to numeric methods.
void deg2rad(const ossim_float64 &degrees) const
Converts degrees to radians and outputs to stdout.
Definition: ossimInfo.cpp:2818
unsigned int ossim_uint32
virtual ~ossimInfo()
virtual destructor
Definition: ossimInfo.cpp:122
virtual const ossimDatum * create(const ossimString &code) const
create method
32 bit normalized floating point
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimDpt.cpp:192
virtual const ossimEllipsoid * ellipsoid() const
Definition: ossimDatum.h:60
static const char * NUMBER_OUTPUT_BANDS_KW
static ossimGeoidManager * instance()
Implements singelton pattern:
double height() const
Definition: ossimGpt.h:107
ossim_float64 toFloat64() const
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual bool getRgbBandList(std::vector< ossim_uint32 > &bandList) const
Convenience method to get the zero based rgb output band list.
virtual void getList(std::vector< ossimString > &list) const
getList method to return a combined list of all datums from registered datum factories.
ossim_uint32 executeImageOptions(const ossimFilename &file)
handles image options.
Definition: ossimInfo.cpp:1127
void closeImage()
Closes image if open.
Definition: ossimInfo.cpp:1664
static const char * DECIMAL_DEGREES_PER_PIXEL_LON
void prettyPrint(const ossimFilename &file) const
Dumps the image information from ossimInfoFactoryRegistry.
Definition: ossimInfo.cpp:1674
ossim_float32 toFloat32() const
virtual bool initialize(ossimArgumentParser &ap)
Initializes from command line arguments.
Definition: ossimTool.cpp:58
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual bool initialize(ossimArgumentParser &ap)
Initial method.
Definition: ossimInfo.cpp:269
static const char * UL_Y_KW
bool hasNans() const
Definition: ossimDrect.h:396
void printExtensions() const
Prints supported image file extensions to stdout.
Definition: ossimInfo.cpp:3054
virtual ossim_uint32 getNumberOfEntries() const
#define DBL_EPSILON
virtual void getEntryList(std::vector< ossim_uint32 > &entryList) const
ossim_float64 height() const
Definition: ossimDrect.h:517
void save(ossimKeywordlist &kwl, const char *prefix) const
Output list to the kwl.
bool isImageEntryOverview() const
Definition: ossimInfo.cpp:2665
void getGrd2img(ossimKeywordlist &kwl)
Populates keyword list with image point for grund point.
Definition: ossimInfo.cpp:2367
static ossimPreferences * instance()
ossimScalarType
void dumpImage(const ossimFilename &file, bool dnoFlag, ossimKeywordlist &kwl) const
Dumps the image information from ossimInfoFactoryRegistry to keyword list.
Definition: ossimInfo.cpp:1702
static ossimProjectionFactoryRegistry * instance()
void printWriters() const
Prints list of available writers to stdout.
Definition: ossimInfo.cpp:3187
void printZoomLevelGsds() const
Prints zoom levels to stdout.
Definition: ossimInfo.cpp:3197
static const char * ENTRY_KW
#define MTRS_PER_FT
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
64 bit normalized floating point
static ossimOverviewBuilderFactoryRegistry * instance()
instance method for access to theInstance pointer.
16 bit unsigned integer (11 bits used)
ossimString toString(ossim_uint32 precision=15) const
Definition: ossimDpt.cpp:160
virtual void setUsage(ossimArgumentParser &ap)
Adds application arguments to the argument parser.
Definition: ossimInfo.cpp:126
static ossimFontFactoryRegistry * instance()
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
virtual double getHeightAboveMSL(const ossimGpt &gpt)
Height access methods:
static ossimInfoFactoryRegistry * instance()
instance method
This class defines an abstract Handler which all image handlers(loaders) should derive from...
void getImageBounds(ossimKeywordlist &kwl)
Populates keyword list with edge to edge image bounds.
Definition: ossimInfo.cpp:2216
ossimDpt midPoint() const
Definition: ossimDrect.h:817
void getVersion(std::string &s) const
Gets version.
Definition: ossimInfo.cpp:3391
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
void setDescription(const ossimString &desc)
void printProjections() const
Prints projections to stdout.
Definition: ossimInfo.cpp:3133
double geodeticRadius(const double &latitude) const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
const ossimDpt & ur() const
Definition: ossimDrect.h:340
double x
Definition: ossimDpt.h:164
virtual ossimObject * createObject(const ossimString &name) const
void printFactories(bool keywordListFlag) const
Prints factories.
Definition: ossimInfo.cpp:2710
ossim_uint32 getSize() const
void printPlugins() const
Prints loaded plugins to stdout.
Definition: ossimInfo.cpp:3079
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool empty() const
Definition: ossimString.h:411
static std::shared_ptr< ImageHandlerStateRegistry > instance()
static ossimInit * instance()
Definition: ossimInit.cpp:89
ossim_float64 upIsUpAngle(const ossimDpt &) const
ossimString ext() const
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.
ossimDpt metersPerDegree() const
Definition: ossimGpt.cpp:498
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the transform (if any) and projection (if any) states to the KWL.
void getCenterImage(ossimKeywordlist &kwl)
Populates keyword list with image center point.
Definition: ossimInfo.cpp:2104
static ossimImageHandlerRegistry * instance()
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
std::ostream & printImageTypeList(std::ostream &out) const
Prints list of writers from getImageTypeList.
std::ostream & printReaderProps(std::ostream &out) const
Prints list of readers and properties.
const ossimDpt & ll() const
Definition: ossimDrect.h:342
ossim_float64 lat
Definition: ossimGpt.h:265
static const char * TIE_POINT_LAT_KW
ossimString toString(ossim_uint32 precision=15) const
Definition: ossimGpt.cpp:78
static ossimSupportFilesList * instance()
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
void getImagePalette(ossimKeywordlist &kwl)
Populates keyword list with palette data.
Definition: ossimInfo.cpp:1777
8 bit unsigned integer
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
void getImageGeometryInfo(ossimKeywordlist &kwl, bool dnoFlag)
Populates keyword list with image geometry/projection information.
Definition: ossimInfo.cpp:1949
void printWriterProps() const
Prints writer properties to stdout.
Definition: ossimInfo.cpp:3280
#define OSSIM_VERSION
Definition: ossimVersion.h:4
virtual ossim_uint32 getNumberOfInputBands() const =0
virtual bool setCurrentEntry(ossim_uint32 entryIdx)
ossim_float64 northUpAngle() const
virtual double offsetFromEllipsoid(const ossimGpt &gpt)
const ossimDpt & lr() const
Definition: ossimDrect.h:341
void getImageRect(ossimKeywordlist &kwl)
Populates keyword list with image rectangle.
Definition: ossimInfo.cpp:2584
int & argc()
return the argument count.
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
#define OSSIM_BUILD_DATE
Definition: ossimVersion.h:12
64 bit floating point
static const char * METERS_PER_PIXEL_X_KW
#define RAD_PER_DEG
static const char * NUMBER_SAMPLES_KW
void getBuildDate(std::string &s) const
Gets build date.
Definition: ossimInfo.cpp:3373
ossimFilename getPreferencesFilename() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void makeNan()
Definition: ossimDpt.h:65
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
ossimString toString(ossim_uint32 precision=15) const
To string method.
void writeErrorMessages(std::ostream &output, ossimErrorSeverity sevrity=OSSIM_BENIGN)
write out error messages at an above specified .
const std::string & string() const
Definition: ossimString.h:414
16 bit unsigned integer (12 bits used)
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91