MCPcopy Create free account
hub / github.com/PDAL/PDAL / writeXml

Method writeXml

plugins/e57/libE57Format/src/FloatNodeImpl.cpp:147–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145 }
146
147 void FloatNodeImpl::writeXml( ImageFileImplSharedPtr /*imf*/, CheckedFile &cf, int indent,
148 const char *forcedFieldName )
149 {
150 // don't checkImageFileOpen
151
152 ustring fieldName;
153 if ( forcedFieldName != nullptr )
154 {
155 fieldName = forcedFieldName;
156 }
157 else
158 {
159 fieldName = elementName_;
160 }
161
162 cf << space( indent ) << "<" << fieldName << " type=\"Float\"";
163 if ( precision_ == PrecisionSingle )
164 {
165 cf << " precision=\"single\"";
166
167 // Don't need to write if are default values
168 if ( minimum_ > FLOAT_MIN )
169 {
170 cf << " minimum=\"" << static_cast<float>( minimum_ ) << "\"";
171 }
172 if ( maximum_ < FLOAT_MAX )
173 {
174 cf << " maximum=\"" << static_cast<float>( maximum_ ) << "\"";
175 }
176
177 // Write value as child text, unless it is the default value
178 if ( value_ != 0.0 )
179 {
180 cf << ">" << static_cast<float>( value_ ) << "</" << fieldName << ">\n";
181 }
182 else
183 {
184 cf << "/>\n";
185 }
186 }
187 else
188 {
189 // Don't need to write precision="double", because that's the default
190
191 // Don't need to write if are default values
192 if ( minimum_ > DOUBLE_MIN )
193 {
194 cf << " minimum=\"" << minimum_ << "\"";
195 }
196 if ( maximum_ < DOUBLE_MAX )
197 {
198 cf << " maximum=\"" << maximum_ << "\"";
199 }
200
201 // Write value as child text, unless it is the default value
202 if ( value_ != 0.0 )
203 {
204 cf << ">" << value_ << "</" << fieldName << ">\n";

Callers

nothing calls this directly

Calls 1

spaceFunction · 0.85

Tested by

no test coverage detected