Commit 47885a0a authored by Robert Smith's avatar Robert Smith
Browse files

Made GeometryComponent persistable

The GeometryComponent can now persist its CSG tree to xml using EAVP
Signed-off-by: Robert Smith's avatarRobert Smith <>
parent 5fc9f1c9
......@@ -180,6 +180,7 @@ public class ICEGeometryPage extends ICEFormPage
service = factory.get("ICE Geometry Editor");
((ShapeTreeView) getSite().getWorkbenchWindow().getActivePage()
// Create and draw geometry canvas
try {
......@@ -25,6 +25,7 @@ Import-Package: ca.odell.glazedlists,
......@@ -16,11 +16,15 @@ import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.eclipse.eavp.viz.service.IVizService;
import org.eclipse.eavp.viz.service.geometry.persistence.PersistableShape;
import org.eclipse.eavp.viz.modeling.ShapeController;
import org.eclipse.eavp.viz.modeling.ShapeMesh;
import org.eclipse.eavp.viz.datastructures.VizObject.IManagedUpdateable;
import org.eclipse.eavp.viz.datastructures.VizObject.IManagedUpdateableListener;
import org.eclipse.eavp.viz.datastructures.VizObject.SubscriptionType;
......@@ -42,6 +46,13 @@ import;
public class GeometryComponent extends ICEObject
implements Component, IUpdateableListener, IManagedUpdateableListener {
* The component's geometry in a temporary compresed form.
private PersistableShape compressedGeometry;
* <p>
* The set of ComponentListeners observing the GeometryComponent
......@@ -54,7 +65,14 @@ public class GeometryComponent extends ICEObject
* The Geometry managed by the GeometryComponent
private ShapeController geometry;
* The service being used to render this component.
private IVizService service;
* <p>
......@@ -128,6 +146,16 @@ public class GeometryComponent extends ICEObject
public ShapeController getGeometry() {
return geometry;
* Get the component's geometry in a persistable format. It is intended that this function will only be called by JAXB.
* @return A PersistableShape representing the component's CSG tree
private PersistableShape getPersistableGeometry(){
return PersistableShape.compress((ShapeMesh) geometry.getModel());
* Mutator method for the held geometry
......@@ -147,6 +175,38 @@ public class GeometryComponent extends ICEObject
// Notify listeners
* Set the compressed form of the component's geometry. It is intended that this function will only be called by JAXB.
* @param root The compressed root of the CSG tree to be displayed by this component.
private void setPersistableGeometry(PersistableShape root){
compressedGeometry = root;
* Set the IVizService that will be used to visualize this component.
* @param service The service that will be used to visualize this component.
public void setService(IVizService service){
this.service = service;
//If a geometry was read from the xml, expand it
if(compressedGeometry != null){
//Unregister from the old geometry
//Set the component's contents to a full version of the geometry
geometry = compressedGeometry.unpack(service.getFactory());
//The full geometry is now in memory, so delete the compressed version
compressedGeometry = null;
* <p>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment