]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/EndComponent.java
Introduce orientToDirection() method to pipe control point
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / EndComponent.java
1 package org.simantics.plant3d.scenegraph;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import org.simantics.g3d.scenegraph.base.ParentNode;
7 import org.simantics.objmap.graph.annotations.DynamicGraphType;
8 import org.simantics.objmap.graph.annotations.GetType;
9 import org.simantics.objmap.graph.annotations.SetType;
10 import org.simantics.plant3d.ontology.Plant3D;
11 import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint;
12 import org.simantics.plant3d.scenegraph.controlpoint.ControlPointFactory;
13
14 @DynamicGraphType(Plant3D.URIs.EndComponent)
15 public class EndComponent extends PipelineComponent {
16
17         private String type;
18         PipeControlPoint controlPoint;
19         
20         @GetType(Plant3D.URIs.EndComponent)
21         public String getType() {
22                 return type;
23         }
24         
25         @SetType(Plant3D.URIs.EndComponent)
26         public void setType(String type) throws Exception {
27                 this.type = type;
28                 controlPoint = ControlPointFactory.create(this);
29                 syncNext();
30         syncPrevious();
31         syncBranch0();
32                 
33         }
34         
35         @Override
36         public PipeControlPoint getControlPoint() {
37                 return controlPoint;
38         }
39         
40         @Override
41         public void setParent(ParentNode<?> parent, String name) {
42                 super.setParent(parent, name);
43                 setPipeRun((PipeRun)parent);
44         }
45         
46         @Override
47         public Map<String, Object> updateParameterMap() {
48                 Map<String,Object> map = new HashMap<String, Object>();
49                 
50                 PipeRun pipeRun = getPipeRun();
51                 if (pipeRun != null) {
52                         map.put("radius", pipeRun.getPipeDiameter() * 0.5);
53                 }
54                 return map;
55         }
56 }