[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[gef3d-commits] r308 - trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles
|
- From: genie@xxxxxxxxxxx
- Date: Sun, 6 Sep 2009 05:49:18 -0400 (EDT)
- Delivered-to: gef3d-commits@eclipse.org
Author: kduske
Date: 2009-09-06 05:49:18 -0400 (Sun, 06 Sep 2009)
New Revision: 308
Added:
trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles/RotateHandle3DFactory.java
Modified:
trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles/DiscHandle.java
Log:
- implemented DiscHandle and added RotateHandle3DFactory, but it's unfinished and currently unusable
Modified: trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles/DiscHandle.java
===================================================================
--- trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles/DiscHandle.java 2009-09-06 09:48:19 UTC (rev 307)
+++ trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles/DiscHandle.java 2009-09-06 09:49:18 UTC (rev 308)
@@ -12,7 +12,14 @@
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Locator;
+import org.eclipse.draw3d.RenderContext;
+import org.eclipse.draw3d.geometry.ParaxialBoundingBox;
+import org.eclipse.draw3d.geometry.ParaxialBoundingBoxImpl;
+import org.eclipse.draw3d.geometry.Vector3f;
import org.eclipse.draw3d.geometry.Vector3fImpl;
+import org.eclipse.draw3d.picking.Query;
+import org.eclipse.draw3d.shapes.CylindricFigureShape;
+import org.eclipse.draw3d.util.Draw3DCache;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.handles.SquareHandle;
@@ -33,14 +40,18 @@
*/
protected static final float DEFAULT_HANDLE_SIZE = 7;
+ private CylindricFigureShape m_alphaDisc =
+ new CylindricFigureShape(this, 12, 1, false);
+
+ private CylindricFigureShape m_superDisc =
+ new CylindricFigureShape(this, 12, 1, true);
+
/**
* Creates a disc handle for the given <code>GraphicalEditPart</code> with
* the given <code>Locator</code>.
*
- * @param owner
- * the edit part which created this handle
- * @param loc
- * the locator to position this handle
+ * @param owner the edit part which created this handle
+ * @param loc the locator to position this handle
*/
public DiscHandle(GraphicalEditPart owner, Locator loc) {
super(owner, loc);
@@ -51,12 +62,9 @@
* Creates a disc handle for the given <code>GraphicalEditPart</code> with
* the given <code>Cursor</code> using the given <code>Locator</code>.
*
- * @param owner
- * the edit part which created this handle
- * @param loc
- * the locator to position this handle
- * @param c
- * the cursor to display when the mouse hovers over this handle
+ * @param owner the edit part which created this handle
+ * @param loc the locator to position this handle
+ * @param c the cursor to display when the mouse hovers over this handle
*/
public DiscHandle(GraphicalEditPart owner, Locator loc, Cursor c) {
super(owner, loc, c);
@@ -65,6 +73,18 @@
/**
* {@inheritDoc}
+ *
+ * @see org.eclipse.draw3d.Figure3D#collectRenderFragments(org.eclipse.draw3d.RenderContext)
+ */
+ @Override
+ public void collectRenderFragments(RenderContext i_renderContext) {
+
+ i_renderContext.addRenderFragment(m_alphaDisc);
+ i_renderContext.addRenderFragment(m_superDisc);
+ }
+
+ /**
+ * {@inheritDoc}
* <p>
* Returns the color for the inside of the handle. Like
* {@link SquareHandle#getFillColor()}.
@@ -80,6 +100,17 @@
/**
* {@inheritDoc}
+ *
+ * @see org.eclipse.draw3d.Figure3D#getDistance(org.eclipse.draw3d.picking.Query)
+ */
+ @Override
+ public float getDistance(Query i_query) {
+
+ return m_alphaDisc.getDistance(i_query);
+ }
+
+ /**
+ * {@inheritDoc}
* <p>
* Returns the color for the outside of the handle, GEF uses
* {@link SquareHandle#getBorderColor()} instead.
@@ -93,12 +124,49 @@
}
/**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.draw3d.Figure3D#getParaxialBoundingBox(org.eclipse.draw3d.geometry.ParaxialBoundingBox)
+ */
+ @Override
+ public ParaxialBoundingBox getParaxialBoundingBox(
+ ParaxialBoundingBox o_result) {
+
+ ParaxialBoundingBox result = o_result;
+ if (o_result == null)
+ result = new ParaxialBoundingBoxImpl();
+
+ Vector3f location = Draw3DCache.getVector3f();
+ Vector3f size = Draw3DCache.getVector3f();
+ try {
+ if (m_paraxialBounds == null) {
+ m_paraxialBounds = m_alphaDisc.getParaxialBoundingBox(null);
+
+ if (m_paraxialBounds == null)
+ return null;
+
+ helper.unionWithChildParaxialBounds(m_paraxialBounds);
+ }
+
+ m_paraxialBounds.getLocation(location);
+ m_paraxialBounds.getSize(size);
+
+ result.setLocation(location);
+ result.setSize(size);
+
+ return result;
+ } finally {
+ Draw3DCache.returnVector3f(location, size);
+ }
+ }
+
+ /**
* Initializes this handle.
*/
protected void init() {
setPreferredSize3D(new Vector3fImpl(DEFAULT_HANDLE_SIZE,
- DEFAULT_HANDLE_SIZE, DEFAULT_HANDLE_SIZE));
+ DEFAULT_HANDLE_SIZE, DEFAULT_HANDLE_SIZE));
setAlpha(40);
}
Added: trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles/RotateHandle3DFactory.java
===================================================================
--- trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles/RotateHandle3DFactory.java (rev 0)
+++ trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/handles/RotateHandle3DFactory.java 2009-09-06 09:49:18 UTC (rev 308)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Jens von Pilgrim 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:
+ * Kristian Duske - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.gef3d.handles;
+
+import java.util.List;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Handle;
+
+/**
+ * Handle factory for creating a single 3D rotate handle. This factory has no
+ * GEF counterpart.
+ *
+ * @author Kristian Duske
+ * @version $Revision$
+ * @since 31.08.2009
+ */
+public class RotateHandle3DFactory implements IHandleFactory {
+
+ /**
+ * {@inheritDoc}
+ * @see org.eclipse.gef3d.handles.IHandleFactory#addHandle(org.eclipse.gef.GraphicalEditPart, java.util.List, int)
+ */
+ public void addHandle(GraphicalEditPart i_part, List<Handle> i_handles,
+ int i_direction) {
+ // TODO implement method RotateHandle3DFactory.addHandle
+
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.eclipse.gef3d.handles.IHandleFactory#addHandles(org.eclipse.gef.GraphicalEditPart, java.util.List)
+ */
+ public void addHandles(GraphicalEditPart i_part, List<Handle> i_handles) {
+ // TODO implement method RotateHandle3DFactory.addHandles
+
+ }
+
+}