| 273 | } |
| 274 | |
| 275 | Expected<ObjectLines> makeObjectLinesFromFile( const std::filesystem::path& file, ProgressCallback callback ) |
| 276 | { |
| 277 | MR_TIMER; |
| 278 | |
| 279 | VertColors colors; |
| 280 | LinesLoadSettings settings |
| 281 | { |
| 282 | .colors = &colors, |
| 283 | .callback = callback |
| 284 | }; |
| 285 | auto lines = LinesLoad::fromAnySupportedFormat( file, settings ); |
| 286 | if ( !lines.has_value() ) |
| 287 | return unexpected( std::move( lines.error() ) ); |
| 288 | |
| 289 | const auto numVerts = lines->points.size(); |
| 290 | const bool hasColors = colors.size() >= numVerts; |
| 291 | |
| 292 | ObjectLines objectLines; |
| 293 | objectLines.setName( utf8string( file.stem() ) ); |
| 294 | objectLines.setPolyline( std::make_shared<Polyline3>( std::move( lines.value() ) ) ); |
| 295 | |
| 296 | if ( hasColors ) |
| 297 | { |
| 298 | objectLines.setVertsColorMap( std::move( colors ) ); |
| 299 | objectLines.setColoringType( ColoringType::VertsColorMap ); |
| 300 | } |
| 301 | |
| 302 | return objectLines; |
| 303 | } |
| 304 | |
| 305 | Expected<ObjectPoints> makeObjectPointsFromFile( const std::filesystem::path& file, ProgressCallback callback ) |
| 306 | { |
no test coverage detected