From b402711239498596d7dfada0c66bc6627e37e7e6 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Wed, 29 Jan 2020 15:10:04 +0200 Subject: [PATCH] Added labels to piping component types gitlab #71 Change-Id: I956bb0ce2d9c449d805ee476f688bc9117926e7d --- .../graph/plant3d_builtins.pgraph | 18 ++++++++++- .../dialog/ComponentLabelProvider.java | 31 +++++++++++++++++-- .../src/org/simantics/plant3d/utils/Item.java | 10 +++++- .../org/simantics/plant3d/utils/P3DUtil.java | 3 +- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/org.simantics.plant3d.ontology/graph/plant3d_builtins.pgraph b/org.simantics.plant3d.ontology/graph/plant3d_builtins.pgraph index 4895630f..ff4f149b 100644 --- a/org.simantics.plant3d.ontology/graph/plant3d_builtins.pgraph +++ b/org.simantics.plant3d.ontology/graph/plant3d_builtins.pgraph @@ -19,12 +19,14 @@ P3D.Builtin.CapGeometryProvider : P3D.GeometryProvider P3D.Builtin.ConcentricReducer = 2 && Character.isLowerCase(ch) && + Character.isUpperCase(b.charAt(i-1)) && + b.charAt(i-2) != ' ') { + b.insert(i-1, ' '); + i++; + } + } + + return b.toString(); + } } diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/utils/Item.java b/org.simantics.plant3d/src/org/simantics/plant3d/utils/Item.java index 1ce6ed20..2a5b205a 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/utils/Item.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/utils/Item.java @@ -6,6 +6,7 @@ public class Item { private String uri; private String name; + private String label; private Type type; private boolean code = false; @@ -20,7 +21,11 @@ public class Item { this.name = name; } - + public Item(String type, String name, String label) { + this.uri = type; + this.name = name; + this.label = label; + } public String getUri() { return uri; @@ -91,4 +96,7 @@ public class Item { return uri.hashCode(); } + public String getLabel() { + return label; + } } diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java b/org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java index 055ffa11..ab795acc 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java @@ -188,7 +188,8 @@ public class P3DUtil { Plant3D p3d = Plant3D.getInstance(graph); String name = graph.getRelatedValue(r, l0.HasName); String uri = graph.getURI(r); - Item item = new Item(uri, name); + String label = graph.getPossibleRelatedValue(r, l0.HasLabel); + Item item = new Item(uri, name, label); if (graph.isInstanceOf(r, p3d.Equipment)) item.setType(Type.EQUIPMENT); else if (graph.isInstanceOf(r, p3d.InlineComponent)) -- 2.47.1