This file is indexed.

/usr/include/ossim/imaging/ossimPdfWriter.h is in libossim-dev 1.8.16-3+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
//----------------------------------------------------------------------------
//
// License:  See top level LICENSE.txt file
//
// Author:  David Burken
//
// Description: OSSIM Portable Document Format (PDF) writer.
//
//----------------------------------------------------------------------------
// $Id$

#ifndef ossimPdfWriter_HEADER
#define ossimPdfWriter_HEADER 1

#include <ossim/imaging/ossimImageFileWriter.h>
#include <ossim/base/ossimConnectableObject.h>
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimRefPtr.h>
#include <ossim/base/ossimRtti.h>
#include <ossim/base/ossimKeywordlist.h>
#include <ossim/imaging/ossimImageSource.h>
#include <OpenThreads/Mutex>
#include <iosfwd>

// Forward class declarations:
class ossimImageData;
class ossimIpt;
class ossimIrect;

/**
 * @class ossimPdfWriter
 *
 * References:
 * 
 * Adobe PDF Reference sixth edition, Version 1.7 November 2006
 * pdf_reference_1-7.pdf
 *
 * PDF Georegistration Encoding Best Practice Version (2.2 OGC 08-139r3)
 * 08-139r3_PDF_Geo-registration_Encoding_Best_Practice_Version_2.2.pdf
 *
 * @note Spaces and newlines for formatting have been left in the code for
 * sanity purposes only.  Code is heavily traced.  You can enable trace on any
 * ossim application with "-T ossimPdfWriter".
 */
class OSSIM_DLL ossimPdfWriter : public ossimImageFileWriter
{
public:

   enum ossimPdfImageType
   {
      UNKNOWN = 0,
      JPEG    = 1, // JPEG
      RAW     = 2  // general raster, band interleaved by pixel(BIP)
   };

   /** @brief default constructor */
   ossimPdfWriter();

   /** @brief virtual destructor */
   virtual ~ossimPdfWriter();

   /** @return "pdf writer" */
   virtual ossimString getShortName() const;

   /** @return "ossim pdf writer" */
   virtual ossimString getLongName()  const;

   /** @return "ossimPdfWriter" */
   virtual ossimString getClassName()    const;

   /**
    * @brief Returns a 3-letter extension from the image type descriptor
    * (theOutputImageType) that can be used for image file extensions.
    *
    * @param imageType string representing image type.
    *
    * @return the 3-letter string extension.
    */
   virtual ossimString getExtension() const;

   /**
    * @brief void getImageTypeList(std::vector<ossimString>& imageTypeList)const
    *
    * Appends this writer image types to list "imageTypeList".
    *
    * This writer only has one type "pdf".
    *
    * @param imageTypeList stl::vector<ossimString> list to append to.
    */
   virtual void getImageTypeList(std::vector<ossimString>& imageTypeList)const;

   /** @return true if open, false if not. */
   virtual bool isOpen() const;

   /**
    * @brief Open method.
    * @return True on success, false on error.
    */
   virtual bool open();
   
   /** @brief Closes file. */
   virtual void close();
   
   /** @brief saves the state of the object. */
   virtual bool saveState(ossimKeywordlist& kwl,
                          const char* prefix=0)const;
   
   /**
    * @brief Method to the load (recreate) the state of an object from a keyword
    * list.
    * @return True on success, false on error.
    */
   virtual bool loadState(const ossimKeywordlist& kwl,
                          const char* prefix=0);

   /**
    * @brief Will set the property whose name matches the argument
    * "property->getName()".
    *
    * @param property Object containing property to set.
    */
   virtual void setProperty(ossimRefPtr<ossimProperty> property);
   
   /**
    * @brief Gets property for name.
    * 
    * @param name Name of property to return.
    * 
    * @returns A pointer to a property object which matches "name".
    */
   virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;

   /**
    * @brief Pushes this's names onto the list of property names.
    *
    * @param propertyNames array to add this's property names to.
    */
   virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;

   virtual bool hasImageType(const ossimString& imageType) const;

   /**
    * @brief Method to write the image to a stream.
    *
    * @return true on success, false on error.
    */
   virtual bool writeStream();

   /**
    * @brief Sets the output stream to write to.
    *
    * The stream will not be closed/deleted by this object.
    *
    * @param output The stream to write to.
    */
   virtual bool setOutputStream( std::ostream& stream );

private:

   /**
    * @brief Writes the file to disk or a stream.
    * @return true on success, false on error.
    */
   virtual bool writeFile();

   /**
    * @brief Writes header.
    * @param str Stream to write to.
    */
   void writeHeader( std::ostream* str );

   /**
    * @brief Writes Catalog object.
    * @param str Stream to write to.
    * @param xref To capture object positions.
    */
   void writeCatalog( std::ostream* str,
                      std::vector<std::streamoff>& xref );
   
   /**
    * @brief Writes Outlines object.
    * @param str Stream to write to.
    * @param xref To capture object positions.
    */
#if 0
   void writeOutlines( std::ostream* str,
                       std::vector<std::streamoff>& xref );
#endif

