Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13675/src/net/sourceforge/bprocessor/model
Modified Files:
Surface.java
Added Files:
LayerModellor.java
Log Message:
LayerModellor added (untested)
Index: Surface.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** Surface.java 3 Feb 2006 13:01:49 -0000 1.72
--- Surface.java 6 Feb 2006 12:29:57 -0000 1.73
***************
*** 298,304 ****
/**
* Return a copy of this Surface
* @return The copy
*/
! public Surface copy() {
Surface surface = new Surface();
--- 298,305 ----
/**
* Return a copy of this Surface
+ * @param mesh The mesh to copy into
* @return The copy
*/
! public Surface copy(Mesh mesh) {
Surface surface = new Surface();
***************
*** 310,333 ****
Edge newEdge = new Edge();
Vertex from = current.getFrom();
! Vertex newFrom = (Vertex) map.get(from.getId());
if (newFrom == null) {
newFrom = from.copy();
! map.put(from.getId(), newFrom);
! getMesh().add(newFrom);
}
newEdge.setFrom(newFrom);
Vertex to = current.getTo();
! Vertex newTo = (Vertex) map.get(to.getId());
if (newTo == null) {
newTo = to.copy();
! map.put(to.getId(), newTo);
! getMesh().add(newTo);
}
newEdge.setTo(newTo);
! getMesh().add(newEdge);
edges.add(newEdge);
}
surface.setEdges(edges);
! getMesh().add(surface);
return surface;
}
--- 311,334 ----
Edge newEdge = new Edge();
Vertex from = current.getFrom();
! Vertex newFrom = (Vertex) map.get(from);
if (newFrom == null) {
newFrom = from.copy();
! map.put(from, newFrom);
! mesh.add(newFrom);
}
newEdge.setFrom(newFrom);
Vertex to = current.getTo();
! Vertex newTo = (Vertex) map.get(to);
if (newTo == null) {
newTo = to.copy();
! map.put(to, newTo);
! mesh.add(newTo);
}
newEdge.setTo(newTo);
! mesh.add(newEdge);
edges.add(newEdge);
}
surface.setEdges(edges);
! mesh.add(surface);
return surface;
}
--- NEW FILE: LayerModellor.java ---
//---------------------------------------------------------------------------------
// $Id: LayerModellor.java,v 1.1 2006/02/06 12:29:57 henryml Exp $
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.model;
import java.util.HashSet;
import java.util.Set;
/**
* Modellor
*/
public class LayerModellor extends Modellor {
/** The space */
private Space space;
/** The surface */
private Surface surface;
/** The distance */
private double distance;
/**
* Constructor for LayerModellor
* @param space The space to contain the layer
* @param surface The surface to extrude
* @param distance The distance of the xtrusion
*/
public LayerModellor(Space space, Surface surface, double distance) {
super();
this.space = space;
this.surface = surface;
this.distance = distance;
}
/**
* Update the geometry.
* @param entity The changed entity
*/
public void update(Object entity) {
Mesh interior = new Mesh();
Set sides = new HashSet();
Surface bottom = surface.copy(interior);
Surface top = bottom.extrude(distance, sides);
space.setInterior(interior);
}
/**
* Return null as center
* @return Null
*/
public Vertex center() {
return null;
}
}
|