| 126 | } |
| 127 | |
| 128 | WriterImpl::WriterImpl( const ustring &filePath, const WriterOptions &options ) : |
| 129 | imf_( filePath, "w" ), root_( imf_.root() ), data3D_( imf_, true ), images2D_( imf_, true ) |
| 130 | { |
| 131 | // We are using the E57 v1.0 data format standard field names. |
| 132 | // The standard field names are used without an extension prefix (in the default namespace). |
| 133 | // We explicitly register it for completeness (the reference implementation would do it for |
| 134 | // us, if we didn't). |
| 135 | imf_.extensionsAdd( "", e57::VERSION_1_0_URI ); |
| 136 | |
| 137 | // Set per-file properties. |
| 138 | // Path names: "/formatName", "/majorVersion", "/minorVersion", "/coordinateMetadata" |
| 139 | root_.set( "formatName", StringNode( imf_, "ASTM E57 3D Imaging Data File" ) ); |
| 140 | |
| 141 | if ( !options.guid.empty() ) |
| 142 | { |
| 143 | root_.set( "guid", StringNode( imf_, options.guid ) ); |
| 144 | } |
| 145 | else |
| 146 | { |
| 147 | root_.set( "guid", StringNode( imf_, generateRandomGUID() ) ); |
| 148 | } |
| 149 | |
| 150 | root_.set( "versionMajor", IntegerNode( imf_, Version::astmMajor() ) ); |
| 151 | root_.set( "versionMinor", IntegerNode( imf_, Version::astmMinor() ) ); |
| 152 | root_.set( "e57LibraryVersion", StringNode( imf_, Version::library() ) ); |
| 153 | |
| 154 | // Save a dummy string for coordinate system. |
| 155 | // Really should be a valid WKT string identifying the coordinate reference system (CRS). |
| 156 | if ( !options.coordinateMetadata.empty() ) |
| 157 | { |
| 158 | root_.set( "coordinateMetadata", StringNode( imf_, options.coordinateMetadata ) ); |
| 159 | } |
| 160 | |
| 161 | // Create creationDateTime structure |
| 162 | // Path name: "/creationDateTime |
| 163 | // TODO currently no support for handling UTC <-> GPS time conversions |
| 164 | // note that "creationDateTime" is optional in the standard |
| 165 | #if 0 |
| 166 | StructureNode creationDateTime = StructureNode(imf_); |
| 167 | creationDateTime.set("dateTimeValue", FloatNode(imf_, GetGPSTime())); |
| 168 | creationDateTime.set("isAtomicClockReferenced", IntegerNode(imf_,0)); |
| 169 | root_.set("creationDateTime", creationDateTime); |
| 170 | #endif |
| 171 | |
| 172 | root_.set( "data3D", data3D_ ); |
| 173 | root_.set( "images2D", images2D_ ); |
| 174 | } |
| 175 | |
| 176 | WriterImpl::~WriterImpl() |
| 177 | { |
nothing calls this directly
no test coverage detected