From: jsimomaa Date: Wed, 29 Mar 2017 16:31:14 +0000 (+0300) Subject: Some fixes to district stuff X-Git-Tag: v1.31.0~13 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=a4395a1da139133059833fb1f909f5033676f8bc;p=simantics%2Fdistrict.git Some fixes to district stuff refs #6958 Change-Id: I55cd490238b75fede3e0b90dcf720cb28c23433f --- diff --git a/org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java b/org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java index 01eab3a3..e06adcb2 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java +++ b/org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java @@ -169,7 +169,7 @@ public class MapNode extends G2DNode implements ITileListener { public void init() { try { - ITileProvider provider = new OSMTileProvider(new WebService("http://localhost:8080/osm-bright/"), TILE_PIXEL_SIZE); + ITileProvider provider = new OSMTileProvider(new WebService("http://localhost:8080/mapbox-studio-osm-bright.tm2/"), TILE_PIXEL_SIZE); // Try to load eclipse specific implementation of TileJobQueue, if it doesn't exist, fall back to pojo implementation try { diff --git a/org.simantics.district.network.ontology/graph.tg b/org.simantics.district.network.ontology/graph.tg index c1cb1b6d..317d8ce0 100644 Binary files a/org.simantics.district.network.ontology/graph.tg and b/org.simantics.district.network.ontology/graph.tg differ diff --git a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph index 5c30822b..7719ed48 100644 --- a/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph +++ b/org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph @@ -69,6 +69,9 @@ DN.HasInLayerTag - + diff --git a/org.simantics.district.network.ui/icons/map.png b/org.simantics.district.network.ui/icons/map.png new file mode 100644 index 00000000..f90ef25e Binary files /dev/null and b/org.simantics.district.network.ui/icons/map.png differ diff --git a/org.simantics.district.network.ui/icons/map_go.png b/org.simantics.district.network.ui/icons/map_go.png new file mode 100644 index 00000000..11eab26d Binary files /dev/null and b/org.simantics.district.network.ui/icons/map_go.png differ diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java index 0ea5adf7..f421c673 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java @@ -32,6 +32,7 @@ import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.IndexRoot; +import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; @@ -40,6 +41,7 @@ import org.simantics.db.exception.ServiceException; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables.Role; import org.simantics.db.procedure.Procedure; +import org.simantics.diagram.stubs.DiagramResource; import org.simantics.district.network.ontology.DistrictNetworkResource; import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; @@ -280,9 +282,11 @@ public class Functions { } protected Map getComposites(ReadGraph graph, Resource element) throws DatabaseException { + Resource indexRoot = graph.sync(new IndexRoot(element)); - List composites = ModelingUtils.searchByType(graph, indexRoot, StructuralResource2.getInstance(graph).Composite); - List nonDistrictComposites = composites.stream().filter(comp -> { + List diagrams = ModelingUtils.searchByType(graph, indexRoot, DiagramResource.getInstance(graph).Diagram); + + List nonDistrictComposites = composites.values().stream().filter(comp -> { try { return !graph.isInstanceOf(comp, DistrictNetworkResource.getInstance(graph).Composite); } catch (ServiceException e1) { @@ -297,7 +301,7 @@ public class Functions { String name = graph.getRelatedValue2(mapping, L0.HasName); result.put(name, mapping); } catch (DatabaseException e) { - e.printStackTrace(); + LOGGER.error("Could not read name of " + mapping, e); } }); return result; diff --git a/org.simantics.district.ui.feature/feature.xml b/org.simantics.district.ui.feature/feature.xml index 8e0633e8..d4f241b2 100644 --- a/org.simantics.district.ui.feature/feature.xml +++ b/org.simantics.district.ui.feature/feature.xml @@ -48,4 +48,11 @@ version="0.0.0" unpack="false"/> + +