X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fvisualisations%2FDynamicVisualisationsContributions.java;h=e3ede04fb970053c87d17962f2fbf398ab140e98;hb=2de54d0f65ace8c56d27a5a1191e4420b96e22c2;hp=6c25d237886fc82825045d7f45e08c257511a5e6;hpb=459ec7f12a161219cea7c8b76fe72ae46fe33569;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network/src/org/simantics/district/network/visualisations/DynamicVisualisationsContributions.java b/org.simantics.district.network/src/org/simantics/district/network/visualisations/DynamicVisualisationsContributions.java index 6c25d237..e3ede04f 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/visualisations/DynamicVisualisationsContributions.java +++ b/org.simantics.district.network/src/org/simantics/district/network/visualisations/DynamicVisualisationsContributions.java @@ -64,7 +64,8 @@ public class DynamicVisualisationsContributions { results.put(colorMap.getLabel(), colorMap); } } catch (ValueNotFound e) { - e.printStackTrace(); + // ignore + LOGGER.debug("Dynamic color maps not found for {}", sclModule, e); } finally { SCLContext.getCurrent().put("graph", oldGraph); } @@ -93,7 +94,8 @@ public class DynamicVisualisationsContributions { results.put(sizeMap.getLabel(), sizeMap); } } catch (ValueNotFound e) { - e.printStackTrace(); + // ignore + LOGGER.debug("Dynamic size maps not found for {}", sclModule, e); } finally { SCLContext.getCurrent().put("graph", oldGraph); } @@ -145,27 +147,17 @@ public class DynamicVisualisationsContributions { Resource sclModule = Layer0Utils.getPossibleChild(graph, moduleType.getResource(), L0.SCLModule, DYNAMIC_VISUALISATIONS_CONTRIBUTION_MODULE); if (sclModule != null) { String moduleURI = graph.getURI(sclModule); - return new DynamicColoringObject(moduleType, getDynamicColorContributionSupplier(moduleURI, COLOR_CONTRIBUTION)); + return new DynamicColoringObject(moduleType, getContributionSupplier(moduleURI, COLOR_CONTRIBUTION)); } return null; } - -// private static DynamicColoringMap dynamicColoringMap(ReadGraph graph, NamedResource moduleType) throws DatabaseException { -// Layer0 L0 = Layer0.getInstance(graph); -// Resource sclModule = Layer0Utils.getPossibleChild(graph, moduleType.getResource(), L0.SCLModule, DYNAMIC_VISUALISATIONS_CONTRIBUTION_MODULE); -// if (sclModule != null) { -// String moduleURI = graph.getURI(sclModule); -// return new DynamicColoringMap(moduleType, getDynamicColoringMapSupplier(moduleURI, COLOR_CONTRIBUTION)); -// } -// return null; -// } - + private static DynamicSizingObject dynamicSizingObject(ReadGraph graph, NamedResource moduleType) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); Resource sclModule = Layer0Utils.getPossibleChild(graph, moduleType.getResource(), L0.SCLModule, DYNAMIC_VISUALISATIONS_CONTRIBUTION_MODULE); if (sclModule != null) { String moduleURI = graph.getURI(sclModule); - return new DynamicSizingObject(moduleType, getDynamicSizeContributionSupplier(moduleURI, SIZE_CONTRIBUTION)); + return new DynamicSizingObject(moduleType, getContributionSupplier(moduleURI, SIZE_CONTRIBUTION)); } return null; } @@ -194,67 +186,25 @@ public class DynamicVisualisationsContributions { Resource sclModule = Layer0Utils.getPossibleChild(graph, moduleType.getResource(), L0.SCLModule, DYNAMIC_VISUALISATIONS_CONTRIBUTION_MODULE); if (sclModule != null) { String moduleURI = graph.getURI(sclModule); - return new DynamicArrowObject(moduleType, getDynamicEdgeArrowContributionSupplier(moduleURI, ARROW_CONTRIBUTION)); + return new DynamicArrowObject(moduleType, getContributionSupplier(moduleURI, ARROW_CONTRIBUTION)); } return null; } - - private static Supplier> getDynamicColorMapSupplier(String uri, String expressionText) { - return () -> { - try { - @SuppressWarnings("unchecked") - List result = (List) SCLOsgi.MODULE_REPOSITORY.getValue(uri, expressionText); - return result.stream();//result.stream().map(DynamicColorContribution::fromTuple9); - } catch (ValueNotFound e) { - LOGGER.error("Could not find contributions", e); - //throw new RuntimeException(e); - return Stream.empty(); - } - }; - } - - private static Supplier> getDynamicColorContributionSupplier(String uri, String expressionText) { - return () -> { - try { - @SuppressWarnings("unchecked") - List result = (List) SCLOsgi.MODULE_REPOSITORY.getValue(uri, expressionText); - return result.stream();//result.stream().map(DynamicColorContribution::fromTuple9); - } catch (ValueNotFound e) { - LOGGER.error("Could not find contributions", e); - //throw new RuntimeException(e); - return Stream.empty(); - } - }; - } - private static Supplier> getDynamicEdgeArrowContributionSupplier(String uri, String expressionText) { + private static Supplier> getContributionSupplier(String uri, String expressionText) { return () -> { try { @SuppressWarnings("unchecked") - List result = (List) SCLOsgi.MODULE_REPOSITORY.getValue(uri, expressionText); + List result = (List) SCLOsgi.MODULE_REPOSITORY.getValue(uri, expressionText); return result.stream();//result.stream().map(DynamicColorContribution::fromTuple9); } catch (ValueNotFound e) { - LOGGER.error("Could not find contributions", e); + LOGGER.trace("Could not find contributions for module {} and expression {}", uri, expressionText, e); //throw new RuntimeException(e); return Stream.empty(); } }; } - private static Supplier> getDynamicSizeContributionSupplier(String uri, String expressionText) { - return () -> { - try { - @SuppressWarnings("unchecked") - List result = (List) SCLOsgi.MODULE_REPOSITORY.getValue(uri, expressionText); - return result.stream();//result.stream().map(DynamicColorContribution::fromTuple9); - } catch (ValueNotFound e) { - LOGGER.error("Could not find contributions", e); - //throw new RuntimeException(e); - return Stream.empty(); - } - }; - } - public static class DynamicArrowObject { private final NamedResource arrowObject;