Commit b5b228ad authored by Filip Reaboi's avatar Filip Reaboi
Browse files

refs 3240
parent 11a42f93
/*-------------------------------------------------------------------------+
| Copyright 2014 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.component.ui.utils;
import static org.conqat.ide.commons.ui.dialog.MessageUtils.showWarning;
import org.fortiss.af3.component.model.Component;
import org.fortiss.tooling.base.model.element.IModelElementReference;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
/**
* Utility class for {@link IModelElementSpecification}s of a {@link Component} that represent a
* {@link IModelElementReference}s to another model element
*
* @author teufl
*/
@Deprecated //ucd
public class ModelElementReferenceSpecificationUtils {
/**
* Warning that should be displayed in case {@link IModelElementSpecification}s of a
* {@link Component} that represent a {@link IModelElementReference}s to another model element
* have been removed from that {@link Component}.
*/
public static void displayModelElementSpecificationsWithExternalReferencesRemovalWarning() {
showWarning(
"References to external model elements.",
"The copied component contained references to external model elements which have not copied. Please re-add them if necessary.");
}
}
......@@ -74,8 +74,4 @@ public class SimulationUtils {
return getExecutableComponentFor(component, context);
}
/** Class to identify contexts which are valid for simulation. */
public static interface ISimulationContext extends ITransformationContext {
// Marker class
}
}
/*-------------------------------------------------------------------------+
| Copyright 2011 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.cosimulation.compose;
import static org.fortiss.af3.cosimulation.utils.CosimulationSpecificationUtils.createCosimulationSpecification;
import org.fortiss.af3.component.prototypes.GloballyCategorizedPrototypeProviderBase;
import org.fortiss.af3.cosimulation.model.CosimulationSpecification;
import org.fortiss.tooling.kernel.extension.IPrototypeProvider;
/**
* {@link IPrototypeProvider} for {@link CosimulationSpecification}s.
*
* @author vogelsan
*
*/
public class CosimulationSpecificationPrototypeProvider extends GloballyCategorizedPrototypeProviderBase {
/** {@inheritDoc} */
@Override
public void registerPrototypes() {
CosimulationSpecification specification = createCosimulationSpecification();
specification.setServiceHost("localhost");
specification.setServicePort("9999");
specification.setServicePath("ws/cosimulation");
specification.setBoolTypeRepresentation("boolean");
specification.setBooleanNumericRepresentation(false);
specification.setDoubleTypeRepresentation("double");
specification.setDoubleSeparator(".");
specification.setIntTypeRepresentation("int");
registerPrimaryPrototype("Cosimulation Specification", specification, CATEGORY_NAME_SECONDARY_SPEC);
}
}
/*-------------------------------------------------------------------------+
| Copyright 2011 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.deployment.generator;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
/**
* A {@link DeploymentTransformationContext} for transforming a component into
* execution unit specific code.
*
* @author hoelzl
*/
@Deprecated //ucd
public class ComponentCodeTransformationContext extends DeploymentTransformationContext {
/** Stores the {@link ExecutionUnit} for the component code. */
private final ExecutionUnit executionUnit;
/** Constructor. */
public ComponentCodeTransformationContext(Deployment deployment, ExecutionUnit executionUnit,
ITransformationContext original) {
super(deployment, original);
this.executionUnit = executionUnit;
}
/** Returns the execution unit. */
public ExecutionUnit getExecutionUnit() {
return executionUnit;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.ui.perspective.constraint;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.wb.swt.SWTResourceManager;
/**
* Backend implementation for the Deployment Pattern.
*
* @author zverlov
*/
@SuppressWarnings("javadoc")
public class DeploymentPatternCompositeGUI extends Composite {
protected ListViewer listViewerSet1Property;
protected ListViewer listViewerSet2Property;
protected Combo comboOperator;
protected Button btnAdd;
protected Button btnSum;
protected Label lblConstraintPreview;
protected Label lblSwcproperty;
protected Label lblHwcproperty;
protected ListViewer listViewerSet1;
protected ListViewer listViewerSet2;
protected Tree treeSet1Selection;
protected Tree treeSet2Selection;
protected TreeViewer treeViewerSet1Selection;
protected TreeViewer treeViewerSet2Selection;
protected ConstraintPatternHeader header;
/** {@inheritDoc} */
public DeploymentPatternCompositeGUI(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(1, false));
header = new ConstraintPatternHeader(this, SWT.NONE);
GridData gd_compositeSetName = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
gd_compositeSetName.widthHint = 242;
header.setLayoutData(gd_compositeSetName);
header.setLayout(new GridLayout(2, false));
Composite compositeSetSelection = new Composite(this, SWT.NONE);
compositeSetSelection.setLayout(new GridLayout(5, false));
GridData gd_compositeSetSelection = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
gd_compositeSetSelection.widthHint = 868;
compositeSetSelection.setLayoutData(gd_compositeSetSelection);
compositeSetSelection.setBounds(0, 0, 64, 64);
Label lblHwcs = new Label(compositeSetSelection, SWT.NONE);
lblHwcs.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
lblHwcs.setText("SWCs");
Label lblProperties = new Label(compositeSetSelection, SWT.NONE);
lblProperties.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
lblProperties.setText("Properties");
new Label(compositeSetSelection, SWT.NONE);
Label lblSwcs = new Label(compositeSetSelection, SWT.NONE);
lblSwcs.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
lblSwcs.setText("HWCs");
Label lblProperties_1 = new Label(compositeSetSelection, SWT.NONE);
lblProperties_1.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
lblProperties_1.setText("Properties");
new Label(compositeSetSelection, SWT.NONE);
btnSum = new Button(compositeSetSelection, SWT.CHECK);
btnSum.setText("SUM");
new Label(compositeSetSelection, SWT.NONE);
new Label(compositeSetSelection, SWT.NONE);
new Label(compositeSetSelection, SWT.NONE);
treeViewerSet1Selection = new TreeViewer(compositeSetSelection, SWT.MULTI | SWT.BORDER);
treeSet1Selection = treeViewerSet1Selection.getTree();
GridData gd_treeSet1Selection = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
gd_treeSet1Selection.heightHint = 161;
gd_treeSet1Selection.widthHint = 300;
treeSet1Selection.setLayoutData(gd_treeSet1Selection);
listViewerSet1Property = new ListViewer(compositeSetSelection, SWT.BORDER | SWT.V_SCROLL);
List lstSet1Property = listViewerSet1Property.getList();
GridData gd_lstSet1Property = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);
gd_lstSet1Property.heightHint = 97;
gd_lstSet1Property.widthHint = 120;
lstSet1Property.setLayoutData(gd_lstSet1Property);
new Label(compositeSetSelection, SWT.NONE);
treeViewerSet2Selection = new TreeViewer(compositeSetSelection, SWT.MULTI | SWT.BORDER);
treeSet2Selection = treeViewerSet2Selection.getTree();
GridData gd_treeSet2Selection = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
gd_treeSet2Selection.heightHint = 161;
gd_treeSet2Selection.widthHint = 300;
treeSet2Selection.setLayoutData(gd_treeSet2Selection);
listViewerSet2Property = new ListViewer(compositeSetSelection, SWT.BORDER | SWT.V_SCROLL);
List lstSet2Property = listViewerSet2Property.getList();
GridData gd_lstSet2Property = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);
gd_lstSet2Property.heightHint = 97;
gd_lstSet2Property.widthHint = 120;
lstSet2Property.setLayoutData(gd_lstSet2Property);
Composite compositePreview = new Composite(this, SWT.NONE);
GridData gd_compositePreview = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_compositePreview.widthHint = 977;
compositePreview.setLayoutData(gd_compositePreview);
compositePreview.setBounds(0, 0, 64, 64);
compositePreview.setLayout(new GridLayout(2, false));
Label lblNewLabel = new Label(compositePreview, SWT.NONE);
lblNewLabel.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
lblNewLabel.setBounds(0, 0, 59, 14);
lblNewLabel.setText("Preview:");
lblConstraintPreview = new Label(compositePreview, SWT.NONE);
lblConstraintPreview.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.NORMAL));
lblConstraintPreview.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lblConstraintPreview
.setText("ForAll hwc in selectedHWC ForAll swc in selectedSWC where swc mapped to hwc: swc.sil < hwc.sil");
Composite compositeAddConstraint = new Composite(this, SWT.NONE);
GridData gd_compositeAddConstraint = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_compositeAddConstraint.widthHint = 741;
gd_compositeAddConstraint.heightHint = 77;
compositeAddConstraint.setLayoutData(gd_compositeAddConstraint);
compositeAddConstraint.setLayout(new GridLayout(4, false));
new Label(compositeAddConstraint, SWT.NONE);
Label lblNewLabel_1 = new Label(compositeAddConstraint, SWT.CENTER);
lblNewLabel_1.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
GridData gd_lblNewLabel_1 = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
gd_lblNewLabel_1.widthHint = 147;
lblNewLabel_1.setLayoutData(gd_lblNewLabel_1);
lblNewLabel_1.setText("Software");
Label lblOperator = new Label(compositeAddConstraint, SWT.NONE);
lblOperator.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
lblOperator.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
lblOperator.setText("Operator");
Label lblHardware = new Label(compositeAddConstraint, SWT.NONE);
lblHardware.setAlignment(SWT.CENTER);
lblHardware.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
GridData gd_lblHardware = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
gd_lblHardware.widthHint = 171;
lblHardware.setLayoutData(gd_lblHardware);
lblHardware.setText("Hardware");
Label lblConstraintPattern = new Label(compositeAddConstraint, SWT.NONE);
lblConstraintPattern.setFont(SWTResourceManager.getFont(".SF NS Text", 11, SWT.BOLD));
lblConstraintPattern.setText("Constraint Pattern:");
lblSwcproperty = new Label(compositeAddConstraint, SWT.NONE);
lblSwcproperty.setAlignment(SWT.CENTER);
GridData gd_lblSwcproperty = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_lblSwcproperty.widthHint = 198;
lblSwcproperty.setLayoutData(gd_lblSwcproperty);
lblSwcproperty.setText("swc.property");
comboOperator = new Combo(compositeAddConstraint, SWT.READ_ONLY);
GridData gd_comboOperator = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_comboOperator.widthHint = 80;
comboOperator.setLayoutData(gd_comboOperator);
lblHwcproperty = new Label(compositeAddConstraint, SWT.NONE);
lblHwcproperty.setAlignment(SWT.CENTER);
GridData gd_lblHwcproperty = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_lblHwcproperty.widthHint = 268;
lblHwcproperty.setLayoutData(gd_lblHwcproperty);
lblHwcproperty.setText("hwc.property");
btnAdd = new Button(this, SWT.NONE);
btnAdd.setText("Add Constraint");
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout(1, false));
}
}
/*-------------------------------------------------------------------------+
| Copyright 2013 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.ui.util;
import static org.fortiss.tooling.graphicsGL.util.Graph3DModelElementFactory.graphLine;
import static org.fortiss.tooling.graphicsGL.util.Graph3DModelElementFactory.graphPoint;
import java.util.ArrayList;
import org.fortiss.tooling.graphicsGL.model.Color3D;
import org.fortiss.tooling.graphicsGL.model.graph.GraphLine3D;
import org.fortiss.tooling.graphicsGL.model.graph.GraphPoint3D;
import org.lwjglx.util.vector.Vector3f;
/**
* Utility methods for 3D calculations.
*
* @author eder
*/
@Deprecated //ucd
public class Editor3DUtil {
/**
* a plane spawned by x,y,z
*
* @param x
* point in the plane
* @param y
* point in the plane
* @param z
* point in the plane
* @return plane spawned by the three given points
*/
public static GraphLine3D[] setupPlane(GraphPoint3D x, GraphPoint3D y, GraphPoint3D z) {
Vector3f v1 = convert2(x);
Vector3f v2 = convert2(y);
Vector3f v3 = convert2(z);
Vector3f v2v1 = new Vector3f();
Vector3f v2v3 = new Vector3f();
Vector3f.sub(v1, v2, v2v1);
Vector3f.sub(v3, v2, v2v3);
Vector3f line1 = new Vector3f();
Vector3f line2 = new Vector3f();
Vector3f line3 = new Vector3f();
Vector3f line4 = new Vector3f();
Vector3f.add(v2, v2v1, line1);
Vector3f.add(v2, v2v3, line2);
Vector3f.add(v1, v2v3, line3);
Vector3f.add(v3, v2v1, line4);
GraphPoint3D start1 = convert(v2);
GraphPoint3D end1 = convert(line1);
GraphPoint3D start2 = convert(v2);
GraphPoint3D end2 = convert(line2);
GraphPoint3D start3 = convert(v1);
GraphPoint3D end3 = convert(line3);
GraphPoint3D start4 = convert(v3);
GraphPoint3D end4 = convert(line4);
GraphLine3D[] lines = new GraphLine3D[4];
lines[0] = graphLine(start1, end1);
lines[1] = graphLine(start2, end2);
lines[2] = graphLine(start3, end3);
lines[3] = graphLine(start4, end4);
return lines;
}
/**
* a plane spawned by x,y,z + line color
*
* @param x
* point in the plane
* @param y
* point in the plane
* @param z
* point in the plane
* @param color
* color of the plane
* @return colored plane spawned by x,y,z
*/
public static ArrayList<GraphLine3D> setupPlaneList(GraphPoint3D x, GraphPoint3D y,
GraphPoint3D z, Color3D color) {
GraphLine3D[] lines = setupPlane(x, y, z);
ArrayList<GraphLine3D> list = new ArrayList<GraphLine3D>();
for(GraphLine3D l : lines) {
l.setColor(color);
list.add(l);
}
return list;
}
/**
* Returns the intersection line between two planes or null if there is none
*
* @param p11
* point in plane 1
* @param p12
* point in plane 1
* @param p13
* point in plane 1
* @param p21
* point in plane 2
* @param p22
* point in plane 2
* @param p23
* point in plane 2
* @param AXIS_LENGTH
* length of the axes
* @return intersection line between the two planes, null if there is none
*/
public static GraphLine3D planeVsPlane(GraphPoint3D p11, GraphPoint3D p12, GraphPoint3D p13,
GraphPoint3D p21, GraphPoint3D p22, GraphPoint3D p23, int AXIS_LENGTH) {
// calculate direction vector
Vector3f v11 = convert2(p11);
Vector3f v12 = convert2(p12);
Vector3f v13 = convert2(p13);
Vector3f v21 = convert2(p21);
Vector3f v22 = convert2(p22);
Vector3f v23 = convert2(p23);
Vector3f v11v12 = new Vector3f();
Vector3f v12v13 = new Vector3f();
Vector3f.sub(v12, v11, v11v12);
Vector3f.sub(v13, v12, v12v13);
// direction vector of plane 1
Vector3f dir1 = new Vector3f();
Vector3f.cross(v11v12, v12v13, dir1);
Vector3f v21v22 = new Vector3f();
Vector3f v22v23 = new Vector3f();
Vector3f.sub(v22, v21, v21v22);
Vector3f.sub(v23, v22, v22v23);
// direction vector of plane 2
Vector3f dir2 = new Vector3f();
Vector3f.cross(v21v22, v22v23, dir2);
// direction vector of intersection
Vector3f dirIntersect = new Vector3f();
Vector3f.cross(dir1, dir2, dirIntersect);
dirIntersect.normalise();
// calculate arbitrary point on intersection line
// intersect 3 planes - the 2 from above and the new one set up by the dirIntersect vector
// from 0|0|0
// planes to coordinate form
// p1: ax + by + cz = d
// p2: qx + fy + gz = h
// p3: ix + jy + kz = l
double a, b, c, d, q, f, g, h, i, j, k, l;
a = dir1.x;
b = dir1.y;
c = dir1.z;
d = a * v11.x + b * v11.y + c * v11.z;
q = dir2.x;
f = dir2.y;
g = dir2.z;
h = q * v21.x + f * v21.y + g * v21.z;
i = dirIntersect.x;
j = dirIntersect.y;
k = dirIntersect.z;</