| 232 | |
| 233 | |
| 234 | void PlyWriter::writeValue(PointRef& point, Dimension::Id dim, |
| 235 | Dimension::Type type) |
| 236 | { |
| 237 | if (m_format == Format::Ascii) |
| 238 | { |
| 239 | if (Dimension::base(type) == Dimension::BaseType::Floating) |
| 240 | { |
| 241 | if (m_precisionArg->set()) |
| 242 | { |
| 243 | *m_stream << std::fixed; |
| 244 | m_stream->precision(m_precision); |
| 245 | } |
| 246 | |
| 247 | if (type == Dimension::Type::Float) |
| 248 | writeTextVal<float>(*m_stream, point, dim); |
| 249 | else |
| 250 | writeTextVal<double>(*m_stream, point, dim); |
| 251 | |
| 252 | if (m_precisionArg->set()) |
| 253 | m_stream->unsetf(std::ios_base::fixed); |
| 254 | } |
| 255 | else |
| 256 | { |
| 257 | switch (type) |
| 258 | { |
| 259 | case Dimension::Type::Unsigned8: |
| 260 | writeTextVal<uint8_t>(*m_stream, point, dim); |
| 261 | break; |
| 262 | case Dimension::Type::Unsigned16: |
| 263 | writeTextVal<uint16_t>(*m_stream, point, dim); |
| 264 | break; |
| 265 | case Dimension::Type::Unsigned32: |
| 266 | writeTextVal<uint32_t>(*m_stream, point, dim); |
| 267 | break; |
| 268 | case Dimension::Type::Unsigned64: |
| 269 | writeTextVal<uint64_t>(*m_stream, point, dim); |
| 270 | break; |
| 271 | case Dimension::Type::Signed8: |
| 272 | writeTextVal<int8_t>(*m_stream, point, dim); |
| 273 | break; |
| 274 | case Dimension::Type::Signed16: |
| 275 | writeTextVal<int16_t>(*m_stream, point, dim); |
| 276 | break; |
| 277 | case Dimension::Type::Signed32: |
| 278 | writeTextVal<int32_t>(*m_stream, point, dim); |
| 279 | break; |
| 280 | case Dimension::Type::Signed64: |
| 281 | writeTextVal<int64_t>(*m_stream, point, dim); |
| 282 | break; |
| 283 | default: |
| 284 | throwError("Internal error: invalid type found writing " |
| 285 | "output."); |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | else if (m_format == Format::BinaryLe) |
| 290 | { |
| 291 | OLeStream out(m_stream); |