Ignore:
Timestamp:
07/13/20 13:51:43 (4 years ago)
Author:
Maciej Komosinski
Message:

More consistent usage of "shapetype" (vs. "shape")

File:
1 edited

Legend:

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

    r988 r999  
    1717}
    1818
    19 void Model::init(ShapeType sh)
     19void Model::init(ShapeType shtype)
    2020{
    2121        partmappingchanged = 0;
     
    2929        f0map = 0;
    3030        f0genoknown = 1;
    31         shape = SHAPE_UNKNOWN;
    32         declared_shape = sh;
    33 }
    34 
    35 void Model::declareShapeType(ShapeType sh)
    36 {
    37         declared_shape = sh;
     31        shapetype = SHAPETYPE_UNKNOWN;
     32        declared_shapetype = shtype;
     33}
     34
     35void Model::declareShapeType(ShapeType shtype)
     36{
     37        declared_shapetype = shtype;
    3838}
    3939
     
    5656        geno = mod.geno;
    5757        f0genoknown = 0;
    58         shape = mod.shape;
    59         declared_shape = mod.declared_shape;
     58        shapetype = mod.shapetype;
     59        declared_shapetype = mod.declared_shapetype;
    6060        startenergy = mod.startenergy;
    6161        modelfromgenotype = mod.modelfromgenotype;
     
    117117        :autobuildmaps(buildmaps)
    118118{
    119         init(mod.declared_shape);
     119        init(mod.declared_shapetype);
    120120        open(_using_checkpoints, _is_checkpoint);
    121121        internalCopy(mod);
     
    169169        delMap();
    170170        delF0Map();
    171         init(declared_shape);
     171        init(declared_shapetype);
    172172        geno = Geno();
    173173        f0geno = Geno();
     
    340340        f0warnposition = -1;
    341341        MultiMap *convmap = autobuildmaps ? new MultiMap() : NULL;
    342         if (declared_shape == SHAPE_UNKNOWN)
     342        if (declared_shapetype == SHAPETYPE_UNKNOWN)
    343343                f0geno = geno.getConverted(Geno::F0_FORMAT_LIST, convmap, using_checkpoints);
    344344        else
    345                 f0geno = geno.getConverted(genoFormatForShapeType(declared_shape), convmap, using_checkpoints);
     345                f0geno = geno.getConverted(genoFormatForShapeType(declared_shapetype), convmap, using_checkpoints);
    346346        f0genoknown = 1;
    347347        if (f0geno.isInvalid())
     
    351351                return;
    352352        }
    353         if (declared_shape == SHAPE_UNKNOWN)
     353        if (declared_shapetype == SHAPETYPE_UNKNOWN)
    354354                declareShapeType(shapeTypeForGenoFormat(f0geno.getFormat()));
    355355        SString f0txt = f0geno.getGenes();
     
    560560        switch (st)
    561561        {
    562         case SHAPE_BALL_AND_STICK:
     562        case SHAPETYPE_BALL_AND_STICK:
    563563                return "0";
    564         case SHAPE_SOLIDS:
     564        case SHAPETYPE_SOLIDS:
    565565                return "0s";
    566566        default:
     
    572572{
    573573        if (format == "0")
    574                 return SHAPE_BALL_AND_STICK;
     574                return SHAPETYPE_BALL_AND_STICK;
    575575        else if (format == "0s")
    576                 return SHAPE_SOLIDS;
     576                return SHAPETYPE_SOLIDS;
    577577        else
    578                 return SHAPE_UNKNOWN;
     578                return SHAPETYPE_UNKNOWN;
    579579
    580580}
     
    584584        switch (sh)
    585585        {
    586         case SHAPE_BALL_AND_STICK: return "ball-and-stick";
    587         case SHAPE_SOLIDS: return "solid shapes";
    588         case SHAPE_UNKNOWN: return "unknown";
    589 
    590         case SHAPE_ILLEGAL:
     586        case SHAPETYPE_BALL_AND_STICK: return "ball-and-stick";
     587        case SHAPETYPE_SOLIDS: return "solid shapes";
     588        case SHAPETYPE_UNKNOWN: return "unknown";
     589
     590        case SHAPETYPE_ILLEGAL:
    591591        default:
    592592                return "illegal";
     
    894894        int i, k;
    895895        int ret = 1;
    896         shape = SHAPE_UNKNOWN;
     896        shapetype = SHAPETYPE_UNKNOWN;
    897897        updateRefno();
    898898        if ((parts.size() == 0) && (neurons.size() == 0)) return 0;
     
    931931                        if (p->p.y + p->size > bbmax.y) bbmax.y = p->p.y + p->size;
    932932                        if (p->p.z + p->size > bbmax.z) bbmax.z = p->p.z + p->size;
    933                         if (shape == SHAPE_UNKNOWN)
    934                                 shape = (p->shape == Part::SHAPE_BALL_AND_STICK) ? SHAPE_BALL_AND_STICK : SHAPE_SOLIDS;
    935                         else if (shape != SHAPE_ILLEGAL)
     933                        if (shapetype == SHAPETYPE_UNKNOWN)
     934                                shapetype = (p->shape == Part::SHAPE_BALL) ? SHAPETYPE_BALL_AND_STICK : SHAPETYPE_SOLIDS;
     935                        else if (shapetype != SHAPETYPE_ILLEGAL)
    936936                        {
    937                                 if ((p->shape == Part::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK))
     937                                if ((p->shape == Part::SHAPE_BALL) ^ (shapetype == SHAPETYPE_BALL_AND_STICK))
    938938                                {
    939                                         shape = SHAPE_ILLEGAL;
     939                                        shapetype = SHAPETYPE_ILLEGAL;
    940940                                        logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent part shapes (mixed ball-and-stick and solids shape types)%s", nameForErrors().c_str());
    941941                                }
     
    10021002                                if ((check != LIVE_CHECK) && (check != CHECKPOINT_CHECK))
    10031003                                {
    1004                                         if (j->shape == Joint::SHAPE_BALL_AND_STICK)
     1004                                        if (j->shape == Joint::SHAPE_STICK)
    10051005                                        {
    10061006                                                if (j->d() > getMaxJoint().d.x)
     
    10171017                                ret = 0;
    10181018                        }
    1019                         if (shape != SHAPE_ILLEGAL)
     1019                        if (shapetype != SHAPETYPE_ILLEGAL)
    10201020                        {
    1021                                 if ((j->shape == Joint::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK))
     1021                                if ((j->shape == Joint::SHAPE_STICK) ^ (shapetype == SHAPETYPE_BALL_AND_STICK))
    10221022                                {
    1023                                         shape = SHAPE_ILLEGAL;
     1023                                        shapetype = SHAPETYPE_ILLEGAL;
    10241024                                        logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent joint shapes (mixed old and new shapes)%s", nameForErrors().c_str());
    10251025                                }
     
    11091109        }
    11101110
    1111         if (shape == SHAPE_ILLEGAL)
     1111        if (shapetype == SHAPETYPE_ILLEGAL)
    11121112                ret = 0;
    1113         else if ((declared_shape != SHAPE_UNKNOWN) && (declared_shape != shape))
    1114         {
    1115                 logPrintf("Model", "internalCheck", LOG_ERROR, "Model shape type '%s' does not match the declared type '%s'", getShapeTypeName(shape), getShapeTypeName(declared_shape));
     1113        else if ((declared_shapetype != SHAPETYPE_UNKNOWN) && (declared_shapetype != shapetype))
     1114        {
     1115                logPrintf("Model", "internalCheck", LOG_ERROR, "Model shape type '%s' does not match the declared type '%s'", getShapeTypeName(shapetype), getShapeTypeName(declared_shapetype));
    11161116                ret = 0;
    11171117        }
     
    13351335{
    13361336        using_model = converted_model = NULL;
    1337         if (m.getShapeType() == Model::SHAPE_BALL_AND_STICK)
     1337        if (m.getShapeType() == Model::SHAPETYPE_BALL_AND_STICK)
    13381338        {
    13391339                converted_model = new Model;
Note: See TracChangeset for help on using the changeset viewer.