- @Override
- public void applyStyleForNode(EvaluationContext observer, INode parent, StyleResult results) {
-// if (results == null) {
-// cleanupStyleForNode(observer, parent);
-// return;
-// }
-//
-// DistrictNetworkHoverInfoNode node = ProfileVariables.claimChild(parent, "*", DistrictNetworkHoverInfoNode.NODE_KEY, DistrictNetworkHoverInfoNode.class, observer);
-// if (node == null)
-// return;
-//
-// ParentNode<?> root = (ParentNode<?>) NodeUtil.getNearestParentOfType(parent, RTreeNode.class);
-// if (root != null) {
-// DeferredRenderingNode deferred = ProfileVariables.claimChild(root, "", HOVER_INFO_DEFERRED, DeferredRenderingNode.class, observer);
-// deferred.setZIndex(Integer.MAX_VALUE);
-// }
-//
-// node.setLabels(results.getLabels());
-// node.setOrigin(results.getOrigin());
- }
-
- @Override
- protected void cleanupStyleForNode(EvaluationContext observer, INode node) {
- ProfileVariables.denyChild(node, "*", DistrictNetworkHoverInfoNode.NODE_KEY);
- }
-
- private static Function1<Variable, List<Tuple3>> getUCTextGridFunctionCached(ReadGraph graph, Resource componentType)
- throws DatabaseException {
- return graph.syncRequest(new UCTextGridFunctionRequest(componentType), TransientCacheListener.instance());
- }
-
- private static final class UCTextGridFunctionRequest extends ResourceRead<Function1<Variable, List<Tuple3>>> {
- public UCTextGridFunctionRequest(Resource resource) {
- super(resource);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Function1<Variable, List<Tuple3>> perform(ReadGraph graph) throws DatabaseException {
- Resource actionsModule = Layer0Utils.getPossibleChild(graph, resource, ACTIONS_MODULE);
- if (actionsModule == null || !graph.isInstanceOf(actionsModule, Layer0.getInstance(graph).SCLModule))
- return null;
-
- String uri = graph.getURI(actionsModule);
- SCLContext sclContext = SCLContext.getCurrent();
- Object oldGraph = sclContext.get("graph");
- try {
- sclContext.put("graph", graph);
- return (Function1<Variable, List<Tuple3>>) SCLOsgi.MODULE_REPOSITORY.getValue(uri, HOVER_CONTRIBUTION);
- } catch (ValueNotFound e1) {
- return null;
- } finally {
- sclContext.put("graph", oldGraph);
- }
- }
- }
+ public static Point2D calculatePoint(INode node, int zoomLevel, Point2D result) {
+ if (node instanceof DistrictNetworkVertexNode) {
+ DistrictNetworkVertexNode vertex = (DistrictNetworkVertexNode) node;
+ return DistrictNetworkNodeUtils.calculatePoint2D(vertex.getVertex().getPoint(), result);
+ } else if (node instanceof DistrictNetworkEdgeNode) {
+ DistrictNetworkEdgeNode edge = (DistrictNetworkEdgeNode) node;
+ Point2D cp = edge.getCenterPoint(zoomLevel);
+ if (result == null)
+ result = new Point2D.Double();
+ result.setLocation(cp);
+ return result;
+ }
+ return null;
+ }
+
+ private static Function1<Variable, List<Tuple3>> getUCTextGridFunctionCached(ReadGraph graph, Resource componentType)
+ throws DatabaseException {
+ return graph.syncRequest(new UCTextGridFunctionRequest(componentType), TransientCacheListener.instance());
+ }
+
+ private static final class UCTextGridFunctionRequest extends ResourceRead<Function1<Variable, List<Tuple3>>> {
+ public UCTextGridFunctionRequest(Resource resource) {
+ super(resource);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Function1<Variable, List<Tuple3>> perform(ReadGraph graph) throws DatabaseException {
+ Resource actionsModule = CommonDBUtils.getPossibleChild(graph, resource, ACTIONS_MODULE);
+ if (actionsModule == null || !graph.isInstanceOf(actionsModule, Layer0.getInstance(graph).SCLModule))
+ return null;
+
+ String uri = graph.getURI(actionsModule);
+ SCLContext sclContext = SCLContext.getCurrent();
+ Object oldGraph = sclContext.get("graph");
+ try {
+ sclContext.put("graph", graph);
+ return (Function1<Variable, List<Tuple3>>) SCLOsgi.MODULE_REPOSITORY.getValue(uri, HOVER_CONTRIBUTION);
+ } catch (ValueNotFound e1) {
+ return null;
+ } finally {
+ sclContext.put("graph", oldGraph);
+ }
+ }
+ }
+