[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Command.java, 1.7, 1.8 ParameterBloc
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-10-22 06:55:14
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17663/src/net/sourceforge/bprocessor/model Modified Files: Command.java ParameterBlock.java Project.java Log Message: started scale command Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Command.java 20 Oct 2007 17:22:53 -0000 1.7 --- Command.java 22 Oct 2007 06:55:09 -0000 1.8 *************** *** 8,11 **** --- 8,12 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; *************** *** 16,20 **** * Command */ ! public class Command extends Entity implements Parametric { /** --- 17,21 ---- * Command */ ! public abstract class Command extends Entity implements Parametric { /** *************** *** 57,62 **** * */ ! public void evaluate() { ! } /** {@inheritDoc} */ --- 58,62 ---- * */ ! public abstract void evaluate(); /** {@inheritDoc} */ *************** *** 71,74 **** --- 71,137 ---- * */ + public static class Smooth extends Command { + + /** + * + * @param surface Surface + */ + public Smooth(Surface surface) { + parameters.put(new Attribute("surface", surface)); + } + + /** + * {@inheritDoc} + */ + public String getGeneralName() { + return "Smooth Surface"; + } + + /** {@inheritDoc} */ + @Override + public void evaluate() { + Surface surface = (Surface) parameters.get("surface"); + Space owner = surface.getOwner(); + List<Edge> edges = surface.getEdges(); + List<Vertex> vertices = surface.getVertices(); + int n = vertices.size(); + Vertex facepoint = surface.center(); + owner.insert(facepoint); + List<Vertex> edgepoints = new ArrayList(n); + List<Edge> sides = new ArrayList(n); + for (Edge current : edges) { + edgepoints.add(current.center()); + } + + for (Vertex current : edgepoints) { + Edge side = new Edge(current, facepoint); + sides.add(side); + owner.insert(current); + } + + for (Edge current : sides) { + owner.insert(current); + } + for (int i = 0; i < n; i++) { + int j = (i + 1) % n; + Vertex v0 = facepoint; + Vertex v1 = edgepoints.get(i); + Vertex v2 = vertices.get(j); + Vertex v3 = edgepoints.get(j); + List<Edge> contour = new LinkedList(); + contour.add(new Edge(v0, v1)); + contour.add(new Edge(v1, v2)); + contour.add(new Edge(v2, v3)); + contour.add(new Edge(v3, v0)); + Surface face = new Surface(contour); + owner.insert(face); + } + } + } + + /** + * + * + */ public static class Split extends Command { /** *************** *** 78,82 **** public Split(Edge edge) { parameters.put(new Attribute("edge", edge)); ! parameters.put("n", 2); } /** --- 141,145 ---- public Split(Edge edge) { parameters.put(new Attribute("edge", edge)); ! parameters.putDouble("n", 2); } /** *************** *** 159,161 **** --- 222,257 ---- } } + + /** + * + * + */ + public static class Scale extends Command { + private Collection<Vertex> vertices; + private Vertex origin; + private Vertex normal; + + /** + * + * @param vertices collecting + * @param origin vertex + * @param normal vertex + */ + public Scale(Collection<Vertex> vertices, Vertex origin, Vertex normal) { + this.vertices = vertices; + this.origin = origin; + this.normal = normal; + parameters.put("vertices", vertices); + parameters.put("origin", origin); + parameters.put("normal", normal); + parameters.put("scale", 1.0); + } + + /** {@inheritDoc} */ + @Override + public void evaluate() { + // TODO Auto-generated method stub + + } + } } Index: ParameterBlock.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ParameterBlock.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ParameterBlock.java 20 Oct 2007 17:22:53 -0000 1.11 --- ParameterBlock.java 22 Oct 2007 06:55:09 -0000 1.12 *************** *** 54,58 **** * @param value double */ ! public void put(String key, double value) { add(new Attribute(key, new Double(value))); } --- 54,58 ---- * @param value double */ ! public void putDouble(String key, double value) { add(new Attribute(key, new Double(value))); } *************** *** 63,67 **** * @param value boolean */ ! public void put(String key, boolean value) { parameters.add(new Attribute(key, value)); } --- 63,67 ---- * @param value boolean */ ! public void putBoolean(String key, boolean value) { parameters.add(new Attribute(key, value)); } *************** *** 92,95 **** --- 92,104 ---- * * @param key String + * @param value Object + */ + public void put(String key, Object value) { + add(new Attribute(key, value)); + } + + /** + * + * @param key String * @return value */ Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** Project.java 15 Oct 2007 12:41:24 -0000 1.135 --- Project.java 22 Oct 2007 06:55:09 -0000 1.136 *************** *** 169,177 **** constraints = new LinkedList(); globals = new ParameterBlock(); ! globals.put("pi", Math.PI); ! globals.put("wall", 0.15); ! globals.put("isolation", 0.1); ! globals.put("brick", 0.12); ! globals.put("roof", 0.07); Modellor.registerModellor(new LayerModellor()); Modellor.registerModellor(new TileModellor(null)); --- 169,177 ---- constraints = new LinkedList(); globals = new ParameterBlock(); ! globals.putDouble("pi", Math.PI); ! globals.putDouble("wall", 0.15); ! globals.putDouble("isolation", 0.1); ! globals.putDouble("brick", 0.12); ! globals.putDouble("roof", 0.07); Modellor.registerModellor(new LayerModellor()); Modellor.registerModellor(new TileModellor(null)); |