   /**
    * @brief Writes Pages object.
    * @param str Stream to write to.
    * @param xref To capture object positions.
    */
   void writePages( std::ostream* str,
                    std::vector<std::streamoff>& xref );

   /**
    * @brief Writes document infomation dictionary.
    * @param str Stream to write to.
    * @param xrefOffset Offset to cross reference(xref) table. 
    */
   void writeInfo( std::ostream* str,
                   std::vector<std::streamoff>& xref );
   
   /**
    * @brief Writes the image dictionary and associated objects.
    * @param str Stream to write to.
    * @return true on success, false on error.
    */
   bool writeImage( std::ostream* str );

   /**
    * @brief Write a JPEG-compresses the raster tile buffer to the output stream
    * provided.
    * @param str Stream to write to.
    * @param xref To capture object positions.
    * @param id Pointer to tile data.
    * @param aoi Area of interest.
    * @param outputTileRect Initialized by this with output tile rect clamped
    * to aoi.
    */
   void writeJpegTile( std::ostream* str,
                       std::vector<std::streamoff>& xref,
                       ossimImageData* id,
                       const ossimIrect& aoi,
                       ossimIrect& outputTileRect );
   
   /**
    * @brief Write raw raster tile buffer to the output stream
    * provided.
    * @param str Stream to write to.
    * @param xref To capture object positions.
    * @param id Pointer to tile data.
    * @param aoi Area of interest.
    * @param outputTileRect Initialized by this with output tile rect clamped
    * to aoi.
    */
   void writeRawTile( std::ostream* str,
                      std::vector<std::streamoff>& xref,
                      ossimImageData* id,
                      const ossimIrect& aoi,
                      ossimIrect& outputTileRect );
   
   /**
    * @brief Writes Cross Reference(xref) section.
    * @param str Stream to write to.
    * @param xref Array of object offsets.
    */
   void writeXref( std::ostream* str,
                   const std::vector<std::streamoff>& xref );

   /**
    * @brief Writes trailer.
    * @param str Stream to write to.
    * @param entrySize Number of entries, one plus object count.
    * @param xrefOffset Offset to cross reference(xref) table. 
    */
   void writeTrailer( std::ostream* str,
                      ossim_uint32 entrySize,
                      std::streamoff xrefOffset );

   /**
    * @brief Writes "dummy"  or blank object just to keep object references
    * in line.
    * @param str Stream to write to.
    * @param xref To capture object positions.
    */
#if 0
   void writeDummy( std::ostream* str,
                    std::vector<std::streamoff>& xref );
#endif
   
   /**
    * @brief Sets up input image source.
    * This sets up the chain fed to theInputConnection which is an image
    * source sequencer.  This will remap input to eight bit if not already and
    * make input one or three band depending on number of bands. Also sets
    * m_saveInput for reconnection at the end of write.
    */
   void setupInputChain();

   /**
    * @brief Gets the enumerated value of IMAGE_TYPE_KW lookup.
    *
    * This is the image type of the stream embedded in the pdf.
    * Default "raw" if not found.
    * 
    * @return ossimPdfImageType, e.g. PNG, RAW...
    */
   ossimPdfImageType getImageType() const;   

   /**
    * @brief Initializes image type from IMAGE_TYPE_KW lookup.
    *
    * This is the image type of the stream embedded in the pdf.
    * Default "raw" if not found.
    *
    * @param type Initialized by this.
    */
   void getImageType( std::string& type ) const;

   /**
    * @brief Adds option to m_kwl with mutex lock.
    * @param key
    * @param value
    */
   void addOption( const std::string& key, const std::string& value );

   /**
    * @brief Gets the page size.
    *
    * Takes into account image width, height, and annotations.
    * 
    * @param width Width of image.
    * @param height Height of image.
    * @param size Initialized by this.
    */
#if 0
   void getMediaBoxSize( ossim_uint32 imageWidth,
                         ossim_uint32 imageHeight,
                         ossimIpt& size ) const;
#endif

   /**
    * @brief Gets page offset for image from lower left corner of media box.
    * @param aoi Area of interest.
    * @param offset Initialized by this.
    */
   void getLowerLeftPageOffset( const ossimIrect& aoi,
                                ossimIpt& offset ) const;

   /**
    * @brief Get the LGIDict string.
    * @param geom Image geometry.
    * @param aoi Area of interest.
    * @param s Initialized by this.
    */
   void getLgiDict( ossimImageGeometry* geom,
                    const ossimIrect& aoi,
                    std::string& s ) const;

   /**
    * @brief Gets projection part of LGIDict string.
    * @param geom Image geometry.
    * @param s Initialized by this. 
    */ 
   void getLgiDictProjection( ossimImageGeometry* geom,
                              std::string& s ) const;

   
   /**
    * @brief Gets Coordinate Transformation Matrix(CTM) part of
    * LGIDict string from geom. 
    * @param geom Image geometry.
    * @param aoi Area of interest.
    * @param s Initialized by this or cleared on error.
    */
   void getLgiDictCtm( ossimImageGeometry* geom,
                       const ossimIrect& aoi,
                       std::string& s ) const;

