Skip to content

Commit df869d9

Browse files
committed
feat(replace_components_meshes_by_others): Added function to replace component meshes of a BRep by another BRep's.
1 parent 724c3f7 commit df869d9

File tree

20 files changed

+157
-10
lines changed

20 files changed

+157
-10
lines changed

include/geode/model/mixin/builder/blocks_builder.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ namespace geode
8686
[[nodiscard]] SolidMesh< dimension >& modifiable_block_mesh(
8787
const uuid& id );
8888

89+
[[nodiscard]] std::unique_ptr< SolidMesh< dimension > >
90+
steal_block_mesh( const uuid& id );
91+
8992
private:
9093
Blocks< dimension >& blocks_;
9194
};

include/geode/model/mixin/builder/corners_builder.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ namespace geode
7878
[[nodiscard]] PointSet< dimension >& modifiable_corner_mesh(
7979
const uuid& id );
8080

81+
[[nodiscard]] std::unique_ptr< PointSet< dimension > >
82+
steal_corner_mesh( const uuid& id );
83+
8184
private:
8285
Corners< dimension >& corners_;
8386
};

include/geode/model/mixin/builder/lines_builder.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ namespace geode
7575
[[nodiscard]] EdgedCurve< dimension >& modifiable_line_mesh(
7676
const uuid& id );
7777

78+
[[nodiscard]] std::unique_ptr< EdgedCurve< dimension > >
79+
steal_line_mesh( const uuid& id );
80+
7881
private:
7982
Lines< dimension >& lines_;
8083
};

include/geode/model/mixin/builder/surfaces_builder.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ namespace geode
8686
[[nodiscard]] SurfaceMesh< dimension >& modifiable_surface_mesh(
8787
const uuid& id );
8888

89+
[[nodiscard]] std::unique_ptr< SurfaceMesh< dimension > >
90+
steal_surface_mesh( const uuid& id );
91+
8992
private:
9093
Surfaces< dimension >& surfaces_;
9194
};

include/geode/model/mixin/core/block.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ namespace geode
8585

8686
[[nodiscard]] const MeshImpl& mesh_type() const;
8787

88-
template < typename TypedMesh = Mesh >
89-
[[nodiscard]] TypedMesh& modifiable_mesh( BlocksKey /*unused*/ )
90-
{
91-
return dynamic_cast< TypedMesh& >( get_modifiable_mesh() );
92-
}
93-
9488
public:
9589
explicit Block( BlocksKey key );
9690

@@ -100,6 +94,12 @@ namespace geode
10094

10195
void set_mesh( std::unique_ptr< Mesh > mesh, BlocksBuilderKey key );
10296

97+
template < typename TypedMesh = Mesh >
98+
[[nodiscard]] TypedMesh& modifiable_mesh( BlocksKey /*unused*/ )
99+
{
100+
return dynamic_cast< TypedMesh& >( get_modifiable_mesh() );
101+
}
102+
103103
template < typename TypedMesh = Mesh >
104104
[[nodiscard]] TypedMesh& modifiable_mesh( BlocksBuilderKey /*unused*/ )
105105
{
@@ -108,6 +108,9 @@ namespace geode
108108

109109
void set_block_name( std::string_view name, BlocksBuilderKey key );
110110

111+
[[nodiscard]] std::unique_ptr< Mesh > steal_mesh(
112+
BlocksBuilderKey key );
113+
111114
private:
112115
Block();
113116

include/geode/model/mixin/core/corner.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ namespace geode
7979

8080
[[nodiscard]] const Mesh& mesh() const;
8181

82-
[[nodiscard]] Mesh& modifiable_mesh( CornersKey key );
83-
8482
[[nodiscard]] const MeshImpl& mesh_type() const;
8583

8684
public:
@@ -94,8 +92,13 @@ namespace geode
9492

9593
void set_corner_name( std::string_view name, CornersBuilderKey key );
9694

95+
[[nodiscard]] Mesh& modifiable_mesh( CornersKey key );
96+
9797
[[nodiscard]] Mesh& modifiable_mesh( CornersBuilderKey key );
9898

99+
[[nodiscard]] std::unique_ptr< Mesh > steal_mesh(
100+
CornersBuilderKey key );
101+
99102
private:
100103
Corner();
101104

include/geode/model/mixin/core/detail/mesh_storage.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ namespace geode
5959
return *mesh_;
6060
}
6161

62+
[[nodiscard]] std::unique_ptr< Mesh > steal_mesh()
63+
{
64+
return std::move( mesh_ );
65+
}
66+
6267
[[nodiscard]] const MeshImpl& mesh_type() const
6368
{
6469
return mesh_type_;

include/geode/model/mixin/core/line.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ namespace geode
8080

8181
[[nodiscard]] const MeshImpl& mesh_type() const;
8282

83-
[[nodiscard]] Mesh& modifiable_mesh( LinesKey key );
84-
8583
public:
8684
explicit Line( LinesKey key );
8785

@@ -93,8 +91,12 @@ namespace geode
9391

9492
void set_line_name( std::string_view name, LinesBuilderKey key );
9593

94+
[[nodiscard]] Mesh& modifiable_mesh( LinesKey key );
95+
9696
[[nodiscard]] Mesh& modifiable_mesh( LinesBuilderKey key );
9797

98+
[[nodiscard]] std::unique_ptr< Mesh > steal_mesh( LinesBuilderKey key );
99+
98100
private:
99101
Line();
100102

include/geode/model/mixin/core/surface.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ namespace geode
108108
return dynamic_cast< TypedMesh& >( get_modifiable_mesh() );
109109
}
110110

111+
[[nodiscard]] std::unique_ptr< Mesh > steal_mesh(
112+
SurfacesBuilderKey key );
113+
111114
private:
112115
Surface();
113116

include/geode/model/representation/builder/brep_builder.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ namespace geode
110110

111111
ModelCopyMapping copy( const BRep& brep );
112112

113+
void replace_components_meshes_by_others(
114+
BRep&& other, const ModelCopyMapping& mapping );
115+
113116
ModelCopyMapping copy_components( const BRep& brep );
114117

115118
void copy_components( ModelCopyMapping& mapping, const BRep& brep );

0 commit comments

Comments
 (0)