Commit 714b980b authored by David Thompson's avatar David Thompson Committed by Kitware Robot
Browse files

Merge topic 'model-names'

02ca9b2b Use model manager to assign polygon names...
3237de10

 Eliminate a compiler warning (Xcode 8.3).
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Haocheng LIU's avatarHaocheng Liu <haocheng.liu@kitware.com>
Merge-request: !544
parents 955ccd42 02ca9b2b
......@@ -94,12 +94,6 @@ 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);
......@@ -107,6 +101,10 @@ smtk::model::OperatorResult CreateModel::operateInternal()
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);
......
......@@ -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();
......
......@@ -100,10 +100,10 @@ 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;
......@@ -111,7 +111,7 @@ OperatorResult SaveSMTKModel::operateInternal()
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)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment