SYSDYN.SimulateOnChangeExperiment <T SYSDYN.Experiment
-SYSDYN.defaultGradient : G2D.ColorGradient
- G2D.HasColorPlacement _ : G2D.ColorPlacement
- G2D.HasGradientPosition 0.0 : L0.Double
- G2D.HasColor [0.0, 0.24313726, 0.52156866, 0.0] : L0.FloatArray
- G2D.HasColorPlacement _ : G2D.ColorPlacement
- G2D.HasGradientPosition 1.0 : L0.Double
- G2D.HasColor [1.0, 0.9019608, 0.0, 0.0] : L0.FloatArray
-
SYSDYN.PlaybackExperiment <T SYSDYN.Experiment
- @L0.assert G2D.HasColorGradient SYSDYN.defaultGradient
SYSDYN.HasResult <R L0.IsComposedOf
L0.HasRange SYSDYN.Result
//#####################################################################
SYSDYN.Result <T L0.Entity
- // ??? SIMU.IsActive
@L0.singleProperty L0.HasName
@L0.optionalProperty SYSDYN.HasParameterFile
@L0.optionalProperty SYSDYN.HasResultFile
+
+SYSDYN.ShowResult <R L0.IsRelatedTo : L0.Tag
+ @L0.symmetric
SYSDYN.HasParameterFile <R L0.HasProperty
L0.HasRange L0.String
public final Resource SharedModuleOntolofgy;\r
public final Resource ShowEnumerationIndexInCharts;\r
public final Resource ShowEnumerationIndexInCharts_Inverse;\r
+ public final Resource ShowResult;\r
public final Resource SimulateOnChangeExperiment;\r
public final Resource SimulationPlaybackProfile;\r
public final Resource SimulationPlaybackStyle;\r
public final Resource WithLookupExpression;\r
public final Resource angle;\r
public final Resource angle_Inverse;\r
- public final Resource defaultGradient;\r
public final Resource polarityLocation;\r
\r
public static class URIs {\r
public static final String SharedModuleOntolofgy = "http://www.simantics.org/Sysdyn-1.0/SharedModuleOntolofgy";\r
public static final String ShowEnumerationIndexInCharts = "http://www.simantics.org/Sysdyn-1.0/ShowEnumerationIndexInCharts";\r
public static final String ShowEnumerationIndexInCharts_Inverse = "http://www.simantics.org/Sysdyn-1.0/ShowEnumerationIndexInCharts/Inverse";\r
+ public static final String ShowResult = "http://www.simantics.org/Sysdyn-1.0/ShowResult";\r
public static final String SimulateOnChangeExperiment = "http://www.simantics.org/Sysdyn-1.0/SimulateOnChangeExperiment";\r
public static final String SimulationPlaybackProfile = "http://www.simantics.org/Sysdyn-1.0/SimulationPlaybackProfile";\r
public static final String SimulationPlaybackStyle = "http://www.simantics.org/Sysdyn-1.0/SimulationPlaybackStyle";\r
public static final String WithLookupExpression = "http://www.simantics.org/Sysdyn-1.0/WithLookupExpression";\r
public static final String angle = "http://www.simantics.org/Sysdyn-1.0/angle";\r
public static final String angle_Inverse = "http://www.simantics.org/Sysdyn-1.0/angle/Inverse";\r
- public static final String defaultGradient = "http://www.simantics.org/Sysdyn-1.0/defaultGradient";\r
public static final String polarityLocation = "http://www.simantics.org/Sysdyn-1.0/polarityLocation";\r
}\r
\r
SharedModuleOntolofgy = getResourceOrNull(graph, URIs.SharedModuleOntolofgy);\r
ShowEnumerationIndexInCharts = getResourceOrNull(graph, URIs.ShowEnumerationIndexInCharts);\r
ShowEnumerationIndexInCharts_Inverse = getResourceOrNull(graph, URIs.ShowEnumerationIndexInCharts_Inverse);\r
+ ShowResult = getResourceOrNull(graph, URIs.ShowResult);\r
SimulateOnChangeExperiment = getResourceOrNull(graph, URIs.SimulateOnChangeExperiment);\r
SimulationPlaybackProfile = getResourceOrNull(graph, URIs.SimulationPlaybackProfile);\r
SimulationPlaybackStyle = getResourceOrNull(graph, URIs.SimulationPlaybackStyle);\r
WithLookupExpression = getResourceOrNull(graph, URIs.WithLookupExpression);\r
angle = getResourceOrNull(graph, URIs.angle);\r
angle_Inverse = getResourceOrNull(graph, URIs.angle_Inverse);\r
- defaultGradient = getResourceOrNull(graph, URIs.defaultGradient);\r
polarityLocation = getResourceOrNull(graph, URIs.polarityLocation);\r
}\r
\r
import org.simantics.browsing.ui.graph.contributor.labeler.LabelDecoratorContributor;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode;\r
\r
public class SimulationResultDecorator extends LabelDecoratorContributor<SimulationResultNode>{\r
\r
@Override\r
public LabelDecorator getDecorator(ReadGraph graph, SimulationResultNode result) throws DatabaseException {\r
- if (graph.hasStatement(result.data, SimulationResource.getInstance(graph).IsActive)) {\r
+ if (graph.hasStatement(result.data, SysdynResource.getInstance(graph).ShowResult)) {\r
return new LabelDecorator.Stub() {\r
\r
@SuppressWarnings("unchecked")\r
import org.simantics.browsing.ui.swt.ImagerContributor;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.Activator;\r
import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode;\r
\r
\r
@Override\r
public ImageDescriptor getDescriptor(ReadGraph graph, SimulationResultNode result) throws DatabaseException {\r
- if(graph.hasStatement(result.data, SimulationResource.getInstance(graph).IsActive))\r
+ if(graph.hasStatement(result.data, SysdynResource.getInstance(graph).ShowResult))\r
return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_bar.png"));\r
else\r
return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_bar_blackAndWhite.png"));\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.diagram.G2DUtils;\r
import org.simantics.diagram.elements.TextNode;\r
import org.simantics.diagram.profile.StyleBase;\r
import org.simantics.diagram.stubs.DiagramResource;\r
ArrayList<ColorValue> colorValues = new ArrayList<ColorValue>();\r
for(Resource placement : graph.syncRequest(new ObjectsWithType(gradient, g2d.HasColorPlacement, g2d.ColorPlacement))) {\r
Double position = graph.getPossibleRelatedValue(placement, g2d.HasGradientPosition, Bindings.DOUBLE);\r
- float[] rgba = graph.getPossibleRelatedValue(placement, g2d.HasColor, Bindings.FLOAT_ARRAY);\r
- colorValues.add(new ColorValue(new Color(new java.awt.Color(rgba[0], rgba[1], rgba[2])), position));\r
+ Resource rColor = graph.getPossibleObject(placement, g2d.HasColor);\r
+ if (rColor != null) {\r
+ colorValues.add(new ColorValue(new Color((java.awt.Color) G2DUtils.getObject(graph, rColor)), position));\r
+ }\r
}\r
cg = new ColorGradient(colorValues, ColorGradient.HSV);\r
} else {\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2011 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
});\r
\r
} else {\r
+ \r
+ Resource project = SimanticsUI.getProject().get();\r
+ graph.claim(root, Layer0X.getInstance(graph).IsActivatedBy, project);\r
+ \r
updateOldConfigurationToBaseRealization(graph, root);\r
addDefaultOntologyLinks(graph, root);\r
addURIsToDiagrams(graph, root);\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2011 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
\r
@Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
- System.out.println("New Experiment");\r
-\r
ISelection sel = HandlerUtil.getCurrentSelection(event);\r
\r
ExperimentsFolder node = AdaptionUtils.adaptToSingle(sel, ExperimentsFolder.class);\r
\r
String name = NameUtils.findFreshName(g, getNameSuggestion(), model, l0.ConsistsOf, "%s%d");\r
\r
- @SuppressWarnings("unused")\r
Resource experiment = GraphUtils.create2(g, getExperimentType(g),\r
l0.HasName, name,\r
l0.HasLabel, name,\r
DOC.HasReportFactory, report,\r
l0.PartOf, model);\r
+ \r
+ configureExperiment(g, experiment);\r
}\r
});\r
return null;\r
}\r
\r
+ /**\r
+ * Override to do experiment-specific alterations\r
+ */\r
+ protected void configureExperiment(WriteGraph graph, Resource experiment) throws DatabaseException {\r
+ \r
+ }\r
+ \r
protected Resource getExperimentType(ReadGraph g) {\r
return SysdynResource.getInstance(g).BasicExperiment;\r
}\r
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
package org.simantics.sysdyn.ui.handlers;\r
\r
+import java.awt.Color;\r
+\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.sysdyn.SysdynResource;\r
\r
\r
public class NewPlaybackExperimentNodeHandler extends NewExperimentNodeHandler {\r
- \r
+\r
+ protected void configureExperiment(WriteGraph graph, Resource experiment) throws DatabaseException {\r
+ G2DResource g2d = G2DResource.getInstance(graph);\r
+ Resource defaultGradient = GraphUtils.create2(graph, g2d.ColorGradient);\r
+ graph.claim(experiment, g2d.HasColorGradient, defaultGradient);\r
+\r
+ Resource placement = GraphUtils.create2(graph, g2d.ColorPlacement, \r
+ g2d.HasGradientPosition, 0.0);\r
+ graph.claimLiteral(placement, g2d.HasColor, g2d.Color, new Color(0, 62, 133).getColorComponents(new float[4]));\r
+ graph.claim(defaultGradient, g2d.HasColorPlacement, placement);\r
+ \r
+ placement = GraphUtils.create2(graph, g2d.ColorPlacement, \r
+ g2d.HasGradientPosition, 1.0);\r
+ graph.claimLiteral(placement, g2d.HasColor, g2d.Color, new Color(255, 230, 0).getColorComponents(new float[4]));\r
+ graph.claim(defaultGradient, g2d.HasColorPlacement, placement);\r
+ }\r
+\r
protected Resource getExperimentType(ReadGraph g) {\r
return SysdynResource.getInstance(g).PlaybackExperiment;\r
}\r
- \r
+\r
protected String getNameSuggestion() {\r
return "Playback Experiment";\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2011 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.simulation.ontology.SimulationResource;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
- SimulationResource SIMU = SimulationResource.getInstance(graph);\r
for(Resource r : resources) {\r
if(graph.isInstanceOf(r, sr.Result)) {\r
- if (graph.hasStatement(r, SIMU.IsActive)) {\r
- graph.denyStatement(r, SIMU.IsActive, r);\r
+ if (graph.hasStatement(r, sr.ShowResult)) {\r
+ graph.denyStatement(r, sr.ShowResult, r);\r
} else {\r
- graph.claim(r, SIMU.IsActive, r);\r
+ graph.claim(r, sr.ShowResult, r);\r
}\r
}\r
}\r
package org.simantics.sysdyn.ui.properties;\r
\r
import java.util.ArrayList;\r
+import java.util.Collection;\r
\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
for(ColorValue cv : colorValues) {\r
Resource placement = GraphUtils.create2(graph, g2d.ColorPlacement, \r
g2d.HasGradientPosition, cv.getValue());\r
- graph.claimLiteral(placement, g2d.HasColor, cv.getColor().getAWTColor().getColorComponents(new float[4]), Bindings.FLOAT_ARRAY);\r
+ graph.claimLiteral(placement, g2d.HasColor, g2d.Color, cv.getColor().getAWTColor().getColorComponents(new float[4]));\r
graph.claim(gradient, g2d.HasColorPlacement, placement);\r
}\r
}\r
if(gradient == null) {\r
return Boolean.FALSE;\r
}\r
+ Collection<Resource> placements = graph.syncRequest(new ObjectsWithType(gradient, g2d.HasColorPlacement, g2d.ColorPlacement));\r
+ if(placements.isEmpty())\r
+ return Boolean.FALSE;\r
\r
- for(Resource placement : graph.syncRequest(new ObjectsWithType(gradient, g2d.HasColorPlacement, g2d.ColorPlacement))) {\r
+ for(Resource placement : placements) {\r
Double position = graph.getPossibleRelatedValue(placement, g2d.HasGradientPosition);\r
if(position == null) \r
return Boolean.FALSE;\r
if(model == null)\r
return true;\r
Configuration configuration = model.getConfiguration();\r
+ if(configuration == null)\r
+ return true;\r
IElement current = model.getElement(variable);\r
for(IElement e : configuration.getElements()) {\r
if(e instanceof Variable) {\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.representation;\r
+\r
+import org.simantics.objmap.annotations.GraphType;\r
+import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid;\r
+\r
+@GraphType("http://www.simantics.org/Diagram-2.0/DiagramContainer")\r
+public class DiagramContainerDummy implements IElement {\r
+ \r
+ @Override\r
+ public void accept(IElementVisitorVoid v) {\r
+ v.visit(this); \r
+ }\r
+\r
+}
\ No newline at end of file
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2011 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
addLinkType(MappingSchemas.fromAnnotations(g, LibraryDummy.class));\r
addLinkType(MappingSchemas.fromAnnotations(g, Book.class));\r
addLinkType(MappingSchemas.fromAnnotations(g, Sheet.class));\r
+ addLinkType(MappingSchemas.fromAnnotations(g, DiagramContainerDummy.class));\r
} catch (DatabaseException e) {\r
e.printStackTrace();\r
} catch (InstantiationException e) {\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2011 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.sysdyn.representation.Cloud;\r
import org.simantics.sysdyn.representation.Configuration;\r
import org.simantics.sysdyn.representation.Dependency;\r
+import org.simantics.sysdyn.representation.DiagramContainerDummy;\r
import org.simantics.sysdyn.representation.Enumeration;\r
import org.simantics.sysdyn.representation.Flow;\r
import org.simantics.sysdyn.representation.Input;\r
@Override\r
public void visit(Book sheet) {\r
}\r
+ \r
+ @Override\r
+ public void visit(DiagramContainerDummy container) {\r
+ }\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2011 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.sysdyn.representation.Cloud;\r
import org.simantics.sysdyn.representation.Configuration;\r
import org.simantics.sysdyn.representation.Dependency;\r
+import org.simantics.sysdyn.representation.DiagramContainerDummy;\r
import org.simantics.sysdyn.representation.Enumeration;\r
import org.simantics.sysdyn.representation.Flow;\r
import org.simantics.sysdyn.representation.Input;\r
void visit(Enumeration enumeration);\r
void visit(LibraryDummy libraryDummy);\r
void visit(Book sheet);\r
+ void visit(DiagramContainerDummy container);\r
}\r