panel.setPickType(4);
try {
- ControlPointFactory.preloadCache();
+ ControlPointFactory.preloadCache(getLibraryUri());
ComponentUtils.preloadCache();
} catch (Exception e) {
ExceptionUtils.logAndShowError("Cannot open Plant3D editor",e);
private GeometryProvider geometryProvider;
public GeometryComponent() {
- currentParameters = new HashMap<String, Object>();
- calculatedParameters = new HashMap<String, Object>();
+ currentParameters = new HashMap<>();
+ calculatedParameters = new HashMap<>();
}
public void visualize(VtkView panel) {
return calculatedParameters;
}
+ public Map<String, Object> getTotalParameters() {
+ Map<String,Object> params = new HashMap<>();
+ params.putAll(currentParameters);
+ params.putAll(calculatedParameters);
+ return params;
+ }
+
public void setParametersUpdated(boolean parametersUpdated) {
this.parametersUpdated = parametersUpdated;
}
return component.getCalculatedParameters();
}
+
+ public Map<String, Object> getTotalParameters() {
+ return component.getTotalParameters();
+ }
+
public void setParametersUpdated(boolean parametersUpdated) {
component.setParametersUpdated(parametersUpdated);
}
public void updateParameters() {
super.updateParameters();
if (!isVariableLength()) {
- Map<String,Object> calculated = getCalculatedParameters();
+ Map<String,Object> calculated = getTotalParameters();
if (calculated.containsKey("length")) {
controlPoint.setLength((Double)calculated.get("length"));
}
} else {
componentCalculatedOffset = false;
}
+ PipingRules.requestUpdate(getControlPoint());
}
}
public Map<String, Object> updateParameterMap() {
Map<String,Object> map = new HashMap<String, Object>();
if (controlPoint != null) {
- if (!Double.isNaN(controlPoint.getLength()))
+ if (!Double.isNaN(controlPoint.getLength()) && controlPoint.isVariableLength())
map.put("length", controlPoint.getLength());
if (controlPoint.isDualInline()) {
PipeControlPoint sub = controlPoint.getSubPoint().get(0);
@Override
@CompoundRelatedGetValue(objRelation=Plant3D.URIs.hasParameter,objType=Plant3D.URIs.Parameter,valRelation=Plant3D.URIs.hasParameterValue)
- @CompoundGetPropertyValue(name="Parameters",tabId="Parameters",value="parameters")
public Map<String, Object> getParameterMap() {
return super.getParameterMap();
}
// TODO : how to filter parameters that are calculated by geometry provider?
Map<String,Object> map = new HashMap<String, Object>(getParameterMap());
map.remove("radius");
+ map.remove("radius2");
+ map.remove("offset");
return map;
}
if (next == comp) {
next = null;
syncnext = false;
+ if (DEBUG) System.out.println(this + " remove next " + comp);
firePropertyChanged(Plant3D.URIs.HasNext);
syncNext();
} else if (previous == comp) {
previous = null;
syncprev = false;
+ if (DEBUG) System.out.println(this + " remove prev " + comp);
firePropertyChanged(Plant3D.URIs.HasPrevious);
syncPrevious();
} else if (branch0 == comp) {
branch0 = null;
syncbr0 = false;
+ if (DEBUG) System.out.println(this + " remove br0 " + comp);
firePropertyChanged(Plant3D.URIs.HasBranch0);
syncBranch0();
}
if (calculated.containsKey("length")) {
controlPoint.setLength((Double)calculated.get("length"));
}
+ PipingRules.requestUpdate(getControlPoint());
}
}
private static Map<String,Instruction> cache = new HashMap<String, Instruction>();
- public static void preloadCache() throws Exception {
- List<Item> items = P3DUtil.getEnds(Plant3D.URIs.Builtin);
- items.addAll(P3DUtil.getInlines(Plant3D.URIs.Builtin));
- items.addAll(P3DUtil.getNozzles(Plant3D.URIs.Builtin));
- items.addAll(P3DUtil.getTurns(Plant3D.URIs.Builtin));
+ public static void preloadCache(String libUri) throws Exception {
+ List<Item> items = P3DUtil.getEnds(libUri);
+ items.addAll(P3DUtil.getInlines(libUri));
+ items.addAll(P3DUtil.getNozzles(libUri));
+ items.addAll(P3DUtil.getTurns(libUri));
for (Item item : items) {
Instruction inst = createInstruction(item.getUri());
import org.simantics.objmap.graph.IMapping;
import org.simantics.objmap.graph.Mappings;
import org.simantics.objmap.graph.schema.IMappingSchema;
+import org.simantics.plant3d.ontology.Plant3D;
import org.simantics.plant3d.scenegraph.P3DRootNode;
import org.simantics.plant3d.scenegraph.SchemaBuilder;
import org.simantics.plant3d.scenegraph.controlpoint.ControlPointFactory;
public static P3DScriptNodeMap load(final Resource root) throws DatabaseException {
try {
- ControlPointFactory.preloadCache();
+ ControlPointFactory.preloadCache(Plant3D.URIs.Builtin);
ComponentUtils.preloadCache();
} catch (Exception e) {
throw new DatabaseException(e);
public static P3DRootNode loadReadOnly(final Resource root) throws DatabaseException {
try {
- ControlPointFactory.preloadCache();
+ ControlPointFactory.preloadCache(Plant3D.URIs.Builtin);
ComponentUtils.preloadCache();
} catch (Exception e) {
throw new DatabaseException(e);