Changeset 546 for cpp/frams/model/model.h
 Timestamp:
 07/28/16 03:39:26 (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

cpp/frams/model/model.h
r544 r546 414 414 void rotate(const Pt3D& angles) { Orient o = Orient_1; o.rotate(angles); rotate(o); } 415 415 416 /// build this model using new shapes, based on the provided model that uses old shapes. See also shapeconvert.cpp.417 void buildUsing NewShapes(const Model& src_old_shapes, Part::Shape default_shape = Part::SHAPE_CYLINDER, float thickness = 0.2);416 /// build this model using solid shape types, based on the provided ballandstick model. See also shapeconvert.cpp. 417 void buildUsingSolidShapeTypes(const Model& src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, float thickness = 0.2); 418 418 419 419 #ifdef EASYMAPDEBUG … … 448 448 }; 449 449 450 /** 451 An object of this class is created from a Model and returns the solidstype const Model& regardless of the source Model shape type. 452 For solidstype Models, the same source Model reference is returned. 453 For ballandsticktype Models, the new temporary Model is created (using Model::buildUsingSolidShapeTypes). 454 Useful for making the solidsonly code work for both solids Models and ballandstick Models, without if's and special cases, like in this example: 455 456 void fun(const Model& input) // 'input' can be any shape type 457 { 458 SolidsShapeTypeModel converted(input); // 'converted' contains either 'input' or the new solidstype Model created from 'input' 459 functionAcceptingSolidsTypeModel(converted); // operator const Model&() is called automatically because of the function signature 460 int n=converted.getModel().getPartCount(); // getting the const Model& explicitly (converted.getPartCount() would fail) 461 } 462 */ 463 class SolidsShapeTypeModel 464 { 465 public: 466 Model *converted_model; 467 const Model *using_model; 468 SolidsShapeTypeModel(const Model& m, Part::Shape use_shape = Part::SHAPE_CYLINDER, float thickness = 0.2); 469 operator const Model&() const { return *using_model; } 470 const Model& getModel() const { return *using_model; } 471 ~SolidsShapeTypeModel() { if (converted_model) delete converted_model; } 472 }; 473 450 474 #endif
Note: See TracChangeset
for help on using the changeset viewer.