diff +multiblock/Def.m @ 543:9924f1f8c906 feature/grids

Allow labels to be block ids
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 15 Aug 2017 12:57:36 +0200
parents 3377bedf371f
children 687756646aa9
line wrap: on
line diff
--- a/+multiblock/Def.m	Mon Aug 14 16:46:58 2017 +0200
+++ b/+multiblock/Def.m	Tue Aug 15 12:57:36 2017 +0200
@@ -49,10 +49,10 @@
         end
 
         function show(obj, label, gridLines, varargin)
-            default_arg('label', true)
+            default_arg('label', 'name')
             default_arg('gridLines', false);
 
-            if ~label && ~gridLines
+            if isempty('label') && ~gridLines
                 for i = 1:obj.nBlocks
                     obj.blockMaps{i}.show(2,2);
                 end
@@ -67,10 +67,22 @@
                 end
             end
 
-            if label
-                for i = 1:obj.nBlocks
-                    parametrization.Ti.label(obj.blockMaps{i}, obj.blockNames{i});
-                end
+
+            switch label
+                case 'name'
+                    labels = obj.blockNames;
+                case 'id'
+                    labels = {};
+                    for i = 1:obj.nBlocks
+                        labels{i} = num2str(i);
+                    end
+                otherwise
+                    axis equal
+                    return
+            end
+
+            for i = 1:obj.nBlocks
+                parametrization.Ti.label(obj.blockMaps{i}, labels{i});
             end
 
             axis equal