blob: f0e4f999e7d6e0909d86248e277e95f197688b48 [file] [log] [blame]
/**
* Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Martin Fluegge - initial API and implementation
*/
package org.eclipse.emf.cdo.threedee.ui.nodes;
import org.eclipse.emf.cdo.threedee.common.Element;
import org.eclipse.emf.cdo.threedee.ui.ThreeDeeUtil;
import org.eclipse.net4j.util.collection.Pair;
import javax.media.j3d.Appearance;
import javax.media.j3d.TransparencyAttributes;
/**
* @author Eike Stepper
*/
public class CallShape extends LineShape implements IColors
{
public CallShape(Element from, Element to, boolean transmission)
{
super(new Pair<Element, Element>(from, to), createAppearance(transmission));
}
private static Appearance createAppearance(boolean transmission)
{
Appearance appearance = ThreeDeeUtil.getDefaultAppearance(transmission ? green : red);
TransparencyAttributes transparencyAttributes = appearance.getTransparencyAttributes();
if (transparencyAttributes == null)
{
transparencyAttributes = new TransparencyAttributes();
appearance.setTransparencyAttributes(transparencyAttributes);
}
transparencyAttributes.setTransparencyMode(TransparencyAttributes.FASTEST);
transparencyAttributes.setTransparency(0.0f);
return appearance;
}
}