Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7019/src/net/sourceforge/bprocessor/model
Added Files:
FullRotate.java
Log Message:
A rotation experiment
--- NEW FILE: FullRotate.java ---
//---------------------------------------------------------------------------------
// $Id: FullRotate.java,v 1.1 2006/09/20 11:01:46 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.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Rotate
*/
public class FullRotate extends Transform {
/** rotate x */
private double rx;
/** rotate y */
private double ry;
/** rotate z */
private double rz;
/** angle */
private double angle;
/**
* Constructor
*/
public FullRotate() {
super();
rx = 0;
ry = 0;
rz = 1;
angle = 0;
}
/**
* @param value new value
*/
public void rx(double value) {
rx = value;
}
/**
*
* @return rx
*/
public double rx() {
return rx;
}
/**
* @param value new value
*/
public void ry(double value) {
ry = value;
}
/**
*
* @return ry
*/
public double ry() {
return ry;
}
/**
* @param value new value
*/
public void rz(double value) {
rz = value;
}
/**
*
* @return rz
*/
public double rz() {
return rz;
}
/**
*
* @param value new value
*/
public void angle(double value) {
angle = value;
}
/**
*
* @return angle
*/
public double angle() {
return angle;
}
/**
* Set attributes
* @param attributes List
*/
public void setAttributes(List attributes) {
Iterator iter = attributes.iterator();
while (iter.hasNext()) {
Attribute a = (Attribute)iter.next();
if (a.getName().equals("Rotate X")) {
rx(((Double)a.getValue()).doubleValue());
} else if (a.getName().equals("Rotate Y")) {
ry(((Double)a.getValue()).doubleValue());
} else if (a.getName().equals("Rotate Z")) {
rz(((Double)a.getValue()).doubleValue());
} else if (a.getName().equals("Angle")) {
angle(((Double)a.getValue()).doubleValue());
}
}
Project.getInstance().changed(Project.getInstance());
}
/**
* Get attributes
* @return List
*/
public List getAttributes() {
ArrayList res = new ArrayList();
res.add(new Attribute("Rotate X", new Double(rx())));
res.add(new Attribute("Rotate Y", new Double(ry())));
res.add(new Attribute("Rotate Z", new Double(rz())));
res.add(new Attribute("Angle", new Double(angle())));
return res;
}
/**
* @param vertex Vertex
* @return Vertex
*/
public Vertex transform(Vertex vertex) {
return vertex;
}
/**
* Get display name
* @return name
*/
public String getGeneralName() {
return "Rotate";
}
}
|