[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Instance.java, 1.12, 1.13 Space.java
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2010-01-13 10:58:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15655/src/net/sourceforge/bprocessor/model Modified Files: Instance.java Space.java Persistence.java Log Message: new rotation tool Index: Instance.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Instance.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Instance.java 21 Sep 2009 11:00:46 -0000 1.12 --- Instance.java 13 Jan 2010 10:58:34 -0000 1.13 *************** *** 27,33 **** private Space proto; ! /** A anchor for instances */ protected CoordinateSystem anchor; /** * Constructs instance --- 27,37 ---- private Space proto; ! /** ! * ! */ protected CoordinateSystem anchor; + private CoordinateSystem transformation; + /** * Constructs instance *************** *** 60,90 **** proto = space; if (anchor == null) { ! Collection<CoordinateSystem> anchors = space.getCoordinateSystems(); ! if (anchors.size() > 0) { ! anchor = anchors.iterator().next().copy(); ! } else { ! CoordinateSystem system ! = (CoordinateSystem) Project.getInstance().world().getConstructor(1); ! anchor = system.copy(); ! } } } /** ! * Getter for anchor ! * @return The anchor */ ! public CoordinateSystem getInstanceAnchor() { return anchor; } /** ! * set the anchor for a instance ! * @param cs the coordinatesystem to use as anchor */ ! public void setInstanceAnchor(CoordinateSystem cs) { ! anchor = cs; } --- 64,113 ---- proto = space; if (anchor == null) { ! CoordinateSystem system ! = (CoordinateSystem) Project.getInstance().world().getConstructor(1); ! anchor = system.copy(); } } /** ! * @param system CoordinateSystem */ ! public void setAnchor(CoordinateSystem system) { ! anchor = system; ! transformation = null; ! } ! ! /** ! * ! * @return CoordinateSystem ! */ ! public CoordinateSystem getAnchor() { return anchor; } /** ! * ! * @return CoordinateSystem */ ! public CoordinateSystem getTransformation() { ! transformation = null; ! if (transformation == null) { ! CoordinateSystem handle = getHandle(); ! CoordinateSystem zero = new CoordinateSystem(new Vertex(1, 0, 0), new Vertex(0, 1, 0), ! new Vertex(0, 0, 1), new Vertex(0, 0, 0)); ! transformation = handle.translate(zero); ! transformation = anchor.unTranslate(transformation); ! return transformation; ! } ! return transformation; } + /** + * + * @return handle + */ + public CoordinateSystem getHandle() { + return proto.getHandle(); + } *************** *** 115,119 **** List<Edge> edges = new LinkedList(); for (Edge current : interior) { ! edges.add(anchor.unTranslate(current)); } return edges; --- 138,142 ---- List<Edge> edges = new LinkedList(); for (Edge current : interior) { ! edges.add(getTransformation().unTranslate(current)); } return edges; *************** *** 144,148 **** Space duplicate = proto.copy(new HashMap()); List<Vertex> vertices = new ArrayList(duplicate.collect()); ! anchor.unTranslateIt(vertices); for (Vertex current : vertices) { current.update(); --- 167,171 ---- Space duplicate = proto.copy(new HashMap()); List<Vertex> vertices = new ArrayList(duplicate.collect()); ! getTransformation().unTranslateIt(vertices); for (Vertex current : vertices) { current.update(); Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** Persistence.java 18 Sep 2009 09:09:06 -0000 1.84 --- Persistence.java 13 Jan 2010 10:58:34 -0000 1.85 *************** *** 307,311 **** CoordinateSystem anchor; anchor = internalizeCoordinateSystem(xml.getAnchor(), mapper, xmls); ! space.setInstanceAnchor(anchor); } space.setOwner(owner); --- 307,311 ---- CoordinateSystem anchor; anchor = internalizeCoordinateSystem(xml.getAnchor(), mapper, xmls); ! space.setAnchor(anchor); } space.setOwner(owner); *************** *** 1147,1151 **** } map.put(space, xml); ! xml.setAnchor(externalizeCoordinateSystem(space.getInstanceAnchor(), map)); return xml; } --- 1147,1151 ---- } map.put(space, xml); ! xml.setAnchor(externalizeCoordinateSystem(space.getAnchor(), map)); return xml; } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.247 retrieving revision 1.248 diff -C2 -d -r1.247 -r1.248 *** Space.java 5 Oct 2009 10:50:21 -0000 1.247 --- Space.java 13 Jan 2010 10:58:34 -0000 1.248 *************** *** 553,556 **** --- 553,567 ---- /** + * + * @return handle coordinate system + */ + public CoordinateSystem getHandle() { + for (CoordinateSystem current : getCoordinateSystems()) { + return current; + } + return Project.getInstance().getActiveCoordinateSystem().copy(); + } + + /** * Return the vertices * @return The vertices |