]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Fixed most warnings from district codebase after JavaSE-11 switch 86/4186/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 22 Apr 2020 09:34:40 +0000 (12:34 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 22 Apr 2020 09:34:40 +0000 (12:34 +0300)
gitlab simantics/platform#524

Change-Id: Iaacf66511566b43a2af2dff18317c639ff6ffe2a

21 files changed:
org.simantics.district.maps/src/org/simantics/maps/WebService.java
org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeRoutePointToVertexHandler.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeVertexToRoutePointHandler.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkEdgeArrayNode.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkStaticInfoNode.java
org.simantics.district.network.ui/src/org/simantics/district/network/ui/styles/DistrictNetworkStaticInfoStyle.java
org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java [deleted file]
org.simantics.district.network/src/org/simantics/district/network/profile/DNElementColorStyle.java [deleted file]
org.simantics.district.network/src/org/simantics/district/network/profile/DNElementSizeStyle.java [deleted file]
org.simantics.district.network/src/org/simantics/district/network/profile/DynamicVisualisationsRequest.java
org.simantics.district.network/src/org/simantics/district/network/profile/HideStyle.java [deleted file]
org.simantics.district.network/src/org/simantics/district/network/profile/ThrottledStyleBase.java [deleted file]
org.simantics.district.network/src/org/simantics/district/network/profile/VertexSymbolStyle.java [deleted file]
org.simantics.district.network/src/org/simantics/district/network/visualisations/model/DynamicSizeContribution.java
org.simantics.district.repository/pom.xml
org.simantics.district.route.ui/src/org/simantics/district/route/ui/actions/ValidateRouteAction.java
org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/TiffInterface.java
org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/TiffTileInterface.java

index 3bfab58cef2bf947b654f378cc25e56d002512f1..0e6ccf9cd1e6be6842bb7e7bea8bf22ddb2f53ba 100644 (file)
@@ -12,6 +12,7 @@
 package org.simantics.maps;
 
 import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
 import java.net.HttpURLConnection;
 import java.net.InetSocketAddress;
 import java.net.MalformedURLException;
@@ -47,10 +48,9 @@ public class WebService {
         IProxyUtil util = null;
         try {
             Class<?> proxyClass = (Class<?>) Class.forName("org.simantics.maps.eclipse.EclipseProxyUtil");
-            util = (IProxyUtil)proxyClass.newInstance();
-        } catch (ClassNotFoundException e1) {
-        } catch (InstantiationException e) {
-        } catch (IllegalAccessException e) {
+            util = (IProxyUtil)proxyClass.getDeclaredConstructor().newInstance();
+        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException
+                | InvocationTargetException | NoSuchMethodException | SecurityException e) {
         }
         // AppletProxyUtil should exist always..
         if(util == null) {
index fe83bd10999c07a24d54b4b0b0678772799f2eac..5bdd2555c7bb373b53a6c34789f13f92fd0ae688 100644 (file)
@@ -197,7 +197,7 @@ public class MapNode extends G2DNode implements ITileListener  {
             // Try to load eclipse specific implementation of TileJobQueue, if it doesn't exist, fall back to pojo implementation 
             try {
                 Class<?> proxyClass = (Class<?>) Class.forName("org.simantics.maps.eclipse.TileJobQueue");
-                job = (ITileJobQueue)proxyClass.newInstance();
+                job = (ITileJobQueue)proxyClass.getDeclaredConstructor().newInstance();
             } catch (ClassNotFoundException e1) {
             } catch (InstantiationException e) {
             } catch (IllegalAccessException e) {
index 3f32f445265a84325082b195f417b40ab2278fc6..3b33020f452d5e1252c7fc72193f53da437a3e1a 100644 (file)
@@ -148,8 +148,6 @@ public class ChangeMappingTypeHandler {
                                 
                                 @Override
                                 public void perform(WriteGraph graph) throws DatabaseException {
-                                    DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-                                    
                                     for (Map.Entry<Resource, Collection<NamedResource>> entry : results.entrySet()) {
                                         List<Resource> elements = entry.getValue().stream()
                                             .map(NamedResource::getResource)
index f9e37c088bc2751b8e9c339a66d312f1409df0df..8d3037c5adb9d36092dec6a2da5a013dce688ea2 100644 (file)
@@ -38,8 +38,6 @@ import org.simantics.district.network.ui.NetworkDrawingParticipant;
 import org.simantics.g2d.canvas.ICanvasContext;
 import org.simantics.g2d.participant.MouseUtil;
 import org.simantics.g2d.participant.MouseUtil.MouseInfo;
-import org.simantics.maps.elevation.server.SingletonTiffTileInterface;
-import org.simantics.maps.elevation.server.prefs.MapsElevationServerPreferences;
 import org.simantics.ui.workbench.e4.E4WorkbenchUtils;
 import org.simantics.utils.threads.ThreadUtils;
 import org.simantics.utils.ui.ISelectionUtils;
@@ -159,9 +157,12 @@ public class ChangeRoutePointToVertexHandler {
                                                     double y = finalClosestPoint.getY();
                                                     double[] midVertexCoords = new double[] { x, y };
                                                     
+                                                    @SuppressWarnings("unused")
                                                     Resource createdVertex = DistrictNetworkUtil.createVertex(graph, diagram, midVertexCoords, Double.MAX_VALUE, mapping);
 
+                                                    @SuppressWarnings("unused")
                                                     Optional<Resource> leftEdge = DNEdgeBuilder.create(graph, diagram, currentStartVertexCoords, Double.MAX_VALUE, midVertexCoords, Double.MAX_VALUE, detailedLeftEdgeGeometryCoords, 0.001);
+                                                    @SuppressWarnings("unused")
                                                     Optional<Resource> rightEdge = DNEdgeBuilder.create(graph, diagram, midVertexCoords, Double.MAX_VALUE, currentEndVertexCoords, Double.MAX_VALUE, detailedRightEdgeGeometryCoords, 0.001);
                                                 }
                                             }
index cd71341758fec8d1ff7413b8b1c4dfbd9372641d..bf8571be3fe138f21f6af5082e6f9b6ea814c98a 100644 (file)
@@ -6,8 +6,6 @@ import java.awt.geom.Point2D;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Collection;
 import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.TimeUnit;
 
 import javax.inject.Named;
 
@@ -23,15 +21,12 @@ import org.simantics.databoard.Bindings;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;
 import org.simantics.db.WriteGraph;
-import org.simantics.db.common.request.ReadRequest;
 import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.SelectionHints;
 import org.simantics.db.layer0.util.RemoverUtil;
 import org.simantics.db.request.Read;
 import org.simantics.diagram.stubs.DiagramResource;
-import org.simantics.district.network.DNEdgeBuilder;
-import org.simantics.district.network.DistrictNetworkUtil;
 import org.simantics.district.network.ModelledCRS;
 import org.simantics.district.network.ontology.DistrictNetworkResource;
 import org.simantics.district.network.ui.DistrictDiagramEditor;
@@ -39,10 +34,7 @@ import org.simantics.district.network.ui.NetworkDrawingParticipant;
 import org.simantics.g2d.canvas.ICanvasContext;
 import org.simantics.g2d.participant.MouseUtil;
 import org.simantics.g2d.participant.MouseUtil.MouseInfo;
-import org.simantics.maps.elevation.server.SingletonTiffTileInterface;
-import org.simantics.maps.elevation.server.prefs.MapsElevationServerPreferences;
 import org.simantics.ui.workbench.e4.E4WorkbenchUtils;
-import org.simantics.utils.threads.ThreadUtils;
 import org.simantics.utils.ui.ISelectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -94,8 +86,6 @@ public class ChangeVertexToRoutePointHandler {
                     return;
                 if (!(activeEditorPart instanceof DistrictDiagramEditor))
                     return;
-                DistrictDiagramEditor editor = (DistrictDiagramEditor) activeEditorPart;
-                Resource diagram = editor.getInputResource();
                 
                 Simantics.getSession().asyncRequest(new WriteRequest() {
                     
index 2513c39d7a33233e8af525a8542d5d3c5665a95d..eafb6f380088b87a5cefcf29772a0c0f46ff11a4 100644 (file)
@@ -175,7 +175,7 @@ public class Functions {
     
     @SCLValue(type = "ReadGraph -> Resource -> a -> b")
     public static Object enumerationValues(ReadGraph graph, Resource resource, Object context) throws DatabaseException {
-        Variable var = (Variable) context;
+        //Variable var = (Variable) context;
         return Collections.emptyList();
     }
     
index a28abada5b88f5f1f0c08365d418fa9f55ad7994..9d3adebeaa2aa821ec76cb8e8f618b6f308254ea 100644 (file)
@@ -8,7 +8,6 @@ import java.awt.geom.Path2D;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 
-import org.simantics.district.network.ui.styles.DistrictNetworkStaticInfoStyle;
 import org.simantics.scenegraph.ParentNode;
 import org.simantics.scenegraph.g2d.G2DNode;
 import org.simantics.scenegraph.g2d.nodes.spatial.RTreeNode;
index 523f7e805cc8c5cd73e6ebbf8d0f935df2f4e0bb..a8544a9b1858032e85c293a8f6e62fe1260abda6 100644 (file)
@@ -9,7 +9,6 @@ import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 
-import org.simantics.district.network.ui.styles.DistrictNetworkStaticInfoStyle;
 import org.simantics.scenegraph.ParentNode;
 import org.simantics.scenegraph.g2d.G2DNode;
 import org.simantics.scenegraph.g2d.nodes.spatial.RTreeNode;
@@ -24,6 +23,8 @@ public class DistrictNetworkStaticInfoNode extends G2DNode implements DeferredNo
 
        public static final String NODE_KEY = "DISTRICT_NETWORK_STATIC_INFO";
 
+       public static final String STATIC_INFO_DEFERRED = "staticInfo";
+
        String info = null;
        Point2D origin = new Point2D.Double();
        Point2D direction = new Point2D.Double();
@@ -35,7 +36,7 @@ public class DistrictNetworkStaticInfoNode extends G2DNode implements DeferredNo
        @Override
        public void render(Graphics2D g) {
                ParentNode<?> root = (ParentNode<?>) NodeUtil.getNearestParentOfType(this, RTreeNode.class);
-               DeferredRenderingNode deferred = root != null ? (DeferredRenderingNode) root.getNode(DistrictNetworkStaticInfoStyle.STATIC_INFO_DEFERRED) : null;
+               DeferredRenderingNode deferred = root != null ? (DeferredRenderingNode) root.getNode(STATIC_INFO_DEFERRED) : null;
                if (deferred != null)
                        deferred.deferNode(g.getTransform(), this);
                else
index ca592acfdd52d58647b2da056949273a403485fd..3dff9ad91ddc068a595b6da8176b03633224dc17 100644 (file)
@@ -50,8 +50,6 @@ public class DistrictNetworkStaticInfoStyle extends StyleBase<DistrictNetworkSta
        private static final String ACTIONS_MODULE = "Actions";
        private static final String PIPELINE_INFO = "pipelineInfo";
 
-       public static final String STATIC_INFO_DEFERRED = "staticInfo";
-
        public static class StyleResult {
                public StyleResult(Resource r, Point2D p1, String info) {
                        this.r = r;
@@ -162,7 +160,7 @@ public class DistrictNetworkStaticInfoStyle extends StyleBase<DistrictNetworkSta
 
                ParentNode<?> root = (ParentNode<?>) NodeUtil.getNearestParentOfType(parent, RTreeNode.class);
                if (root != null) {
-                       DeferredRenderingNode deferred = ProfileVariables.claimChild(root, "", STATIC_INFO_DEFERRED, DeferredRenderingNode.class, evaluationContext);
+                       DeferredRenderingNode deferred = ProfileVariables.claimChild(root, "", DistrictNetworkStaticInfoNode.STATIC_INFO_DEFERRED, DeferredRenderingNode.class, evaluationContext);
                        deferred.setZIndex(Integer.MAX_VALUE-1);
                }
 
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/ArrowLengthStyle.java
deleted file mode 100644 (file)
index bcbb06e..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.simantics.district.network.profile;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.simantics.databoard.Bindings;
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
-import org.simantics.db.common.procedure.adapter.TransientCacheListener;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.variable.Variable;
-import org.simantics.db.layer0.variable.Variables;
-import org.simantics.district.network.ontology.DistrictNetworkResource;
-import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicArrowObject;
-import org.simantics.district.network.visualisations.model.DynamicArrowContribution;
-import org.simantics.district.network.visualisations.model.DynamicVisualisation;
-import org.simantics.layer0.Layer0;
-import org.simantics.modeling.ModelingResources;
-import org.simantics.scenegraph.INode;
-import org.simantics.scenegraph.g2d.G2DSceneGraph;
-import org.simantics.scenegraph.g2d.nodes.ConnectionNode;
-import org.simantics.scenegraph.profile.EvaluationContext;
-import org.simantics.scenegraph.profile.common.ProfileVariables;
-import org.simantics.scl.runtime.SCLContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ArrowLengthStyle extends ThrottledStyleBase<Double> {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(ArrowLengthStyle.class);
-       private static final Double PENDING = Double.NaN;
-
-       @Override
-       public Double calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
-               Resource diagram = graph.getSingleObject(groupItem, Layer0.getInstance(graph).PartOf);
-               Set<Resource> edgesToUse = graph.syncRequest(new MidBranchEdgeSetRequest(diagram), TransientCacheListener.instance());
-               if (!edgesToUse.contains(groupItem))
-                       return null;
-               
-        DynamicVisualisation dv = graph.syncRequest(new RuntimeDynamicVisualisationsRequest(runtimeDiagram),
-                TransientCacheAsyncListener.instance());
-               // Prevent PendingVariableExceptions from coming through
-               boolean wasSynchronous = graph.setSynchronous(true);
-               try {
-            if (dv != null) {
-                Layer0 L0 = Layer0.getInstance(graph);
-                DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-                ModelingResources MOD = ModelingResources.getInstance(graph);
-                Resource mapping = graph.getSingleObject(groupItem, DN.HasMapping);
-            
-                Map<String, DynamicArrowContribution> arrowContributions = dv.getArrowContributions();
-                String mappingName = graph.getRelatedValue(mapping, L0.HasName);
-                DynamicArrowContribution dac = arrowContributions.get(mappingName);
-                if (dac != null && dac.isUsed()) {
-    
-                    Resource mappedComponent = graph.getPossibleObject(groupItem, DN.MappedComponent);
-                    if (mappedComponent != null) {
-    
-                        Resource component = graph.getSingleObject(mappedComponent, MOD.ElementToComponent);
-                        Variable variable = Variables.getVariable(graph, component);
-                        Variable possibleActiveVariable = Variables.possibleActiveVariable(graph, variable);
-                        if (possibleActiveVariable != null) {
-    
-                            Variable module = possibleActiveVariable.getPossibleChild(graph, dac.getModuleName());
-                            if (module != null) {
-                                Variable attribute = module.getPossibleProperty(graph, dac.getAttributeName());
-                                if (attribute != null) {
-                                    Double possibleValue = attribute.getPossibleValue(graph, Bindings.DOUBLE);
-                                    if (possibleValue != null) {
-                                        
-                                        double biasValue;
-                                        double gainValue;
-                                        if (dac.isUseDefault()) {
-                                            DynamicArrowObject dynamicArrowObject = dv.getDefaultArrowContributions().get(mappingName);
-                                            
-                                            // This is required if ontology module needs to be compiled
-                                            Object currentGraph = SCLContext.getCurrent().get("graph");
-                                            try {
-                                                SCLContext.getCurrent().put("graph", graph);
-                                                
-                                                DynamicArrowContribution ddcc = dynamicArrowObject.getArrowContributions().get(dac.getLabel());
-                                                biasValue = ddcc.getDefaultBias();
-                                                gainValue = ddcc.getDefaultGain();
-                                            } finally {
-                                                SCLContext.getCurrent().put("graph", currentGraph);
-                                            }
-                                        } else {
-                                            biasValue = dac.getDefaultBias();
-                                            gainValue = dac.getDefaultGain();
-                                        }
-                                        // here we do the adjusting according to spec in #15038
-                                        return possibleValue.doubleValue() * gainValue + biasValue;
-                                    } else {
-                                        LOGGER.warn("No value for {}", attribute.getURI(graph));
-                                    }
-                                } else {
-                                    LOGGER.warn("Wrong attribute name {} for {} !!", dac.getAttributeName(), module.getURI(graph));
-                                }
-                            } else {
-                                LOGGER.warn("Wrong modulename {} for {} !!", dac.getModuleName(), possibleActiveVariable.getURI(graph));
-                            }
-                        } else {
-                            LOGGER.debug("No active experiment for {}", variable.getURI(graph));
-                        }
-                    } else {
-                        LOGGER.debug("No mapped component for {} to calculate dynamic color style", groupItem);
-                    }
-                }
-            }
-        } finally {
-            graph.setSynchronous(wasSynchronous);
-        }
-        return null;
-    }
-
-       @Override
-       public void applyThrottledStyleForNode(EvaluationContext observer, INode node, Double value) {
-//             System.out.println("apply: " + node + " : " + value);
-               ConnectionNode n = (ConnectionNode) node;
-               if (value == PENDING) {
-                       ((G2DSceneGraph)node.getRootNode()).setPending(node);
-               } else {
-                       ((G2DSceneGraph)node.getRootNode()).clearPending(node);
-               }
-               for (INode nn : n.getNodes())
-                       ProfileVariables.claimNodeProperty(nn, "arrowLength", value, observer);
-       }
-
-       @Override
-       protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) {
-               ((G2DSceneGraph)node.getRootNode()).clearPending(node);
-               ConnectionNode n = (ConnectionNode) node;
-               for (INode nn : n.getNodes())
-                       ProfileVariables.claimNodeProperty(nn, "arrowLength", null, evaluationContext);
-       }
-}
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/DNElementColorStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/DNElementColorStyle.java
deleted file mode 100644 (file)
index 1e50a92..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.simantics.district.network.profile;
-
-import java.awt.Color;
-import java.util.Map;
-
-import org.simantics.databoard.Bindings;
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.variable.Variable;
-import org.simantics.db.layer0.variable.Variables;
-import org.simantics.district.network.ontology.DistrictNetworkResource;
-import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicColoringObject;
-import org.simantics.district.network.visualisations.model.DynamicColorContribution;
-import org.simantics.district.network.visualisations.model.DynamicColorMap;
-import org.simantics.district.network.visualisations.model.DynamicVisualisation;
-import org.simantics.layer0.Layer0;
-import org.simantics.modeling.ModelingResources;
-import org.simantics.scenegraph.INode;
-import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
-import org.simantics.scenegraph.profile.EvaluationContext;
-import org.simantics.scenegraph.profile.common.ProfileVariables;
-import org.simantics.scl.runtime.SCLContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author Tuukka Lehtonen
- * @since 1.35.0
- */
-public class DNElementColorStyle extends ThrottledStyleBase<Color> {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(DNElementColorStyle.class);
-
-    private static final boolean DEBUG = false;
-
-       @Override
-       public Color calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
-           
-        DynamicVisualisation dv = graph.syncRequest(new RuntimeDynamicVisualisationsRequest(runtimeDiagram),
-                TransientCacheAsyncListener.instance());
-
-        // Prevent PendingVariableExceptions from coming through
-        boolean wasSynchronous = graph.setSynchronous(true);
-        try {
-            if (dv != null) {
-                Layer0 L0 = Layer0.getInstance(graph);
-                DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-                ModelingResources MOD = ModelingResources.getInstance(graph);
-                Resource mapping = graph.getSingleObject(groupItem, DN.HasMapping);
-            
-                Map<String, DynamicColorContribution> colorContributions = dv.getColorContributions();
-                String mappingName = graph.getRelatedValue(mapping, L0.HasName);
-                DynamicColorContribution dcc = colorContributions.get(mappingName);
-                if (dcc != null && dcc.isUsed()) {
-    
-                    Resource mappedComponent = graph.getPossibleObject(groupItem, DN.MappedComponent);
-                    if (mappedComponent != null) {
-    
-                        Resource component = graph.getSingleObject(mappedComponent, MOD.ElementToComponent);
-                        Variable variable = Variables.getVariable(graph, component);
-                        Variable possibleActiveVariable = Variables.possibleActiveVariable(graph, variable);
-                        if (possibleActiveVariable != null) {
-    
-                            Variable module = possibleActiveVariable.getPossibleChild(graph, dcc.getModuleName());
-                            if (module != null) {
-                                Variable attribute = module.getPossibleProperty(graph, dcc.getAttributeName());
-                                if (attribute != null) {
-                                    Double possibleValue = attribute.getPossibleValue(graph, Bindings.DOUBLE);
-                                    if (possibleValue != null) {
-                                        
-                                        double minValue;
-                                        double maxValue;
-                                        if (dcc.isUseDefault()) {
-                                            DynamicColoringObject dynamicColoringObject = dv.getDefaultColorContributions().get(mappingName);
-                                            
-                                            // This is required if ontology module needs to be compiled
-                                            Object currentGraph = SCLContext.getCurrent().get("graph");
-                                            try {
-                                                SCLContext.getCurrent().put("graph", graph);
-                                                
-                                                DynamicColorContribution ddcc = dynamicColoringObject.getColorContributions().get(dcc.getLabel());
-                                                minValue = ddcc.getDefaultMin();
-                                                maxValue = ddcc.getDefaultMax();
-                                            } finally {
-                                                SCLContext.getCurrent().put("graph", currentGraph);
-                                            }
-                                        } else {
-                                            minValue = dcc.getDefaultMin();
-                                            maxValue = dcc.getDefaultMax();
-                                        }
-                                        // here we do the adjusting according to spec in #15038
-                                        double adjustedValue = possibleValue.doubleValue() * dcc.getVariableGain() + dcc.getVariableBias();
-                                        DynamicColorMap defaultColorMap = dcc.getDefaultColorMap();
-                                        Color color = defaultColorMap.getColor(adjustedValue, dv.getColorBarOptions().isUseGradients(), minValue, maxValue);
-                                        return color;
-                                    } else {
-                                        LOGGER.warn("No value for {}", attribute.getURI(graph));
-                                    }
-                                } else {
-                                    LOGGER.warn("Wrong attribute name {} for {} !!", dcc.getAttributeName(), module.getURI(graph));
-                                }
-                            } else {
-                                LOGGER.warn("Wrong modulename {} for {} !!", dcc.getModuleName(), possibleActiveVariable.getURI(graph));
-                            }
-                        } else {
-                            LOGGER.debug("No active experiment for {}", variable.getURI(graph));
-                        }
-                    } else {
-                        LOGGER.debug("No mapped component for {} to calculate dynamic color style", groupItem);
-                    }
-                }
-            }
-               }
-               finally {
-                       graph.setSynchronous(wasSynchronous);
-               }
-               return null;
-       }
-
-       @Override
-       public void applyThrottledStyleForNode(EvaluationContext observer, INode node, Color color) {
-               SingleElementNode n = (SingleElementNode) node;
-               for (INode nn : n.getNodes())
-                       ProfileVariables.claimNodeProperty(nn, "dynamicColor", color, observer);
-       }
-
-       @Override
-       protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) {
-               SingleElementNode n = (SingleElementNode) node;
-               for (INode nn : n.getNodes())
-                       ProfileVariables.claimNodeProperty(nn, "dynamicColor", null, evaluationContext);
-       }
-
-}
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/DNElementSizeStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/DNElementSizeStyle.java
deleted file mode 100644 (file)
index 870f745..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.simantics.district.network.profile;
-
-import java.util.Map;
-
-import org.simantics.databoard.Bindings;
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.variable.Variable;
-import org.simantics.db.layer0.variable.Variables;
-import org.simantics.district.network.ontology.DistrictNetworkResource;
-import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicColoringObject;
-import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicSizingObject;
-import org.simantics.district.network.visualisations.model.DynamicColorContribution;
-import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
-import org.simantics.district.network.visualisations.model.DynamicSizeMap;
-import org.simantics.district.network.visualisations.model.DynamicVisualisation;
-import org.simantics.layer0.Layer0;
-import org.simantics.modeling.ModelingResources;
-import org.simantics.scenegraph.INode;
-import org.simantics.scenegraph.g2d.G2DSceneGraph;
-import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
-import org.simantics.scenegraph.profile.EvaluationContext;
-import org.simantics.scenegraph.profile.common.ProfileVariables;
-import org.simantics.scl.runtime.SCLContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author Jani Simomaa
- */
-public class DNElementSizeStyle extends ThrottledStyleBase<Double> {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(DNElementSizeStyle.class);
-    private static final boolean DEBUG = false;
-    
-    private static final Double PENDING = Double.NaN;
-    private static final Double ONE = 1.0;
-
-       @Override
-       public Double calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
-           
-        DynamicVisualisation dv = graph.syncRequest(new RuntimeDynamicVisualisationsRequest(runtimeDiagram),
-                TransientCacheAsyncListener.instance());
-
-        // Prevent PendingVariableExceptions from coming through
-        boolean wasSynchronous = graph.setSynchronous(true);
-        try {
-            if (dv != null) {
-                Layer0 L0 = Layer0.getInstance(graph);
-                DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-                ModelingResources MOD = ModelingResources.getInstance(graph);
-                Resource mapping = graph.getSingleObject(groupItem, DN.HasMapping);
-            
-                Map<String, DynamicSizeContribution> sizeContributions = dv.getSizeContributions();
-                String mappingName = graph.getRelatedValue(mapping, L0.HasName);
-                DynamicSizeContribution dsc = sizeContributions.get(mappingName);
-                if (dsc != null && dsc.isUsed()) {
-    
-                    Resource mappedComponent = graph.getPossibleObject(groupItem, DN.MappedComponent);
-                    if (mappedComponent != null) {
-    
-                        Resource component = graph.getSingleObject(mappedComponent, MOD.ElementToComponent);
-                        Variable variable = Variables.getVariable(graph, component);
-                        Variable possibleActiveVariable = Variables.possibleActiveVariable(graph, variable);
-                        if (possibleActiveVariable != null) {
-    
-                            Variable module = possibleActiveVariable.getPossibleChild(graph, dsc.getModuleName());
-                            if (module != null) {
-                                Variable attribute = module.getPossibleProperty(graph, dsc.getAttributeName());
-                                if (attribute != null) {
-                                    Double possibleValue = attribute.getPossibleValue(graph, Bindings.DOUBLE);
-                                    if (possibleValue != null) {
-                                        
-                                        
-                                        double minValue;
-                                        double maxValue;
-                                        if (dsc.isUseDefault()) {
-                                            DynamicSizingObject dynamicSizingObject = dv.getDefaultSizeContributions().get(mappingName);
-                                            
-                                            // This is required if ontology module needs to be compiled
-                                            Object currentGraph = SCLContext.getCurrent().get("graph");
-                                            try {
-                                                SCLContext.getCurrent().put("graph", graph);
-                                                
-                                                DynamicSizeContribution ddcc = dynamicSizingObject.getSizeContributions().get(dsc.getLabel());
-                                                minValue = ddcc.getDefaultMin();
-                                                maxValue = ddcc.getDefaultMax();
-                                            } finally {
-                                                SCLContext.getCurrent().put("graph", currentGraph);
-                                            }
-                                        } else {
-                                            minValue = dsc.getDefaultMin();
-                                            maxValue = dsc.getDefaultMax();
-                                        }
-                                        // here we do the adjusting according to spec in #15038
-                                        double adjustedValue = possibleValue.doubleValue() * dsc.getVariableGain() + dsc.getVariableBias();
-                                        DynamicSizeMap defaultSizeMap = dsc.getDefaultSizeMap();
-                                        double size = defaultSizeMap.getSize(adjustedValue, dv.getSizeBarOptions().isUseGradients(), minValue, maxValue);
-                                        return size;
-                                    } else {
-                                        LOGGER.warn("No value for {}", attribute.getURI(graph));
-                                    }
-                                } else {
-                                    LOGGER.warn("Wrong attribute name {} for {} !!", dsc.getAttributeName(), module.getURI(graph));
-                                }
-                            } else {
-                                LOGGER.warn("Wrong modulename {} for {} !!", dsc.getModuleName(), possibleActiveVariable.getURI(graph));
-                            }
-                        } else {
-                            LOGGER.debug("No active experiment for {}", variable.getURI(graph));
-                        }
-                    } else {
-                        LOGGER.debug("No mapped component for {} to calculate dynamic size style", groupItem);
-                    }
-                }
-            }
-               }
-               finally {
-                       graph.setSynchronous(wasSynchronous);
-               }
-               return 1.0;
-       }
-
-       @Override
-       public void applyThrottledStyleForNode(EvaluationContext observer, INode node, Double value) {
-        //System.out.println("apply: " + node + " : " + value);
-        SingleElementNode n = (SingleElementNode) node;
-        if (value == PENDING) {
-            ((G2DSceneGraph)node.getRootNode()).setPending(node);
-        } else {
-            ((G2DSceneGraph)node.getRootNode()).clearPending(node);
-        }
-        if (value == null)
-            value = ONE;
-        for (INode nn : n.getNodes()) {
-            ProfileVariables.claimNodeProperty(nn, "size", value, observer);
-            ProfileVariables.claimNodeProperty(nn, "stroke", value, observer);
-        }
-       }
-
-       @Override
-       protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) {
-        ((G2DSceneGraph)node.getRootNode()).clearPending(node);
-        SingleElementNode n = (SingleElementNode) node;
-        for (INode nn : n.getNodes()) {
-            ProfileVariables.claimNodeProperty(nn, "size", ONE, evaluationContext);
-            ProfileVariables.claimNodeProperty(nn, "stroke", ONE, evaluationContext);
-        }
-       }
-
-}
index 0387029ffdf98fefaabce12d2fc4e4c6b86e6a99..f8aa0b0a33218517769cbb1143b38b11feaec4af 100644 (file)
@@ -9,7 +9,6 @@ import org.simantics.db.Resource;
 import org.simantics.db.common.NamedResource;
 import org.simantics.db.common.request.ResourceRead;
 import org.simantics.db.exception.DatabaseException;
-import org.simantics.district.network.DistrictNetworkUtil;
 import org.simantics.district.network.ontology.DistrictNetworkResource;
 import org.simantics.district.network.visualisations.DynamicVisualisations;
 import org.simantics.layer0.Layer0;
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/HideStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/HideStyle.java
deleted file mode 100644 (file)
index fff5fde..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.simantics.district.network.profile;
-
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.procedure.adapter.TransientCacheListener;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.diagram.profile.StyleBase;
-import org.simantics.district.network.visualisations.model.DynamicVisualisation;
-import org.simantics.scenegraph.INode;
-import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
-import org.simantics.scenegraph.profile.EvaluationContext;
-import org.simantics.scenegraph.profile.common.ProfileVariables;
-
-/**
- * @author Tuukka Lehtonen
- */
-public class HideStyle extends StyleBase<Boolean> {
-
-    @Override
-    public Boolean calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
-        
-        DynamicVisualisation dv = graph.syncRequest(new ActiveDynamicVisualisationsRequest(runtimeDiagram), TransientCacheListener.instance());
-        
-        
-        return Boolean.TRUE;
-    }
-
-    @Override
-    public void applyStyleForNode(EvaluationContext evaluationContext, INode node, Boolean result) {
-        SingleElementNode n = (SingleElementNode) node;
-        for (INode nn : n.getNodes())
-            ProfileVariables.claimNodeProperty(nn, "hidden", true, evaluationContext);
-    }
-    
-    @Override
-    protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) {
-        SingleElementNode n = (SingleElementNode) node;
-        for (INode nn : n.getNodes())
-            ProfileVariables.claimNodeProperty(nn, "hidden", false, evaluationContext);
-    }
-
-    @Override
-    public String toString() {
-        return "Hide";
-    }
-
-}
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/ThrottledStyleBase.java b/org.simantics.district.network/src/org/simantics/district/network/profile/ThrottledStyleBase.java
deleted file mode 100644 (file)
index 483f62e..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2019 Association for Decentralized Information Management in
- * Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Semantum Oy - initial API and implementation
- *******************************************************************************/
-package org.simantics.district.network.profile;
-
-import java.util.Optional;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.request.UnaryRead;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.procedure.Listener;
-import org.simantics.db.request.Read;
-import org.simantics.diagram.profile.StyleBase;
-import org.simantics.diagram.stubs.DiagramResource;
-import org.simantics.district.network.ontology.DistrictNetworkResource;
-import org.simantics.scenegraph.INode;
-import org.simantics.scenegraph.profile.EvaluationContext;
-import org.simantics.scenegraph.profile.Group;
-import org.simantics.scenegraph.profile.Observer;
-import org.simantics.scenegraph.profile.common.ObserverGroupListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class ThrottledStyleBase<Result> extends StyleBase<Optional<Result>> {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(ThrottledStyleBase.class);
-    private static final long DEFAULT_INTERVAL = 2000;
-
-    //private long lastCalculateTimestamp = 0;
-    private AtomicLong interval = new AtomicLong(DEFAULT_INTERVAL);
-    private Listener<Optional<Result>> resultListener;
-
-    @Override
-    protected Read<Optional<Result>> getStyleCalculationRequest(Resource runtimeDiagram, Resource entry, Resource item) {
-        //Simantics.getSession().asyncRequest(new ProfileUpdateIntervalRead(runtimeDiagram), new ProfileUpdateIntervalListener(runtimeDiagram, entry, item)); 
-        return super.getStyleCalculationRequest(runtimeDiagram, entry, item);
-    }
-
-    @Override
-    protected Listener<Optional<Result>> getStyleResultListener(ObserverGroupListener groupListener, Resource item,
-            Group group, Observer observer, Resource runtimeDiagram) {
-        resultListener = super.getStyleResultListener(groupListener, item, group, observer, runtimeDiagram);
-        return resultListener;
-    }
-
-    @Override
-    public final Optional<Result> calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry,
-            Resource groupItem) throws DatabaseException {
-// Needs fixing - this will result registration of listeners for nothing in the cache
-//        long currentTimestamp = System.currentTimeMillis();
-//        if (lastCalculateTimestamp > (currentTimestamp - interval.get())) {
-//            LOGGER.debug("Throttling result calculation for {} {} {} {}", runtimeDiagram, entry, groupItem, interval.get());
-//            return Optional.empty();
-//        }
-//        lastCalculateTimestamp = currentTimestamp;
-        // let's calculate
-        return Optional.ofNullable(calculateThrottledStyle(graph, runtimeDiagram, entry, groupItem));
-    }
-
-    public abstract Result calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException;
-
-    @Override
-    public final void applyStyleForNode(EvaluationContext evaluationContext, INode node, Optional<Result> result) {
-        if (!Optional.empty().equals(result) && result != null) {
-            applyThrottledStyleForNode(evaluationContext, node, result.get());
-        } else {
-            LOGGER.debug("Do not apply as results are unchanged for {} {} {}", evaluationContext, node, result);
-            // TODO: fix this duplicate method invocation with null
-            applyThrottledStyleForNode(evaluationContext, node, null);
-        }
-    }
-
-    public abstract void applyThrottledStyleForNode(EvaluationContext evaluationContext, INode node, Result result);
-    
-    private static class ProfileUpdateIntervalRead extends UnaryRead<Resource, Long> {
-
-        public ProfileUpdateIntervalRead(Resource parameter) {
-            super(parameter);
-        }
-
-        @Override
-        public Long perform(ReadGraph graph) throws DatabaseException {
-            Resource configuration = graph.getPossibleObject(parameter, DiagramResource.getInstance(graph).RuntimeDiagram_HasConfiguration);
-            DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-            Long interval = DEFAULT_INTERVAL;
-            if (configuration != null) {
-                // TODO: take back to use when throttled profile is actually working
-                // interval = graph.getPossibleRelatedValue(configuration, DN.Diagram_profileUpdateInterval, Bindings.LONG);
-            }
-            return interval != null ? interval : DEFAULT_INTERVAL;
-        }
-    }
-    
-    private class ProfileUpdateIntervalListener implements Listener<Long> {
-
-        private Resource runtimeDiagram;
-        private Resource entry;
-        private Resource item;
-
-        public ProfileUpdateIntervalListener(Resource runtimeDiagram, Resource entry, Resource item) {
-            this.runtimeDiagram = runtimeDiagram;
-            this.entry = entry;
-            this.item = item;
-        }
-
-        @Override
-        public void execute(Long result) {
-            interval.set(result);
-        }
-
-        @Override
-        public void exception(Throwable t) {
-            LOGGER.error("Could not listen interval from runtime diagram {}", runtimeDiagram, t);
-        }
-
-        @Override
-        public boolean isDisposed() {
-            return resultListener.isDisposed();
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + getEnclosingInstance().hashCode();
-            result = prime * result + ((entry == null) ? 0 : entry.hashCode());
-            result = prime * result + ((item == null) ? 0 : item.hashCode());
-            result = prime * result + ((runtimeDiagram == null) ? 0 : runtimeDiagram.hashCode());
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj)
-                return true;
-            if (obj == null)
-                return false;
-            if (getClass() != obj.getClass())
-                return false;
-            ProfileUpdateIntervalListener other = (ProfileUpdateIntervalListener) obj;
-            if (!getEnclosingInstance().equals(other.getEnclosingInstance()))
-                return false;
-            if (entry == null) {
-                if (other.entry != null)
-                    return false;
-            } else if (!entry.equals(other.entry))
-                return false;
-            if (item == null) {
-                if (other.item != null)
-                    return false;
-            } else if (!item.equals(other.item))
-                return false;
-            if (runtimeDiagram == null) {
-                if (other.runtimeDiagram != null)
-                    return false;
-            } else if (!runtimeDiagram.equals(other.runtimeDiagram))
-                return false;
-            return true;
-        }
-
-        private ThrottledStyleBase<Result> getEnclosingInstance() {
-            return ThrottledStyleBase.this;
-        }
-    }
-
-}
diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/VertexSymbolStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/VertexSymbolStyle.java
deleted file mode 100644 (file)
index 913ba20..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.simantics.district.network.profile;
-
-import org.simantics.Simantics;
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.procedure.adapter.TransientCacheListener;
-import org.simantics.db.common.request.ResourceRead;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.district.network.ontology.DistrictNetworkResource;
-import org.simantics.layer0.Layer0;
-import org.simantics.scenegraph.INode;
-import org.simantics.scenegraph.g2d.G2DSceneGraph;
-import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
-import org.simantics.scenegraph.profile.EvaluationContext;
-import org.simantics.scenegraph.profile.common.ProfileVariables;
-import org.simantics.scl.runtime.function.Function;
-import org.simantics.scl.runtime.function.FunctionImpl1;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Deprecated
-public class VertexSymbolStyle extends ThrottledStyleBase<String> {
-
-       private static final Logger LOGGER = LoggerFactory.getLogger(VertexSymbolStyle.class);
-
-    @Override
-    public String calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
-        return calculateStyle(graph, entry, groupItem);
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public static String calculateStyle(ReadGraph graph, Resource entry, Resource groupItem) throws DatabaseException {
-        // Prevent PendingVariableExceptions from coming through
-        boolean wasSynchronous = graph.setSynchronous(true);
-        try {
-            Function symbolFunction = getSymbolFunction(graph, entry);
-            if (symbolFunction == null)
-                return null;
-
-            try {
-                return (String) Simantics.applySCLRead(graph, symbolFunction, groupItem);
-            } catch (Exception e) {
-                LOGGER.error("Getting dynamic symbol for " + groupItem + " ("
-                        + graph.getPossibleRelatedValue(groupItem, Layer0.getInstance(graph).HasName) + ") failed", e);
-                return null;
-            }
-        } finally {
-            graph.setSynchronous(wasSynchronous);
-        }
-    }
-
-       @SuppressWarnings("rawtypes")
-       public static Function getSymbolFunction(ReadGraph graph, Resource entry) throws DatabaseException {
-               // Cache function read for profile entry
-               return graph.syncRequest(new SymbolFunctionRequest(entry), TransientCacheListener.<Function>instance());
-       }
-
-       @Override
-       public void applyThrottledStyleForNode(EvaluationContext observer, INode node, String value) {
-               SingleElementNode n = (SingleElementNode) node;
-               for (INode nn : n.getNodes())
-                       ProfileVariables.claimNodeProperty(nn, "SVG", value, observer);
-       }
-
-       @Override
-       protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) {
-               ((G2DSceneGraph)node.getRootNode()).clearPending(node);
-               SingleElementNode n = (SingleElementNode) node;
-               for (INode nn : n.getNodes())
-                       ProfileVariables.claimNodeProperty(nn, "SVG", null, evaluationContext);
-       }
-
-       @SuppressWarnings("rawtypes")
-       protected static final class SymbolFunctionRequest extends ResourceRead<Function> {
-               protected static final Function CONST_NULL = new FunctionImpl1<Resource, String>() {
-                       @Override
-                       public String apply(Resource p0) {
-                               return null;
-                       }
-               };
-               
-               public SymbolFunctionRequest(Resource entry) {
-                       super(entry);
-               }
-
-               @Override
-               public Function perform(ReadGraph graph) throws DatabaseException {
-                       DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-                       
-                       Function symbolFunction = (Function) graph.getPossibleRelatedValue2(resource, DN.HasSymbolFunction, resource);
-                       if (symbolFunction == null)
-                               symbolFunction = CONST_NULL;
-                       
-                       return symbolFunction;
-               }
-       }
-
-}
index 9adc4ddd3e281c512200959200bea2dcf70a0007..9dc67d1c8cd7fba41163418721ce2977b4139eae 100644 (file)
@@ -1,8 +1,5 @@
 package org.simantics.district.network.visualisations.model;
 
-import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicSizingObject;
-import org.simantics.scl.runtime.SCLContext;
-
 public class DynamicSizeContribution {
 
     private String label;
index c43ce767ad6f5b467b4e842fb527c142eb9752f5..889477d64b59a3c442a206d88557f84e354573a6 100644 (file)
                                                                                <ignore></ignore>
                                                                        </action>
                                                                </pluginExecution>
+                                                               <pluginExecution>
+                                                                       <pluginExecutionFilter>
+                                                                               <groupId>org.simantics</groupId>
+                                                                               <artifactId>
+                                                                                       graph-builder-maven-plugin
+                                                                               </artifactId>
+                                                                               <versionRange>
+                                                                                       [0.0.9,)
+                                                                               </versionRange>
+                                                                               <goals>
+                                                                                       <goal>compile-graphs</goal>
+                                                                               </goals>
+                                                                       </pluginExecutionFilter>
+                                                                       <action>
+                                                                               <ignore></ignore>
+                                                                       </action>
+                                                               </pluginExecution>
                                                        </pluginExecutions>
                                                </lifecycleMappingMetadata>
                                        </configuration>
index 5b0e7d0506e456b40532fe8fd18364bb052123c0..5ef65b77a8535486f4b50650b5fe7e11af9e0877 100644 (file)
@@ -1,6 +1,5 @@
 package org.simantics.district.route.ui.actions;
 
-import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 
index f5935318348612517d6a6db3317e7b9b325ce934..c3a27a4f04e754aeddf1f96b89eea85ae02cdef9 100644 (file)
@@ -67,21 +67,21 @@ public class TiffInterface implements Closeable {
             case DataBuffer.TYPE_BYTE: {
                 // TODO: if the result is byte how does one subtract the pipeDepth form the value?
                 // Might not be even relevant with this use case 
-                return new Byte(((byte[]) r)[0]);
+                return Byte.valueOf(((byte[]) r)[0]);
             }
             case DataBuffer.TYPE_SHORT:  // Fall through
             case DataBuffer.TYPE_USHORT: // Fall through
             case DataBuffer.TYPE_INT: {
                 int val = ((int[]) r)[0] - pipeDepthUnderGround;
-                return new Integer(val);
+                return Integer.valueOf(val);
             }
             case DataBuffer.TYPE_FLOAT: {
                 float val = ((float[]) r)[0] - pipeDepthUnderGround;
-                return new Float(val);
+                return Float.valueOf(val);
             }
             case DataBuffer.TYPE_DOUBLE: {
                 double val = ((double[]) r)[0] - pipeDepthUnderGround;
-                return new Double(val);
+                return Double.valueOf(val);
             }
             default: return null;
         }
index 0cbf3fa5e03f31f80a50d9f796c66780f37715af..6cc9cd7b79e0c544f01f14f02c7c23563ef50927 100644 (file)
@@ -118,6 +118,7 @@ public class TiffTileInterface implements Closeable {
     public Number lookup(double x, double y) {
         LOGGER.trace("Looking up x={} y={}", x, y);
         DirectPosition p = new DirectPosition2D(c4326, x, y);
+        @SuppressWarnings("unchecked")
         List<Path> tifFiles = (List<Path>) index.query(new Envelope(new Coordinate(x, y)));
         for (Path tifFile : tifFiles) {
             TiffInterface tifInterface = openTifInterface(tifFile);
@@ -131,7 +132,7 @@ public class TiffTileInterface implements Closeable {
                 //System.out.println("not found");
             }
         }
-        return new Double(0); // use 0 by default for now
+        return Double.valueOf(0); // use 0 by default for now
     }
 
     @Override