Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11530/src/net/sourceforge/bprocessor/model
Modified Files:
Command.java Project.java
Log Message:
Index: Command.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -d -r1.93 -r1.94
*** Command.java 13 Jul 2010 09:32:43 -0000 1.93
--- Command.java 13 Jul 2010 12:33:52 -0000 1.94
***************
*** 28,32 ****
public Command() {
parameters = new ParameterBlock();
- // Comment
}
--- 28,31 ----
***************
*** 74,77 ****
--- 73,92 ----
*/
public abstract void evaluate();
+
+ /**
+ * Return true if this command depends on the specified geometric
+ * @param geometric Geometric to test dependence on
+ * @return true if this command depends on the geometric
+ */
+ public boolean depends(Geometric geometric) {
+ if (parameters != null) {
+ for (Attribute current : parameters.getAttributes()) {
+ if (geometric == current.getValue()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
/** {@inheritDoc} */
***************
*** 151,155 ****
parameters.put("name", "");
}
!
/**
* {@inheritDoc}
--- 166,170 ----
parameters.put("name", "");
}
!
/**
* {@inheritDoc}
***************
*** 1790,1795 ****
*/
public static class Frame extends Command {
- private Space net;
-
/**
* Constructs a frame command
--- 1805,1808 ----
***************
*** 1797,1801 ****
*/
public Frame(Space net) {
! this.net = net;
parameters.put("frame-width", 0.035);
parameters.put("interior-width", 0.035);
--- 1810,1814 ----
*/
public Frame(Space net) {
! parameters.put("net", net);
parameters.put("frame-width", 0.035);
parameters.put("interior-width", 0.035);
***************
*** 1851,1854 ****
--- 1864,1868 ----
@Override
public void evaluate() {
+ Space net = (Space) parameters.get("net");
double inside = parameters.getDouble("frame-width");
double delta = parameters.getDouble("interior-width");
***************
*** 1882,1886 ****
Offset.offsetIt(boundary, -inside + (delta / 2));
! Space union = Item.createUnion("Frame");
Collection<Surface> inserted = new LinkedList();
--- 1896,1907 ----
Offset.offsetIt(boundary, -inside + (delta / 2));
! Space union = (Space) net.getOwner().find("Frame");
!
! if (union == null) {
! union = Item.createUnion("Frame");
! net.getOwner().add(union);
! } else {
! union.clear();
! }
Collection<Surface> inserted = new LinkedList();
***************
*** 1966,1972 ****
}
}
-
-
- net.getOwner().add(union);
}
}
--- 1987,1990 ----
Index: Project.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v
retrieving revision 1.194
retrieving revision 1.195
diff -C2 -d -r1.194 -r1.195
*** Project.java 20 May 2010 12:02:03 -0000 1.194
--- Project.java 13 Jul 2010 12:33:52 -0000 1.195
***************
*** 696,699 ****
--- 696,716 ----
}
+ /**
+ * Propagate changes by evaluating scripts in the owner of the specified geometric that depends
+ * on it.
+ * @param geometric Geometric that changed
+ */
+ public void propagate(Geometric geometric) {
+ Space owner = geometric.getOwner();
+ if (owner != null) {
+ for (Command current : owner.getScripts()) {
+ if (current.depends(geometric)) {
+ current.evaluate();
+ }
+ }
+ }
+ }
+
+
/**
|