| 122 | } |
| 123 | |
| 124 | void renameLayer(const cmd::ArgumentList& args) |
| 125 | { |
| 126 | if (args.size() != 2) |
| 127 | { |
| 128 | rError() << "Usage: " << COMMAND_RENAMELAYER << " <LayerID> <NewLayerName>" << std::endl; |
| 129 | return; |
| 130 | } |
| 131 | |
| 132 | DoWithMapLayerManager([&](ILayerManager& manager) |
| 133 | { |
| 134 | auto layerName = manager.getLayerName(args[0].getInt()); |
| 135 | |
| 136 | if (args[1].getString().empty()) |
| 137 | { |
| 138 | throw cmd::ExecutionFailure(_("Cannot use an empty string as new layer name")); |
| 139 | } |
| 140 | |
| 141 | manager.renameLayer(args[0].getInt(), args[1].getString()); |
| 142 | GlobalMapModule().setModified(true); |
| 143 | }); |
| 144 | } |
| 145 | |
| 146 | void deleteLayer(const cmd::ArgumentList& args) |
| 147 | { |
nothing calls this directly
no test coverage detected