From: Reino Ruusu Date: Wed, 29 Jan 2020 13:10:04 +0000 (+0200) Subject: Added labels to piping component types X-Git-Tag: v1.43.0~85 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F19%2F3819%2F1;p=simantics%2F3d.git Added labels to piping component types gitlab #71 Change-Id: I956bb0ce2d9c449d805ee476f688bc9117926e7d --- 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))