]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Some fixes to district stuff 85/385/2
authorjsimomaa <jani.simomaa@gmail.com>
Wed, 29 Mar 2017 16:31:14 +0000 (19:31 +0300)
committerjsimomaa <jani.simomaa@gmail.com>
Wed, 29 Mar 2017 16:37:28 +0000 (19:37 +0300)
refs #6958

Change-Id: I55cd490238b75fede3e0b90dcf720cb28c23433f

org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java
org.simantics.district.network.ontology/graph.tg
org.simantics.district.network.ontology/graph/DistrictNetwork.pgraph
org.simantics.district.network.ontology/graph/images/map.png [new file with mode: 0644]
org.simantics.district.network.ontology/src/org/simantics/district/network/ontology/DistrictNetworkResource.java
org.simantics.district.network.ui/fragment.e4xmi
org.simantics.district.network.ui/icons/map.png [new file with mode: 0644]
org.simantics.district.network.ui/icons/map_go.png [new file with mode: 0644]
org.simantics.district.network.ui/src/org/simantics/district/network/ui/function/Functions.java
org.simantics.district.ui.feature/feature.xml

index 01eab3a33d20a96afcf321b4bbeb04e64444b9f6..e06adcb27e2d82ef8757cc9e4a8e96c6738313fc 100644 (file)
@@ -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 {
index c1cb1b6d1c219e7161f7bd853ee81def90644e73..317d8ce0641b5e4731d36d472db40508ab67870f 100644 (file)
Binary files a/org.simantics.district.network.ontology/graph.tg and b/org.simantics.district.network.ontology/graph.tg differ
index 5c30822b1f856c9cbcc8d79611a23f619f9938cc..7719ed48c1210f2acc4502080a925ee9b4b32f5a 100644 (file)
@@ -69,6 +69,9 @@ DN.HasInLayerTag <R L0.HasProperty
 
 DN.Connection <T DIA.Connection
 
+DN.Diagram.MappedDiagram <R L0.IsWeaklyRelatedTo
+DN.MappedComponent <R L0.IsWeaklyRelatedTo
+
 DN.Diagram <T DIA.Diagram
 
 DN.AddLayerToDNDiagramTemplate <T L0.Template
diff --git a/org.simantics.district.network.ontology/graph/images/map.png b/org.simantics.district.network.ontology/graph/images/map.png
new file mode 100644 (file)
index 0000000..f90ef25
Binary files /dev/null and b/org.simantics.district.network.ontology/graph/images/map.png differ
index 1e73de182320ee60bf4cf2800d25c881b9f3afa6..cdf3121232032fcec1aed86fd59e2793b0a375ac 100644 (file)
@@ -21,6 +21,7 @@ public class DistrictNetworkResource {
     public final Resource Composite;
     public final Resource Connection;
     public final Resource Diagram;
+    public final Resource Diagram_MappedDiagram;
     public final Resource EPSG_4326;
     public final Resource Edge;
     public final Resource EdgeDefaultMapping;
@@ -53,6 +54,7 @@ public class DistrictNetworkResource {
     public final Resource Images_ConfigurationFolder;
     public final Resource InLayer;
     public final Resource Layer;
+    public final Resource MappedComponent;
     public final Resource Mapping;
     public final Resource MappingParameterType;
     public final Resource Mapping_Base;
@@ -94,6 +96,7 @@ public class DistrictNetworkResource {
         public static final String Composite = "http://www.simantics.org/DistrictNetwork-1.0/Composite";
         public static final String Connection = "http://www.simantics.org/DistrictNetwork-1.0/Connection";
         public static final String Diagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram";
+        public static final String Diagram_MappedDiagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/MappedDiagram";
         public static final String EPSG_4326 = "http://www.simantics.org/DistrictNetwork-1.0/EPSG_4326";
         public static final String Edge = "http://www.simantics.org/DistrictNetwork-1.0/Edge";
         public static final String EdgeDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping";
@@ -126,6 +129,7 @@ public class DistrictNetworkResource {
         public static final String Images_ConfigurationFolder = "http://www.simantics.org/DistrictNetwork-1.0/Images/ConfigurationFolder";
         public static final String InLayer = "http://www.simantics.org/DistrictNetwork-1.0/InLayer";
         public static final String Layer = "http://www.simantics.org/DistrictNetwork-1.0/Layer";
+        public static final String MappedComponent = "http://www.simantics.org/DistrictNetwork-1.0/MappedComponent";
         public static final String Mapping = "http://www.simantics.org/DistrictNetwork-1.0/Mapping";
         public static final String MappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/MappingParameterType";
         public static final String Mapping_Base = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Base";
@@ -177,6 +181,7 @@ public class DistrictNetworkResource {
         Composite = getResourceOrNull(graph, URIs.Composite);
         Connection = getResourceOrNull(graph, URIs.Connection);
         Diagram = getResourceOrNull(graph, URIs.Diagram);
+        Diagram_MappedDiagram = getResourceOrNull(graph, URIs.Diagram_MappedDiagram);
         EPSG_4326 = getResourceOrNull(graph, URIs.EPSG_4326);
         Edge = getResourceOrNull(graph, URIs.Edge);
         EdgeDefaultMapping = getResourceOrNull(graph, URIs.EdgeDefaultMapping);
@@ -209,6 +214,7 @@ public class DistrictNetworkResource {
         Images_ConfigurationFolder = getResourceOrNull(graph, URIs.Images_ConfigurationFolder);
         InLayer = getResourceOrNull(graph, URIs.InLayer);
         Layer = getResourceOrNull(graph, URIs.Layer);
+        MappedComponent = getResourceOrNull(graph, URIs.MappedComponent);
         Mapping = getResourceOrNull(graph, URIs.Mapping);
         MappingParameterType = getResourceOrNull(graph, URIs.MappingParameterType);
         Mapping_Base = getResourceOrNull(graph, URIs.Mapping_Base);
index e4a2fbcbcb5bb55cba23dce810bddf0add1dd7c5..75ef8fa7b7f51d9f282fe8dede3634aa6282e582 100644 (file)
@@ -28,7 +28,7 @@
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_Rf7koN16Eea73Pr1j_7O0Q" featurename="trimContributions" parentElementId="xpath:/">
     <elements xsi:type="menu:TrimContribution" xmi:id="_c57iwN16Eea73Pr1j_7O0Q" elementId="org.simantics.district.network.ui.trimcontribution.0" parentId="org.eclipse.ui.main.toolbar">
       <children xsi:type="menu:ToolBar" xmi:id="_vdgLoN16Eea73Pr1j_7O0Q" elementId="org.simantics.district.network.ui.toolbar.0">
-        <children xsi:type="menu:HandledToolItem" xmi:id="_v99NUN16Eea73Pr1j_7O0Q" elementId="org.simantics.district.network.ui.handledtoolitem.domapping" label="Do mapping" tooltip="testtsts" command="_zhiBwN16Eea73Pr1j_7O0Q"/>
+        <children xsi:type="menu:HandledToolItem" xmi:id="_v99NUN16Eea73Pr1j_7O0Q" elementId="org.simantics.district.network.ui.handledtoolitem.domapping" label="Map network ontology" iconURI="platform:/plugin/org.simantics.district.network.ui/icons/map_go.png" tooltip="Map network ontology to simulator specific model" command="_zhiBwN16Eea73Pr1j_7O0Q"/>
       </children>
     </elements>
   </fragments>
diff --git a/org.simantics.district.network.ui/icons/map.png b/org.simantics.district.network.ui/icons/map.png
new file mode 100644 (file)
index 0000000..f90ef25
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 (file)
index 0000000..11eab26
Binary files /dev/null and b/org.simantics.district.network.ui/icons/map_go.png differ
index 0ea5adf7f7638173ba324b27a610bc931c946c33..f421c6735e5f48ea642894512d18442ce27d942c 100644 (file)
@@ -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<String, Resource> getComposites(ReadGraph graph, Resource element) throws DatabaseException {
+            
             Resource indexRoot = graph.sync(new IndexRoot(element));
-            List<Resource> composites = ModelingUtils.searchByType(graph, indexRoot, StructuralResource2.getInstance(graph).Composite);
-            List<Resource> nonDistrictComposites = composites.stream().filter(comp -> {
+            List<Resource> diagrams = ModelingUtils.searchByType(graph, indexRoot, DiagramResource.getInstance(graph).Diagram);
+            
+            List<Resource> 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;
index 8e0633e87d660ffb67e7673666551d3fc66b7c2e..d4f241b240e24abc59be73492c54eb81bca45322 100644 (file)
          version="0.0.0"
          unpack="false"/>
 
+   <plugin
+         id="org.simantics.maps.server.ui"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
 </feature>