Changeset 544 for cpp/frams/model
- Timestamp:
- 07/28/16 01:09:29 (8 years ago)
- Location:
- cpp/frams/model
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/model.cpp
r536 r544 944 944 if (p->p.z + p->size > bbmax.z) bbmax.z = p->p.z + p->size; 945 945 if (shape == SHAPE_UNKNOWN) 946 shape = (p->shape == Part::SHAPE_ DEFAULT) ? SHAPE_OLD : SHAPE_NEW;946 shape = (p->shape == Part::SHAPE_BALL_AND_STICK) ? SHAPE_BALL_AND_STICK : SHAPE_SOLIDS; 947 947 else if (shape != SHAPE_ILLEGAL) 948 948 { 949 if ((p->shape == Part::SHAPE_ DEFAULT) ^ (shape == SHAPE_OLD))949 if ((p->shape == Part::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK)) 950 950 { 951 951 shape = SHAPE_ILLEGAL; 952 logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent part shapes (mixed old and new shapes)%s", nameForErrors().c_str());952 logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent part shapes (mixed ball-and-stick and solids shape types)%s", nameForErrors().c_str()); 953 953 } 954 954 } … … 1014 1014 if (final) 1015 1015 { 1016 if (j->shape != Joint::SHAPE_ SOLID)1016 if (j->shape != Joint::SHAPE_FIXED) 1017 1017 { 1018 1018 if (j->d() > getMaxJoint().d.x) … … 1031 1031 if (shape != SHAPE_ILLEGAL) 1032 1032 { 1033 if ((j->shape == Joint::SHAPE_ DEFAULT) ^ (shape == SHAPE_OLD))1033 if ((j->shape == Joint::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK)) 1034 1034 { 1035 1035 shape = SHAPE_ILLEGAL; … … 1363 1363 if ((oj2->part1 == op) || (oj2->part2 == op)) 1364 1364 { 1365 addNewJoint(getPart(j), getPart(j2), Joint::SHAPE_ SOLID);1365 addNewJoint(getPart(j), getPart(j2), Joint::SHAPE_FIXED); 1366 1366 } 1367 1367 } -
cpp/frams/model/model.h
r522 r544 119 119 120 120 public: 121 enum Shape { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_OLD, SHAPE_NEW};121 enum ShapeType { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_BALL_AND_STICK, SHAPE_SOLIDS }; 122 122 protected: 123 Shape shape;123 ShapeType shape; 124 124 125 125 void updateNeuroRefno(); // set Neuro::refno for all neurons … … 156 156 int isValid() const { return buildstatus == valid; } 157 157 int getErrorPosition(bool includingwarnings = false); 158 Shape getShape(){ return shape; }158 ShapeType getShapeType() const { return shape; } 159 159 160 160 void updateRefno(); // set ::refno for all elements … … 359 359 360 360 /** create new Part and add it to the model. @see addPart() */ 361 Part *addNewPart(Part::Shape shape = Part::SHAPE_ DEFAULT) { return addPart(new Part(shape)); }361 Part *addNewPart(Part::Shape shape = Part::SHAPE_BALL_AND_STICK) { return addPart(new Part(shape)); } 362 362 /** create new Joint and add it to the model. @see addJoint() */ 363 Joint *addNewJoint(Part *p1 = NULL, Part *p2 = NULL, Joint::Shape shape = Joint::SHAPE_ DEFAULT) { Joint *j = addJoint(new Joint()); j->shape = shape; if ((p1 != NULL) && (p2 != NULL)) j->attachToParts(p1, p2); return j; }363 Joint *addNewJoint(Part *p1 = NULL, Part *p2 = NULL, Joint::Shape shape = Joint::SHAPE_BALL_AND_STICK) { Joint *j = addJoint(new Joint()); j->shape = shape; if ((p1 != NULL) && (p2 != NULL)) j->attachToParts(p1, p2); return j; } 364 364 /** create new Neuro and add it to the model. @see addNeuro() */ 365 365 Neuro *addNewNeuro() { return addNeuro(new Neuro()); } -
cpp/frams/model/modelparts.h
r408 r544 85 85 /// 86 86 paInt shape;///default=old Framsticks compatible, do not mix with shapes>0 87 enum Shape {SHAPE_ DEFAULT=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3};87 enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3}; 88 88 double mass,size,density,friction,ingest,assim,hollow; 89 89 Pt3D scale; … … 95 95 double vsize; 96 96 97 Part(enum Shape s=SHAPE_ DEFAULT);97 Part(enum Shape s=SHAPE_BALL_AND_STICK); 98 98 Part(const Part& src):PartBase(getDefaultStyle()) {operator=(src);} 99 99 void operator=(const Part& src); … … 124 124 class Pt3D d; ///< position delta between parts 125 125 class Pt3D rot; ///< orientation delta between parts expressed as 3 angles 126 enum Shape {SHAPE_ DEFAULT=0, SHAPE_SOLID=1};127 paInt shape;///< default=old Framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with shape>0, solid=merge parts into one physical entity126 enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_FIXED=1}; 127 paInt shape;///< ball-and-stick=old Framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with shape>0, fixed=merge parts into one physical entity 128 128 129 129 Joint();
Note: See TracChangeset
for help on using the changeset viewer.