Changeset 544 for cpp/frams/model


Ignore:
Timestamp:
07/28/16 01:09:29 (4 years ago)
Author:
Maciej Komosinski
Message:

Renamed:
Model::getShape() ==> Model::getShapeType()
Model::SHAPE_OLD ==> Model::SHAPE_BALL_AND_STICK
Model::SHAPE_NEW ==> Model::SHAPE_SOLIDS
Part::SHAPE_DEFAULT ==> Part::SHAPE_BALL_AND_STICK
Joint::SHAPE_DEFAULT ==> Joint::SHAPE_BALL_AND_STICK
Joint::SHAPE_SOLID ==> Joint::SHAPE_FIXED

Location:
cpp/frams/model
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/model.cpp

    r536 r544  
    944944                        if (p->p.z + p->size > bbmax.z) bbmax.z = p->p.z + p->size;
    945945                        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;
    947947                        else if (shape != SHAPE_ILLEGAL)
    948948                        {
    949                                 if ((p->shape == Part::SHAPE_DEFAULT) ^ (shape == SHAPE_OLD))
     949                                if ((p->shape == Part::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK))
    950950                                {
    951951                                        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());
    953953                                }
    954954                        }
     
    10141014                                if (final)
    10151015                                {
    1016                                         if (j->shape != Joint::SHAPE_SOLID)
     1016                                        if (j->shape != Joint::SHAPE_FIXED)
    10171017                                        {
    10181018                                                if (j->d() > getMaxJoint().d.x)
     
    10311031                        if (shape != SHAPE_ILLEGAL)
    10321032                        {
    1033                                 if ((j->shape == Joint::SHAPE_DEFAULT) ^ (shape == SHAPE_OLD))
     1033                                if ((j->shape == Joint::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK))
    10341034                                {
    10351035                                        shape = SHAPE_ILLEGAL;
     
    13631363                                        if ((oj2->part1 == op) || (oj2->part2 == op))
    13641364                                        {
    1365                                                 addNewJoint(getPart(j), getPart(j2), Joint::SHAPE_SOLID);
     1365                                                addNewJoint(getPart(j), getPart(j2), Joint::SHAPE_FIXED);
    13661366                                        }
    13671367                                }
  • cpp/frams/model/model.h

    r522 r544  
    119119
    120120public:
    121         enum Shape { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_OLD, SHAPE_NEW };
     121        enum ShapeType { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_BALL_AND_STICK, SHAPE_SOLIDS };
    122122protected:
    123         Shape shape;
     123        ShapeType shape;
    124124
    125125        void updateNeuroRefno(); // set Neuro::refno for all neurons
     
    156156        int isValid() const { return buildstatus == valid; }
    157157        int getErrorPosition(bool includingwarnings = false);
    158         Shape getShape() { return shape; }
     158        ShapeType getShapeType() const { return shape; }
    159159
    160160        void updateRefno(); // set ::refno for all elements
     
    359359
    360360        /** 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)); }
    362362        /** 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; }
    364364        /** create new Neuro and add it to the model. @see addNeuro() */
    365365        Neuro *addNewNeuro() { return addNeuro(new Neuro()); }
  • cpp/frams/model/modelparts.h

    r408 r544  
    8585///
    8686paInt 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};
     87enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3};
    8888double mass,size,density,friction,ingest,assim,hollow;
    8989Pt3D scale;
     
    9595double vsize;
    9696
    97 Part(enum Shape s=SHAPE_DEFAULT);
     97Part(enum Shape s=SHAPE_BALL_AND_STICK);
    9898Part(const Part& src):PartBase(getDefaultStyle()) {operator=(src);}
    9999void operator=(const Part& src);
     
    124124class Pt3D d;           ///< position delta between parts
    125125class 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 entity
     126enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_FIXED=1};
     127paInt 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
    128128
    129129Joint();
Note: See TracChangeset for help on using the changeset viewer.