Skip to content

Commit

Permalink
Merge topic 'model-names'
Browse files Browse the repository at this point in the history
02ca9b2 Use model manager to assign polygon names...
3237de1 Eliminate a compiler warning (Xcode 8.3).

Acked-by: Kitware Robot <[email protected]>
Acked-by: Haocheng Liu <[email protected]>
Merge-request: !544
  • Loading branch information
vibraphone authored and kwrobot committed Apr 21, 2017
2 parents 955ccd4 + 02ca9b2 commit 714b980
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
10 changes: 4 additions & 6 deletions smtk/bridge/polygon/operators/CreateModel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,17 @@ smtk::model::OperatorResult CreateModel::operateInternal()
{
modelName = nameItem->value(0);
}
else
{
std::ostringstream ss;
ss << "model " << this->nextModelNumber();
modelName = ss.str();
}

mgr = sess->manager();
smtk::model::Model model = mgr->addModel(/* par. dim. */ 2, /* emb. dim. */ 3, modelName);
storage->setId(model.entity());
storage->setSession(sess);
this->addStorage(model.entity(), storage);
model.setSession(smtk::model::SessionRef(mgr, sess->sessionId()));
if (modelName.empty())
{
model.assignDefaultName();
}

result = this->createResult(smtk::model::OPERATION_SUCCEEDED);
this->addEntityToResult(result, model, CREATED);
Expand Down
2 changes: 1 addition & 1 deletion smtk/extension/vtk/filter/vtkCMBApplyBathymetryFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ T vtkCMBApplyBathymetryFilter::vtkCmbInternalTerrainInfo::getElevation(
for ( vtkIdType i=0; i < size; ++i)
{
//average the elevation
assert(ids->GetId(i)<this->IdToElevation.size());
assert(ids->GetId(i) < static_cast<vtkIdType>(this->IdToElevation.size()));
sum += this->IdToElevation[ids->GetId(i)];
}
ids->Delete();
Expand Down
6 changes: 3 additions & 3 deletions smtk/model/operators/SaveSMTKModel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,18 @@ OperatorResult SaveSMTKModel::operateInternal()
std::string oldmodelname = modit->name();
bool matchDefault = false;
bool matchPrevious = false;
const std::string defaultprefix("model ");
const std::string defaultPrefix("Model ");
if (
renamePolicy == "all" ||
(matchDefault = std::equal(defaultprefix.begin(), defaultprefix.end(), oldmodelname.begin())) ||
(matchDefault = std::equal(defaultPrefix.begin(), defaultPrefix.end(), oldmodelname.begin())) ||
(matchPrevious = std::equal(oldfilename.begin(), oldfilename.end(), oldmodelname.begin())))
{
std::ostringstream newname;
newname << smtkfilename;
std::string suffix;
if (matchDefault)
{
suffix = oldmodelname.substr(defaultprefix.size() - 1); // include space after prefix
suffix = oldmodelname.substr(defaultPrefix.size() - 1); // include space after prefix
}
else if (matchPrevious)
{
Expand Down

0 comments on commit 714b980

Please sign in to comment.