   /**
    * @brief Gets datum part of LGIDict string from geom. 
    * @param geom Image geometry.
    * @param s Initialized by this or cleared on error.
    */   
   void getLgiDictDatum( ossimImageGeometry* geom,
                         std::string& s ) const;

   /**
    * @brief Gets description part of LGIDict string from geom. 
    * @param geom Image geometry.
    * @param s Initialized by this or cleared on error.
    */   
   void getLgiDictDescription( ossimImageGeometry* geom,
                               std::string& s ) const;
   
   /**
    * @brief Gets neatline part of LGIDict string from geom. 
    * @param geom Image geometry.
    * @param s Initialized by this or cleared on error.
    */
#if 0
   void getLgiDictNeatline( ossimImageGeometry* geom,
                            std::string& s ) const;
#endif

   /**
    * @brief Gets projection type part of LGIDict string from geom. 
    * @param geom Image geometry.
    * @param s Initialized by this or cleared on error.
    */
   void getLgiDictProjectionType( ossimImageGeometry* geom,
                                  std::string& s ) const;
   
   /**
    * @brief Gets the EPSG/PCS code from geometry.
    * @param geom Image geometry.
    * @return EPSG code or 32767 on error.
    */
   ossim_uint32 getEpsgCode( const ossimImageGeometry* geom ) const;

#if 0
   void getNumberOfTiles( ossim_uint32 imageWidth,
                          ossim_uint32 imageHeight,
                          ossimIpt& size ) const;
#endif

   /**
    * @brief Gets the Title.
    *
    * Looks in m_kwl for options keyword: "Title"
    *
    * Defaults to basename of output file if not found.
    *
    * @param s Initialed by this.
    */
   void getTitle( std::string& s ) const;
   
   /**
    * @brief Gets the Author.
    *
    * Looks in m_kwl for options keyword: "Author"
    *
    * Defaults to "ossim" if not found.
    *
    * @param s Initialed by this.
    */
   void getAuthor( std::string& s ) const;

   /**
    * @brief Gets the Subject.
    *
    * Looks in m_kwl for options keyword: "Subject"
    *
    * Default: No default, empty string if not found.
    *
    * @param s Initialed by this.
    */
   void getSubject( std::string& s ) const;

   /**
    * @brief Gets the Keywords.
    *
    * Looks in m_kwl for options keyword: "Keywords"
    *
    * Default: No default, empty string if not found.
    *
    * @param s Initialed by this.
    */
   void getKeywords( std::string& s ) const;

   /**
    * @brief Gets the Creator.
    *
    * Looks in m_kwl for options keyword: "Creator"
    *
    * Defaults to "ossim" if not found.
    *
    * @param s Initialed by this.
    */
   void getCreator( std::string& s ) const;
   
   /**
    * @brief Gets the Producer.
    *
    * Looks in m_kwl for options keyword: "Producer"
    *
    * Defaults to "ossim" if not found.
    *
    * @param s Initialed by this.
    */
   void getProducer( std::string& s ) const;

   /**
    * @brief Gets the Producer.
    *
    * Looks in m_kwl for options keyword: "CreationDate"
    *
    * Defaults to current time if not found.
    *
    * @param s Initialed by this.
    *
    * NOTE: This is a formatted string in the form of:
    * D:YYYYMMDDHHmmSSOHH'mm'
    */   
   void getCreationDate( std::string& s ) const;

   /**
    * @brief Gets the Producer.
    *
    * Looks in m_kwl for options keyword: "ModDate"
    *
    * Defaults to current time if not found.
    *
    * @param s Initialed by this.
    *
    * NOTE: This is a formatted string in the form of:
    * D:YYYYMMDDHHmmSSOHH'mm'
    */
   void getModDate( std::string& s ) const;

   /**
    * @brief Get's the date in format of:
    * (D:YYYYMMDDHHmmSSZ00'00')
    *
    * @param s Initialed by this.
    *
    * NOTE: Date code is NOT thread safe.
    */
   void getGmtDate( std::string& s ) const;

   /**
    * @brief Gets tiles size as string.
    *
    * Looks in m_kwl for options keyword: "output_tile_size"
    *
    * Defaults to 1024 if not found.
    *
    * @param s Initialized by this.
    */
   void getTileSize( std::string& s ) const;

   /**
    * @brief Gets Tile size as integer point.
    *
    * Defaults to 1024x1024 if not found.
    * @param tileSize Initialized by this.
    */
   void getTileSize( ossimIpt& tileSize ) const;
   
   /**
    * @return string for x and y in the form of (x=1, y=3): "/Tile_0001_0003"
    */
   std::string getTileString( ossim_uint32 x, ossim_uint32 y ) const;

   std::ostream* m_str;
   bool m_ownsStream;

   /**
    * Holds the origin end of the chain connected to theInputConnection.
    */
   ossimRefPtr<ossimConnectableObject> m_savedInput;

   /** Holds all options in key, value pair map. */
   ossimRefPtr<ossimKeywordlist> m_kwl;

   OpenThreads::Mutex m_mutex;

TYPE_DATA
};

#endif /* #ifndef ossimPdfWriter_HEADER */