import java.util.EnumSet;
import javax.swing.JSlider;
-import javax.vecmath.Vector2d;
+import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
import org.simantics.g2d.diagram.IDiagram;
import org.simantics.g2d.element.ElementClass;
import org.simantics.g2d.element.ElementHints;
* @author J-P Laine
*/
public class SliderClass {
- public static final Key KEY_SLIDER_RESOURCE_PATH = new KeyOf(Collection.class, "SLIDER_RESOURCE_PATH");
- public static final Key KEY_SLIDER_COMPONENT = new KeyOf(Object.class, "SLIDER_COMPONENT");
- public static final Key KEY_SLIDER_SUFFIX = new KeyOf(String.class, "SLIDER_SUFFIX");
- public static final Key KEY_SLIDER_RANGE = new KeyOf(Range.class, "SLIDER_SUBSTITUTIONS");
- public static final Key KEY_SLIDER_GC = new KeyOf(Graphics2D.class, "SLIDER_GC");
- public static final Key KEY_SLIDER_VALUE = new KeyOf(Double.class, "SLIDER_VALUE");
- public static final Key KEY_TOOLTIP_TEXT = new KeyOf(String.class, "TOOLTIP_TEXT");
- public static final Key KEY_NUMBER_FORMAT = new KeyOf(MetricsFormat.class, "NUMBER_FORMAT");
+ public static final Key KEY_SLIDER_RESOURCE_PATH = new KeyOf(Collection.class, "SLIDER_RESOURCE_PATH"); //$NON-NLS-1$
+ public static final Key KEY_SLIDER_COMPONENT = new KeyOf(Object.class, "SLIDER_COMPONENT"); //$NON-NLS-1$
+ public static final Key KEY_SLIDER_SUFFIX = new KeyOf(String.class, "SLIDER_SUFFIX"); //$NON-NLS-1$
+ public static final Key KEY_SLIDER_RANGE = new KeyOf(Range.class, "SLIDER_SUBSTITUTIONS"); //$NON-NLS-1$
+ public static final Key KEY_SLIDER_GC = new KeyOf(Graphics2D.class, "SLIDER_GC"); //$NON-NLS-1$
+ public static final Key KEY_SLIDER_VALUE = new KeyOf(Double.class, "SLIDER_VALUE"); //$NON-NLS-1$
+ public static final Key KEY_TOOLTIP_TEXT = new KeyOf(String.class, "TOOLTIP_TEXT"); //$NON-NLS-1$
+ public static final Key KEY_NUMBER_FORMAT = new KeyOf(MetricsFormat.class, "NUMBER_FORMAT"); //$NON-NLS-1$
/**
* If this hint is defined, the monitor will force its x-axis to match this
* angle. If this hint doesn't exist, the monitor will not force x-axis
* orientation.
*/
- public static final Key KEY_DIRECTION = new KeyOf(Double.class, "SLIDER_DIRECTION");
+ public static final Key KEY_DIRECTION = new KeyOf(Double.class, "SLIDER_DIRECTION"); //$NON-NLS-1$
- public static final Key KEY_SG_NODE = new SceneGraphNodeKey(Node.class, "SLIDER_SG_NODE");
+ public static final Key KEY_SG_NODE = new SceneGraphNodeKey(Node.class, "SLIDER_SG_NODE"); //$NON-NLS-1$
public final static MetricsFormat DEFAULT_NUMBER_FORMAT = MetricsFormatList.METRICS_DECIMAL;
public static class Range<T> {
return Double.NaN;
double angrad = Math.toRadians(angle);
- Vector2d forcedAxis = new Vector2d(Math.cos(angrad), Math.sin(angrad));
- Vector2d x = new Vector2d(tr.getScaleX(), tr.getShearX());
- forcedAxis.normalize();
- x.normalize();
- double cosa = forcedAxis.dot(x);
+ Vector2D forcedAxis = new Vector2D(Math.cos(angrad), Math.sin(angrad));
+ Vector2D x = new Vector2D(tr.getScaleX(), tr.getShearX()).normalize();
+ double cosa = forcedAxis.dotProduct(x);
double delta = Math.acos(cosa);
return delta;
}
@Override
public Node init(G2DParentNode parent) {
- SliderNode node = parent.getOrCreateNode(""+hashCode(), SliderNode.class);
+ SliderNode node = parent.getOrCreateNode(""+hashCode(), SliderNode.class); //$NON-NLS-1$
node.setValue(0);
node.setBounds(new Rectangle2D.Double(0, 0, 50, 22));
node.setTransform(AffineTransform.getScaleInstance(staticScaleX, staticScaleY));