]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/3d/trunk@6842 ac1ea38d-2e2b-0410...
authorluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 29 Sep 2008 11:04:56 +0000 (11:04 +0000)
committerluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 29 Sep 2008 11:04:56 +0000 (11:04 +0000)
310 files changed:
dev/org.simantics.feature.proconf.g3d/.project [deleted file]
dev/org.simantics.feature.proconf.g3d/build.properties [deleted file]
dev/org.simantics.feature.proconf.g3d/feature.xml [deleted file]
dev/org.simantics.proconf.g3d.csg/.classpath [deleted file]
dev/org.simantics.proconf.g3d.csg/.project [deleted file]
dev/org.simantics.proconf.g3d.csg/META-INF/MANIFEST.MF [deleted file]
dev/org.simantics.proconf.g3d.csg/build.properties [deleted file]
dev/org.simantics.proconf.g3d.csg/src/org/simantics/proconf/g3d/csg/Activator.java [deleted file]
dev/org.simantics.proconf.g3d.occ/.classpath [deleted file]
dev/org.simantics.proconf.g3d.occ/.project [deleted file]
dev/org.simantics.proconf.g3d.occ/META-INF/MANIFEST.MF [deleted file]
dev/org.simantics.proconf.g3d.occ/build.properties [deleted file]
dev/org.simantics.proconf.g3d.occ/plugin.xml [deleted file]
dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/Activator.java [deleted file]
dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/OccResources.java [deleted file]
dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/IndexedGeometry.java [deleted file]
dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/OccTriangulator.java [deleted file]
dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/ViewableShapeImpl.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/.classpath [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/.project [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/META-INF/MANIFEST.MF [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/build.properties [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/difference.png [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/difference.svg [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/intersection.png [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/intersection.svg [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/link.png [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/link.svg [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/union.png [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/union.svg [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/unlink.png [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/icons/unlink.svg [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/plugin.xml [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/Activator.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/ShapeEditorResources.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/ExportAction.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/ImportAction.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFileAction.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFolderAction.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/common/ViewpointGenerator.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/dialogs/PropertySelectionDialog.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectAdapter.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectType.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/NewCSGModelHandler.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/ResourceEditorAdapter1.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/ResourceEditorAdapter3.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/perspectives/CSGModellingPerspective.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/scenegraph/CSGShapeNode.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/AnimationContribution.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/CSGModellingContribution.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/ParameterizationContribution.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/CSGModellingView.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ParameterizationEditor.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ShapeEditorBase.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ShapeEditorView.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/StructureOutlinePage.java [deleted file]
dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/StructureView.java [deleted file]
dev/org.simantics.proconf.g3d/.classpath [deleted file]
dev/org.simantics.proconf.g3d/.project [deleted file]
dev/org.simantics.proconf.g3d/META-INF/MANIFEST.MF [deleted file]
dev/org.simantics.proconf.g3d/build.properties [deleted file]
dev/org.simantics.proconf.g3d/data/defaultfont.tga [deleted file]
dev/org.simantics.proconf.g3d/icons/batch.png [deleted file]
dev/org.simantics.proconf.g3d/icons/batch.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/delete.png [deleted file]
dev/org.simantics.proconf.g3d/icons/delete.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/eye.png [deleted file]
dev/org.simantics.proconf.g3d/icons/eye.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/ff.png [deleted file]
dev/org.simantics.proconf.g3d/icons/ff.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/geometry.png [deleted file]
dev/org.simantics.proconf.g3d/icons/geometry.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/node.png [deleted file]
dev/org.simantics.proconf.g3d/icons/node.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/play.png [deleted file]
dev/org.simantics.proconf.g3d/icons/play.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/rotate.png [deleted file]
dev/org.simantics.proconf.g3d/icons/rotate.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/rw.png [deleted file]
dev/org.simantics.proconf.g3d/icons/rw.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_eject.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_eject_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_end.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_end_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_equalizer.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_equalizer_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_fastforward.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_fastforward_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_pause.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_pause_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_play.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_play_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_repeat.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_repeat_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_rewind.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_rewind_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_start.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_start_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_stop.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/control_stop_blue.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/lock.png [deleted file]
dev/org.simantics.proconf.g3d/icons/silk/lock_open.png [deleted file]
dev/org.simantics.proconf.g3d/icons/stop.png [deleted file]
dev/org.simantics.proconf.g3d/icons/stop.svg [deleted file]
dev/org.simantics.proconf.g3d/icons/translate.png [deleted file]
dev/org.simantics.proconf.g3d/icons/translate.svg [deleted file]
dev/org.simantics.proconf.g3d/logging.properties [deleted file]
dev/org.simantics.proconf.g3d/plugin.xml [deleted file]
dev/org.simantics.proconf.g3d/schema/geometry.exsd [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/Activator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/Resources.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/CameraAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ConstrainedTransformAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextActionFactory.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextActionRegistry.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/FocusAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/InteractiveAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ReadAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ReadInteractiveAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/RemoveAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/RotateAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/TranslateAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/TranslateActionConstraints.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/WriteAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/WriteInteractiveAction.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AbstractScalarInterpolator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Animatable.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Animation.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationController.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationSystem.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationSystemListener.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ChanneledColorInterpolator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ChanneledPositionInterpolator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ConstantInterpolator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Interpolator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ResourceAnimationController.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ScalarInterpolator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ScaledResourceAnimationController.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/SlerpInterpolator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/TCBInterpolator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/TestAnimationController.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ui/AnimationControlCreator.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/AppearanceTools.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/Constraint.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ConstraintDetector.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/EditorContribution.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/G3DAPI.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/G3DTools.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/GeometryProvider.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/GeometryProviderRegistry.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/JmeRenderingComponent.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/MathTools.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ResourceTextureCache.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ScenegraphAdapter.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ScenegraphAdapterImpl.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/SelectionAdapter.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorBase.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorPart.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorProvider.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/TransformationTools.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/VecmathJmeTools.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/VisualizationScheduler.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/JmeComposite.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/JmeSinglePassRenderingComponent.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/OrbitalCamera.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/PropertyTester2.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/StructuredResourceSelection.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dialogs/JMEDialog.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dnd/DropListener.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dnd/ShapeDropTarget.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/AbstractGizmo.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/Gizmo.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/MultiSelectionGizmo.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/RotateGizmo.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/TransformGizmo.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/TransformInlineGizmo.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/AWTInputProvider.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/InputProvider.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/SWTInputProvider.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/G3DPreferencesPage.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/PreferenceConstants.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/PreferenceInitializer.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/AbstractGraphicsNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/IGeometryNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/IGraphicsNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ISelectableNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ModelNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/NonTransformableNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ParameterizedModelNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/RootGraphicsNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ShapeNode.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/AxesShape.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/FloorShape.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/GridShape.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/Quad.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/OEPathSelectionListener.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/OESelectionListener.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/PropertyTree.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/ScenegraphLockTraverser.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/AppearanceEditor.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/ScenegraphViewPart.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/SinglePageResourceEditor.java [deleted file]
dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/SinglePageResourceView.java [deleted file]
dev/org.simantics.proconf.processeditor/.classpath [deleted file]
dev/org.simantics.proconf.processeditor/.project [deleted file]
dev/org.simantics.proconf.processeditor/META-INF/MANIFEST.MF [deleted file]
dev/org.simantics.proconf.processeditor/build.properties [deleted file]
dev/org.simantics.proconf.processeditor/data/dcp.mtl [deleted file]
dev/org.simantics.proconf.processeditor/data/dcp.obj [deleted file]
dev/org.simantics.proconf.processeditor/icons/Component.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/Component.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/Elbow.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/Elbow.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/Nozzle.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/Nozzle.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/Straight.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/Straight.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/bubble.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/bubble.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/crosshair.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/crosshair.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/factory.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/factory.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/middle.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/middle.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/plus.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/plus.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/tank.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/tank.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/translate_d.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/translate_d.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/x-axis.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/x-axis.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/x-plane.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/x-plane.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/y-axis.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/y-axis.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/y-plane.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/y-plane.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/z-axis.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/z-axis.svg [deleted file]
dev/org.simantics.proconf.processeditor/icons/z-plane.png [deleted file]
dev/org.simantics.proconf.processeditor/icons/z-plane.svg [deleted file]
dev/org.simantics.proconf.processeditor/plugin.xml [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/Activator.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/ProcessResource.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertComponentAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertEquipmentAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertNozzleAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/PositionType.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/ReversePipelineAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/RoutePipeAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/SelectSplitPointAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/SplitPointListener.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateElbowAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateInlineComponentAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateStraightAction.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/InlineComponentConstraintAdapter.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/NozzleConstraintAdapter.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/TurnComponentConstraintAdapter.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/PipeAnimationController.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/PipeFlowAnimation.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/ResourcePipeAnimationController.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/ControlPointTools.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PathUtils.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipeComponentProvider.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingRules.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingTools.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingTools2.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigureAnimationDialog.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigureMonitorDialog.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigurePipelineAnimationDialog.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/EquipmentDialog.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/LibraryComponentDialog.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/NozzleDialog.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/PipelineComponentDialog.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/PipelineDialog.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/gizmo/PositionSelectionGizmo.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/EquipmentEditorAdapter.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewComponentHandler.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewEquipmentHandler.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewPlantHandler.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/PipelineComponentEditorAdapter.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DEditorAdapter.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DProjectAdapter.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DProjectType.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/BillboardMonitor.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/Monitor.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/MonitorTextProvider.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/ObjectPropertyProvider.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/PathContainer.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/ResourcePathPropertyProvider.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/TextMonitor.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/perspectives/Plant3DModellingPerspective.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/perspectives/ViewpointGenerator.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/NonVisibleNode.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeComponentNode.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeRunNode.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipelineComponentNode.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/ControlPointContribution.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/NozzleContribution.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/PlantEditContribution.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/PlantVisualizationContribution.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/EquipmentEditorPart.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PipelineComponentEditorPart.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PlantStructureOutlinePage.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PlantStructureView.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/ProcessEditor.java [deleted file]
dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/ProcessEditorPart.java [deleted file]

diff --git a/dev/org.simantics.feature.proconf.g3d/.project b/dev/org.simantics.feature.proconf.g3d/.project
deleted file mode 100644 (file)
index 8bf470c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>org.simantics.feature.proconf.g3d</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.FeatureBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.pde.FeatureNature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/dev/org.simantics.feature.proconf.g3d/build.properties b/dev/org.simantics.feature.proconf.g3d/build.properties
deleted file mode 100644 (file)
index 82ab19c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-bin.includes = feature.xml\r
diff --git a/dev/org.simantics.feature.proconf.g3d/feature.xml b/dev/org.simantics.feature.proconf.g3d/feature.xml
deleted file mode 100644 (file)
index 01fca39..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<feature\r
-      id="org.simantics.proconf.g3d"\r
-      label="ProConf 3D Graphics Framework"\r
-      version="1.0.0.qualifier"\r
-      provider-name="VTT Technical Research Centre of Finland">\r
-\r
-   <description url="http://www.example.com/description">\r
-      [Enter Feature Description here.]\r
-   </description>\r
-\r
-   <copyright url="http://www.example.com/copyright">\r
-      [Enter Copyright Description here.]\r
-   </copyright>\r
-\r
-   <license url="http://www.example.com/license">\r
-      [Enter License Description here.]\r
-   </license>\r
-\r
-   <requires>\r
-      <import feature="org.simantics.proconf.ode" version="1.0.0" match="compatible"/>\r
-      <import feature="org.simantics.proconf.platform" version="1.0.0" match="compatible"/>\r
-      <import feature="org.simantics.proconf.simulation" version="1.0.0" match="compatible"/>\r
-   </requires>\r
-\r
-   <plugin\r
-         id="org.simantics.proconf.g3d"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.simantics.proconf.g3d.occ"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="com.jme.eclipse"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.jcae.opencascade.jni"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"/>\r
-\r
-   <plugin\r
-         id="org.simantics.equation"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.simantics.animation"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.simantics.proconf.g3d.csg"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.simantics.proconf.g3d.shapeeditor"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="fi.vtt.simantics.processeditor"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-</feature>\r
diff --git a/dev/org.simantics.proconf.g3d.csg/.classpath b/dev/org.simantics.proconf.g3d.csg/.classpath
deleted file mode 100644 (file)
index 0215967..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
-       <classpathentry kind="output" path="bin"/>\r
-</classpath>\r
diff --git a/dev/org.simantics.proconf.g3d.csg/.project b/dev/org.simantics.proconf.g3d.csg/.project
deleted file mode 100644 (file)
index f4e22d7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>org.simantics.proconf.g3d.csg</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.ManifestBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.SchemaBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.pde.PluginNature</nature>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/dev/org.simantics.proconf.g3d.csg/META-INF/MANIFEST.MF b/dev/org.simantics.proconf.g3d.csg/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index cbca823..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Csg Plug-in
-Bundle-SymbolicName: org.simantics.proconf.g3d.csg
-Bundle-Version: 1.0.0
-Bundle-Activator: org.simantics.proconf.g3d.csg.Activator
-Bundle-Vendor: VTT
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.simantics.proconf.g3d,
- org.simantics.g2d.stubs,
- org.simantics.db,
- org.simantics.layer0.utils,
- org.simantics.layer0.stubs,
- org.simantics.utils.datastructures
-ipse-LazyStart: true
-Export-Package: org.simantics.proconf.g3d.csg.stubs
diff --git a/dev/org.simantics.proconf.g3d.csg/build.properties b/dev/org.simantics.proconf.g3d.csg/build.properties
deleted file mode 100644 (file)
index 41eb6ad..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/\r
-output.. = bin/\r
-bin.includes = META-INF/,\\r
-               .\r
diff --git a/dev/org.simantics.proconf.g3d.csg/src/org/simantics/proconf/g3d/csg/Activator.java b/dev/org.simantics.proconf.g3d.csg/src/org/simantics/proconf/g3d/csg/Activator.java
deleted file mode 100644 (file)
index 9a0c126..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.csg;\r
-\r
-import org.eclipse.ui.plugin.AbstractUIPlugin;\r
-import org.osgi.framework.BundleContext;\r
-\r
-/**\r
- * The activator class controls the plug-in life cycle\r
- */\r
-public class Activator extends AbstractUIPlugin {\r
-\r
-       // The plug-in ID\r
-       public static final String PLUGIN_ID = "fi.vtt.simantics.proconf.g3d.csg";\r
-\r
-       // The shared instance\r
-       private static Activator plugin;\r
-       \r
-       /**\r
-        * The constructor\r
-        */\r
-       public Activator() {\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)\r
-        */\r
-       public void start(BundleContext context) throws Exception {\r
-               super.start(context);\r
-               plugin = this;\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)\r
-        */\r
-       public void stop(BundleContext context) throws Exception {\r
-               plugin = null;\r
-               super.stop(context);\r
-       }\r
-\r
-       /**\r
-        * Returns the shared instance\r
-        *\r
-        * @return the shared instance\r
-        */\r
-       public static Activator getDefault() {\r
-               return plugin;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.occ/.classpath b/dev/org.simantics.proconf.g3d.occ/.classpath
deleted file mode 100644 (file)
index 0215967..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
-       <classpathentry kind="output" path="bin"/>\r
-</classpath>\r
diff --git a/dev/org.simantics.proconf.g3d.occ/.project b/dev/org.simantics.proconf.g3d.occ/.project
deleted file mode 100644 (file)
index 83bfecc..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>org.simantics.proconf.g3d.occ</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.ManifestBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.SchemaBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.pde.PluginNature</nature>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/dev/org.simantics.proconf.g3d.occ/META-INF/MANIFEST.MF b/dev/org.simantics.proconf.g3d.occ/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index 82853e1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: G3D OpenCascade Plug-in
-Bundle-SymbolicName: org.simantics.proconf.g3d.occ;singleton:=true
-Bundle-Version: 1.0.0
-Bundle-Activator: org.simantics.proconf.g3d.occ.Activator
-Bundle-Vendor: VTT
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.simantics.proconf.g3d,
- com.jme.eclipse,
- javax.vecmath,
- org.jcae.opencascade.jni,
- org.simantics.db,
- org.simantics.layer0.stubs,
- org.simantics.layer0.utils,
- org.simantics.utils,
- org.simantics.proconf.ui,
- org.simantics.proconf.g3d.csg
-Eclipse-LazyStart: true
-Export-Package: org.simantics.proconf.g3d.occ.geometry
diff --git a/dev/org.simantics.proconf.g3d.occ/build.properties b/dev/org.simantics.proconf.g3d.occ/build.properties
deleted file mode 100644 (file)
index 6f20375..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/\r
-output.. = bin/\r
-bin.includes = META-INF/,\\r
-               .,\\r
-               plugin.xml\r
diff --git a/dev/org.simantics.proconf.g3d.occ/plugin.xml b/dev/org.simantics.proconf.g3d.occ/plugin.xml
deleted file mode 100644 (file)
index 3784ffe..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<?eclipse version="3.2"?>\r
-<plugin>\r
-   <extension\r
-         point="org.simantics.proconf.g3d.geometry">\r
-      <Geometry\r
-            class="org.simantics.proconf.g3d.occ.geometry.OccTriangulator"\r
-            id="org.simantics.proconf.g3d.occ.Geometry1">\r
-      </Geometry>\r
-   </extension>\r
-\r
-</plugin>\r
diff --git a/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/Activator.java b/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/Activator.java
deleted file mode 100644 (file)
index a4f7cd4..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.occ;\r
-\r
-import org.eclipse.ui.plugin.AbstractUIPlugin;\r
-import org.osgi.framework.BundleContext;\r
-import org.simantics.proconf.g3d.csg.stubs.CSGResource;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.proconf.g3d.stubs.G3DResource;\r
-import org.simantics.proconf.ui.ProConfUI;\r
-\r
-/**\r
- * The activator class controls the plug-in life cycle\r
- */\r
-public class Activator extends AbstractUIPlugin {\r
-\r
-       // The plug-in ID\r
-       public static final String PLUGIN_ID = "org.simantics.proconf.g3d.occ";\r
-\r
-       // The shared instance\r
-       private static Activator plugin;\r
-       \r
-       /**\r
-        * The constructor\r
-        */\r
-       public Activator() {\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)\r
-        */\r
-       public void start(BundleContext context) throws Exception {\r
-               super.start(context);\r
-               plugin = this;\r
-               \r
-               ProConfUI.getSession().syncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               OccResources.csgResource = CSGResource.getInstance(g);\r
-                               OccResources.g3dResource = G3DResource.getInstance(g);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)\r
-        */\r
-       public void stop(BundleContext context) throws Exception {\r
-               plugin = null;\r
-               super.stop(context);\r
-       }\r
-\r
-       /**\r
-        * Returns the shared instance\r
-        *\r
-        * @return the shared instance\r
-        */\r
-       public static Activator getDefault() {\r
-               return plugin;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/OccResources.java b/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/OccResources.java
deleted file mode 100644 (file)
index 1023fb6..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.occ;\r
-\r
-import org.simantics.proconf.g3d.csg.stubs.CSGResource;\r
-import org.simantics.proconf.g3d.stubs.G3DResource;\r
-\r
-\r
-public class OccResources {\r
-       public static CSGResource csgResource;\r
-       public static G3DResource g3dResource;\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/IndexedGeometry.java b/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/IndexedGeometry.java
deleted file mode 100644 (file)
index cf3732d..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.occ.geometry;\r
-\r
-\r
-public class IndexedGeometry \r
-{\r
-       private float[] coordinates=new float[0];\r
-       private float[] tcoordinates=new float[0];\r
-    private float[] normals=new float[0];\r
-       private int[] indices = new int[0];\r
-       private float[] colors=new float[0];\r
-               \r
-       public IndexedGeometry()\r
-       {               \r
-       }\r
-       \r
-       \r
-       \r
-       public int[] getIndices()\r
-       {\r
-               return indices;\r
-       }\r
-       \r
-       public float[] getCoordinates()\r
-       {\r
-               return coordinates;\r
-       }\r
-       \r
-       public float[] getTCoordinates()\r
-       {\r
-               return tcoordinates;\r
-       }\r
-       \r
-       \r
-       public void setIndices(int[] value)\r
-       {\r
-               indices=value;\r
-       }\r
-       \r
-       public void setCoordinates(float[] value)\r
-       {\r
-               coordinates=value;\r
-       }\r
-       \r
-       public void setTCoordinates(float[] value)\r
-       {\r
-               tcoordinates=value;\r
-       }\r
-       \r
-       public float[] getColors()\r
-       {\r
-               return colors;\r
-       }\r
-       \r
-       public void setColors(float[] arg)\r
-       {\r
-               colors=arg;\r
-       }\r
-       \r
-\r
-    public float[] getNormals()\r
-    {\r
-        return normals;\r
-    }\r
-    \r
-    public void setNormals(float[] arg)\r
-    {\r
-        normals=arg;\r
-    }\r
-\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/OccTriangulator.java b/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/OccTriangulator.java
deleted file mode 100644 (file)
index ca5af06..0000000
+++ /dev/null
@@ -1,820 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.occ.geometry;\r
-\r
-import java.io.IOException;\r
-import java.util.Collection;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Tuple3d;\r
-import javax.vecmath.Vector2d;\r
-\r
-import org.jcae.opencascade.jni.BRepBuilderAPI_MakeEdge;\r
-import org.jcae.opencascade.jni.BRepBuilderAPI_MakeFace;\r
-import org.jcae.opencascade.jni.BRepBuilderAPI_MakeWire;\r
-import org.jcae.opencascade.jni.BRepBuilderAPI_Transform;\r
-import org.jcae.opencascade.jni.BRepOffsetAPI_ThruSections;\r
-import org.jcae.opencascade.jni.BRepPrimAPI_MakePrism;\r
-import org.jcae.opencascade.jni.BRepPrimAPI_MakeRevol;\r
-import org.jcae.opencascade.jni.BRepPrimAPI_MakeTorus;\r
-import org.jcae.opencascade.jni.BRep_Builder;\r
-import org.jcae.opencascade.jni.GC_MakeArcOfCircle;\r
-import org.jcae.opencascade.jni.GC_MakeSegment;\r
-import org.jcae.opencascade.jni.GP_Elips;\r
-import org.jcae.opencascade.jni.GP_Trsf;\r
-import org.jcae.opencascade.jni.TopoDS_Edge;\r
-import org.jcae.opencascade.jni.TopoDS_Face;\r
-import org.jcae.opencascade.jni.TopoDS_Shape;\r
-import org.jcae.opencascade.jni.TopoDS_Wire;\r
-import org.simantics.proconf.g3d.csg.stubs.Barrel;\r
-import org.simantics.proconf.g3d.csg.stubs.BooleanOperation;\r
-import org.simantics.proconf.g3d.csg.stubs.Box;\r
-import org.simantics.proconf.g3d.csg.stubs.CSGShape;\r
-import org.simantics.proconf.g3d.csg.stubs.Cone;\r
-import org.simantics.proconf.g3d.csg.stubs.Cylinder;\r
-import org.simantics.proconf.g3d.csg.stubs.EllipticCylinder;\r
-import org.simantics.proconf.g3d.csg.stubs.RectangularSolid;\r
-import org.simantics.proconf.g3d.csg.stubs.RegularPrism;\r
-import org.simantics.proconf.g3d.csg.stubs.Sphere;\r
-import org.simantics.proconf.g3d.csg.stubs.Torus;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.GeometryProvider;\r
-import org.simantics.proconf.g3d.occ.OccResources;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import com.jme.eclipse.test.ply.PLY_Loader;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Line;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-public class OccTriangulator implements GeometryProvider{\r
-\r
-    \r
-    public static final double MIN_VALUE = 0.001;\r
-    \r
-    public OccTriangulator() {\r
-        \r
-    }\r
-    \r
-    \r
-    \r
-    public boolean canHandle(IEntity instance) {\r
-        if (instance.isInstanceOf(OccResources.csgResource.CSGShape)) {\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-    \r
-    public Geometry[] getGeometryFromResource(IEntity resource, boolean transform) {\r
-        if (resource.isInstanceOf(OccResources.csgResource.CSGShape)) {\r
-            TopoDS_Shape shape = OccTriangulator.getShapeFromResource(resource, transform);\r
-            Geometry[] g = OccTriangulator.getGeometry(shape);\r
-            shape.delete();\r
-            return g;\r
-        } \r
-        return null;\r
-    }\r
-    \r
-    public boolean reconstructGeometry(IEntity instance, boolean transform, Geometry[] geometry) {\r
-       if (instance.isInstanceOf(OccResources.csgResource.CSGShape)) {\r
-            TopoDS_Shape shape = OccTriangulator.getShapeFromResource(instance, transform);\r
-            boolean b = OccTriangulator.getGeometry(shape,geometry);\r
-            shape.delete();\r
-            return b;\r
-        } \r
-       return false;\r
-       \r
-    }\r
-\r
-    public static Geometry[] getGeometry(TopoDS_Shape tds_shape) {\r
-       Geometry g[] = new Geometry[]{new TriMesh(),new Line()};\r
-       if (getGeometry(tds_shape, g))\r
-               return g;\r
-       return null;\r
-        \r
-    }\r
-    \r
-    public static boolean getGeometry(TopoDS_Shape tds_shape, Geometry[] geometry) {\r
-       ViewableShapeImpl shape = new ViewableShapeImpl(tds_shape);\r
-        //System.out.println("Geometries in shape " + shape.numGeometries());\r
-        if (shape.numGeometries() > 0) {\r
-            int totalIndicesCount = 0;\r
-            int totalVerticesCount = 0;\r
-            boolean hasTCoords = true;\r
-            for (int geometryIndex = 0; geometryIndex < shape.numGeometries(); geometryIndex++) {\r
-                IndexedGeometry geom = shape.getGeometry(geometryIndex);\r
-                totalIndicesCount += geom.getIndices().length;\r
-                totalVerticesCount += (geom.getCoordinates().length / 3);\r
-                if (geom.getTCoordinates() == null || geom.getTCoordinates().length == 0)\r
-                       hasTCoords = false;\r
-            }\r
-            int currentVertex = 0;\r
-            int currentIndex = 0;\r
-            int indices[] = new int[totalIndicesCount];\r
-            \r
-            \r
-            \r
-            //TriMesh mesh = new TriMesh();\r
-            TriMesh mesh = (TriMesh)geometry[0];\r
-            float data[] = new float[totalVerticesCount*3];\r
-            float normals[] = new float[totalVerticesCount*3];\r
-            float tcoords[] = null;\r
-            if (hasTCoords)\r
-               tcoords = new float[totalVerticesCount*2];\r
-            for (int geometryIndex = 0; geometryIndex < shape.numGeometries(); geometryIndex++) {\r
-                IndexedGeometry geom = shape.getGeometry(geometryIndex);         \r
-                System.arraycopy(geom.getCoordinates(), 0, data, currentVertex*3, geom.getCoordinates().length);\r
-                System.arraycopy(geom.getNormals(), 0, normals, currentVertex*3, geom.getCoordinates().length);\r
-                if (hasTCoords)\r
-                       System.arraycopy(geom.getTCoordinates(), 0, tcoords, currentVertex*2, geom.getTCoordinates().length - 1);\r
-                \r
-                 for (int i = 0; i < geom.getIndices().length; i++) {\r
-                     indices[currentIndex + i] = geom.getIndices()[i] + currentVertex;\r
-                 }\r
-               \r
-                 currentVertex += geom.getCoordinates().length/3;\r
-                 currentIndex += geom.getIndices().length;\r
-               \r
-            }\r
-            mesh.reconstruct(BufferUtils.createFloatBuffer(data),BufferUtils.createFloatBuffer(normals) , null, hasTCoords ? BufferUtils.createFloatBuffer(tcoords) : null, BufferUtils.createIntBuffer(indices));\r
-            \r
-            int numEdgeVertices = 0;\r
-            int currentEdgeVertex = 0;\r
-            for (int i = 0; i < shape.getNumEdges(); i++) {\r
-                numEdgeVertices += shape.getEdge(i).length/3;\r
-            }\r
-\r
-            Line lines = (Line)geometry[1];\r
-            data = new float[numEdgeVertices*3];\r
-            for (int i = 0; i < shape.getNumEdges(); i++) {\r
-                int index = currentEdgeVertex *3;\r
-                System.arraycopy(shape.getEdge(i), 0,data, index, shape.getEdge(i).length);\r
-               currentEdgeVertex+= shape.getEdge(i).length/3;\r
-            }\r
-            lines.reconstruct(BufferUtils.createFloatBuffer(data), null, null, null);\r
-            \r
-            tds_shape.delete();\r
-            return true;\r
-        } else {\r
-               tds_shape.delete();\r
-               return false;\r
-        }\r
-    }\r
-    /*\r
-    public static Geometry[] getGeometry(TopoDS_Shape tds_shape) {\r
-        return getGeometry(tds_shape,true);\r
-    }\r
-    */\r
-    /*\r
-    public static boolean getGeometry(TopoDS_Shape tds_shape, Geometry[] geometry) {\r
-        return getGeometry(tds_shape,true, geometry);\r
-    }\r
-    */\r
-    \r
-    private static TopoDS_Shape getPrimitiveFromResource(IEntity thing) {\r
-       if (!thing.isInstanceOf(OccResources.csgResource.Primitive)) \r
-            throw new IllegalArgumentException("Resource is not a primitive");\r
-        TopoDS_Shape shape = null;\r
-        if (thing.isInstanceOf(OccResources.csgResource.Box)) {\r
-            Box box = new Box(thing);\r
-            double sx = box.getXAxisSize()[0];\r
-            double sy = box.getYAxisSize()[0];\r
-            double sz = box.getZAxisSize()[0];\r
-            if (sx <= MIN_VALUE)\r
-                sx = MIN_VALUE;\r
-            if (sy <= MIN_VALUE)\r
-                sy = MIN_VALUE;\r
-            if (sz <= MIN_VALUE)\r
-                sz = MIN_VALUE;\r
-            \r
-            shape = makeBox(-sx * 0.5, -sy * 0.5, -sz * 0.5, sx * 0.5, sy * 0.5, sz * 0.5);\r
-        } else if (thing.isInstanceOf(OccResources.csgResource.Cone)) {\r
-            Cone cone = new Cone(thing);\r
-            double h = cone.getHeight()[0];\r
-            double r1 = cone.getBottomRadius()[0];\r
-            double r2 = cone.getTopRadius()[0];\r
-            if (Math.abs(r1 - r2) > MIN_VALUE) { // OpenCASCADE won't work,\r
-                                            // if r1 == r2\r
-                shape = makeCone(new double[] { 0.0, -h * 0.5, 0.0 }, new double[] { 0.0, 1.0, 0.0 }, r1,\r
-                        r2, h);\r
-            } else {\r
-                shape = makeCylinder(new double[] { 0.0, -h * 0.5, 0.0 }, new double[] { 0.0, 1.0, 0.0 },\r
-                        r1, h);\r
-            }\r
-        } else if (thing.isInstanceOf(OccResources.csgResource.Sphere)) {\r
-            Sphere sphere = new Sphere(thing);\r
-            double r = sphere.getRadius()[0];\r
-            if (r <= MIN_VALUE)\r
-                r = MIN_VALUE;\r
-            shape = makeSphere(0.0, 0.0, 0.0, r);\r
-        } else if (thing.isInstanceOf(OccResources.csgResource.Torus)) {\r
-            Torus torus = new Torus(thing);\r
-            double r1 = torus.getMajorRadius()[0];\r
-            double r2 = torus.getMinorRadius()[0];\r
-            if (r1 <= MIN_VALUE)\r
-                r1 = MIN_VALUE;\r
-            if (r2 <= MIN_VALUE)\r
-                r2 = MIN_VALUE;\r
-            shape = makeTorus(new double[] { 0.0, 0.0, 0.0 }, new double[] { 0.0, 1.0, 0.0 }, r1, r2);\r
-        } else if (thing.isInstanceOf(OccResources.csgResource.Cylinder)) {\r
-            Cylinder cylinder = new Cylinder(thing);\r
-            double h = cylinder.getHeight()[0];\r
-            double r = cylinder.getRadius()[0];\r
-            if (r <= MIN_VALUE)\r
-                r = MIN_VALUE;\r
-            if (h <= MIN_VALUE)\r
-                h = MIN_VALUE;\r
-            shape = makeCylinder(new double[] { 0.0, -h * 0.5, 0.0 }, new double[] { 0.0, 1.0, 0.0 }, r, h);\r
-               } else if (thing.isInstanceOf(OccResources.csgResource.Barrel)) {\r
-                       Barrel barrel = new Barrel(thing);\r
-                       double h = barrel.getHeight()[0];\r
-                       if (h <= 0.0)\r
-                               h = 0.01;\r
-                       double r1 = barrel.getMinorRadius()[0];\r
-                       if (r1 <= MIN_VALUE)\r
-                               r1 = MIN_VALUE;\r
-                       double r2 = barrel.getMajorRadius()[0];\r
-                       if (r2 <= MIN_VALUE)\r
-                               r2 = MIN_VALUE;\r
-                       if (Math.abs(r1 -r2)< MIN_VALUE)\r
-                               r2 = r1 + MIN_VALUE;\r
-                       double p0[] = new double[]{0.0,-h*0.5,0.0};\r
-                       double p1[] = new double[]{0.0,-h*0.5,r1};\r
-                       double p2[] = new double[]{0.0, 0.0  ,r2};\r
-                       double p3[] = new double[]{0.0, h*0.5,r1};\r
-                       double p4[] = new double[]{0.0, h*0.5,0.0};\r
-                       GC_MakeArcOfCircle m = new GC_MakeArcOfCircle(p1,p2,p3);\r
-                       GC_MakeSegment s1 = new GC_MakeSegment(p0,p1);\r
-                       GC_MakeSegment s2 = new GC_MakeSegment(p3,p4);\r
-                       TopoDS_Edge e1 = (TopoDS_Edge)new BRepBuilderAPI_MakeEdge(s1.value()).shape();\r
-                       TopoDS_Edge e2 = (TopoDS_Edge)new BRepBuilderAPI_MakeEdge(m.value()).shape();\r
-                       TopoDS_Edge e3 = (TopoDS_Edge)new BRepBuilderAPI_MakeEdge(s2.value()).shape();\r
-                       TopoDS_Wire w = (TopoDS_Wire) new BRepBuilderAPI_MakeWire(e1,e2,e3).shape();\r
-                       TopoDS_Face F = (TopoDS_Face) new BRepBuilderAPI_MakeFace(w).shape();\r
-            shape = new BRepPrimAPI_MakeRevol(F,new double[]{0.0,0.0,0.0,0.0,1.0,0.0}).shape();\r
-            m.delete();\r
-            s1.delete();\r
-            s2.delete();\r
-            e1.delete();\r
-            e2.delete();\r
-            e3.delete();\r
-            w.delete();\r
-            F.delete();\r
-               } else if (thing.isInstanceOf(OccResources.csgResource.EllipticCylinder)) {\r
-                       EllipticCylinder cylinder = new EllipticCylinder(thing);\r
-                       double h = cylinder.getHeight()[0];\r
-                       if (h < MIN_VALUE)\r
-                               h = MIN_VALUE;\r
-                       double r2 = cylinder.getMinorRadius()[0];\r
-                       if (r2 < MIN_VALUE)\r
-                               r2 = MIN_VALUE;\r
-                       double r1 = cylinder.getMajorRadius()[0];\r
-                       if (r1 < MIN_VALUE)\r
-                               r1 = MIN_VALUE;\r
-                       GP_Elips ellipse;\r
-                       if (r1 < r2) {\r
-                               // FIXME : ellipse should be rotated, but current JNI won't allow it since Ax2 is not separate object\r
-                               ellipse = new GP_Elips(new double[]{0.0,-h*0.5,0.0,0.0,1.0,0.0},r2,r1);\r
-                       } else {\r
-                               ellipse = new GP_Elips(new double[]{0.0,-h*0.5,0.0,0.0,1.0,0.0},r1,r2);\r
-                       }\r
-                       TopoDS_Edge ed = (TopoDS_Edge) new BRepBuilderAPI_MakeEdge(ellipse).shape();\r
-                       TopoDS_Wire w = (TopoDS_Wire) new BRepBuilderAPI_MakeWire(ed).shape();\r
-            TopoDS_Face F = (TopoDS_Face) new BRepBuilderAPI_MakeFace(w).shape();\r
-            shape = new BRepPrimAPI_MakePrism(F, new double[] { 0.0, h, 0.0 }).shape();\r
-            ellipse.delete();\r
-            ed.delete();\r
-            w.delete();\r
-            F.delete();\r
-               } else if (thing.isInstanceOf(OccResources.csgResource.RegularPrism)) {\r
-                       RegularPrism prism = new RegularPrism(thing);\r
-                       int n = prism.getCorners()[0];\r
-                       if (n < 3)\r
-                               n = 3;\r
-                       double h = prism.getHeight()[0];\r
-                       if (h < MIN_VALUE)\r
-                               h = MIN_VALUE;\r
-                       double r = prism.getRadius()[0];\r
-                       if (r < MIN_VALUE)\r
-                               r = MIN_VALUE;\r
-                       Vector2d vertices[] = new Vector2d[n];\r
-                       for (int i = 0; i < n; i++) {\r
-                               vertices[i] = new Vector2d(Math.sin(Math.PI * 2.0 * i / n)*r,Math.cos(Math.PI * 2.0 * i / n)*r);\r
-                       }\r
-                       BRepBuilderAPI_MakeWire wire = new BRepBuilderAPI_MakeWire();\r
-                       for (int i = 0; i < n; i++) {\r
-                               Vector2d v1 = vertices[i];\r
-                               Vector2d v2 = vertices[(i+1)%n];\r
-                               wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{v1.x,-h*0.5,v1.y},new double[]{v2.x,-h*0.5,v2.y}).shape());\r
-                       }\r
-                       TopoDS_Wire w = (TopoDS_Wire)wire.shape();\r
-                       TopoDS_Face F = (TopoDS_Face) new BRepBuilderAPI_MakeFace(w).shape();\r
-            shape = new BRepPrimAPI_MakePrism(F, new double[] { 0.0, h, 0.0 }).shape();        \r
-            wire.delete();\r
-            w.delete();\r
-            F.delete();\r
-               } else if (thing.isInstanceOf(OccResources.csgResource.RectangularSolid)) {\r
-                       RectangularSolid solid = new RectangularSolid(thing);\r
-                       double x1 = solid.getXAxisMinimumSize()[0];\r
-                       double x2 = solid.getXAxisMaximumSize()[0];\r
-                       double y = solid.getYAxisSize()[0];\r
-                       double z1 = solid.getZAxisMinimumSize()[0];\r
-                       double z2 = solid.getZAxisMaximumSize()[0];\r
-                       if (x1 < MIN_VALUE)\r
-                               x1 = MIN_VALUE;\r
-                       if (x2 < MIN_VALUE)\r
-                               x2 = MIN_VALUE;\r
-                       if (y < MIN_VALUE)\r
-                               y = MIN_VALUE;\r
-                       if (z1 < MIN_VALUE)\r
-                               z1 = MIN_VALUE;\r
-                       if (z2 < MIN_VALUE)\r
-                               z2 = MIN_VALUE;\r
-                       x1 *= 0.5;\r
-                       x2 *= 0.5;\r
-                       y *= 0.5;\r
-                       z1 *= 0.5;\r
-                       z2 *= 0.5;\r
-                       \r
-                       BRepBuilderAPI_MakeWire wire = new BRepBuilderAPI_MakeWire();\r
-                       wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{x1,-y,z1},new double[]{x1,-y,-z1}).shape());\r
-                       wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{x1,-y,-z1},new double[]{-x1,-y,-z1}).shape());\r
-                       wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{-x1,-y,-z1},new double[]{-x1,-y,z1}).shape());\r
-                       wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{-x1,-y,z1},new double[]{x1,-y,z1}).shape());\r
-                       TopoDS_Wire w1 = (TopoDS_Wire)wire.shape();\r
-                       wire.delete();\r
-                       wire = new BRepBuilderAPI_MakeWire();\r
-                       wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{x2, y,z2},new double[]{x2, y,-z2}).shape());\r
-                       wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{x2, y,-z2},new double[]{-x2, y,-z2}).shape());\r
-                       wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{-x2, y,-z2},new double[]{-x2, y,z2}).shape());\r
-                       wire.add((TopoDS_Edge)new BRepBuilderAPI_MakeEdge(new double[]{-x2, y,z2},new double[]{x2, y,z2}).shape());\r
-                       TopoDS_Wire w2 = (TopoDS_Wire)wire.shape();\r
-                       BRepOffsetAPI_ThruSections generatorb = new BRepOffsetAPI_ThruSections(true, true);\r
-                       generatorb.addWire(w1);\r
-                       generatorb.addWire(w2);\r
-                       generatorb.build();\r
-                       shape = generatorb.shape();\r
-                       wire.delete();\r
-                       w1.delete();\r
-                       w2.delete();\r
-               } else {\r
-                       throw new UnsupportedOperationException("Unsupported primitive");\r
-\r
-               }\r
-        return shape;\r
-    }\r
-    \r
-    private static TopoDS_Shape getBooleanOp(IEntity thing, TopoDS_Shape topoDSshape1, TopoDS_Shape topoDSshape2) {\r
-        if (!thing.isInstanceOf(OccResources.csgResource.BooleanOperation))\r
-            throw new IllegalArgumentException("Resource is not a boolean operation");\r
-        TopoDS_Shape shape = null;\r
-        int type;\r
-        if (thing.isInstanceOf(OccResources.csgResource.Difference)) {\r
-            type = 0;\r
-        } else if (thing.isInstanceOf(OccResources.csgResource.Union)) {\r
-            type = 1;\r
-        } else if (thing.isInstanceOf(OccResources.csgResource.Intersection)) {\r
-            type = 2;\r
-        } else {\r
-            throw new UnsupportedOperationException("Unsupported boolean operation");\r
-        }\r
-       \r
-        switch (type) {\r
-        case 0:\r
-            shape = makeCut(topoDSshape1, topoDSshape2);\r
-            break;\r
-        case 1:\r
-            shape = makeFuse(topoDSshape1, topoDSshape2);\r
-            break;\r
-        case 2:\r
-            shape = makeCommon(topoDSshape1, topoDSshape2);\r
-            break;\r
-        }\r
-        topoDSshape1.delete();\r
-        topoDSshape2.delete();\r
-        return shape;\r
-    }\r
-    \r
-    private static TopoDS_Shape getBooleanOpFromResource(IEntity thing) {\r
-       if (!thing.isInstanceOf(OccResources.csgResource.BooleanOperation))\r
-               throw new IllegalArgumentException("Resource is not a boolean operation");\r
-        \r
-        TopoDS_Shape shape = null;\r
-        TopoDS_Shape topoDSshape1 = null;\r
-        TopoDS_Shape topoDSshape2 = null;\r
-        BooleanOperation op = new BooleanOperation(thing);\r
-        CSGShape mainShape = op.getMainShape();\r
-        Collection<CSGShape> secondaryShapes = op.getSecondaryShape();\r
-        if (mainShape == null || secondaryShapes.size() < 1) {\r
-            throw new RuntimeException("Cannot find requested Shapes for boolean operation");\r
-        }\r
-        topoDSshape1 = getShapeFromResource(mainShape);\r
-        for (CSGShape shape2 : secondaryShapes) {\r
-            topoDSshape2 = getShapeFromResource(shape2);\r
-            shape = getBooleanOp(thing,topoDSshape1,topoDSshape2);\r
-            topoDSshape1.delete();\r
-            topoDSshape1 = shape;\r
-        }\r
-        \r
-        topoDSshape2.delete();\r
-        return shape;\r
-    }\r
-\r
-    private static TopoDS_Shape getShapeFromResource(IEntity thing) {\r
-        return getShapeFromResource(thing, true);\r
-    }\r
-    \r
-    private static TopoDS_Shape getShapeFromResource(IEntity thing, boolean transform) {\r
-        if (thing.isInstanceOf(OccResources.csgResource.CSGShape)) {\r
-            TopoDS_Shape shape = null;\r
-            \r
-            if (thing.isInstanceOf(OccResources.csgResource.Primitive)) {\r
-                shape = getPrimitiveFromResource(thing);\r
-\r
-            } else if (thing.isInstanceOf(OccResources.csgResource.BooleanOperation)) {\r
-                shape = getBooleanOpFromResource(thing);\r
-\r
-            } else {\r
-                throw new UnsupportedOperationException("Shape must be a primitive or a boolean operation");\r
-            }\r
-            Tuple3d c = null;\r
-            CSGShape shapeType = new CSGShape(thing);\r
-            \r
-            if (shapeType.getCenter() != null)\r
-               c = G3DTools.getVector(shapeType.getCenter());\r
-            \r
-            TopoDS_Shape tShape = null;\r
-            if(c != null) {\r
-               tShape = makeTranslation(shape, c.x, c.y, c.z);\r
-                shape.delete();\r
-                shape = tShape;\r
-            }\r
-            if (transform) {\r
-                //CSGShape shapeType = CSGShapeFactory.create(resource);\r
-                Tuple3d p = G3DTools.getVector(shapeType.getLocalPosition());\r
-                AxisAngle4d r = G3DTools.getOrientation(shapeType.getLocalOrientation());\r
-               \r
-                if (Math.abs(r.angle) > 0.01) {\r
-                    tShape = makeRotation(shape, new double[] { 0.0, 0.0, 0.0, r.x, r.y, r.z }, r.angle);\r
-                    shape.delete();\r
-                    shape = tShape;\r
-                }\r
-                tShape = makeTranslation(shape, p.x, p.y, p.z);\r
-                shape.delete();\r
-                shape = tShape;\r
-            }\r
-\r
-            return shape;\r
-\r
-        }\r
-        throw new UnsupportedOperationException("Resource is not a shape");\r
-    }\r
-\r
-    private static TopoDS_Shape getShapeFromFile(String filename) {\r
-        assert (filename != null);\r
-        if (filename.endsWith("stp")) {\r
-            TopoDS_Shape shape = importSTEP(filename);\r
-            return shape;\r
-        } else if (filename.endsWith("step")) {\r
-            TopoDS_Shape shape = importSTEP(filename);\r
-            return shape;\r
-        } else if (filename.endsWith("iges")) {\r
-            TopoDS_Shape shape = importIGES(filename);\r
-            return shape;\r
-        } else if (filename.endsWith("brep")) {\r
-            TopoDS_Shape shape = importBREP(filename);\r
-            return shape;\r
-        } else {\r
-            throw new UnsupportedOperationException("Unsupported format " + filename);\r
-        }\r
-\r
-    }\r
-\r
-   \r
-\r
-    public static Geometry[] getGeometryFromFile(String filename) {\r
-        if (filename.endsWith("ply")) {\r
-            try {\r
-                return new Geometry[]{PLY_Loader.loadPLY(filename)};\r
-            } catch (IOException e) {\r
-                ErrorLogger.defaultLogError(e);\r
-                return null;\r
-            }\r
-        }\r
-        TopoDS_Shape shape = OccTriangulator.getShapeFromFile(filename);\r
-        Geometry g[] = OccTriangulator.getGeometry(shape);\r
-        shape.delete();\r
-        return g;\r
-    }\r
-    \r
-    public static TopoDS_Shape importBREP(String filename) {\r
-        org.jcae.opencascade.jni.BRep_Builder aBuilder = new org.jcae.opencascade.jni.BRep_Builder();\r
-        org.jcae.opencascade.jni.TopoDS_Shape myShape = org.jcae.opencascade.jni.BRepTools.read(filename, aBuilder);\r
-        aBuilder.delete();\r
-        return myShape;\r
-    }\r
-\r
-    public static TopoDS_Shape importIGES(String filename) {\r
-        org.jcae.opencascade.jni.IGESControl_Reader aReader = new org.jcae.opencascade.jni.IGESControl_Reader();\r
-        aReader.readFile(filename);\r
-        aReader.clearShapes();\r
-        aReader.transferRoots();\r
-        TopoDS_Shape result = aReader.oneShape();\r
-        aReader.delete();\r
-        return result;\r
-    }\r
-    \r
-    public static TopoDS_Shape importSTEP(String filename) {\r
-        org.jcae.opencascade.jni.STEPControl_Reader aReader = new org.jcae.opencascade.jni.STEPControl_Reader();\r
-        aReader.readFile(filename);\r
-        aReader.clearShapes();\r
-        aReader.transferRoots();\r
-        TopoDS_Shape result = aReader.oneShape();\r
-        aReader.delete();\r
-        return result;\r
-    }\r
-\r
-    public static TopoDS_Shape archimede(TopoDS_Shape topoDS_Shape, double param, double param2, double param3) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape suppressHolesInFaceOrShell(TopoDS_Shape topoDS_Shape, TopoDS_Shape[] topoDS_Shape1) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape suppressHole(TopoDS_Shape topoDS_Shape, TopoDS_Shape[] topoDS_Shape1,\r
-            TopoDS_Shape[] topoDS_Shape2, TopoDS_Shape[] topoDS_Shape3) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape[] suppressFaces(TopoDS_Shape topoDS_Shape, TopoDS_Shape[] topoDS_Shape1) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape[] subShapeAll(TopoDS_Shape topoDS_Shape, short param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape subShape(TopoDS_Shape topoDS_Shape, short param, TopoDS_Shape[] topoDS_Shape2) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static boolean setBlock(TopoDS_Shape topoDS_Shape) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape partitionKeepFaces(TopoDS_Shape[] topoDS_Shape, TopoDS_Shape topoDS_Shape1, boolean param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape orientationChange(TopoDS_Shape topoDS_Shape) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static short nbLabels() {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeWire(TopoDS_Shape[] topoDS_Shape) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeVertex(double param, double param1, double param2) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeVector(double[] pointStruct, double[] pointStruct1) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeTranslation(TopoDS_Shape aShape, double x, double y, double z) {\r
-        GP_Trsf theTransformation = new GP_Trsf();\r
-        theTransformation.setTranslation(new double[] { x, y, z });\r
-        BRepBuilderAPI_Transform bt = new BRepBuilderAPI_Transform(aShape, theTransformation, true);\r
-\r
-        TopoDS_Shape shape = bt.shape();\r
-        bt.delete();\r
-        theTransformation.delete();\r
-        return shape;\r
-    }\r
-\r
-    public static TopoDS_Shape makeTorus(double[] pointStruct, double[] dirStruct, double r1, double r2) {\r
-        double[] axe = new double[6];\r
-        System.arraycopy(pointStruct, 0, axe, 0, 3);\r
-        System.arraycopy(dirStruct, 0, axe, 3, 3);\r
-        org.jcae.opencascade.jni.TopoDS_Shape tds = new BRepPrimAPI_MakeTorus(axe, r1, r2).shape();\r
-        return tds;\r
-    }\r
-\r
-    public static TopoDS_Shape makeSphere(double x, double y, double z, double radius) {\r
-        double[] c = new double[] { x, y, z };\r
-        org.jcae.opencascade.jni.TopoDS_Shape tds = new org.jcae.opencascade.jni.BRepPrimAPI_MakeSphere(c, radius)\r
-                .shape();\r
-        return tds;\r
-    }\r
-\r
-    public static TopoDS_Shape makeSewingShape(TopoDS_Shape topoDS_Shape, double param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeSewing(TopoDS_Shape[] topoDS_Shape, double param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeScaleTransform(TopoDS_Shape topoDS_Shape, double[] pointStruct, double param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeRotation(TopoDS_Shape aShape, double[] axisStruct, double angle) {\r
-\r
-        GP_Trsf theTransformation = new GP_Trsf();\r
-        theTransformation.setRotation(axisStruct, angle);\r
-        BRepBuilderAPI_Transform bt = new BRepBuilderAPI_Transform(aShape, theTransformation, true);\r
-        TopoDS_Shape shape = bt.shape();\r
-        bt.delete();\r
-        theTransformation.delete();\r
-        return shape;\r
-    }\r
-\r
-    public static TopoDS_Shape makeRevolution(TopoDS_Shape topoDS_Shape, double[] axisStruct, double param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makePrism(TopoDS_Shape topoDS_Shape, double[] pointStruct, double[] pointStruct2) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makePlane(double[] pointStruct, double[] dirStruct, double param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makePlacedBox(double param, double param1, double param2, double param3, double param4,\r
-            double param5) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makePipe(TopoDS_Shape topoDS_Shape, TopoDS_Shape topoDS_Shape1) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makePanel(TopoDS_Shape topoDS_Shape, short param, double param2) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeMultiTranslation2D(TopoDS_Shape topoDS_Shape, double[] dirStruct, double param,\r
-            short param3, double[] dirStruct4, double param5, short param6) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeMultiTranslation1D(TopoDS_Shape topoDS_Shape, double[] dirStruct, double param, short param3) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeMultiRotation2D(TopoDS_Shape topoDS_Shape, double[] dirStruct, double[] pointStruct,\r
-            double param, short param4, double param5, short param6) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeMultiRotation1D(TopoDS_Shape topoDS_Shape, double[] dirStruct, double[] pointStruct,\r
-            short param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeMirrorByPlane(TopoDS_Shape topoDS_Shape, TopoDS_Shape topoDS_Shape1) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeLine(double[] pointStruct, double[] dirStruct) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeFilling(TopoDS_Shape topoDS_Shape, short param, short param2, double param3, double param4,\r
-            short param5) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeFillet(TopoDS_Shape topoDS_Shape, double param, short param2, TopoDS_Shape[] topoDS_Shape3) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeFace(TopoDS_Shape topoDS_Shape, boolean param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeEdge(double[] pointStruct, double[] pointStruct1) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeCylinder(double[] pointStruct, double[] dirStruct, double radius, double height) {\r
-        double[] axe = new double[6];\r
-        System.arraycopy(pointStruct, 0, axe, 0, 3);\r
-        System.arraycopy(dirStruct, 0, axe, 3, 3);\r
-        org.jcae.opencascade.jni.TopoDS_Shape tds = new org.jcae.opencascade.jni.BRepPrimAPI_MakeCylinder(axe, radius,\r
-                height, 2 * Math.PI).shape();\r
-        return tds;\r
-    }\r
-\r
-    public static TopoDS_Shape makeCopy(TopoDS_Shape topoDS_Shape) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeCone(double[] pointStruct, double[] dirStruct, double radius1, double radius2, double height) {\r
-        double[] axe = new double[6];\r
-        System.arraycopy(pointStruct, 0, axe, 0, 3);\r
-        System.arraycopy(dirStruct, 0, axe, 3, 3);\r
-        org.jcae.opencascade.jni.TopoDS_Shape tds = new org.jcae.opencascade.jni.BRepPrimAPI_MakeCone(axe, radius1,\r
-                radius2, height, 2 * Math.PI).shape();\r
-        return tds;\r
-    }\r
-\r
-    public static TopoDS_Shape makeCompound(TopoDS_Shape[] shapes) {\r
-        BRep_Builder builder = new BRep_Builder();\r
-        org.jcae.opencascade.jni.TopoDS_Compound comp = new org.jcae.opencascade.jni.TopoDS_Compound();\r
-        builder.makeCompound(comp);\r
-        for (int i = 0; i < shapes.length; i++) {\r
-\r
-            builder.add(comp, shapes[i]);\r
-        }\r
-        builder.delete();\r
-        return comp;\r
-    }\r
-\r
-    public static TopoDS_Shape makeCircle(double[] pointStruct, double[] dirStruct, double param) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeChamfer(TopoDS_Shape topoDS_Shape, double param, double param2, short param3,\r
-            TopoDS_Shape[] topoDS_Shape4) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeCDG(TopoDS_Shape topoDS_Shape) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    public static TopoDS_Shape makeBox(double x1, double y1, double z1, double x2, double y2, double z2) {\r
-        double[] p1 = new double[] { x1, y1, z1 };\r
-        double[] p2 = new double[] { x2, y2, z2 };\r
-        org.jcae.opencascade.jni.TopoDS_Shape tds = new org.jcae.opencascade.jni.BRepPrimAPI_MakeBox(p1, p2).shape();\r
-        return tds;\r
-    }\r
-\r
-    public static TopoDS_Shape makeCut(TopoDS_Shape shape1, TopoDS_Shape shape2) {\r
-\r
-        org.jcae.opencascade.jni.TopoDS_Shape s = new org.jcae.opencascade.jni.BRepAlgoAPI_Cut(shape1, shape2).shape();\r
-        return s;\r
-    }\r
-    \r
-    public static TopoDS_Shape makeCommon(TopoDS_Shape shape1, TopoDS_Shape shape2) {\r
-\r
-        org.jcae.opencascade.jni.TopoDS_Shape s = new org.jcae.opencascade.jni.BRepAlgoAPI_Common(shape1, shape2).shape();\r
-        return s;\r
-    }\r
-    \r
-    public static TopoDS_Shape makeFuse(TopoDS_Shape shape1, TopoDS_Shape shape2) {\r
-\r
-        org.jcae.opencascade.jni.TopoDS_Shape s = new org.jcae.opencascade.jni.BRepAlgoAPI_Fuse(shape1, shape2).shape();\r
-        return s;\r
-    }\r
-\r
-    public static TopoDS_Shape makeArc(double[] pointStruct, double[] pointStruct1, double[] pointStruct2) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-    \r
-    public static TopoDS_Shape makeWedge(double[] pointStruct, double[] dirStruct,double dx, double dy, double dz, double xmin, double zmin, double xmax, double zmax) {\r
-        double[] axe = new double[6];\r
-        System.arraycopy(pointStruct, 0, axe, 0, 3);\r
-        System.arraycopy(dirStruct, 0, axe, 3, 3);\r
-        org.jcae.opencascade.jni.TopoDS_Shape s = new org.jcae.opencascade.jni.BRepPrimAPI_MakeWedge(axe,  dx,  dy,  dz,  xmin,  zmin, xmax, zmax).shape();\r
-        return s;\r
-    }\r
-\r
\r
-\r
-    public static void exportBREP(TopoDS_Shape shape, String filename) {\r
-        org.jcae.opencascade.jni.BRepTools.write(shape, filename);\r
-    }\r
-\r
-    public static void exportIGES(TopoDS_Shape shape, String filename) {\r
-        throw new UnsupportedOperationException();\r
-        \r
-//          IGESControl_Writer writer=new IGESControl_Writer();\r
-//          writer.addShape(shape); writer.write(filename,false);\r
-         \r
-    }\r
-\r
-\r
-\r
-\r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/ViewableShapeImpl.java b/dev/org.simantics.proconf.g3d.occ/src/org/simantics/proconf/g3d/occ/geometry/ViewableShapeImpl.java
deleted file mode 100644 (file)
index e08c9b7..0000000
+++ /dev/null
@@ -1,498 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-/* \r
-   This class is combination of jCAE's classes to generate meshes from shapes.\r
-   Faces are lisetd as individual meshes.\r
-   \r
-   Marko Luukkainen\r
-   \r
-   jCAE stand for Java Computer Aided Engineering. Features are : Small CAD\r
-   modeler, Finit element mesher, Plugin architecture.\r
-\r
-    Copyright (C) 2003 Jerome Robert <jeromerobert@users.sourceforge.net>\r
-\r
-    This library is free software; you can redistribute it and/or\r
-    modify it under the terms of the GNU Lesser General Public\r
-    License as published by the Free Software Foundation; either\r
-    version 2.1 of the License, or (at your option) any later version.\r
-\r
-    This library is distributed in the hope that it will be useful,\r
-    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-    Lesser General Public License for more details.\r
-\r
-    You should have received a copy of the GNU Lesser General Public\r
-    License along with this library; if not, write to the Free Software\r
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- */\r
-\r
-package org.simantics.proconf.g3d.occ.geometry;\r
-import org.jcae.opencascade.jni.BRepBndLib;\r
-import org.jcae.opencascade.jni.BRepMesh_IncrementalMesh;\r
-import org.jcae.opencascade.jni.BRepTools;\r
-import org.jcae.opencascade.jni.BRep_Tool;\r
-import org.jcae.opencascade.jni.Bnd_Box;\r
-import org.jcae.opencascade.jni.GCPnts_UniformDeflection;\r
-import org.jcae.opencascade.jni.GP_Trsf;\r
-import org.jcae.opencascade.jni.GeomAPI_ProjectPointOnSurf;\r
-import org.jcae.opencascade.jni.GeomAdaptor_Curve;\r
-import org.jcae.opencascade.jni.GeomLProp_SLProps;\r
-import org.jcae.opencascade.jni.Geom_Curve;\r
-import org.jcae.opencascade.jni.Geom_Surface;\r
-import org.jcae.opencascade.jni.Poly_Triangulation;\r
-import org.jcae.opencascade.jni.TopAbs_Orientation;\r
-import org.jcae.opencascade.jni.TopAbs_ShapeEnum;\r
-import org.jcae.opencascade.jni.TopExp_Explorer;\r
-import org.jcae.opencascade.jni.TopLoc_Location;\r
-import org.jcae.opencascade.jni.TopoDS_Edge;\r
-import org.jcae.opencascade.jni.TopoDS_Face;\r
-import org.jcae.opencascade.jni.TopoDS_Shape;\r
-import org.jcae.opencascade.jni.TopoDS_Vertex;\r
-\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashSet;\r
-\r
-import javax.vecmath.Matrix4d;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3f;\r
-\r
-\r
-public class ViewableShapeImpl \r
-{\r
-\r
-    \r
-    ArrayList<IndexedGeometry> faceMeshes =new ArrayList<IndexedGeometry>();\r
-    ArrayList<float[]> edges=new ArrayList<float[]>();\r
-\r
-       public ViewableShapeImpl(TopoDS_Shape g)\r
-       {\r
-        BRepTools.clean(g);\r
-               buildFaces(g);\r
-        buildEdges(g);\r
-               \r
-       }\r
-    /*\r
-    public ViewableShapeImpl(TopoDS_Shape g, boolean alternative)\r
-    {\r
-        \r
-        if (alternative) \r
-            buildFaces(g);\r
-        else {\r
-            BRepTools.clean(g);\r
-            buildFaces2(g);\r
-        }\r
-            \r
-        buildEdges(g);\r
-        \r
-    }\r
-       */\r
-       \r
-       public IndexedGeometry getGeometry(int i)\r
-       {     \r
-               return faceMeshes.get(i);\r
-       }\r
-       \r
-       public int numGeometries()\r
-       {\r
-        return faceMeshes.size();\r
-\r
-       }       \r
-    \r
-    public int getNumEdges() {\r
-        return edges.size();\r
-    }\r
-    \r
-    public float[] getEdge(int i) {\r
-        return edges.get(i);\r
-    }\r
-    \r
-    /**\r
-     * org.jcae.viewer3d.cad.occ.OCCEdgeDomain\r
-     * @param shape\r
-     * @param geom\r
-     */\r
-    private void buildFaces(TopoDS_Shape shape) {\r
-        TopExp_Explorer explorer = new TopExp_Explorer();\r
-        TopLoc_Location loc = new TopLoc_Location();\r
-        \r
-        int meshIter=4;\r
-        double deflection = deflection(shape);\r
-        for (explorer.init(shape, TopAbs_ShapeEnum.FACE); explorer.more(); explorer.next())\r
-        {       \r
-            //System.out.println("Triangulation");\r
-            TopoDS_Shape s = explorer.current();\r
-            if (!(s instanceof TopoDS_Face)) continue; // should not happen!\r
-            TopoDS_Face face = (TopoDS_Face)s;\r
-            Poly_Triangulation pt = BRep_Tool.triangulation(face,loc);\r
-            \r
-            //float error=0.01f;\r
-            double error = deflection;\r
-            int iter=0;\r
-            // if shape was generated with program triangulation seems to be always null,\r
-            // but model is loaded from file, it may already contain triangulation\r
-            // So : in those cases can we delete existing triangulation and generate a new one ?\r
-            //if (pt == null) {\r
-                //System.out.println("Initial triangulation of face "+face+" not found. Using Incremental mesh");\r
-            //} else {\r
-               //System.out.println("Initial triangulation of face "+face+" found.");\r
-            //}\r
-            while((pt==null)&(iter<meshIter)){\r
-                //System.out.println("Triangulation failed for face "+face+". Trying other mesh parameters.");\r
-                \r
-                // using relatif in incremental mesh would cause visible seams between faces\r
-               BRepMesh_IncrementalMesh m = new BRepMesh_IncrementalMesh(face,error, false);\r
-                //new BRepMesh_IncrementalMesh(face,error, false,12.0);\r
-                pt = BRep_Tool.triangulation(face,loc);             \r
-                error/=10;\r
-                iter++;\r
-                m.delete();\r
-                \r
-            }\r
-                          \r
-            \r
-            if (pt==null)\r
-            {\r
-                System.out.println("Triangulation failed for face "+face+". Mesh not generated.");\r
-                continue;\r
\r
-            }\r
-            \r
-            GP_Trsf trsf = loc.transformation();\r
-            double[] mat = new double[16];\r
-            trsf.getValues(mat);\r
-            Matrix4d m = new Matrix4d(mat);\r
-            \r
-            double[] dnodes = pt.nodes();\r
-            final int[] itriangles = pt.triangles();   \r
-            boolean useNormals = false;\r
-            boolean useTCoord = false;\r
-            \r
-            float[] tnodes = null;\r
-            float[] normals = null;\r
-            \r
-            if (useTCoord)\r
-               tnodes = new float[dnodes.length / 3 * 2];\r
-            if (useNormals)\r
-               normals= new float[dnodes.length];\r
-            GeomLProp_SLProps prop = new GeomLProp_SLProps(2,0.001);\r
-            Geom_Surface surf = BRep_Tool.surface(face);\r
-            prop.setSurface(surf);\r
-            if (useTCoord || useNormals) {\r
-               for (int i = 0; i < dnodes.length; i += 3) {\r
-                                       double UV[] = new double[2];\r
-                                       double point[] = new double[] { dnodes[i], dnodes[i + 1],\r
-                                                       dnodes[i + 2] };\r
-                                       GeomAPI_ProjectPointOnSurf pof = new GeomAPI_ProjectPointOnSurf(\r
-                                                       point, surf);\r
-                                       pof.lowerDistanceParameters(UV);\r
-                                       // boolean b = GeomLib_Tool.parameters(surf, point, 0.01,\r
-                                       // UV);\r
-                                       prop.setParameters(UV[0], UV[1]);\r
-                                       if (useNormals) {\r
-                                               double normal[] = prop.normal();\r
-                                               normals[i] = (float) normal[0];\r
-                                               normals[i + 1] = (float) normal[1];\r
-                                               normals[i + 2] = (float) normal[2];\r
-                                       }\r
-                                       if (useTCoord) {\r
-                                               int index = i / 3 * 2;\r
-                                               tnodes[index] = (float) UV[0];\r
-                                               tnodes[index + 1] = (float) UV[1];\r
-                                       }\r
-                                       // System.out.println(dnodes[i]+ " " +dnodes[i+1]+ " "\r
-                                       // +dnodes[i+2]+ " " + " UV:" + UV[0] + ","+UV[1]+ " " + b);\r
-                                       // System.out.println(dnodes[i]+ " " +dnodes[i+1]+ " "\r
-                                       // +dnodes[i+2]+ " " + normals[i] + " " + normals[i+1] + " "\r
-                                       // + normals[i+2] + " UV:" + UV[0] + ","+UV[1]);\r
-                               }\r
-            }\r
-            prop.delete();\r
-            \r
-            if(face.orientation()==TopAbs_Orientation.REVERSED)\r
-            {\r
-                flipFace(itriangles);\r
-            }\r
-            \r
-            final float[] fnodes=createFloatVertices(dnodes, m);\r
-            IndexedGeometry geom = new IndexedGeometry();\r
-            geom.setCoordinates(fnodes);\r
-            geom.setIndices(itriangles);\r
-            geom.setNormals(calcNormals(fnodes,itriangles));\r
-            if (useNormals)\r
-               geom.setNormals(normals);\r
-            if (useTCoord)\r
-               geom.setTCoordinates(tnodes);\r
-            faceMeshes.add(geom);\r
-            //System.out.println("Triangulation done");\r
-        }\r
-    }\r
-    \r
-    /**\r
-     * org.jcae.viewer3d.cad.occ.OCCEdgeDomain\r
-     * @param shape\r
-     * @param geom\r
-     */\r
-    /*\r
-    private void buildFaces2(TopoDS_Shape shape) {\r
-\r
-            TopExp_Explorer explorer = new TopExp_Explorer();\r
-            TopLoc_Location loc = new TopLoc_Location();\r
-            \r
-            int meshIter=10;\r
-                    \r
-            for (explorer.init(shape, TopAbs_ShapeEnum.FACE); explorer.more(); explorer.next())\r
-            {                       \r
-                TopoDS_Shape s = explorer.current();\r
-                if (!(s instanceof TopoDS_Face)) continue; // should not happen!\r
-                TopoDS_Face face = (TopoDS_Face)s;\r
-               \r
-                double error=0.01;\r
-                BRepMesh_Discret mesh = new BRepMesh_Discret(0.01,face,0.1,true,true);\r
-                Poly_Triangulation pt = BRep_Tool.triangulation(face,loc);\r
-                //float error=0.001f*getMaxBound(s)*4;\r
-                \r
-                if (pt == null) {\r
-                    System.out.println("Triangulation failed for face "+face+". Using Incremental mesh");\r
-                }\r
-                \r
-                int iter=0;\r
-                while((pt==null)&(iter<meshIter)){\r
-                       BRepMesh_IncrementalMesh m = new BRepMesh_IncrementalMesh(face,error, false);\r
-                    //new BRepMesh_IncrementalMesh(face,error, true);\r
-                    pt = BRep_Tool.triangulation(face,loc);             \r
-                    error/=100;\r
-                    iter++;\r
-                    System.out.println("Triangulation failed for face "+face+". Trying other mesh parameters.");\r
-                    m.delete();\r
-                }\r
-                mesh.delete();\r
-                if (pt==null)\r
-                {\r
-                    System.out.println("Triangulation failed for face "+face+". Mesh not generated.");\r
-                    continue;\r
-                }\r
-                GP_Trsf trsf = loc.transformation();\r
-                double[] mat = new double[16];\r
-                trsf.getValues(mat);\r
-                Matrix4d m = new Matrix4d(mat);\r
-                \r
-                double[] dnodes = pt.nodes();\r
-                final int[] itriangles = pt.triangles();                        \r
-\r
-                if(face.orientation()==TopAbs_Orientation.REVERSED)\r
-                {\r
-                    flipFace(itriangles);\r
-                }\r
-                \r
-                final float[] fnodes=createFloatVertices(dnodes, m);\r
-                IndexedGeometry geom = new IndexedGeometry();\r
-                geom.setCoordinates(fnodes);\r
-                geom.setIndices(itriangles);\r
-                geom.setNormals(calcNormals(fnodes,itriangles));\r
-                faceMeshes.add(geom);\r
-            }\r
-    }\r
-    */\r
-    \r
-    private float[] createFloatVertices(double dnodes[], Matrix4d m) {\r
-        float[] fnodes=new float[dnodes.length];\r
-        Point3d p = new Point3d();\r
-        \r
-        for(int i=0; i<dnodes.length;)\r
-        {\r
-            p.x = dnodes[i];\r
-            p.y = dnodes[i+1];\r
-            p.z = dnodes[i+2];\r
-            m.transform(p);\r
-            fnodes[i++]=(float) p.x;\r
-            fnodes[i++]=(float) p.y;\r
-            fnodes[i++]=(float) p.z;  \r
-        }\r
-        return fnodes;\r
-    }\r
-    private double deflection(TopoDS_Shape s) {\r
-       Bnd_Box box = new Bnd_Box(); \r
-        BRepBndLib.add(s,box);\r
-        \r
-        double[] bbox = box.get();\r
-        double boundingBoxDeflection=0.01*\r
-            Math.max(Math.max(bbox[3]-bbox[0], bbox[4]-bbox[1]), bbox[5]-bbox[2]);\r
-        box.delete();\r
-        return boundingBoxDeflection;\r
-    }\r
-    \r
-    private double edgeDeflection(TopoDS_Shape s) {\r
-       return 0.5 * deflection(s);\r
-    }\r
-    \r
-    /**\r
-     * org.jcae.viewer3d.cad.occ.OCCEdgeDomain\r
-     * @param shape\r
-     * @param geom\r
-     */\r
-    private void buildEdges(TopoDS_Shape shape) {\r
-        \r
-        \r
-        TopExp_Explorer explorer = new TopExp_Explorer();\r
-        HashSet<TopoDS_Edge> alreadyDone=new HashSet<TopoDS_Edge>();\r
-        double boundingBoxDeflection = edgeDeflection(shape);\r
-\r
-        for (explorer.init(shape, TopAbs_ShapeEnum.EDGE); explorer.more(); explorer.next())\r
-        {\r
-            TopoDS_Shape s = explorer.current();            \r
-            if (!(s instanceof TopoDS_Edge)) continue; // should not happen!\r
-            TopoDS_Edge e = (TopoDS_Edge)s;\r
-            \r
-            if(!alreadyDone.add(e))\r
-                continue;\r
-                        \r
-            double[] range = BRep_Tool.range(e);\r
-            Geom_Curve gc = BRep_Tool.curve(e, range);\r
-            float[] array;\r
-            if(gc!=null)\r
-            {\r
-                GeomAdaptor_Curve adaptator = new GeomAdaptor_Curve(gc);\r
-                GCPnts_UniformDeflection deflector = new GCPnts_UniformDeflection();\r
-\r
-                deflector.initialize(adaptator, boundingBoxDeflection, range[0], range[1]);\r
-                int npts = deflector.nbPoints();\r
-                \r
-                // Allocate one additional point at each end  = parametric value 0, 1\r
-                int size = 0;\r
-                if (npts > 2)\r
-                    size = (npts-2)*2;\r
-                size+=2;\r
-                size*=3;\r
-                array = new float[size];          \r
-                int j=0;\r
-                double[] values = adaptator.value(range[0]);\r
-                array[j++] = (float) values[0];\r
-                array[j++] = (float) values[1];\r
-                array[j++] = (float) values[2];\r
-                // All intermediary points\r
-                for (int i=1; i<npts-1; ++i) {\r
-                    values = adaptator.value(deflector.parameter(i+1));\r
-                    array[j++] = (float) values[0];\r
-                    array[j++] = (float) values[1];\r
-                    array[j++] = (float) values[2];\r
-                    array[j++] = (float) values[0];\r
-                    array[j++] = (float) values[1];\r
-                    array[j++] = (float) values[2];\r
-                }\r
-                // Add last point\r
-                values = adaptator.value(range[1]);\r
-                array[j++] = (float) values[0];\r
-                array[j++] = (float) values[1];\r
-                array[j++] = (float) values[2];\r
-                edges.add(array);\r
-                adaptator.delete();\r
-                deflector.delete();\r
-            }\r
-            else\r
-            {\r
-                if (!BRep_Tool.degenerated(e))\r
-                {\r
-                    // So, there is no curve, and the edge is not degenerated?\r
-                    // => draw lines between the vertices and ignore curvature  \r
-                    // best approximation we can do\r
-                    ArrayList<double[]> aa = new ArrayList<double[]>(); // store points here\r
-                    for (TopExp_Explorer explorer2 = new TopExp_Explorer(s, TopAbs_ShapeEnum.VERTEX);\r
-                        explorer2.more(); explorer2.next())\r
-                    {\r
-                        TopoDS_Shape sv = explorer2.current();\r
-                        if (!(sv instanceof TopoDS_Vertex)) continue; // should not happen!\r
-                        TopoDS_Vertex v = (TopoDS_Vertex)sv;\r
-                        aa.add(BRep_Tool.pnt(v));\r
-                    }\r
-                    int size = 0;\r
-                    if (aa.size() > 2)\r
-                        size = (aa.size()-2)*2;\r
-                    size+=2;\r
-                    double[] f=(double[])aa.get(0);\r
-                    array = new float[size*3];\r
-                    array[0]=(float) f[0];\r
-                    array[1]=(float) f[1];\r
-                    array[2]=(float) f[2];\r
-                    for(int i=1, j=3; i<aa.size()-1; i++)\r
-                    {\r
-                        f=aa.get(i);\r
-                        array[j++]=(float) f[0];\r
-                        array[j++]=(float) f[1];\r
-                        array[j++]=(float) f[2];\r
-                        array[j++]=(float) f[0];\r
-                        array[j++]=(float) f[1];\r
-                        array[j++]=(float) f[2];\r
-                    }\r
-                    f=aa.get(aa.size()-1);\r
-                    array[array.length-3]=(float) f[0];\r
-                    array[array.length-2]=(float) f[1];\r
-                    array[array.length-1]=(float) f[2];\r
-                    edges.add(array);\r
-                }\r
-            }\r
-        }       \r
-    }\r
-    \r
-    private float[] calcNormals(float[] fnodes, int[] trias) {\r
-        float nnodes[] = new float[fnodes.length];\r
-        for (int i = 0; i < nnodes.length; i++) nnodes[i] = 0.f;\r
-        Vector3f v1 = new Vector3f();\r
-        Vector3f v2 = new Vector3f();\r
-        Vector3f v3 = new Vector3f();\r
-        Vector3f t1 = new Vector3f();\r
-        Vector3f t2 = new Vector3f();\r
-        Vector3f n = new Vector3f();\r
-        for (int i = 0; i < trias.length; i+=3) {\r
-            v1.x = fnodes[trias[i]*3];\r
-            v1.y = fnodes[trias[i]*3+1];\r
-            v1.z = fnodes[trias[i]*3+2];\r
-            v2.x = fnodes[trias[i+1]*3];\r
-            v2.y = fnodes[trias[i+1]*3+1];\r
-            v2.z = fnodes[trias[i+1]*3+2];\r
-            v3.x = fnodes[trias[i+2]*3];\r
-            v3.y = fnodes[trias[i+2]*3+1];\r
-            v3.z = fnodes[trias[i+2]*3+2];\r
-            t1.sub(v3, v1);\r
-            t2.sub(v2, v1);\r
-            n.cross(t2, t1);\r
-            //n.normalize();\r
-            nnodes[trias[i]*3] += n.x;\r
-            nnodes[trias[i]*3+1] += n.y;\r
-            nnodes[trias[i]*3+2] += n.z;\r
-            nnodes[trias[i+1]*3] += n.x;\r
-            nnodes[trias[i+1]*3+1] += n.y;\r
-            nnodes[trias[i+1]*3+2] += n.z;\r
-            nnodes[trias[i+2]*3] += n.x;\r
-            nnodes[trias[i+2]*3+1] += n.y;\r
-            nnodes[trias[i+2]*3+2] += n.z;\r
-        }\r
-        for (int i = 0; i < nnodes.length; i+=3) {\r
-            n.x = nnodes[i];\r
-            n.y = nnodes[i+1];\r
-            n.z = nnodes[i+2];\r
-            n.normalize();\r
-            nnodes[i] = n.x;\r
-            nnodes[i+1] = n.y;\r
-            nnodes[i+2] = n.z;\r
-        }\r
-        return nnodes;\r
-    }\r
-    \r
-    private void flipFace(int[] trias) {\r
-        int newTrias[] = new int[trias.length];\r
-        System.arraycopy(trias, 0, newTrias, 0, trias.length);\r
-        for (int i = 0; i < trias.length; i++) {\r
-            trias[i] = newTrias[trias.length - i - 1];\r
-        }\r
-    }  \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/.classpath b/dev/org.simantics.proconf.g3d.shapeeditor/.classpath
deleted file mode 100644 (file)
index 0215967..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
-       <classpathentry kind="output" path="bin"/>\r
-</classpath>\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/.project b/dev/org.simantics.proconf.g3d.shapeeditor/.project
deleted file mode 100644 (file)
index 875413f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>org.simantics.proconf.g3d.shapeeditor</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.ManifestBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.SchemaBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.pde.PluginNature</nature>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/META-INF/MANIFEST.MF b/dev/org.simantics.proconf.g3d.shapeeditor/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index 332d852..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Shapeeditor Plug-in
-Bundle-SymbolicName: org.simantics.proconf.g3d.shapeeditor;singleton:=true
-Bundle-Version: 1.0.0
-Bundle-Activator: org.simantics.proconf.g3d.shapeeditor.Activator
-Bundle-Vendor: VTT
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.ui.views.properties.tabbed,
- com.jme.eclipse,
- javax.vecmath,
- org.jcae.opencascade.jni,
- org.simantics.proconf.g3d,
- org.simantics.image.stubs,
- org.simantics.layer0.stubs,
- org.simantics.layer0.utils,
- org.simantics.g2d.stubs,
- org.simantics.utils,
- org.simantics.proconf.g3d.occ,
- org.simantics.proconf.ui,
- org.simantics.animation,
- org.simantics.proconf.ode,
- org.simantics.utils.ui,
- org.simantics.equation,
- org.simantics.db,
- org.simantics.utils.ui.workbench,
- org.simantics.proconf.browsing,
- org.simantics.db.services,
- org.simantics.proconf.g3d.csg
-Eclipse-LazyStart: true
-Export-Package: org.simantics.proconf.g3d.shapeeditor.views
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/build.properties b/dev/org.simantics.proconf.g3d.shapeeditor/build.properties
deleted file mode 100644 (file)
index 6f20375..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/\r
-output.. = bin/\r
-bin.includes = META-INF/,\\r
-               .,\\r
-               plugin.xml\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/difference.png b/dev/org.simantics.proconf.g3d.shapeeditor/icons/difference.png
deleted file mode 100644 (file)
index d7b2747..0000000
Binary files a/dev/org.simantics.proconf.g3d.shapeeditor/icons/difference.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/difference.svg b/dev/org.simantics.proconf.g3d.shapeeditor/icons/difference.svg
deleted file mode 100644 (file)
index d358465..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
-<svg\r
-   xmlns:dc="http://purl.org/dc/elements/1.1/"\r
-   xmlns:cc="http://web.resource.org/cc/"\r
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
-   xmlns:svg="http://www.w3.org/2000/svg"\r
-   xmlns="http://www.w3.org/2000/svg"\r
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\r
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
-   width="744.09448819"\r
-   height="1052.3622047"\r
-   id="svg2"\r
-   sodipodi:version="0.32"\r
-   inkscape:version="0.44"\r
-   sodipodi:docbase="D:\työt"\r
-   sodipodi:docname="difference.svg"\r
-   inkscape:export-filename="D:\työt\difference.png"\r
-   inkscape:export-xdpi="4.612184"\r
-   inkscape:export-ydpi="4.612184">\r
-  <defs\r
-     id="defs4" />\r
-  <sodipodi:namedview\r
-     id="base"\r
-     pagecolor="#ffffff"\r
-     bordercolor="#666666"\r
-     borderopacity="1.0"\r
-     gridtolerance="10000"\r
-     guidetolerance="10"\r
-     objecttolerance="10"\r
-     inkscape:pageopacity="0.0"\r
-     inkscape:pageshadow="2"\r
-     inkscape:zoom="2.5664702"\r
-     inkscape:cx="171.53487"\r
-     inkscape:cy="890.09888"\r
-     inkscape:document-units="px"\r
-     inkscape:current-layer="layer1"\r
-     showgrid="true"\r
-     inkscape:window-width="1280"\r
-     inkscape:window-height="968"\r
-     inkscape:window-x="-4"\r
-     inkscape:window-y="-4" />\r
-  <metadata\r
-     id="metadata7">\r
-    <rdf:RDF>\r
-      <cc:Work\r
-         rdf:about="">\r
-        <dc:format>image/svg+xml</dc:format>\r
-        <dc:type\r
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
-      </cc:Work>\r
-    </rdf:RDF>\r
-  </metadata>\r
-  <g\r
-     inkscape:label="Layer 1"\r
-     inkscape:groupmode="layer"\r
-     id="layer1">\r
-    <rect\r
-       style="fill:none;fill-opacity:1;stroke:navy;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="rect1876"\r
-       width="303.06973"\r
-       height="299.80225"\r
-       x="20"\r
-       y="12.362183" />\r
-    <path\r
-       style="fill:lime;fill-opacity:1;stroke:none;stroke-width:27.12068065;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:27.12068065,54.2413613;stroke-dashoffset:0;stroke-opacity:1"\r
-       d="M 130.1875 26 C 73.425961 26 27.343749 73.576037 27.34375 132.21875 C 27.34375 187.17447 67.823401 232.43322 119.625 237.90625 L 119.625 110.625 L 230.875 110.625 C 221.21132 62.322879 179.78947 26 130.1875 26 z "\r
-       id="path14325" />\r
-    <path\r
-       sodipodi:type="arc"\r
-       style="fill:none;fill-opacity:1;stroke:blue;stroke-width:27.12068065;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:27.12068065,54.2413613;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="path9884"\r
-       sodipodi:cx="113.82415"\r
-       sodipodi:cy="116.55048"\r
-       sodipodi:rx="86.560883"\r
-       sodipodi:ry="90.650368"\r
-       d="M 200.38503 116.55048 A 86.560883 90.650368 0 1 1  27.263268,116.55048 A 86.560883 90.650368 0 1 1  200.38503 116.55048 z"\r
-       transform="matrix(1.187937,0,0,1.17194,-5.033825,-4.36331)" />\r
-    <rect\r
-       style="fill:none;fill-opacity:1;stroke:red;stroke-width:32;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:32,64;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="rect1880"\r
-       width="181.57614"\r
-       height="182.39815"\r
-       x="119.61777"\r
-       y="110.61679" />\r
-  </g>\r
-</svg>\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/intersection.png b/dev/org.simantics.proconf.g3d.shapeeditor/icons/intersection.png
deleted file mode 100644 (file)
index 95915d3..0000000
Binary files a/dev/org.simantics.proconf.g3d.shapeeditor/icons/intersection.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/intersection.svg b/dev/org.simantics.proconf.g3d.shapeeditor/icons/intersection.svg
deleted file mode 100644 (file)
index d12d668..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
-<svg\r
-   xmlns:dc="http://purl.org/dc/elements/1.1/"\r
-   xmlns:cc="http://web.resource.org/cc/"\r
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
-   xmlns:svg="http://www.w3.org/2000/svg"\r
-   xmlns="http://www.w3.org/2000/svg"\r
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\r
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
-   width="744.09448819"\r
-   height="1052.3622047"\r
-   id="svg2"\r
-   sodipodi:version="0.32"\r
-   inkscape:version="0.44"\r
-   sodipodi:docbase="D:\työt"\r
-   sodipodi:docname="intersection.svg"\r
-   inkscape:export-filename="D:\työt\union.png"\r
-   inkscape:export-xdpi="4.7871981"\r
-   inkscape:export-ydpi="4.7871981">\r
-  <defs\r
-     id="defs4" />\r
-  <sodipodi:namedview\r
-     id="base"\r
-     pagecolor="#ffffff"\r
-     bordercolor="#666666"\r
-     borderopacity="1.0"\r
-     gridtolerance="10000"\r
-     guidetolerance="10"\r
-     objecttolerance="10"\r
-     inkscape:pageopacity="0.0"\r
-     inkscape:pageshadow="2"\r
-     inkscape:zoom="2.5664702"\r
-     inkscape:cx="171.53487"\r
-     inkscape:cy="890.09888"\r
-     inkscape:document-units="px"\r
-     inkscape:current-layer="layer1"\r
-     showgrid="true"\r
-     inkscape:window-width="1280"\r
-     inkscape:window-height="968"\r
-     inkscape:window-x="-4"\r
-     inkscape:window-y="-4" />\r
-  <metadata\r
-     id="metadata7">\r
-    <rdf:RDF>\r
-      <cc:Work\r
-         rdf:about="">\r
-        <dc:format>image/svg+xml</dc:format>\r
-        <dc:type\r
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
-      </cc:Work>\r
-    </rdf:RDF>\r
-  </metadata>\r
-  <g\r
-     inkscape:label="Layer 1"\r
-     inkscape:groupmode="layer"\r
-     id="layer1">\r
-    <rect\r
-       style="fill:none;fill-opacity:1;stroke:navy;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="rect1876"\r
-       width="303.06973"\r
-       height="299.80225"\r
-       x="20"\r
-       y="12.362183" />\r
-    <path\r
-       style="fill:lime;fill-opacity:1;stroke:none;stroke-width:32;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:32,64;stroke-dashoffset:0;stroke-opacity:1"\r
-       d="M 119.625 110.625 L 119.625 237.90625 C 123.10038 238.27344 126.61878 238.46875 130.1875 238.46875 C 186.94904 238.46875 233 190.86146 233 132.21875 C 233 124.82191 232.26986 117.59694 230.875 110.625 L 119.625 110.625 z "\r
-       id="rect13432" />\r
-    <path\r
-       sodipodi:type="arc"\r
-       style="fill:none;fill-opacity:1;stroke:blue;stroke-width:27.12068065;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:27.12068065,54.2413613;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="path9884"\r
-       sodipodi:cx="113.82415"\r
-       sodipodi:cy="116.55048"\r
-       sodipodi:rx="86.560883"\r
-       sodipodi:ry="90.650368"\r
-       d="M 200.38503 116.55048 A 86.560883 90.650368 0 1 1  27.263268,116.55048 A 86.560883 90.650368 0 1 1  200.38503 116.55048 z"\r
-       transform="matrix(1.187937,0,0,1.17194,-5.033825,-4.36331)" />\r
-    <rect\r
-       style="fill:none;fill-opacity:1;stroke:red;stroke-width:32;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:32,64;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="rect1880"\r
-       width="181.57614"\r
-       height="182.39815"\r
-       x="119.61777"\r
-       y="110.61679" />\r
-  </g>\r
-</svg>\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/link.png b/dev/org.simantics.proconf.g3d.shapeeditor/icons/link.png
deleted file mode 100644 (file)
index b8ac73c..0000000
Binary files a/dev/org.simantics.proconf.g3d.shapeeditor/icons/link.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/link.svg b/dev/org.simantics.proconf.g3d.shapeeditor/icons/link.svg
deleted file mode 100644 (file)
index 2ad1a0a..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   sodipodi:docname="link.svg"
-   sodipodi:docbase="D:\dev\icons"
-   inkscape:export-filename="D:\dev\icons\link.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient4583">
-      <stop
-         style="stop-color:#0049ff;stop-opacity:1;"
-         offset="0"
-         id="stop4585" />
-      <stop
-         style="stop-color:#00b3b3;stop-opacity:1;"
-         offset="1"
-         id="stop4587" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3686">
-      <stop
-         style="stop-color:red;stop-opacity:0;"
-         offset="0"
-         id="stop3688" />
-      <stop
-         style="stop-color:red;stop-opacity:1;"
-         offset="1"
-         id="stop3690" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3133">
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="0"
-         id="stop3135" />
-      <stop
-         id="stop3141"
-         offset="0.5"
-         style="stop-color:#cbcbcb;stop-opacity:1;" />
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="1"
-         id="stop3137" />
-    </linearGradient>
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.72"
-     inkscape:cx="50"
-     inkscape:cy="55.181347"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       sodipodi:type="arc"
-       style="fill:none;fill-opacity:1;stroke:#fd2306;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="path3660"
-       sodipodi:cx="45.142487"
-       sodipodi:cy="45.272022"
-       sodipodi:rx="7.7072539"
-       sodipodi:ry="7.9663215"
-       d="M 52.849741 45.272022 A 7.7072539 7.9663215 0 1 1  37.435233,45.272022 A 7.7072539 7.9663215 0 1 1  52.849741 45.272022 z"
-       transform="translate(-3.238342,-1.813472)" />
-    <path
-       sodipodi:type="arc"
-       style="fill:none;fill-opacity:1;stroke:#fd2306;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="path4547"
-       sodipodi:cx="45.142487"
-       sodipodi:cy="45.272022"
-       sodipodi:rx="7.7072539"
-       sodipodi:ry="7.9663215"
-       d="M 52.849741 45.272022 A 7.7072539 7.9663215 0 1 1  37.435233,45.272022 A 7.7072539 7.9663215 0 1 1  52.849741 45.272022 z"
-       transform="translate(4.468912,7.189118)" />
-    <path
-       sodipodi:type="arc"
-       style="fill:none;fill-opacity:1;stroke:#fd2306;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="path4549"
-       sodipodi:cx="45.142487"
-       sodipodi:cy="45.272022"
-       sodipodi:rx="7.7072539"
-       sodipodi:ry="7.9663215"
-       d="M 52.849741 45.272022 A 7.7072539 7.9663215 0 1 1  37.435233,45.272022 A 7.7072539 7.9663215 0 1 1  52.849741 45.272022 z"
-       transform="translate(12.37046,15.60881)" />
-    <rect
-       style="fill:#009bff;fill-opacity:1;stroke:#009aff;stroke-width:1.72972977;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1886"
-       width="30.270269"
-       height="30.270269"
-       x="9.8648653"
-       y="9.8648653" />
-    <path
-       sodipodi:type="arc"
-       style="fill:#2fc82f;fill-opacity:1;stroke:#2fc82f;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="path1884"
-       sodipodi:cx="72.5"
-       sodipodi:cy="72.5"
-       sodipodi:rx="17.5"
-       sodipodi:ry="17.5"
-       d="M 90 72.5 A 17.5 17.5 0 1 1  55,72.5 A 17.5 17.5 0 1 1  90 72.5 z" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/union.png b/dev/org.simantics.proconf.g3d.shapeeditor/icons/union.png
deleted file mode 100644 (file)
index 7ffeedb..0000000
Binary files a/dev/org.simantics.proconf.g3d.shapeeditor/icons/union.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/union.svg b/dev/org.simantics.proconf.g3d.shapeeditor/icons/union.svg
deleted file mode 100644 (file)
index 9f64f67..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
-<svg\r
-   xmlns:dc="http://purl.org/dc/elements/1.1/"\r
-   xmlns:cc="http://web.resource.org/cc/"\r
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
-   xmlns:svg="http://www.w3.org/2000/svg"\r
-   xmlns="http://www.w3.org/2000/svg"\r
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\r
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
-   width="744.09448819"\r
-   height="1052.3622047"\r
-   id="svg2"\r
-   sodipodi:version="0.32"\r
-   inkscape:version="0.44"\r
-   sodipodi:docbase="D:\työt"\r
-   sodipodi:docname="union.svg"\r
-   inkscape:export-filename="D:\työt\union.png"\r
-   inkscape:export-xdpi="4.612184"\r
-   inkscape:export-ydpi="4.612184">\r
-  <defs\r
-     id="defs4" />\r
-  <sodipodi:namedview\r
-     id="base"\r
-     pagecolor="#ffffff"\r
-     bordercolor="#666666"\r
-     borderopacity="1.0"\r
-     gridtolerance="10000"\r
-     guidetolerance="10"\r
-     objecttolerance="10"\r
-     inkscape:pageopacity="0.0"\r
-     inkscape:pageshadow="2"\r
-     inkscape:zoom="2.5664702"\r
-     inkscape:cx="171.53487"\r
-     inkscape:cy="890.09888"\r
-     inkscape:document-units="px"\r
-     inkscape:current-layer="layer1"\r
-     showgrid="true"\r
-     inkscape:window-width="1280"\r
-     inkscape:window-height="968"\r
-     inkscape:window-x="-4"\r
-     inkscape:window-y="-4" />\r
-  <metadata\r
-     id="metadata7">\r
-    <rdf:RDF>\r
-      <cc:Work\r
-         rdf:about="">\r
-        <dc:format>image/svg+xml</dc:format>\r
-        <dc:type\r
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
-      </cc:Work>\r
-    </rdf:RDF>\r
-  </metadata>\r
-  <g\r
-     inkscape:label="Layer 1"\r
-     inkscape:groupmode="layer"\r
-     id="layer1">\r
-    <rect\r
-       style="fill:none;fill-opacity:1;stroke:navy;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="rect1876"\r
-       width="303.06973"\r
-       height="299.80225"\r
-       x="20"\r
-       y="12.362183" />\r
-    <path\r
-       style="fill:lime;fill-opacity:1;stroke:blue;stroke-width:3.39008508;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"\r
-       d="M 130.1875 26 C 73.425961 26 27.343749 73.576037 27.34375 132.21875 C 27.34375 187.17447 67.823401 232.43322 119.625 237.90625 L 119.625 293 L 301.1875 293 L 301.1875 110.625 L 230.875 110.625 C 221.21132 62.322879 179.78947 26 130.1875 26 z "\r
-       id="path1878" />\r
-    <path\r
-       sodipodi:type="arc"\r
-       style="fill:none;fill-opacity:1;stroke:blue;stroke-width:27.12068065;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:27.12068065,54.2413613;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="path9884"\r
-       sodipodi:cx="113.82415"\r
-       sodipodi:cy="116.55048"\r
-       sodipodi:rx="86.560883"\r
-       sodipodi:ry="90.650368"\r
-       d="M 200.38503 116.55048 A 86.560883 90.650368 0 1 1  27.263268,116.55048 A 86.560883 90.650368 0 1 1  200.38503 116.55048 z"\r
-       transform="matrix(1.187937,0,0,1.17194,-5.033825,-4.36331)" />\r
-    <rect\r
-       style="fill:none;fill-opacity:1;stroke:red;stroke-width:32;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:32,64;stroke-dashoffset:0;stroke-opacity:1"\r
-       id="rect1880"\r
-       width="181.57614"\r
-       height="182.39815"\r
-       x="119.61777"\r
-       y="110.61679" />\r
-  </g>\r
-</svg>\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/unlink.png b/dev/org.simantics.proconf.g3d.shapeeditor/icons/unlink.png
deleted file mode 100644 (file)
index 5db0efc..0000000
Binary files a/dev/org.simantics.proconf.g3d.shapeeditor/icons/unlink.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/icons/unlink.svg b/dev/org.simantics.proconf.g3d.shapeeditor/icons/unlink.svg
deleted file mode 100644 (file)
index ca82a54..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   sodipodi:docname="unlink.svg"
-   sodipodi:docbase="D:\dev\icons"
-   inkscape:export-filename="D:\dev\icons\unlink.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient4583">
-      <stop
-         style="stop-color:#0049ff;stop-opacity:1;"
-         offset="0"
-         id="stop4585" />
-      <stop
-         style="stop-color:#00b3b3;stop-opacity:1;"
-         offset="1"
-         id="stop4587" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3686">
-      <stop
-         style="stop-color:red;stop-opacity:0;"
-         offset="0"
-         id="stop3688" />
-      <stop
-         style="stop-color:red;stop-opacity:1;"
-         offset="1"
-         id="stop3690" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3133">
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="0"
-         id="stop3135" />
-      <stop
-         id="stop3141"
-         offset="0.5"
-         style="stop-color:#cbcbcb;stop-opacity:1;" />
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="1"
-         id="stop3137" />
-    </linearGradient>
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.72"
-     inkscape:cx="50"
-     inkscape:cy="55.181347"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       sodipodi:type="arc"
-       style="fill:none;fill-opacity:1;stroke:#fd2306;stroke-width:4.10961773;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:4.10961773,4.10961773;stroke-dashoffset:4.10961773;stroke-opacity:1"
-       id="path4549"
-       sodipodi:cx="45.142487"
-       sodipodi:cy="45.272022"
-       sodipodi:rx="7.7072539"
-       sodipodi:ry="7.9663215"
-       d="M 52.849741 45.272022 A 7.7072539 7.9663215 0 1 1  37.435233,45.272022 A 7.7072539 7.9663215 0 1 1  52.849741 45.272022 z"
-       transform="matrix(2.507716,0,0,2.361124,-67.73823,-58.31771)" />
-    <rect
-       style="fill:#0052ff;fill-opacity:1;stroke:#0052ff;stroke-width:1.93978441;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1886"
-       width="33.946224"
-       height="33.946224"
-       x="9.9698925"
-       y="9.9698925" />
-    <path
-       sodipodi:type="arc"
-       style="fill:#2faa2f;fill-opacity:1;stroke:#2fab2f;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="path1884"
-       sodipodi:cx="72.5"
-       sodipodi:cy="72.5"
-       sodipodi:rx="17.5"
-       sodipodi:ry="17.5"
-       d="M 90 72.5 A 17.5 17.5 0 1 1  55,72.5 A 17.5 17.5 0 1 1  90 72.5 z"
-       transform="matrix(1.133035,0,0,1.133035,-12.10615,-12.10615)" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/plugin.xml b/dev/org.simantics.proconf.g3d.shapeeditor/plugin.xml
deleted file mode 100644 (file)
index e54575c..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<?eclipse version="3.2"?>\r
-<plugin>\r
-   <extension\r
-         point="org.eclipse.ui.commands">\r
-      <command\r
-            categoryId="org.simantics.proconf.shapeeditor.commands"\r
-            description="New CSG-Model"\r
-            id="org.simantics.proconf.shapeeditor.commands.newCSG"\r
-            name="New CSG-Model">\r
-      </command>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.handlers">\r
-      <handler\r
-            class="org.simantics.proconf.g3d.shapeeditor.handlers.NewCSGModelHandler"\r
-            commandId="org.simantics.proconf.shapeeditor.commands.newCSG">\r
-      </handler>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.menus">\r
-      <menuContribution\r
-            locationURI="popup:#OEPopup?after=additions">\r
-         <command\r
-               commandId="org.simantics.proconf.shapeeditor.commands.newCSG"\r
-               icon="icons/union.png"\r
-               id="org.simantics.proconf.shapeeditor.popups.newCSG"\r
-               label="New CSG-Model"\r
-               style="push">\r
-            <visibleWhen>\r
-               <and>\r
-                  <with\r
-                        variable="activeContexts">\r
-                     <iterate\r
-                           ifEmpty="false"\r
-                           operator="or">\r
-                        <equals\r
-                              value="org.simantics.proconf.shapeeditor.csg">\r
-                        </equals>\r
-                     </iterate>\r
-                  </with>\r
-                  <with\r
-                        variable="selection">\r
-                     <and>\r
-                        <test\r
-                              args="http://www.vtt.fi/Simantics/Layer0/1.0/Types#Library"\r
-                              property="org.simantics.graph.resourceType">\r
-                        </test>\r
-                     </and>\r
-                  </with>\r
-               </and>\r
-            </visibleWhen>\r
-         </command>\r
-      </menuContribution>\r
-   </extension>\r
-   <extension\r
-         point="org.simantics.proconf.ui.resourceEditorAdapter">\r
-      <adapterClass\r
-            class="org.simantics.proconf.g3d.shapeeditor.handlers.ResourceEditorAdapter1"\r
-            id="org.simantics.proconf.shapeeditor.ResourceEditorDescription1">\r
-      </adapterClass>\r
-      <adapterClass\r
-            class="org.simantics.proconf.g3d.shapeeditor.handlers.ResourceEditorAdapter3"\r
-            id="org.simantics.proconf.shapeeditor.ResourceEditorDescription3">\r
-      </adapterClass>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.editors">\r
-      <editor\r
-            class="org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorView"\r
-            icon="icons/union.png"\r
-            id="org.simantics.proconf.shapeeditor.editor1"\r
-            name="ShapeEditor">\r
-      </editor>\r
-      <editor\r
-            class="org.simantics.proconf.g3d.shapeeditor.views.ParameterizationEditor"\r
-            icon="icons/unlink.png"\r
-            id="org.simantics.proconf.shapeeditor.editor3"\r
-            name="ParameterizationEditor">\r
-      </editor>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.views">\r
-      <view\r
-            class="org.simantics.proconf.g3d.shapeeditor.views.StructureView"\r
-            icon="icons/union.png"\r
-            id="org.simantics.shapeeditor.views.structure"\r
-            name="Structure View">\r
-      </view>\r
-      <view\r
-            class="org.simantics.proconf.g3d.shapeeditor.views.CSGModellingView"\r
-            icon="icons/union.png"\r
-            id="org.simantics.proconf.shapeeditor.views.modelling"\r
-            name="CSG Modelling View">\r
-      </view>\r
-   </extension>\r
-   <extension\r
-         point="org.simantics.db.resourceAdapter">\r
-      <resource_adapter\r
-            adapter_class="org.simantics.proconf.g3d.shapeeditor.handlers.CSGProjectAdapter"\r
-            operation="http://www.vtt.fi/Simantics/Layer0/1.0/Relations#HasProjectTypeAdapter"\r
-            type_uri="http://www.vtt.fi/Simantics/CSG/1.0/Types#CSGProjectType">\r
-      </resource_adapter>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.perspectives">\r
-      <perspective\r
-            class="org.simantics.proconf.g3d.shapeeditor.perspectives.CSGModellingPerspective"\r
-            icon="icons/union.png"\r
-            id="org.simantics.proconf.shapeeditor.perspectives.csg"\r
-            name="CSG Modelling">\r
-      </perspective>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.perspectiveExtensions">\r
-      <perspectiveExtension\r
-            targetID="org.simantics.proconf.shapeeditor.perspectives.csg">\r
-         <view\r
-               id="org.simantics.proconf.shapeeditor.views.modelling"\r
-               ratio="0.3"\r
-               relationship="left"\r
-               relative="org.eclipse.ui.editorss"\r
-               visible="true">\r
-         </view>\r
-         <view\r
-               id="org.simantics.proconf.browsing.views.property"\r
-               ratio="0.7"\r
-               relationship="bottom"\r
-               relative="org.simantics.proconf.shapeeditor.views.modelling"\r
-               visible="true">\r
-         </view>\r
-         <view\r
-               id="org.eclipse.pde.runtime.LogView"\r
-               relationship="fast"\r
-               relative="fi.vtt.proconf.ui.views.property"\r
-               visible="false">\r
-         </view>\r
-         <view\r
-               id="org.simantics.shapeeditor.views.structure"\r
-               relationship="stack"\r
-               relative="org.simantics.proconf.shapeeditor.views.modelling">\r
-         </view>\r
-         <view\r
-               id="org.simantics.g3d.views.scenegraph"\r
-               ratio="0.3"\r
-               relationship="right"\r
-               relative="org.eclipse.ui.editorss"\r
-               visible="true">\r
-         </view>\r
-      </perspectiveExtension>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.contexts">\r
-      <context\r
-            id="org.simantics.proconf.shapeeditor.csg"\r
-            name="name">\r
-      </context>\r
-   </extension>\r
-   <extension\r
-         point="org.simantics.proconf.ui.perspectiveContextBinding">\r
-      <binding\r
-            contextIds="org.simantics.proconf.shapeeditor.csg"\r
-            perspectiveId="org.simantics.proconf.shapeeditor.perspectives.csg">\r
-      </binding>\r
-   </extension>\r
-\r
-</plugin>\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/Activator.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/Activator.java
deleted file mode 100644 (file)
index e256c29..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor;\r
-\r
-import org.eclipse.ui.plugin.AbstractUIPlugin;\r
-import org.osgi.framework.BundleContext;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.db.management.ISessionContextChangedListener;\r
-import org.simantics.db.management.SessionContextChangedEvent;\r
-import org.simantics.proconf.ui.ProConfUI;\r
-\r
-/**\r
- * The activator class controls the plug-in life cycle\r
- */\r
-public class Activator extends AbstractUIPlugin {\r
-\r
-       // The plug-in ID\r
-       public static final String PLUGIN_ID = "org.simantics.proconf.g3d.shapeeditor";\r
-\r
-       // The shared instance\r
-       private static Activator plugin;\r
-       \r
-       /**\r
-        * The constructor\r
-        */\r
-       public Activator() {\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)\r
-        */\r
-       public void start(BundleContext context) throws Exception {\r
-               super.start(context);\r
-               plugin = this;\r
-               ProConfUI.getSessionContextProvider().addContextChangedListener(new ISessionContextChangedListener() {\r
-                       @Override\r
-                       public void sessionContextChanged(SessionContextChangedEvent event) {\r
-                               ISessionContext ctx = event.getNewValue();\r
-                               if (ctx != null) {\r
-                                       ctx.getSession().asyncRead(new GraphRequestAdapter() {\r
-                                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                                       ShapeEditorResources.initialize(g);\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               };\r
-                                       });\r
-                               } else {\r
-                                       ShapeEditorResources.deinitialize();\r
-                               }\r
-                       }\r
-               });\r
-               try {\r
-                       ProConfUI.getSession().asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       ShapeEditorResources.initialize(g);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-               } catch (Exception e) {\r
-                       \r
-               }\r
-               \r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)\r
-        */\r
-       public void stop(BundleContext context) throws Exception {\r
-               plugin = null;\r
-               super.stop(context);\r
-       }\r
-\r
-       /**\r
-        * Returns the shared instance\r
-        *\r
-        * @return the shared instance\r
-        */\r
-       public static Activator getDefault() {\r
-               return plugin;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/ShapeEditorResources.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/ShapeEditorResources.java
deleted file mode 100644 (file)
index 1548881..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor;\r
-\r
-import org.simantics.proconf.g3d.csg.stubs.CSGResource;\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.Graph;\r
-import org.simantics.equation.stubs.EquationResource;\r
-import org.simantics.g2d.stubs.anim.AnimationResource;\r
-import org.simantics.animation.curve.CurveBuilder;\r
-import org.simantics.animation.curve.CurveBuilderImpl;\r
-import org.simantics.proconf.g3d.stubs.G3DResource;\r
-\r
-public class ShapeEditorResources {\r
-       public static Builtins builtins;\r
-       public static G3DResource g3dResource;\r
-       public static CSGResource csgResource;\r
-       public static AnimationResource animationResource;\r
-       public static CurveBuilder curveBuilder;\r
-       public static EquationResource equationResource;\r
-       \r
-       public static void initialize(Graph g) {\r
-               builtins = g.getBuiltins();\r
-               animationResource = AnimationResource.getInstance(g);\r
-               csgResource = CSGResource.getInstance(g);\r
-               g3dResource = G3DResource.getInstance(g);\r
-               curveBuilder = new CurveBuilderImpl(ShapeEditorResources.animationResource);\r
-               equationResource = EquationResource.getInstance(g);\r
-       }\r
-       \r
-       public static void deinitialize() {\r
-               builtins = null;\r
-               g3dResource = null;\r
-               csgResource = null;\r
-               animationResource = null;\r
-               curveBuilder = null;\r
-               equationResource = null;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/ExportAction.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/ExportAction.java
deleted file mode 100644 (file)
index eca9989..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.simantics.proconf.g3d.shapeeditor.actions;\r
-\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.util.Collection;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.FileDialog;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Statement;\r
-import org.simantics.layer0.utils.direct.GraphUtils;\r
-import org.simantics.layer0.utils.extent.Extent;\r
-import org.simantics.layer0.utils.extent.ExtentUtils;\r
-import org.simantics.layer0.utils.extent.IExtentAdvisor;\r
-import org.simantics.layer0.utils.serialization.ConnectionPointMap;\r
-import org.simantics.layer0.utils.serialization.TransferableGraph;\r
-import org.simantics.layer0.utils.serialization.TransferableGraphUtils;\r
-import org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorBase;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-\r
-public class ExportAction extends Action{\r
-       private ShapeEditorBase parent;\r
-       \r
-       public ExportAction(ShapeEditorBase parent) {\r
-               this.parent = parent;\r
-               this.setText("Export");\r
-               this.setId("g3d shape export");\r
-       }\r
-       \r
-       @Override\r
-       public void run() {\r
-               try {\r
-                       doExport();\r
-               } catch (IOException e) {\r
-                       ErrorLogger.defaultLogError(e);\r
-               }\r
-       }\r
-       \r
-       private void doExport() throws IOException {\r
-               FileDialog dialog = new FileDialog(parent.getRenderingComposite().getShell(),SWT.SAVE);\r
-               String filename = dialog.open();\r
-               if (filename == null)\r
-                       return;\r
-               \r
-               final File file = new File(filename);\r
-               final FileOutputStream fos = new FileOutputStream(file);\r
-               \r
-               parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               Resource modelResource = parent.getModelResource();\r
-                               System.out.println("Exporting " + modelResource);\r
-                               Collection<Statement> model = ExtentUtils.determineExtent(g, new ExtentAdvisor(), modelResource);\r
-                               \r
-                               for (Statement s : model)                \r
-                                       System.out.println(GraphUtils.getReadableName(g, s.getSubject())+", "+GraphUtils.getReadableName(g, s.getPredicate())+", "+GraphUtils.getReadableName(g, s.getObject()));                \r
-                               \r
-                               ConnectionPointMap purposeProvider = new ConnectionPointMap();\r
-                               purposeProvider.put(modelResource, TransferableGraphUtils.CP_OBJECT);\r
-                               \r
-                               TransferableGraph dbIndependentSubgraph = TransferableGraphUtils.extractTransferableGraph(g, model, purposeProvider, null); \r
-                               \r
-                               byte[] data = TransferableGraphUtils.serialize(dbIndependentSubgraph);\r
-                               \r
-                               fos.write(data);\r
-                               \r
-                               System.out.println("Exporting done.");\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void requestCompleted(GraphRequestStatus status) {\r
-                               try {\r
-                                       fos.close();\r
-                               } catch (IOException e) {\r
-                                       ErrorLogger.defaultLogError(e);\r
-                               }\r
-                               \r
-                       }\r
-               });\r
-       }\r
-       \r
-       public class ExtentAdvisor implements IExtentAdvisor {\r
-               @Override\r
-               public ExtentAdvice getAdvice(Graph g, Extent currentState, Resource extent) {\r
-                       System.out.println("Extent advice : " + currentState + " : " + extent);\r
-                       \r
-                       //if (extent.equals(ShapeEditorResources.equationResource.Expression)) return ExtentAdvice.Include;\r
-                       //return ExtentAdvice.Exclude;\r
-                       return ExtentAdvice.Include;\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/ImportAction.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/ImportAction.java
deleted file mode 100644 (file)
index 7a4d063..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.simantics.proconf.g3d.shapeeditor.actions;\r
-\r
-import java.io.BufferedInputStream;\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.IOException;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.FileDialog;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Statement;\r
-import org.simantics.layer0.utils.serialization.ConnectionPointList;\r
-import org.simantics.layer0.utils.serialization.TransferableGraph;\r
-import org.simantics.layer0.utils.serialization.TransferableGraphUtils;\r
-import org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorBase;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-public class ImportAction extends Action {\r
-       \r
-       private ShapeEditorBase parent;\r
-       \r
-       public ImportAction(ShapeEditorBase parent) {\r
-               this.parent = parent;\r
-               setText("Import");\r
-               setId("g3d shape import");\r
-       }\r
-       \r
-       @Override\r
-       public void run() {\r
-               try {\r
-                       doImport();\r
-               } catch (IOException e) {\r
-                       ErrorLogger.defaultLogError(e);\r
-               }\r
-       }\r
-       \r
-       private void doImport() throws IOException {\r
-               FileDialog dialog = new FileDialog(parent.getRenderingComposite().getShell(),SWT.OPEN);\r
-               String filename = dialog.open();\r
-               if (filename == null)\r
-                       return;\r
-               File file = new File(filename);\r
-               FileInputStream fis = new FileInputStream(file);\r
-               BufferedInputStream bis = new BufferedInputStream(fis);\r
-               byte[] data = new byte[0];\r
-               byte[] buf = new byte[256];\r
-               int res = 0;\r
-               while ((res = bis.read(buf)) != -1) {\r
-                       byte[] newData = new byte[data.length + res];\r
-                       System.arraycopy(data, 0, newData, 0, data.length);\r
-                       System.arraycopy(buf, 0, newData, data.length, res);\r
-                       data = newData;\r
-               }\r
-               bis.close();\r
-               final byte fdata[] = data;\r
-               parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               TransferableGraph sg = TransferableGraphUtils.deserialize(fdata);\r
-                               ConnectionPointList purposes = TransferableGraphUtils.integrateTransferableGraph(g, sg, null);\r
-                               Resource modelResource = purposes.getSingleByDescription(TransferableGraphUtils.CP_OBJECT).resource;\r
-                   Resource currentModelResource = parent.getModelResource();\r
-                   for (Statement s : g.getStatements(modelResource)) {\r
-                       g.removeStatements(currentModelResource, s.getPredicate());\r
-                   }\r
-                               for (Statement s : g.getStatements(modelResource)) {\r
-                                       \r
-                                       g.removeStatement(s);\r
-                                       g.addStatement(currentModelResource, s.getPredicate(), s.getObject());\r
-                               }\r
-                   \r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFileAction.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFileAction.java
deleted file mode 100644 (file)
index 193fe45..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.actions;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.FileDialog;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.occ.geometry.OccTriangulator;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.state.MaterialState;\r
-\r
-\r
-public class LoadFileAction extends Action {\r
-       private ThreeDimensionalEditorBase editor;\r
-       \r
-       public LoadFileAction(ThreeDimensionalEditorBase editor) {\r
-               super("Load file");\r
-               this.editor = editor;\r
-               \r
-       }\r
-       \r
-       public void run() {\r
-        FileDialog loadDialog = new FileDialog(editor.getRenderingComposite().getShell(), SWT.OPEN);\r
-        String exts[] = { "*.stp;*.step", "*.iges", "*.brep", "*.ply" }; //$NON-NLS-1$\r
-        String names[] = { "STEP (AP214/AP203)", "IGES", "BREP", "PLY" }; //$NON-NLS-1$\r
-        loadDialog.setFilterNames(names);\r
-        loadDialog.setFilterExtensions(exts);\r
-        loadDialog.setText("Load model");\r
-\r
-        String filename = loadDialog.open();\r
-        if (filename != null) {\r
-            Geometry g = OccTriangulator.getGeometryFromFile(filename)[0];\r
-            MaterialState ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-            ms.setAmbient(new ColorRGBA(0.f,0.f,0.f,0.f));\r
-            ms.setEmissive(new ColorRGBA(0.f,0.f,0.f,0.f));\r
-            ms.setShininess(128.f);\r
-            ms.setDiffuse(new ColorRGBA(0.8f,0.8f,0.8f,0.f));\r
-            ms.setSpecular(new ColorRGBA(1.f,1.f,1.f,0.f));\r
-            ms.setMaterialFace(MaterialState.MF_FRONT_AND_BACK);\r
-            if (g.getColorBuffer(0) != null) {\r
-               ms.setColorMaterial(MaterialState.CM_DIFFUSE);\r
-            }\r
-            g.setRenderState(ms);\r
-            editor.getRenderingComponent().getShadowRoot().attachChild(g);\r
-            // mo.setGeometry(mesh, filename);\r
-            // xithComposite.getScene().compile();\r
-        }\r
-\r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFolderAction.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFolderAction.java
deleted file mode 100644 (file)
index 2b7d49e..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.actions;\r
-\r
-import java.io.File;\r
-import java.io.FilenameFilter;\r
-import java.util.Stack;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.DirectoryDialog;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.occ.geometry.OccTriangulator;\r
-\r
-import com.jme.bounding.BoundingBox;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.state.MaterialState;\r
-\r
-\r
-public class LoadFolderAction extends Action {\r
-       private ThreeDimensionalEditorBase editor;\r
-       \r
-       public LoadFolderAction(ThreeDimensionalEditorBase editor) {\r
-               super("Load folder");\r
-               this.editor = editor;\r
-               \r
-       }\r
-       \r
-       public void run() {\r
-        \r
-      DirectoryDialog loadDialog = new DirectoryDialog(editor.getRenderingComposite().getShell(), SWT.OPEN);\r
-      loadDialog.setText("Select directory");\r
-\r
-      String directory = loadDialog.open();\r
-      if (directory != null) {\r
-          File file = new File(directory);\r
-          if (!file.isDirectory())\r
-              return;\r
-          Stack<File> directories = new Stack<File>();\r
-          directories.push(file);\r
-          boolean recursive = true;\r
-          while (!directories.empty()) {\r
-              File dir = directories.pop();\r
-\r
-              String[] files = dir.list(new PLYFilter());\r
-              for (String filename : files) {\r
-                  Geometry g = OccTriangulator.getGeometryFromFile(dir.getAbsolutePath() + "/" + filename)[0];\r
-                MaterialState ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-                ms.setAmbient(new ColorRGBA(0.f,0.f,0.f,0.f));\r
-                ms.setEmissive(new ColorRGBA(0.f,0.f,0.f,0.f));\r
-                ms.setShininess(128.f);\r
-                ms.setDiffuse(new ColorRGBA(0.8f,0.8f,0.8f,0.f));\r
-                ms.setSpecular(new ColorRGBA(1.f,1.f,1.f,0.f));\r
-                ms.setMaterialFace(MaterialState.MF_FRONT_AND_BACK);\r
-                if (g.getColorBuffer(0) != null) {\r
-                       ms.setColorMaterial(MaterialState.CM_DIFFUSE);\r
-                }\r
-                g.setModelBound(new BoundingBox());\r
-                g.updateModelBound();\r
-                g.setRenderState(ms);\r
-                editor.getRenderingComponent().getShadowRoot().attachChild(g);\r
-                g.updateWorldBound();\r
-                g.lock();\r
-               \r
-              }\r
-              if (recursive) {\r
-                  File[] newDirs = dir.listFiles(new DirectoryFilter());\r
-                  for (File d : newDirs)\r
-                      directories.push(d);\r
-              }\r
-          }\r
-          \r
-      }\r
-\r
-\r
-    }\r
-       \r
-        protected class DirectoryFilter implements FilenameFilter {\r
-               public boolean accept(File dir, String name) {\r
-                   File file = new File(dir.getAbsolutePath() + "/" + name);\r
-                   return file.isDirectory();\r
-               }\r
-           }\r
-\r
-           protected class PLYFilter implements FilenameFilter {\r
-               public boolean accept(File dir, String name) {\r
-                   return (name.endsWith("ply"));\r
-               }\r
-           }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/common/ViewpointGenerator.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/common/ViewpointGenerator.java
deleted file mode 100644 (file)
index 6873736..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.common;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.Statement;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.viewpoints.AcceptDecision;\r
-import org.simantics.layer0.utils.viewpoints.AcceptRule;\r
-import org.simantics.layer0.utils.viewpoints.PlainStateFactory;\r
-import org.simantics.layer0.utils.viewpoints.ResourceViewpoint;\r
-import org.simantics.layer0.utils.viewpoints.State;\r
-import org.simantics.layer0.utils.viewpoints.StateFactory;\r
-import org.simantics.layer0.utils.viewpoints.TraversalDecision;\r
-import org.simantics.layer0.utils.viewpoints.TraversalRule;\r
-import org.simantics.layer0.utils.viewpoints.rules.AcceptAllResourceAcceptRule;\r
-import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
-\r
-\r
-public class ViewpointGenerator {\r
-       \r
-       public static ResourceViewpoint createStuctureViewpoint() {\r
-               StateFactory f = new PlainStateFactory();\r
-               final State rootState = f.newState();\r
-               final State projectState = f.newState();\r
-               final State libraryState = f.newState();\r
-\r
-               return new ResourceViewpoint(new TraversalRule() {\r
-                       @Override\r
-                       public TraversalDecision makeTraversalDecision(State state,\r
-                                       Statement statement) {\r
-                               Builtins b = statement.getGraph().getBuiltins();\r
-                               if (state.equals(rootState)) {\r
-                                       if (!statement.getPredicate().equals(b.ConsistsOf))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       //if (!statement.getObject().isInstanceOf(b.Project))\r
-                                       //    return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(projectState);\r
-                               } else if (state.equals(projectState)) {\r
-                                       if (!statement.getPredicate().equals(b.ConsistsOf))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       //if (!statement.getObject().isInstanceOf(b.Library))\r
-                                       //    return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(libraryState);\r
-                               } else if (state.equals(libraryState)) {\r
-                                       if (!statement.getPredicate().equals(b.ConsistsOf)\r
-                                                       && !statement.getPredicate().isSubrelationOf(\r
-                                                                       ShapeEditorResources.g3dResource.HasChild))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(libraryState);\r
-                               }\r
-                               return TraversalDecision.stopTraversal;\r
-                       }\r
-\r
-                       @Override\r
-                       public boolean areAllStatesRelevant() {\r
-                               return true;\r
-                       }\r
-\r
-                       @Override\r
-                       public Collection<State> relevantStates() {\r
-                               return null;\r
-                       }\r
-               }, new AcceptAllResourceAcceptRule(), rootState);\r
-       }\r
-       \r
-       public static ResourceViewpoint createObjectStructureViewpoint() {\r
-               StateFactory f = new PlainStateFactory();\r
-               final State rootState = f.newState();\r
-\r
-               return new ResourceViewpoint(new TraversalRule() {\r
-                       @Override\r
-                       public TraversalDecision makeTraversalDecision(State state,\r
-                                       Statement statement) {\r
-                               if (state.equals(rootState)) {\r
-                                       if (!statement.getPredicate().isSubrelationOf(\r
-                                                       ShapeEditorResources.g3dResource.HasChild))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(rootState);\r
-                               }\r
-                               return TraversalDecision.stopTraversal;\r
-                       }\r
-\r
-                       @Override\r
-                       public boolean areAllStatesRelevant() {\r
-                               return true;\r
-                       }\r
-\r
-                       @Override\r
-                       public Collection<State> relevantStates() {\r
-                               return null;\r
-                       }\r
-               }, new AcceptAllResourceAcceptRule(), rootState);\r
-       }\r
-       \r
-       public static ResourceViewpoint createObjectSizingParameterViewpoint(Resource modelToParameterRelation) {\r
-               StateFactory f = new PlainStateFactory();\r
-               final State rootState = f.newState();\r
-               final State endState = f.newState();\r
-               final Resource relation = modelToParameterRelation;\r
-\r
-               return new ResourceViewpoint(new TraversalRule() {\r
-                       @Override\r
-                       public TraversalDecision makeTraversalDecision(State state,\r
-                                       Statement statement) {\r
-                               if (state.equals(rootState)) {\r
-                                       if (!statement.getPredicate().isSubrelationOf(relation))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(endState);\r
-                               }\r
-                               return TraversalDecision.stopTraversal;\r
-                       }\r
-\r
-                       @Override\r
-                       public boolean areAllStatesRelevant() {\r
-                               return true;\r
-                       }\r
-\r
-                       @Override\r
-                       public Collection<State> relevantStates() {\r
-                               return null;\r
-                       }\r
-               }, new AcceptAllResourceAcceptRule(), rootState);\r
-       }\r
-       \r
-       public static ResourceViewpoint createViewpoint() {\r
-               StateFactory f = new PlainStateFactory();\r
-               final State rootState = f.newState();\r
-               final State projectState = f.newState();\r
-               final State libraryState = f.newState();\r
-               \r
-               return new ResourceViewpoint(new TraversalRule() {\r
-                       @Override\r
-                       public TraversalDecision makeTraversalDecision(State state, Statement statement) {\r
-                               Builtins b = statement.getGraph().getBuiltins();\r
-                               if (state.equals(rootState)) {\r
-                                       if (statement.getObject().isInstanceOf(b.Ontology))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       if(!statement.getPredicate().equals(b.ConsistsOf))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(projectState);\r
-                               } else if (state.equals(projectState)) {\r
-                                       if(!statement.getPredicate().equals(b.ConsistsOf))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(libraryState);\r
-                               } else if (state.equals(libraryState)) {\r
-                                       if(!statement.getPredicate().equals(b.ConsistsOf))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(libraryState);\r
-                               }\r
-                               return TraversalDecision.stopTraversal;\r
-                       }\r
-                       \r
-                       @Override\r
-                       public boolean areAllStatesRelevant() {\r
-                               return true;\r
-                       }\r
-                       \r
-                       @Override\r
-                       public Collection<State> relevantStates() {\r
-                               return null;\r
-                       }\r
-               }, new AcceptRule<IEntity>() {\r
-               @Override\r
-                       public AcceptDecision makeAcceptDecision(State state, IEntity obj) {\r
-                               Builtins b = obj.getGraph().getBuiltins();\r
-                               //NOSEResource nr = NOSEResource.getInstance(obj.getGraph());\r
-                               if(obj.isInstanceOf(b.Project)) return AcceptDecision.REJECT;\r
-                               else if (obj.isInstanceOf(b.Ontology)) return AcceptDecision.REJECT;\r
-                               else return AcceptDecision.ACCEPT;\r
-                       }\r
-               \r
-                       @Override\r
-                       public boolean areAllStatesRelevant() {\r
-                               return true;\r
-                       }\r
-                       \r
-                       @Override\r
-                       public Collection<State> relevantStates() {\r
-                               return null;\r
-                       }\r
-               }, rootState);\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/dialogs/PropertySelectionDialog.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/dialogs/PropertySelectionDialog.java
deleted file mode 100644 (file)
index 09a5add..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.simantics.proconf.g3d.shapeeditor.dialogs;\r
-\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Tree;\r
-import org.eclipse.swt.widgets.TreeItem;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.proconf.g3d.tools.PropertyTree;\r
-\r
-public class PropertySelectionDialog extends Dialog {\r
-    String title = null;\r
-    String message = null;\r
-    \r
-    Session session;\r
-    PropertyTree propertyTree;\r
-    Resource[] selectedTypes = null;\r
-    List<Resource> selectedPropertyInstances = null;\r
-    List<Resource> selectedInstances = null;\r
-    \r
-    public PropertySelectionDialog(Shell parentShell, String dialogTitle, String dialogMessage, Session session, List<Resource> selectedResources) {\r
-        super(parentShell);\r
-        this.session = session;\r
-        this.title = dialogTitle;\r
-        this.message = dialogMessage;\r
-        this.selectedInstances = selectedResources;\r
-    }\r
-    \r
-    @Override\r
-    protected void configureShell(Shell newShell) {\r
-        \r
-        super.configureShell(newShell);\r
-        if (title != null)\r
-            newShell.setText(title);\r
-    }\r
-    \r
-    protected Control createDialogArea(Composite parent) {\r
-        Composite composite = (Composite) super.createDialogArea(parent);\r
-        \r
-        Label label = new Label(composite, SWT.WRAP);\r
-        label.setText(message);\r
-        GridData data = new GridData(GridData.GRAB_HORIZONTAL\r
-                | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
-                | GridData.VERTICAL_ALIGN_CENTER);\r
-        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        Tree tree = new Tree(composite,SWT.SINGLE);\r
-        propertyTree = new PropertyTree(tree,session);\r
-\r
-        GridData data2 = new GridData(GridData.GRAB_HORIZONTAL\r
-                | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
-                | GridData.VERTICAL_ALIGN_FILL);\r
-        data2.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-        data2.heightHint = 200;\r
-        tree.setLayoutData(data2);\r
-        tree.setFont(parent.getFont());\r
-        \r
-        tree.showSelection();\r
-        \r
-        applyDialogFont(composite);\r
-        \r
-        //propertyTree.setProperties(selectionAdapter.getCurrentSelection());\r
-        propertyTree.setProperties(selectedInstances);\r
-        return composite;\r
-    }\r
-    \r
-    @Override\r
-    public boolean close() {\r
-        TreeItem selected[] = propertyTree.getTree().getSelection();\r
-        if (selected.length == 0) {\r
-            selectedTypes = null;\r
-        } else {\r
-            selectedTypes = new Resource[selected.length];\r
-            for (int i = 0; i < selected.length; i++) {\r
-                selectedTypes[i] = (Resource)selected[i].getData();\r
-            }\r
-        }\r
-        //final ArrayList<Resource> instances = new ArrayList<Resource>();\r
-//        for (Resource rs : selectionAdapter.getCurrentSelection().getSelectionList()) {\r
-//            instances.add(rs);\r
-//        }\r
-\r
-        \r
-        session.syncRead(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       selectedPropertyInstances = propertyTree.findPropertyInstances(g,selectedInstances);\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-        });\r
-\r
-        return super.close();\r
-    }\r
-    \r
-    public List<Resource> getSelectedPropertyInstances() {\r
-        return selectedPropertyInstances;\r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectAdapter.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectAdapter.java
deleted file mode 100644 (file)
index 5c0835d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.handlers;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.adaption.AdaptionException;\r
-import org.simantics.db.adaption.ResourceAdapter;\r
-\r
-\r
-public class CSGProjectAdapter implements ResourceAdapter {\r
-       @SuppressWarnings("unchecked")\r
-       @Override\r
-       public <T> T adapt(Graph graph, Resource resource, Resource mia) throws AdaptionException {\r
-               return (T) new CSGProjectType(graph, resource);\r
-\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectType.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectType.java
deleted file mode 100644 (file)
index a220f78..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.handlers;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.direct.GraphUtils;\r
-import org.simantics.proconf.ui.projects.IProject;\r
-import org.simantics.proconf.ui.projects.ProjectType;\r
-\r
-public class CSGProjectType extends ProjectType {\r
-\r
-       public CSGProjectType(Graph graph, Resource projectTypeResource) {\r
-               super(graph, projectTypeResource);\r
-       }\r
-\r
-       @Override\r
-       public Resource createProject(Graph g, String name) throws Exception {\r
-               Resource project = super.createProject(g, name);\r
-               Builtins b = g.getBuiltins();\r
-               \r
-               {   // Models\r
-         Resource modelLibrary = g.newResource();                \r
-         g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);\r
-         GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Models");\r
-         g.addStatement(project, b.ConsistsOf, modelLibrary);        \r
-               }\r
-       \r
-               \r
-               \r
-               return project;\r
-       }\r
-       \r
-       @Override\r
-       public IProject loadProject(Graph g, Resource r) {\r
-               IProject project = super.loadProject(g, r);\r
-               project.set(DefaultPerspective, "org.simantics.proconf.shapeeditor.perspectives.csg");\r
-               Collection<String> perspectives = new ArrayList<String>();\r
-               perspectives.add("org.simantics.proconf.shapeeditor.perspectives.csg");\r
-               project.set(Perspectives, perspectives);\r
-               \r
-               return project;\r
-       }\r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/NewCSGModelHandler.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/NewCSGModelHandler.java
deleted file mode 100644 (file)
index be79363..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.handlers;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.proconf.g3d.csg.stubs.CSGModel;\r
-\r
-import org.simantics.proconf.ui.ProConfUI;\r
-import org.simantics.proconf.ui.utils.ResourceAdaptionUtils;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.stubs.Library;\r
-\r
-\r
-public class NewCSGModelHandler extends AbstractHandler {\r
-\r
-       @Override\r
-       public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               ISelection s = HandlerUtil.getCurrentSelectionChecked(event);\r
-        IStructuredSelection ss = (IStructuredSelection) s;\r
-        if (ss.size() != 1)\r
-            return null;\r
-        final Resource lib = ResourceAdaptionUtils.toSingleResource(ss);\r
-               ProConfUI.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               CSGModel model = CSGModel.createDefault(g);\r
-                               Library l = new Library(g, lib);\r
-                               l.addStatement(g.getBuiltins().ConsistsOf, model);\r
-                               \r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-               \r
-               \r
-               return null;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/ResourceEditorAdapter1.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/ResourceEditorAdapter1.java
deleted file mode 100644 (file)
index 41f07ad..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.handlers;\r
-\r
-import org.simantics.proconf.g3d.shapeeditor.Activator;\r
-import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
-import org.simantics.proconf.ui.workbench.ResourceEditorInput;\r
-import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.utils.ui.BundleUtils;\r
-import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
-\r
-\r
-public class ResourceEditorAdapter1 extends SimpleEditorAdapter {\r
-\r
-       public ResourceEditorAdapter1() {\r
-               super("ShapeEditor",\r
-                       BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/union.png"),\r
-                       null,null,null);\r
-       }\r
-\r
-       @Override\r
-       public boolean canHandle(Graph g, Resource r) {\r
-               if(ShapeEditorResources.csgResource == null) return false; \r
-               if(ShapeEditorResources.csgResource.CSGModel == null) return false; \r
-               return g.isInstanceOf(r, ShapeEditorResources.csgResource.CSGModel);\r
-       }\r
-\r
-\r
-       @Override\r
-       public void openEditor(Resource r) throws Exception {\r
-               WorkbenchUtils.openEditor("org.simantics.proconf.shapeeditor.editor1", new ResourceEditorInput("org.simantics.proconf.shapeeditor.editor1",r));\r
-\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/ResourceEditorAdapter3.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/ResourceEditorAdapter3.java
deleted file mode 100644 (file)
index f861179..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.handlers;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.shapeeditor.Activator;\r
-import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
-import org.simantics.proconf.ui.workbench.ResourceEditorInput;\r
-import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;\r
-import org.simantics.utils.ui.BundleUtils;\r
-import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
-\r
-\r
-public class ResourceEditorAdapter3 extends SimpleEditorAdapter {\r
-\r
-       public ResourceEditorAdapter3() {\r
-               super("Parameterization Editor",\r
-                       BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/unlink.png"),\r
-                       null,null,null);\r
-       }\r
-\r
-       @Override\r
-       public boolean canHandle(Graph g, Resource r) {\r
-               if(ShapeEditorResources.csgResource == null) return false; \r
-               if(ShapeEditorResources.csgResource.CSGModel == null) return false; \r
-               return g.isInstanceOf(r, ShapeEditorResources.csgResource.CSGModel);\r
-       }\r
-\r
-\r
-       @Override\r
-       public void openEditor(Resource r) throws Exception {\r
-               WorkbenchUtils.openEditor("org.simantics.proconf.shapeeditor.editor3", new ResourceEditorInput("org.simantics.proconf.shapeeditor.editor3",r));\r
-\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/perspectives/CSGModellingPerspective.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/perspectives/CSGModellingPerspective.java
deleted file mode 100644 (file)
index f6c6a58..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.perspectives;\r
-\r
-import org.eclipse.ui.IPageLayout;\r
-import org.eclipse.ui.IPerspectiveFactory;\r
-\r
-public class CSGModellingPerspective implements IPerspectiveFactory {\r
-\r
-       @Override\r
-       public void createInitialLayout(IPageLayout layout) {\r
-       \r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/scenegraph/CSGShapeNode.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/scenegraph/CSGShapeNode.java
deleted file mode 100644 (file)
index 1bf8fe7..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.scenegraph;\r
-\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.GeometryProviderRegistry;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.ShapeNode;\r
-\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.ZBufferState;\r
-\r
-\r
-\r
-public class CSGShapeNode extends ShapeNode{\r
-\r
-       \r
-    //protected Geometry axesGeometry = null;\r
-    protected boolean axesVisible = false;\r
-\r
-    public CSGShapeNode(ThreeDimensionalEditorBase editor,IGraphicsNode parent, Graph graph, Resource shapeResource) {\r
-        super(editor,parent, graph,shapeResource);\r
-        //axesGeometry = AxesShape.getShape(editor.getRenderingComponent().getDisplaySystem().getRenderer());\r
-        ZBufferState zs = editor.getRenderingComponent().getDisplaySystem().getRenderer().createZBufferState();\r
-        zs.setFunction(ZBufferState.CF_ALWAYS);\r
-        AlphaState as = editor.getRenderingComponent().getDisplaySystem().getRenderer().createAlphaState();\r
-        as.setBlendEnabled(true);\r
-        as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as.setSrcFunction(AlphaState.DB_SRC_ALPHA);\r
-//        axesGeometry.setRenderState(zs);\r
-//        axesGeometry.setRenderState(as);\r
-//        axesGeometry.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-    }\r
-\r
-    \r
-\r
-   public Geometry[] getGeometry(Graph graph) {\r
-          \r
-       return GeometryProviderRegistry.getGeometry(getG3DNode(graph), false);\r
-   }\r
-   \r
-   public void updateAllGeometry() {\r
-          //System.out.println("CSGSHapeNode.updateAllGeometry " + shapeResource.getResourceId());\r
-          editor.getScenegraphAdapter().updateGeometry(shapeResource);\r
-       if (parent != null && parent instanceof CSGShapeNode) {\r
-           ((CSGShapeNode)parent).updateAllGeometry();\r
-       }\r
-       \r
-   }\r
-   \r
-   @Override\r
-       public void updateGeometry(Graph graph) {\r
-               super.updateGeometry(graph);\r
-               if (isAxesVisible()) {\r
-                       //getGroup().attachChild(axesGeometry);\r
-               } else {\r
-                       //axesGeometry.removeFromParent();\r
-               }\r
-       }\r
-\r
-\r
-   \r
-   public boolean isAxesVisible() {\r
-       return axesVisible;\r
-   }\r
-\r
-   public void setAxesVisible(boolean axesVisible) {\r
-       \r
-       if (this.axesVisible == axesVisible)\r
-           return;\r
-       this.axesVisible = axesVisible;\r
-       if (isAxesVisible()) {\r
-               //getGroup().getParent().attachChild(axesGeometry);\r
-          //getGroup().attachChild(axesGeometry);\r
-       } else {\r
-               //axesGeometry.removeFromParent();\r
-       }\r
-   }\r
-   \r
-   public void setSelected(boolean selected) {\r
-       if (this.selected == selected)\r
-           return;\r
-       this.selected = selected;\r
-       if (selected) {\r
-\r
-           setSelectedVisible(true);\r
-           setAxesVisible(true);\r
-           setTransparentVisible(true);\r
-       } else {\r
-           setSelectedVisible(false);\r
-           setAxesVisible(false);\r
-           setTransparentVisible(false);\r
-       }\r
-   }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/AnimationContribution.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/AnimationContribution.java
deleted file mode 100644 (file)
index c3f7f61..0000000
+++ /dev/null
@@ -1,774 +0,0 @@
-package org.simantics.proconf.g3d.shapeeditor.tools;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Quat4d;\r
-\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.InputDialog;\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.jface.viewers.ISelectionChangedListener;\r
-import org.eclipse.jface.viewers.SelectionChangedEvent;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.custom.CCombo;\r
-import org.eclipse.swt.events.FocusAdapter;\r
-import org.eclipse.swt.events.FocusEvent;\r
-import org.eclipse.swt.events.KeyAdapter;\r
-import org.eclipse.swt.events.KeyEvent;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.layout.FormAttachment;\r
-import org.eclipse.swt.layout.FormData;\r
-import org.eclipse.swt.layout.FormLayout;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Slider;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.simantics.db.ContextGraph;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.GraphRequestWithResult;\r
-import org.simantics.db.Resource;\r
-import org.simantics.g2d.stubs.anim.Animation;\r
-import org.simantics.g2d.stubs.anim.Interpolator;\r
-import org.simantics.g2d.stubs.anim.ScalarInterpolator;\r
-import org.simantics.g2d.stubs.anim.SlerpInterpolator;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.Property;\r
-import org.simantics.animation.curve.SlerpCurve;\r
-import org.simantics.animation.curve.TCBCurve;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.actions.RotateAction;\r
-import org.simantics.proconf.g3d.actions.TranslateAction;\r
-import org.simantics.proconf.g3d.animation.Animatable;\r
-import org.simantics.proconf.g3d.base.EditorContribution;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.VisualizationScheduler;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.ISelectableNode;\r
-import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
-import org.simantics.proconf.g3d.shapeeditor.dialogs.PropertySelectionDialog;\r
-import org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorBase;\r
-import org.simantics.proconf.g3d.stubs.G3DModel;\r
-import org.simantics.proconf.g3d.stubs.Orientation;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-public class AnimationContribution implements EditorContribution {\r
-       List<ContextAction> actions = new ArrayList<ContextAction>();\r
-       \r
-       private ShapeEditorBase parent;\r
-       \r
-       private final String NO_ANIMATION = "None";\r
-\r
-       private Slider timeSlider;\r
-       private double key = 0;\r
-       private Composite buttonComposite;\r
-       private Button insertKeyFrameButton;\r
-       private Button clearKeyFrameButton;\r
-       private CCombo animationCombo;\r
-       private Button addAnimationButton;\r
-       private Button removeAnimationButton;\r
-       private Button clearAnimationButton;\r
-       private Button animateButton;\r
-       private Button usePrecalculation;\r
-       private Text timeText;\r
-       private Composite infoComposite;\r
-       private Text infoText;\r
-\r
-       private Resource animationResource;\r
-       \r
-       private ContextAction translateAction;\r
-       private ContextAction rotateAction;\r
-       \r
-       public AnimationContribution(ThreeDimensionalEditorBase parent) {\r
-               this.parent = (ShapeEditorBase)parent;\r
-       }\r
-       \r
-       @Override\r
-       public String getName() {\r
-               return "Animator";\r
-       }\r
-       \r
-       @Override\r
-       public void createControl(Composite parent) {\r
-               FormLayout flayout = new FormLayout();\r
-               parent.setLayout(flayout);\r
-               infoComposite = new Composite(parent, SWT.BORDER);\r
-               FormData data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(100, 0);\r
-               data.bottom = new FormAttachment(infoComposite, 0, SWT.TOP);\r
-               this.parent.getRenderingComposite().setLayoutData(data);\r
-\r
-               infoComposite.setLayout(new FillLayout(SWT.VERTICAL));\r
-               infoText = new Text(infoComposite, SWT.NONE);\r
-               GridLayout layout = new GridLayout(2, false);\r
-               layout.horizontalSpacing = 2;\r
-               layout.verticalSpacing = 2;\r
-               layout.marginWidth = 1;\r
-               layout.marginHeight = 1;\r
-               infoComposite.setLayout(layout);\r
-               GridData gdata = new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 2, 1);\r
-               // FIXME : allows text widget to take all available space (horizontal / width)\r
-               gdata.widthHint = 2000;\r
-               infoText.setLayoutData(gdata);\r
-               timeSlider = new Slider(infoComposite, SWT.NONE);\r
-               timeSlider.setValues(0, 0, 100, 1, 1, 1);\r
-               timeSlider.addSelectionListener(new SelectionAdapter() {\r
-                       @Override\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               key = ((double) timeSlider.getSelection()) / 100.0;\r
-                               updateTime();\r
-                       }\r
-               });\r
-               timeSlider.setLayoutData(new GridData(SWT.FILL, 1, true, false));\r
-               timeText = new Text(infoComposite, SWT.SINGLE);\r
-               timeText.addFocusListener(new FocusAdapter() {\r
-                       @Override\r
-                       public void focusLost(FocusEvent e) {\r
-                               updateTime();\r
-                       }\r
-               });\r
-               timeText.addKeyListener(new KeyAdapter() {\r
-                       @Override\r
-                       public void keyReleased(KeyEvent e) {\r
-                               if (e.keyCode == SWT.CR)\r
-                                       updateTime();\r
-                       }\r
-               });\r
-\r
-               buttonComposite = new Composite(infoComposite, SWT.NONE);\r
-               buttonComposite.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-               buttonComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 2, 1));\r
-               insertKeyFrameButton = new Button(buttonComposite, SWT.PUSH);\r
-               insertKeyFrameButton.setText("Insert Keyframe");\r
-               insertKeyFrameButton.addSelectionListener(new SelectionAdapter() {\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               insertKeyFrame();\r
-                       }\r
-               });\r
-\r
-               clearKeyFrameButton = new Button(buttonComposite, SWT.PUSH);\r
-               clearKeyFrameButton.setText("Clear Keyframe");\r
-\r
-               animationCombo = new CCombo(buttonComposite, SWT.NONE);\r
-               animationCombo.add(NO_ANIMATION);\r
-               animationCombo.select(0);\r
-               animationCombo.setEditable(false);\r
-               animationCombo.addSelectionListener(new SelectionAdapter() {\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               selectAnimation();\r
-                       }\r
-               });\r
-\r
-               addAnimationButton = new Button(buttonComposite, SWT.PUSH);\r
-               addAnimationButton.setText("New Animation");\r
-               addAnimationButton.addSelectionListener(new SelectionAdapter() {\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               addAnimation();\r
-                       }\r
-               });\r
-\r
-               clearAnimationButton = new Button(buttonComposite, SWT.PUSH);\r
-               clearAnimationButton.setText("Clear Animation");\r
-               clearAnimationButton.addSelectionListener(new SelectionAdapter() {\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               clearAnimation();\r
-                       }\r
-               });\r
-\r
-               removeAnimationButton = new Button(buttonComposite, SWT.PUSH);\r
-               removeAnimationButton.setText("Remove Animation");\r
-               removeAnimationButton.addSelectionListener(new SelectionAdapter() {\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               removeAnimation();\r
-                       }\r
-               });\r
-\r
-               animateButton = new Button(buttonComposite, SWT.TOGGLE);\r
-               animateButton.setText("Animate");\r
-               animateButton.addSelectionListener(new SelectionAdapter() {\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               animate();\r
-                       }\r
-               });\r
-\r
-               usePrecalculation = new Button(buttonComposite, SWT.CHECK);\r
-               usePrecalculation.setText("Precalc");\r
-\r
-               data = new FormData();\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(100, 0);\r
-               data.bottom = new FormAttachment(100, 0);\r
-               // FIXME : take account font size\r
-               data.height = 20 * 3;\r
-               infoComposite.setLayoutData(data);\r
-\r
-               this.parent.getSelectionAdapter().addSelectionChangedListener(new ISelectionChangedListener() {\r
-                       public void selectionChanged(SelectionChangedEvent event) {\r
-                               updateUI();\r
-                       }\r
-               });\r
-               updateUI();\r
-               \r
-               this.parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               G3DModel m = new G3DModel(g,AnimationContribution.this.parent.getModelResource());\r
-                       Collection<Animation> animations = m.getAnimation();\r
-\r
-                       final List<String> animationNames = new ArrayList<String>();\r
-                       for (Animation a : animations) {\r
-                               animationNames.add(a.getName());\r
-                       }\r
-                       AnimationContribution.this.parent.getRenderingComposite().getDisplay().asyncExec(new Runnable() {\r
-                               public void run() {\r
-                                       for (String s : animationNames)\r
-                                               animationCombo.add(s);\r
-                               }\r
-                       });\r
-                       return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-               });\r
-       }\r
-       \r
-       @Override\r
-       public void disposeControl() {\r
-               if (animateRunnable != null)\r
-               VisualizationScheduler.getInstance().removeVisualization(animateRunnable);\r
-       animateRunnable = null;\r
-       \r
-       infoComposite.dispose();\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillContextMenu(Graph graph, IMenuManager manager, StructuredResourceSelection selection) {\r
-\r
-       }\r
-       \r
-       \r
-       \r
-       @Override\r
-       public Collection<ContextAction> getActions() {\r
-               return actions;\r
-       }\r
-       \r
-       @Override\r
-       public void initialize(Graph graph) {\r
-               actions.add(translateAction = new TranslateAction(parent) {\r
-                       @Override\r
-                       public void setInfoText(String text) {\r
-                               infoText.setText(text);\r
-                       }\r
-               });\r
-               actions.add(rotateAction = new RotateAction(parent){\r
-                       @Override\r
-                       public void setInfoText(String text) {\r
-                               infoText.setText(text);\r
-                       }\r
-               });\r
-       }\r
-       \r
-       private double getCurrentKey() {\r
-       return key;\r
-    }\r
-    \r
-    private void updateTime() {\r
-        final double t = getCurrentKey();\r
-        timeText.setText(Double.toString(t));\r
-        if (animationResource == null)\r
-            return;\r
-        if (usePrecalculation.getSelection()) {\r
-            for (IGraphicsNode n : parent.getScenegraphAdapter().getNodes()) {\r
-                if (n instanceof Animatable) {\r
-                       // TODO : frame-rate dependent animations\r
-                    ((Animatable)n).animate(t,0.0);\r
-                }\r
-                parent.setViewChanged(true);\r
-            }    \r
-        } else {\r
-               parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               Collection<IEntity> interpolators = getAnimation(g).getRelatedObjects(ShapeEditorResources.animationResource.HasInterpolator);\r
-                    for (IEntity i : interpolators) {\r
-                        if (i.isInstanceOf(ShapeEditorResources.animationResource.ScalarInterpolator)) {\r
-                            // TODO : creating curve each time when time is set is\r
-                            // slow. Curve should be cached\r
-                            TCBCurve c = (TCBCurve) ShapeEditorResources.curveBuilder.loadInterpolator(i);\r
-                            double out = c.evaluate(t);\r
-                            g.setScalarDouble(i.getSingleRelatedObject(ShapeEditorResources.animationResource.HasTarget).getResource(), out);\r
-                        } else if (i.isInstanceOf(ShapeEditorResources.animationResource.SlerpInterpolator)) {\r
-                            // TODO : creating curve each time when time is set is slow.\r
-                            // Curve should be cached\r
-                            SlerpCurve c = (SlerpCurve) ShapeEditorResources.curveBuilder.loadInterpolator(i);\r
-                            Quat4d out = c.evaluate(t);\r
-                            Orientation r = new Orientation(i.getSingleRelatedObject(ShapeEditorResources.animationResource.HasTarget));\r
-                            AxisAngle4d aa = new AxisAngle4d();\r
-                            aa.set(out);\r
-                            G3DTools.setOrientation(r, aa);\r
-                        }\r
-                    }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void requestCompleted(GraphRequestStatus status) {\r
-                               parent.getScenegraphAdapter().setChanged(true);\r
-                       }\r
-               });   \r
-        }\r
-    }\r
-    \r
-    private IEntity findPropertyInterpolator(Graph g, Resource property) {\r
-       Collection<IEntity> interpolators = getAnimation(g).getRelatedObjects(ShapeEditorResources.animationResource.HasInterpolator);\r
-        for (IEntity i : interpolators) {\r
-            IEntity e = i.getAtMostOneRelatedObject(ShapeEditorResources.animationResource.HasTarget);\r
-            if (e == null)\r
-                continue;\r
-            if (e.getResource().equals(property)) {\r
-                return i;\r
-            }\r
-        }\r
-        return null;\r
-    }\r
-    \r
-    private void insertKeyFrame() {\r
-       ArrayList<Resource> instances = new ArrayList<Resource>();\r
-       for (Resource rs : parent.getSelectionAdapter().getCurrentSelection().getSelectionList()) {\r
-               instances.add(rs);\r
-       }\r
-        PropertySelectionDialog dialog = new PropertySelectionDialog(parent.getRenderingComposite().getShell(),"Select property","Select animated property",parent.getSession(),instances);\r
-        if (dialog.open() == Dialog.CANCEL) {\r
-            return;\r
-        }\r
-        final List<Resource> properties = dialog.getSelectedPropertyInstances(); \r
-        parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       for (Resource r : properties) {\r
-                               IEntity t = EntityFactory.create(g,r);\r
-                    IEntity current = findPropertyInterpolator(g, r);\r
-                    if (t.isInstanceOf(ShapeEditorResources.g3dResource.Position)) {\r
-                        \r
-                        for (int i = 0; i < 3; i++) {\r
-                               IEntity d = null;\r
-                            switch (i) {\r
-                            case 0:\r
-                                d = t.getSingleRelatedObject(ShapeEditorResources.g3dResource.HasX);\r
-                                break;\r
-                            case 1:\r
-                               d = t.getSingleRelatedObject(ShapeEditorResources.g3dResource.HasY);\r
-                               break;\r
-                            case 2:\r
-                               d = t.getSingleRelatedObject(ShapeEditorResources.g3dResource.HasZ);\r
-                               break;\r
-                            }\r
-                            current = findPropertyInterpolator(g, d.getResource());\r
-                            addScalarKey(current,d);\r
-                        }\r
-                        \r
-                    } else if (t.isInstanceOf(ShapeEditorResources.g3dResource.Orientation)) {\r
-                        Orientation rot = new Orientation(t);\r
-                        addSlerpKey(current, rot);\r
-                    } else if (t.isInstanceOf(ShapeEditorResources.g3dResource.Color)) {\r
-                        for (int i = 0; i < 3; i++) {\r
-                            IEntity d = null;\r
-                               switch (i) {\r
-                            case 0:\r
-                               d = t.getSingleRelatedObject(ShapeEditorResources.g3dResource.HasRed);\r
-                                break;\r
-                            case 1:\r
-                                break;\r
-                            case 2:\r
-                                break;\r
-                            }\r
-                            current = findPropertyInterpolator(g, d.getResource());\r
-                               addScalarKey(current,d);\r
-                        }\r
-                    } else if (t.isInstanceOf(g.getBuiltins().Double)) {\r
-                       addScalarKey(current,t);\r
-                    } else {\r
-                        // TODO: basic cases are handled, only way to support\r
-                        // is to find all doubles from property structure and\r
-                        // interpolators attached to them, if there's any\r
-                        ErrorLogger.getDefault().logWarning("Default keyframe adding has not been implemented", null);\r
-                    }\r
-                }\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-        });\r
-    }\r
-    \r
-    private void addScalarKey(IEntity current, IEntity d) {\r
-        \r
-       Graph graph = d.getGraph();\r
-       if (current == null) {\r
-            current = ScalarInterpolator.createDefault(graph).toInterpolator(); // FIXME : stubcast\r
-            getAnimation(graph).addStatement(ShapeEditorResources.animationResource.HasInterpolator, current);\r
-            current.addStatement(ShapeEditorResources.animationResource.HasTarget, d);\r
-        }\r
-        ShapeEditorResources.curveBuilder.addKey(current,getCurrentKey(),new double[]{d.getGraph().getScalarDouble(d.getResource()),0.0,0.0,0.0});\r
-    }\r
-    \r
-    private void addSlerpKey(IEntity current, Orientation r) {\r
-        Graph graph = r.getGraph();\r
-       if (current == null) {\r
-            current = SlerpInterpolator.createDefault(graph).toInterpolator(); // FIXME : stubcast\r
-            getAnimation(graph).addStatement(ShapeEditorResources.animationResource.HasInterpolator, current);\r
-            current.addStatement(ShapeEditorResources.animationResource.HasTarget, r);\r
-            \r
-        }\r
-        AxisAngle4d aa = G3DTools.getOrientation(r);\r
-        Quat4d q = new Quat4d();\r
-        q.set(aa);\r
-        ShapeEditorResources.curveBuilder.addKey(current,getCurrentKey(),new double[]{q.w,q.x,q.y,q.z});  \r
-    }\r
-    \r
-    private void selectAnimation() {\r
-        if (animationCombo.getSelectionIndex() == 0) {\r
-            animationResource = null;\r
-            updateUI();\r
-        } else {\r
-               final String name = animationCombo.getItem(animationCombo.getSelectionIndex());\r
-               parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               \r
-                    Resource modelResource = parent.getModelResource();\r
-                    G3DModel m = new G3DModel(g, modelResource);\r
-                    Collection<Animation> animations = m.getAnimation();\r
-                    boolean found = false;\r
-                    for (Animation a : animations) {\r
-                        if (a.getName().startsWith(name) && a.getName().length() == name.length()) {\r
-                            animationResource = a.getResource();\r
-                            found = true;\r
-                            break;\r
-                        }\r
-                    }\r
-                    if (!found) {\r
-                        ErrorLogger.defaultLogError("Could find animation " + name + " for model " + m.getResource(), null);\r
-                        animationResource = null;\r
-                    }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       @Override\r
-                       public void requestCompleted(GraphRequestStatus status) {\r
-                               parent.getRenderingComposite().getDisplay().asyncExec(new Runnable() {\r
-                                       @Override\r
-                                       public void run() {\r
-                                                updateUI();    \r
-                                       }\r
-                               });\r
-                       }\r
-               });\r
-        }       \r
-    }\r
-    \r
-    private Animation getAnimation(Graph graph) {\r
-       return new Animation(graph, animationResource);\r
-    }\r
-\r
-    private void addAnimation() {\r
-        InputDialog d = new InputDialog(parent.getRenderingComposite().getShell(),"Animation name","Animation name","",null);\r
-        if (d.open() == InputDialog.CANCEL) {\r
-            return;\r
-        }\r
-        final String name = d.getValue();\r
-        if (name == null || name.length() == 0) {\r
-            return;\r
-        }\r
-        parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       G3DModel m = parent.getModel(g);\r
-                       Collection<IEntity> animations = m.getRelatedObjects(ShapeEditorResources.animationResource.HasAnimation);\r
-                       for (IEntity a : animations) {\r
-                        if (a.getName().startsWith(name) && a.getName().length() == name.length()) {\r
-                        ErrorLogger.getDefault().logWarning("Cannot add animation with the same name " + name, null);\r
-                        return GraphRequestStatus.transactionCancel();\r
-                    }\r
-                }\r
-\r
-                Animation newAnimation = Animation.createDefault(g);\r
-                newAnimation.setName(name);\r
-                m.addStatement(ShapeEditorResources.animationResource.HasAnimation, newAnimation);\r
-                \r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-\r
-               @Override\r
-               public void requestCompleted(GraphRequestStatus status) {\r
-                       parent.getRenderingComposite().getDisplay().asyncExec(new Runnable() {\r
-                               public void run() {\r
-                                       animationCombo.add(name);\r
-                        animationCombo.select(animationCombo.indexOf(name));\r
-                        selectAnimation();\r
-                               }\r
-                       });\r
-               }\r
-        });    \r
-    }\r
-    \r
-    private void removeAnimation() {\r
-        assert(animationResource != null);\r
-        GraphRequestWithResult<String> r = new GraphRequestWithResult<String>() {\r
-               public String performWithResult(Graph g) throws Exception {\r
-                       return getAnimation(g).getName();\r
-               };\r
-        };\r
-        parent.getSession().syncRead(r);\r
-        MessageDialog dialog = new MessageDialog(parent.getRenderingComposite().getShell(),"Confirm",null,"Do you want to remove animation " + r.getResult() ,MessageDialog.QUESTION,new String[]{"Yes","No"},1);\r
-        if (dialog.open() == 1)\r
-               return;\r
-        parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-               String name;\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       \r
-                       Animation currentAnimation = getAnimation(g);\r
-                       name = currentAnimation.getName();\r
-                parent.getModel(g).removeStatement(ShapeEditorResources.animationResource.HasAnimation, currentAnimation);\r
-                \r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-               \r
-               @Override\r
-               public void requestCompleted(GraphRequestStatus status) {\r
-                       parent.getRenderingComposite().getDisplay().asyncExec(new Runnable() {\r
-                               public void run() {\r
-                                       animationCombo.remove(animationCombo.indexOf(name));\r
-                               }\r
-                       });     \r
-               }\r
-        });\r
-    }\r
-    \r
-    private void clearAnimation() {\r
-        assert(animationResource != null);  \r
-        \r
-        parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-               \r
-               boolean proceed;\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       int size = getAnimation(g).getInterpolator().size();\r
-                       if (size == 0)\r
-                               return GraphRequestStatus.transactionCancel();\r
-                       final String name = getAnimation(g).getName();\r
-                       parent.getRenderingComposite().getDisplay().syncExec(new Runnable() {\r
-                               public void run() {\r
-                                       MessageDialog dialog = new MessageDialog(parent.getRenderingComposite().getShell(),"Confirm",null,"Do you want to clear animation " + name ,MessageDialog.QUESTION,new String[]{"Yes","No"},1);\r
-                           proceed = (dialog.open() != MessageDialog.CANCEL);\r
-                               }\r
-                       });\r
-                       if (proceed) {\r
-                               //getAnimation(g).getInterpolator().clear();\r
-                               getAnimation(g).removeRelatedStatements(ShapeEditorResources.animationResource.HasInterpolator);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       } else {\r
-                               return GraphRequestStatus.transactionCancel();\r
-                       }\r
-               }\r
-        });\r
-    }\r
\r
-    public Graph createAnimationParameterization(Graph g) {\r
-               if (g.getObjects(parent.getModelResource(), ShapeEditorResources.g3dResource.HasSizingParameter).size() > 0) {\r
-                       ContextGraph graph;\r
-                       if (!(g instanceof ContextGraph)) {\r
-                               graph = new ContextGraph(g);\r
-                               graph.setContext(parent.getModelResource());\r
-                       } else {\r
-                               graph = (ContextGraph)g;\r
-                       }\r
-                       Animation animation = getAnimation(graph);\r
-                       Collection<Interpolator> interpolators = animation.getInterpolator();\r
-                       for (org.simantics.g2d.stubs.anim.Interpolator interpolator : interpolators) {\r
-                       IEntity target = interpolator.getTarget();\r
-                       // check all model properties\r
-                       G3DModel model = parent.getModel(graph);\r
-                       Collection<Property> modelProperties = model.getRelatedProperties(ShapeEditorResources.g3dResource.HasSizingParameter);\r
-                       for (Property p : modelProperties) {\r
-                               IEntity t = EntityFactory.create(graph,p.getResource());\r
-                               // get parameterization equations\r
-                               Collection<IEntity> equations = t.getRelatedObjects(ShapeEditorResources.equationResource.HasTarget);\r
-                               // get parameterized values\r
-                               Collection<IEntity> parameterTargets = new ArrayList<IEntity>();\r
-                               for (IEntity eq : equations) {\r
-                                       Collection<IEntity> tgts = eq.getRelatedObjects(ShapeEditorResources.equationResource.HasTarget);\r
-                                       assert(tgts.size() == 1);\r
-                                       parameterTargets.add(tgts.iterator().next());\r
-                               }\r
-                               // do matching between interpolator targets and parameterized values\r
-                               // TODO : old system did not have inverse relations but current system does.\r
-                               //                it is possible to take interpolation target and find if it is connected to an equation\r
-                               //                this would make code much faster (no more stupid loops over everything)\r
-                               for (IEntity d : parameterTargets) {\r
-                                       if (d.getResource().equals(target.getResource())) {\r
-                                               // get default value for sizing property\r
-                                               Collection<IEntity> prop = t.getRelatedObjects(ShapeEditorResources.g3dResource.HasDefaultDoubleValue);\r
-                                               if (prop.size() == 1) {\r
-                                                       ShapeEditorResources.curveBuilder.parameterize(interpolator, prop.iterator().next().toProperty().getDoubleArray(), p.getDoubleArray());\r
-                                       } else {\r
-                                               ErrorLogger.defaultLogError("Cannot parameterize interpolator " + interpolator.getResource() + " of animation " + animation.getResource() + " since parameter " + p.getResource() + " has no default value", null);\r
-                                       }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-                       \r
-                       return graph;\r
-               } else {\r
-                       return g;\r
-               }\r
-       }\r
-    \r
-    private AnimateRunnable animateRunnable = null;\r
-    \r
-    private void animate() {\r
-        updateUI();\r
-        if (animateButton.getSelection()) {\r
-            if (animateRunnable != null)\r
-                return;\r
-            if (usePrecalculation.getSelection()) {\r
-               parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               Graph graph = parent.createParameterization(g);\r
-                               createAnimationParameterization(graph);\r
-                               for (IGraphicsNode n : parent.getScenegraphAdapter().getNodes()) {\r
-                                       if (n instanceof ISelectableNode) {\r
-                                               if (!((ISelectableNode)n).isVisible())\r
-                                                       continue;\r
-                                       }\r
-                            if (n instanceof Animatable) {\r
-                                ((Animatable)n).setAnimation(graph,animationResource);\r
-                            }\r
-                        }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void requestCompleted(GraphRequestStatus status) {\r
-                               animateRunnable = new AnimateRunnable();\r
-                        VisualizationScheduler.getInstance().addVisualization(animateRunnable);\r
-                       }\r
-               });\r
-            } else {\r
-               animateRunnable = new AnimateRunnable();\r
-                VisualizationScheduler.getInstance().addVisualization(animateRunnable);\r
-            }\r
-            \r
-        } else {\r
-            if (animateRunnable == null)\r
-                return;       \r
-            VisualizationScheduler.getInstance().removeVisualization(animateRunnable);\r
-            animateRunnable = null;\r
-            if (usePrecalculation.getSelection()) {\r
-               // updateTime updates values to graph if precalculation is not used.\r
-               // we must store current values from animation to synchronize view and graph\r
-               // information so that use can modify animation properly.\r
-               usePrecalculation.setSelection(false);\r
-               updateTime();\r
-               usePrecalculation.setSelection(true);\r
-               for (IGraphicsNode n : parent.getScenegraphAdapter().getNodes()) {\r
-                  if (n instanceof Animatable) {\r
-                      ((Animatable)n).setAnimation(null,null);\r
-                  }\r
-              }\r
-            }\r
-        }\r
-    }\r
-    \r
-    private void updateUI() {\r
-        if (animationResource != null) {\r
-            animateButton.setEnabled(true);\r
-            timeSlider.setEnabled(true);\r
-            if (animateButton.getSelection()) {\r
-                addAnimationButton.setEnabled(false);\r
-                insertKeyFrameButton.setEnabled(false);\r
-                removeAnimationButton.setEnabled(false);\r
-                clearKeyFrameButton.setEnabled(false);\r
-                animationCombo.setEnabled(false);\r
-                usePrecalculation.setEnabled(false);\r
-                clearAnimationButton.setEnabled(false);\r
-            } else {\r
-                addAnimationButton.setEnabled(true);\r
-                insertKeyFrameButton.setEnabled(!parent.getSelectionAdapter().getCurrentSelection().isEmpty());\r
-                removeAnimationButton.setEnabled(true);\r
-                clearKeyFrameButton.setEnabled(false); //FIXME : detect keyframes\r
-                animationCombo.setEnabled(true);\r
-                usePrecalculation.setEnabled(true);\r
-                clearAnimationButton.setEnabled(true);\r
-            }    \r
-        } else {\r
-            timeSlider.setEnabled(false);\r
-            addAnimationButton.setEnabled(true);\r
-            insertKeyFrameButton.setEnabled(false);\r
-            removeAnimationButton.setEnabled(false);\r
-            clearKeyFrameButton.setEnabled(false);\r
-            animateButton.setEnabled(false);\r
-            animateButton.setSelection(false);\r
-            animationCombo.setEnabled(true);\r
-            usePrecalculation.setEnabled(false);\r
-            clearAnimationButton.setEnabled(false);\r
-        }\r
-    }\r
-    \r
-    private void updateKey(double k) {\r
-       key = k;\r
-       if (key >= 1.0)\r
-               key = 0.0;\r
-       else if (key < 0.0)\r
-               key = 1.0;\r
-       timeSlider.setSelection((int)(key*100.0));\r
-    }\r
-    \r
-    private class AnimateRunnable implements Runnable {\r
-        public void run() {\r
-               try {\r
-                       updateKey(key + 0.01);\r
-                       updateTime();\r
-               } catch (Exception e) {\r
-                        VisualizationScheduler.getInstance().removeVisualization(animateRunnable);\r
-               }\r
-        }\r
-    }\r
-    \r
-    @Override\r
-    public void fillLocalToolBar(IToolBarManager manager) {\r
-\r
-    }\r
-    \r
-    @Override\r
-    public void fillLocalPullDown(IMenuManager manager) {\r
-       \r
-    }\r
-    \r
-    @Override\r
-    public void dispose() {\r
-       \r
-    }\r
-    \r
-    @Override\r
-    public void run() {\r
-\r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/CSGModellingContribution.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/CSGModellingContribution.java
deleted file mode 100644 (file)
index dd80c96..0000000
+++ /dev/null
@@ -1,777 +0,0 @@
-package org.simantics.proconf.g3d.shapeeditor.tools;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.TreeMap;\r
-import java.util.Map.Entry;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Point3d;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.action.MenuManager;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.layout.FormAttachment;\r
-import org.eclipse.swt.layout.FormData;\r
-import org.eclipse.swt.layout.FormLayout;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.eclipse.ui.ISharedImages;\r
-import org.eclipse.ui.PlatformUI;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.stubs.Property;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.instantiation.Instance;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.actions.FocusAction;\r
-import org.simantics.proconf.g3d.actions.RemoveAction;\r
-import org.simantics.proconf.g3d.actions.RotateAction;\r
-import org.simantics.proconf.g3d.actions.TranslateAction;\r
-import org.simantics.proconf.g3d.actions.WriteAction;\r
-import org.simantics.proconf.g3d.base.EditorContribution;\r
-import org.simantics.proconf.g3d.base.G3DAPI;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.csg.stubs.BooleanOperation;\r
-import org.simantics.proconf.g3d.csg.stubs.CSGModel;\r
-import org.simantics.proconf.g3d.csg.stubs.CSGShape;\r
-import org.simantics.proconf.g3d.csg.stubs.Difference;\r
-import org.simantics.proconf.g3d.csg.stubs.Intersection;\r
-import org.simantics.proconf.g3d.csg.stubs.Primitive;\r
-import org.simantics.proconf.g3d.csg.stubs.Union;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.shapeeditor.Activator;\r
-import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
-import org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorBase;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.proconf.g3d.stubs.Shape;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-public class CSGModellingContribution implements EditorContribution {\r
-       \r
-       private static ImageDescriptor INTERSECTION_IMAGE = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID,"icons/intersection.png");\r
-       private static ImageDescriptor UNION_IMAGE = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/union.png");\r
-       private static ImageDescriptor DIFFERENCE_IMAGE = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID,"icons/difference.png");\r
-\r
-       private ShapeEditorBase parent;\r
-       \r
-       private List<ContextAction> actions = new ArrayList<ContextAction>();\r
-       \r
-       private List<Action> addActions = new ArrayList<Action>();\r
-       private ContextAction unionAction;\r
-       private ContextAction differenceAction;\r
-       private ContextAction intersectionAction;\r
-       private ContextAction splitAction;\r
-       private ContextAction linkAction;\r
-       private ContextAction unlinkAction;\r
-       private ContextAction translateAction;\r
-       private ContextAction rotateAction;\r
-       private ContextAction removeAction;\r
-       \r
-       private Composite infoComposite;\r
-       private Text infoText;\r
-       \r
-       \r
-       public CSGModellingContribution(ThreeDimensionalEditorBase parent) {\r
-               this.parent = (ShapeEditorBase)parent;  \r
-       }\r
-       \r
-       @Override\r
-       public String getName() {\r
-               return "Shape Editing";\r
-       }\r
-       \r
-       @Override\r
-       public void initialize(Graph graph) {\r
-               makeActions(graph);\r
-       }\r
-       \r
-       @Override\r
-       public void createControl(Composite parent) {\r
-               FormLayout flayout = new FormLayout();\r
-               parent.setLayout(flayout);\r
-               infoComposite = new Composite(parent, SWT.BORDER);\r
-               FormData data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(100, 0);\r
-               data.bottom = new FormAttachment(infoComposite, 0, SWT.TOP);\r
-               this.parent.getRenderingComposite().setLayoutData(data);\r
-               data = new FormData();\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(100, 0);\r
-               data.bottom = new FormAttachment(100, 0);\r
-               data.height = 18;\r
-               infoComposite.setLayoutData(data);\r
-               GridLayout layout = new GridLayout(1,false);\r
-               layout.marginWidth = 1;\r
-               layout.marginHeight = 1;\r
-               infoComposite.setLayout(layout);\r
-               infoText = new Text(infoComposite, SWT.NONE);\r
-               GridData gdata = new GridData();\r
-               gdata.grabExcessHorizontalSpace = true;\r
-               gdata.horizontalAlignment = SWT.FILL;\r
-               infoText.setLayoutData(gdata);\r
-       }\r
-       \r
-       @Override\r
-       public void disposeControl() {\r
-               infoComposite.dispose();\r
-       }\r
-       \r
-       @Override\r
-       public void fillContextMenu(Graph graph, IMenuManager manager, StructuredResourceSelection selection) {\r
-\r
-               if (selection.isEmpty()) {\r
-                       MenuManager addMenu = new MenuManager("Add", "add");\r
-                       addMenu.setRemoveAllWhenShown(false);\r
-                       for (Action a : addActions) {\r
-                               addMenu.add(a);\r
-                       }\r
-                       manager.add(addMenu);\r
-               }\r
-\r
-       }\r
-       \r
-       protected void makeActions(Graph graph) {\r
-               actions.add(translateAction = new TranslateAction(parent) {\r
-                       @Override\r
-                       public void setInfoText(String text) {\r
-                               infoText.setText(text);\r
-                       }\r
-               });\r
-               actions.add(rotateAction = new RotateAction(parent){\r
-                       @Override\r
-                       public void setInfoText(String text) {\r
-                               infoText.setText(text);\r
-                       }\r
-               });\r
-               actions.add(removeAction = new RemoveAction(parent));\r
-               actions.add(new FocusAction(parent));\r
-\r
-               \r
-               IEntity primitive = EntityFactory.create(graph,ShapeEditorResources.csgResource.Primitive);\r
-               \r
-               Collection<IEntity> primitives = primitive.getRelatedObjects(graph.getBuiltins().SupertypeOf);\r
-\r
-               TreeMap<String, Resource> sorter = new TreeMap<String, Resource>();\r
-               for (IEntity p : primitives) {\r
-                       String key = p.getName();\r
-                       if (key.equals(""))\r
-                               key = "ERROR (" + p.getURI() + ")";\r
-                       sorter.put(key, p.getResource());\r
-               }\r
-\r
-               for (Entry<String, Resource> e : sorter.entrySet()) {\r
-                       final String name = e.getKey();\r
-                       final Resource r = e.getValue();\r
-                       Action a = new Action() {\r
-                               Resource res;\r
-                               public void run() {\r
-                                       parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                                               @Override\r
-                                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-\r
-                                                       Instance ins = InstanceFactory.getInstanceOfType(g,r);\r
-                                                       Resource instance = ins.instantiate(g);\r
-                                                       Shape shape = new Shape(g,instance);\r
-                                                       res = shape.getResource();\r
-                                                       resetShape(shape);\r
-                                                       CSGModel model = new CSGModel(g,parent.getModelResource());\r
-                                                       model.addStatement(ShapeEditorResources.g3dResource.HasChild, shape.getResource());\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               }\r
-                                               \r
-                                               @Override\r
-                                               public void handleException(Throwable e) {\r
-                                                       super.handleException(e);\r
-                                                       ErrorLogger.defaultLogError("Adding " + name + " failed.", e);\r
-                                               }\r
-                                               \r
-                                               @Override\r
-                                               public void requestCompleted(GraphRequestStatus status) {\r
-                                                       parent.getRenderingComposite().getDisplay().asyncExec(new Runnable(){\r
-                                                               public void run() {\r
-                                                                       parent.getSelectionAdapter().updateSelection(new StructuredResourceSelection(res));\r
-                                                               }\r
-                                                       });\r
-                                               }\r
-                                       });\r
-                               }\r
-                       };\r
-                       a.setText(name);\r
-                       a.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));\r
-                       addActions.add(a);\r
-\r
-               }\r
-\r
-               unionAction = new WriteAction(parent,false) {\r
-\r
-                       Resource r;\r
-                       @Override\r
-                       public boolean usable(Graph graph,List<Resource> resources) {\r
-                               if (resources.size() >= 2)\r
-                                       return true;\r
-                               return false;\r
-                       }\r
-\r
-                       public GraphRequestStatus doChanges(Graph graph) {\r
-                               List<IGraphicsNode> list = parent.getSelectionAdapter().getSelectedObjects();\r
-                               if (list.size() < 2) {\r
-                                       showMessage("Union works between two objects");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               Resource r1 = list.get(0).getResource();\r
-                               CSGShape shape1 = new CSGShape(graph,r1);\r
-\r
-                               G3DNode parent = shape1.getParent();\r
-                               if (parent == null) {\r
-                                       showMessage("Primary shape has no parent, don't know what to do");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               BooleanOperation op = Union.createDefault(graph).toBooleanOperation(); //FIXME : stubcast\r
-                               r = op.getResource();\r
-                               if (createBooleanOp(op, parent, shape1, list))\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               else\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void afterChanges(GraphRequestStatus status) {\r
-                               parent.getRenderingComposite().getDisplay().asyncExec(new Runnable(){\r
-                                       public void run() {\r
-                                               parent.getSelectionAdapter().updateSelection(new StructuredResourceSelection(r));\r
-                                       }\r
-                               });\r
-                       }\r
-               };\r
-               unionAction.setText("Union");\r
-               unionAction.setToolTipText("Union");\r
-               unionAction.setImageDescriptor(UNION_IMAGE);\r
-\r
-               differenceAction = new WriteAction(parent,false) {\r
-\r
-                       Resource r;\r
-                       @Override\r
-                       public boolean usable(Graph graph,List<Resource> resources) {\r
-                               if (resources.size() >= 2)\r
-                                       return true;\r
-                               return false;\r
-                       }\r
-\r
-                       public GraphRequestStatus doChanges(Graph graph) {\r
-                               List<IGraphicsNode> list = parent.getSelectionAdapter().getSelectedObjects();\r
-                               if (list.size() < 2) {\r
-                                       showMessage("Difference works between two objects");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               CSGShape shape1 = new CSGShape(graph,list.get(0).getResource());\r
-                               G3DNode parent = shape1.getParent();\r
-                               if (parent == null) {\r
-                                       showMessage("Primary shape has no parent, don't know what to do");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               BooleanOperation op = Difference.createDefault(graph).toBooleanOperation(); //FIXME : stubcast\r
-                               r = op.getResource();\r
-                               if (createBooleanOp(op, parent, shape1, list))\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               else\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void afterChanges(GraphRequestStatus status) {\r
-                               parent.getRenderingComposite().getDisplay().asyncExec(new Runnable(){\r
-                                       public void run() {\r
-                                               parent.getSelectionAdapter().updateSelection(new StructuredResourceSelection(r));\r
-                                       }\r
-                               });\r
-                       }\r
-               };\r
-               differenceAction.setText("Difference");\r
-               differenceAction.setToolTipText("Difference");\r
-               differenceAction.setImageDescriptor(DIFFERENCE_IMAGE);\r
-\r
-               intersectionAction = new WriteAction(parent,false) {\r
-                       Resource r;\r
-                       @Override\r
-                       public boolean usable(Graph graph,List<Resource> resources) {\r
-                               if (resources.size() >= 2)\r
-                                       return true;\r
-                               return false;\r
-                       }\r
-\r
-                       public GraphRequestStatus doChanges(Graph graph) {\r
-                               List<IGraphicsNode> list = parent.getSelectionAdapter()\r
-                                               .getSelectedObjects();\r
-                               if (list.size() < 2) {\r
-                                       showMessage("Intersection works between two objects");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               CSGShape shape1 = new CSGShape(graph,list.get(0).getResource());\r
-                               G3DNode parent = shape1.getParent();\r
-                               if (parent == null) {\r
-                                       showMessage("Primary shape has no parent, don't know what to do");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               BooleanOperation op = Intersection.createDefault(graph).toBooleanOperation(); //FIXME : stubcast\r
-                               r = op.getResource();\r
-                               if (createBooleanOp(op, parent, shape1, list))\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               else\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void afterChanges(GraphRequestStatus status) {\r
-                               parent.getRenderingComposite().getDisplay().asyncExec(new Runnable(){\r
-                                       public void run() {\r
-                                               parent.getSelectionAdapter().updateSelection(new StructuredResourceSelection(r));\r
-                                       }\r
-                               });\r
-                               \r
-                       }\r
-               };\r
-               intersectionAction.setText("Intersection");\r
-               intersectionAction.setToolTipText("Intersection");\r
-               intersectionAction.setImageDescriptor(INTERSECTION_IMAGE);\r
-\r
-               splitAction = new WriteAction(parent,false) {\r
-\r
-                       @Override\r
-                       public boolean usable(Graph graph,List<Resource> resources) {\r
-                               if (resources.size() == 1) {\r
-                                       Resource r = resources.iterator().next();\r
-                                       IEntity t = EntityFactory.create(graph,r);\r
-                                       if (t.isInstanceOf(ShapeEditorResources.csgResource.BooleanOperation)) {\r
-                                               return true;\r
-                                       }\r
-                               }\r
-\r
-                               return false;\r
-                       }\r
-                       \r
-                       \r
-                       \r
-                       public GraphRequestStatus doChanges(Graph graph) {\r
-                               List<IGraphicsNode> list = parent.getSelectionAdapter().getSelectedObjects();\r
-                               if (list.size() != 1) {\r
-                                       showMessage("Split requires one object");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               Resource deletedResource = list.get(0).getResource();\r
-                               IEntity deletedEntity = EntityFactory.create(graph,deletedResource);\r
-                               if (!deletedEntity.isInstanceOf(ShapeEditorResources.csgResource.BooleanOperation)) {\r
-                                       showMessage("Split requires boolean operation");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               Collection<IEntity> parents = deletedEntity.getRelatedObjects(ShapeEditorResources.g3dResource.HasParent);\r
-                               if (parents.size() != 1) {\r
-                                       showMessage("Shape has " + parents.size()\r
-                                                       + " parents, don't know what to do");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               IEntity parent = parents.iterator().next();\r
-                               // find all shapes and their positions and orientations relative to world coordinates\r
-                               BooleanOperation op = new BooleanOperation(deletedEntity);\r
-                               CSGShape shape1 = op.getMainShape();\r
-                               Point3d shape1WorldPos = G3DTools.getPoint(shape1.getWorldPosition());\r
-                               AxisAngle4d shape1WorldRot = G3DTools.getOrientation(shape1.getWorldOrientation());\r
-                               //System.out.println(shape1WorldPos + " " + shape1WorldRot);\r
-                               Collection<CSGShape> shape2s = op.getSecondaryShape();\r
-\r
-                               ArrayList<Point3d> shape2WorldPos = new ArrayList<Point3d>();\r
-                               ArrayList<AxisAngle4d> shape2WorldRot = new ArrayList<AxisAngle4d>();\r
-                               for (CSGShape shape : shape2s) {\r
-                                       Point3d pos = G3DTools.getPoint(shape.getWorldPosition());\r
-                                       AxisAngle4d rot = G3DTools.getOrientation(shape.getWorldOrientation());\r
-                                       shape2WorldPos.add(pos);\r
-                                       shape2WorldRot.add(rot);\r
-                                       //System.out.println(pos + " " + rot);\r
-                               }\r
-\r
-                               // removed boolean operation is either connected to model or another boolean operation.\r
-                               CSGModel m = new CSGModel(graph,CSGModellingContribution.this.parent.getModelResource());\r
-                               if (parent.getResource().equals(CSGModellingContribution.this.parent.getModelResource())) {\r
-                                       // if deleted boolean operation is connected to the model,\r
-                                       // all its children are added to the model\r
-\r
-                                       m.removeStatement(ShapeEditorResources.g3dResource.HasChild, op);\r
-                                       m.addStatement(ShapeEditorResources.g3dResource.HasChild, shape1);\r
-                                       for (CSGShape shape2 : shape2s) {\r
-                                               m.addStatement(ShapeEditorResources.g3dResource.HasChild, shape2);\r
-                                       }\r
-\r
-                               } else {\r
-                                       // deleted boolean operation is connected to another boolean\r
-                                       // operation\r
-                                       // if the deleted boolean operation is primary child, we'll\r
-                                       // must replace it with deleted boolean operations\r
-                                       // primary child\r
-                                       if (!parent.isInstanceOf(ShapeEditorResources.csgResource.BooleanOperation)) {\r
-                                               ErrorLogger.defaultLogError("Parent shape is not a boolean operation nor model ?!", null);\r
-                                               return GraphRequestStatus.transactionCancel();\r
-                                       }\r
-                                       BooleanOperation parentOp = new BooleanOperation(parent);\r
-                                       // we'll have to list all secondary shapes in parent boolean\r
-                                       // op so that we can find the correct relatio\r
-                                       Collection<IEntity> parentShape2s = parentOp.getRelatedObjects(ShapeEditorResources.csgResource.HasSecondaryShape);\r
-\r
-                                       if (parentOp.getMainShape().getResource().equals(deletedResource)) {\r
-                                               // split boolean operation is the primary child in the\r
-                                               // parent boolean operation\r
-                                               parent.removeStatement(ShapeEditorResources.csgResource.HasMainShape,deletedResource);\r
-                                               // graph.commitChanges(ShapeEditorView.this);\r
-                                               parent.addStatement(ShapeEditorResources.csgResource.HasMainShape, shape1);\r
-                                               // graph.commitChanges(ShapeEditorView.this);\r
-                                               for (CSGShape shape2 : shape2s) {\r
-                                                       m.addStatement(ShapeEditorResources.g3dResource.HasChild, shape2);\r
-                                               }\r
-                                       } else if (contains(parentShape2s, deletedResource)) {\r
-                                               // split boolean operation is one of the secondary\r
-                                               // shapes in the parent boolean operation\r
-                                               parent.removeStatement(ShapeEditorResources.csgResource.HasSecondaryShape,deletedResource);\r
-                                               // graph.commitChanges(ShapeEditorView.this);\r
-                                               parent.addStatement(ShapeEditorResources.csgResource.HasSecondaryShape,shape1);\r
-                                               // graph.commitChanges(ShapeEditorView.this);\r
-\r
-                                               // model.getConsistOfShapeSet().add(shape2);\r
-                                               for (CSGShape shape2 : shape2s) {\r
-                                                       m.addStatement(ShapeEditorResources.g3dResource.HasChild, shape2);\r
-                                               }\r
-                                       } else {\r
-                                               ErrorLogger.defaultLogError("Parent shape is not a boolean operation nor model ?!", null);\r
-                                               return GraphRequestStatus.transactionCancel();\r
-                                       }\r
-                               }\r
-                               deletedEntity.removeStatement(ShapeEditorResources.csgResource.HasMainShape, shape1);\r
-                               for (CSGShape shape2 : shape2s)\r
-                                       deletedEntity.removeStatement(ShapeEditorResources.csgResource.HasSecondaryShape, shape2);\r
-                               //graph.commit();\r
-                               //System.out.println("Setting original transformations");\r
-                               //G3DTools.setTuple3(shape1.getWorldPosition(), shape1WorldPos);\r
-                               //G3DTools.setOrientation(shape1.getWorldOrientation(), shape1WorldRot);\r
-                               G3DAPI.setWorldTransformation(shape1, shape1WorldPos,shape1WorldRot);\r
-                               \r
-                               int i = 0;\r
-                               for (CSGShape shape : shape2s) {\r
-                                       G3DAPI.setWorldTransformation(shape, shape2WorldPos.get(i),shape2WorldRot.get(i));\r
-                                       //G3DTools.setTuple3(shape.getWorldPosition(), shape2WorldPos.get(i));\r
-                                       //G3DTools.setOrientation(shape.getWorldOrientation(),shape2WorldRot.get(i));\r
-                                       i++;\r
-                               }\r
-                               return GraphRequestStatus.transactionComplete();\r
-\r
-                       }\r
-               };\r
-               splitAction.setText("Split");\r
-               splitAction.setToolTipText("Split");\r
-               splitAction.setImageDescriptor(PlatformUI.getWorkbench()\r
-                               .getSharedImages().getImageDescriptor(\r
-                                               ISharedImages.IMG_OBJS_INFO_TSK));\r
-\r
-               linkAction = new WriteAction(parent,false) {\r
-                       Resource r;\r
-                       @Override\r
-                       public boolean usable(Graph graph,List<Resource> resources) {\r
-                               if (resources.size() == 2) {\r
-                                       Iterator<Resource> i = resources.iterator();\r
-                                       Shape s1 = new Shape(graph,i.next());\r
-                                       Shape s2 = new Shape(graph,i.next());\r
-                                       if (s1.getRelatedObjects(ShapeEditorResources.g3dResource.GeometryDefinitionOf).size() == 0 &&\r
-                                               s2.getRelatedObjects(ShapeEditorResources.g3dResource.GeometryDefinitionOf).size() == 0)\r
-                                               return true;\r
-\r
-                               }\r
-                               return false;\r
-                       }\r
-\r
-                       public GraphRequestStatus doChanges(Graph graph) {\r
-                               List<IGraphicsNode> list = parent.getSelectionAdapter().getSelectedObjects();\r
-                               if (list.size() != 2) {\r
-                                       showMessage("Link works between two objects");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               Resource r1 = list.get(0).getResource();\r
-                               Resource r2 = list.get(1).getResource();\r
-\r
-                               CSGShape shape1 = new CSGShape(graph,r1);\r
-                               CSGShape shape2 = new CSGShape(graph,r2);\r
-                               \r
-                               Point3d p = G3DTools.getPoint(shape2.getWorldPosition());\r
-                               AxisAngle4d aa = G3DTools.getOrientation(shape2.getWorldOrientation());\r
-                               //System.out.println(p + " " + aa);\r
-                               shape2.removeRelatedStatements(ShapeEditorResources.g3dResource.HasParent);\r
-                               r = shape2.getResource();\r
-                               //System.out.println("Link remove commit");\r
-                               //graph.commitChanges(ShapeEditorView.this);\r
-                               //shape1.getChild().add(shape2.toG3DNode()); //FIXME : stubcast\r
-                               shape1.addStatement(ShapeEditorResources.g3dResource.HasChild, shape2);\r
-                               // FIXME : this is needed\r
-                               //System.out.println("Link add commit");\r
-                               //graph.commitChanges(ShapeEditorView.this);\r
-                               //G3DTools.setTuple3(shape2.getWorldPosition(), p);\r
-                               //G3DTools.setOrientation(shape2.getWorldOrientation(), aa);\r
-                               G3DAPI.setWorldTransformation(shape2, p, aa);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void afterChanges(GraphRequestStatus status) {\r
-                               parent.getRenderingComposite().getDisplay().asyncExec(new Runnable(){\r
-                                       public void run() {\r
-                                               parent.getSelectionAdapter().updateSelection(new StructuredResourceSelection(r));\r
-                                       }\r
-                               });\r
-                       }\r
-               };\r
-               linkAction.setText("Link");\r
-               linkAction.setToolTipText("Link");\r
-               linkAction.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/link.png"));\r
-\r
-               unlinkAction = new WriteAction(parent,false) {\r
-                       Resource r;\r
-                       @Override\r
-                       public boolean usable(Graph graph,List<Resource> resources) {\r
-                               if (resources.size() == 1) {\r
-                                       Iterator<Resource> i = resources.iterator();\r
-                                       Shape s1 = new Shape(graph,i.next());\r
-                                       return (s1.getRelatedObjects(ShapeEditorResources.g3dResource.GeometryDefinitionOf).size() == 0\r
-                                                       && s1.getParent() != null && !s1.getParent()\r
-                                                       .getResource().equals(CSGModellingContribution.this.parent.getModelResource()));\r
-\r
-                               }\r
-                               return false;\r
-                       }\r
-\r
-                       public GraphRequestStatus doChanges(Graph graph) {\r
-                               List<IGraphicsNode> list = parent.getSelectionAdapter().getSelectedObjects();\r
-                               if (list.size() != 1) {\r
-                                       showMessage("Unlink works with one object");\r
-                                       return GraphRequestStatus.transactionCancel();\r
-                               }\r
-                               Resource r1 = list.get(0).getResource();\r
-\r
-                               CSGShape shape1 = new CSGShape(graph,r1);\r
-                               CSGModel m = new CSGModel(graph,CSGModellingContribution.this.parent.getModelResource());\r
-                               Point3d p = G3DTools.getPoint(shape1.getWorldPosition());\r
-                               AxisAngle4d aa = G3DTools.getOrientation(shape1.getWorldOrientation());\r
-                               shape1.removeRelatedStatements(ShapeEditorResources.g3dResource.HasParent);\r
-                               //graph.commitChanges(ShapeEditorView.this);\r
-                               m.addStatement(ShapeEditorResources.g3dResource.HasChild, shape1);\r
-                               // FIXME : this is needed\r
-                               //graph.commitChanges(ShapeEditorView.this);\r
-                               //G3DTools.setTuple3(shape1.getWorldPosition(), p);\r
-                               //G3DTools.setOrientation(shape1.getWorldOrientation(), aa);\r
-                               G3DAPI.setWorldTransformation(shape1, p, aa);\r
-                               r = shape1.getResource();\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void afterChanges(GraphRequestStatus status) {\r
-                               parent.getRenderingComposite().getDisplay().asyncExec(new Runnable(){\r
-                                       public void run() {\r
-                                               parent.getSelectionAdapter().updateSelection(new StructuredResourceSelection(r));\r
-                                       }\r
-                               });\r
-                       }\r
-               };\r
-               unlinkAction.setText("Unlink");\r
-               unlinkAction.setToolTipText("Unlink");\r
-               unlinkAction.setImageDescriptor(Activator.imageDescriptorFromPlugin(\r
-                               Activator.PLUGIN_ID, "icons/unlink.png"));\r
-\r
-               actions.add(unionAction);\r
-               actions.add(intersectionAction);\r
-               actions.add(differenceAction);\r
-               actions.add(splitAction);\r
-               actions.add(linkAction);\r
-               actions.add(unlinkAction);\r
-       }\r
-       \r
-       boolean contains(ArrayList<Resource> parentShape2sIds, Resource id) {\r
-               for (int i = 0; i < parentShape2sIds.size(); i++) {\r
-                       if (parentShape2sIds.get(i).equals(id))\r
-                               return true;\r
-\r
-               }\r
-               return false;\r
-       }\r
-       \r
-       boolean contains(Collection<IEntity> parentShape2sIds, Resource id) {\r
-               for (IEntity e : parentShape2sIds) {\r
-                       if (e.getResource().equals(id))\r
-                               return true;\r
-\r
-               }\r
-               return false;\r
-       }\r
-\r
-       private boolean createBooleanOp(BooleanOperation op, G3DNode parent,\r
-                       CSGShape shape1, List<IGraphicsNode> list) {\r
-\r
-               resetShape(op.toShape()); //FIXME : stubcast\r
-               // new boolean operation is added to the first shape's parent\r
-               // the parent is the model\r
-\r
-               Point3d refPos = G3DTools.getPoint(shape1.getLocalPosition());\r
-               G3DTools.setTuple3(op.getLocalPosition(), refPos);\r
-               refPos.negate();\r
-               G3DTools.addTuple3(shape1.getLocalPosition(), refPos);\r
-               op.removeRelatedStatements(ShapeEditorResources.csgResource.HasMainShape);\r
-               op.addStatement(ShapeEditorResources.csgResource.HasMainShape, shape1);\r
-               \r
-               if (!replaceShape(parent, shape1.toShape(), op.toShape())) { //FIXME : stubcast\r
-                       return false;\r
-               }\r
-               //model.getConsistOfSet().remove(shape1);\r
-               for (int i = 1; i < list.size(); i++) {\r
-                       CSGShape shape2 = new CSGShape(op.getGraph(),list.get(i).getResource());\r
-                       G3DTools.addTuple3(shape2.getLocalPosition(), refPos);\r
-                       G3DNode shape2parent = shape2.getParent();\r
-                       if (shape2parent != null) {\r
-                               // we'll must link before removing or shape will be deleted\r
-                               //op.addStatement(ShapeEditorResources.csgResource.HasSecondaryShape,shape2);                   \r
-                               //if (!replaceShape(shape2parent, shape2, null)) {\r
-                               //      op.removeStatement(ShapeEditorResources.csgResource.HasSecondaryShape, shape2);\r
-                               //      // shape couldn't be removed so we'll remove the link\r
-                               //}\r
-                               \r
-                               if (replaceShape(shape2parent, shape2.toShape(), null)) { //FIXME : stubcast\r
-                                       op.addStatement(ShapeEditorResources.csgResource.HasSecondaryShape,shape2);\r
-                               }\r
-                       }\r
-               }\r
-               // Commit is not needed because this is final call in all transactions\r
-               //graph.commitChanges(ShapeEditorView.this);\r
-               return true;\r
-       }\r
-\r
-       /**\r
-        * Replaces or removes parent from shape\r
-        * @param parent parent containing shape\r
-        * @param removed the shape\r
-        * @param added the replacing shape or null\r
-        * @return true if replacing or removing was successful\r
-        * @throws TransactionException\r
-        */\r
-       private boolean replaceShape(G3DNode parent, Shape removed, Shape added) {\r
-               assert (parent != null);\r
-               assert (removed != null);\r
-\r
-               \r
-               //CSGModel m = CSGModelFactory.create(parent.getGraph(),model);\r
-               if (parent.getResource().equals(this.parent.getModelResource())) {\r
-                       // parent is model (rootnode). \r
-                       // shape is connected to it with "Has Child" relation\r
-                       parent.removeStatement(ShapeEditorResources.g3dResource.HasChild, removed);\r
-                       if (added != null) {\r
-                               parent.addStatement(ShapeEditorResources.g3dResource.HasChild, added);\r
-                       }\r
-               } else {\r
-                       // the first shape's parent is boolean operation\r
-                       // so we must know if its connected as a primary shape or as a secondary shape\r
-                       if (!parent.isInstanceOf(ShapeEditorResources.csgResource.BooleanOperation)) {\r
-                               ErrorLogger.defaultLogError("Parent shape is not a boolean operation nor model ?!",null);\r
-                               return false;\r
-                       }\r
-                       BooleanOperation parentOp = new BooleanOperation(parent);\r
-                       // listing all secondary shapes in the parent boolean operation\r
-                       Collection<CSGShape> parentShape2s = parentOp.getSecondaryShape();\r
-                       ArrayList<Resource> parentShape2sIds = new ArrayList<Resource>();\r
-                       for (CSGShape shape2 : parentShape2s)\r
-                               parentShape2sIds.add(shape2.getResource());\r
-                       if (parentOp.getMainShape().getResource().equals(removed.getResource())) {\r
-                               if (added == null) {\r
-                                       return false;\r
-                               }\r
-                               parent.removeStatement(ShapeEditorResources.csgResource.HasMainShape, removed);\r
-                               parent.addStatement(ShapeEditorResources.csgResource.HasMainShape, added);\r
-                       \r
-                       } else if (contains(parentShape2sIds, removed.getResource())) {\r
-\r
-                               parent.removeStatement(ShapeEditorResources.csgResource.HasSecondaryShape, removed);\r
-                               parent.addStatement(ShapeEditorResources.csgResource.HasSecondaryShape, added); \r
-               \r
-                       } else {\r
-                               ErrorLogger.defaultLogError("Parent shape is not a boolean operation nor model ?!",null);\r
-                               //coreTC.cancelTransaction();\r
-                               return false;\r
-                       }\r
-               }\r
-               return true;\r
-       }\r
-\r
-       /**\r
-        * Resets shape to identity rotation and zero translation\r
-        * \r
-        * @param shape\r
-        */\r
-       private void resetShape(Shape shape) {\r
-               G3DTools.resetTransformation(shape);\r
-               Graph graph = shape.getGraph();\r
-               if (shape.isInstanceOf(ShapeEditorResources.csgResource.Primitive)) {\r
-                       Primitive prim = new Primitive(shape);\r
-                       Collection<Property> c = prim.getSizingProperty();\r
-                       if (c.size() == 0)\r
-                               ErrorLogger.getDefault().logWarning("Shape does not contain sizing properties.", null);\r
-                       \r
-                       for (Property p : c) {\r
-                               if (p.isInstanceOf(graph.getBuiltins().Double)) {\r
-                                       graph.setScalarDouble(p.getResource(), 1.0);\r
-                               } else if (p.isInstanceOf(graph.getBuiltins().Integer)) {\r
-                                       graph.setScalarInteger(p.getResource(), 1);\r
-                               } else {\r
-                                       ErrorLogger.getDefault().logWarning("Cannot handle sizing property " + p.getName() , null);\r
-                               }\r
-                       }\r
-               }\r
-               \r
-       }\r
-       \r
-       protected void showMessage(String s) {\r
-               parent.showMessage(s);\r
-       }\r
-       \r
-       @Override\r
-       public Collection<ContextAction> getActions() {\r
-               return actions;\r
-       }\r
-       \r
-       \r
-       @Override\r
-       public void fillLocalToolBar(IToolBarManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalPullDown(IMenuManager manager) {\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void dispose() {\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void run() {\r
-\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/ParameterizationContribution.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/tools/ParameterizationContribution.java
deleted file mode 100644 (file)
index 3f1fefa..0000000
+++ /dev/null
@@ -1,680 +0,0 @@
-package org.simantics.proconf.g3d.shapeeditor.tools;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.dialogs.InputDialog;\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.layout.FormAttachment;\r
-import org.eclipse.swt.layout.FormData;\r
-import org.eclipse.swt.layout.FormLayout;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Listener;\r
-import org.eclipse.swt.widgets.Sash;\r
-import org.eclipse.swt.widgets.Tree;\r
-import org.eclipse.ui.forms.IFormColors;\r
-import org.eclipse.ui.forms.events.ExpansionAdapter;\r
-import org.eclipse.ui.forms.events.ExpansionEvent;\r
-import org.eclipse.ui.forms.widgets.FormToolkit;\r
-import org.eclipse.ui.forms.widgets.ScrolledForm;\r
-import org.eclipse.ui.forms.widgets.Section;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.equation.stubs.SecondOrderScalarPolynomial;\r
-import org.simantics.g2d.stubs.anim.Animation;\r
-import org.simantics.g2d.stubs.anim.Interpolator;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.ResourceDebugUtils;\r
-import org.simantics.proconf.browsing.GraphExplorer;\r
-import org.simantics.proconf.browsing.GraphExplorerInputFactory;\r
-import org.simantics.proconf.browsing.views.PropertyTable;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.base.EditorContribution;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
-import org.simantics.proconf.g3d.shapeeditor.common.ViewpointGenerator;\r
-import org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorBase;\r
-import org.simantics.proconf.g3d.stubs.G3DModel;\r
-import org.simantics.proconf.g3d.tools.OESelectionListener;\r
-import org.simantics.proconf.g3d.tools.PropertyTree;\r
-import org.simantics.utils.ui.jface.BaseSelectionProvider;\r
-\r
-\r
-public class ParameterizationContribution implements EditorContribution {\r
-\r
-       private ShapeEditorBase parent;\r
-       private List<ContextAction> actions = new ArrayList<ContextAction>();\r
-       private Composite sideComposite;\r
-       private Sash sash;\r
-       \r
-       \r
-       public ParameterizationContribution(ThreeDimensionalEditorBase parent) {\r
-               this.parent = (ShapeEditorBase) parent;\r
-       }\r
-       \r
-       @Override\r
-       public void createControl(final Composite parentComposite) {\r
-               FormLayout flayout = new FormLayout();\r
-               parentComposite.setLayout(flayout);\r
-               sash = new Sash(parentComposite,SWT.VERTICAL);\r
-               \r
-               sideComposite = new Composite(parentComposite,SWT.BORDER);\r
-               FormData data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(sash, 0, SWT.LEFT);\r
-               data.bottom = new FormAttachment(100,0);\r
-               this.parent.getRenderingComposite().setLayoutData(data);\r
-               sideComposite.setLayout(new FillLayout(SWT.VERTICAL));\r
-               data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.bottom = new FormAttachment(100,0);\r
-               data.right = new FormAttachment(100,0);\r
-               data.left = new FormAttachment(sash,0,SWT.RIGHT);\r
-               sideComposite.setLayoutData(data);\r
-               \r
-               final int limit = 20, percent = 50;\r
-               final FormData sashData = new FormData();\r
-               sashData.left = new FormAttachment (percent, 0);\r
-               sashData.top = new FormAttachment(0, 0);\r
-               sashData.bottom = new FormAttachment(100,0);\r
-               \r
-               sash.setLayoutData (sashData);\r
-               sash.addListener (SWT.Selection, new Listener () {\r
-                       public void handleEvent (Event e) {\r
-                               Rectangle sashRect = sash.getBounds ();\r
-                               Rectangle shellRect = parentComposite.getClientArea ();\r
-                               int right = shellRect.width - sashRect.width - limit;\r
-                               e.x = Math.max (Math.min (e.x, right), limit);\r
-                               if (e.x != sashRect.x)  {\r
-                                       sashData.left = new FormAttachment (0, e.x);\r
-                                       parentComposite.layout ();\r
-                               }\r
-                       }\r
-               });\r
-               createForm(sideComposite);\r
-               \r
-               hierarchyExplorer.setInput(parent.getSessionContext(),GraphExplorerInputFactory.clone(hierarchyExplorer.getInput())\r
-                   .input(parent.getModelResource())\r
-                   .viewpoint(ViewpointGenerator.createObjectStructureViewpoint())\r
-                   .toInput());\r
-\r
-//        parameterExplorer.setInput(parent.getSessionContext(),GraphExplorerInputFactory.clone(parameterExplorer.getInput())\r
-//                .input(parent.getModelResource())\r
-//                .viewpoint(ViewpointGenerator.createObjectSizingParameterViewpoint(ShapeEditorResources.g3dResource.HasSizingParameter))\r
-//                .toInput());\r
-               parameterTable.setSession(parent.getSession());\r
-               parameterTable.setInput(new StructuredResourceSelection(parent.getModelResource()));\r
-        \r
-       }\r
-       \r
-       @Override\r
-       public void disposeControl() {\r
-               sideComposite.dispose();\r
-               sash.dispose();\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void dispose() {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillContextMenu(Graph graph, IMenuManager manager,\r
-                       StructuredResourceSelection selection) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalPullDown(IMenuManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalToolBar(IToolBarManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public Collection<ContextAction> getActions() {\r
-               return actions;\r
-       }\r
-       \r
-       @Override\r
-       public String getName() {\r
-               return "Parameterization";\r
-       }\r
-       \r
-       @Override\r
-       public void initialize(Graph graph) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void run() {\r
-               \r
-       }\r
-       \r
-       private ScrolledForm form;\r
-       private BaseSelectionProvider defaultInputSelectionProvider = new BaseSelectionProvider();\r
-       protected FormToolkit toolkit;\r
-       \r
-\r
-    \r
-    private void createForm(Composite parent) {\r
-       toolkit = new FormToolkit(parent.getDisplay());\r
-               form = getToolkit().createScrolledForm(parent);\r
-\r
-               GridLayout layout = new GridLayout(2, false);\r
-               form.getBody().setLayout(layout);\r
-               form.getBody().setLayoutData(\r
-                               new GridData(GridData.FILL, GridData.FILL, true, true));\r
-\r
-               // By default make this ViewPart use a default ISelectionProvider\r
-               // that will offer the viewparts input resource as its selection.\r
-               // The Resource is wrapped into a ResourceSelection object.\r
-               // Any widgets created in createWidgets may override the default\r
-               // selection provider.\r
-               //getEditorSite().setSelectionProvider(defaultInputSelectionProvider);\r
-\r
-               beforeCreateWidgets();\r
-               createWidgets();\r
-\r
-               //reload();\r
-\r
-               form.setText(getFormText());\r
-\r
-               // Finally Set the default selection which will have an effect only\r
-               // if nothing in createWidgets has overridden the default selection\r
-               // provider.\r
-//             ISelection s = ISelectionUtils\r
-//                             .createSelection(new StructuredResourceSelection(\r
-//                                             getInputResource()));\r
-//             defaultInputSelectionProvider.setSelection(s);\r
-    }\r
-    \r
-       \r
-       public ScrolledForm getActiveForm() {\r
-               return form;\r
-       }\r
-\r
-       protected Composite getBody() {\r
-               return form.getBody();\r
-       }\r
-       \r
-       public Composite newGridSection(int formColumns, int childColumns,\r
-                       boolean equalWidth, boolean grabVertical, String text,\r
-                       String description) {\r
-               return newGridSection(getBody(), formColumns, childColumns, equalWidth,\r
-                               grabVertical, text, description);\r
-       }\r
-\r
-       public Composite newGridSection(Composite parent, int formColumns,\r
-                       int childColumns, boolean equalWidth, boolean grabVertical,\r
-                       String text, String description) {\r
-               FormToolkit toolkit = getToolkit();\r
-\r
-               Section section = toolkit.createSection(parent, Section.DESCRIPTION\r
-                               | Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED);\r
-               section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,\r
-                               grabVertical, formColumns, 1));\r
-               section.addExpansionListener(new ExpansionAdapter() {\r
-                       public void expansionStateChanged(ExpansionEvent e) {\r
-                               //System.out.println("SinglePageTypeEditor: expansionStateChanged " + e);\r
-                               //reflow(true);\r
-                       }\r
-               });\r
-               section.setText(text);\r
-               section.setDescription(description);\r
-               Composite sectionClient = toolkit.createComposite(section);\r
-               sectionClient.setLayout(new GridLayout(childColumns, equalWidth));\r
-               sectionClient.setLayoutData(new GridData());\r
-               section.setClient(sectionClient);\r
-               return sectionClient;\r
-       }\r
-       \r
-       public FormToolkit getToolkit() {\r
-               return toolkit;\r
-       }\r
-       \r
-       public void reflow(boolean flushCache) {\r
-               //System.out.println("FormTypeEditorBase.reflow(" + flushCache + ")");\r
-               getActiveForm().reflow(flushCache);\r
-       }\r
-       \r
-       protected void beforeCreateWidgets() {\r
-       }\r
-       \r
-//     private TrackedText modelName = null;\r
-    StructuredResourceSelection hierarchySelection = new StructuredResourceSelection();\r
-    StructuredResourceSelection parameterSelection = new StructuredResourceSelection();\r
-    //GraphExplorer parameterExplorer;\r
-    PropertyTable parameterTable;\r
-    GraphExplorer hierarchyExplorer;\r
-    Button deleteParameterButton;\r
-    Button clearButton;\r
-    PropertyTree propertiesTree;\r
-    Button generateButton;\r
-    Button askButton;\r
-    Button overrideButton;\r
-    \r
-    protected String getFormText() {\r
-        return "Parameterization Editor";\r
-    }\r
-\r
-    protected void createWidgets() {\r
-        createModelPropertiesGroup(newGridSection(2, 1, false, false, "Model Properties",\r
-        "Basic properties for this viewpoint"));\r
-        createParametrizationGroup(newGridSection(2, 1, false, false, "Parameterization",\r
-        "Create parameterization for selected shapes"));\r
-        //getSite().setSelectionProvider(this);\r
-    }\r
-    \r
-    private void createParametrizationGroup(Composite parent) {\r
-        toolkit.paintBordersFor(parent);\r
-        toolkit.setBorderStyle(SWT.BORDER);\r
-        \r
-        overrideButton = toolkit.createButton(parent, "Overwrite previous parameterizations", SWT.CHECK);\r
-        overrideButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                askButton.setEnabled(overrideButton.getSelection());\r
-                \r
-            }\r
-        });\r
-\r
-        \r
-        askButton = toolkit.createButton(parent, "Ask before overwriting", SWT.CHECK);\r
-        askButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                \r
-                \r
-            }\r
-        });\r
-        askButton.setEnabled(false);\r
-        \r
-        generateButton = toolkit.createButton(parent, "Generate linear parameterization", SWT.PUSH);\r
-        generateButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                generateMappings();\r
-                \r
-            }\r
-        });\r
-        generateButton.setEnabled(false);\r
-        \r
-        \r
-    }\r
-    \r
-    private void createModelPropertiesGroup(final Composite parent) {\r
-  \r
-        toolkit.paintBordersFor(parent);\r
-        toolkit.setBorderStyle(SWT.BORDER);\r
-        \r
-        GridData gridData1 = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);\r
-        \r
-        \r
-        // Parameters\r
-        Label parameterLabel = toolkit.createLabel(parent, "Parameters:");\r
-        parameterLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));\r
-        parameterLabel.setLayoutData(gridData1);\r
-        \r
-//        parameterExplorer = new GraphExplorer(parent, SWT.SINGLE); //new OntologyExplorer("ParameterExplorer", this, getInput("ParameterExplorer", model.getId()));\r
-//        parameterExplorer.getViewer().addPostSelectionChangedListener(new OESelectionListener() {\r
-//\r
-//           protected void resourceSelectionUpdated(StructuredResourceSelection sel) {\r
-//                parameterSelection = sel;\r
-//               if (parameterSelection.size() == 0) {\r
-//                   deleteParameterButton.setEnabled(false);\r
-//                   clearButton.setEnabled(false);\r
-//               } else {\r
-//                   deleteParameterButton.setEnabled(true);\r
-//                   clearButton.setEnabled(true);\r
-//               }\r
-//               updateGenerateButtonStatus();\r
-//           }\r
-//             \r
-//        });\r
-//        Tree oe = parameterExplorer.getTree();\r
-//        toolkit.adapt(oe, true, true);\r
-        \r
-        parameterTable = new PropertyTable(parent,SWT.NONE);\r
-        parameterTable.getViewer().addPostSelectionChangedListener(new OESelectionListener() {\r
-\r
-           protected void resourceSelectionUpdated(StructuredResourceSelection sel) {\r
-                  parameterSelection = sel;\r
-               if (parameterSelection.size() == 0) {\r
-                   deleteParameterButton.setEnabled(false);\r
-                   clearButton.setEnabled(false);\r
-               } else {\r
-                   deleteParameterButton.setEnabled(true);\r
-                   clearButton.setEnabled(true);\r
-               }\r
-               updateGenerateButtonStatus();\r
-           }\r
-               \r
-        });\r
-        \r
-        GridData gd3 = new GridData(GridData.FILL, GridData.FILL, true, true,1,1);\r
-        gd3.heightHint = 50;\r
-        //oe.setLayoutData(gd3);\r
-\r
-        parameterTable.setLayoutData(gd3);\r
-        \r
-        // Buttons to add and remove parameters\r
-        toolkit.createLabel(parent, "");\r
-        Composite buttons = toolkit.createComposite(parent);\r
-\r
-        buttons.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-        Button newParameterButton = toolkit.createButton(buttons, "New Parameter", SWT.PUSH);\r
-        newParameterButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                InputDialog dialog = new InputDialog(ParameterizationContribution.this.parent.getRenderingComposite().getShell(),"New Parameter","Enter parameter's name","new parameter",null);\r
-                if (dialog.open() == InputDialog.CANCEL)\r
-                    return;\r
-                final String name = dialog.getValue();\r
-                if (name.length() < 1) \r
-                    return; // TODO : show error\r
-                \r
-                ParameterizationContribution.this.parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               //fi.vtt.simantics.layer0.stubs.Double parameter = DoubleFactory.createDefault(g);\r
-                        //getModel(g).addStatement(ShapeEditorResources.g3dResource.HasSizingParameter, parameter);\r
-                        //parameter.setValue(new double[]{1.0});\r
-                        //parameter.setName(name);\r
-                               Resource parameter = ParameterizationContribution.this.parent.getModel(g).addRelatedScalarDouble(ShapeEditorResources.g3dResource.HasSizingParameter, 1.0).getResource();\r
-                               IEntity thing = EntityFactory.create(g,parameter);\r
-                               thing.setName(name);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       };\r
-                });\r
-                    \r
-                \r
-            }\r
-        });\r
-        deleteParameterButton = toolkit.createButton(buttons, "Delete Parameter", SWT.PUSH);\r
-        deleteParameterButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                //StructuredResourceSelection s = (StructuredResourceSelection)parameterScheme.getSelection();\r
-               final StructuredResourceSelection s = parameterSelection;\r
-               if (s.size() != 1)\r
-                    return;\r
-               // we'll have to start write transaction, since we may have to change the graph\r
-               ParameterizationContribution.this.parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       boolean proceed;\r
-                       IEntity selectedParameter;\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                selectedParameter = EntityFactory.create(g,s.getSelectionList().get(0));\r
-                               \r
-                        Collection<IEntity> parameters = selectedParameter.getRelatedObjects(ShapeEditorResources.g3dResource.HasSizingParameter);\r
-                        if (parameters.size() > 0) {\r
-                            final MessageDialog dialog = new MessageDialog(ParameterizationContribution.this.parent.getRenderingComposite().getShell(),"Deleting a parameter",null,"Parameter is in use, doe you wan't to remove it?",MessageDialog.QUESTION,new String[]{"OK","Cancel"},1);\r
-                            parent.getDisplay().syncExec(new Runnable() {\r
-                               @Override\r
-                               public void run() {\r
-                                        proceed = (dialog.open() != 1);\r
-                               }\r
-                            });\r
-                            if (proceed) {\r
-                               ParameterizationContribution.this.parent.getModel(g).removeStatement(ShapeEditorResources.g3dResource.HasSizingParameter,selectedParameter);\r
-                                       }\r
-                        }\r
-                       \r
-                        return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-            }\r
-        });\r
-        deleteParameterButton.setEnabled(false);\r
-        \r
-        clearButton = toolkit.createButton(buttons, "Clear Parameter", SWT.PUSH);\r
-        clearButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                final StructuredResourceSelection s = parameterSelection;\r
-                if (s.size() != 1)\r
-                    return;\r
-                ParameterizationContribution.this.parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       boolean proceed;\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                IEntity selectedParameter = EntityFactory.create(g,s.getSelectionList().get(0));\r
-                         Collection<IEntity> equations = selectedParameter.getRelatedObjects(ShapeEditorResources.equationResource.HasTarget);\r
-                                final String name = selectedParameter.getName();\r
-                                if (equations.size() > 0) {\r
-                                        final MessageDialog dialog = new MessageDialog(ParameterizationContribution.this.parent.getRenderingComposite().getShell(),"Clearing a parameter",null,"Do you wan't to clear parameterization for "+ name + " ?\nIt has " + equations.size() + " mappings.",MessageDialog.QUESTION,new String[]{"OK","Cancel"},1);     \r
-                                        parent.getDisplay().syncExec(new Runnable() {\r
-                                                public void run() {\r
-                                                        proceed = (dialog.open() != 1);\r
-                                                };\r
-                                        });\r
-                                        if (proceed) {\r
-                                                for (IEntity eq : equations) {\r
-                                                        eq.removeRelatedStatements(ShapeEditorResources.equationResource.HasSource);\r
-                                                        eq.removeRelatedStatements(ShapeEditorResources.equationResource.HasTarget);\r
-                                                }\r
-                                                return GraphRequestStatus.transactionComplete();\r
-                                        }\r
-                                }\r
-                                return GraphRequestStatus.transactionCancel();\r
-                       }\r
-                });\r
-            \r
-                \r
-            }\r
-        });\r
-        clearButton.setEnabled(false);\r
-        \r
-        Label hierarchyLabel = toolkit.createLabel(parent, "Model Hierarchy:");\r
-        hierarchyLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));\r
-        hierarchyLabel.setLayoutData(gridData1);\r
-        \r
-        hierarchyExplorer = new GraphExplorer(parent,SWT.MULTI); //new OntologyExplorer("HierarchyExplorer", this, getInput("HierarchyExplorer", model.getId()));\r
-        Tree oeh = hierarchyExplorer.getTree();//hierarchyExplorer.getControl(parent, 1, OntologyExplorer.OntologyTree, SWT.MULTI);\r
-        toolkit.adapt(oeh, true, true);\r
-        \r
-        GridData gd4 = new GridData(GridData.FILL, GridData.FILL, true, true,1,1);\r
-        gd4.heightHint = 200;\r
-        oeh.setLayoutData(gd4);\r
-        hierarchyExplorer.getViewer().addPostSelectionChangedListener(new OESelectionListener() {\r
-\r
-          protected void resourceSelectionUpdated(StructuredResourceSelection sel) {\r
-                 hierarchySelection = sel;\r
-              updatePropertiesTable();\r
-              updateGenerateButtonStatus();\r
-          }\r
-  \r
-          private void updatePropertiesTable() {\r
-              propertiesTree.setProperties(hierarchySelection);\r
-              \r
-          }\r
-               \r
-        });\r
-\r
-        Label propertiesLabel = toolkit.createLabel(parent, "Available properties:");\r
-        propertiesLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));\r
-        propertiesLabel.setLayoutData(gridData1); \r
-        \r
-        //propertiesTable = toolkit.createTable(parent, SWT.MULTI);\r
-        Tree tree = toolkit.createTree(parent, SWT.MULTI);\r
-        propertiesTree = new PropertyTree(tree,ParameterizationContribution.this.parent.getSession());\r
-        //\r
-        GridData gd5 = new GridData(GridData.FILL, GridData.FILL, true, true,1,1);\r
-        gd5.heightHint = 200;\r
-        //propertiesTable.setLayoutData(gd5);\r
-        tree.setLayoutData(gd5);\r
-        tree.addSelectionListener(new SelectionAdapter() {\r
-\r
-            @Override\r
-            public void widgetSelected(SelectionEvent e) {\r
-                updateGenerateButtonStatus();\r
-            }\r
-            \r
-        });\r
-\r
-        \r
-    }\r
-       \r
-    private void updateGenerateButtonStatus() {\r
-        if (parameterSelection.size() == 0) {\r
-            generateButton.setEnabled(false);\r
-            return;\r
-        }\r
-        if (hierarchySelection.size() == 0) {\r
-            generateButton.setEnabled(false);\r
-            return;\r
-        }\r
-        if (propertiesTree.getTree().getSelection().length == 0) {\r
-            generateButton.setEnabled(false);\r
-            return;\r
-        }\r
-        generateButton.setEnabled(true);\r
-    }\r
-    \r
-    List<Resource> res;\r
-    \r
-    private void generateMappings() {\r
-               final StructuredResourceSelection selectedShapes = hierarchySelection;\r
-               final StructuredResourceSelection selectedParameter = parameterSelection;\r
-               \r
-               final boolean override = overrideButton.getSelection();\r
-               final boolean ask = askButton.getSelection();\r
-               //TreeItem[] selectedProperties = propertiesTree.getTree().getSelection();\r
-               \r
-               assert (selectedParameter.size() == 1);\r
-               assert (selectedShapes.size() > 0);\r
-               //assert(selectedProperties.length > 0);\r
-               parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               //fi.vtt.simantics.layer0.stubs.Double parameter = DoubleFactory.create(g,selectedParameter.getSelectionList().get(0));\r
-                               IEntity parameter = EntityFactory.create(g,selectedParameter.getSelectionList().get(0));\r
-                               Collection<IEntity> prop = parameter.getRelatedObjects(ShapeEditorResources.g3dResource.HasDefaultDoubleValue);\r
-                               //fi.vtt.simantics.layer0.stubs.Double defaultValue;\r
-                               double value = g.getScalarDouble(parameter.getResource());\r
-                               if (prop.size() == 0) {\r
-                                       //defaultValue = DoubleFactory.createDefault(g);\r
-                                       //parameter.addStatement(ShapeEditorResources.g3dResource.HasDefaultDoubleValue, defaultValue);\r
-                                       parameter.addRelatedScalarDouble(ShapeEditorResources.g3dResource.HasDefaultDoubleValue, value);\r
-                               } else {\r
-                                       //defaultValue = DoubleFactory.create(prop.iterator().next());\r
-                                       g.setScalarDouble(prop.iterator().next().getResource(),value);\r
-                               }\r
-                               //defaultValue.setValue(parameter.getValue());\r
-                               final Graph graph = g;\r
-                               parent.getRenderingComposite().getDisplay().syncExec(new Runnable() {\r
-                                       public void run() {\r
-                                               res = propertiesTree.findLeafPropertyInstances(graph, selectedShapes.getSelectionList());\r
-                                       };\r
-                               });\r
-                                \r
-                               \r
-                               double refValue = parameter.toProperty().getScalarDouble();\r
-                               ArrayList<Resource> mappedProperties = new ArrayList<Resource>();\r
-                               \r
-                               for (Resource r : res) {\r
-                                       IEntity propertyThing = EntityFactory.create(g,r);\r
-                                       assert (propertyThing.isInstanceOf(g.getBuiltins().Double));\r
-                                       final String name = ResourceDebugUtils.getReadableNameForEntity(propertyThing);\r
-                                       double rb = propertyThing.toProperty().getScalarDouble();\r
-                                       System.out.println("Mapping to " + name + " " + rb);\r
-                                       Collection<IEntity> equations = propertyThing.getRelatedObjects(ShapeEditorResources.equationResource.HasSource);\r
-                                       if (equations.size() != 0) {\r
-                                               mappedProperties.add(propertyThing.getResource());\r
-                                               if (override) {\r
-                                                       System.out.println("Override");\r
-                                                       boolean over = true;\r
-                                                       if (ask) {\r
-                                                               IEntity t = propertyThing;\r
-                                                               while (t.isInstanceOf(g.getBuiltins().Property)) {\r
-                                                                       Collection<IEntity> ts = t.getRelatedObjects(g.getBuiltins().PropertyOf);\r
-                                                                       // FIXME : traverse all possible routes\r
-                                                                       t = ts.iterator().next();\r
-                                                               }\r
-                                                               //StructuredResourceSelection selection = new StructuredResourceSelection(t.getResource());\r
-                                                               // TODO : do the selection!\r
-                                                               //hierarchyScheme.setSelection(selection);\r
-                                                               //fireSelectionChanged();\r
-                                                               MessageDialog dialog = new MessageDialog(ParameterizationContribution.this.parent.getRenderingComposite().getShell(),\r
-                                                                               "Override mapping",\r
-                                                                               null,\r
-                                                                               "Override mapping to property of highlighted shape?",\r
-                                                                               MessageDialog.QUESTION, new String[] {\r
-                                                                                               "Yes","No", "Cancel" }, 0);\r
-                                                               int i = dialog.open();\r
-                                                               if (i == 2)\r
-                                                                       return GraphRequestStatus.transactionCancel();\r
-                                                               over = (i == 0);\r
-                                                       }\r
-                                                       if (over) {\r
-                                                               \r
-                                                       }\r
-                                               } else {\r
-                                                       if (equations.size() != 1) {\r
-                                                               throw new RuntimeException("One property can have only one euquation as source function.");\r
-                                                       }\r
-                                                       IEntity equation = equations.iterator().next();\r
-                                                       if (!equation.isInstanceOf(ShapeEditorResources.equationResource.SecondOrderScalarPolynomial)) {\r
-                                                               throw new RuntimeException("Only Second order scalar polynomials are supported");\r
-                                                       }\r
-                                                       SecondOrderScalarPolynomial s = new SecondOrderScalarPolynomial(equation);\r
-                                                       s.setA(new double[]{0.0});\r
-                                                       s.setB(new double[]{rb / refValue});\r
-                                                       s.setC(new double[]{0.0});\r
-                                                               \r
-                                               }\r
-                                       } else { //override\r
-                                               // create relation\r
-                                               SecondOrderScalarPolynomial s = SecondOrderScalarPolynomial.createDefault(g);\r
-                                               s.setA(new double[]{0.0});\r
-                                               s.setB(new double[]{rb / refValue});\r
-                                               s.setC(new double[]{0.0});\r
-                                               \r
-                                               // these relations have been instantiated, but addStatements won't delete them so we have to delete them manually.\r
-                                               s.removeRelatedStatements(ShapeEditorResources.equationResource.HasTarget);\r
-                                               s.removeRelatedStatements(ShapeEditorResources.equationResource.HasSource);\r
-                                               \r
-                                               parameter.addStatement(ShapeEditorResources.equationResource.HasTarget, s);\r
-                                               \r
-                                               s.addStatement(ShapeEditorResources.equationResource.HasTarget, propertyThing);\r
-                                               mappedProperties.add(propertyThing.getResource());\r
-                                       }\r
-                                       \r
-                               }\r
-                               G3DModel model = parent.getModel(g);\r
-                               Collection<Animation> animations = model.getAnimation();\r
-                               for (Animation animation : animations) {\r
-                                       Collection<Interpolator> interpolators = animation.getInterpolator();\r
-                                       for (Interpolator interpolator : interpolators) {\r
-                                               IEntity target = interpolator.getTarget();\r
-                                               for (Resource property : mappedProperties) {\r
-                                                       if (target.getResource().equals(property)) {\r
-                                                               ShapeEditorResources.curveBuilder.createDefault(interpolator);\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-\r
-\r
-\r
-       }\r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/CSGModellingView.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/CSGModellingView.java
deleted file mode 100644 (file)
index f2b8c84..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.views;\r
-\r
-import org.eclipse.swt.widgets.Composite;\r
-\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.layer0.utils.viewpoints.ResourceViewpoint;\r
-import org.simantics.proconf.browsing.GraphExplorer;\r
-import org.simantics.proconf.browsing.views.GraphExplorerView;\r
-import org.simantics.proconf.g3d.shapeeditor.common.ViewpointGenerator;\r
-\r
-public class CSGModellingView extends GraphExplorerView {\r
-\r
-       @Override\r
-       protected GraphExplorer createExplorer(Composite parent) {\r
-               return super.createExplorer(parent);\r
-       }\r
-       \r
-       @Override\r
-       protected ResourceViewpoint getViewpoint(ISessionContext context) {\r
-               return ViewpointGenerator.createViewpoint();\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ParameterizationEditor.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ParameterizationEditor.java
deleted file mode 100644 (file)
index 07dc17c..0000000
+++ /dev/null
@@ -1,587 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.views;\r
-\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.dialogs.InputDialog;\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.eclipse.swt.widgets.Tree;\r
-import org.eclipse.ui.forms.IFormColors;\r
-import org.simantics.proconf.g3d.csg.stubs.CSGModel;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.equation.stubs.SecondOrderScalarPolynomial;\r
-import org.simantics.g2d.stubs.anim.Animation;\r
-import org.simantics.g2d.stubs.anim.Interpolator;\r
-import org.simantics.layer0.utils.ResourceDebugUtils;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.proconf.browsing.GraphExplorer;\r
-import org.simantics.proconf.browsing.GraphExplorerInputFactory;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
-import org.simantics.proconf.g3d.shapeeditor.common.ViewpointGenerator;\r
-import org.simantics.proconf.g3d.tools.OESelectionListener;\r
-import org.simantics.proconf.g3d.tools.PropertyTree;\r
-import org.simantics.proconf.g3d.views.SinglePageResourceEditor;\r
-import org.simantics.utils.ui.widgets.TrackedModifyEvent;\r
-import org.simantics.utils.ui.widgets.TrackedModifyListener;\r
-import org.simantics.utils.ui.widgets.TrackedText;\r
-\r
-\r
-public class ParameterizationEditor extends SinglePageResourceEditor { //implements ISelectionProvider{\r
-    \r
-    //ParameterizedCSGModel model;\r
-       Resource modelResource;\r
-    private TrackedText modelName = null;\r
-    StructuredResourceSelection hierarchySelection = new StructuredResourceSelection();\r
-    StructuredResourceSelection parameterSelection = new StructuredResourceSelection();\r
-    GraphExplorer parameterExplorer;\r
-    GraphExplorer hierarchyExplorer;\r
-    Button deleteParameterButton;\r
-    Button clearButton;\r
-    PropertyTree propertiesTree;\r
-    Button generateButton;\r
-    Button askButton;\r
-    Button overrideButton;\r
-    Composite parent;\r
-    \r
-    \r
-    @Override\r
-    protected String getFormText() {\r
-        return "Parameterization Editor";\r
-    }\r
-\r
-//    @Override\r
-//    protected void beforeCreateWidgets() {\r
-//        if (!(getInputResource().isInstanceOf(GlobalIdMap.get(CSGModelingOntologyMapping.PARAMETERIZED_CSG_MODEL))))\r
-//            throw new RuntimeException("Trying to open resource that is not paramaterized CSG model");\r
-//        model = ParameterizedCSGModelFactory.create(getInputResource());\r
-//    }\r
-    \r
-    \r
-\r
-    @Override\r
-    protected void createWidgets() {\r
-        createModelPropertiesGroup(newGridSection(2, 2, false, false, "Model Properties",\r
-        "Basic properties for this viewpoint"));\r
-        createParametrizationGroup(newGridSection(2, 2, false, false, "Parameterization",\r
-        "Create parameterization for selected shapes"));\r
-        //getSite().setSelectionProvider(this);\r
-    }\r
-\r
-    @Override\r
-    public void reload(Graph graph) {\r
-       modelResource = getInputResource();\r
-       parent.getDisplay().asyncExec(new Runnable() {\r
-        @Override\r
-       public void run() {\r
-               reload();\r
-       }  \r
-       });\r
-\r
-    }\r
-    \r
-    public void reload() {\r
-\r
-           hierarchyExplorer.setInput(getSessionContext(),GraphExplorerInputFactory.clone(hierarchyExplorer.getInput())\r
-                   .input(modelResource)\r
-                   .viewpoint(ViewpointGenerator.createObjectStructureViewpoint())\r
-                   .toInput());\r
-\r
-            parameterExplorer.setInput(getSessionContext(),GraphExplorerInputFactory.clone(parameterExplorer.getInput())\r
-                    .input(modelResource)\r
-                    .viewpoint(ViewpointGenerator.createObjectSizingParameterViewpoint(ShapeEditorResources.g3dResource.HasSizingParameter))\r
-                    .toInput());\r
-\r
-    }\r
-    \r
-    private void createParametrizationGroup(Composite parent) {\r
-        toolkit.paintBordersFor(parent);\r
-        toolkit.setBorderStyle(SWT.BORDER);\r
-        \r
-        overrideButton = toolkit.createButton(parent, "Overwrite previous parameterizations", SWT.CHECK);\r
-        overrideButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                askButton.setEnabled(overrideButton.getSelection());\r
-                \r
-            }\r
-        });\r
-\r
-        \r
-        askButton = toolkit.createButton(parent, "Ask before overwriting", SWT.CHECK);\r
-        askButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                \r
-                \r
-            }\r
-        });\r
-        askButton.setEnabled(false);\r
-        \r
-        generateButton = toolkit.createButton(parent, "Generate linear parameterization", SWT.PUSH);\r
-        generateButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                generateMappings();\r
-                \r
-            }\r
-        });\r
-        generateButton.setEnabled(false);\r
-        \r
-        \r
-    }\r
-    \r
-    private CSGModel getModel(Graph graph) {\r
-       return new CSGModel(graph, modelResource);\r
-    }\r
-    \r
-    private void createModelPropertiesGroup(Composite p) {\r
-       parent = p;\r
-        toolkit.paintBordersFor(parent);\r
-        toolkit.setBorderStyle(SWT.BORDER);\r
-        \r
-        GridData gridData1 = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);\r
-        GridData gridData2 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);\r
-\r
-        // Name\r
-        Label l1 = toolkit.createLabel(parent, "Name:");\r
-        l1.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));\r
-        Text text = toolkit.createText(parent, "TODO: Insert model's name here", SWT.SINGLE);\r
-        GridData textLayout = new GridData(GridData.FILL, GridData.FILL, true, true);\r
-        text.setLayoutData(textLayout);\r
-        modelName = new TrackedText(text);\r
-        modelName.addModifyListener(new TrackedModifyListener(){\r
-               @Override\r
-               public void modifyText(TrackedModifyEvent e) {\r
-                       final String name = e.getText();\r
-                       getSession().asyncWrite(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       getModel(g).setName(name);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-               }\r
-        });\r
-        \r
-        l1.setLayoutData(gridData1);\r
-        text.setLayoutData(gridData2);\r
-        \r
-        \r
-        // Parameters\r
-        Label parameterLabel = toolkit.createLabel(parent, "Parameters:");\r
-        parameterLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));\r
-        parameterLabel.setLayoutData(gridData1);\r
-        \r
-        parameterExplorer = new GraphExplorer(parent, SWT.SINGLE); //new OntologyExplorer("ParameterExplorer", this, getInput("ParameterExplorer", model.getId()));\r
-        parameterExplorer.getViewer().addPostSelectionChangedListener(new OESelectionListener() {\r
-\r
-           protected void resourceSelectionUpdated(StructuredResourceSelection sel) {\r
-                  parameterSelection = sel;\r
-               if (parameterSelection.size() == 0) {\r
-                   deleteParameterButton.setEnabled(false);\r
-                   clearButton.setEnabled(false);\r
-               } else {\r
-                   deleteParameterButton.setEnabled(true);\r
-                   clearButton.setEnabled(true);\r
-               }\r
-               updateGenerateButtonStatus();\r
-           }\r
-               \r
-        });\r
-        Tree oe = parameterExplorer.getTree();\r
-        toolkit.adapt(oe, true, true);\r
-        GridData gd3 = new GridData(GridData.FILL, GridData.FILL, true, true,1,1);\r
-        gd3.heightHint = 50;\r
-        oe.setLayoutData(gd3);\r
-//        parameterExplorer.init(getLastMemento(), ViewpointUtils.getModelledHandler(parameterExplorer.getGraph(), Builtins.DefaultViewpointId), null, ViewLabelProviderDecorationSettings.DEFAULT, new MenuAboutToShowAction(), new NullAdditionAction(), false);\r
-//        parameterScheme = new ParameterSelectionScheme(parameterExplorer);\r
-//        parameterExplorer.setSelectionScheme(parameterScheme);\r
-        \r
-        // Buttons to add and remove parameters\r
-        toolkit.createLabel(parent, "");\r
-        Composite buttons = toolkit.createComposite(parent);\r
-\r
-        buttons.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-        Button newParameterButton = toolkit.createButton(buttons, "New Parameter", SWT.PUSH);\r
-        newParameterButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                InputDialog dialog = new InputDialog(ParameterizationEditor.this.getSite().getShell(),"New Parameter","Enter parameter's name","new parameter",null);\r
-                if (dialog.open() == InputDialog.CANCEL)\r
-                    return;\r
-                final String name = dialog.getValue();\r
-                if (name.length() < 1) \r
-                    return; // TODO : show error\r
-                \r
-                getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               //fi.vtt.simantics.layer0.stubs.Double parameter = DoubleFactory.createDefault(g);\r
-                        //getModel(g).addStatement(ShapeEditorResources.g3dResource.HasSizingParameter, parameter);\r
-                        //parameter.setValue(new double[]{1.0});\r
-                        //parameter.setName(name);\r
-                               Resource parameter = getModel(g).addRelatedScalarDouble(ShapeEditorResources.g3dResource.HasSizingParameter, 1.0).getResource();\r
-                               IEntity thing = EntityFactory.create(g,parameter);\r
-                               thing.setName(name);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       };\r
-                });\r
-                    \r
-                \r
-            }\r
-        });\r
-        deleteParameterButton = toolkit.createButton(buttons, "Delete Parameter", SWT.PUSH);\r
-        deleteParameterButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                //StructuredResourceSelection s = (StructuredResourceSelection)parameterScheme.getSelection();\r
-               final StructuredResourceSelection s = parameterSelection;\r
-               if (s.size() != 1)\r
-                    return;\r
-               // we'll have to start write transaction, since we may have to change the graph\r
-               getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       boolean proceed;\r
-                       IEntity selectedParameter;\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                selectedParameter = EntityFactory.create(g,s.getSelectionList().get(0));\r
-                               \r
-                        Collection<IEntity> parameters = selectedParameter.getRelatedObjects(ShapeEditorResources.g3dResource.HasSizingParameter);\r
-                        if (parameters.size() > 0) {\r
-                            final MessageDialog dialog = new MessageDialog(ParameterizationEditor.this.getSite().getShell(),"Deleting a parameter",null,"Parameter is in use, doe you wan't to remove it?",MessageDialog.QUESTION,new String[]{"OK","Cancel"},1);\r
-                            parent.getDisplay().syncExec(new Runnable() {\r
-                               @Override\r
-                               public void run() {\r
-                                        proceed = (dialog.open() != 1);\r
-                               }\r
-                            });\r
-                            if (proceed) {\r
-                                               getModel(g).removeStatement(ShapeEditorResources.g3dResource.HasSizingParameter,selectedParameter);\r
-                                       }\r
-                        }\r
-                       \r
-                        return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-            }\r
-        });\r
-        deleteParameterButton.setEnabled(false);\r
-        \r
-        clearButton = toolkit.createButton(buttons, "Clear Parameter", SWT.PUSH);\r
-        clearButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                final StructuredResourceSelection s = parameterSelection;\r
-                if (s.size() != 1)\r
-                    return;\r
-                getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       boolean proceed;\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                IEntity selectedParameter = EntityFactory.create(g,s.getSelectionList().get(0));\r
-                         Collection<IEntity> equations = selectedParameter.getRelatedObjects(ShapeEditorResources.equationResource.HasTarget);\r
-                                final String name = selectedParameter.getName();\r
-                                if (equations.size() > 0) {\r
-                                        final MessageDialog dialog = new MessageDialog(ParameterizationEditor.this.getSite().getShell(),"Clearing a parameter",null,"Do you wan't to clear parameterization for "+ name + " ?\nIt has " + equations.size() + " mappings.",MessageDialog.QUESTION,new String[]{"OK","Cancel"},1);        \r
-                                        parent.getDisplay().syncExec(new Runnable() {\r
-                                                public void run() {\r
-                                                        proceed = (dialog.open() != 1);\r
-                                                };\r
-                                        });\r
-                                        if (proceed) {\r
-                                                for (IEntity eq : equations) {\r
-                                                        eq.removeRelatedStatements(ShapeEditorResources.equationResource.HasSource);\r
-                                                        eq.removeRelatedStatements(ShapeEditorResources.equationResource.HasTarget);\r
-                                                }\r
-                                                return GraphRequestStatus.transactionComplete();\r
-                                        }\r
-                                }\r
-                                return GraphRequestStatus.transactionCancel();\r
-                       }\r
-                });\r
-            \r
-                \r
-            }\r
-        });\r
-        clearButton.setEnabled(false);\r
-        \r
-        Label hierarchyLabel = toolkit.createLabel(parent, "Model Hierarchy:");\r
-        hierarchyLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));\r
-        hierarchyLabel.setLayoutData(gridData1);\r
-        \r
-        hierarchyExplorer = new GraphExplorer(parent,SWT.MULTI); //new OntologyExplorer("HierarchyExplorer", this, getInput("HierarchyExplorer", model.getId()));\r
-        Tree oeh = hierarchyExplorer.getTree();//hierarchyExplorer.getControl(parent, 1, OntologyExplorer.OntologyTree, SWT.MULTI);\r
-        toolkit.adapt(oeh, true, true);\r
-        \r
-        GridData gd4 = new GridData(GridData.FILL, GridData.FILL, true, true,1,1);\r
-        gd4.heightHint = 200;\r
-        oeh.setLayoutData(gd4);\r
-        hierarchyExplorer.getViewer().addPostSelectionChangedListener(new OESelectionListener() {\r
-\r
-          protected void resourceSelectionUpdated(StructuredResourceSelection sel) {\r
-                 hierarchySelection = sel;\r
-              updatePropertiesTable();\r
-              updateGenerateButtonStatus();\r
-          }\r
-  \r
-          private void updatePropertiesTable() {\r
-              propertiesTree.setProperties(hierarchySelection);\r
-              \r
-          }\r
-               \r
-        });\r
-        //hierarchyExplorer.init(getLastMemento(), ViewpointUtils.getModelledHandler(hierarchyExplorer.getGraph(), CSGModelingOntologyMapping.CSG_MODEL_HIERARCHY_VIEWPOINT), null, ViewLabelProviderDecorationSettings.DEFAULT, new MenuAboutToShowAction(), new NullAdditionAction(), false);\r
-//        hierarchyScheme = new HierarchySelectionScheme(hierarchyExplorer);\r
-//        hierarchyExplorer.setSelectionScheme(hierarchyScheme);\r
-//        hierarchyExplorer.hookPageSelection(this);\r
-        Label propertiesLabel = toolkit.createLabel(parent, "Available properties:");\r
-        propertiesLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));\r
-        propertiesLabel.setLayoutData(gridData1); \r
-        \r
-        //propertiesTable = toolkit.createTable(parent, SWT.MULTI);\r
-        Tree tree = toolkit.createTree(parent, SWT.MULTI);\r
-        propertiesTree = new PropertyTree(tree,getSession());\r
-        //\r
-        GridData gd5 = new GridData(GridData.FILL, GridData.FILL, true, true,1,1);\r
-        gd5.heightHint = 200;\r
-        //propertiesTable.setLayoutData(gd5);\r
-        tree.setLayoutData(gd5);\r
-        tree.addSelectionListener(new SelectionAdapter() {\r
-\r
-            @Override\r
-            public void widgetSelected(SelectionEvent e) {\r
-                updateGenerateButtonStatus();\r
-            }\r
-            \r
-        });\r
-\r
-        \r
-    }\r
-    \r
-//    private class ParameterSelectionScheme extends AbstractSelectionScheme {\r
-//        \r
-//        public ParameterSelectionScheme(OntologyExplorer explorer) {\r
-//            super(explorer);\r
-//        }\r
-//\r
-//        @Override\r
-//        protected Resource getResourceForSelection(TreeNode selected) {\r
-//            Resource resource = explorer.getCoreResource(selected);\r
-//            System.out.println("Parameter Tree Selection : " + resource.getId());\r
-//            return resource;\r
-//        }\r
-//\r
-//        @Override\r
-//        protected void resourceSelectionUpdated() {\r
-//            if (selection.size() == 0) {\r
-//                deleteParameterButton.setEnabled(false);\r
-//                clearButton.setEnabled(false);\r
-//            } else {\r
-//                deleteParameterButton.setEnabled(true);\r
-//                clearButton.setEnabled(true);\r
-//            }\r
-//            updateGenerateButtonStatus();\r
-//        }\r
-//    }\r
-//    \r
-//    private class HierarchySelectionScheme extends AbstractSelectionScheme {\r
-//\r
-//        public HierarchySelectionScheme(OntologyExplorer explorer) {\r
-//            super(explorer);\r
-//        }\r
-//        \r
-//        @Override\r
-//        protected Resource getResourceForSelection(TreeNode selected) {\r
-//            Resource resource = explorer.getCoreResource(selected);\r
-//            System.out.println("Hierarchy Tree Selection : " + resource.getId());\r
-//            return resource;\r
-//        }\r
-//        \r
-//        @Override\r
-//        protected void resourceSelectionUpdated() {\r
-//            updatePropertiesTable();\r
-//            updateGenerateButtonStatus();\r
-//        }\r
-//\r
-//        private void updatePropertiesTable() {\r
-//            propertiesTree.setProperties(selection);\r
-//            \r
-//        }\r
-//        \r
-//    }\r
-    \r
-//    private boolean contains(Resource list[], Resource value) {\r
-//        for (int i = 0; i < list.length; i++) {\r
-//            if (list[i].equals(value))\r
-//                return true;\r
-//        }\r
-//        return false;\r
-//    }\r
-    \r
-    private void updateGenerateButtonStatus() {\r
-        if (parameterSelection.size() == 0) {\r
-            generateButton.setEnabled(false);\r
-            return;\r
-        }\r
-        if (hierarchySelection.size() == 0) {\r
-            generateButton.setEnabled(false);\r
-            return;\r
-        }\r
-        if (propertiesTree.getTree().getSelection().length == 0) {\r
-            generateButton.setEnabled(false);\r
-            return;\r
-        }\r
-        generateButton.setEnabled(true);\r
-    }\r
-    \r
-    List<Resource> res;\r
-    \r
-    private void generateMappings() {\r
-               final StructuredResourceSelection selectedShapes = hierarchySelection;\r
-               final StructuredResourceSelection selectedParameter = parameterSelection;\r
-               \r
-               final boolean override = overrideButton.getSelection();\r
-               final boolean ask = askButton.getSelection();\r
-               //TreeItem[] selectedProperties = propertiesTree.getTree().getSelection();\r
-               \r
-               assert (selectedParameter.size() == 1);\r
-               assert (selectedShapes.size() > 0);\r
-               //assert(selectedProperties.length > 0);\r
-               getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               //fi.vtt.simantics.layer0.stubs.Double parameter = DoubleFactory.create(g,selectedParameter.getSelectionList().get(0));\r
-                               IEntity parameter = EntityFactory.create(g,selectedParameter.getSelectionList().get(0));\r
-                               Collection<IEntity> prop = parameter.getRelatedObjects(ShapeEditorResources.g3dResource.HasDefaultDoubleValue);\r
-                               //fi.vtt.simantics.layer0.stubs.Double defaultValue;\r
-                               double value = g.getScalarDouble(parameter.getResource());\r
-                               if (prop.size() == 0) {\r
-                                       //defaultValue = DoubleFactory.createDefault(g);\r
-                                       //parameter.addStatement(ShapeEditorResources.g3dResource.HasDefaultDoubleValue, defaultValue);\r
-                                       parameter.addRelatedScalarDouble(ShapeEditorResources.g3dResource.HasDefaultDoubleValue, value);\r
-                               } else {\r
-                                       //defaultValue = DoubleFactory.create(prop.iterator().next());\r
-                                       g.setScalarDouble(prop.iterator().next().getResource(),value);\r
-                               }\r
-                               //defaultValue.setValue(parameter.getValue());\r
-                               final Graph graph = g;\r
-                               parent.getDisplay().syncExec(new Runnable() {\r
-                                       public void run() {\r
-                                               res = propertiesTree.findLeafPropertyInstances(graph, selectedShapes.getSelectionList());\r
-                                       };\r
-                               });\r
-                                \r
-                               \r
-                               double refValue = parameter.toProperty().getScalarDouble();\r
-                               ArrayList<Resource> mappedProperties = new ArrayList<Resource>();\r
-                               \r
-                               for (Resource r : res) {\r
-                                       IEntity propertyThing = EntityFactory.create(g,r);\r
-                                       assert (propertyThing.isInstanceOf(g.getBuiltins().Double));\r
-                                       final String name = ResourceDebugUtils.getReadableNameForEntity(propertyThing);\r
-                                       double rb = propertyThing.toProperty().getScalarDouble();\r
-                                       System.out.println("Mapping to " + name + " " + rb);\r
-                                       Collection<IEntity> equations = propertyThing.getRelatedObjects(ShapeEditorResources.equationResource.HasSource);\r
-                                       if (equations.size() != 0) {\r
-                                               mappedProperties.add(propertyThing.getResource());\r
-                                               if (override) {\r
-                                                       System.out.println("Override");\r
-                                                       boolean over = true;\r
-                                                       if (ask) {\r
-                                                               IEntity t = propertyThing;\r
-                                                               while (t.isInstanceOf(g.getBuiltins().Property)) {\r
-                                                                       Collection<IEntity> ts = t.getRelatedObjects(g.getBuiltins().PropertyOf);\r
-                                                                       // FIXME : traverse all possible routes\r
-                                                                       t = ts.iterator().next();\r
-                                                               }\r
-                                                               //StructuredResourceSelection selection = new StructuredResourceSelection(t.getResource());\r
-                                                               // TODO : do the selection!\r
-                                                               //hierarchyScheme.setSelection(selection);\r
-                                                               //fireSelectionChanged();\r
-                                                               MessageDialog dialog = new MessageDialog(ParameterizationEditor.this.getSite().getShell(),\r
-                                                                               "Override mapping",\r
-                                                                               null,\r
-                                                                               "Override mapping to property of highlighted shape?",\r
-                                                                               MessageDialog.QUESTION, new String[] {\r
-                                                                                               "Yes","No", "Cancel" }, 0);\r
-                                                               int i = dialog.open();\r
-                                                               if (i == 2)\r
-                                                                       return GraphRequestStatus.transactionCancel();\r
-                                                               over = (i == 0);\r
-                                                       }\r
-                                                       if (over) {\r
-                                                               \r
-                                                       }\r
-                                               } else {\r
-                                                       if (equations.size() != 1) {\r
-                                                               throw new RuntimeException("One property can have only one euquation as source function.");\r
-                                                       }\r
-                                                       IEntity equation = equations.iterator().next();\r
-                                                       if (!equation.isInstanceOf(ShapeEditorResources.equationResource.SecondOrderScalarPolynomial)) {\r
-                                                               throw new RuntimeException("Only Second order scalar polynomials are supported");\r
-                                                       }\r
-                                                       SecondOrderScalarPolynomial s = new SecondOrderScalarPolynomial(equation);\r
-                                                       s.setA(new double[]{0.0});\r
-                                                       s.setB(new double[]{rb / refValue});\r
-                                                       s.setC(new double[]{0.0});\r
-                                                               \r
-                                               }\r
-                                       } else { //override\r
-                                               // create relation\r
-                                               SecondOrderScalarPolynomial s = SecondOrderScalarPolynomial.createDefault(g);\r
-                                               s.setA(new double[]{0.0});\r
-                                               s.setB(new double[]{rb / refValue});\r
-                                               s.setC(new double[]{0.0});\r
-                                               \r
-                                               // FIXME : these relations have been instantiated, but addStatements won't delete them so we have to delete them manually.\r
-                                               s.removeRelatedStatements(ShapeEditorResources.equationResource.HasTarget);\r
-                                               s.removeRelatedStatements(ShapeEditorResources.equationResource.HasSource);\r
-                                               \r
-                                               parameter.addStatement(ShapeEditorResources.equationResource.HasTarget, s);\r
-                                               \r
-                                               s.addStatement(ShapeEditorResources.equationResource.HasTarget, propertyThing);\r
-                                               mappedProperties.add(propertyThing.getResource());\r
-                                       }\r
-                                       \r
-                               }\r
-                               CSGModel model = getModel(g);\r
-                               Collection<Animation> animations = model.getAnimation();\r
-                               for (Animation animation : animations) {\r
-                                       Collection<Interpolator> interpolators = animation.getInterpolator();\r
-                                       for (Interpolator interpolator : interpolators) {\r
-                                               IEntity target = interpolator.getTarget();\r
-                                               for (Resource property : mappedProperties) {\r
-                                                       if (target.getResource().equals(property)) {\r
-                                                               ShapeEditorResources.curveBuilder.createDefault(interpolator);\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-\r
-\r
-\r
-       }\r
-   \r
-}\r
-\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ShapeEditorBase.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ShapeEditorBase.java
deleted file mode 100644 (file)
index 9c1490d..0000000
+++ /dev/null
@@ -1,628 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.views;\r
-\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IStatusLineManager;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.ISelectionChangedListener;\r
-import org.eclipse.jface.viewers.SelectionChangedEvent;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;\r
-import org.simantics.db.ContextGraph;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.GraphRequestWithResult;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.equation.solver.Solver;\r
-import org.simantics.layer0.stubs.Property;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.InteractiveAction;\r
-import org.simantics.proconf.g3d.actions.TranslateAction;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.base.ScenegraphAdapter;\r
-import org.simantics.proconf.g3d.base.ScenegraphAdapterImpl;\r
-import org.simantics.proconf.g3d.base.SelectionAdapter;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorProvider;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.csg.stubs.CSGModel;\r
-import org.simantics.proconf.g3d.csg.stubs.Primitive;\r
-import org.simantics.proconf.g3d.dnd.DropListener;\r
-import org.simantics.proconf.g3d.scenegraph.AbstractGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.IGeometryNode;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.ISelectableNode;\r
-import org.simantics.proconf.g3d.shapeeditor.ShapeEditorResources;\r
-import org.simantics.proconf.g3d.shapeeditor.actions.ExportAction;\r
-import org.simantics.proconf.g3d.shapeeditor.actions.ImportAction;\r
-import org.simantics.proconf.g3d.shapeeditor.scenegraph.CSGShapeNode;\r
-import org.simantics.proconf.g3d.shapeeditor.tools.AnimationContribution;\r
-import org.simantics.proconf.g3d.shapeeditor.tools.CSGModellingContribution;\r
-import org.simantics.proconf.g3d.shapeeditor.tools.ParameterizationContribution;\r
-import org.simantics.proconf.g3d.shapes.GridShape;\r
-import org.simantics.proconf.g3d.stubs.G3DModel;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.proconf.g3d.stubs.Shape;\r
-import org.simantics.utils.ErrorLogger;\r
-import org.simantics.utils.ui.jface.MenuTools;\r
-\r
-public class ShapeEditorBase extends ThreeDimensionalEditorBase {\r
-\r
-       // currently each 3D-model has a root object which is ShapeGroup\r
-       protected Resource model = null;\r
-       \r
-       protected boolean isParameterized;\r
-       \r
-       private Action exportAction;\r
-       private Action importAction;\r
-       \r
-       public ShapeEditorBase(ISessionContext session) {\r
-               super(session);\r
-               addEditorContribution(new CSGModellingContribution(this));\r
-               addEditorContribution(new AnimationContribution(this));\r
-               addEditorContribution(new ParameterizationContribution(this));\r
-       }\r
-\r
-       public ShapeEditorBase(ISessionContext session, JmeRenderingComponent component) {\r
-               super(session,component);\r
-               addEditorContribution(new CSGModellingContribution(this));\r
-               addEditorContribution(new AnimationContribution(this));\r
-               addEditorContribution(new ParameterizationContribution(this));\r
-       }\r
-\r
-       @Override\r
-       protected ScenegraphAdapter createScenegraphAdapter() {\r
-               return new ShapeEditorAdapter(session, getRenderingComponent());\r
-       }\r
-\r
-       @Override\r
-       public void createControl(Graph graph,Composite parent) {\r
-               super.createControl(graph,parent);\r
-               getRenderingComponent().getNoCastRoot().attachChild(GridShape.getShape(getRenderingComponent().getDisplaySystem().getRenderer(), 10, 1.f));\r
-       }\r
-\r
-//     private void loadGroup(Graph graph) {\r
-//             assert (model != null);\r
-//             adapter.addOutbound(EntityFactory.create(graph,model));\r
-//             //assert (abstractGraphicsNodes.size() == 1);\r
-//\r
-//     }\r
-\r
-       protected void makeActions(Graph graph) {\r
-               super.makeActions(graph);\r
-               exportAction = new ExportAction(this);\r
-               importAction = new ImportAction(this);\r
-       }\r
-\r
-       @Override\r
-       protected void fillLocalPullDown() {\r
-               super.fillLocalPullDown();\r
-               MenuTools.getOrCreate(getMenuID(),"Model", menuManager).add(exportAction);\r
-               MenuTools.getOrCreate(getMenuID(),"Model", menuManager).add(importAction);\r
-       }\r
-       \r
-\r
-       \r
-       /*\r
-        * These are used for updating CSG models geometry when internal shapes are moved. Interactive update is not possible\r
-        * because recalculation of geometry takes too much time. There are several problems in this method:\r
-        * 1. it relies on instanceof check \r
-        * 2. when shape is moved, transformations of its children are updated, which causes all\r
-        *    child geometries to be updated, which is not necessary. We want to update only moved\r
-        *    shape, since updateAllGemetry method takes care of parents. \r
-        * \r
-        *  TODO : this functionality should be moved to TranslateAction\r
-        *  TODO : prevent moved shape's children to be updated.\r
-        */\r
-       \r
-       @Override\r
-       public void setCurrentAction(InteractiveAction action) {\r
-               if (getCurrentAction() == action)\r
-               return;\r
-               if (getCurrentAction() != null && getCurrentAction() instanceof TranslateAction) {\r
-                       runGeometryUpdates();\r
-               }\r
-               super.setCurrentAction(action);\r
-       }\r
-       \r
-       private void runGeometryUpdates() {\r
-               // now we'll just filter out all parents so that they won't be updated multiple times.\r
-               HashSet<CSGShapeNode> parents = new HashSet<CSGShapeNode>();\r
-               for (CSGShapeNode n : geometryUpdates) {\r
-                       IGraphicsNode parent = n.getParent();\r
-                       if (parent instanceof CSGShapeNode)\r
-                               parents.add((CSGShapeNode)parent);\r
-               }\r
-               for (CSGShapeNode n : geometryUpdates) {\r
-                       if (!parents.contains(n))\r
-                               n.updateAllGeometry();\r
-               }\r
-               geometryUpdates.clear();\r
-       }\r
-       \r
-       private HashSet<CSGShapeNode> geometryUpdates = new HashSet<CSGShapeNode>();\r
-       \r
-       private void geometryUpdate(CSGShapeNode shape) {\r
-               \r
-               if (!(getCurrentAction() instanceof TranslateAction)) {\r
-                       shape.updateAllGeometry();\r
-               } else {\r
-                       geometryUpdates.add(shape);\r
-               }\r
-       }\r
-       \r
-       public Graph createParameterization(Graph g) {\r
-               if (isParameterized) {\r
-                       ContextGraph graph;\r
-                       if (!(g instanceof ContextGraph)) {\r
-                               graph = new ContextGraph(g);\r
-                               graph.setContext(model);\r
-                       } else {\r
-                               graph = (ContextGraph)g;\r
-                       }\r
-                       Solver solver = new Solver();\r
-                       Collection<org.simantics.layer0.utils.Property> parameters = getModel(graph).getRelatedProperties(ShapeEditorResources.g3dResource.HasSizingParameter);\r
-                       for (org.simantics.layer0.utils.Property p : parameters) {\r
-                               IEntity t = EntityFactory.create(graph, p.getResource());\r
-                               Collection<IEntity> exp = t.getRelatedObjects(ShapeEditorResources.equationResource.HasTarget);\r
-                               if (exp.size() > 0) {\r
-                                       Iterator<IEntity> i = exp.iterator();\r
-                                       while (i.hasNext())\r
-                                               solver.evaluate(i.next());\r
-                               } else {\r
-                                       ErrorLogger.defaultLogWarning("Model property " + p + " is not bound to a expression", null);\r
-                               }\r
-                       }\r
-                       solver.pushToGraph(graph);\r
-                       return graph;\r
-               } else {\r
-                       return g;\r
-               }\r
-       }\r
-       \r
-       \r
-\r
-       protected class ShapeEditorAdapter extends ScenegraphAdapterImpl {\r
-\r
-               public ShapeEditorAdapter(Session session,JmeRenderingComponent component) {\r
-                       super(session,component);\r
-               }\r
-               \r
-               @Override\r
-               public synchronized void updateGeometry(Graph graph) {\r
-                       if (isParameterized) {\r
-                               graph = createParameterization(graph);  \r
-                       }\r
-                       super.updateGeometry(graph);\r
-               }\r
-               \r
-               \r
-               \r
-               protected AbstractGraphicsNode instantiateNode(IGraphicsNode comp,\r
-                               G3DNode node) {\r
-                       CSGShapeNode mo = new CSGShapeNode(ShapeEditorBase.this, comp, node.getGraph(),node.getResource());\r
-                       updateGeometry(mo);\r
-                       return mo;\r
-               }\r
-\r
-               \r
-               private class ShapeEditorScenegraphQuery extends ScenegraphQuery {\r
-                       \r
-                       public ShapeEditorScenegraphQuery(Resource nodeResource) {\r
-                               super(nodeResource);\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void shapeAdded(Graph graph,IGraphicsNode n) {\r
-                               updateGeometry((CSGShapeNode) n);\r
-\r
-                                       if (n.getG3DNode(graph).getParent() == null) {\r
-                                               if (DEBUG)System.out.println("ShapeSubnodeListener "\r
-                                                               + n.getResource()\r
-                                                               + " has no parent");\r
-                                               return;\r
-                                       }\r
-                                       if (DEBUG) System.out.print("ShapeSubnodeListener " + n.getResource());\r
-                                       if (n.getG3DNode(graph).getRelatedObjects(ShapeEditorResources.g3dResource.GeometryDefinitionOf).size() == 0) {\r
-                                               if (DEBUG) System.out.println(" visible");\r
-                                               ((ISelectableNode)n).setVisible(true);\r
-                                       } else {\r
-                                               if (DEBUG) System.out.println(" invisible");\r
-                                               ((ISelectableNode)n).setVisible(false);\r
-                                       }\r
-                       }\r
-                       \r
-//                     @Override\r
-//                     public NodeQuery instantiateQuery(Resource node) {\r
-//                             return new ShapeEditorScenegraphQuery(node);\r
-//                     }\r
-               }\r
-               \r
-               @Override\r
-               protected ScenegraphQuery newSubnodeListener(G3DNode node) {\r
-                       return new ShapeEditorScenegraphQuery(node.getResource());\r
-               }\r
-               \r
-               private class ShapeEditorNodePropertyQuery extends NodePropertyQuery {\r
-                       public ShapeEditorNodePropertyQuery(Resource nodeResource) {\r
-                               super(nodeResource);\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void shapeUpdated(Graph graph,final IGraphicsNode shape) {\r
-                               if (DEBUG) System.out.println("Tri - Shape id " + shape + " modified");\r
-                               ((CSGShapeNode) shape).updateAllGeometry();\r
-                       }\r
-                       \r
-//                     @Override\r
-//                     public NodeQuery instantiateQuery(Resource node) {\r
-//                             return new ShapeEditorNodePropertyQuery(node);\r
-//                     }\r
-               }\r
-\r
-               @Override\r
-               protected NodePropertyQuery newPropertyListener(G3DNode node) {\r
-                       return new ShapeEditorNodePropertyQuery(node.getResource());\r
-               }\r
-               \r
-               private class ShapeEditorNodeTransformationQuery extends NodeTransformationQuery {\r
-                       public ShapeEditorNodeTransformationQuery(Resource nodeResource) {\r
-                               super(nodeResource);\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void shapeUpdated(Graph graph,final IGraphicsNode shape) {\r
-                               if (DEBUG) System.out.println("Tra - Shape id " + shape + " modified");\r
-                               ((CSGShapeNode) shape).updateTransform(graph);\r
-                               geometryUpdate((CSGShapeNode)shape);\r
-                       }\r
-                       \r
-//                     @Override\r
-//                     public NodeQuery instantiateQuery(Resource node) {\r
-//                             return new ShapeEditorNodePropertyQuery(node);\r
-//                     }\r
-               }\r
-\r
-               @Override\r
-               protected NodeTransformationQuery newTransformationListener(G3DNode node) {\r
-                       return new ShapeEditorNodeTransformationQuery(node.getResource());\r
-               }\r
-               \r
-               private class ShapeEditorRootPropertyQuery extends NodePropertyQuery {\r
-                       public ShapeEditorRootPropertyQuery(Resource nodeResource) {\r
-                               super(nodeResource);\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void shapeUpdated(Graph graph, final IGraphicsNode shape) {\r
-                               if (DEBUG)System.out.println("Tri - Shape id " + shape + " modified");\r
-\r
-                               updateParameterizationStatus(graph);\r
-                               if (isParameterized) {\r
-                                       for (IGraphicsNode n : getNodes())\r
-                                               if (n instanceof IGeometryNode)\r
-                                                       updateGeometry((IGeometryNode) n);\r
-                               }\r
-                       }\r
-                       \r
-//                     @Override\r
-//                     public NodeQuery instantiateQuery(Resource node) {\r
-//                             return new ShapeEditorRootPropertyQuery(node);\r
-//                     }\r
-               }\r
-               \r
-               @Override\r
-               protected NodePropertyQuery newRootPropertyListener(G3DNode root) {\r
-                       return new ShapeEditorRootPropertyQuery(root.getResource());\r
-               }\r
-               \r
-       }\r
-\r
-       protected void contributeStatusBar(IStatusLineManager manager) {\r
-       }\r
-\r
-       /**\r
-        * Loads the initial scene: all further updates to the view are done by\r
-        * listening changes in the shapes and int the shape group\r
-        * \r
-        * @param resource\r
-        */\r
-       protected void reloadFrom(IEntity thing) {\r
-               if (model != null) {\r
-                       throw new UnsupportedOperationException(\r
-                                       "Reloading instantiated viewer not supported");\r
-\r
-               }\r
-               if (thing.isInstanceOf(ShapeEditorResources.csgResource.CSGModel)) {\r
-                       //System.out.print("ShapeEditorView.reloadFrom() : model");\r
-                       Graph g = thing.getGraph();\r
-                       model = thing.getResource();\r
-                       //System.out.println(" " + model.getResource());\r
-                       adapter.setRootNode(new G3DNode(thing));\r
-                       updateParameterizationStatus(g);\r
-                       \r
-                       //loadGroup(thing.getGraph());\r
-                       \r
-               } else {\r
-                       throw new UnsupportedOperationException("Cannot load ShapeViewer for Resource:" + thing);\r
-               }\r
-\r
-       }\r
-       \r
-       private void updateParameterizationStatus(Graph graph) {\r
-               G3DModel model = getModel(graph);\r
-               if(model.getRelatedObjects(ShapeEditorResources.g3dResource.HasSizingParameter).size() > 0) {\r
-                       isParameterized = true;\r
-               } else {\r
-                       isParameterized = false;\r
-               }\r
-               parent.getDisplay().asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-//                             for (Action a : addActions)\r
-//                                     a.setEnabled(!isParameterized);\r
-//                             unionAction.setEnabled(!isParameterized);\r
-//                             differenceAction.setEnabled(!isParameterized);\r
-//                             intersectionAction.setEnabled(!isParameterized);\r
-//                             linkAction.setEnabled(!isParameterized);\r
-//                             unlinkAction.setEnabled(!isParameterized);\r
-//                             translateAction.setEnabled(!isParameterized);\r
-//                             rotateAction.setEnabled(!isParameterized);\r
-//                             removeAction.setEnabled(!isParameterized);\r
-                       }\r
-                       \r
-               });\r
-       }\r
-\r
-       public Resource getModelResource() {\r
-               return model;\r
-       }\r
-       \r
-       public G3DModel getModel(Graph graph) {\r
-               return new G3DModel(graph, model);\r
-       }\r
-\r
-       @Override\r
-       protected SelectionAdapter createSelectionAdapter() {\r
-               return new ShapeEditorSelectionAdapter(adapter);\r
-       }\r
-\r
-       protected class ShapeEditorSelectionAdapter extends SelectionAdapter {\r
-\r
-               public ShapeEditorSelectionAdapter(ScenegraphAdapter adapter) {\r
-                       super(adapter);\r
-               }\r
-\r
-               public void setEditorSelection() {\r
-                       List<IGraphicsNode> sel = getSelectedObjects();\r
-                       for (IGraphicsNode o : adapter.getNodes())\r
-                               if (o instanceof ISelectableNode) {\r
-                                       ISelectableNode n = (ISelectableNode)o;\r
-                                       if (sel.contains(o))\r
-                                               n.setSelected(true);\r
-                                       else\r
-                                               n.setSelected(false);\r
-                               }\r
-                       List<Resource> selected = getSelectedResources();\r
-                       for (Resource r : selected) {\r
-                               if (!adapter.hasNode(r)) {\r
-                                       //adapter.addInbound(r).setSelected(true);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public void setEditorHighlightSelection() {\r
-                       List<IGraphicsNode> sel = getInteractiveSelectedObjects();\r
-                       for (IGraphicsNode o : adapter.getNodes())\r
-                               if (o instanceof CSGShapeNode) {\r
-                                       if (sel.contains(o))\r
-                                               ((CSGShapeNode) o).setHighlighted(true);\r
-                                       else\r
-                                               ((CSGShapeNode) o).setHighlighted(false);\r
-                               }\r
-               }\r
-\r
-               public void setEditorSelection(boolean addShapes) {\r
-\r
-                       List<IGraphicsNode> sel = getSelectedObjects();\r
-                       for (IGraphicsNode o : adapter.getNodes()) \r
-                               if (o instanceof ISelectableNode) {\r
-                                       ISelectableNode n = (ISelectableNode)o;\r
-                                       if (sel.contains(o)) \r
-                                               n.setSelected(true);\r
-                                       else\r
-                                               n.setSelected(false);\r
-                               }\r
-                       viewChanged = true;\r
-                       if (addShapes) {\r
-                               session.syncRead(new GraphRequestAdapter() {\r
-                                       @Override\r
-                                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                               List<Resource> selected = getSelectedResources();\r
-                                               for (Resource r : selected) {\r
-                                                       if (!adapter.hasNode(r)) {\r
-                                                               IEntity t = EntityFactory.create(g, r);\r
-                                                               if (t.isInstanceOf(ShapeEditorResources.g3dResource.Shape)) {\r
-                                                                       G3DNode group = G3DTools.getModelFromResource(g,r);\r
-                                                                       if (group != null\r
-                                                                                       && group.getResource().equals(model.getResource())) {\r
-                                                                               //adapter.addInbound(g).setSelected(true);\r
-                                                                       }\r
-\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-                                               return GraphRequestStatus.transactionComplete();\r
-                                       }\r
-                               });\r
-                               \r
-                       }\r
-               }\r
-\r
-               public StructuredResourceSelection filterSelection(ISelection selection) {\r
-                       if (!(selection instanceof StructuredResourceSelection))\r
-                               return new StructuredResourceSelection();\r
-                       return (StructuredResourceSelection) selection;\r
-               }\r
-\r
-       }\r
-\r
-       /**\r
-        * Receives selection changes\r
-        * \r
-        * @param part\r
-        * @param selection\r
-        */\r
-       protected void pageSelectionChanged(IWorkbenchPart part, ISelection selection) {\r
-               \r
-               StructuredResourceSelection s = SelectionAdapter.transformSelection(selection);\r
-               //System.out.println("ShapeEditorBase.pageSelectionChanged " + s);\r
-               selectionAdapter.setCurrentSelection(s);\r
-\r
-               if (!(part instanceof ThreeDimensionalEditorProvider)) {\r
-                       ((ShapeEditorSelectionAdapter) selectionAdapter).setEditorSelection(true);\r
-                       return;\r
-               }\r
-               ThreeDimensionalEditorBase e = ((ThreeDimensionalEditorProvider)part).getEditor();\r
-               if (!(e instanceof ShapeEditorBase)) {\r
-                       ((ShapeEditorSelectionAdapter) selectionAdapter).setEditorSelection(true);\r
-                       return;\r
-               }\r
-               \r
-               ShapeEditorBase editor = (ShapeEditorBase)e;\r
-               \r
-               if (!editor.getModelResource().equals(model.getResource())) {\r
-                       selectionAdapter.setCurrentSelection(new StructuredResourceSelection());\r
-                       ((ShapeEditorSelectionAdapter) selectionAdapter).setEditorSelection(false);\r
-                       return;\r
-               }\r
-               selectionAdapter.setEditorSelection();\r
-       }\r
-\r
-       @Override\r
-       protected void hookDragAndDrop() {\r
-               super.hookDragAndDrop();\r
-               dropTarget.addDropListener(new DropListener() {\r
-                       public boolean acceptDrop(StructuredResourceSelection s, Resource[] ids) {\r
-                               if (!s.isEmpty())\r
-                                       return false;\r
-                               if (ids == null)\r
-                                       return false;\r
-                               if (ids.length != 1)\r
-                                       return false;\r
-                               final Resource r = ids[0];\r
-                               GraphRequestWithResult<Boolean> rq = new GraphRequestWithResult<Boolean>() {\r
-                                       @Override\r
-                                       public Boolean performWithResult(Graph g) throws Exception {\r
-                                               IEntity t = EntityFactory.create(g, r);\r
-                                               return t.isInstanceOf(ShapeEditorResources.csgResource.Primitive);\r
-                                       }\r
-                               };\r
-                               session.syncRead(rq);\r
-                               return rq.getResult();\r
-                       }\r
-\r
-                       public void doDrop(StructuredResourceSelection s, Resource[] ids) {\r
-                               session.asyncWrite(new GraphRequestAdapter() {\r
-                                       Resource r;\r
-\r
-                                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                               IEntity type = EntityFactory.create(g);\r
-                                               IEntity instance = type.instantiate();\r
-                                               Shape shape = new Shape(instance);\r
-                                               resetShape(shape);\r
-                                               CSGModel m = new CSGModel(g, model);\r
-                                               m.getChild().add(shape.toG3DNode()); // FIXME : stubcast\r
-                                               return GraphRequestStatus.transactionComplete();\r
-                                               \r
-                                       };\r
-                                       \r
-                                       @Override\r
-                                       public void requestCompleted(GraphRequestStatus status) {\r
-                                               selectionAdapter\r
-                                               .updateSelection(new StructuredResourceSelection(r));\r
-                                               super.requestCompleted(status);\r
-                                       }\r
-                               }\r
-                               );\r
-\r
-                       }\r
-               });\r
-       }\r
-       \r
-       private void resetShape(Shape shape) {\r
-               G3DTools.resetTransformation(shape);\r
-               Graph graph = shape.getGraph();\r
-               if (shape.isInstanceOf(ShapeEditorResources.csgResource.Primitive)) {\r
-                       Primitive prim = new Primitive(shape);\r
-                       Collection<Property> c = prim.getSizingProperty();\r
-                       if (c.size() == 0)\r
-                               ErrorLogger.getDefault().logWarning("Shape does not contain sizing properties.", null);\r
-                       \r
-                       for (Property p : c) {\r
-                               if (p.isInstanceOf(graph.getBuiltins().Double)) {\r
-                                       graph.setScalarDouble(p.getResource(), 1.0);\r
-                               } else if (p.isInstanceOf(graph.getBuiltins().Integer)) {\r
-                                       graph.setScalarInteger(p.getResource(), 1);\r
-                               } else {\r
-                                       ErrorLogger.getDefault().logWarning("Cannot handle sizing property " + p.getName() , null);\r
-                               }\r
-                       }\r
-               }\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public Object getAdapter(Class adapter) {\r
-               if (adapter == IContentOutlinePage.class) {\r
-                       if (getModelResource() == null)\r
-                               return null;\r
-                       final StructureOutlinePage page = new StructureOutlinePage(sessionContext,getModelResource());\r
-                       \r
-                       getSelectionAdapter().addSelectionChangedListener(new ISelectionChangedListener() {\r
-                               @Override\r
-                               public void selectionChanged(SelectionChangedEvent event) {\r
-                                       page.setSelection(event.getSelection());\r
-                                       \r
-                               }\r
-                       });\r
-                       parent.getDisplay().asyncExec(new Runnable() {\r
-                               @Override\r
-                               public void run() {\r
-                                       page.addSelectionChangedListener(new ISelectionChangedListener() {\r
-                                               @Override\r
-                                               public void selectionChanged(SelectionChangedEvent event) {\r
-                                                       selectionAdapter.setSelection(SelectionAdapter.transformSelection(event.getSelection()));\r
-                                               }\r
-                                       });\r
-                               }\r
-                       });\r
-                       \r
-                       \r
-                       \r
-                       return page;\r
-               }\r
-               return null;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ShapeEditorView.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/ShapeEditorView.java
deleted file mode 100644 (file)
index 8fa7a37..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.views;\r
-\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorPart;\r
-\r
-\r
-\r
-\r
-/**\r
- * Shape Editor / CGS-modeling\r
- * \r
- * \r
- * @author Marko Luukkainen\r
- * \r
- */\r
-public class ShapeEditorView extends ThreeDimensionalEditorPart {\r
-    \r
-    \r
-       @Override\r
-       protected ThreeDimensionalEditorBase createEditor(ISessionContext session) {\r
-               return new ShapeEditorBase(session);\r
-       }\r
-\r
-}\r
-\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/StructureOutlinePage.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/StructureOutlinePage.java
deleted file mode 100644 (file)
index c0ddb2a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.simantics.proconf.g3d.shapeeditor.views;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.layer0.utils.viewpoints.ResourceViewpoint;\r
-import org.simantics.proconf.browsing.views.GraphExplorerOutlinePage;\r
-import org.simantics.proconf.g3d.shapeeditor.common.ViewpointGenerator;\r
-\r
-public class StructureOutlinePage extends GraphExplorerOutlinePage {\r
-       \r
-       \r
-       public StructureOutlinePage(ISessionContext session, Resource model) {\r
-               super(session,model);\r
-       }\r
-       \r
-       @Override\r
-       public ResourceViewpoint getViewPoint(ISessionContext sessionContext) {\r
-               return ViewpointGenerator.createObjectStructureViewpoint();\r
-       }\r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/StructureView.java b/dev/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/views/StructureView.java
deleted file mode 100644 (file)
index f747d49..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapeeditor.views;\r
-\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.layer0.utils.viewpoints.ResourceViewpoint;\r
-import org.simantics.proconf.browsing.views.GraphExplorerView;\r
-import org.simantics.proconf.g3d.shapeeditor.common.ViewpointGenerator;\r
-\r
-public class StructureView extends GraphExplorerView {\r
-\r
-    @Override\r
-    protected void contributeActions() {\r
-    }\r
-\r
-    @Override\r
-    protected ResourceViewpoint getViewpoint(ISessionContext context) {\r
-        return ViewpointGenerator.createStuctureViewpoint();\r
-    }\r
-\r
-    /*\r
-    @Override\r
-    public String getContributorId() {\r
-        return "fi.vtt.simantics.shapeeditor.pcid";\r
-    }\r
-\r
-    @Override\r
-    public Object getAdapter(Class adapter) {\r
-        if (adapter == IPropertySheetPage.class) {\r
-            return new TabbedPropertySheetPage(this);\r
-        }\r
-        return super.getAdapter(adapter);\r
-    }\r
-    */\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/.classpath b/dev/org.simantics.proconf.g3d/.classpath
deleted file mode 100644 (file)
index 2e6482e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry excluding="fi/vtt/simantics/g3d/views/AppearanceEditor.java" kind="src" path="src"/>\r
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
-       <classpathentry kind="output" path="bin"/>\r
-</classpath>\r
diff --git a/dev/org.simantics.proconf.g3d/.project b/dev/org.simantics.proconf.g3d/.project
deleted file mode 100644 (file)
index a27da2f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>org.simantics.proconf.g3d</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.ManifestBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.SchemaBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.pde.PluginNature</nature>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/dev/org.simantics.proconf.g3d/META-INF/MANIFEST.MF b/dev/org.simantics.proconf.g3d/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index ae81bc8..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: G3D Plug-in
-Bundle-SymbolicName: org.simantics.proconf.g3d;singleton:=true
-Bundle-Version: 1.0.0
-Bundle-Activator: org.simantics.proconf.g3d.Activator
-Bundle-Vendor: VTT
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.simantics.g2d.stubs,
- javax.vecmath,
- com.jme.eclipse,
- org.simantics.proconf.image,
- org.eclipse.ui.views,
- org.simantics.db,
- org.simantics.layer0.stubs,
- org.simantics.layer0.utils,
- org.simantics.image.stubs,
- org.simantics.utils,
- org.simantics.utils.datastructures,
- org.simantics.utils.ui,
- org.simantics.proconf.ui,
- org.simantics.equation,
- org.simantics.proconf.browsing,
- org.eclipse.ui.forms,
- org.eclipse.core.expressions,
- org.simantics.animation
-Eclipse-LazyStart: true
-Export-Package: org.simantics.proconf.g3d.actions,
- org.simantics.proconf.g3d.animation,
- org.simantics.proconf.g3d.animation.ui,
- org.simantics.proconf.g3d.base,
- org.simantics.proconf.g3d.common,
- org.simantics.proconf.g3d.dialogs,
- org.simantics.proconf.g3d.dnd,
- org.simantics.proconf.g3d.gizmo,
- org.simantics.proconf.g3d.input,
- org.simantics.proconf.g3d.preferences,
- org.simantics.proconf.g3d.scenegraph,
- org.simantics.proconf.g3d.shapes,
- org.simantics.proconf.g3d.stubs,
- org.simantics.proconf.g3d.tools,
- org.simantics.proconf.g3d.views
diff --git a/dev/org.simantics.proconf.g3d/build.properties b/dev/org.simantics.proconf.g3d/build.properties
deleted file mode 100644 (file)
index 6f20375..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/\r
-output.. = bin/\r
-bin.includes = META-INF/,\\r
-               .,\\r
-               plugin.xml\r
diff --git a/dev/org.simantics.proconf.g3d/data/defaultfont.tga b/dev/org.simantics.proconf.g3d/data/defaultfont.tga
deleted file mode 100644 (file)
index e215541..0000000
Binary files a/dev/org.simantics.proconf.g3d/data/defaultfont.tga and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/batch.png b/dev/org.simantics.proconf.g3d/icons/batch.png
deleted file mode 100644 (file)
index 424fd1b..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/batch.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/batch.svg b/dev/org.simantics.proconf.g3d/icons/batch.svg
deleted file mode 100644 (file)
index 23ba494..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
-<svg\r
-   xmlns:dc="http://purl.org/dc/elements/1.1/"\r
-   xmlns:cc="http://web.resource.org/cc/"\r
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
-   xmlns:svg="http://www.w3.org/2000/svg"\r
-   xmlns="http://www.w3.org/2000/svg"\r
-   xmlns:xlink="http://www.w3.org/1999/xlink"\r
-   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"\r
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
-   width="744.09448819"\r
-   height="1052.3622047"\r
-   id="svg2"\r
-   sodipodi:version="0.32"\r
-   inkscape:version="0.43"\r
-   sodipodi:docbase="D:\workspace\fi.vtt.proconf.webmon.visualizations.binary\icons"\r
-   sodipodi:docname="binary.svg"\r
-   inkscape:export-filename="D:\binary.png"\r
-   inkscape:export-xdpi="14.400002"\r
-   inkscape:export-ydpi="14.400002">\r
-  <defs\r
-     id="defs4">\r
-    <linearGradient\r
-       id="linearGradient1308">\r
-      <stop\r
-         style="stop-color:#ffffff;stop-opacity:1.0000000;"\r
-         offset="0.00000000"\r
-         id="stop1310" />\r
-      <stop\r
-         style="stop-color:#5764ff;stop-opacity:1.0000000;"\r
-         offset="1.0000000"\r
-         id="stop1312" />\r
-    </linearGradient>\r
-    <radialGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient1308"\r
-       id="radialGradient1316"\r
-       cx="105.42004"\r
-       cy="96.950104"\r
-       fx="105.42004"\r
-       fy="96.950104"\r
-       r="50.500000"\r
-       gradientUnits="userSpaceOnUse"\r
-       gradientTransform="matrix(0.892809,1.055631,-0.763525,0.645779,74.50455,-84.48377)" />\r
-  </defs>\r
-  <sodipodi:namedview\r
-     id="base"\r
-     pagecolor="#ffffff"\r
-     bordercolor="#666666"\r
-     borderopacity="1.0"\r
-     inkscape:pageopacity="0.0"\r
-     inkscape:pageshadow="2"\r
-     inkscape:zoom="7.2970297"\r
-     inkscape:cx="107.14286"\r
-     inkscape:cy="947.14286"\r
-     inkscape:document-units="px"\r
-     inkscape:current-layer="layer1"\r
-     inkscape:window-width="1280"\r
-     inkscape:window-height="904"\r
-     inkscape:window-x="149"\r
-     inkscape:window-y="34" />\r
-  <metadata\r
-     id="metadata7">\r
-    <rdf:RDF>\r
-      <cc:Work\r
-         rdf:about="">\r
-        <dc:format>image/svg+xml</dc:format>\r
-        <dc:type\r
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
-      </cc:Work>\r
-    </rdf:RDF>\r
-  </metadata>\r
-  <g\r
-     inkscape:label="Layer 1"\r
-     inkscape:groupmode="layer"\r
-     id="layer1">\r
-    <path\r
-       sodipodi:type="arc"\r
-       style="fill:url(#radialGradient1316);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"\r
-       id="path1306"\r
-       sodipodi:cx="107.14286"\r
-       sodipodi:cy="105.21932"\r
-       sodipodi:rx="50.000000"\r
-       sodipodi:ry="50.000000"\r
-       d="M 157.14286 105.21932 A 50.000000 50.000000 0 1 1  57.142860,105.21932 A 50.000000 50.000000 0 1 1  157.14286 105.21932 z" />\r
-    <text\r
-       xml:space="preserve"\r
-       style="font-size:93.40623474px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial"\r
-       x="71.08165"\r
-       y="144.76363"\r
-       id="text1318"\r
-       sodipodi:linespacing="125%"\r
-       transform="scale(1.0468,0.955293)"><tspan\r
-         sodipodi:role="line"\r
-         id="tspan1311"\r
-         x="71.08165"\r
-         y="144.76363">B</tspan></text>\r
-  </g>\r
-</svg>\r
diff --git a/dev/org.simantics.proconf.g3d/icons/delete.png b/dev/org.simantics.proconf.g3d/icons/delete.png
deleted file mode 100644 (file)
index 31f061a..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/delete.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/delete.svg b/dev/org.simantics.proconf.g3d/icons/delete.svg
deleted file mode 100644 (file)
index 888616f..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   sodipodi:docname="delete.svg"
-   sodipodi:docbase="D:\dev\icons"
-   inkscape:export-filename="D:\dev\icons\Nozzle.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient3686">
-      <stop
-         style="stop-color:red;stop-opacity:0;"
-         offset="0"
-         id="stop3688" />
-      <stop
-         style="stop-color:red;stop-opacity:1;"
-         offset="1"
-         id="stop3690" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3133">
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="0"
-         id="stop3135" />
-      <stop
-         id="stop3141"
-         offset="0.5"
-         style="stop-color:#cbcbcb;stop-opacity:1;" />
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="1"
-         id="stop3137" />
-    </linearGradient>
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3686"
-       id="radialGradient3692"
-       cx="50"
-       cy="50"
-       fx="50"
-       fy="50"
-       r="52"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(0.707107,-0.707107,0.707107,0.707107,-20.71068,50)" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.72"
-     inkscape:cx="50"
-     inkscape:cy="55.181347"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       style="fill:url(#radialGradient3692);fill-opacity:1;stroke:red;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       d="M 7.5735931,21.715729 L 35.857864,50 L 7.5735931,78.284271 L 21.715729,92.426407 L 50,64.142136 L 78.284271,92.426407 L 92.426407,78.284271 L 64.142136,50 L 92.426407,21.715729 L 78.284271,7.5735931 L 50,35.857864 L 21.715729,7.5735931 L 7.5735931,21.715729 z "
-       id="rect2796" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.g3d/icons/eye.png b/dev/org.simantics.proconf.g3d/icons/eye.png
deleted file mode 100644 (file)
index 0e78cfd..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/eye.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/eye.svg b/dev/org.simantics.proconf.g3d/icons/eye.svg
deleted file mode 100644 (file)
index cfb5620..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   sodipodi:docname="eye.svg"
-   sodipodi:docbase="D:\dev\icons"
-   inkscape:export-filename="D:\dev\icons\eye.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient4583">
-      <stop
-         style="stop-color:#0049ff;stop-opacity:1;"
-         offset="0"
-         id="stop4585" />
-      <stop
-         style="stop-color:#00b3b3;stop-opacity:1;"
-         offset="1"
-         id="stop4587" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3686">
-      <stop
-         style="stop-color:red;stop-opacity:0;"
-         offset="0"
-         id="stop3688" />
-      <stop
-         style="stop-color:red;stop-opacity:1;"
-         offset="1"
-         id="stop3690" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3133">
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="0"
-         id="stop3135" />
-      <stop
-         id="stop3141"
-         offset="0.5"
-         style="stop-color:#cbcbcb;stop-opacity:1;" />
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="1"
-         id="stop3137" />
-    </linearGradient>
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="10"
-     inkscape:cx="50"
-     inkscape:cy="59.95985"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
-       d="M 10,50 C 35.054042,24.945958 64.998554,24.998554 90,50 C 65.010416,74.989584 35.029348,75.029348 10,50 z "
-       id="path3694"
-       sodipodi:nodetypes="ccc" />
-    <path
-       sodipodi:type="arc"
-       style="fill:#009bff;fill-opacity:1;stroke:#009aff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="path3696"
-       sodipodi:cx="50"
-       sodipodi:cy="50"
-       sodipodi:rx="15"
-       sodipodi:ry="15"
-       d="M 65 50 A 15 15 0 1 1  35,50 A 15 15 0 1 1  65 50 z" />
-    <path
-       sodipodi:type="arc"
-       style="fill:black;fill-opacity:1;stroke:black;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="path5476"
-       sodipodi:cx="50"
-       sodipodi:cy="50"
-       sodipodi:rx="4"
-       sodipodi:ry="4"
-       d="M 54 50 A 4 4 0 1 1  46,50 A 4 4 0 1 1  54 50 z" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.g3d/icons/ff.png b/dev/org.simantics.proconf.g3d/icons/ff.png
deleted file mode 100644 (file)
index 9fb120a..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/ff.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/ff.svg b/dev/org.simantics.proconf.g3d/icons/ff.svg
deleted file mode 100644 (file)
index 5d9ddc9..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
-<svg\r
-   xmlns:dc="http://purl.org/dc/elements/1.1/"\r
-   xmlns:cc="http://web.resource.org/cc/"\r
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
-   xmlns:svg="http://www.w3.org/2000/svg"\r
-   xmlns="http://www.w3.org/2000/svg"\r
-   xmlns:xlink="http://www.w3.org/1999/xlink"\r
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\r
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
-   width="100"\r
-   height="100"\r
-   id="svg2"\r
-   sodipodi:version="0.32"\r
-   inkscape:version="0.44"\r
-   version="1.0"\r
-   sodipodi:docname="ff.svg"\r
-   sodipodi:docbase="D:\dev\icons"\r
-   inkscape:export-filename="D:\dev\icons\ff.png"\r
-   inkscape:export-xdpi="14.4"\r
-   inkscape:export-ydpi="14.4">\r
-  <defs\r
-     id="defs4">\r
-    <linearGradient\r
-       id="linearGradient6310">\r
-      <stop\r
-         style="stop-color:white;stop-opacity:1;"\r
-         offset="0"\r
-         id="stop6312" />\r
-      <stop\r
-         style="stop-color:blue;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop6314" />\r
-    </linearGradient>\r
-    <linearGradient\r
-       id="linearGradient3686">\r
-      <stop\r
-         style="stop-color:red;stop-opacity:0;"\r
-         offset="0"\r
-         id="stop3688" />\r
-      <stop\r
-         style="stop-color:red;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop3690" />\r
-    </linearGradient>\r
-    <linearGradient\r
-       id="linearGradient3133">\r
-      <stop\r
-         style="stop-color:#4c4c4c;stop-opacity:1;"\r
-         offset="0"\r
-         id="stop3135" />\r
-      <stop\r
-         id="stop3141"\r
-         offset="0.5"\r
-         style="stop-color:#cbcbcb;stop-opacity:1;" />\r
-      <stop\r
-         style="stop-color:#4c4c4c;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop3137" />\r
-    </linearGradient>\r
-    <radialGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient6310"\r
-       id="radialGradient6316"\r
-       cx="63.25"\r
-       cy="49.999989"\r
-       fx="63.25"\r
-       fy="49.999989"\r
-       r="20.5"\r
-       gradientTransform="matrix(0.768293,5.919238e-8,-1.428134e-7,1.853659,14.65549,-42.68293)"\r
-       gradientUnits="userSpaceOnUse" />\r
-    <radialGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient6310"\r
-       id="radialGradient6318"\r
-       cx="29"\r
-       cy="49.999989"\r
-       fx="29"\r
-       fy="49.999989"\r
-       r="20.5"\r
-       gradientTransform="matrix(0.780488,9.067778e-7,-2.068587e-6,1.780488,6.365957,-39.02442)"\r
-       gradientUnits="userSpaceOnUse" />\r
-  </defs>\r
-  <sodipodi:namedview\r
-     id="base"\r
-     pagecolor="#ffffff"\r
-     bordercolor="#666666"\r
-     borderopacity="1.0"\r
-     gridtolerance="10000"\r
-     guidetolerance="10"\r
-     objecttolerance="10"\r
-     inkscape:pageopacity="0.0"\r
-     inkscape:pageshadow="2"\r
-     inkscape:zoom="4"\r
-     inkscape:cx="50"\r
-     inkscape:cy="40"\r
-     inkscape:document-units="px"\r
-     inkscape:current-layer="layer1"\r
-     width="100px"\r
-     height="100px"\r
-     inkscape:window-width="1280"\r
-     inkscape:window-height="968"\r
-     inkscape:window-x="-4"\r
-     inkscape:window-y="-4" />\r
-  <metadata\r
-     id="metadata7">\r
-    <rdf:RDF>\r
-      <cc:Work\r
-         rdf:about="">\r
-        <dc:format>image/svg+xml</dc:format>\r
-        <dc:type\r
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
-      </cc:Work>\r
-    </rdf:RDF>\r
-  </metadata>\r
-  <g\r
-     inkscape:label="Layer 1"\r
-     inkscape:groupmode="layer"\r
-     id="layer1">\r
-    <path\r
-       style="fill:url(#radialGradient6316);fill-opacity:1.0;fill-rule:evenodd;stroke:blue;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"\r
-       d="M 85,50 L 50,15 L 50,85 L 85,50 z "\r
-       id="path4536" />\r
-    <path\r
-       style="fill:url(#radialGradient6318);fill-opacity:1.0;fill-rule:evenodd;stroke:blue;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"\r
-       d="M 15.5,85 L 15,15 L 50,50 L 15.5,85 z "\r
-       id="path4538" />\r
-  </g>\r
-</svg>\r
diff --git a/dev/org.simantics.proconf.g3d/icons/geometry.png b/dev/org.simantics.proconf.g3d/icons/geometry.png
deleted file mode 100644 (file)
index b06b553..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/geometry.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/geometry.svg b/dev/org.simantics.proconf.g3d/icons/geometry.svg
deleted file mode 100644 (file)
index e0e8ab7..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="D:\dev\icons\jme"
-   sodipodi:docname="geometry.svg"
-   inkscape:export-filename="D:\dev\icons\jme\geometry.png"
-   inkscape:export-xdpi="14.400002"
-   inkscape:export-ydpi="14.400002">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient1308">
-      <stop
-         style="stop-color:#ffffff;stop-opacity:1.0000000;"
-         offset="0.00000000"
-         id="stop1310" />
-      <stop
-         style="stop-color:#00d51d;stop-opacity:1;"
-         offset="1"
-         id="stop1312" />
-    </linearGradient>
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient1308"
-       id="radialGradient1316"
-       cx="105.42004"
-       cy="96.950104"
-       fx="105.42004"
-       fy="96.950104"
-       r="50.500000"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(0.892809,1.055631,-0.763525,0.645779,74.50455,-84.48377)" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.2970297"
-     inkscape:cx="107.14286"
-     inkscape:cy="947.14286"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     inkscape:window-width="1280"
-     inkscape:window-height="904"
-     inkscape:window-x="149"
-     inkscape:window-y="34" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       sodipodi:type="arc"
-       style="fill:url(#radialGradient1316);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
-       id="path1306"
-       sodipodi:cx="107.14286"
-       sodipodi:cy="105.21932"
-       sodipodi:rx="50.000000"
-       sodipodi:ry="50.000000"
-       d="M 157.14286 105.21932 A 50.000000 50.000000 0 1 1  57.142860,105.21932 A 50.000000 50.000000 0 1 1  157.14286 105.21932 z" />
-    <text
-       xml:space="preserve"
-       style="font-size:93.40626526px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial"
-       x="65.321404"
-       y="144.90714"
-       id="text1318"
-       sodipodi:linespacing="125%"
-       transform="scale(1.0468,0.955293)"><tspan
-         sodipodi:role="line"
-         id="tspan1876"
-         x="65.321404"
-         y="144.90714">G</tspan></text>
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.g3d/icons/node.png b/dev/org.simantics.proconf.g3d/icons/node.png
deleted file mode 100644 (file)
index a2cb4c4..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/node.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/node.svg b/dev/org.simantics.proconf.g3d/icons/node.svg
deleted file mode 100644 (file)
index 8fe1dd3..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="D:\dev\icons\jme"
-   sodipodi:docname="node.svg"
-   inkscape:export-filename="D:\dev\icons\jme\node.png"
-   inkscape:export-xdpi="14.400002"
-   inkscape:export-ydpi="14.400002">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient1308">
-      <stop
-         style="stop-color:#ffffff;stop-opacity:1.0000000;"
-         offset="0.00000000"
-         id="stop1310" />
-      <stop
-         style="stop-color:red;stop-opacity:1;"
-         offset="1"
-         id="stop1312" />
-    </linearGradient>
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient1308"
-       id="radialGradient1316"
-       cx="105.42004"
-       cy="96.950104"
-       fx="105.42004"
-       fy="96.950104"
-       r="50.500000"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(0.892809,1.055631,-0.763525,0.645779,74.50455,-84.48377)" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.2970297"
-     inkscape:cx="107.14286"
-     inkscape:cy="947.14286"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     inkscape:window-width="1280"
-     inkscape:window-height="904"
-     inkscape:window-x="149"
-     inkscape:window-y="34" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       sodipodi:type="arc"
-       style="fill:url(#radialGradient1316);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
-       id="path1306"
-       sodipodi:cx="107.14286"
-       sodipodi:cy="105.21932"
-       sodipodi:rx="50.000000"
-       sodipodi:ry="50.000000"
-       d="M 157.14286 105.21932 A 50.000000 50.000000 0 1 1  57.142860,105.21932 A 50.000000 50.000000 0 1 1  157.14286 105.21932 z" />
-    <text
-       xml:space="preserve"
-       style="font-size:93.40623199;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial"
-       x="71.08165"
-       y="144.76363"
-       id="text1318"
-       sodipodi:linespacing="125%"
-       transform="scale(1.0468,0.955293)"><tspan
-         sodipodi:role="line"
-         id="tspan1876"
-         x="71.08165"
-         y="144.76363">N</tspan></text>
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.g3d/icons/play.png b/dev/org.simantics.proconf.g3d/icons/play.png
deleted file mode 100644 (file)
index 10f00bb..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/play.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/play.svg b/dev/org.simantics.proconf.g3d/icons/play.svg
deleted file mode 100644 (file)
index dafc820..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
-<svg\r
-   xmlns:dc="http://purl.org/dc/elements/1.1/"\r
-   xmlns:cc="http://web.resource.org/cc/"\r
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
-   xmlns:svg="http://www.w3.org/2000/svg"\r
-   xmlns="http://www.w3.org/2000/svg"\r
-   xmlns:xlink="http://www.w3.org/1999/xlink"\r
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\r
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
-   width="100"\r
-   height="100"\r
-   id="svg2"\r
-   sodipodi:version="0.32"\r
-   inkscape:version="0.44"\r
-   version="1.0"\r
-   inkscape:export-filename="D:\dev\icons\play.png"\r
-   inkscape:export-xdpi="14"\r
-   inkscape:export-ydpi="14"\r
-   sodipodi:docname="play.svg"\r
-   sodipodi:docbase="D:\dev\icons">\r
-  <defs\r
-     id="defs4">\r
-    <linearGradient\r
-       id="linearGradient2184">\r
-      <stop\r
-         style="stop-color:white;stop-opacity:1;"\r
-         offset="0"\r
-         id="stop2186" />\r
-      <stop\r
-         style="stop-color:#2aae3a;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop2188" />\r
-    </linearGradient>\r
-    <linearGradient\r
-       id="linearGradient3146">\r
-      <stop\r
-         style="stop-color:#0000ff;stop-opacity:1;"\r
-         offset="0"\r
-         id="stop3148" />\r
-      <stop\r
-         id="stop3156"\r
-         offset="0.5"\r
-         style="stop-color:#006eff;stop-opacity:1;" />\r
-      <stop\r
-         style="stop-color:#00ffff;stop-opacity:1;"\r
-         offset="0.75"\r
-         id="stop3158" />\r
-      <stop\r
-         style="stop-color:#0079ff;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop3150" />\r
-    </linearGradient>\r
-    <linearGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient2184"\r
-       id="linearGradient2190"\r
-       x1="8.00577"\r
-       y1="50.15"\r
-       x2="92.29423"\r
-       y2="50.15"\r
-       gradientUnits="userSpaceOnUse" />\r
-    <radialGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient2184"\r
-       id="radialGradient2795"\r
-       cx="50"\r
-       cy="50"\r
-       fx="50"\r
-       fy="50"\r
-       r="40.5"\r
-       gradientUnits="userSpaceOnUse" />\r
-    <radialGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient2184"\r
-       id="radialGradient5460"\r
-       cx="41.099998"\r
-       cy="49.999992"\r
-       fx="41.099998"\r
-       fy="49.999992"\r
-       r="30.5"\r
-       gradientTransform="matrix(0.724585,-2.263036e-7,3.286836e-7,1.055743,11.31954,-2.78713)"\r
-       gradientUnits="userSpaceOnUse" />\r
-  </defs>\r
-  <sodipodi:namedview\r
-     id="base"\r
-     pagecolor="#ffffff"\r
-     bordercolor="#666666"\r
-     borderopacity="1.0"\r
-     gridtolerance="10000"\r
-     guidetolerance="10"\r
-     objecttolerance="10"\r
-     inkscape:pageopacity="0.0"\r
-     inkscape:pageshadow="2"\r
-     inkscape:zoom="10"\r
-     inkscape:cx="50"\r
-     inkscape:cy="58.310406"\r
-     inkscape:document-units="px"\r
-     inkscape:current-layer="layer1"\r
-     width="100px"\r
-     height="100px"\r
-     inkscape:window-width="1272"\r
-     inkscape:window-height="960"\r
-     inkscape:window-x="0"\r
-     inkscape:window-y="0" />\r
-  <metadata\r
-     id="metadata7">\r
-    <rdf:RDF>\r
-      <cc:Work\r
-         rdf:about="">\r
-        <dc:format>image/svg+xml</dc:format>\r
-        <dc:type\r
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
-      </cc:Work>\r
-    </rdf:RDF>\r
-  </metadata>\r
-  <g\r
-     inkscape:label="Layer 1"\r
-     inkscape:groupmode="layer"\r
-     id="layer1">\r
-    <path\r
-       style="fill:url(#radialGradient5460);fill-opacity:1.0;fill-rule:evenodd;stroke:#009c00;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"\r
-       d="M 80,50 L 20,10 L 20,90 L 80,50 z "\r
-       id="path4567" />\r
-  </g>\r
-</svg>\r
diff --git a/dev/org.simantics.proconf.g3d/icons/rotate.png b/dev/org.simantics.proconf.g3d/icons/rotate.png
deleted file mode 100644 (file)
index bcc829f..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/rotate.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/rotate.svg b/dev/org.simantics.proconf.g3d/icons/rotate.svg
deleted file mode 100644 (file)
index 1b8d04b..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.43"
-   version="1.0"
-   inkscape:export-filename="C:\Documents and Settings\Make\Desktop\rotate.png"
-   inkscape:export-xdpi="14"
-   inkscape:export-ydpi="14"
-   sodipodi:docname="rotate.svg"
-   sodipodi:docbase="C:\Documents and Settings\Make\Desktop">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient2184">
-      <stop
-         style="stop-color:#2aae3a;stop-opacity:1;"
-         offset="0"
-         id="stop2186" />
-      <stop
-         style="stop-color:#2aae3a;stop-opacity:0;"
-         offset="1"
-         id="stop2188" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3146">
-      <stop
-         style="stop-color:#0000ff;stop-opacity:1;"
-         offset="0"
-         id="stop3148" />
-      <stop
-         id="stop3156"
-         offset="0.5"
-         style="stop-color:#006eff;stop-opacity:1;" />
-      <stop
-         style="stop-color:#00ffff;stop-opacity:1;"
-         offset="0.75"
-         id="stop3158" />
-      <stop
-         style="stop-color:#0079ff;stop-opacity:1;"
-         offset="1"
-         id="stop3150" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient2184"
-       id="linearGradient2190"
-       x1="8.00577"
-       y1="50.15"
-       x2="92.29423"
-       y2="50.15"
-       gradientUnits="userSpaceOnUse" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="10"
-     inkscape:cx="50"
-     inkscape:cy="52.718966"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1680"
-     inkscape:window-height="994"
-     inkscape:window-x="1280"
-     inkscape:window-y="22" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       style="fill:url(#linearGradient2190);fill-opacity:1.0;fill-rule:nonzero;stroke:#009c00;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       d="M 50.15,10.00577 C 27.990385,10.00577 10.00577,27.990385 10.00577,50.15 C 10.00577,72.309615 27.990385,90.29423 50.15,90.29423 C 61.229808,90.29423 71.260847,85.793059 78.526954,78.526954 L 64.351021,64.351021 C 60.717969,67.984074 55.689904,70.222115 50.15,70.222115 C 39.070192,70.222115 30.077885,61.229808 30.077885,50.15 C 30.077885,39.070192 39.070192,30.077885 50.15,30.077885 C 55.689904,30.077885 60.717969,32.315926 64.351021,35.948979 L 50.15,50.15 L 90.29423,50.15 L 90.29423,10.00577 L 78.526954,21.773046 C 71.260847,14.506941 61.229808,10.00577 50.15,10.00577 z "
-       id="path2162"
-       inkscape:export-xdpi="14"
-       inkscape:export-ydpi="14" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.g3d/icons/rw.png b/dev/org.simantics.proconf.g3d/icons/rw.png
deleted file mode 100644 (file)
index ccc1ce6..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/rw.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/rw.svg b/dev/org.simantics.proconf.g3d/icons/rw.svg
deleted file mode 100644 (file)
index dc4aed2..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
-<svg\r
-   xmlns:dc="http://purl.org/dc/elements/1.1/"\r
-   xmlns:cc="http://web.resource.org/cc/"\r
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
-   xmlns:svg="http://www.w3.org/2000/svg"\r
-   xmlns="http://www.w3.org/2000/svg"\r
-   xmlns:xlink="http://www.w3.org/1999/xlink"\r
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\r
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
-   width="100"\r
-   height="100"\r
-   id="svg2"\r
-   sodipodi:version="0.32"\r
-   inkscape:version="0.44"\r
-   version="1.0"\r
-   sodipodi:docname="rw.svg"\r
-   sodipodi:docbase="D:\dev\icons"\r
-   inkscape:export-filename="D:\dev\icons\rw.png"\r
-   inkscape:export-xdpi="14.4"\r
-   inkscape:export-ydpi="14.4">\r
-  <defs\r
-     id="defs4">\r
-    <linearGradient\r
-       id="linearGradient6310">\r
-      <stop\r
-         style="stop-color:white;stop-opacity:1;"\r
-         offset="0"\r
-         id="stop6312" />\r
-      <stop\r
-         style="stop-color:blue;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop6314" />\r
-    </linearGradient>\r
-    <linearGradient\r
-       id="linearGradient3686">\r
-      <stop\r
-         style="stop-color:red;stop-opacity:0;"\r
-         offset="0"\r
-         id="stop3688" />\r
-      <stop\r
-         style="stop-color:red;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop3690" />\r
-    </linearGradient>\r
-    <linearGradient\r
-       id="linearGradient3133">\r
-      <stop\r
-         style="stop-color:#4c4c4c;stop-opacity:1;"\r
-         offset="0"\r
-         id="stop3135" />\r
-      <stop\r
-         id="stop3141"\r
-         offset="0.5"\r
-         style="stop-color:#cbcbcb;stop-opacity:1;" />\r
-      <stop\r
-         style="stop-color:#4c4c4c;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop3137" />\r
-    </linearGradient>\r
-    <radialGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient6310"\r
-       id="radialGradient6316"\r
-       cx="63.25"\r
-       cy="49.999989"\r
-       fx="63.25"\r
-       fy="49.999989"\r
-       r="20.5"\r
-       gradientTransform="matrix(-0.768293,-5.919238e-8,1.428134e-7,-1.853659,85.34451,142.6829)"\r
-       gradientUnits="userSpaceOnUse" />\r
-    <radialGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient6310"\r
-       id="radialGradient6318"\r
-       cx="29"\r
-       cy="49.999989"\r
-       fx="29"\r
-       fy="49.999989"\r
-       r="20.5"\r
-       gradientTransform="matrix(-0.780488,-9.067778e-7,2.068587e-6,-1.780488,93.63404,139.0244)"\r
-       gradientUnits="userSpaceOnUse" />\r
-  </defs>\r
-  <sodipodi:namedview\r
-     id="base"\r
-     pagecolor="#ffffff"\r
-     bordercolor="#666666"\r
-     borderopacity="1.0"\r
-     gridtolerance="10000"\r
-     guidetolerance="10"\r
-     objecttolerance="10"\r
-     inkscape:pageopacity="0.0"\r
-     inkscape:pageshadow="2"\r
-     inkscape:zoom="4"\r
-     inkscape:cx="50"\r
-     inkscape:cy="40"\r
-     inkscape:document-units="px"\r
-     inkscape:current-layer="layer1"\r
-     width="100px"\r
-     height="100px"\r
-     inkscape:window-width="1280"\r
-     inkscape:window-height="968"\r
-     inkscape:window-x="-4"\r
-     inkscape:window-y="-4" />\r
-  <metadata\r
-     id="metadata7">\r
-    <rdf:RDF>\r
-      <cc:Work\r
-         rdf:about="">\r
-        <dc:format>image/svg+xml</dc:format>\r
-        <dc:type\r
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
-      </cc:Work>\r
-    </rdf:RDF>\r
-  </metadata>\r
-  <g\r
-     inkscape:label="Layer 1"\r
-     inkscape:groupmode="layer"\r
-     id="layer1">\r
-    <path\r
-       style="fill:url(#radialGradient6316);fill-opacity:1;fill-rule:evenodd;stroke:blue;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"\r
-       d="M 15,50 L 50,85 L 50,15 L 15,50 z "\r
-       id="path4536" />\r
-    <path\r
-       style="fill:url(#radialGradient6318);fill-opacity:1;fill-rule:evenodd;stroke:blue;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"\r
-       d="M 84.5,15 L 85,85 L 50,50 L 84.5,15 z "\r
-       id="path4538" />\r
-  </g>\r
-</svg>\r
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_eject.png b/dev/org.simantics.proconf.g3d/icons/silk/control_eject.png
deleted file mode 100644 (file)
index 924d817..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_eject.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_eject_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_eject_blue.png
deleted file mode 100644 (file)
index 2bd4963..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_eject_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_end.png b/dev/org.simantics.proconf.g3d/icons/silk/control_end.png
deleted file mode 100644 (file)
index 036e04d..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_end.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_end_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_end_blue.png
deleted file mode 100644 (file)
index 7207935..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_end_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_equalizer.png b/dev/org.simantics.proconf.g3d/icons/silk/control_equalizer.png
deleted file mode 100644 (file)
index 4606087..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_equalizer.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_equalizer_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_equalizer_blue.png
deleted file mode 100644 (file)
index 1b2e6a3..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_equalizer_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_fastforward.png b/dev/org.simantics.proconf.g3d/icons/silk/control_fastforward.png
deleted file mode 100644 (file)
index 31f7fd3..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_fastforward.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_fastforward_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_fastforward_blue.png
deleted file mode 100644 (file)
index 4a2f9d4..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_fastforward_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_pause.png b/dev/org.simantics.proconf.g3d/icons/silk/control_pause.png
deleted file mode 100644 (file)
index 2d9ce9c..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_pause.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_pause_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_pause_blue.png
deleted file mode 100644 (file)
index ec61099..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_pause_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_play.png b/dev/org.simantics.proconf.g3d/icons/silk/control_play.png
deleted file mode 100644 (file)
index 0846555..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_play.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_play_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_play_blue.png
deleted file mode 100644 (file)
index f8c8ec6..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_play_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_repeat.png b/dev/org.simantics.proconf.g3d/icons/silk/control_repeat.png
deleted file mode 100644 (file)
index 1c4f57a..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_repeat.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_repeat_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_repeat_blue.png
deleted file mode 100644 (file)
index 406ec33..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_repeat_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_rewind.png b/dev/org.simantics.proconf.g3d/icons/silk/control_rewind.png
deleted file mode 100644 (file)
index c029447..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_rewind.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_rewind_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_rewind_blue.png
deleted file mode 100644 (file)
index 15d1584..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_rewind_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_start.png b/dev/org.simantics.proconf.g3d/icons/silk/control_start.png
deleted file mode 100644 (file)
index 7dd1c07..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_start.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_start_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_start_blue.png
deleted file mode 100644 (file)
index 6f11fcb..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_start_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_stop.png b/dev/org.simantics.proconf.g3d/icons/silk/control_stop.png
deleted file mode 100644 (file)
index 893bb60..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_stop.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/control_stop_blue.png b/dev/org.simantics.proconf.g3d/icons/silk/control_stop_blue.png
deleted file mode 100644 (file)
index e6f75d2..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/control_stop_blue.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/lock.png b/dev/org.simantics.proconf.g3d/icons/silk/lock.png
deleted file mode 100644 (file)
index 2ebc4f6..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/lock.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/silk/lock_open.png b/dev/org.simantics.proconf.g3d/icons/silk/lock_open.png
deleted file mode 100644 (file)
index a471765..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/silk/lock_open.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/stop.png b/dev/org.simantics.proconf.g3d/icons/stop.png
deleted file mode 100644 (file)
index ef86eb5..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/stop.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/stop.svg b/dev/org.simantics.proconf.g3d/icons/stop.svg
deleted file mode 100644 (file)
index 58381c7..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
-<svg\r
-   xmlns:dc="http://purl.org/dc/elements/1.1/"\r
-   xmlns:cc="http://web.resource.org/cc/"\r
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
-   xmlns:svg="http://www.w3.org/2000/svg"\r
-   xmlns="http://www.w3.org/2000/svg"\r
-   xmlns:xlink="http://www.w3.org/1999/xlink"\r
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\r
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
-   width="100"\r
-   height="100"\r
-   id="svg2"\r
-   sodipodi:version="0.32"\r
-   inkscape:version="0.44"\r
-   version="1.0"\r
-   sodipodi:docname="stop.svg"\r
-   sodipodi:docbase="D:\dev\icons"\r
-   inkscape:export-filename="D:\dev\icons\stop.png"\r
-   inkscape:export-xdpi="14.4"\r
-   inkscape:export-ydpi="14.4">\r
-  <defs\r
-     id="defs4">\r
-    <linearGradient\r
-       id="linearGradient3686">\r
-      <stop\r
-         style="stop-color:white;stop-opacity:1;"\r
-         offset="0"\r
-         id="stop3688" />\r
-      <stop\r
-         style="stop-color:red;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop3690" />\r
-    </linearGradient>\r
-    <linearGradient\r
-       id="linearGradient3133">\r
-      <stop\r
-         style="stop-color:#4c4c4c;stop-opacity:1;"\r
-         offset="0"\r
-         id="stop3135" />\r
-      <stop\r
-         id="stop3141"\r
-         offset="0.5"\r
-         style="stop-color:#cbcbcb;stop-opacity:1;" />\r
-      <stop\r
-         style="stop-color:#4c4c4c;stop-opacity:1;"\r
-         offset="1"\r
-         id="stop3137" />\r
-    </linearGradient>\r
-    <radialGradient\r
-       inkscape:collect="always"\r
-       xlink:href="#linearGradient3686"\r
-       id="radialGradient3657"\r
-       cx="50"\r
-       cy="50"\r
-       fx="50"\r
-       fy="50"\r
-       r="42"\r
-       gradientUnits="userSpaceOnUse"\r
-       gradientTransform="matrix(1.366955,0,0,1.366953,-18.34766,-18.34764)" />\r
-  </defs>\r
-  <sodipodi:namedview\r
-     id="base"\r
-     pagecolor="#ffffff"\r
-     bordercolor="#666666"\r
-     borderopacity="1.0"\r
-     gridtolerance="10000"\r
-     guidetolerance="10"\r
-     objecttolerance="10"\r
-     inkscape:pageopacity="0.0"\r
-     inkscape:pageshadow="2"\r
-     inkscape:zoom="7.72"\r
-     inkscape:cx="50"\r
-     inkscape:cy="50"\r
-     inkscape:document-units="px"\r
-     inkscape:current-layer="layer1"\r
-     width="100px"\r
-     height="100px"\r
-     inkscape:window-width="1280"\r
-     inkscape:window-height="968"\r
-     inkscape:window-x="-4"\r
-     inkscape:window-y="-4" />\r
-  <metadata\r
-     id="metadata7">\r
-    <rdf:RDF>\r
-      <cc:Work\r
-         rdf:about="">\r
-        <dc:format>image/svg+xml</dc:format>\r
-        <dc:type\r
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
-      </cc:Work>\r
-    </rdf:RDF>\r
-  </metadata>\r
-  <g\r
-     inkscape:label="Layer 1"\r
-     inkscape:groupmode="layer"\r
-     id="layer1">\r
-    <path\r
-       style="fill:url(#radialGradient3657);fill-opacity:1;fill-rule:evenodd;stroke:red;stroke-width:6;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"\r
-       d="M 17.619764,17.619763 L 17.619764,82.380236 L 82.380236,82.380236 L 82.380236,17.619763 L 17.619764,17.619763 z "\r
-       id="path1878" />\r
-  </g>\r
-</svg>\r
diff --git a/dev/org.simantics.proconf.g3d/icons/translate.png b/dev/org.simantics.proconf.g3d/icons/translate.png
deleted file mode 100644 (file)
index 21f5284..0000000
Binary files a/dev/org.simantics.proconf.g3d/icons/translate.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.g3d/icons/translate.svg b/dev/org.simantics.proconf.g3d/icons/translate.svg
deleted file mode 100644 (file)
index b600c2f..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   inkscape:export-filename="C:\Documents and Settings\Make\Desktop\rotate.png"
-   inkscape:export-xdpi="14"
-   inkscape:export-ydpi="14"
-   sodipodi:docname="translate.svg"
-   sodipodi:docbase="D:\dev\icons">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient2184">
-      <stop
-         style="stop-color:#2aae3a;stop-opacity:1;"
-         offset="0"
-         id="stop2186" />
-      <stop
-         style="stop-color:#2aae3a;stop-opacity:0;"
-         offset="1"
-         id="stop2188" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3146">
-      <stop
-         style="stop-color:#0000ff;stop-opacity:1;"
-         offset="0"
-         id="stop3148" />
-      <stop
-         id="stop3156"
-         offset="0.5"
-         style="stop-color:#006eff;stop-opacity:1;" />
-      <stop
-         style="stop-color:#00ffff;stop-opacity:1;"
-         offset="0.75"
-         id="stop3158" />
-      <stop
-         style="stop-color:#0079ff;stop-opacity:1;"
-         offset="1"
-         id="stop3150" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient2184"
-       id="linearGradient2190"
-       x1="8.00577"
-       y1="50.15"
-       x2="92.29423"
-       y2="50.15"
-       gradientUnits="userSpaceOnUse" />
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient2184"
-       id="radialGradient4579"
-       cx="50"
-       cy="50"
-       fx="50"
-       fy="50"
-       r="52"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(0.809436,0,0,0.809436,9.463433,9.592966)" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.72"
-     inkscape:cx="50"
-     inkscape:cy="39.637306"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       style="fill:url(#radialGradient4579);fill-opacity:1;fill-rule:evenodd;stroke:#009c00;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 49.935233,9.5929652 L 33.746512,25.781686 L 41.840873,25.781686 L 41.840873,41.970406 L 25.652153,41.970406 L 25.652153,33.876046 L 9.4634316,50.064767 L 25.652153,66.253488 L 25.652153,58.159127 L 41.840873,58.159127 L 41.840873,74.347847 L 33.746512,74.347847 L 49.935233,90.536568 L 66.123954,74.347847 L 58.029594,74.347847 L 58.029594,58.159127 L 74.218314,58.159127 L 74.218314,66.253488 L 90.407036,50.064767 L 74.218314,33.876046 L 74.218314,41.970406 L 58.029594,41.970406 L 58.029594,25.781686 L 66.123954,25.781686 L 49.935233,9.5929652 z "
-       id="path1879" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.g3d/logging.properties b/dev/org.simantics.proconf.g3d/logging.properties
deleted file mode 100644 (file)
index d8ec9e4..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-############################################################\r
-#      Default Logging Configuration File\r
-#\r
-# You can use a different file by specifying a filename\r
-# with the java.util.logging.config.file system property.  \r
-# For example java -Djava.util.logging.config.file=myfile\r
-############################################################\r
-\r
-############################################################\r
-#      Global properties\r
-############################################################\r
-\r
-# "handlers" specifies a comma separated list of log Handler \r
-# classes.  These handlers will be installed during VM startup.\r
-# Note that these classes must be on the system classpath.\r
-# By default we only configure a ConsoleHandler, which will only\r
-# show messages at the INFO and above levels.\r
-handlers= java.util.logging.ConsoleHandler\r
-\r
-# To also add the FileHandler, use the following line instead.\r
-#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler\r
-\r
-# Default global logging level.\r
-# This specifies which kinds of events are logged across\r
-# all loggers.  For any given facility this global level\r
-# can be overriden by a facility specific level\r
-# Note that the ConsoleHandler also has a separate level\r
-# setting to limit messages printed to the console.\r
-.level= OFF\r
-\r
-############################################################\r
-# Handler specific properties.\r
-# Describes specific configuration info for Handlers.\r
-############################################################\r
-\r
-# default file output is in user's home directory.\r
-java.util.logging.FileHandler.pattern = %h/java%u.log\r
-java.util.logging.FileHandler.limit = 50000\r
-java.util.logging.FileHandler.count = 1\r
-java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter\r
-\r
-# Limit the message that are printed on the console to INFO and above.\r
-java.util.logging.ConsoleHandler.level = OFF\r
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter\r
-\r
-\r
-############################################################\r
-# Facility specific properties.\r
-# Provides extra control for each logger.\r
-############################################################\r
-\r
-# For example, set the com.xyz.foo logger to only log SEVERE\r
-# messages:\r
-# com.xyz.foo.level = SEVERE\r
diff --git a/dev/org.simantics.proconf.g3d/plugin.xml b/dev/org.simantics.proconf.g3d/plugin.xml
deleted file mode 100644 (file)
index fc55861..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<?eclipse version="3.2"?>\r
-<plugin>\r
-   <extension-point id="geometry" name="Geometry" schema="schema/geometry.exsd"/>\r
-   <extension\r
-         point="org.eclipse.ui.preferencePages">\r
-      <page\r
-            category="org.simantics.proconf.preferences"\r
-            class="org.simantics.proconf.g3d.preferences.G3DPreferencesPage"\r
-            id="fi.vtt.simantics.g3d.page1"\r
-            name="3D Preferences">\r
-      </page>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.core.runtime.preferences">\r
-      <initializer\r
-            class="org.simantics.proconf.g3d.preferences.PreferenceInitializer">\r
-      </initializer>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.views">\r
-      <view\r
-            allowMultiple="false"\r
-            class="org.simantics.proconf.g3d.views.ScenegraphViewPart"\r
-            icon="icons/geometry.png"\r
-            id="org.simantics.g3d.views.scenegraph"\r
-            name="Scene-graph">\r
-      </view>\r
-      <view\r
-            allowMultiple="false"\r
-            class="org.simantics.proconf.g3d.views.AppearanceEditor"\r
-            icon="icons/geometry.png"\r
-            id="org.simantics.proconf.g3d.view1"\r
-            name="Appearance Editor">\r
-      </view>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.core.expressions.propertyTesters">\r
-      <propertyTester\r
-            class="org.simantics.proconf.g3d.common.PropertyTester2"\r
-            id="org.simantics.proconf.editorToolTester"\r
-            namespace="org.simantics.proconf"\r
-            properties="editorTool"\r
-            type="org.eclipse.jface.viewers.IStructuredSelection">\r
-      </propertyTester>\r
-   </extension>\r
-</plugin>\r
diff --git a/dev/org.simantics.proconf.g3d/schema/geometry.exsd b/dev/org.simantics.proconf.g3d/schema/geometry.exsd
deleted file mode 100644 (file)
index f6af128..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>\r
-<!-- Schema file written by PDE -->\r
-<schema targetNamespace="org.simantics.proconf.g3d">\r
-<annotation>\r
-      <appInfo>\r
-         <meta.schema plugin="org.simantics.proconf.g3d" id="geometry" name="Geometry"/>\r
-      </appInfo>\r
-      <documentation>\r
-         [Enter description of this extension point.]\r
-      </documentation>\r
-   </annotation>\r
-\r
-   <element name="extension">\r
-      <complexType>\r
-         <sequence>\r
-            <element ref="Geometry" minOccurs="0" maxOccurs="unbounded"/>\r
-         </sequence>\r
-         <attribute name="point" type="string" use="required">\r
-            <annotation>\r
-               <documentation>\r
-                  \r
-               </documentation>\r
-            </annotation>\r
-         </attribute>\r
-         <attribute name="id" type="string">\r
-            <annotation>\r
-               <documentation>\r
-                  \r
-               </documentation>\r
-            </annotation>\r
-         </attribute>\r
-         <attribute name="name" type="string">\r
-            <annotation>\r
-               <documentation>\r
-                  \r
-               </documentation>\r
-               <appInfo>\r
-                  <meta.attribute translatable="true"/>\r
-               </appInfo>\r
-            </annotation>\r
-         </attribute>\r
-      </complexType>\r
-   </element>\r
-\r
-   <element name="Geometry">\r
-      <complexType>\r
-         <attribute name="id" type="string" use="required">\r
-            <annotation>\r
-               <documentation>\r
-                  \r
-               </documentation>\r
-            </annotation>\r
-         </attribute>\r
-         <attribute name="class" type="string" use="required">\r
-            <annotation>\r
-               <documentation>\r
-                  \r
-               </documentation>\r
-               <appInfo>\r
-                  <meta.attribute kind="java" basedOn=":fi.vtt.simantics.g3d.base.GeometryProvider"/>\r
-               </appInfo>\r
-            </annotation>\r
-         </attribute>\r
-      </complexType>\r
-   </element>\r
-\r
-   <annotation>\r
-      <appInfo>\r
-         <meta.section type="since"/>\r
-      </appInfo>\r
-      <documentation>\r
-         [Enter the first release in which this extension point appears.]\r
-      </documentation>\r
-   </annotation>\r
-\r
-   <annotation>\r
-      <appInfo>\r
-         <meta.section type="examples"/>\r
-      </appInfo>\r
-      <documentation>\r
-         [Enter extension point usage example here.]\r
-      </documentation>\r
-   </annotation>\r
-\r
-   <annotation>\r
-      <appInfo>\r
-         <meta.section type="apiInfo"/>\r
-      </appInfo>\r
-      <documentation>\r
-         [Enter API information here.]\r
-      </documentation>\r
-   </annotation>\r
-\r
-   <annotation>\r
-      <appInfo>\r
-         <meta.section type="implementation"/>\r
-      </appInfo>\r
-      <documentation>\r
-         [Enter information about supplied implementation of this extension point.]\r
-      </documentation>\r
-   </annotation>\r
-\r
-   <annotation>\r
-      <appInfo>\r
-         <meta.section type="copyright"/>\r
-      </appInfo>\r
-      <documentation>\r
-         \r
-      </documentation>\r
-   </annotation>\r
-\r
-</schema>\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/Activator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/Activator.java
deleted file mode 100644 (file)
index 38b8b6f..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d;\r
-\r
-import org.eclipse.ui.plugin.AbstractUIPlugin;\r
-import org.osgi.framework.BundleContext;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.db.management.ISessionContextChangedListener;\r
-import org.simantics.db.management.SessionContextChangedEvent;\r
-import org.simantics.proconf.ui.ProConfUI;\r
-\r
-/**\r
- * The activator class controls the plug-in life cycle\r
- */\r
-public class Activator extends AbstractUIPlugin {\r
-\r
-       // The plug-in ID\r
-       public static final String PLUGIN_ID = "org.simantics.proconf.g3d";\r
-\r
-       // The shared instance\r
-       private static Activator plugin;\r
-       \r
-       /**\r
-        * The constructor\r
-        */\r
-       public Activator() {\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)\r
-        */\r
-       public void start(BundleContext context) throws Exception {\r
-               super.start(context);\r
-               plugin = this;\r
-               ProConfUI.getSessionContextProvider().addContextChangedListener(new ISessionContextChangedListener() {\r
-                       @Override\r
-                       public void sessionContextChanged(SessionContextChangedEvent event) {\r
-                               ISessionContext ctx = event.getNewValue();\r
-                               if (ctx != null) {\r
-                                       ctx.getSession().asyncRead(new GraphRequestAdapter() {\r
-                                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                                       Resources.initialize(g);\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               };\r
-                                       });\r
-                               } else {\r
-                                       Resources.deinitialize();\r
-                               }\r
-                       }\r
-               });\r
-               try {\r
-                       ProConfUI.getSession().asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       Resources.initialize(g);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-               } catch (Exception e) {\r
-                       \r
-               }\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)\r
-        */\r
-       public void stop(BundleContext context) throws Exception {\r
-               plugin = null;\r
-               super.stop(context);\r
-       }\r
-\r
-       /**\r
-        * Returns the shared instance\r
-        *\r
-        * @return the shared instance\r
-        */\r
-       public static Activator getDefault() {\r
-               return plugin;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/Resources.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/Resources.java
deleted file mode 100644 (file)
index f0cacb4..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.equation.stubs.EquationResource;\r
-import org.simantics.g2d.stubs.anim.AnimationResource;\r
-import org.simantics.animation.curve.CurveBuilder;\r
-import org.simantics.animation.curve.CurveBuilderImpl;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.stubs.G3DResource;\r
-\r
-public class Resources {\r
-       public static AnimationResource animationResource;\r
-       public static G3DResource g3dResource;\r
-       public static CurveBuilder curveBuilder;\r
-       public static EquationResource equationResource;\r
-       \r
-       public static void initialize(Graph g) {\r
-               animationResource = AnimationResource.getInstance(g);\r
-               g3dResource = G3DResource.getInstance(g);\r
-               curveBuilder = new CurveBuilderImpl(Resources.animationResource);\r
-               equationResource = EquationResource.getInstance(g);\r
-               G3DTools.initialize();\r
-       }\r
-       \r
-       public static void deinitialize() {\r
-               animationResource = null;\r
-               g3dResource = null;\r
-               curveBuilder = null;\r
-               equationResource = null;\r
-               G3DTools.deinitialize();\r
-       }\r
-       \r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/CameraAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/CameraAction.java
deleted file mode 100644 (file)
index 2f61904..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import java.awt.event.KeyEvent;\r
-import java.awt.event.MouseEvent;\r
-import java.util.List;\r
-\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.OrbitalCamera;\r
-\r
-\r
-\r
-public class CameraAction extends InteractiveAction{\r
-       \r
-       private JmeRenderingComponent component;\r
-       private OrbitalCamera camera;\r
-       \r
-    public CameraAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        component = parent.getRenderingComponent();\r
-        camera = parent.getCamera();\r
-    }\r
-    \r
-    @Override\r
-    public void activate() {\r
-\r
-    }\r
-\r
-    @Override\r
-    public void deactivate() {\r
-\r
-    }\r
-    \r
-    @Override\r
-  public boolean usable(Graph graph,List<Resource> resources) {\r
-      return true;\r
-  }\r
-\r
-    Vector3d prevIntersectPoint = new Vector3d();\r
-    @Override\r
-    public void update() {\r
-        double scale = 1.0;\r
-        if (input.keyDown(KeyEvent.VK_CONTROL))\r
-            scale = -1.0;\r
-        if (input.keyPressed(KeyEvent.VK_NUMPAD5)) {\r
-            if (component.getProjectionPolicy() == JmeRenderingComponent.PERSPECTIVE_PROJECTION)\r
-                component.setProjectionPolicy(JmeRenderingComponent.PARALLEL_PROJECTION);\r
-            else\r
-                component.setProjectionPolicy(JmeRenderingComponent.PERSPECTIVE_PROJECTION);\r
-            parent.setViewChanged(true);\r
-        }\r
-        if (input.keyPressed(KeyEvent.VK_NUMPAD7)) {\r
-            camera.setCameraPosRelativeToTarget(new Vector3d(camera.getDistanceToTarget() * scale, 0, 0));\r
-            parent.setViewChanged(true);\r
-        }\r
-        if (input.keyPressed(KeyEvent.VK_NUMPAD1)) {\r
-            camera.setCameraPosRelativeToTarget(new Vector3d(0, 0, camera.getDistanceToTarget() * scale));\r
-            parent.setViewChanged(true);\r
-        }\r
-        if (input.keyPressed(KeyEvent.VK_NUMPAD9)) {\r
-            camera.setCameraPosRelativeToTarget(new Vector3d(0, camera.getDistanceToTarget() * scale, 0));\r
-            parent.setViewChanged(true);\r
-        }\r
-\r
-        if (input.mousePressed() && ((input.pressModifiers() & MouseEvent.BUTTON1_MASK) > 0)) {\r
-            Vector3d o = new Vector3d();\r
-            Vector3d d = new Vector3d();\r
-            parent.createPickRay(o, d);\r
-            Vector3d point = new Vector3d(camera.getTarget());\r
-            Vector3d normal = camera.getUnNormalizedHeading();\r
-            normal.normalize();\r
-            MathTools.intersectStraightPlane(o, d, point, normal, prevIntersectPoint);\r
-        }\r
-        if (!input.mouseDragged())\r
-            return;\r
-        parent.setViewChanged(true);\r
-        Vector3d msTmp = new Vector3d();\r
-        msTmp.x = (input.prevMouseX() - input.mouseX()) / 100f;\r
-        msTmp.y = (input.prevMouseY() - input.mouseY()) / 100f;\r
-\r
-        if ((input.dragModifiers() & MouseEvent.BUTTON1_MASK) > 0) {\r
-            if ((input.dragModifiers() & MouseEvent.CTRL_MASK) > 0) {\r
-                Vector3d o = new Vector3d();\r
-                Vector3d d = new Vector3d();\r
-                parent.createPickRay(o, d);\r
-                Vector3d point = new Vector3d(camera.getTarget());\r
-                Vector3d normal = camera.getUnNormalizedHeading();\r
-                normal.normalize();\r
-                Vector3d intersectPoint = new Vector3d();\r
-                if (MathTools.intersectStraightPlane(o, d, point, normal, intersectPoint)) {\r
-                    Vector3d delta = new Vector3d(intersectPoint);\r
-                    delta.sub(prevIntersectPoint);\r
-                    prevIntersectPoint = intersectPoint;\r
-                    delta.negate();\r
-                    camera.translate(delta);\r
-                    prevIntersectPoint.add(delta);\r
-                } else {\r
-                    camera.moveRight((float) msTmp.x);\r
-                    camera.moveUp(-(float) msTmp.y);\r
-                }\r
-            } else {\r
-                camera.rotateRight((float) msTmp.x);\r
-                camera.rotateUp((float) msTmp.y);\r
-            }\r
-        } else if ((input.dragModifiers() & MouseEvent.BUTTON2_MASK) > 0) {\r
-            // System.out.println("zoom");\r
-            if (component.getProjectionPolicy() == JmeRenderingComponent.PERSPECTIVE_PROJECTION) {\r
-                camera.moveScaledToTarget((float) msTmp.y * 0.5f);\r
-            } else {\r
-                component.setScreenScale(component.getScreenScale() - (float) msTmp.y * 0.5f * component.getScreenScale());\r
-            }\r
-        }\r
-//        } else {\r
-//            System.out.println("cameraAction!");\r
-//            System.out.println(input);\r
-//        } \r
-       \r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ConstrainedTransformAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ConstrainedTransformAction.java
deleted file mode 100644 (file)
index 1cd0b59..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.base.ConstraintDetector;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.OrbitalCamera;\r
-\r
-\r
-public abstract class ConstrainedTransformAction extends WriteInteractiveAction {\r
-       private static final ImageDescriptor LOCK_ICON = Activator.imageDescriptorFromPlugin("org.simantic.proconf.g3d", "icons/silk/lock.png");\r
-       private static final ImageDescriptor LOCK_OPEN_ICON = Activator.imageDescriptorFromPlugin("org.simantic.proconf.g3d", "icons/silk/lock_open.png");\r
-       \r
-       protected JmeRenderingComponent component;\r
-       protected OrbitalCamera camera;\r
-       \r
-    protected boolean useConstraints = false;\r
-    protected ConstraintDetector detector;\r
-    \r
-    protected Action useConstraintsAction;\r
-    \r
-    //protected IToolBarManager manager;\r
-    \r
-       public ConstrainedTransformAction(ThreeDimensionalEditorBase editor) {\r
-               super(editor, true);\r
-               component = parent.getRenderingComponent();\r
-               camera = parent.getCamera();\r
-               detector = new ConstraintDetector(parent);\r
-               useConstraintsAction = new Action("Constraints", Action.AS_CHECK_BOX) {\r
-                       public void run() {\r
-                               useConstraints = this.isChecked();\r
-                       }\r
-\r
-                       public void setChecked(boolean b) {\r
-                               super.setChecked(b);\r
-                               if (b) {\r
-                                       setImageDescriptor(LOCK_ICON);\r
-                               } else {\r
-                                       setImageDescriptor(LOCK_OPEN_ICON);\r
-                               }\r
-                       }\r
-               };\r
-               useConstraintsAction.setImageDescriptor(LOCK_OPEN_ICON);\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void deactivate() {\r
-               detector.clearConstraintHighlights();\r
-       }\r
-       \r
-       @Override\r
-       public void fillToolBar(IToolBarManager manager) {\r
-                //this.manager = manager;\r
-                useConstraintsAction.setChecked(useConstraints);\r
-                manager.add(useConstraintsAction);\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextAction.java
deleted file mode 100644 (file)
index c86858d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-\r
-\r
-/**\r
- * Context / selection dependent action\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public abstract class ContextAction extends Action {\r
-    protected ThreeDimensionalEditorBase parent;\r
-\r
-    public ContextAction(ThreeDimensionalEditorBase parent) {\r
-        this.parent = parent;\r
-        init();\r
-    }\r
-    \r
-    /**\r
-     * Initialization\r
-     */\r
-    public void init(){};\r
\r
-    /**\r
-     * Runs the action\r
-     */\r
-    public abstract void run();\r
-    \r
-    /**\r
-     * Used to check if action is usable for given resources\r
-     * @param resources\r
-     * @return\r
-     */\r
-    public abstract boolean usable(Graph graph, List<Resource> resources);\r
-    \r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextActionFactory.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextActionFactory.java
deleted file mode 100644 (file)
index ce6638a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-\r
-\r
-public interface ContextActionFactory {\r
-       \r
-       \r
-       public ContextAction createAction(ThreeDimensionalEditorBase editor);\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextActionRegistry.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextActionRegistry.java
deleted file mode 100644 (file)
index bb8ffbc..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.simantics.utils.ui.plugin.Extension;\r
-import org.simantics.utils.ui.plugin.ExtensionLoader;\r
-\r
-\r
-\r
-public class ContextActionRegistry {\r
-       /*\r
-    private static ContextActionRegistry instance;\r
-    public final static String ELEMENT_NAME = "ContextAction";\r
-    public final static String NAME_SPACE = "org.simantics.proconf.g3d";\r
-    public final static String EP_NAME = "contextaction";\r
-    \r
-    private ExtensionLoader<ContextActionFactory> loader;\r
-    \r
-    private ContextActionRegistry() {\r
-        loader = new ExtensionLoader<ContextActionFactory>(ELEMENT_NAME, NAME_SPACE, EP_NAME);\r
-    }\r
-    \r
-    public static ContextActionRegistry getInstance() {\r
-        if (instance==null) instance = new ContextActionRegistry();\r
-        return instance;\r
-    }\r
-\r
-    public Extension<ContextActionFactory>[] getExtensions() {\r
-        return loader.getExtensions();\r
-    }\r
-\r
-    \r
-    public static ContextActionFactory[] getActions(String editorID) {\r
-       List<ContextActionFactory> list = new ArrayList<ContextActionFactory>();\r
-       for (Extension<ContextActionFactory> e : getInstance().getExtensions()) {\r
-               if(e.getStringField("editorid").compareTo(editorID) == 0) {\r
-                       list.add(e.getInstance());\r
-               }\r
-       }\r
-       return list.toArray(new ContextActionFactory[0]);\r
-    }\r
-    */\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/FocusAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/FocusAction.java
deleted file mode 100644 (file)
index 7893f23..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.OrbitalCamera;\r
-import org.simantics.proconf.g3d.stubs.Tuple3;\r
-\r
-public class FocusAction extends ContextAction{\r
-\r
-       private OrbitalCamera camera;\r
-       \r
-    Vector3d focusPoint = null;\r
-    \r
-    public FocusAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        camera = parent.getCamera();\r
-    }\r
-    \r
-    public void init() {\r
-        this.setText("Focus");\r
-        this.setToolTipText("Focus");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/eye.png"));\r
-    }\r
-    \r
-\r
-    \r
-    @Override\r
-  public boolean usable(Graph graph,List<Resource> resources) {\r
-      if (resources.size() != 1)\r
-          return false;\r
-      IEntity t = EntityFactory.create(graph, resources.get(0));\r
-      \r
-      if (t.isInstanceOf(Resources.g3dResource.G3DNode)) {\r
-          Collection<IEntity> p = t.getRelatedObjects(Resources.g3dResource.HasWorldPosition);\r
-          if (p == null || p.size() != 1)\r
-              return false;\r
-          else \r
-              //focusPoint = new Vector3d(G3DTools.getPoint(new Position(graph,p.iterator().next().getResource())));\r
-              focusPoint = new Vector3d(G3DTools.getPoint(new Tuple3(graph,p.iterator().next().getResource())));\r
-      }\r
-      return true;\r
-  }\r
-    \r
-    public void run() {\r
-        camera.setTarget(focusPoint);\r
-        parent.setViewChanged(true);\r
-    }\r
-\r
-   \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/InteractiveAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/InteractiveAction.java
deleted file mode 100644 (file)
index a797434..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.input.InputProvider;\r
-\r
-\r
-\r
-/**\r
- * Context / selection dependent action that requires user's interaction\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public abstract class InteractiveAction extends ContextAction {\r
-    protected InputProvider input;\r
-    \r
-    public InteractiveAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        input = parent.getInputProvider();\r
-    }\r
-    \r
-    public abstract void update() ;\r
-\r
-    /**\r
-     * Activates the action\r
-     */\r
-    public abstract void activate();\r
-\r
-    /**\r
-     * Deactivates / ends the action\r
-     */\r
-    public abstract void deactivate();\r
-    \r
-    /**\r
-     * Activates the action in the viewer. Normally there's no need to override this method.\r
-     */\r
-    public final void run() {\r
-        parent.setCurrentAction(this);\r
-    }\r
-    \r
-    /**\r
-     * This method is used to end the action, call this from <code>update()</code>.\r
-     *\r
-     */\r
-    public void end() {\r
-        parent.setCurrentAction(parent.getDefaultAction());\r
-    }\r
-    \r
-    public void fillToolBar(IToolBarManager manager) {\r
-        \r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ReadAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ReadAction.java
deleted file mode 100644 (file)
index 36fcc4b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequest;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Session;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-\r
-public abstract class ReadAction extends ContextAction {\r
-       boolean sync;\r
-       public ReadAction(ThreeDimensionalEditorBase parent, boolean sync) {\r
-               super(parent);\r
-               this.sync = sync;\r
-       }\r
-\r
-       @Override\r
-       public final void run() {\r
-               Session session = parent.getSession();\r
-               if(!canActivate()) {\r
-                       return;\r
-               }\r
-               GraphRequest r = new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               doChanges(g);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               };\r
-               if (sync) {\r
-                       session.syncRead(r);\r
-               } else {\r
-                       session.asyncRead(r);\r
-               } \r
-       }\r
-       \r
-       public abstract void doChanges(Graph graph) throws Exception;\r
-\r
-       public boolean canActivate() {\r
-               return true;\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ReadInteractiveAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ReadInteractiveAction.java
deleted file mode 100644 (file)
index 9bd972c..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequest;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Session;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-\r
-public abstract class ReadInteractiveAction extends InteractiveAction {\r
-       boolean sync;\r
-       \r
-       public ReadInteractiveAction(ThreeDimensionalEditorBase parent, boolean sync) {\r
-               super(parent);\r
-               this.sync = sync;\r
-       }\r
-       \r
-       @Override\r
-       public final void update(){\r
-               Session session = parent.getSession();\r
-               GraphRequest r = new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               doChanges(g);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               };\r
-               if (sync) {\r
-                       session.syncRead(r);\r
-               } else {\r
-                       session.asyncRead(r);\r
-               } \r
-       }\r
-\r
-       \r
-       public abstract void doChanges(Graph graph) throws Exception;\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/RemoveAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/RemoveAction.java
deleted file mode 100644 (file)
index ac9bdfa..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-\r
-public class RemoveAction extends WriteAction {\r
-    \r
-    public RemoveAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent,false);\r
-    }\r
-    \r
-    public void init() {\r
-        setText("Remove");\r
-        setToolTipText("Remove the object");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/delete.png"));\r
-    }\r
-    public GraphRequestStatus doChanges(Graph graph) {\r
-        StructuredResourceSelection sel = parent.getSelectionAdapter().getCurrentSelection();\r
-        List<Resource> res = sel.getSelectionList();\r
-        for (Resource r : res) {\r
-                IEntity t = EntityFactory.create(graph, r);\r
-                if (t.isInstanceOf(Resources.g3dResource.G3DNode)) {\r
-                    IEntity parentNode = t.getSingleRelatedObject(Resources.g3dResource.HasParent);\r
-                    parentNode.removeStatement(Resources.g3dResource.HasChild, t);\r
-                }\r
-\r
-            }\r
-        return GraphRequestStatus.transactionComplete();\r
-     \r
-    }\r
-    \r
-    @Override\r
-    public boolean usable(Graph graph,List<Resource> resources) {\r
-        return resources.size() > 0;\r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/RotateAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/RotateAction.java
deleted file mode 100644 (file)
index fe6fc71..0000000
+++ /dev/null
@@ -1,453 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import java.awt.event.KeyEvent;\r
-import java.awt.event.MouseEvent;\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.AxisAngle4f;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequest;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-import org.simantics.proconf.g3d.common.OrbitalCamera;\r
-import org.simantics.proconf.g3d.gizmo.RotateGizmo;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-public class RotateAction extends WriteInteractiveAction {\r
-       \r
-       private JmeRenderingComponent component;\r
-       \r
-    private RotateGizmo gizmo;\r
-\r
-    private OrbitalCamera camera;\r
-    \r
-    private Map<IGraphicsNode, AxisAngle4d > rotations = new HashMap<IGraphicsNode, AxisAngle4d>();\r
-    \r
-    private int steps; \r
-    private double angles[];\r
-    \r
-    private Action csAction;\r
-    private boolean worldCoord = true;\r
-    private IToolBarManager manager;\r
-    \r
-    private List<IGraphicsNode> mos;\r
-    AxisAngle4d aa;\r
-    Quat4d q;\r
-    \r
-    public RotateAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent,true);\r
-        component = parent.getRenderingComponent();\r
-        camera = parent.getCamera();\r
-        gizmo = new RotateGizmo(component.getDisplaySystem().getRenderer());\r
-        csAction = new Action("World",Action.AS_CHECK_BOX) {\r
-               public void run() {\r
-                       GraphRequest r = new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       setWorldCoord(g,!isChecked());\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       };\r
-                       RotateAction.this.parent.getSession().asyncRead(r);\r
-                       \r
-               }\r
-        };\r
-    }\r
-    \r
-    public void init() {\r
-        this.setText("Rotate");\r
-        this.setToolTipText("Rotate the object");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/rotate.png"));\r
-        steps = 36;\r
-        angles = new double[steps+1];\r
-        for (int i = 0; i < angles.length; i++) {\r
-            angles[i] = - Math.PI + (Math.PI * i * 2.0 / steps);\r
-        }\r
-    }\r
-    \r
-    @Override\r
-    public boolean usable(Graph graph, List<Resource> resources) {\r
-        if (resources.size() == 0)\r
-            return false;\r
-        for (Resource r : resources) {\r
-               IEntity t = EntityFactory.create(graph,r);\r
-            if (t.isInstanceOf(Resources.g3dResource.G3DNode)) {\r
-                Collection<IEntity> p = t.getRelatedObjects(Resources.g3dResource.HasLocalOrientation);\r
-                if (p == null || p.size() != 1)\r
-                    return false;\r
-            }\r
-               \r
-        }\r
-        return true;\r
-        \r
-    }\r
-    \r
-    @Override\r
-    public void deactivate() {\r
-       inputType = InputType.NONE;\r
-        parent.setGizmo(null);\r
-        mos = null;\r
-\r
-    }\r
-    \r
-    public void fillToolBar(IToolBarManager manager) {\r
-       super.fillToolBar(manager);\r
-       this.manager = manager;\r
-        csAction.setChecked(!worldCoord);\r
-        manager.add(csAction);\r
-        \r
-    }\r
-    \r
-    private void setWorldCoord(Graph graph,boolean b) {\r
-       if (worldCoord == b)\r
-               return;\r
-       worldCoord = b;\r
-       updateWorldCoord(graph);\r
-    }\r
-    \r
-    private void updateWorldCoord(Graph graph) {\r
-       if (worldCoord) {\r
-                       csAction.setText("World");\r
-                       gizmo.setRotation(new AxisAngle4f());\r
-                       aa = null;\r
-                       q = null;\r
-       } else {\r
-                       csAction.setText("Local");\r
-                       aa = G3DTools.getOrientation(mos.get(0).getParent().getG3DNode(graph).getWorldOrientation());\r
-                       if (aa == null)\r
-                               aa = new AxisAngle4d();\r
-                       gizmo.setRotation(new AxisAngle4f(aa));\r
-                       q = new Quat4d();\r
-               q.set(aa);\r
-       }\r
-       if (manager != null)\r
-               manager.update(true);\r
-       this.parent.setViewChanged(true);\r
-    }\r
-    \r
-    @Override\r
-    public void activate() {\r
-       \r
-       Session session = parent.getSession();\r
-       \r
-       GraphRequest r = new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       parent.setGizmo(gizmo);\r
-               \r
-               component.getNoShadowRoot().attachChild(gizmo.getNode());\r
-               updateGizmo();\r
-\r
-               String text = "";\r
-               mos = parent.getSelectionAdapter().getSelectedObjects();\r
-               rotations = new HashMap<IGraphicsNode, AxisAngle4d>();\r
-               for (IGraphicsNode mo : mos) {\r
-                       G3DNode n = mo.getG3DNode(g);\r
-                   rotations.put(mo,G3DTools.getOrientation(n.getLocalOrientation()));\r
-                   text += G3DTools.getOrientation(n.getLocalOrientation()) + " " + MathTools.getEuler(G3DTools.getOrientation(mo.getG3DNode(g).getLocalOrientation())) + " ";\r
-               }\r
-               setInfoText(text);\r
-               parent.setViewChanged(true);\r
-               inputType = InputType.NONE;\r
-               return GraphRequestStatus.transactionComplete();\r
-               }\r
-       };\r
-       \r
-       session.syncRead(r);\r
-       \r
-        \r
-    }\r
-    \r
-    \r
-    private Vector3d getRotationAxis() {\r
-        switch (gizmo.getSelected()) {\r
-        case RotateGizmo.X:\r
-            return new Vector3d(1.0,0.0,0.0);\r
-        case RotateGizmo.Y:\r
-            return new Vector3d(0.0,1.0,0.0);\r
-        case RotateGizmo.Z:\r
-            return new Vector3d(0.0,0.0,1.0);\r
-        case RotateGizmo.XYZ:\r
-            Vector3d axis = camera.getUnNormalizedHeading();\r
-            axis.normalize();\r
-            return axis;\r
-        default:\r
-            return null;\r
-        }\r
-    }\r
-    private double prevS = 0.0;\r
-    \r
-    private Vector3d i = new Vector3d();\r
-    private Vector3d j = new Vector3d();\r
-    private double prevAngle = 0;\r
-\r
-    enum InputType{INTERSECT,NONINTERSECT,KEY,NONE};\r
-    InputType inputType;\r
-    private boolean useStep = false;\r
-    \r
-    @Override\r
-    public void doChanges(Graph graph) throws Exception {\r
-       \r
-        if (input.mousePressed()) {\r
-            Vector3d axis = getRotationAxis();\r
-            if (axis != null) {\r
-               if (!worldCoord) {\r
-                       MathTools.rotate(q, axis, axis);\r
-               }\r
-                Vector3d o = new Vector3d();\r
-                Vector3d d = new Vector3d();\r
-                parent.createPickRay(o, d);\r
-                Vector3d p = gizmo.getPosition();\r
-                double s[] = new double[2];\r
-                Vector3d i2 = new Vector3d();\r
-                if ((input.pressModifiers() & MouseEvent.CTRL_MASK) > 0) {\r
-                    useStep = true;\r
-                } else {\r
-                    useStep = false;\r
-                }\r
-                if (MathTools.intersectStraightPlane(o, d, p, axis, i2, s) && Math.abs(d.dot(axis)) > 0.2)\r
-                       inputType = InputType.INTERSECT;\r
-                else\r
-                       inputType = InputType.NONINTERSECT;\r
-                       \r
-                \r
-                if (inputType == InputType.INTERSECT) {\r
-                    // picking ray and plane defined by gizmo's center point and\r
-                    // rotation axis can intersect\r
-                    // vector from center point to intersection point\r
-                    i2.sub(p);\r
-                    // creating vectors i and j that are lying on the plane and\r
-                    // are perpendicular\r
-                    // vectors are used to calculate polar coordinate for\r
-                    // intersection point\r
-                    j.set(i2);\r
-                    i.cross(j, axis);\r
-                    double angleI = i2.angle(i);\r
-                    double angleJ = i2.angle(j);\r
-                    prevAngle = Math.atan2(Math.cos(angleJ), Math.cos(angleI));\r
-                } else {\r
-                    // picking ray and plane defined by gizmo's center point and\r
-                    // rotation axis are parallel,\r
-                    // so we'll use cross product of rotation axis and picking\r
-                    // ray to detect amount of rotation\r
-                    i.cross(d, axis);\r
-                    MathTools.intersectStraightStraight(o, d, p, i, new Vector3d(), new Vector3d(), s);\r
-                    prevS = s[1];\r
-                }\r
-            }\r
-           \r
-            \r
-        }\r
-        if (input.mouseClicked()) {\r
-            end();\r
-            return;\r
-        }\r
-        Vector3d axis = null;\r
-        if (input.keyPressed(KeyEvent.VK_LEFT)) {\r
-               inputType = InputType.KEY;\r
-               axis = new Vector3d(0.0,1.0,0.0);\r
-        } else if (input.keyPressed(KeyEvent.VK_RIGHT)) {\r
-               inputType = InputType.KEY;\r
-               axis = new Vector3d(0.0,-1.0,0.0);\r
-        } else if (input.keyPressed(KeyEvent.VK_UP)) {\r
-               inputType = InputType.KEY;\r
-               axis = new Vector3d(1.0,0.0,0.0);\r
-        } else if (input.keyPressed(KeyEvent.VK_DOWN)) {\r
-               inputType = InputType.KEY;\r
-               axis = new Vector3d(-1.0,0.0,0.0);\r
-        } else if (!input.mouseDragged()) {\r
-            parent.getDefaultAction().update();\r
-            return;\r
-        }\r
-        parent.setViewChanged(true);\r
-        \r
-        \r
-        updateGizmo();\r
-        List<IGraphicsNode> mos = parent.getSelectionAdapter().getSelectedObjects();\r
-        if (inputType != InputType.KEY)\r
-               axis = getRotationAxis();\r
-        if (axis == null) {\r
-            parent.getDefaultAction().update();\r
-            return;   \r
-        }\r
-        Vector3d taxis = null;\r
-        if (!worldCoord) {\r
-               taxis = new Vector3d(axis);\r
-               MathTools.rotate(q, axis, axis);\r
-       }\r
-        String text = "";\r
-        if (inputType == InputType.INTERSECT) {\r
-            Vector3d o = new Vector3d();\r
-            Vector3d d = new Vector3d();\r
-            parent.createPickRay(o, d);\r
-            Vector3d p = gizmo.getPosition();\r
-            double s[] = new double[2];\r
-            Vector3d i2 = new Vector3d();\r
-            MathTools.intersectStraightPlane(o, d, p, axis, i2, s);\r
-            i2.sub(p);\r
-            double angleI = i2.angle(i);\r
-            double angleJ = i2.angle(j);\r
-            double angle = Math.atan2(Math.cos(angleJ), Math.cos(angleI));\r
-            if(!worldCoord)\r
-               axis = taxis;\r
-            if (false && useStep) {\r
-                for (IGraphicsNode mo : mos) {\r
-                    G3DTools.setOrientation(mo.getG3DNode(graph).getLocalOrientation(), rotations.get(mo));\r
-                    // FIXME : commit\r
-                    G3DTools.multiplyOrientation(mo.getG3DNode(graph).getWorldOrientation(), new AxisAngle4d(axis,angle-prevAngle));\r
-                    //mo.setRotation(rotations.get(mo));\r
-                    //mo.modifyWorldRotation(axis, angle - prevAngle);\r
-                    AxisAngle4d aa = G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation());\r
-                    rotations.put(mo, aa);\r
-                    prevAngle = angle;\r
-                    Vector3d euler = MathTools.getEuler(aa);\r
-                    euler.x = roundAngle(euler.x);\r
-                    euler.y = roundAngle(euler.y);\r
-                    euler.z = roundAngle(euler.z);\r
-                    aa = MathTools.getFromEuler2(euler);\r
-                    G3DTools.setOrientation(mo.getG3DNode(graph).getLocalOrientation(), aa);\r
-                    //mo.setRotation(aa);\r
-                    Vector3d e = MathTools.getEuler(G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation()));\r
-                    e.scale(180.0/Math.PI);\r
-                    text += G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation()) + " " + e + " ";\r
-                }\r
-            } else  {\r
-                for (IGraphicsNode mo : mos) {\r
-                    if (worldCoord)\r
-                               G3DTools.multiplyOrientation\r
-                               (mo.getG3DNode(graph).getWorldOrientation(), new AxisAngle4d(axis,angle-prevAngle));\r
-                       else\r
-                               G3DTools.multiplyOrientation(mo.getG3DNode(graph).getLocalOrientation(), new AxisAngle4d(axis,angle-prevAngle));\r
-                       text += G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation()) + " " + MathTools.getEuler(G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation())) + " ";\r
-                }\r
-                prevAngle = angle;\r
-            }\r
-            \r
-        } else if (inputType == InputType.NONINTERSECT){\r
-            Vector3d o = new Vector3d();\r
-            Vector3d d = new Vector3d();\r
-            parent.createPickRay(o, d);\r
-            Vector3d p = gizmo.getPosition();\r
-            double s[] = new double[2];\r
-            MathTools.intersectStraightStraight(o, d, p, i, new Vector3d(), new Vector3d(), s);\r
-            if(!worldCoord)\r
-               axis = taxis;\r
-            if (false && useStep) {\r
-                for (IGraphicsNode mo : mos) {\r
-                    G3DTools.setOrientation(mo.getG3DNode(graph).getLocalOrientation(), rotations.get(mo));\r
-                    G3DTools.multiplyOrientation(mo.getG3DNode(graph).getWorldOrientation(), new AxisAngle4d(axis,s[1] - prevS));\r
-                    //mo.setRotation(rotations.get(mo));\r
-                    //mo.modifyWorldRotation(axis, s[1] - prevS);\r
-                    AxisAngle4d aa = G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation());\r
-                    rotations.put(mo, aa);\r
-                    Vector3d euler = MathTools.getEuler(aa);\r
-                    euler.x = roundAngle(euler.x);\r
-                    euler.y = roundAngle(euler.y);\r
-                    euler.z = roundAngle(euler.z);\r
-                    aa = MathTools.getFromEuler2(euler);\r
-                    prevS = s[1];\r
-                    G3DTools.setOrientation(mo.getG3DNode(graph).getLocalOrientation(), aa);\r
-                    //mo.setRotation(aa);\r
-                    Vector3d e = MathTools.getEuler(G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation()));\r
-                    e.scale(180.0/Math.PI);\r
-                    text += G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation()) + " " + e + " ";\r
-                }\r
-            } else {\r
-                for (IGraphicsNode mo : mos) {\r
-                       if (worldCoord)\r
-                               G3DTools.multiplyOrientation(mo.getG3DNode(graph).getWorldOrientation(), new AxisAngle4d(axis,s[1] - prevS));\r
-                       else\r
-                               G3DTools.multiplyOrientation(mo.getG3DNode(graph).getLocalOrientation(), new AxisAngle4d(axis,s[1] - prevS));\r
-                    text += G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation()) + " " + MathTools.getEuler(G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation())) + " ";\r
-                }\r
-                prevS = s[1];\r
-                \r
-            }\r
-           \r
-        } else {\r
-               for (IGraphicsNode mo : mos) {\r
-               if (worldCoord)\r
-                       G3DTools.multiplyOrientation(mo.getG3DNode(graph).getWorldOrientation(), new AxisAngle4d(axis,Math.PI * 0.5));\r
-               else\r
-                       G3DTools.multiplyOrientation(mo.getG3DNode(graph).getLocalOrientation(), new AxisAngle4d(axis,Math.PI * 0.5));\r
-                text += G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation()) + " " + MathTools.getEuler(G3DTools.getOrientation(mo.getG3DNode(graph).getLocalOrientation())) + " ";\r
-            }\r
-        }\r
-        setInfoText(text);\r
\r
-    }\r
-    /*\r
-    private double roundAngle(double current, double modify) {\r
-        double angle = roundAngle(current+modify);\r
-        if (Double.isNaN(angle)) {\r
-            angle = current+modify;\r
-        }\r
-        //System.out.println(angle + " " + (current+modify));\r
-        return angle;\r
-    }\r
-    */\r
-    \r
-    private double roundAngle(double angle) {\r
-        while (angle < - Math.PI)\r
-            angle += Math.PI*2.0;\r
-        while (angle > Math.PI)\r
-            angle -= Math.PI*2.0;\r
-        \r
-        \r
-        int index = 0;\r
-        while (angle > angles[index])\r
-            index++;\r
-        if (index == 0) {\r
-            angle = angles[0];\r
-        } else {\r
-            double d = angle - angles[index - 1];\r
-            double d2 = angles[index] - angle;\r
-            if (d < d2)\r
-                angle = angles[index - 1];\r
-            else\r
-                angle = angles[index];\r
-        }\r
-        return angle;\r
-    }\r
-    \r
-    private void updateGizmo() {\r
-        List<IGraphicsNode> mos = parent.getSelectionAdapter().getSelectedObjects();\r
-        //gizmo.update(XithTools.getPosition(mos.get(0).getGroup()),camera.getCameraPos(),component);\r
-        gizmo.update(VecmathJmeTools.getD(mos.get(0).getGroup().getWorldTranslation()),camera.getCameraPos(),component);\r
-    }\r
-    \r
-    public void setInfoText(String text) {\r
-       \r
-    }\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/TranslateAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/TranslateAction.java
deleted file mode 100644 (file)
index d4630a1..0000000
+++ /dev/null
@@ -1,422 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import java.awt.event.MouseEvent;\r
-import java.math.BigDecimal;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.AxisAngle4f;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequest;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.gizmo.TransformGizmo;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.Orientation;\r
-import org.simantics.proconf.g3d.stubs.Position;\r
-\r
-\r
-public class TranslateAction extends ConstrainedTransformAction {\r
-       \r
-       \r
-    private TransformGizmo gizmo;\r
-    \r
-    private double istep = 10.0;\r
-    private int decimals = 2;\r
-    \r
-    \r
-    private Action csAction;\r
-    List<IGraphicsNode> mos = null;\r
-    \r
-    private boolean worldCoord = true;\r
-    \r
-    \r
-    private AxisAngle4d aa;\r
-    private Quat4d q;\r
-    \r
-    public TranslateAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        \r
-        csAction = new Action("World",Action.AS_CHECK_BOX) {\r
-               public void run() {\r
-                       GraphRequest r = new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       setWorldCoord(g,!isChecked());\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       };\r
-                       TranslateAction.this.parent.getSession().asyncRead(r);\r
-                       \r
-               }\r
-        };\r
-        gizmo = new TransformGizmo(component.getDisplaySystem().getRenderer());\r
-    }\r
-    \r
-    public void init() {\r
-        this.setText("Translate");\r
-        this.setToolTipText("Translate the object");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/translate.png"));\r
-    }\r
-    \r
-    @Override\r
-    public boolean usable(Graph graph, List<Resource> resources) {\r
-        if (resources.size() == 0)\r
-            return false;\r
-        for (Resource r : resources) {\r
-               IEntity t = EntityFactory.create(graph,r);\r
-            if (t.isInstanceOf(Resources.g3dResource.G3DNode)) {\r
-                Collection<IEntity> p = t.getRelatedObjects(Resources.g3dResource.HasLocalPosition);\r
-                if (p == null || p.size() != 1)\r
-                    return false;\r
-            }\r
-               \r
-        }\r
-        return true;\r
-        \r
-    }\r
-    \r
-    @Override\r
-    public void deactivate() {\r
-       super.deactivate();\r
-        parent.setGizmo(null);\r
-        mos = null;\r
-    }\r
-    \r
-    private void setWorldCoord(Graph graph,boolean b) {\r
-       if (worldCoord == b)\r
-               return;\r
-       worldCoord = b;\r
-       updateWorldCoord(graph);\r
-    }\r
-    \r
-    private void updateWorldCoord(Graph graph) {\r
-       if (worldCoord) {\r
-                       csAction.setText("World");\r
-                       gizmo.setRotation(new AxisAngle4f());\r
-                       aa = null;\r
-                       q = null;\r
-       } else {\r
-                       csAction.setText("Local");\r
-                       Orientation o = mos.get(0).getParent().getG3DNode(graph).getWorldOrientation();\r
-                       if (o == null) {\r
-                               aa = new AxisAngle4d();\r
-                       } else {\r
-                               aa = G3DTools.getOrientation(o);\r
-                       }\r
-                               \r
-                       gizmo.setRotation(new AxisAngle4f(aa));\r
-                       q = new Quat4d();\r
-                       q.set(aa);\r
-       }\r
-//     if (manager != null)\r
-//             parent.getRenderingComposite().getDisplay().asyncExec(new Runnable() {\r
-//                     public void run() {\r
-//                             manager.update(true);\r
-//                     }\r
-//             });\r
-               \r
-       this.parent.setViewChanged(true);\r
-    }\r
-    \r
-    public void fillToolBar(IToolBarManager manager) {\r
-       super.fillToolBar(manager);\r
-        csAction.setChecked(!worldCoord);\r
-        manager.add(csAction);\r
-    }\r
-\r
-    @Override\r
-    public void activate() {\r
-       GraphRequest r = new GraphRequestAdapter() {\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       parent.setGizmo(gizmo);\r
-\r
-               updateGizmo(g);\r
-\r
-               component.getNoShadowRoot().attachChild(gizmo.getNode());\r
-               \r
-               String text = "";\r
-               mos = parent.getSelectionAdapter().getSelectedObjects();\r
-               for (IGraphicsNode mo : mos) {\r
-                       if (worldCoord)\r
-                               text += G3DTools.getVector(mo.getG3DNode(g).getWorldPosition()) + " ";//mo.getWorldPosition() + " ";\r
-                       else\r
-                               text += G3DTools.getVector(mo.getG3DNode(g).getLocalPosition()) + " ";\r
-               }\r
-               final String fText = text;\r
-               parent.getRenderingComposite().getDisplay().asyncExec(new Runnable() {\r
-                       public void run() {\r
-                               setInfoText(fText);    \r
-                       }\r
-               });\r
-               \r
-               Resource r[] = new Resource[mos.size()];\r
-               for (int i = 0; i < mos.size(); i++) {\r
-                   r[i] = mos.get(i).getResource();\r
-               }\r
-               \r
-               TranslateActionConstraints.addConstraints(r, detector);   \r
-               updateWorldCoord(g);\r
-               return GraphRequestStatus.transactionComplete();\r
-               };\r
-         \r
-       };\r
-       parent.getSession().asyncRead(r);\r
-        \r
-    }\r
-    \r
-    Vector3d getTranslate(Graph graph) {\r
-        return getTranslate(graph,new Vector3d());\r
-    }\r
-    \r
-    Vector3d getTranslate(Graph graph,Vector3d offset) {\r
-        Vector3d translate = new Vector3d();\r
-        Vector3d o = new Vector3d();\r
-        Vector3d d = new Vector3d();\r
-        parent.createPickRay(o, d);\r
-        Vector3d p = G3DTools.getVector(mos.get(0).getG3DNode(graph).getWorldPosition());//gizmo.getPosition();\r
-        Vector3d dir = null;\r
-        switch (gizmo.getSelected()) {\r
-        case TransformGizmo.XYZ :\r
-            Vector3d normal = camera.getUnNormalizedHeading();\r
-            if(!worldCoord)\r
-               MathTools.rotate(q, normal, normal);\r
-            normal.normalize();\r
-            double s[] = new double[1];\r
-            Vector3d r = new Vector3d();\r
-            if (MathTools.intersectStraightPlane(o, d, p, normal, r)) {\r
-                r.sub(p);\r
-                translate.x = r.x;\r
-                translate.y = r.y;\r
-                translate.z = r.z;\r
-            }\r
-            break;\r
-        case TransformGizmo.X :\r
-            dir = new Vector3d(1.0,0.0,0.0);\r
-            if(!worldCoord)\r
-               MathTools.rotate(q, dir, dir);\r
-            Vector3d i1 = new Vector3d();\r
-            Vector3d i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight( p, dir,o, d, i2, i1,s);\r
-            translate.x = s[0];\r
-            \r
-            break;\r
-        case TransformGizmo.Y :\r
-            dir = new Vector3d(0.0,1.0,0.0);\r
-            if(!worldCoord)\r
-               MathTools.rotate(q, dir, dir);\r
-            i1 = new Vector3d();\r
-            i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight( p, dir,o, d, i2, i1,s);\r
-            translate.y = s[0];\r
-            break;\r
-        case TransformGizmo.Z :\r
-            dir = new Vector3d(0.0,0.0,1.0);\r
-            if(!worldCoord)\r
-               MathTools.rotate(q, dir, dir);\r
-            i1 = new Vector3d();\r
-            i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight( p, dir,o, d, i2, i1,s);\r
-            translate.z = s[0];\r
-            break;\r
-        case TransformGizmo.XY :\r
-            normal = new Vector3d(0.0,0.0,1.0);\r
-            if(!worldCoord)\r
-               MathTools.rotate(q, normal, normal);\r
-            r = new Vector3d();\r
-            if (MathTools.intersectStraightPlane(o, d, p, normal, r)) {\r
-                r.sub(p);\r
-                translate.x = r.x;\r
-                translate.y = r.y;\r
-            }\r
-            break;\r
-        case TransformGizmo.XZ :\r
-            normal = new Vector3d(0.0,1.0,0.0);\r
-            if(!worldCoord)\r
-               MathTools.rotate(q, normal, normal);\r
-            r = new Vector3d();\r
-            if (MathTools.intersectStraightPlane(o, d, p, normal, r)) {\r
-                r.sub(p);\r
-                translate.x = r.x;\r
-                translate.z = r.z;\r
-            }\r
-            break;\r
-        case TransformGizmo.YZ :\r
-            normal = new Vector3d(1.0,0.0,0.0);\r
-            if(!worldCoord)\r
-               MathTools.rotate(q, normal, normal);\r
-            r = new Vector3d();\r
-            if (MathTools.intersectStraightPlane(o, d, p, normal, r)) {\r
-                r.sub(p);\r
-                translate.y = r.y;\r
-                translate.z = r.z;\r
-            }\r
-            break;\r
-        default :\r
-            \r
-            return null;\r
-        }\r
-        translate.sub(offset);\r
-        \r
-        if (useConstraints && dir != null) {\r
-            switch (gizmo.getSelected()) {\r
-            case TransformGizmo.X:\r
-            case TransformGizmo.Y:\r
-            case TransformGizmo.Z:\r
-                Vector3d t = new Vector3d(translate);\r
-                // TODO : to the test against all translated objects and snap to closest one\r
-                Point3d pos = G3DTools.getPoint(mos.get(0).getG3DNode(graph).getWorldPosition());\r
-                t.add(pos);\r
-                Point3d snap = detector.getPointSnap2(t, dir);\r
-                if (snap != null) {\r
-                   // System.out.print("t: " + translate);\r
-                    translate = new Vector3d(snap);\r
-                    translate.sub(pos);\r
-                   // System.out.println(" " + translate);\r
-                }\r
-                break;\r
-                \r
-            }\r
-        }\r
-        return translate;\r
-    }\r
-    \r
-    Vector3d prevTranslate = new Vector3d();\r
-    \r
-    @Override\r
-    public void doChanges(Graph graph) throws Exception {\r
-        if (input.mousePressed()) {\r
-            boolean b = useConstraints;\r
-            useConstraints = false;\r
-            prevTranslate = getTranslate(graph);\r
-            useConstraints = b;\r
-        }\r
-        if (input.mouseClicked()) {\r
-            end();\r
-            return;\r
-        }\r
-        if (!input.mouseDragged()) {\r
-            parent.getDefaultAction().update();\r
-            return;\r
-        }   \r
-        detector.clearConstraintHighlights();\r
-        parent.setViewChanged(true);\r
-        \r
-        \r
-        \r
-        Vector3d translate = getTranslate(graph,prevTranslate);\r
-       \r
-        if (translate == null) {\r
-            //cameraRotateAction.update();\r
-            parent.getDefaultAction().update();\r
-            updateGizmo(graph);\r
-            return;\r
-        }\r
-        //translate.sub(prevTranslate);\r
-       \r
-        if ((input.dragModifiers() & MouseEvent.CTRL_MASK) > 0) {\r
-            String text = "";\r
-            for (IGraphicsNode mo : mos) {\r
-                \r
-                Point3d p;\r
-                if (worldCoord)\r
-                       p = G3DTools.getPoint(mo.getG3DNode(graph).getWorldPosition());//mo.getWorldPosition();\r
-                else\r
-                       p = G3DTools.getPoint(mo.getG3DNode(graph).getLocalPosition());\r
-                p.add(translate);\r
-                if (gizmo.getSelected() == TransformGizmo.X || gizmo.getSelected() == TransformGizmo.XY || gizmo.getSelected() == TransformGizmo.XZ || gizmo.getSelected() == TransformGizmo.XYZ) {\r
-                    p.x = Math.round(istep * p.x) / istep;\r
-                    BigDecimal bx = new BigDecimal(p.x);\r
-                    bx.setScale(decimals, BigDecimal.ROUND_HALF_UP);\r
-                    p.x = bx.doubleValue();\r
-                }\r
-                if (gizmo.getSelected() == TransformGizmo.Y || gizmo.getSelected() == TransformGizmo.XY || gizmo.getSelected() == TransformGizmo.YZ || gizmo.getSelected() == TransformGizmo.XYZ) {\r
-                    p.y = Math.round(istep * p.y) / istep;\r
-                    BigDecimal by = new BigDecimal(p.y);\r
-                    by.setScale(decimals, BigDecimal.ROUND_HALF_UP);\r
-                    p.y = by.doubleValue();\r
-                }\r
-                if (gizmo.getSelected() == TransformGizmo.Z || gizmo.getSelected() == TransformGizmo.YZ || gizmo.getSelected() == TransformGizmo.XZ || gizmo.getSelected() == TransformGizmo.XYZ) {      \r
-                    p.z = Math.round(istep * p.z) / istep;\r
-                    BigDecimal bz = new BigDecimal(p.z);\r
-                    bz.setScale(decimals, BigDecimal.ROUND_HALF_UP);\r
-                    p.z = bz.doubleValue();\r
-                }\r
-                text += p + " ";\r
-                if (worldCoord)\r
-                       G3DTools.setTuple3(mo.getG3DNode(graph).getWorldPosition(), p); \r
-                else\r
-                       G3DTools.setTuple3(mo.getG3DNode(graph).getLocalPosition(), p);\r
-                //mo.setWorldTranslation(p);\r
-                \r
-            }\r
-            if (useConstraints)\r
-                text+=detector.getSnapString();\r
-            setInfoText(text);\r
-            \r
-        } else {\r
-            String text = "";\r
-            for (IGraphicsNode mo : mos) {\r
-               Position pos;\r
-               if (worldCoord) {\r
-                       pos = mo.getG3DNode(graph).getWorldPosition();  \r
-               } else {\r
-                       pos = mo.getG3DNode(graph).getLocalPosition();\r
-               }\r
-               Point3d p = G3DTools.getPoint(pos);\r
-                       p.add(translate);\r
-                       text += p;\r
-                       G3DTools.setTuple3(pos, p);\r
-            }\r
-            if (useConstraints)\r
-                text+=detector.getSnapString();\r
-            setInfoText(text);\r
-           // parent.getGraph().commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-        }\r
-        updateGizmo(graph);\r
-\r
-    }\r
-    \r
-    protected void updateGizmo(Graph graph) {\r
-        List<IGraphicsNode> mos = parent.getSelectionAdapter().getSelectedObjects();\r
-        if (mos.size() == 0) {\r
-               end();\r
-               return;\r
-        }\r
-        gizmo.update(G3DTools.getVector(mos.get(0).getG3DNode(graph).getWorldPosition()),camera.getCameraPos(),component);\r
-        \r
-   }\r
-    \r
-    public void setInfoText(String text) {\r
-       \r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/TranslateActionConstraints.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/TranslateActionConstraints.java
deleted file mode 100644 (file)
index c1a7236..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.ConstraintDetector;\r
-\r
-\r
-/**\r
- * Temporary class to handle "Automatic" constraints for translation\r
- * TODO : create extension point / extension that can provide constraints\r
- * TODO : how to override previously added constraints ?\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class TranslateActionConstraints {\r
-    \r
-    \r
-    public static void addConstraints(Resource translated[], ConstraintDetector detector) {\r
-        detector.clearConstraints();\r
-        // these must be provided through extension point !\r
-//        if (isElbow(translated)) {\r
-//            addElbowConstraints(translated, detector);\r
-//        } else if (isPipeControlPoint(translated)) {\r
-//            addPipeControlPointConstraints(translated, detector);\r
-//        } else if (isEndComponent(translated)) {\r
-//             addEndComponentConstraints(translated, detector);\r
-//        }\r
-        \r
-        \r
-    }\r
-    \r
-    /*\r
-     * These methods must be inserted into extension\r
-     */\r
-    \r
-//    private static boolean isElbow(Resource translated[]) {\r
-//        for (Resource r : translated) {\r
-//            if (!r.isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.ELBOW))) {\r
-//                return false;\r
-//            }\r
-//        }\r
-//        return true;\r
-//    }\r
-//    \r
-//    private static boolean isEndComponent(Resource translated[]) {\r
-//        for (Resource r : translated) {\r
-//            if (!r.isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.END_COMPONENT))) {\r
-//                return false;\r
-//            }\r
-//        }\r
-//        return true;\r
-//    }\r
-//    \r
-//    private static boolean isPipeControlPoint(Resource translated[]) {\r
-//        for (Resource r : translated) {\r
-//            if (!r.isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.PIPE_CONTROL_POINT))) {\r
-//                return false;\r
-//            }\r
-//        }\r
-//        return true;\r
-//    }\r
-//    \r
-//    private static void addElbowConstraints(Resource translated[], ConstraintDetector detector) {\r
-//        Set<Resource> res = new HashSet<Resource>();\r
-//        // add all controlpoints connected to every elbow's controlpoint\r
-//        for (Resource r : translated) {\r
-//            Elbow elbow = ElbowFactory.create(r);\r
-//            PipeControlPoint p = elbow.getHasControlPoint();\r
-//            PipeControlPoint next = PipingTools.findNextEnd(p);\r
-//            PipeControlPoint previous = PipingTools.findPreviousEnd(p);\r
-//            if (next != null)\r
-//                res.add(next.getResource());\r
-//            if (previous != null)\r
-//                res.add(previous.getResource());\r
-//            \r
-//        }\r
-//        // remove all controlpoints that are elbows' controlpoints\r
-//        for (Resource r : translated) {\r
-//            Elbow elbow = ElbowFactory.create(r);\r
-//            res.remove(elbow.getHasControlPoint().getResource());\r
-//        }\r
-//        for (Resource r : res) {\r
-//            PipeControlPoint p = PipeControlPointFactory.create(r);\r
-//            detector.addContraintPoint(GraphicsNodeTools.getPoint(p.getLocalPosition()));\r
-//        }\r
-//    }\r
-//    \r
-//    private static void addEndComponentConstraints(Resource translated[], ConstraintDetector detector) {\r
-//        Set<Resource> res = new HashSet<Resource>();\r
-//        // add all controlpoints connected to every elbow's controlpoint\r
-//        for (Resource r : translated) {\r
-//            EndComponent elbow = EndComponentFactory.create(r);\r
-//            PipeControlPoint p = elbow.getHasControlPoint();\r
-//            PipeControlPoint next = PipingTools.findNextEnd(p);\r
-//            PipeControlPoint previous = PipingTools.findPreviousEnd(p);\r
-//            if (next != null)\r
-//                res.add(next.getResource());\r
-//            if (previous != null)\r
-//                res.add(previous.getResource());\r
-//            \r
-//        }\r
-//        // remove all controlpoints that are elbows' controlpoints\r
-//        for (Resource r : translated) {\r
-//             EndComponent elbow = EndComponentFactory.create(r);\r
-//            res.remove(elbow.getHasControlPoint().getResource());\r
-//        }\r
-//        for (Resource r : res) {\r
-//            PipeControlPoint p = PipeControlPointFactory.create(r);\r
-//            detector.addContraintPoint(GraphicsNodeTools.getPoint(p.getLocalPosition()));\r
-//        }\r
-//    }\r
-//    \r
-//    \r
-//    private static void addPipeControlPointConstraints(Resource translated[], ConstraintDetector detector) {\r
-//        Set<Resource> res = new HashSet<Resource>();\r
-//        // add all controlpoints connected to every elbow's controlpoint\r
-//        for (Resource r : translated) {\r
-//            PipeControlPoint p = PipeControlPointFactory.create(r);\r
-//            PipeControlPoint next = PipingTools.findNextEnd(p);\r
-//            PipeControlPoint previous = PipingTools.findPreviousEnd(p);\r
-//            if (next != null)\r
-//                res.add(next.getResource());\r
-//            if (previous != null)\r
-//                res.add(previous.getResource());\r
-//            \r
-//        }\r
-//        // remove all controlpoints that are elbows' controlpoints\r
-//        for (Resource r : translated) {\r
-//            res.remove(r);\r
-//        }\r
-//        for (Resource r : res) {\r
-//            PipeControlPoint p = PipeControlPointFactory.create(r);\r
-//            detector.addContraintPoint(GraphicsNodeTools.getPoint(p.getLocalPosition()));\r
-//        }\r
-//    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/WriteAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/WriteAction.java
deleted file mode 100644 (file)
index 58aa02a..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequest;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Session;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-\r
-public abstract class WriteAction extends ContextAction {\r
-       boolean sync;\r
-       public WriteAction(ThreeDimensionalEditorBase parent, boolean sync) {\r
-               super(parent);\r
-               this.sync = sync;\r
-       }\r
-\r
-       @Override\r
-       public final void run() {\r
-               Session session = parent.getSession();\r
-               if(!canActivate()) {\r
-                       return;\r
-               }\r
-               GraphRequest r = new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               return doChanges(g);\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void requestCompleted(GraphRequestStatus status) {\r
-                               afterChanges(status);\r
-                       }\r
-               };\r
-               if (sync) {\r
-                       session.syncWrite(r);\r
-               } else {\r
-                       session.asyncWrite(r);\r
-               } \r
-       }\r
-       \r
-       public abstract GraphRequestStatus doChanges(Graph graph) throws Exception;\r
-       \r
-       public void afterChanges(GraphRequestStatus status) {\r
-               \r
-       }\r
-       \r
-       public boolean canActivate() {\r
-               return true;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/WriteInteractiveAction.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/WriteInteractiveAction.java
deleted file mode 100644 (file)
index 1208b75..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.actions;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequest;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Session;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-\r
-\r
-public abstract class WriteInteractiveAction extends InteractiveAction {\r
-       boolean sync;\r
-       \r
-       public WriteInteractiveAction(ThreeDimensionalEditorBase parent, boolean sync) {\r
-               super(parent);\r
-               this.sync = sync;\r
-       }\r
-       \r
-       @Override\r
-       public final void update(){\r
-               Session session = parent.getSession();\r
-               GraphRequest r = new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               doChanges(g);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               };\r
-               if (sync) {\r
-                       session.syncWrite(r);\r
-               } else {\r
-                       session.asyncWrite(r);\r
-               } \r
-       }\r
-\r
-       \r
-       public abstract void doChanges(Graph graph) throws Exception;\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AbstractScalarInterpolator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AbstractScalarInterpolator.java
deleted file mode 100644 (file)
index 5777f8e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-public abstract class AbstractScalarInterpolator implements ScalarInterpolator {\r
-    public void interpolate(double delta) {\r
-        throw new UnsupportedOperationException("");\r
-        \r
-    }\r
-    \r
-    public void setTarget(Object target) {\r
-        throw new UnsupportedOperationException("");\r
-        \r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Animatable.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Animatable.java
deleted file mode 100644 (file)
index 435cb0d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-\r
-\r
-/**\r
- * \r
- * TODO : multiple animations\r
- * TODO : remove setRandomAnimation\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public interface Animatable {\r
-    \r
-    /**\r
-     * Sets used animation\r
-     * @param animation\r
-     */\r
-    public boolean setAnimation(Graph graph, Resource animation);\r
-    \r
-    /**\r
-     * Updates animation\r
-     * @param delta\r
-     */\r
-    public void animate(double delta, double frameTime);\r
-    \r
-    /**\r
-     * Sets random animation\r
-     * (Testing purposes)\r
-     */\r
-    public boolean setRandomAnimation(Graph graph);\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Animation.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Animation.java
deleted file mode 100644 (file)
index 9dd7f5e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-public class Animation {\r
-    private List<Interpolator> interpolators = new ArrayList<Interpolator>();\r
-\r
-\r
-    public void addInterpolator(Interpolator i) {\r
-        interpolators.add(i);\r
-    }\r
-    \r
-    public void removeInterpolator(Interpolator i) {\r
-        interpolators.remove(i);\r
-    }\r
-    \r
-    public void interpolate(double delta) {\r
-        for (Interpolator i : interpolators) {\r
-            i.interpolate(delta);\r
-        }\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationController.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationController.java
deleted file mode 100644 (file)
index 809ec60..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import org.simantics.db.Graph;\r
-\r
-\r
-public interface AnimationController {\r
-       \r
-       public void updateAnimation(Graph graph, double frameTime);\r
-       public void setAnimatable(Animatable animatable);\r
-       public void addAnimatable(Animatable animatable);\r
-       public void dispose();\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationSystem.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationSystem.java
deleted file mode 100644 (file)
index 8085405..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.proconf.g3d.base.ScenegraphAdapter;\r
-\r
-\r
-public class AnimationSystem {\r
-       private ScenegraphAdapter adapter;\r
-       private List<AnimationController> animationControllers = new ArrayList<AnimationController>();\r
-    \r
-       private List<AnimationSystemListener> listeners = new ArrayList<AnimationSystemListener>();\r
-       \r
-       private boolean pause = false;\r
-       \r
-       public AnimationSystem(ScenegraphAdapter adapter) {\r
-               if (adapter == null)\r
-                       throw new IllegalArgumentException("ScenegraphAdapter must not be null");\r
-               this.adapter = adapter;\r
-       }\r
-       \r
-       public void add(AnimationController controller) {\r
-               animationControllers.add(controller);\r
-               for (AnimationSystemListener l : listeners)\r
-               l.animationAdded(this, controller);\r
-       }\r
-       \r
-       public void addListener(AnimationSystemListener l) {\r
-               listeners.add(l);\r
-       }\r
-       \r
-       public void removeListener(AnimationSystemListener l) {\r
-               listeners.remove(l);\r
-       }\r
-       \r
-       public boolean isRunning() {\r
-               return animationControllers.size() > 0;\r
-       }\r
-       \r
-       public void pause() {\r
-               if (pause)\r
-                       return;\r
-               pause = true;\r
-               for (AnimationSystemListener l : listeners)\r
-               l.animationPaused(this);\r
-       }\r
-       \r
-       public void play() {\r
-               if(!pause)\r
-                       return;\r
-               pause = false;\r
-               for (AnimationSystemListener l : listeners)\r
-               l.animationPlay(this);\r
-       }\r
-       \r
-       public void stop() {\r
-               for (AnimationController c : animationControllers)\r
-               c.dispose();\r
-       animationControllers.clear();\r
-       for (AnimationSystemListener l : listeners)\r
-               l.animationStopped(this);\r
-       }\r
-       \r
-       public boolean isPause() {\r
-               return pause;\r
-       }\r
-       \r
-       public void run(Graph graph, double frameTime) {\r
-               if (pause)\r
-                       return;\r
-                if (animationControllers.size() > 0) {\r
-               for (AnimationController c : animationControllers)\r
-                               c.updateAnimation(graph, frameTime);\r
-                       adapter.setChanged(true);\r
-            }\r
-       }\r
-       \r
-       public List<AnimationController> getAnimationControllers() {\r
-               return animationControllers;\r
-       }\r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationSystemListener.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/AnimationSystemListener.java
deleted file mode 100644 (file)
index f45c3b4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-public interface AnimationSystemListener {\r
-       public void animationStopped(AnimationSystem animationSystem);\r
-       public void animationPaused(AnimationSystem animationSystem);\r
-       public void animationPlay(AnimationSystem animationSystem);\r
-       public void animationAdded(AnimationSystem animationSystem, AnimationController animationController);\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ChanneledColorInterpolator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ChanneledColorInterpolator.java
deleted file mode 100644 (file)
index 5a80e83..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.state.MaterialState;\r
-\r
-public class ChanneledColorInterpolator implements Interpolator {\r
-    private ScalarInterpolator rInterpolator;\r
-    private ScalarInterpolator gInterpolator;\r
-    private ScalarInterpolator bInterpolator;\r
-    \r
-    //Material m = null;\r
-    MaterialState m = null;\r
-    int type = 1;\r
-    \r
-    public static final int AMBIENT = 0;\r
-    public static final int DIFFUSE = 1;\r
-    public static final int SPECULAR = 2;\r
-    public static final int EMISSIVE = 3;\r
-    \r
-    \r
-    public ChanneledColorInterpolator(ScalarInterpolator rInterpolator, ScalarInterpolator gInterpolator, ScalarInterpolator bInterpolator) {\r
-        this.rInterpolator = rInterpolator;\r
-        this.gInterpolator = gInterpolator;\r
-        this.bInterpolator = bInterpolator;\r
-    }\r
-    \r
-    public void interpolate(double delta) {\r
-        double r = rInterpolator.evaluate(delta);\r
-        double g = gInterpolator.evaluate(delta);\r
-        double b = bInterpolator.evaluate(delta);\r
-\r
-        ColorRGBA c = new ColorRGBA((float)r, (float)g, (float)b,0.f);\r
-        switch (type) {\r
-        case AMBIENT : \r
-            m.setAmbient(c);\r
-            break;\r
-        case DIFFUSE:\r
-            m.setDiffuse(c);\r
-            break;\r
-        case SPECULAR:\r
-            m.setSpecular(c);\r
-            break;\r
-        case EMISSIVE:\r
-            m.setEmissive(c);\r
-            break;\r
-        }\r
-    }\r
-    \r
-    public void setTarget(Object target) {\r
-       // m = (Material)target;\r
-        m = (MaterialState)target;\r
-    }\r
-    \r
-    public void setType(int type) {\r
-        this.type = type;\r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ChanneledPositionInterpolator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ChanneledPositionInterpolator.java
deleted file mode 100644 (file)
index 5b6aeb6..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-\r
-import com.jme.math.Vector3f;\r
-import com.jme.scene.Node;\r
-\r
-\r
-public class ChanneledPositionInterpolator implements Interpolator {\r
-    private ScalarInterpolator xInterpolator;\r
-    private ScalarInterpolator yInterpolator;\r
-    private ScalarInterpolator zInterpolator;\r
-\r
-    Node node;\r
-    \r
-    public ChanneledPositionInterpolator(ScalarInterpolator xInterpolator, ScalarInterpolator yInterpolator, ScalarInterpolator zInterpolator) {\r
-        this.xInterpolator = xInterpolator;\r
-        this.yInterpolator = yInterpolator;\r
-        this.zInterpolator = zInterpolator;\r
-    }\r
-    \r
-    public void interpolate(double delta) {\r
-        double x = xInterpolator.evaluate(delta);\r
-        double y = yInterpolator.evaluate(delta);\r
-        double z = zInterpolator.evaluate(delta);\r
-\r
-        node.setLocalTranslation(new Vector3f((float)x,(float)y,(float)z));\r
-    }\r
-    \r
-    public void setTarget(Object target) {\r
-       node = (Node)target;\r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ConstantInterpolator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ConstantInterpolator.java
deleted file mode 100644 (file)
index 5e273d1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-public class ConstantInterpolator extends AbstractScalarInterpolator{\r
-    double constant;\r
-    \r
-    \r
-    public ConstantInterpolator(double constant) {\r
-        this.constant = constant;\r
-    }\r
-    \r
-    public double evaluate(double delta) {\r
-        return constant;\r
-    }\r
-    \r
-    \r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Interpolator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/Interpolator.java
deleted file mode 100644 (file)
index 630434f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-public interface Interpolator {\r
-    \r
-    public void interpolate(double delta);\r
-    public void setTarget(Object target);\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ResourceAnimationController.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ResourceAnimationController.java
deleted file mode 100644 (file)
index d359c34..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-\r
-public class ResourceAnimationController implements AnimationController {\r
-       List<Animatable> animatables = new ArrayList<Animatable>();\r
-    \r
-       Resource source;\r
-       \r
-    public ResourceAnimationController(Resource source) {\r
-       this.source = source;\r
-    }\r
-    \r
-       public void addAnimatable(Animatable animatable) {\r
-               animatables.add(animatable);\r
-               \r
-       }\r
-       \r
-       public void setAnimatable(Animatable animatable) {\r
-               animatables.clear();\r
-               animatables.add(animatable);\r
-               \r
-       }\r
-       \r
-       protected double getValue(Graph graph) {\r
-               //return PropertyUtils.getScalarDoubleValue(source);\r
-               return graph.getScalarDouble(source);\r
-               //source.getDoubleValue();\r
-       }\r
-       \r
-       public void updateAnimation(Graph graph, double frameTime) {\r
-               double d = getValue(graph);\r
-               d = d - Math.floor(d);\r
-        if (d > 1.0) {\r
-            d = 1.0;\r
-        } else if (d < 0.0) {\r
-            d = 0.0;\r
-        }\r
-        for (Animatable a : animatables)\r
-            a.animate(d,frameTime);\r
-       }\r
-       \r
-       public void dispose() {\r
-               \r
-       }\r
-       \r
-       \r
-       \r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ScalarInterpolator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ScalarInterpolator.java
deleted file mode 100644 (file)
index afe7597..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-public interface ScalarInterpolator extends Interpolator{\r
-\r
-    public double evaluate(double delta);\r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ScaledResourceAnimationController.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ScaledResourceAnimationController.java
deleted file mode 100644 (file)
index c356269..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-\r
-public class ScaledResourceAnimationController extends ResourceAnimationController {\r
-       double min;\r
-       double max;\r
-       double irange;\r
-       \r
-       public ScaledResourceAnimationController(Resource source, double min, double max) {\r
-               super(source);\r
-               this.max = max;\r
-               this.min = min;\r
-               this.irange = 1.0/(max - min);\r
-       }\r
-\r
-       \r
-       @Override\r
-       public void updateAnimation(Graph graph, double frameTime) {\r
-               double d = (getValue(graph) - min) * irange;\r
-        if (d > 1.0) {\r
-            d = 1.0;\r
-        } else if (d < 0.0) {\r
-            d = 0.0;\r
-        }\r
-        for (Animatable a : animatables)\r
-            a.animate(d,frameTime);\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/SlerpInterpolator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/SlerpInterpolator.java
deleted file mode 100644 (file)
index 33e565c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import javax.vecmath.Quat4d;\r
-\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-\r
-\r
-import com.jme.scene.Node;\r
-\r
-import org.simantics.animation.curve.SlerpCurve;\r
-\r
-\r
-public class SlerpInterpolator implements Interpolator{\r
-    private SlerpCurve curve;\r
-    \r
-    //private TransformGroup group;\r
-    //private Transform3D transform;\r
-    private Node node = null;\r
-    \r
-    public SlerpInterpolator(SlerpCurve curve) {\r
-        this.curve = curve;\r
-        //transform = new Transform3D();\r
-    }\r
-    \r
-    public void interpolate(double delta) {\r
-       Quat4d q = curve.evaluate(delta);\r
-       //transform.set(new Quat4f(q));\r
-       //group.setTransform(transform);\r
-       node.setLocalRotation(VecmathJmeTools.get(q));\r
-    }\r
-    \r
-    public void setTarget(Object target) {\r
-        //group = (TransformGroup)target;\r
-       node = (Node)target;\r
-    }\r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/TCBInterpolator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/TCBInterpolator.java
deleted file mode 100644 (file)
index 063b0a6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import org.simantics.animation.curve.TCBCurve;\r
-\r
-\r
-public class TCBInterpolator extends AbstractScalarInterpolator{\r
-    TCBCurve curve;\r
-    \r
-    public TCBInterpolator(TCBCurve curve) {\r
-        this.curve = curve;\r
-    }\r
-\r
-    public double evaluate(double delta) {\r
-        return curve.evaluate(delta);\r
-    \r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/TestAnimationController.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/TestAnimationController.java
deleted file mode 100644 (file)
index ec40dea..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-\r
-public class TestAnimationController implements AnimationController {\r
-       List<Animatable> animatables = new ArrayList<Animatable>();\r
-       \r
-       private double d = 0.0;\r
-    private double delta = 0.01;\r
-    \r
-       public void addAnimatable(Animatable animatable) {\r
-               animatables.add(animatable);\r
-               \r
-       }\r
-       \r
-       public void setAnimatable(Animatable animatable) {\r
-               animatables.clear();\r
-               animatables.add(animatable);\r
-               \r
-       }\r
-       \r
-       public void updateAnimation(Graph graph, double frameTime) {\r
-               d += delta;\r
-        if (d > 1.0) {\r
-            d = 1.0;\r
-            delta = -delta;\r
-        } else if (d < 0.0) {\r
-            delta = -delta;\r
-            d = 0.0;\r
-        }\r
-        for (Animatable a : animatables)\r
-            a.animate(d,frameTime);\r
-       }\r
-       \r
-       public void dispose() {\r
-               \r
-       }\r
-       \r
-       \r
-       \r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ui/AnimationControlCreator.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/animation/ui/AnimationControlCreator.java
deleted file mode 100644 (file)
index b433d22..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.animation.ui;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.animation.AnimationController;\r
-import org.simantics.proconf.g3d.animation.AnimationSystem;\r
-import org.simantics.proconf.g3d.animation.AnimationSystemListener;\r
-\r
-\r
-\r
-public class AnimationControlCreator {\r
-       \r
-       private AnimationSystem animationSystem;\r
-       \r
-       public AnimationControlCreator(AnimationSystem animationSystem) {\r
-               if (animationSystem == null)\r
-                       throw new IllegalArgumentException("AnimationSystem must not be null");\r
-               this.animationSystem = animationSystem;\r
-       }\r
-       \r
-       public Action createStopAction() {\r
-               return new StopAction();\r
-       }\r
-       \r
-       public Action createPauseAction() {\r
-               return new PauseAction();\r
-       }\r
-       \r
-       public Action createPlayAction() {\r
-               return new PlayAction();\r
-       }\r
-       \r
-       private class StopAction extends Action implements AnimationSystemListener {\r
-               \r
-               public StopAction() {\r
-                       super();\r
-                       this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/silk/control_stop_blue.png"));\r
-                       this.setDisabledImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/silk/control_stop.png"));\r
-                       animationSystem.addListener(this);\r
-                       if (!animationSystem.isRunning())\r
-                               this.setEnabled(false);\r
-               }\r
-               \r
-               public void run() {\r
-                       animationSystem.stop();\r
-               }\r
-               \r
-               public void animationAdded(AnimationSystem animationSystem, AnimationController animationController) {\r
-                       this.setEnabled(true);\r
-               }\r
-               \r
-               public void animationPaused(AnimationSystem animationSystem) {\r
-                       this.setEnabled(true);\r
-               }\r
-               \r
-               public void animationPlay(AnimationSystem animationSystem) {\r
-                       this.setEnabled(true);\r
-               }\r
-               \r
-               public void animationStopped(AnimationSystem animationSystem) {\r
-                       this.setEnabled(false);\r
-               }\r
-       }\r
-       \r
-       private class PlayAction extends Action implements AnimationSystemListener {\r
-               \r
-               public PlayAction() {\r
-                       super();\r
-                       this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/silk/control_play_blue.png"));\r
-                       this.setDisabledImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/silk/control_play.png"));\r
-                       animationSystem.addListener(this);\r
-                       if (!animationSystem.isPause() || !animationSystem.isRunning())\r
-                               this.setEnabled(false);\r
-               }\r
-               \r
-               public void run() {\r
-                       animationSystem.play();\r
-               }\r
-               \r
-               public void animationAdded(AnimationSystem animationSystem, AnimationController animationController) {\r
-                       this.setEnabled(animationSystem.isPause());\r
-               }\r
-               \r
-               public void animationPaused(AnimationSystem animationSystem) {\r
-                       this.setEnabled(true);\r
-               }\r
-               \r
-               public void animationPlay(AnimationSystem animationSystem) {\r
-                       this.setEnabled(false);\r
-               }\r
-               \r
-               public void animationStopped(AnimationSystem animationSystem) {\r
-                       this.setEnabled(false);\r
-               }\r
-       }\r
-       \r
-       private class PauseAction extends Action implements AnimationSystemListener {\r
-               \r
-               public PauseAction() {\r
-                       super();\r
-                       this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/silk/control_pause_blue.png"));\r
-                       this.setDisabledImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/silk/control_pause.png"));\r
-                       animationSystem.addListener(this);\r
-                       if (animationSystem.isPause() || !animationSystem.isRunning())\r
-                               this.setEnabled(false);\r
-               }\r
-               \r
-               public void run() {\r
-                       animationSystem.pause();\r
-               }\r
-               \r
-               public void animationAdded(AnimationSystem animationSystem, AnimationController animationController) {\r
-                       this.setEnabled(!animationSystem.isPause());\r
-               }\r
-               \r
-               public void animationPaused(AnimationSystem animationSystem) {\r
-                       this.setEnabled(false);\r
-               }\r
-               \r
-               public void animationPlay(AnimationSystem animationSystem) {\r
-                       this.setEnabled(true);\r
-               }\r
-               \r
-               public void animationStopped(AnimationSystem animationSystem) {\r
-                       this.setEnabled(false);\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/AppearanceTools.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/AppearanceTools.java
deleted file mode 100644 (file)
index 5cc4304..0000000
+++ /dev/null
@@ -1,454 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.swt.graphics.Device;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.StubLinkedList;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.stubs.Appearance;\r
-import org.simantics.proconf.g3d.stubs.Color;\r
-import org.simantics.proconf.g3d.stubs.G3DResource;\r
-import org.simantics.proconf.g3d.stubs.ImageTexture;\r
-import org.simantics.proconf.g3d.stubs.Material;\r
-import org.simantics.proconf.g3d.stubs.MultiTexture;\r
-import org.simantics.proconf.g3d.stubs.MultiTextureMode;\r
-import org.simantics.proconf.g3d.stubs.Shader;\r
-import org.simantics.proconf.g3d.stubs.Texture;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import com.jme.image.Image;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.FragmentProgramState;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.RenderState;\r
-import com.jme.scene.state.TextureState;\r
-import com.jme.scene.state.VertexProgramState;\r
-\r
-\r
-public class AppearanceTools {\r
-       \r
-       \r
-    \r
-    \r
-    public static void setColor(Color color, org.eclipse.swt.graphics.Color c) {\r
-        color.setRed(new double[]{(double)c.getRed() / 255.0});\r
-        color.setGreen(new double[]{(double)c.getGreen() / 255.0});\r
-        color.setBlue(new double[]{(double)c.getBlue() / 255.0});\r
-    }\r
-    \r
-    public static org.eclipse.swt.graphics.Color getColor(Color color, Device device) {\r
-        org.eclipse.swt.graphics.Color c = new org.eclipse.swt.graphics.Color(device, (int)(color.getRed()[0] * 255.0), (int)(color.getGreen()[0] * 255.0),(int)(color.getBlue()[0] * 255.0));\r
-        return c;\r
-    }\r
-    \r
-    /**\r
-     * Returns collection of renderstates that represent the given appearance.\r
-     * Note : if collection contains an alphastate, node must be inserted to transparent rendering queue.!\r
-     * @param appearance\r
-     * @param renderer\r
-     * @return\r
-     */\r
-    public static Collection<RenderState> getAppearance(Appearance appearance, Renderer renderer) {\r
-        Material m = appearance.getMaterial();\r
-        List <RenderState> states = new ArrayList<RenderState>();\r
-        if (m != null) {\r
-          states.addAll(getMaterial(m, renderer));\r
-        }\r
-        Texture t = appearance.getTexture();\r
-        if (t != null) {\r
-            if (t.isInstanceOf(Resources.g3dResource.ImageTexture)) {\r
-                states.addAll(getPatternTexture(t, renderer));\r
-            } else if (t.isInstanceOf(Resources.g3dResource.Texture3D)) {\r
-                ErrorLogger.getDefault().logWarning("JME doesn't support volume textures!", null);\r
-            } else if (t.isInstanceOf(Resources.g3dResource.MultiTexture)) {\r
-                states.addAll(getMultiTexture(t, renderer));\r
-            } else if (t.isInstanceOf(Resources.g3dResource.CubeMapTexture)) {\r
-               ErrorLogger.getDefault().logWarning("JME doesn't support cubemap textures!", null);    \r
-            } else {\r
-                throw new UnsupportedOperationException("Unsupported texture");\r
-            }\r
-        }\r
-        Shader s =  appearance.getShader();\r
-        if (s != null) {\r
-            states.addAll(getShader(s, renderer));\r
-        }\r
-        return states;\r
-        \r
-    }\r
-    \r
-    private static ColorRGBA getJMEColor(Color color) {\r
-       return new ColorRGBA((float)color.getRed()[0],(float)color.getGreen()[0],(float)color.getBlue()[0],0.f);\r
-    }\r
-    \r
-    private static ColorRGBA getJMEColor(Color color, float alpha) {\r
-       return new ColorRGBA((float)color.getRed()[0],(float)color.getGreen()[0],(float)color.getBlue()[0],alpha);\r
-    }\r
-    \r
-    private static Collection<RenderState> getMaterial(Material m , Renderer renderer) {\r
-       float alpha = 0.f;\r
-       MaterialState ms = renderer.createMaterialState();\r
-       List<RenderState> states = new ArrayList<RenderState>();\r
-       if (m.getTransparency()[0] > 0.0) {\r
-               AlphaState as = renderer.createAlphaState();\r
-               as.setBlendEnabled(true);\r
-               as.setSrcFunction(AlphaState.DB_SRC_ALPHA);\r
-               as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-               states.add(as);\r
-               alpha = 1.f - (float)m.getTransparency()[0];\r
-               //node.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-               ms.setMaterialFace(MaterialState.MF_FRONT_AND_BACK);\r
-        } else {\r
-               //node.setRenderQueueMode(Renderer.QUEUE_OPAQUE);\r
-        }\r
-       \r
-       ms.setEmissive(getJMEColor(m.getEmissiveColor()));\r
-        ms.setSpecular(getJMEColor(m.getSpecularColor()));\r
-        ms.setAmbient(getJMEColor(m.getAmbientColor()));\r
-        ms.setDiffuse(getJMEColor(m.getDiffuseColor(),alpha));\r
-        ms.setShininess((float) m.getShininess()[0]); \r
-        //node.setRenderState(ms);\r
-        states.add(ms);\r
-        return states; \r
-    }\r
-    \r
-    private static Collection<RenderState> getShader(Shader s , Renderer renderer) {\r
-       List<RenderState> states = new ArrayList<RenderState>();\r
-        VertexProgramState vs = renderer.createVertexProgramState();\r
-        vs.load(s.getVertexShader()[0]);\r
-        FragmentProgramState fs = renderer.createFragmentProgramState();\r
-        fs.load(s.getFragmentShader()[0]);\r
-        states.add(vs);\r
-        states.add(fs);\r
-        return states;\r
-    }\r
-    \r
-    private static Collection<RenderState> getPatternTexture(Texture t, Renderer renderer) {\r
-\r
-               List<RenderState> states = new ArrayList<RenderState>();\r
-               com.jme.image.Texture texture = ResourceTextureCache.getInstance().loadTexture(t.getGraph(), t.getResource());\r
-               if (texture == null)\r
-                       return states;\r
-               TextureState state = renderer.createTextureState();\r
-               state.setTexture(texture);\r
-               state.setEnabled(true);\r
-               states.add(state);\r
-               return states;\r
-       \r
-    }\r
-    \r
-    private static Image getPatternTexture(ImageTexture t) {\r
-       return ResourceTextureCache.getInstance().loadImage(t.getGraph(), t.getResource());\r
-    }\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    private static Collection<RenderState> getMultiTexture(Texture t,  Renderer renderer) {\r
-       List<RenderState> states = new ArrayList<RenderState>();\r
-       TextureState state = renderer.createTextureState();\r
-        MultiTexture t3 = new MultiTexture(t); \r
-        Collection<IEntity> mtList = t3.getRelatedObjects(Resources.g3dResource.HasMultiTextureElementList);\r
-        assert (mtList.size() == 1); //this is required in the ontology!\r
-        StubLinkedList<IEntity> list = new StubLinkedList<IEntity>(mtList.iterator().next());\r
-        \r
-        for (int i = 0; i < list.size(); i++) {\r
-               IEntity ie = list.get(i);\r
-               //MultiTextureElement e = new MultiTextureElement(ie);\r
-               Texture tex = new Texture(ie); //e.getTexture();\r
-               MultiTextureMode mode = tex.getTextureMode();//e.getTextureMode();\r
-               com.jme.image.Texture texture = new com.jme.image.Texture();\r
-            texture.setFilter(com.jme.image.Texture.FM_LINEAR);\r
-            texture.setMipmapState(com.jme.image.Texture.MM_LINEAR_LINEAR);\r
-            texture.setWrap(com.jme.image.Texture.WM_WRAP_S_WRAP_T);\r
-            if (mode.getResource().equals(Resources.g3dResource.MultiTextureMode_add)) {\r
-               texture.setApply(com.jme.image.Texture.AM_ADD);\r
-            } else if (mode.getResource().equals(Resources.g3dResource.MultiTextureMode_modulate)) {\r
-               texture.setApply(com.jme.image.Texture.AM_MODULATE);\r
-            } else if (mode.getResource().equals(Resources.g3dResource.MultiTextureMode_decal)) {\r
-               texture.setApply(com.jme.image.Texture.AM_DECAL);\r
-            } else if (mode.getResource().equals(Resources.g3dResource.MultiTextureMode_blend)) {\r
-               texture.setApply(com.jme.image.Texture.AM_BLEND);\r
-            } else if (mode.getResource().equals(Resources.g3dResource.MultiTextureMode_replace)) {\r
-               texture.setApply(com.jme.image.Texture.AM_REPLACE);\r
-            } else if (mode.getResource().equals(Resources.g3dResource.MultiTextureMode_combine)) {\r
-               texture.setApply(com.jme.image.Texture.AM_COMBINE);\r
-                //CombineMode cm = e.getCombineMode();\r
-                //CombineSource cs = e.getCombineSource();\r
-               StubLinkedList<IEntity> combine = new StubLinkedList<IEntity>(tex.getCombineDefinition());\r
-                setCombineAttributes(texture, combine);\r
-                  \r
-                  \r
-                  \r
-                  //att.setBlendColor(blendColor)\r
-                  //att.setTexBlendColor(texBlendColor)\r
-                  //att.setTextureBlendColor(color)\r
-                  //att.setTextureTransform(transform)\r
-             } else {\r
-                  throw new UnsupportedOperationException("Texture mode not supported");\r
-             }\r
-              \r
-              \r
-              if (tex.isInstanceOf(Resources.g3dResource.MultiTexture)) {\r
-                  ErrorLogger.defaultLogError("MultiTexture contains another MultiTexture which is not allowed", null);\r
-                  continue;\r
-              } else if (tex.isInstanceOf(Resources.g3dResource.ImageTexture)) {\r
-                  Image image = getPatternTexture(new ImageTexture(tex));\r
-                  if (image != null)\r
-                       texture.setImage(image);\r
-  \r
-              } else if (tex.isInstanceOf(Resources.g3dResource.Texture3D)) {\r
-               ErrorLogger.getDefault().logWarning("JME doesn't support volume textures!", null);\r
-  \r
-              } else if (tex.isInstanceOf(Resources.g3dResource.CubeMapTexture)) {\r
-               ErrorLogger.getDefault().logWarning("JME doesn't support cubemap textures!", null);    \r
-  \r
-              } else {\r
-                  throw new UnsupportedOperationException("Unsupported texture");\r
-              }\r
-\r
-              state.setTexture(texture, i);\r
-          }\r
-        states.add(state);\r
-        return states;\r
-               \r
-        //MultiTextureElementList texturesList = t3.getMultiTextureElementList();\r
-        //List<MultiTextureElement> textures = texturesList.toStandAloneList();\r
-        //ArrayList<TextureUnitState> states = new ArrayList<TextureUnitState>();\r
-       // for (MultiTextureElement e : textures) {\r
-       //     Texture tex = e.getTexture();\r
-           \r
-            //int index = e.getMultiTextureIndexValue();\r
-            //String mode = e.getMultiTextureModeValue();\r
-            \r
-       //     com.jme.image.Texture texture = new com.jme.image.Texture();\r
-       //     texture.setFilter(com.jme.image.Texture.FM_LINEAR);\r
-       //     texture.setMipmapState(com.jme.image.Texture.MM_LINEAR_LINEAR);\r
-       //     texture.setWrap(com.jme.image.Texture.WM_WRAP_S_WRAP_T);\r
-//            if (mode.startsWith(TEXTURE_MODE_MODULATE)) {\r
-//             texture.setApply(com.jme.image.Texture.AM_MODULATE);\r
-//            } else if (mode.startsWith(TEXTURE_MODE_DECAL)) {\r
-//             texture.setCombineFuncRGB(com.jme.image.Texture.AM_DECAL);\r
-//            } else if (mode.startsWith(TEXTURE_MODE_BLEND)) {\r
-//             texture.setCombineFuncRGB(com.jme.image.Texture.AM_MODULATE);\r
-//            } else if (mode.startsWith(TEXTURE_MODE_REPLACE)) {\r
-//             texture.setCombineFuncRGB(com.jme.image.Texture.AM_REPLACE);\r
-//            } else if (mode.startsWith(TEXTURE_MODE_COMBINE)) {\r
-//             texture.setCombineFuncRGB(com.jme.image.Texture.AM_COMBINE);\r
-//                \r
-//                mode = mode.substring(TEXTURE_MODE_COMBINE.length()+1); \r
-//                setCombineAttributes(texture, mode);\r
-                \r
-                \r
-                \r
-                //att.setBlendColor(blendColor)\r
-                //att.setTexBlendColor(texBlendColor)\r
-                //att.setTextureBlendColor(color)\r
-                //att.setTextureTransform(transform)\r
-//            } else {\r
-//                throw new UnsupportedOperationException("Texture mode not supported");\r
-//            }\r
-//            \r
-//            \r
-//            if (tex.isInstanceOf(Resources.g3dResource.MultiTexture)) {\r
-//                ErrorLogger.defaultLogError("MultiTexture contains another MultiTexture which is not allowed", null);\r
-//                continue;\r
-//            } else if (tex.isInstanceOf(Resources.g3dResource.ImageTexture)) {\r
-//                Image image = getPatternTexture(ImageTextureFactory.create(tex));\r
-//                if (image != null)\r
-//                     texture.setImage(image);\r
-//\r
-//            } else if (tex.isInstanceOf(Resources.g3dResource.Texture3D)) {\r
-//             ErrorLogger.getDefault().logWarning("JME doesn't support volume textures!", null);\r
-//\r
-//            } else if (tex.isInstanceOf(Resources.g3dResource.CubeMapTexture)) {\r
-//             ErrorLogger.getDefault().logWarning("JME doesn't support cubemap textures!", null);    \r
-//\r
-//            } else {\r
-//                throw new UnsupportedOperationException("Unsupported texture");\r
-//            }\r
-            \r
-            //FIXME !\r
-            //state.setTexture(texture, index);\r
-      //  }\r
-      //  node.setRenderState(state);\r
-       \r
-        \r
-\r
-    }\r
-    \r
-    \r
-    private static void setCombineAttributes(com.jme.image.Texture texture, StubLinkedList<IEntity> definition) {\r
-       // TODO : rgb and alpha scale\r
-        Iterator<IEntity> it = definition.iterator();\r
-        IEntity mode = it.next();\r
-        if (mode.getResource().equals(Resources.g3dResource.CombineMode_add)) {\r
-            texture.setCombineFuncRGB(com.jme.image.Texture.ACF_ADD);\r
-        } else if (mode.getResource().equals(Resources.g3dResource.CombineMode_addsigned)) {\r
-            texture.setCombineFuncRGB(com.jme.image.Texture.ACF_ADD_SIGNED);\r
-        } else if (mode.getResource().equals(Resources.g3dResource.CombineMode_dot3)) {\r
-            texture.setCombineFuncRGB(com.jme.image.Texture.ACF_DOT3_RGB);\r
-        } else if (mode.getResource().equals(Resources.g3dResource.CombineMode_interpolate)) {\r
-            texture.setCombineFuncRGB(com.jme.image.Texture.ACF_INTERPOLATE);\r
-        } else if (mode.getResource().equals(Resources.g3dResource.CombineMode_modulate)) {\r
-            texture.setCombineFuncRGB(com.jme.image.Texture.ACF_MODULATE);\r
-        } else if (mode.getResource().equals(Resources.g3dResource.CombineMode_replace)) {\r
-            texture.setCombineFuncRGB(com.jme.image.Texture.ACF_REPLACE);\r
-        } else if (mode.getResource().equals(Resources.g3dResource.CombineMode_subtract)) {\r
-            texture.setCombineFuncRGB(com.jme.image.Texture.ACF_SUBTRACT);\r
-        } else {\r
-            throw new UnsupportedOperationException("Unsupported combine mode");\r
-        }\r
-        mode = it.next();\r
-        int i = 0;\r
-        for (i = 0; i < 3; i++) {\r
-               int m;\r
-            if (mode.getResource().equals(Resources.g3dResource.CombineSource_constantcolor)) {\r
-                m = com.jme.image.Texture.ACS_CONSTANT;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_objectcolor)) {\r
-                m = com.jme.image.Texture.ACS_PRIMARY_COLOR;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_previousstate)) {\r
-                m = com.jme.image.Texture.ACS_TEXTURE;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_texturecolor)) {\r
-                m = com.jme.image.Texture.ACS_TEXTURE;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_texture0)) {\r
-                m = com.jme.image.Texture.ACS_TEXTURE;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_texture1)) {\r
-                m = com.jme.image.Texture.ACS_TEXTURE;\r
-            } else {\r
-                break;\r
-                //throw new UnsupportedOperationException("Texture combine source not supported");\r
-            }\r
-            mode = it.next();\r
-            switch (i) {\r
-               case 0:\r
-                       texture.setCombineSrc0RGB(m);\r
-                       break;\r
-               case 1:\r
-                       texture.setCombineSrc1RGB(m);\r
-                       break;\r
-               case 2:\r
-                       texture.setCombineSrc2RGB(m);\r
-                       break;\r
-                       \r
-            }\r
-        }\r
-        if (i > 0) {\r
-            for (i = 0; i < 3; i++) {\r
-               int m;\r
-                if (mode.getResource().equals(Resources.g3dResource.CombineFunction_srccolor)) {\r
-                    m = com.jme.image.Texture.ACO_SRC_COLOR;\r
-                } else if (mode.getResource().equals(Resources.g3dResource.CombineFunction_srcalpha)) {\r
-                    m = com.jme.image.Texture.ACO_SRC_ALPHA;\r
-                } else if (mode.getResource().equals(Resources.g3dResource.CombineFunction_oneminussrccolor)) {\r
-                    m = com.jme.image.Texture.ACO_ONE_MINUS_SRC_COLOR;\r
-                } else if (mode.getResource().equals(Resources.g3dResource.CombineFunction_oneminussrcalpha)) {\r
-                    m = com.jme.image.Texture.ACO_ONE_MINUS_SRC_ALPHA;\r
-                } else {\r
-                    break;\r
-                }\r
-                mode = it.next();\r
-                switch (i) {\r
-               case 0:\r
-                       texture.setCombineOp0RGB(m);\r
-                       break;\r
-               case 1:\r
-                       texture.setCombineOp1RGB(m);\r
-                       break;\r
-               case 2:\r
-                       texture.setCombineOp2RGB(m);\r
-                       break;\r
-                       \r
-                }\r
-            }\r
-        }\r
-        \r
-        for (i = 0; i < 3; i++) {\r
-               int m;\r
-               if (mode.getResource().equals(Resources.g3dResource.CombineSource_constantcolor)) {\r
-                m = com.jme.image.Texture.ACS_CONSTANT;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_objectcolor)) {\r
-                m = com.jme.image.Texture.ACS_PRIMARY_COLOR;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_previousstate)) {\r
-                m = com.jme.image.Texture.ACS_TEXTURE;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_texturecolor)) {\r
-                m = com.jme.image.Texture.ACS_TEXTURE;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_texture0)) {\r
-                m = com.jme.image.Texture.ACS_TEXTURE;\r
-            } else if (mode.getResource().equals(Resources.g3dResource.CombineSource_texture1)) {\r
-                m = com.jme.image.Texture.ACS_TEXTURE;\r
-            } else {\r
-                break;\r
-                //throw new UnsupportedOperationException("Texture combine source not supported");\r
-            }\r
-            mode = it.next();\r
-            switch (i) {\r
-               case 0:\r
-                       texture.setCombineSrc0Alpha(m);\r
-                       break;\r
-               case 1:\r
-                       texture.setCombineSrc1Alpha(m);\r
-                       break;\r
-               case 2:\r
-                       texture.setCombineSrc2Alpha(m);\r
-                       break;\r
-                       \r
-            }\r
-        }\r
-        if (i > 0) {\r
-            for (i = 0; i < 3; i++) {\r
-               int m;\r
-               if (mode.getResource().equals(Resources.g3dResource.CombineFunction_srccolor)) {\r
-                    m = com.jme.image.Texture.ACO_SRC_COLOR;\r
-                } else if (mode.getResource().equals(Resources.g3dResource.CombineFunction_srcalpha)) {\r
-                    m = com.jme.image.Texture.ACO_SRC_ALPHA;\r
-                } else if (mode.getResource().equals(Resources.g3dResource.CombineFunction_oneminussrccolor)) {\r
-                    m = com.jme.image.Texture.ACO_ONE_MINUS_SRC_COLOR;\r
-                } else if (mode.getResource().equals(Resources.g3dResource.CombineFunction_oneminussrcalpha)) {\r
-                    m = com.jme.image.Texture.ACO_ONE_MINUS_SRC_ALPHA;\r
-                } else {\r
-                    break;\r
-                }\r
-                mode = it.next();\r
-                switch (i) {\r
-               case 0:\r
-                       texture.setCombineOp0Alpha(m);\r
-                       break;\r
-               case 1:\r
-                       texture.setCombineOp1Alpha(m);\r
-                       break;\r
-               case 2:\r
-                       texture.setCombineOp2Alpha(m);\r
-                       break;\r
-                       \r
-                }\r
-            }\r
-        }\r
-    }\r
-    \r
-    public static void copyMaterial(Geometry from, Geometry to) {\r
-       for (int i = RenderState.RS_ALPHA; i < RenderState.RS_MAX_STATE; i++) {\r
-               RenderState rs = from.getRenderState(i);\r
-               if (rs != null)\r
-                       to.setRenderState(rs);\r
-       }\r
-       \r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/Constraint.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/Constraint.java
deleted file mode 100644 (file)
index 9d48d3e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-public class Constraint {\r
-       \r
-       public Constraint() {\r
-               points = new ArrayList<Point3d>();\r
-               dirs = new ArrayList<Vector3d>();\r
-       }\r
-       \r
-       public List<Point3d> points;\r
-       public List<Vector3d> dirs;\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ConstraintDetector.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ConstraintDetector.java
deleted file mode 100644 (file)
index 3a18c27..0000000
+++ /dev/null
@@ -1,442 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestWithResult;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.adaption.AdaptionException;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Line;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-public class ConstraintDetector {\r
-    \r
-    private static final int X = 0;\r
-    private static final int Y = 1;\r
-    private static final int Z = 2;\r
-    \r
-    \r
-    private ThreeDimensionalEditorBase editor;\r
-    //private G3DNode constraintReference = null;\r
-    private Resource constraintReference = null;\r
-    private ArrayList<Point3d> constraintPoints = new ArrayList<Point3d>();\r
-    private ArrayList<Vector3d> constraintDirections = new ArrayList<Vector3d>();\r
-    private MaterialState ms;\r
-    \r
-    private ColorRGBA xColor = new ColorRGBA(1.f,0.f,0.f,1.f);\r
-    private ColorRGBA yColor = new ColorRGBA(0.f,1.f,0.f,1.f);\r
-    private ColorRGBA zColor = new ColorRGBA(0.f,0.f,1.f,1.f);\r
-    \r
-    \r
-    public ConstraintDetector(ThreeDimensionalEditorBase editor) {\r
-        this.editor = editor;\r
-        ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-        ms.setEmissive(new ColorRGBA(1.f,1.f,1.f,1.f));\r
-        ms.setColorMaterial(MaterialState.CM_EMISSIVE);\r
-    }\r
-    \r
-\r
-    public void clearConstraints() {\r
-        //System.out.println("ConstraintDetector.clearConstraints()");\r
-        constraintPoints.clear();\r
-        constraintDirections.clear();\r
-    }\r
-    \r
-    private void updateConstraints() {\r
-        clearConstraints();\r
-        if (constraintReference == null)\r
-            return;\r
-        GraphRequestWithResult<Constraint>  request = new GraphRequestWithResult<Constraint>() {\r
-               @Override\r
-               public Constraint performWithResult(Graph g) throws Exception {\r
-                       try {\r
-                               return g.adapt(constraintReference, Resources.g3dResource.HasConstraints);\r
-                       } catch (AdaptionException e) {\r
-                               ErrorLogger.defaultLogWarning("Cannot add constraint", e);\r
-                               return null;\r
-                       }\r
-               }\r
-        };\r
-        editor.getSession().syncRead(request);\r
-        Constraint c = request.getResult();\r
-        if (c == null)\r
-               return;\r
-        constraintPoints.addAll(c.points);\r
-        constraintDirections.addAll(c.dirs);\r
-    }\r
-    \r
-    \r
-    public ArrayList<Point3d> getConstraintPoints() {\r
-        return constraintPoints;\r
-    }\r
-    \r
-    public ArrayList<Vector3d> getConstraintDirections() {\r
-        return constraintDirections;\r
-    }\r
-\r
-    public void updateConstraintReference() {\r
-   \r
-            Resource interactive = null;\r
-            if (editor.getSelectionAdapter().getHighlightSelection().size() > 0) {\r
-                interactive = editor.getSelectionAdapter().getInteractiveSelectedObjects().iterator().next().getResource();\r
-                if (constraintReference == null) {\r
-                    constraintReference = interactive;\r
-                    updateConstraints();\r
-                } else if (!constraintReference.getResource().equals(interactive.getResource())) {\r
-                    constraintReference = interactive;\r
-                    updateConstraints();\r
-                }\r
-            } else {\r
-                constraintReference = null;\r
-                updateConstraints();\r
-            }\r
-\r
-    }\r
-    \r
-    public void addContraintPoint(Point3d p) {\r
-        //System.out.println("ConstraintDetector.addConstraintPoint() " + p);\r
-        constraintPoints.add(p);\r
-    }\r
-    \r
-    public void addContraintDirection(Vector3d v) {\r
-        //System.out.println("ConstraintDetector.addConstraintDirection() " + v);\r
-        constraintDirections.add(v);\r
-    }\r
-    \r
-    private double snapAngle = 0.1;\r
-    private String snapString = "";\r
-\r
-    private ArrayList<Geometry> constraintHighlights = new ArrayList<Geometry>();\r
-    \r
-    public Point3d getSnappedPoint(Vector3d pickPoint, Vector3d pickDir, Vector3d requestedPoint) {\r
-        \r
-        \r
-        Vector3d snappedPoint = new Vector3d();\r
-        Vector3d t = new Vector3d();\r
-        Point3d currentPoint = null;\r
-        // TODO : snap to closest angle\r
-        for (Vector3d constraintDir : constraintDirections) {\r
-            \r
-            MathTools.intersectStraightStraight(pickPoint,pickDir, requestedPoint, constraintDir, t, snappedPoint);\r
-            t.sub(snappedPoint);\r
-            if (t.lengthSquared() < snapAngle) {\r
-                \r
-                snapString += "Angle snap ";\r
-                currentPoint = new Point3d(snappedPoint);\r
-                break;\r
-            }\r
-        }\r
-        if (currentPoint != null) {\r
-            Vector3d dir = new Vector3d(currentPoint);\r
-            dir.sub(requestedPoint);\r
-            Point3d p = getPointSnap(requestedPoint, dir);\r
-            if (p != null)\r
-                currentPoint = p;\r
-        } else {\r
-               List<Double> distances = new ArrayList<Double>();\r
-               List<Point3d> snapPoints = new ArrayList<Point3d>();\r
-               List<String> snapStrings = new ArrayList<String>();\r
-               List<ColorRGBA> snapColors = new ArrayList<ColorRGBA>();\r
-            for (Point3d constraintPoint : constraintPoints) {\r
-               distances.clear();\r
-               snapPoints.clear();\r
-               snapStrings.clear();\r
-                MathTools.intersectStraightStraight(new Vector3d(constraintPoint), new Vector3d(1.0, 0.0, 0.0),\r
-                        pickPoint, pickDir, snappedPoint, t);\r
-                t.sub(snappedPoint);\r
-                double distance = t.lengthSquared();\r
-                if (distance < snapAngle) {\r
-                       distances.add(distance);\r
-                       snapPoints.add(new Point3d(snappedPoint));\r
-                       snapStrings.add("Point x-snap ");\r
-                       snapColors.add(xColor);\r
-                }\r
-                MathTools.intersectStraightStraight(new Vector3d(constraintPoint), new Vector3d(0.0, 1.0, 0.0),\r
-                        pickPoint, pickDir, snappedPoint, t);\r
-                t.sub(snappedPoint);\r
-                distance = t.lengthSquared();\r
-                if (distance < snapAngle) {\r
-                       distances.add(distance);\r
-                       snapPoints.add(new Point3d(snappedPoint));\r
-                       snapStrings.add("Point y-snap ");\r
-                       snapColors.add(yColor);\r
-                }\r
-                MathTools.intersectStraightStraight(new Vector3d(constraintPoint), new Vector3d(0.0, 0.0, 1.0),\r
-                        pickPoint, pickDir, snappedPoint, t);\r
-                t.sub(snappedPoint);\r
-                distance = t.lengthSquared();\r
-                if (distance < snapAngle) {\r
-                       distances.add(distance);\r
-                       snapPoints.add(new Point3d(snappedPoint));\r
-                       snapStrings.add("Point z-snap ");\r
-                       snapColors.add(zColor);\r
-                    \r
-                }\r
-                if (distances.size() > 0) {\r
-                    if (distances.size() > 1) {\r
-                        // more than one axes snape\r
-                       Vector3d ref = MathTools.closestPointOnStraight(constraintPoint, new Point3d(pickPoint), pickDir);\r
-                       ref.sub(constraintPoint);\r
-                       distance = ref.lengthSquared();\r
-                       if (distance < snapAngle) {\r
-                               // we are close enought to point, so we'll just snap there\r
-                               currentPoint = new Point3d(constraintPoint);\r
-                               snapString += "Point snap ";\r
-                       } else {\r
-                               // select the closest of axes snap to\r
-                               int min = 0;\r
-                               for (int i = 1; i < distances.size(); i++) {\r
-                                       if (distances.get(i) < distances.get(min))\r
-                                               min = i;\r
-                               }\r
-                               currentPoint = snapPoints.get(min);\r
-                               addConstrainLineHighlight(currentPoint, constraintPoint,snapColors.get(min));\r
-                               snapString += snapStrings.get(min);\r
-                       }\r
-                    } else {\r
-                       // only one of the axes snaps\r
-                       currentPoint = snapPoints.get(0);\r
-                       addConstrainLineHighlight(currentPoint, constraintPoint,snapColors.get(0));\r
-                       snapString += snapStrings.get(0);\r
-                    }\r
-                    break;\r
-                }\r
-            }\r
-        }\r
-        return currentPoint;\r
-\r
-    }\r
-    \r
-    public void clearConstraintHighlights() {\r
-        snapString = "";\r
-\r
-        for (Geometry s : constraintHighlights)\r
-            s.removeFromParent();\r
-        \r
-        constraintHighlights.clear();\r
-    }\r
-    \r
-    private void addConstrainLineHighlight(Point3d p1, Point3d p2, ColorRGBA color) {\r
-\r
-       float coord[] = new float[6];\r
-       ColorRGBA colors[] = new ColorRGBA[2];\r
-       colors[0] = color;\r
-       colors[1] = color;\r
-       coord[0] = (float)p1.x;\r
-       coord[1] = (float)p1.y;\r
-       coord[2] = (float)p1.z;\r
-       coord[3] = (float)p2.x;\r
-       coord[4] = (float)p2.y;\r
-       coord[5] = (float)p2.z;\r
-       Line shape = new Line("",BufferUtils.createFloatBuffer(coord),null,BufferUtils.createFloatBuffer(colors),null);\r
-       editor.getRenderingComponent().getNoShadowRoot().attachChild(shape);\r
-       shape.setRenderState(ms);\r
-       constraintHighlights.add(shape);\r
-    }\r
-    \r
-    private void addConstrainPlaneHighlight(Point3d p1, Point3d p2, int axis) {\r
-\r
-       float coord[] = new float[9];\r
-       ColorRGBA colors[] = new ColorRGBA[3];\r
-       coord[0] = (float)p1.x;\r
-       coord[1] = (float)p1.y;\r
-       coord[2] = (float)p1.z;\r
-       switch (axis) {\r
-       case X:\r
-               coord[3] = (float)p1.x;\r
-               coord[4] = (float)p1.y;\r
-               coord[5] = (float)p2.z;\r
-               colors[0] = colors[1] = colors[2] = xColor;\r
-               break;\r
-       case Y:\r
-               coord[3] = (float)p1.x;\r
-               coord[4] = (float)p1.y;\r
-               coord[5] = (float)p2.z;\r
-               colors[0] = colors[1] = colors[2] = yColor;\r
-               break;\r
-       case Z:\r
-               coord[3] = (float)p1.x;\r
-               coord[4] = (float)p2.y;\r
-               coord[5] = (float)p2.z;\r
-               colors[0] = colors[1] = colors[2] = zColor;\r
-               break;\r
-       \r
-       }\r
-       coord[6] = (float)p2.x;\r
-       coord[7] = (float)p2.y;\r
-       coord[8] = (float)p2.z;\r
-       Line shape = new Line("",BufferUtils.createFloatBuffer(coord),null,BufferUtils.createFloatBuffer(colors),null);\r
-       shape.setMode(Line.CONNECTED);\r
-       editor.getRenderingComponent().getNoShadowRoot().attachChild(shape);\r
-       shape.setRenderState(ms);\r
-        constraintHighlights.add(shape);\r
-    }\r
-    \r
-    /**\r
-     * Snaps position to axis-aligned planes defined by constraint points\r
-     * Form of position is p+v, meaning that the position that is snapped is requestedPoint + requestedDir\r
-     * @param requestedPoint one part of the position to be snapped\r
-     * @param requestedDir second part of the position to be snapped and direction that the position is allowed to move\r
-     * @return\r
-     */\r
-    public Point3d getPointSnap(Vector3d requestedPoint, Vector3d requestedDir) {\r
-        \r
-        Vector3d snappedPoint = new Vector3d();\r
-        Point3d currentPoint = null;\r
-        double u[] = new double[1];\r
-        List<Point3d> p1s = new ArrayList<Point3d>();\r
-        List<Point3d> p2s = new ArrayList<Point3d>();\r
-        List<Integer> axes = new ArrayList<Integer>();\r
-        \r
-        for (Point3d constraintPoint : constraintPoints) {\r
-            boolean snap = false;\r
-            \r
-            if (MathTools.intersectStraightPlane(requestedPoint, requestedDir, new Vector3d(constraintPoint), getAxialVector(X), snappedPoint,u) && Math.abs(1.0 - u[0]) < snapAngle) {\r
-                currentPoint = new Point3d(snappedPoint);\r
-                //snapString += "Point/Plane x-snap ";\r
-                snap = true;\r
-                //addConstrainPlaneHighlight(constraintPoint, currentPoint,X);\r
-                p1s.add(constraintPoint);\r
-                p2s.add(currentPoint);\r
-                axes.add(X);\r
-            }\r
-            \r
-            if (MathTools.intersectStraightPlane(requestedPoint, requestedDir, new Vector3d(constraintPoint), getAxialVector(Y), snappedPoint,u) && Math.abs(1.0 - u[0]) < snapAngle) {\r
-                currentPoint = new Point3d(snappedPoint);\r
-                //snapString += "Point/Plane y-snap ";\r
-                snap = true;\r
-                //addConstrainPlaneHighlight(constraintPoint, currentPoint,Y);\r
-                p1s.add(constraintPoint);\r
-                p2s.add(currentPoint);\r
-                axes.add(Y);\r
-            }\r
-            \r
-            if (MathTools.intersectStraightPlane(requestedPoint, requestedDir, new Vector3d(constraintPoint), getAxialVector(Z), snappedPoint,u) && Math.abs(1.0 - u[0]) < snapAngle) {\r
-                currentPoint = new Point3d(snappedPoint);\r
-                //snapString += "Point/Plane z-snap ";\r
-                snap = true;\r
-                //addConstrainPlaneHighlight(constraintPoint, currentPoint,Z);\r
-                p1s.add(constraintPoint);\r
-                p2s.add(currentPoint);\r
-                axes.add(Z);\r
-            }\r
-            if (snap)\r
-                break;\r
-        }\r
-        if (p1s.size() == 0)\r
-               return null;\r
-        if (p1s.size() == 1) {\r
-               snapString += "Point/Plane ";\r
-               switch (axes.get(0)) {\r
-               case X:\r
-                       snapString += "x";\r
-                       break;\r
-               case Y:\r
-                       snapString += "y";\r
-                       break;\r
-               case Z:\r
-                       snapString += "z";\r
-                       break;\r
-               }\r
-               snapString += "-snap ";\r
-               addConstrainPlaneHighlight(p1s.get(0), p2s.get(0),axes.get(0));\r
-               return currentPoint;\r
-        } else if (p1s.size() == 3){\r
-               // all axial planes are intersecting, snapping point must be the constraint point\r
-               // all constraint points are the same, so just pick the first in the list\r
-               snapString += "Point/Point ";\r
-               return p1s.get(0);\r
-        } else {\r
-               Vector3d dir = new Vector3d();\r
-               dir.cross(getAxialVector(axes.get(0)), getAxialVector(axes.get(1)));\r
-               currentPoint = new Point3d(MathTools.closestPointOnStraight(currentPoint, p1s.get(0), dir));\r
-               addConstrainLineHighlight(p1s.get(0), currentPoint, xColor);\r
-               snapString += "Point/Line ";\r
-               return currentPoint;\r
-        }\r
-        \r
-    }\r
-    \r
-    private Vector3d getAxialVector(int axis) {\r
-       switch (axis) {\r
-       case X:\r
-               return new Vector3d(1.0,0.0,0.0);\r
-       case Y:\r
-               return new Vector3d(0.0,1.0,0.0);\r
-       case Z:\r
-               return new Vector3d(0.0,0.0,1.0);\r
-       }\r
-       throw new RuntimeException("Unknown axis " + axis);     \r
-    }\r
-    \r
-    /**\r
-     * Snaps the position to axis-aligned planes defined by constraint points\r
-     * @param requestedPoint point that is snapped\r
-     * @param requestedDir direction that point is allowed to move\r
-     * @return\r
-     */\r
-    \r
-    public Point3d getPointSnap2(Vector3d requestedPoint, Vector3d requestedDir) {\r
-        \r
-        Vector3d snappedPoint = new Vector3d();\r
-        Point3d currentPoint = null;\r
-        double u[] = new double[1];\r
-        //System.out.println(requestedPoint + "  " + requestedDir);\r
-        for (Point3d constraintPoint : constraintPoints) {\r
-            boolean snap = false;\r
-            //System.out.print(constraintPoint + " ");\r
-            if (MathTools.intersectStraightPlane(requestedPoint, requestedDir, new Vector3d(constraintPoint), new Vector3d(1.0,0.0,0.0), snappedPoint,u) && Math.abs(u[0]) < snapAngle) {\r
-                currentPoint = new Point3d(snappedPoint);\r
-                snapString += "Point/Plane x-snap ";\r
-                snap = true;\r
-                addConstrainPlaneHighlight(constraintPoint, currentPoint,X);\r
-                //System.out.print(" x " + u[0]);\r
-            }\r
-            \r
-            if (MathTools.intersectStraightPlane(requestedPoint, requestedDir, new Vector3d(constraintPoint), new Vector3d(0.0,1.0,0.0), snappedPoint,u) && Math.abs(u[0]) < snapAngle) {\r
-                currentPoint = new Point3d(snappedPoint);\r
-                snapString += "Point/Plane y-snap ";\r
-                snap = true;\r
-                addConstrainPlaneHighlight(constraintPoint, currentPoint,Y);\r
-                //System.out.print(" y " + u[0]);\r
-            }\r
-           \r
-            \r
-            if (MathTools.intersectStraightPlane(requestedPoint, requestedDir, new Vector3d(constraintPoint), new Vector3d(0.0,0.0,1.0), snappedPoint,u) && Math.abs(u[0]) < snapAngle) {\r
-                currentPoint = new Point3d(snappedPoint);\r
-                snapString += "Point/Plane z-snap ";\r
-                snap = true;\r
-                addConstrainPlaneHighlight(constraintPoint, currentPoint,Z);\r
-                //System.out.print(" z " + u[0]);\r
-            }\r
-            //System.out.println();\r
-            if (snap)\r
-                break;\r
-        }\r
-        return currentPoint;\r
-    }\r
-    \r
-    public String getSnapString() {\r
-        return snapString;\r
-    }\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/EditorContribution.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/EditorContribution.java
deleted file mode 100644 (file)
index 0cca6ec..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.Collection;\r
-\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.simantics.db.Graph;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-\r
-public interface EditorContribution {\r
-       \r
-       public String getName();\r
-       \r
-       /**\r
-        * Initializes the contribution\r
-        * @param graph\r
-        */\r
-       void initialize(Graph graph);\r
-       \r
-       \r
-       /**\r
-        * Allows contribution to modify current ui.\r
-        * @param parent\r
-        */\r
-       void createControl(Composite parent);\r
-       \r
-       /**\r
-        * Removes all changes created by createControl\r
-        */\r
-       void disposeControl();\r
-       \r
-       /**\r
-        * Fills context menu\r
-        * @param graph\r
-        * @param manager\r
-        */\r
-       void fillContextMenu(Graph graph, IMenuManager manager, StructuredResourceSelection selection);\r
-       \r
-       /**\r
-        * Fills toolbar\r
-        * \r
-        * @param manager\r
-        */\r
-       void fillLocalToolBar(IToolBarManager manager);\r
-       \r
-       /**\r
-        * Fills menumanager\r
-        * \r
-        * \r
-        * @param manager\r
-        */\r
-       void fillLocalPullDown(IMenuManager manager);\r
-\r
-       \r
-       /**\r
-        * Returns context dependent actions\r
-        * @return\r
-        */\r
-       Collection<ContextAction> getActions();\r
-       \r
-       /**\r
-        * \r
-        */\r
-       void run();\r
-       \r
-       void dispose();\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/G3DAPI.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/G3DAPI.java
deleted file mode 100644 (file)
index 3bec68d..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.simantics.proconf.g3d.base;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Tuple3d;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.Resources;\r
-\r
-/**\r
- * Set of methods that make scene-graph handling easier.\r
- * \r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class G3DAPI {\r
-\r
-       \r
-       public static void setWorldPosition(IEntity node, Tuple3d position) {\r
-               G3DTools.setTuple3(node.getSingleRelatedObject(Resources.g3dResource.HasWorldPosition), position);\r
-               //G3DTools.transformationUpdate(node.getGraph(), node.getResource());\r
-               G3DTools.propagateWorldTransformChange(node.getSingleRelatedObject(Resources.g3dResource.HasParent), node);\r
-       }\r
-       \r
-       public static void setLocalPosition(IEntity node, Tuple3d position) {\r
-               G3DTools.setTuple3(node.getSingleRelatedObject(Resources.g3dResource.HasLocalPosition), position);\r
-               //G3DTools.transformationUpdate(node.getGraph(), node.getResource());\r
-               G3DTools.propagateLocalTransformChange(node.getSingleRelatedObject(Resources.g3dResource.HasParent), node);\r
-               \r
-       }\r
-       \r
-       public static void setWorldOrientation(IEntity node, AxisAngle4d orientation) {\r
-               G3DTools.setOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasWorldOrientation), orientation);\r
-               //G3DTools.transformationUpdate(node.getGraph(), node.getResource());\r
-               G3DTools.propagateWorldTransformChange(node.getSingleRelatedObject(Resources.g3dResource.HasParent), node);\r
-               \r
-       }\r
-       \r
-       public static void setLocalOrientation(IEntity node, AxisAngle4d orientation) {\r
-               G3DTools.setOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation), orientation);\r
-               //G3DTools.transformationUpdate(node.getGraph(), node.getResource());\r
-               G3DTools.propagateLocalTransformChange(node.getSingleRelatedObject(Resources.g3dResource.HasParent), node);\r
-               \r
-               \r
-       }\r
-       \r
-       public static void setWorldTransformation(IEntity node, Tuple3d position, AxisAngle4d orientation) {\r
-               G3DTools.setTuple3(node.getSingleRelatedObject(Resources.g3dResource.HasWorldPosition), position);\r
-               G3DTools.setOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasWorldOrientation), orientation);\r
-               //G3DTools.transformationUpdate(node.getGraph(), node.getResource());\r
-               G3DTools.propagateWorldTransformChange(node.getSingleRelatedObject(Resources.g3dResource.HasParent), node);\r
-               \r
-       }\r
-       \r
-       public static void setLocalTransformation(IEntity node, Tuple3d position, AxisAngle4d orientation) {\r
-               G3DTools.setTuple3(node.getSingleRelatedObject(Resources.g3dResource.HasLocalPosition), position);\r
-               G3DTools.setOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation), orientation);\r
-               //G3DTools.transformationUpdate(node.getGraph(), node.getResource());\r
-               G3DTools.propagateLocalTransformChange(node.getSingleRelatedObject(Resources.g3dResource.HasParent), node);\r
-       }\r
-       \r
-       public static void addNodeWorld(IEntity parent, IEntity node) {\r
-               parent.addStatement(Resources.g3dResource.HasChild, node);\r
-               G3DTools.propagateWorldTransformChange(parent,node);\r
-       }\r
-       \r
-       public static void addNodeLocal(IEntity parent, IEntity node) {\r
-               parent.addStatement(Resources.g3dResource.HasChild, node);\r
-               G3DTools.propagateLocalTransformChange(parent,node);\r
-       }\r
-       \r
-       public static void addNodeWorld(IEntity parent, Resource relation, IEntity node) {\r
-               assert(parent.getGraph().isSubrelationOf(relation, Resources.g3dResource.HasChild));\r
-               parent.addStatement(relation, node);\r
-               G3DTools.propagateWorldTransformChange(parent,node);\r
-       }\r
-       \r
-       public static void addNodeLocal(IEntity parent, Resource relation, IEntity node) {\r
-               assert(parent.getGraph().isSubrelationOf(relation, Resources.g3dResource.HasChild));\r
-               parent.addStatement(relation, node);\r
-               G3DTools.propagateLocalTransformChange(parent,node);\r
-       }\r
-       \r
-       public static void removeNode(IEntity node) {\r
-               node.removeRelatedStatements(Resources.g3dResource.HasParent);\r
-       }\r
-       \r
-       public static void moveNode(IEntity node, IEntity newParent) {\r
-               node.removeRelatedStatements(Resources.g3dResource.HasParent);\r
-               newParent.addStatement(Resources.g3dResource.HasChild, node);\r
-               G3DTools.propagateWorldTransformChange(newParent,node);\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/G3DTools.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/G3DTools.java
deleted file mode 100644 (file)
index 0b08880..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.Collection;\r
-import java.util.Set;\r
-import java.util.Stack;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.AxisAngle4f;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Point3f;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Tuple3d;\r
-import javax.vecmath.Tuple3f;\r
-import javax.vecmath.Vector3d;\r
-import javax.vecmath.Vector3f;\r
-\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.Statement;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.viewpoints.State;\r
-import org.simantics.layer0.utils.viewpoints.TraversalDecision;\r
-import org.simantics.layer0.utils.viewpoints.TraversalResult;\r
-import org.simantics.layer0.utils.viewpoints.TraversalRule;\r
-import org.simantics.layer0.utils.viewpoints.TraversalUtils;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.proconf.g3d.stubs.Orientation;\r
-import org.simantics.proconf.g3d.stubs.Position;\r
-\r
-/**\r
- * Basic ThreeDimensionalModelingOntology tools\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class G3DTools {\r
-       \r
-       private static boolean DEBUG = false;\r
-       \r
-       private static TransformationTools tt;\r
-\r
-       public static void initialize() {\r
-               tt = new TransformationTools(Resources.g3dResource.HasChild, Resources.g3dResource.HasParent);\r
-       }\r
-       \r
-       public static void deinitialize() {\r
-               tt = null;\r
-       }\r
-       \r
-       public static Point3d getPoint(IEntity p) {\r
-        return new Point3d(p.getSingleRelatedScalarDouble(Resources.g3dResource.HasX),\r
-                                          p.getSingleRelatedScalarDouble(Resources.g3dResource.HasY),\r
-                                          p.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ));\r
-    }\r
-    \r
-    public static Point3f getPointFloat(IEntity p) {\r
-        return new Point3f((float)p.getSingleRelatedScalarDouble(Resources.g3dResource.HasX),\r
-                                          (float)p.getSingleRelatedScalarDouble(Resources.g3dResource.HasY),\r
-                                          (float)p.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ));\r
-    }\r
-    \r
-    \r
-    public static Vector3d getVector(IEntity p) {\r
-        return new Vector3d(p.getSingleRelatedScalarDouble(Resources.g3dResource.HasX),\r
-                                                       p.getSingleRelatedScalarDouble(Resources.g3dResource.HasY),\r
-                                                       p.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ));\r
-    }\r
-    \r
-    public static Vector3f getVectorFloat(IEntity p) {\r
-        return new Vector3f((float)p.getSingleRelatedScalarDouble(Resources.g3dResource.HasX),\r
-                                                       (float)p.getSingleRelatedScalarDouble(Resources.g3dResource.HasY),\r
-                                                       (float)p.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ));\r
-    }\r
-\r
-    \r
-    public static void setTuple3(IEntity d, Tuple3d translation) {\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasX, translation.x);\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasY, translation.y);\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasZ, translation.z);    \r
-    }\r
-    \r
-    public static void setTuple3(IEntity d, Tuple3f translation) {\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasX, translation.x);\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasY, translation.y);\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasZ, translation.z);    \r
-    }\r
-\r
-    public static void setTuple3(IEntity d, double x, double y, double z) {\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasX, x);\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasY, y);\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasZ, z);    \r
-    }\r
-    \r
-    public static void addTuple3(IEntity d, Tuple3d translation) {\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasX, translation.x + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasX));\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasY, translation.y + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasY));\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasZ, translation.z + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ));\r
-    }\r
-    \r
-    public static void addTuple3(IEntity d, Tuple3f translation) {\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasX, translation.x + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasX));\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasY, translation.y + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasY));\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasZ, translation.z + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ));\r
-    }\r
-\r
-    public static void addTuple3(IEntity d, double x, double y, double z) {\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasX, x + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasX));\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasY, y + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasY));\r
-       d.setRelatedScalarDouble(Resources.g3dResource.HasZ, z + d.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ));    \r
-    }\r
-    \r
-    public static AxisAngle4d getOrientation(IEntity r) {\r
-        return new AxisAngle4d(r.getSingleRelatedScalarDouble(Resources.g3dResource.HasX),\r
-                                                  r.getSingleRelatedScalarDouble(Resources.g3dResource.HasY),\r
-                                                  r.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ),\r
-                                                  r.getSingleRelatedScalarDouble(Resources.g3dResource.HasAngle));\r
-    }\r
-    \r
-    public static AxisAngle4f getOrientationFloat(IEntity r) {\r
-        return new AxisAngle4f((float)r.getSingleRelatedScalarDouble(Resources.g3dResource.HasX),\r
-                                          (float)r.getSingleRelatedScalarDouble(Resources.g3dResource.HasY),\r
-                                          (float)r.getSingleRelatedScalarDouble(Resources.g3dResource.HasZ),\r
-                                          (float)r.getSingleRelatedScalarDouble(Resources.g3dResource.HasAngle));\r
-    }\r
-\r
-    public static void setOrientation(IEntity r, AxisAngle4d aa) {\r
-       r.setRelatedScalarDouble(Resources.g3dResource.HasX, aa.x);\r
-       r.setRelatedScalarDouble(Resources.g3dResource.HasY, aa.y);\r
-       r.setRelatedScalarDouble(Resources.g3dResource.HasZ, aa.z);\r
-       r.setRelatedScalarDouble(Resources.g3dResource.HasAngle, aa.angle);\r
-    }\r
-    \r
-    \r
-    public static void multiplyOrientation(IEntity r, AxisAngle4d rot) {\r
-               AxisAngle4d current = getOrientation(r);\r
-               Quat4d q1 = new Quat4d();\r
-               q1.set(current);\r
-               Quat4d q2 = new Quat4d();\r
-               // q2.set(rot);\r
-               q2.set(rot);\r
-               q2.mul(q1);\r
-               rot.set(q2);\r
-               setOrientation(r, rot);\r
-       }\r
-    \r
-    \r
-    public static AxisAngle4d getWorldFromLocal(IEntity node, AxisAngle4d localRot) {\r
-       return tt.getWorldFromLocal(node, localRot);\r
-    }\r
-    \r
-    public static Point3d getWorldFromLocal(IEntity node, Point3d localRot) {\r
-       return tt.getWorldFromLocal(node, localRot);\r
-    }\r
-    \r
-    public static AxisAngle4d getLocalFromWorld(IEntity node, AxisAngle4d localRot) {\r
-       return tt.getLocalFromWorld(node, localRot);\r
-    }\r
-    \r
-    public static Point3d getLocalFromWorld(IEntity node, Point3d localRot) {\r
-       return tt.getLocalFromWorld(node, localRot);\r
-    }\r
-    \r
-    public static void propagateLocalTransformChange(IEntity node, IEntity child) {\r
-       tt.propagateLocalTransformChange(node, child);\r
-    }\r
-    \r
-    public static void propagateWorldTransformChange(IEntity node, IEntity child) {\r
-       tt.propagateWorldTransformChange(node, child);\r
-    }\r
-    \r
-    public static void transformationUpdate(Graph graph, Resource resource) {\r
-       tt.transformationUpdate(graph, resource);\r
-    }\r
-    \r
-    public static void resetTransformation(IEntity shape) {\r
-               Graph graph = shape.getGraph();\r
-               if (shape.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalPosition) == null) {\r
-\r
-                       // LocalPosition p = LocalPosition.createDefault(graph);\r
-                       Position p = Position.createDefault(graph);\r
-                       shape.addStatement(Resources.g3dResource.HasLocalPosition, p);\r
-                       // WorldPosition p2 = WorldPosition.createDefault(graph);\r
-                       Position p2 = Position.createDefault(graph);\r
-                       shape.addStatement(Resources.g3dResource.HasWorldPosition, p2);\r
-                       p.setX(new double[] { 0.0 });\r
-                       p.setY(new double[] { 0.0 });\r
-                       p.setZ(new double[] { 0.0 });\r
-\r
-                       p2.setX(new double[] { 0.0 });\r
-                       p2.setY(new double[] { 0.0 });\r
-                       p2.setZ(new double[] { 0.0 });\r
-\r
-               } else {\r
-                       G3DTools.setTuple3(shape.getSingleRelatedObject(Resources.g3dResource.HasLocalPosition), 0.0, 0.0, 0.0);\r
-                       G3DTools.setTuple3(shape.getSingleRelatedObject(Resources.g3dResource.HasWorldPosition), 0.0, 0.0, 0.0);\r
-               }\r
-               if (shape.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalOrientation) == null) {\r
-\r
-                       // LocalOrientation r = LocalOrientationFactory.create(graph);\r
-                       Orientation r = Orientation.createDefault(graph);\r
-                       shape.addStatement(Resources.g3dResource.HasLocalOrientation, r);\r
-                       // WorldOrientation r2 = WorldOrientationFactory.create(graph);\r
-                       Orientation r2 = Orientation.createDefault(graph);\r
-                       shape.addStatement(Resources.g3dResource.HasWorldOrientation, r2);\r
-                       r.setAngle(new double[] { 0.0 });\r
-                       r.setX(new double[] { 1.0 });\r
-                       r.setY(new double[] { 0.0 });\r
-                       r.setZ(new double[] { 0.0 });\r
-                       r2.setAngle(new double[] { 0.0 });\r
-                       r2.setX(new double[] { 1.0 });\r
-                       r2.setY(new double[] { 0.0 });\r
-                       r2.setZ(new double[] { 0.0 });\r
-\r
-               } else {\r
-                       G3DTools.setOrientation(shape.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation),\r
-                                       new AxisAngle4d(0.0, 1.0, 0.0, 0.0));\r
-                       G3DTools.setOrientation(shape.getSingleRelatedObject(Resources.g3dResource.HasWorldOrientation),\r
-                                       new AxisAngle4d(0.0, 1.0, 0.0, 0.0));\r
-               }\r
-       }\r
-    \r
-    \r
-    public static G3DNode getModelFromResource(Graph graph,Resource resource) {\r
-       G3DNode node = new G3DNode(graph, resource);\r
-       while (true) {\r
-               G3DNode parent = node.getParent();\r
-               if (parent == null)\r
-                       break;\r
-               node = parent;\r
-       }\r
-        return node;\r
-    }\r
-    \r
-    /**\r
-     * Checks if instance has a certain property instance\r
-     * @param instance\r
-     * @param propertyInstance\r
-     * @return\r
-     */\r
-    public static boolean hasProperty(Graph graph,Resource instance, Resource propertyInstance) {\r
-        Builtins builtins = graph.getBuiltins();\r
-       Stack<IEntity> props = new Stack<IEntity>();\r
-        IEntity IEntity = EntityFactory.create(graph, instance);\r
-        Collection<IEntity> res = IEntity.getRelatedObjects(builtins.HasProperty);\r
-        for (IEntity t : res)\r
-               props.add(t);\r
-        \r
-        while (!props.isEmpty()) {\r
-            IEntity property = props.pop();\r
-            if (property.getResource().equals(propertyInstance)) {\r
-                return true;\r
-            }\r
-            res = property.getRelatedObjects(builtins.HasProperty);\r
-            for (IEntity r : res) {\r
-                props.add(r);\r
-            }\r
-        }\r
-        return false;\r
-    }\r
-    \r
-    /**\r
-     * Checks if one of shapes subshapes has a certain property\r
-     * @param instance shape instance\r
-     * @param propertyInstance instance of a property\r
-     * @return\r
-     * \r
-     */\r
-    public static boolean hasSubProperty(Graph graph,Resource instance, Resource propertyInstance) {\r
-        Builtins builtins = graph.getBuiltins();\r
-        Stack<IEntity> instances = new Stack<IEntity>();\r
-\r
-         //Resource res[] = instance.getRelatedResources(Builtins.HasProperty);\r
-        IEntity entity = EntityFactory.create(graph, instance);\r
-        Collection<IEntity> res;\r
-//         res = entity.getRelatedObjects(Resources.g3dResource.HasChild);\r
-//         for (IEntity t : res) {\r
-//              Collection<IEntity> sub = t.getRelatedObjects(Resources.g3dResource.HasGeometryDefinition);\r
-//              if (sub.size() > 0)\r
-//                     instances.addAll(sub);\r
-//         }\r
-        {\r
-                Collection<IEntity> sub = entity.getRelatedObjects(Resources.g3dResource.HasGeometryDefinition);\r
-                if (sub.size() > 0)\r
-               instances.addAll(sub);\r
-        }\r
-         while (!instances.isEmpty()) {\r
-            IEntity i = instances.pop();\r
-            Stack<IEntity> props = new Stack<IEntity>();\r
-            res = i.getRelatedObjects(builtins.HasProperty);\r
-            for (IEntity r : res) {\r
-                props.add(r);\r
-            }\r
-            while (!props.isEmpty()) {\r
-                IEntity property = props.pop();\r
-                if (property.equals(propertyInstance)) {\r
-                    return true;\r
-                }\r
-                res = property.getRelatedObjects(builtins.HasProperty);\r
-                for (IEntity r : res) {\r
-                    props.add(r);\r
-                }\r
-            }\r
-            res = i.getRelatedObjects(Resources.g3dResource.HasGeometryDefinition);\r
-            for (IEntity r : res) {\r
-               // TODO : unnecessary check\r
-               Collection<IEntity> sub = r.getRelatedObjects(Resources.g3dResource.GeometryDefinitionOf);\r
-                       if (sub.size() > 0)\r
-                       instances.add(r);\r
-            }\r
-            \r
-        }\r
-         return false;\r
-     }\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    /**\r
-     * Loads positions of control point to rule cache\r
-     * \r
-     * @param root resource of the modeled plant\r
-     */\r
-    public static void reloadCache(Graph graph, Resource root) {\r
-//        TraverseHandler handler = new TraverseHandler() {\r
-//            public boolean addToResult(Resource r) {\r
-//                if (r.isInstanceOf(GlobalIdMap.get(ThreeDimensionalModelingOntologyMapping.GRAPHICS_NODE)))\r
-//                    return true;\r
-//                return false;\r
-//            }\r
-//            \r
-//            public TraverseRelation[] traverseFromResource(Resource resource) {\r
-//                return new TraverseRelation[] { new TraverseRelation(\r
-//                        ThreeDimensionalModelingOntologyMapping.HAS_SUBNODES,\r
-//                        TraverseDirection.OUTBOUND)};\r
-//            }\r
-//            \r
-//            \r
-//        };\r
-       \r
-       IEntity IEntity = EntityFactory.create(graph, root);\r
-       State s = new State() {};\r
-       TraversalResult res = TraversalUtils.traverse(new TraversalRule (){\r
-               \r
-               \r
-               @Override\r
-               public boolean areAllStatesRelevant() {\r
-                       return true;\r
-               }\r
-               \r
-               @Override\r
-               public TraversalDecision makeTraversalDecision(State state,\r
-                               Statement statement) {\r
-                       if (statement.getPredicate().isInstanceOf(Resources.g3dResource.HasChild))\r
-                               return TraversalDecision.continueTraversal(state);\r
-                       else\r
-                               return TraversalDecision.stopTraversal;\r
-               }\r
-               \r
-               @Override\r
-               public Collection<State> relevantStates() {\r
-                       return null;\r
-               }\r
-               }, IEntity,s\r
-               );\r
-       \r
-    \r
-       Set<Resource> cps = res.get(s);\r
-        \r
-        //Collection<Resource> cps = TraverseUtils.traverseGraph(root, handler);\r
-        for (Resource r : cps) {\r
-            G3DNode cp = new G3DNode(graph,r);\r
-            if (cp.getLocalPosition() != null)\r
-                tt.storeProperty(cp.getLocalPosition().getResource(),G3DTools.getPoint(cp.getLocalPosition()));\r
-            if (cp.getWorldPosition() != null)\r
-                tt.storeProperty(cp.getWorldPosition().getResource(),G3DTools.getPoint(cp.getWorldPosition()));\r
-            if (cp.getLocalOrientation() != null)\r
-                tt.storeProperty(cp.getLocalOrientation().getResource(),G3DTools.getOrientation(cp.getLocalOrientation()));\r
-            if (cp.getWorldOrientation() != null)\r
-                tt.storeProperty(cp.getWorldOrientation().getResource(),G3DTools.getOrientation(cp.getWorldOrientation()));\r
-            \r
-        }\r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/GeometryProvider.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/GeometryProvider.java
deleted file mode 100644 (file)
index 8ebb506..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import org.simantics.layer0.utils.IEntity;\r
-\r
-\r
-/**\r
- * Interface for geometryProviders\r
- * \r
- * TODO : instead of using Geometry array, create class that is passed through\r
- * TODO : Current animation system links resources; what about code generated meshes ?\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public interface GeometryProvider {\r
-    \r
-       /**\r
-        * Used to check if GeometryProvider can generate mesh\r
-        * @param instance\r
-        * @return\r
-        */\r
-    public boolean canHandle(IEntity instance);\r
-       \r
-    /**\r
-     * Generates mesh\r
-     * @param instance\r
-     * @param transform\r
-     * @return\r
-     */\r
-    public com.jme.scene.Geometry[] getGeometryFromResource(IEntity instance, boolean transform);\r
-    \r
-    /**\r
-     * Updates mesh\r
-     * @param instance\r
-     * @param transform\r
-     * @param geometry\r
-     * @return\r
-     */\r
-    public boolean reconstructGeometry(IEntity instance, boolean transform, com.jme.scene.Geometry[] geometry);\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/GeometryProviderRegistry.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/GeometryProviderRegistry.java
deleted file mode 100644 (file)
index fa92b87..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.utils.ui.plugin.Extension;\r
-import org.simantics.utils.ui.plugin.ExtensionLoader;\r
-\r
-import com.jme.scene.Geometry;\r
-\r
-public class GeometryProviderRegistry {\r
-    private static GeometryProviderRegistry instance;\r
-    public final static String ELEMENT_NAME = "Geometry";\r
-    public final static String NAME_SPACE = "org.simantics.proconf.g3d";\r
-    public final static String EP_NAME = "geometry";\r
-    \r
-    private ExtensionLoader<GeometryProvider> loader;\r
-    private Map<Resource,GeometryProvider> providers;\r
-    \r
-    private GeometryProviderRegistry() {\r
-        loader = new ExtensionLoader<GeometryProvider>(ELEMENT_NAME, NAME_SPACE, EP_NAME);\r
-        providers = new HashMap<Resource,GeometryProvider>();\r
-    }\r
-    \r
-    public static GeometryProviderRegistry getInstance() {\r
-        if (instance==null) instance = new GeometryProviderRegistry();\r
-        return instance;\r
-    }\r
-\r
-    public Extension<GeometryProvider>[] getExtensions() {\r
-        return loader.getExtensions();\r
-    }\r
-    \r
-    private Map<Resource,GeometryProvider> getProviderMap() {\r
-        return providers;\r
-    }\r
-    \r
-    public static Geometry[] getGeometry(IEntity thing, boolean transform) {\r
-        GeometryProvider provider = getGeometryProvider(thing);\r
-        return provider.getGeometryFromResource(thing, transform);\r
-    }\r
-    \r
-    public static GeometryProvider getGeometryProvider(IEntity thing) {\r
-       Collection<IEntity> types = thing.getRelatedObjects(thing.getGraph().getBuiltins().InstanceOf);\r
-        \r
-       //Resource types[] = OntologyUtils.getTypes(resource);\r
-       for (IEntity t : types) {\r
-               GeometryProvider provider = getInstance().getProviderMap().get(t.getResource());\r
-               if (provider == null) {\r
-                for (Extension<GeometryProvider> e : getInstance().getExtensions()) {\r
-                    if (e.getInstance().canHandle(thing)) {\r
-                        getInstance().getProviderMap().put(t.getResource(), e.getInstance());\r
-                        return e.getInstance();\r
-                    }\r
-                }\r
-                \r
-            } else {\r
-               return provider;\r
-            }\r
-       }\r
-       \r
-       throw new UnsupportedOperationException("Cannot handle resource " + thing);\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/JmeRenderingComponent.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/JmeRenderingComponent.java
deleted file mode 100644 (file)
index 4e4905d..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import com.jme.renderer.Camera;\r
-import com.jme.scene.Node;\r
-import com.jme.system.DisplaySystem;\r
-\r
-\r
-\r
-\r
-/**\r
- * Rendering component\r
- * Allows to change underlying rendering so that\r
- * additional information can be presented to the user\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public abstract class JmeRenderingComponent {\r
-    public static final int PARALLEL_PROJECTION = 0;\r
-    public static final int PERSPECTIVE_PROJECTION = 1;\r
-    \r
-    /**\r
-     * Returns root node for nodes that cast and receive shadows.\r
-     * @return\r
-     */\r
-       public abstract Node getShadowRoot();\r
-       \r
-       /**\r
-     * Returns root node for nodes that do not cast shadows.\r
-     * @return\r
-     */\r
-       public abstract Node getNoCastRoot();\r
-       \r
-       /**\r
-        * Returns root node of the scenegraph\r
-        * @return\r
-        */\r
-       public abstract Node getRoot();\r
-       \r
-       /**\r
-        * Returns root node of orthogonal nodes (nodes that always face the camera)\r
-        * @return\r
-        */\r
-       public abstract Node getOrthoNode();\r
-       \r
-       /**\r
-        * Returns root node for nodes that do not cast or receive shadows.\r
-        * @return\r
-        */\r
-       public abstract Node getNoShadowRoot();\r
-       \r
-       public abstract void init(DisplaySystem displaySystem);\r
-       \r
-       /**\r
-        * Sets projection policy.\r
-        * FIXME : this was for Xith compatibility!\r
-        * @param policy\r
-        */\r
-       public abstract void setProjectionPolicy(int policy);\r
-    public abstract int getProjectionPolicy();\r
-    \r
-    public abstract float getScreenScale();\r
-    public abstract void setScreenScale(float screenScale);\r
-    public abstract float getFieldOfView();\r
-    public abstract void dispose();\r
-    \r
-    /**\r
-     * Update flag (Return true if view needs to be rendered)\r
-     * @return\r
-     */\r
-    public boolean update() {return false;}\r
-    public abstract Camera getCamera();\r
-    \r
-    public abstract void render();\r
-    public abstract void resize(int width, int height);\r
-    public abstract DisplaySystem getDisplaySystem();\r
-    \r
-    /**\r
-     * TODO : this is for debugging purposes and will be removed.\r
-     * @param text\r
-     */\r
-    public abstract void setDebugText(String text);\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/MathTools.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/MathTools.java
deleted file mode 100644 (file)
index 2a89a4a..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Matrix3d;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Tuple3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import com.jme.math.Vector2f;\r
-\r
-/**\r
- * Some useful geometry related math functions. Beware, methods may modify their input parameters!\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class MathTools {\r
-    \r
-    static double EPS = 0.001;\r
-    \r
-    public static Vector3d closestPointOnEdge(Vector3d point, Vector3d edgePoint1, Vector3d edgePoint2) {\r
-        point.sub(edgePoint1);\r
-        Vector3d v = new Vector3d(edgePoint2);\r
-        v.sub(edgePoint1);\r
-        double t = v.dot(point);\r
-        t /= v.lengthSquared();\r
-        if (t <= 0.0f)\r
-          return edgePoint1;\r
-        if (t >= 1.0f)\r
-          return edgePoint2;\r
-        v.scale(t);\r
-        v.add(edgePoint1);\r
-        return v;   \r
-    }\r
-    \r
-    public static Vector3d closestPointOnStraight(Point3d point, Point3d straightPoint, Vector3d straightDir) {\r
-        Vector3d v = new Vector3d(point);\r
-        v.sub(straightPoint);\r
-        double t = straightDir.dot(v);\r
-        t /= straightDir.lengthSquared();\r
-        v.set(straightDir);\r
-        v.scale(t);\r
-        v.add(straightPoint);\r
-        return v;   \r
-    }\r
-    \r
-    public static Vector3d closestPointOnStraight(Point3d point, Point3d straightPoint, Vector3d straightDir, double u[]) {\r
-        Vector3d v = new Vector3d(point);\r
-        v.sub(straightPoint);\r
-        u[0] = straightDir.dot(v);\r
-        u[0] /= straightDir.lengthSquared();\r
-        v.set(straightDir);\r
-        v.scale(u[0]);\r
-        v.add(straightPoint);\r
-        return v;   \r
-    }\r
-    \r
-    public static double distanceFromPlane(Vector3d point, Vector3d planeNormal, Tuple3d planePoint) {\r
-        point.sub(planePoint);\r
-        \r
-        return planeNormal.dot(point);\r
-    }\r
-      \r
-    public static double distanceFromPlane(Vector3d point, Vector3d planeNormal, float d) {\r
-        return (planeNormal.dot(point) + d);\r
-    }\r
-    \r
-    public static boolean intersectStraightPlane(Tuple3d linePoint, Vector3d lineDir, Tuple3d planePoint, Vector3d planeNormal, Tuple3d intersectPoint) {\r
-        intersectPoint.set(planePoint);\r
-        intersectPoint.sub(linePoint);\r
-        double u = planeNormal.dot(new Vector3d(intersectPoint));\r
-        double v = planeNormal.dot(lineDir);\r
-        if (Math.abs(v) < EPS)\r
-            return false;\r
-        u /= v;\r
-        intersectPoint.set(lineDir);\r
-        intersectPoint.scale(u);\r
-        intersectPoint.add(linePoint);\r
-        return true;\r
-    }\r
-    \r
-    public static boolean intersectStraightPlane(Tuple3d linePoint, Vector3d lineDir, Tuple3d planePoint, Vector3d planeNormal, Vector3d intersectPoint, double[] u) {\r
-        intersectPoint.set(planePoint);\r
-        intersectPoint.sub(linePoint);\r
-        u[0] = planeNormal.dot(intersectPoint);\r
-        double v = planeNormal.dot(lineDir);\r
-        if (Math.abs(v) < EPS)\r
-            return false;\r
-        u[0] /= v;\r
-        intersectPoint.set(lineDir);\r
-        intersectPoint.scale(u[0]);\r
-        intersectPoint.add(linePoint);\r
-        return true;\r
-    }\r
-    \r
-    public static boolean intersectLineLine(Vector3d p1,Vector3d p2,Vector3d p3,Vector3d p4,Vector3d pa,Vector3d pb) {\r
-            Vector3d p13 = new Vector3d();\r
-            Vector3d p43 = new Vector3d();\r
-            Vector3d p21 = new Vector3d();\r
-            double d1343,d4321,d1321,d4343,d2121;\r
-            double numer,denom;\r
-            p13.sub(p1, p3);\r
-            p43.sub(p4,p3);\r
-            if (Math.abs(p43.x)  < EPS && Math.abs(p43.y)  < EPS && Math.abs(p43.z)  < EPS)\r
-               return false;\r
-            p21.sub(p2,p1);\r
-            if (Math.abs(p21.x)  < EPS && Math.abs(p21.y)  < EPS && Math.abs(p21.z)  < EPS)\r
-               return false;\r
-\r
-            d1343 = p13.dot(p43);\r
-            d4321 = p43.dot(p21);\r
-            d1321 = p13.dot(p21);\r
-            d4343 = p43.lengthSquared();\r
-            d2121 = p21.lengthSquared();\r
-\r
-            denom = d2121 * d4343 - d4321 * d4321;\r
-            if (Math.abs(denom) < EPS)\r
-               return false;\r
-            numer = d1343 * d4321 - d1321 * d4343;\r
-\r
-            double mua = numer / denom;\r
-            double mub = (d1343 + d4321 * mua) / d4343;\r
\r
-            pa.x = p1.x + mua * p21.x;\r
-            pa.y = p1.y + mua * p21.y;\r
-            pa.z = p1.z + mua * p21.z;\r
-            pb.x = p3.x + mub * p43.x;\r
-            pb.y = p3.y + mub * p43.y;\r
-            pb.z = p3.z + mub * p43.z;\r
-\r
-            return true;\r
-    }\r
-    \r
-    public static boolean intersectStraightStraight(Vector3d p1,Vector3d p21,Vector3d p3,Vector3d p43,Tuple3d pa,Tuple3d pb) {\r
-        Vector3d p13 = new Vector3d();\r
-\r
-        double d1343,d4321,d1321,d4343,d2121;\r
-        double numer,denom;\r
-        \r
-        p13.sub(p1, p3);\r
-        if (Math.abs(p43.x)  < EPS && Math.abs(p43.y)  < EPS && Math.abs(p43.z)  < EPS)\r
-           return false;\r
-        if (Math.abs(p21.x)  < EPS && Math.abs(p21.y)  < EPS && Math.abs(p21.z)  < EPS)\r
-           return false;\r
-\r
-        d1343 = p13.dot(p43);\r
-        d4321 = p43.dot(p21);\r
-        d1321 = p13.dot(p21);\r
-        d4343 = p43.lengthSquared();\r
-        d2121 = p21.lengthSquared();\r
-\r
-        denom = d2121 * d4343 - d4321 * d4321;\r
-        if (Math.abs(denom) < EPS)\r
-           return false;\r
-        numer = d1343 * d4321 - d1321 * d4343;\r
-\r
-        double mua = numer / denom;\r
-        double mub = (d1343 + d4321 * mua) / d4343;\r
-\r
-        pa.x = p1.x + mua * p21.x;\r
-        pa.y = p1.y + mua * p21.y;\r
-        pa.z = p1.z + mua * p21.z;\r
-        pb.x = p3.x + mub * p43.x;\r
-        pb.y = p3.y + mub * p43.y;\r
-        pb.z = p3.z + mub * p43.z;\r
-\r
-        return true;\r
-   }\r
-    \r
-    /**\r
-     * Calculate the line segment PaPb that is the shortest route between\r
-     *  two lines P1P2 and P3P4. Calculate also the values of mua and mub where\r
-     *  Pa = P1 + mua (P2 - P1)\r
-     *  Pb = P3 + mub (P4 - P3)\r
-     * @param p1\r
-     * @param p21\r
-     * @param p3\r
-     * @param p43\r
-     * @param pa\r
-     * @param pb\r
-     * @param mu\r
-     * @return\r
-     */\r
-    public static boolean intersectStraightStraight(Tuple3d p1,Vector3d p21,Tuple3d p3,Vector3d p43,Tuple3d pa,Tuple3d pb, double mu[]) {\r
-        Vector3d p13 = new Vector3d();\r
-\r
-        double d1343,d4321,d1321,d4343,d2121;\r
-        double numer,denom;\r
-        double EPS = 0.001;\r
-        p13.sub(p1, p3);\r
-        if (Math.abs(p43.x)  < EPS && Math.abs(p43.y)  < EPS && Math.abs(p43.z)  < EPS)\r
-           return false;\r
-        if (Math.abs(p21.x)  < EPS && Math.abs(p21.y)  < EPS && Math.abs(p21.z)  < EPS)\r
-           return false;\r
-\r
-        d1343 = p13.dot(p43);\r
-        d4321 = p43.dot(p21);\r
-        d1321 = p13.dot(p21);\r
-        d4343 = p43.lengthSquared();\r
-        d2121 = p21.lengthSquared();\r
-\r
-        denom = d2121 * d4343 - d4321 * d4321;\r
-        if (Math.abs(denom) < EPS)\r
-           return false;\r
-        numer = d1343 * d4321 - d1321 * d4343;\r
-\r
-        mu[0] = numer / denom;\r
-        mu[1] = (d1343 + d4321 * mu[0]) / d4343;\r
-\r
-        pa.x = p1.x + mu[0] * p21.x;\r
-        pa.y = p1.y + mu[0] * p21.y;\r
-        pa.z = p1.z + mu[0] * p21.z;\r
-        pb.x = p3.x + mu[1] * p43.x;\r
-        pb.y = p3.y + mu[1] * p43.y;\r
-        pb.z = p3.z + mu[1] * p43.z;\r
-\r
-        return true;\r
-   }\r
-   \r
-   public static AxisAngle4d getFromEuler2(Vector3d euler) {\r
-       AxisAngle4d aa = new AxisAngle4d();\r
-       aa.angle = euler.length();\r
-       Vector3d normal = new Vector3d(euler);\r
-       if (aa.angle > EPS) {\r
-           normal.normalize();\r
-           aa.x = normal.x;\r
-           aa.y = normal.y;\r
-           aa.z = normal.z;\r
-       } else {\r
-           aa.x = 1.0;\r
-           aa.y = 0.0;\r
-           aa.z = 0.0;\r
-       }\r
-       \r
-       return aa;\r
-   }\r
-   \r
-   public static Vector3d getEuler(AxisAngle4d aa) {\r
-       Vector3d euler = new Vector3d(aa.x,aa.y,aa.z);\r
-       euler.scale(aa.angle);\r
-       return euler;\r
-   }\r
-   \r
-   public static void rotate(Quat4d q, Tuple3d in, Tuple3d out) {\r
-       // p' = q * p * q'\r
-       double tw =           - q.x*in.x - q.y*in.y - q.z*in.z;\r
-       double tx =  q.w*in.x            + q.y*in.z - q.z*in.y;\r
-       double ty =  q.w*in.y - q.x*in.z            + q.z*in.x;\r
-       double tz =  q.w*in.z + q.x*in.y - q.y*in.x           ;\r
-       \r
-       //temp * q' -> x = -x, y = -y z = -z\r
-       //out.w = tw*q.w + tx*q.x + ty*q.y + tz*q.z;\r
-       out.x =  -tw*q.x + tx*q.w - ty*q.z + tz*q.y;\r
-       out.y =  -tw*q.y + tx*q.z + ty*q.w - tz*q.x;\r
-       out.z =  -tw*q.z - tx*q.y + ty*q.x + tz*q.w;  \r
-   }\r
-   \r
-   public static void getMatrix(Quat4d quat, Matrix3d m) {\r
-                  m.m00 = 1.0f - 2.0 * (quat.y * quat.y + quat.z * quat.z);\r
-                  m.m01 = 2.0 * (quat.x * quat.y + quat.w * quat.z);\r
-                  m.m02 = 2.0 * (quat.x * quat.z - quat.w * quat.y);\r
-                  m.m10 = 2.0 * (quat.x * quat.y - quat.w * quat.z);\r
-                  m.m11 = 1.0 - 2.0f * (quat.x * quat.x + quat.z * quat.z);\r
-                  m.m12 = 2.0 * (quat.y * quat.z + quat.w * quat.x);\r
-                  m.m20 = 2.0 * (quat.x * quat.z + quat.w * quat.y);\r
-                  m.m21 = 2.0 * (quat.y * quat.z - quat.w * quat.x);\r
-                  m.m22 = 1.0 - 2.0f * (quat.x * quat.x + quat.y * quat.y);\r
-\r
-   }\r
-   \r
-   public static void getQuat(Matrix3d mat, Quat4d quat) {\r
-          double tr = mat.m00 + mat.m11 + mat.m22;\r
-               if (tr > 0.0) {\r
-                       double s = Math.sqrt(tr + 1.0);\r
-                       quat.w = 0.5 * s;\r
-                       s = 0.5 / s;\r
-                       quat.x = (mat.m21 - mat.m12) * s;\r
-                       quat.y = (mat.m02 - mat.m20) * s;\r
-                       quat.z = (mat.m10 - mat.m01) * s;\r
-               } else {\r
-                       int i = 0, j, k;\r
-                       if (mat.m11 > mat.m00)\r
-                               i = 1;\r
-                       if (mat.m22 > mat.getElement(i, i))\r
-                               i = 2;\r
-                       int nxt[] = { 1, 2, 0 };\r
-\r
-                       j = nxt[i];\r
-                       k = nxt[j];\r
-\r
-                       double s = Math\r
-                                       .sqrt((mat.getElement(i, i) - (mat.getElement(j, j) + mat\r
-                                                       .getElement(k, k))) + 1.0);\r
-\r
-                       double q[] = new double[3];\r
-                       q[i] = s * 0.5;\r
-\r
-                       if (Math.abs(s) > 0.001)\r
-                               s = 0.5 / s;\r
-\r
-                       quat.w = (mat.getElement(k, j) - mat.getElement(j, k)) * s;\r
-                       q[j] = (mat.getElement(j, i) + mat.getElement(i, j)) * s;\r
-                       q[k] = (mat.getElement(k, i) + mat.getElement(i, k)) * s;\r
-\r
-                       quat.x = q[0];\r
-                       quat.y = q[1];\r
-                       quat.z = q[2];\r
-               }\r
-       }\r
-   \r
-   \r
-       /*\r
-        * Cohen-Sutherland\r
-        */\r
-       \r
-       private static final int IN = 0;\r
-       private static final int LEFT = 1;\r
-       private static final int RIGHT = 2;\r
-       private static final int BOTTOM = 4;\r
-       private static final int TOP = 8;\r
-       \r
-       \r
-       private static int bitcode(Vector2f p1, Vector2f min, Vector2f max) {\r
-               int code = IN;\r
-               if (p1.x < min.x)\r
-                       code |= LEFT;\r
-               else if (p1.x > max.x)\r
-                       code |= RIGHT;\r
-               if (p1.y < min.y)\r
-                       code |= BOTTOM;\r
-               else if (p1.y > max.y)\r
-                       code |= TOP;\r
-               return code;\r
-       }\r
-       \r
-       public static boolean clipLineRectangle(Vector2f p1,Vector2f p2, Vector2f min, Vector2f max, Vector2f r1, Vector2f r2) {\r
-               while (true) {\r
-                       int o1 = bitcode(p1, min, max);\r
-                       int o2 = bitcode(p2, min, max);\r
-                       int and = o1 & o2;\r
-                       int or = o1 | o2;\r
-                       if (and != IN) {\r
-                               return false;\r
-                       }\r
-                       if (or == IN) {\r
-                               r1.set(p1);\r
-                               r2.set(p2);\r
-                               return true;\r
-                       }\r
-                       if (o1 == IN) {\r
-                               Vector2f t = p1;\r
-                               p1 = p2;\r
-                               p2 = t;\r
-                               int t2 = o1;\r
-                               o1 = o2;\r
-                               o2 = t2;\r
-                       }\r
-                       if ((o1 & TOP) != IN) {\r
-                               float t = (max.y - p1.y) / (p2.y - p1.y);\r
-                               p1.x += t * (p2.x - p1.x);\r
-                               p1.y = max.y;\r
-                       } else if ((o1 & BOTTOM) != IN) {\r
-                               float t = (min.y - p1.y) / (p2.y - p1.y);\r
-                               p1.x += t * (p2.x - p1.x);\r
-                               p1.y = min.y;\r
-                       } else if ((o1 & LEFT) != IN) {\r
-                               float t = (min.x - p1.x) / (p2.x - p1.x);\r
-                               p1.y += t * (p2.y - p1.y);\r
-                               p1.x = min.x;\r
-                       } else if ((o1 & RIGHT) != IN) {\r
-                               float t = (max.x - p1.x) / (p2.x - p1.x);\r
-                               p1.y += t * (p2.y - p1.y);\r
-                               p1.x = max.x;\r
-                       } else {\r
-                               throw new RuntimeException("Error in clipping code");\r
-                       }\r
-               }\r
-               \r
-       }\r
-       \r
-       public static double square(double d) {\r
-               return d * d;\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ResourceTextureCache.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ResourceTextureCache.java
deleted file mode 100644 (file)
index bbba901..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.nio.ByteBuffer;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.eclipse.swt.graphics.ImageData;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.stubs.ImageTexture;\r
-import org.simantics.proconf.g3d.stubs.TextureCoordinateGenerator;\r
-import org.simantics.proconf.image.interfaces.IImage;\r
-import org.simantics.proconf.image.interfaces.IImageFactory;\r
-import org.simantics.utils.ErrorLogger;\r
-import org.simantics.utils.ui.gfx.ImageUtils;\r
-import org.simantics.utils.ui.gfx.PixelDimension;\r
-\r
-import com.jme.image.Image;\r
-import com.jme.image.Texture;\r
-import com.jme.util.TextureManager;\r
-\r
-/**\r
- * Caches resource based textures.\r
- * TODO : use queries to update textures, now textures are read once and cannot be updated\r
- * TODO : either use shared context or use separate cache for each editor\r
- * TODO : ShapeNode implementation won't use release texture yet\r
- * TODO : Texture is released when reference count goes to zero; we probably want to wait for a while before texture is released because it might be used again.\r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class ResourceTextureCache {\r
-       \r
-       public static PixelDimension DEFAULT_SIZE = new PixelDimension(128,128);\r
-       \r
-       private static ResourceTextureCache instance = new ResourceTextureCache();\r
-       \r
-       private Map<Resource,Image> images = new HashMap<Resource, Image>();\r
-       private Map<Resource,Integer> imageReferences = new HashMap<Resource, Integer>();\r
-       \r
-       private Map<Resource,Texture> textures = new HashMap<Resource, Texture>();\r
-       private Map<Resource,Integer> textureReferences = new HashMap<Resource, Integer>();\r
-       \r
-       \r
-       private ResourceTextureCache() {\r
-               \r
-       }\r
-       \r
-       public Texture loadTexture(Graph g, Resource res) {\r
-               Texture t = textures.get(res);\r
-               if (t == null) {\r
-                       ImageTexture it = new ImageTexture(g,res);\r
-                       org.simantics.image.stubs.Image pattern = it.getImage();\r
-                       Image image = loadImage(g, pattern.getResource());\r
-//                     image.getData().rewind();\r
-//                     while (image.getData().hasRemaining())\r
-//                             image.getData().put((byte)(Math.random()*256.0 - 127.0));\r
-                       if (image == null) {\r
-                               return null;\r
-                       }\r
-                       t = new Texture();\r
-                       t.setImage(image);\r
-                       \r
-                       //t = TextureManager.loadTexture(image, Texture.MM_LINEAR, Texture.FM_LINEAR);\r
-//                     t.setImageLocation(res.toString());\r
-//                     URL url = FileLocator.find(com.jme.eclipse.Activator.getDefault().getBundle(),new Path("data/texture/clouds.png"),null);\r
-//             t = TextureManager.loadTexture(url, Texture.MM_LINEAR, Texture.FM_LINEAR);\r
-               \r
-                       t.setFilter(com.jme.image.Texture.FM_LINEAR);\r
-               t.setMipmapState(com.jme.image.Texture.MM_LINEAR);\r
-               t.setApply(Texture.AM_COMBINE);\r
-               t.setCombineFuncRGB(Texture.ACF_MODULATE);\r
-               t.setCombineScaleRGB(2.f);\r
-\r
-               //t.setWrap(com.jme.image.Texture.WM_WRAP_S_WRAP_T);\r
-                       \r
-                       TextureCoordinateGenerator gen = it.getTextureCoordinateGenerator();\r
-                       setTextureCoordGenerator(gen, t);\r
-                       textures.put(res, t);\r
-               }\r
-               addTextureReference(res);\r
-               return t;\r
-       }\r
-       \r
-       public void releaseTexture(Graph g, Resource res) {\r
-               Integer i = textureReferences.get(res);\r
-               if (i != null) {\r
-                       i = i - 1;\r
-                       if (i == 0) {\r
-                               Texture t = textures.get(res);\r
-                               ImageTexture it = new ImageTexture(g,res);\r
-                               org.simantics.image.stubs.Image pattern = it.getImage();\r
-                               releaseImage(pattern.getResource());\r
-                               t.setImage(null);\r
-                               textureReferences.remove(res);\r
-                               //FIXME : release the texture\r
-                       } else {\r
-                               textureReferences.put(res, i);\r
-                       }\r
-                       \r
-               } else {\r
-                       throw new RuntimeException("Cannot released texture that does not exist " + res);\r
-               }\r
-       }\r
-       \r
-       public Image loadImage(Graph g, Resource res) {\r
-               Image image = images.get(res);\r
-               if (image == null) {\r
-                       org.simantics.image.stubs.Image pattern = new org.simantics.image.stubs.Image(g,res);\r
-                       IImageFactory f = org.simantics.proconf.image.ImageUtils.getImageFactoryForResource(g,pattern.getResource());\r
-               try {\r
-                       IImage p = f.createImageForResource(g,pattern.getResource());\r
-               PixelDimension pd = p.getDimensions().getPixelDimension();\r
-               if (pd==null) pd = DEFAULT_SIZE;\r
-                       ImageData data = p.rasterize(pd.getWidth(), pd.getHeight());\r
-                       image = getImage(data);\r
-                       images.put(res, image);\r
-                       \r
-               } catch (Exception e) {\r
-                       ErrorLogger.defaultLogError("Cannor create pattern texture for resource " + pattern, e);\r
-                       return null;\r
-               }\r
-               }\r
-               addImageReference(res);\r
-               return image;\r
-               \r
-       }\r
-       \r
-       private void addTextureReference(Resource res) {\r
-               Integer i = textureReferences.get(res);\r
-               if (i != null) {\r
-                       imageReferences.put(res, i + 1);\r
-               } else {\r
-                       imageReferences.put(res, 1);\r
-               }\r
-       }\r
-       \r
-       private void addImageReference(Resource res) {\r
-               Integer i = imageReferences.get(res);\r
-               if (i != null) {\r
-                       imageReferences.put(res, i + 1);\r
-               } else {\r
-                       imageReferences.put(res, 1);\r
-               }\r
-       }\r
-       \r
-       public void releaseImage(Resource res) {\r
-               Integer i = imageReferences.get(res);\r
-               if (i != null) {\r
-                       i = i - 1;\r
-                       if (i == 0) {\r
-                               Image image = images.get(res);\r
-                               image.getData().clear();\r
-                               image.setData(null);\r
-                               images.remove(res);\r
-                               imageReferences.remove(res);\r
-                       } else {\r
-                               imageReferences.put(res, i);\r
-                       }\r
-               } else {\r
-                       throw new RuntimeException("Cannot release image that does not exist.");\r
-               }\r
-       }\r
-       \r
-       public static ResourceTextureCache getInstance() {\r
-               return instance;\r
-       }\r
-       \r
-       private static Image getImage(ImageData imageData) {\r
-       int width = imageData.width;\r
-       int height = imageData.height;\r
-       int type = 0;\r
-       \r
-       int components = 3;\r
-       \r
-       type = Image.RGB888;\r
-       if (imageData.alphaData != null) {\r
-               type = Image.RGBA8888;\r
-               components = 4;\r
-       }\r
-       \r
-       ByteBuffer buf = ByteBuffer.allocateDirect(components * width * height);\r
-       ImageUtils.convertToRGBA(imageData, buf);       \r
-       return new Image(type,width,height,buf);\r
-    }\r
-       \r
-       \r
-       public static void setTextureCoordGenerator(TextureCoordinateGenerator gen, com.jme.image.Texture texture) {\r
-        if (gen == null)\r
-            return ;\r
-\r
-        //g3dResource.\r
-        if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_sphere))\r
-               texture.setEnvironmentalMapMode(com.jme.image.Texture.EM_SPHERE);\r
-        else if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_eyelinear))\r
-               texture.setEnvironmentalMapMode(com.jme.image.Texture.EM_EYE_LINEAR);\r
-        else if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_objectlinear))\r
-               texture.setEnvironmentalMapMode(com.jme.image.Texture.EM_OBJECT_LINEAR);\r
-        else if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_normal))\r
-               ErrorLogger.getDefault().logWarning("JME doesn't support normal texture coordinate generation", null);\r
-        else if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_reflection))\r
-               ErrorLogger.getDefault().logWarning("JME doesn't support reflection texture coordinate generation", null);\r
-        else\r
-               ErrorLogger.getDefault().logWarning("Unsupported TexGen type " + gen.getName(), null);\r
-    }\r
-       \r
-       public void clear() {\r
-               for (Image i : images.values())\r
-                       i.setData(null);\r
-               for (Texture t : textures.values())\r
-                       t.setImage(null);\r
-               imageReferences.clear();\r
-               textureReferences.clear();\r
-               images.clear();\r
-               textures.clear();\r
-       \r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ScenegraphAdapter.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ScenegraphAdapter.java
deleted file mode 100644 (file)
index e2d0287..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.scenegraph.IGeometryNode;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import com.jme.scene.Node;\r
-\r
-public interface ScenegraphAdapter {\r
-\r
-       /**\r
-        * Disposes the adapter\r
-        */\r
-       public void dispose();\r
-\r
-       /**\r
-        * Returns scene-graph node of the resource\r
-        * @param resource\r
-        * @return\r
-        */\r
-       public IGraphicsNode getNode(Resource resource);\r
-\r
-       /**\r
-        * Returns scene-graph node of the resource\r
-        * @param thing\r
-        * @return\r
-        */\r
-       public IGraphicsNode getNode(IEntity thing);\r
-\r
-       /**\r
-        * Returns node (resource) for the uid.\r
-        * @param uid\r
-        * @return the node (resource)\r
-        */\r
-       public Resource getNodeResource(String uid);\r
-\r
-       /**\r
-        * @return all nodes in the scene-graph\r
-        */\r
-       public Collection<IGraphicsNode> getNodes();\r
-\r
-       /**\r
-        * Returns uid of the node.\r
-        * @param nodeResource\r
-        * @return\r
-        */\r
-       public String getNodeUID(Resource nodeResource);\r
-\r
-       public JmeRenderingComponent getRenderingComponent();\r
-\r
-       public Node getRoot();\r
-\r
-       public IGraphicsNode getRootNode();\r
-\r
-       public Resource getRootResource();\r
-\r
-       /**\r
-        * Returns true if the scene-graph contains the node\r
-        * @param resource\r
-        * @return\r
-        */\r
-       public boolean hasNode(Resource resource);\r
-\r
-       /**\r
-        * Checks if the view has been changed (and needs redrawing).\r
-        * @return\r
-        */\r
-       public boolean isChanged();\r
-\r
-       /**\r
-        * Checks if any geometries needs updating\r
-        * @return \r
-        */\r
-       public boolean needsUpdateGeometry();\r
-\r
-       /**\r
-        * \r
-        * @param changed\r
-        */\r
-       public void setChanged(boolean changed);\r
-\r
-       /**\r
-        * Sets the root node of the scene-graph\r
-        * @param rootNode\r
-        */\r
-       public void setRootNode(G3DNode rootNode);\r
-\r
-       /**\r
-        * Updates requested geometries.\r
-        * \r
-        * @param graph\r
-        */\r
-       public void updateGeometry(Graph graph);\r
-\r
-       /**\r
-        * Updates node's geometry\r
-        * @param node\r
-        */\r
-       public void updateGeometry(IGeometryNode node);\r
-       \r
-       /**\r
-        * Updates node's geometry\r
-        * @param nodeResource\r
-        */\r
-       public void updateGeometry(Resource nodeResource);\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ScenegraphAdapterImpl.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ScenegraphAdapterImpl.java
deleted file mode 100644 (file)
index 43a53a2..0000000
+++ /dev/null
@@ -1,828 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
-import java.util.List;\r
-import java.util.Queue;\r
-import java.util.Set;\r
-import java.util.Stack;\r
-import java.util.concurrent.ConcurrentLinkedQueue;\r
-\r
-import org.simantics.db.AbstractQuery;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.queries.IGraphQuery;\r
-import org.simantics.db.queries.IQuery;\r
-import org.simantics.db.queries.IQueryListener;\r
-import org.simantics.db.utils.transaction.MergingTransactionRunner;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.Property;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.scenegraph.IGeometryNode;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.RootGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.utils.ErrorLogger;\r
-import org.simantics.utils.datastructures.BijectionMap;\r
-\r
-import com.jme.scene.Node;\r
-\r
-\r
-/**\r
- * Scene-graph adapter :\r
- * 1. Adapts graph change events into changes in actual scene-graph nodes.\r
- * 2. Handles instantiating and disposing of Scene-graph nodes.\r
- * 3.  \r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public abstract class ScenegraphAdapterImpl implements ScenegraphAdapter {\r
-       \r
-       protected static boolean DEBUG = false;\r
-       \r
-       private RootGraphicsNode root;\r
-       private HashMap<Resource,ScenegraphQuery> scenegraphQueries = new HashMap<Resource, ScenegraphQuery>();\r
-    private HashMap<Resource,NodePropertyQuery> propertyQueries = new HashMap<Resource, NodePropertyQuery>();\r
-    private HashMap<Resource,NodeTransformationQuery> transformationQueries = new HashMap<Resource, NodeTransformationQuery>();\r
-       private HashMap<Resource, IGraphicsNode> abstractGraphicsNodes = new HashMap<Resource, IGraphicsNode>();\r
-    protected Queue<IGeometryNode> geometryUpdates = new ConcurrentLinkedQueue<IGeometryNode>();\r
-       \r
-    private BijectionMap<Resource, String> nameMap = new BijectionMap<Resource, String>();\r
-    \r
-    protected JmeRenderingComponent component;\r
-    \r
-    protected boolean viewChanged = false;\r
-    \r
-    protected Session session;\r
-    \r
-    private MergingTransactionRunner transactionRunner;\r
-    \r
-    public ScenegraphAdapterImpl(Session session, JmeRenderingComponent component) {\r
-       this.component = component;\r
-       this.session = session;\r
-       transactionRunner = new MergingTransactionRunner(session,true);\r
-    }\r
-    \r
-    \r
-    @Override\r
-    public JmeRenderingComponent getRenderingComponent() {\r
-       return component;\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#setRootNode(fi.vtt.simantics.g3d.stubs.G3DNode)\r
-        */\r
-    public void setRootNode(G3DNode rootNode) {\r
-       addSubnodeListener(rootNode);\r
-        root = new RootGraphicsNode(component,rootNode.getResource());\r
-        abstractGraphicsNodes.put(rootNode.getResource(),root);\r
-        G3DTools.reloadCache(rootNode.getGraph(),root.getResource());\r
-        addRootPropertyListener(rootNode.getGraph());\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#needsUpdateGeometry()\r
-        */\r
-    public boolean needsUpdateGeometry() {\r
-       return geometryUpdates.size() > 0;\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#updateGeometry(fi.vtt.simantics.g3d.scenegraph.IGeometryNode)\r
-        */\r
-    public void updateGeometry(IGeometryNode node) {\r
-       geometryUpdates.add(node);\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#updateGeometry(fi.vtt.simantics.db.connection.Resource)\r
-        */\r
-    public void updateGeometry(Resource nodeResource) {\r
-       geometryUpdates.add((IGeometryNode)abstractGraphicsNodes.get(nodeResource));\r
-    }\r
-    \r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#updateGeometry(fi.vtt.simantics.db.connection.Graph)\r
-        */\r
-    public synchronized void updateGeometry(Graph graph) {\r
-       if (geometryUpdates.size() > 0) {\r
-                       for (IGeometryNode n : geometryUpdates) {\r
-                               try {\r
-                                       n.updateGeometry(graph);\r
-                                       if (DEBUG) System.out.println("ScenegraphAdapterImpl: geometryUpdated " + n.getResource());\r
-                               } catch (Exception e) {\r
-                                       ErrorLogger.defaultLogError("Failed to update geometry of node" + n.getResource(), e);\r
-                               }\r
-                       }\r
-                       geometryUpdates.clear();\r
-                       viewChanged = true;\r
-                       //if (DEBUG) System.out.println("ScenegraphAdapterImpl: geometryUpdated");\r
-               }\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#getNodes()\r
-        */\r
-    public Collection<IGraphicsNode> getNodes() {\r
-        return abstractGraphicsNodes.values();\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#getNode(fi.vtt.simantics.db.connection.Resource)\r
-        */\r
-    public IGraphicsNode getNode(Resource resource) {\r
-        return abstractGraphicsNodes.get(resource);\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#getRootNode()\r
-        */\r
-    public IGraphicsNode getRootNode() {\r
-       return getNode(getRootResource());\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#getNode(fi.vtt.simantics.layer0.utils.IEntity)\r
-        */\r
-    public IGraphicsNode getNode(IEntity IEntity) {\r
-       return abstractGraphicsNodes.get(IEntity.getResource());\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#getNodeResource(java.lang.String)\r
-        */\r
-    public Resource getNodeResource(String uid) {\r
-       return nameMap.getLeft(uid);\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#getNodeUID(fi.vtt.simantics.db.connection.Resource)\r
-        */\r
-    public String getNodeUID(Resource nodeResource) {\r
-       String name = nameMap.getRight(nodeResource);\r
-       if (name == null) {\r
-               //name = UUID.randomUUID().toString();\r
-               name = Long.toString(nodeResource.getResourceId());\r
-               nameMap.map(nodeResource, name);\r
-       }\r
-       return name;\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#hasNode(fi.vtt.simantics.db.connection.Resource)\r
-        */\r
-    public boolean hasNode(Resource resource) {\r
-        return abstractGraphicsNodes.containsKey(resource);\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#getRootResource()\r
-        */\r
-    public Resource getRootResource() {\r
-       if (root == null)\r
-               return null;\r
-        return root.getResource();\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#getRoot()\r
-        */\r
-    public Node getRoot() {\r
-       return root.getGroup();\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#dispose()\r
-        */\r
-    public void dispose() {\r
-       Set<Resource> shapes = new HashSet<Resource>(abstractGraphicsNodes.keySet());\r
-        for (Resource r : shapes) {\r
-            removeNode(r);\r
-        }\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#isChanged()\r
-        */\r
-    public boolean isChanged() {\r
-       return viewChanged;\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-        * @see fi.vtt.simantics.g3d.scenegraph.IScenegraphAdapter#setChanged(boolean)\r
-        */\r
-    public void setChanged(boolean changed) {\r
-       viewChanged = changed;\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Instantiates Listener that listens hierarchy changes in the node (subnode\r
-     * added and/or removed)\r
-     * \r
-     * @param node\r
-     * @return\r
-     */\r
-    protected abstract ScenegraphQuery newSubnodeListener(G3DNode node);\r
-    \r
-    protected void addSubnodeListener(G3DNode node) {\r
-       if (DEBUG) System.out.println("ScenegraphAdapter.addSubnodeListener( " + node.getResource() + " )");\r
-       ScenegraphQuery q = newSubnodeListener(node);\r
-       node.getGraph().performQuery(q);\r
-        scenegraphQueries.put(node.getResource(), q);\r
-    }\r
-    \r
-    /**\r
-     * Returns propertyQuery for a single scene-graph node.\r
-     * @param node\r
-     * @return\r
-     */\r
-    protected abstract NodePropertyQuery newPropertyListener(G3DNode node);\r
-    \r
-    /**\r
-     * Returns transformationQuery for a single scene-graph node\r
-     * @param root\r
-     * @return\r
-     */\r
-    protected abstract NodeTransformationQuery newTransformationListener(G3DNode root);\r
-    \r
-    /**\r
-     * Returns propertyQuery for the root node.\r
-     * May return null if root node has no interesting properties.\r
-     * \r
-     * Potentially root node could contain lighting settings, and so on...\r
-     * \r
-     * @param root\r
-     * @return\r
-     */\r
-    protected abstract NodePropertyQuery newRootPropertyListener(G3DNode root);\r
-    \r
-    protected void addPropertyListener(G3DNode node) {\r
-       if (DEBUG) System.out.println("ScenegraphAdapter.addPropertyListener( " + node.getResource() + " )");\r
-       NodePropertyQuery q = newPropertyListener(node);\r
-       node.getGraph().performQuery(q);\r
-       propertyQueries.put(node.getResource(),q);\r
-    }\r
-    \r
-    \r
-    protected void addTransformationListener(G3DNode node) {\r
-       if (DEBUG) System.out.println("ScenegraphAdapter.addPropertyListener( " + node.getResource() + " )");\r
-       NodeTransformationQuery q = newTransformationListener(node);\r
-       node.getGraph().performQuery(q);\r
-       transformationQueries.put(node.getResource(),q);\r
-    }\r
-    \r
-    protected void addRootPropertyListener(Graph g) {\r
-       G3DNode node = root.getG3DNode(g);\r
-       if (DEBUG) System.out.println("ScenegraphAdapter.addRootPropertyListener( " + node.getResource() + " )");       \r
-       NodePropertyQuery q = newRootPropertyListener(node);\r
-       if (q == null)\r
-               return;\r
-       node.getGraph().performQuery(q);\r
-       propertyQueries.put(node.getResource(),q);\r
-    }\r
-    \r
-    /**\r
-     * Instantiates a new scene-graph node\r
-     * \r
-     * @param parent the parent of the new node.\r
-     * @param node the new node.\r
-     * @return\r
-     */\r
-    protected abstract IGraphicsNode instantiateNode(IGraphicsNode parent, G3DNode node);\r
-    \r
-\r
-    /**\r
-     * Adds node into scene-graph\r
-     * @param parent the parent of the node\r
-     * @param r resource of the node\r
-     * @return created scene-graph node\r
-     */\r
-    protected IGraphicsNode addNode(IEntity parent, IEntity r) {\r
-        if (!r.isInstanceOf(Resources.g3dResource.G3DNode)) {\r
-            ErrorLogger.defaultLogError("Trying to add node into scenegraph that is not instance of graphicsnode " + r,new Exception("ASSERT!"));\r
-            return null;\r
-        }\r
-        if (parent.equals(r)) {\r
-               if (DEBUG) System.out.println("ThreeDimensionalEditorBase.addNodeP(" + r.getResource().getResourceId() + ") adding node to itself?!");\r
-            ErrorLogger.defaultLogError("Adding scnegraphnode " + r.getResource().getResourceId() + " to itself!", new Exception("ASSERT!"));\r
-            return abstractGraphicsNodes.get(r);\r
-        }\r
-        \r
-        if (abstractGraphicsNodes.containsKey(r)) {\r
-               \r
-            IGraphicsNode inView = abstractGraphicsNodes.get(r);\r
-            if (inView.getParent() == null) {\r
-                //if graphicsNode has no parent it must be the root node\r
-                ErrorLogger.defaultLogError("Trying to add rootnode into scenegraph " + r, null);\r
-                return null;\r
-            }\r
-            if (parent.equals(inView.getParent().getResource())) {\r
-               if (DEBUG) System.out.println("ThreeDimensionalEditorBase.addNodeP(" + r.getResource().getResourceId() + ") already in view");\r
-                return inView;\r
-            } else {\r
-               if (DEBUG) System.out.println("ThreeDimensionalEditorBase.addNodeP(" + r.getResource().getResourceId() + ") already in view, but has different parent, current parent is ("+inView.getParent().getResource()+") and node is added to  ("+parent+") -> removing from old parent and inserting to new");\r
-                removeNode(inView.getParent().getResource(),r.getResource());\r
-            }\r
-        }\r
-        \r
-        G3DNode node = new G3DNode(r);\r
-\r
-        IGraphicsNode mo;\r
-        IGraphicsNode parentNode = abstractGraphicsNodes.get(parent);\r
-        if (parentNode == null) {\r
-               if (DEBUG) System.out.println("No graphicsnode for (" + parent.getResource().getResourceId() + ")");\r
-            return null;\r
-        } else {\r
-            mo = instantiateNode(parentNode, node);\r
-            if (mo == null) {\r
-                ErrorLogger.defaultLogError("Could not instantiate scenegraph node for " + r.getResource().getResourceId(), null);\r
-                return null;\r
-            }\r
-            if (DEBUG) System.out.println("ThreeDimensionalEditorBase.addNodeP(" + r.getResource().getResourceId() + ") added to parent (" + parent.getResource().getResourceId() + ") " + mo.getClass());\r
-        }\r
-        addSubnodeListener(node);\r
-        addPropertyListener(node);\r
-        addTransformationListener(node);\r
-\r
-        abstractGraphicsNodes.put(r.getResource(), mo);\r
-\r
-        \r
-        \r
-        // FIXME : this is a hack to fix transformations of instantiated nodes\r
-//             if (graph.getCurrentTransaction() != null) {\r
-//                     try {\r
-//                             G3DTools.propagateWorldTransformChange(parentNode\r
-//                                             .getG3DNode());\r
-//                             graph.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-//                             // G3DNodeTools.transformationUpdate(graph, r.getId());\r
-//                     } catch (Exception e) {\r
-//                             ErrorLogger.defaultLogError(e);\r
-//                     }\r
-//             }\r
-\r
-        \r
-        return mo;\r
-    }\r
-\r
-    /**\r
-        * This is used only when view is disposed!\r
-        * \r
-        * @param r\r
-        */\r
-    private void removeNode(Resource r) {\r
-       NodeTransformationQuery tq = transformationQueries.get(r);\r
-        //StructuralChangeMonitor monitor = monitors.getLeft(r);\r
-        if (tq == null) {\r
-               if (abstractGraphicsNodes.containsKey(r)) {\r
-                // root node has no monitor (no transformation to monitor)\r
-                //System.out.println("ThreeDimensionalEditorBase.removeNode(" + r + ") node has no monitor, but has node in scenegraph");  \r
-                abstractGraphicsNodes.remove(r);\r
-                if(scenegraphQueries.get(r) != null) {\r
-                       scenegraphQueries.get(r).dispose();\r
-                       scenegraphQueries.remove(r);\r
-                }\r
-            } else {\r
-                //System.out.println("ThreeDimensionalEditorBase.removeNode(" + r + ") not in view");\r
-            }\r
-               return;\r
-        }\r
-        // remove listeners\r
-        propertyQueries.remove(r).dispose();     \r
-        transformationQueries.remove(r).dispose();\r
-        scenegraphQueries.get(r);\r
-        scenegraphQueries.remove(r).dispose();\r
-        // remove children\r
-        IGraphicsNode node = abstractGraphicsNodes.get(r);\r
-        ArrayList<IGraphicsNode> children = new ArrayList<IGraphicsNode>(node.getChildren());\r
-        for (IGraphicsNode n : children) {\r
-            removeNode(n.getResource());\r
-        }\r
-        // remove the node\r
-        if (DEBUG) System.out.println("ThreeDimensionalEditorBase.removeNode(" + r + ") removed");\r
-        \r
-        node.dispose();\r
-        abstractGraphicsNodes.remove(r);\r
-\r
-    }\r
-    \r
-    /**\r
-     * Removes a scene-graph node.\r
-     * @param parent the parent of the node\r
-     * @param r the node.\r
-     */\r
-    protected void removeNode(Resource parent,Resource r) {\r
-       NodePropertyQuery q = propertyQueries.get(r);\r
-        if (q == null) {\r
-            assert(!abstractGraphicsNodes.containsKey(r));\r
-            if (DEBUG) System.out.println("ThreeDimensionalEditorBase.removeNodeP(" + r + ") not in view");\r
-            return;\r
-        }\r
-        \r
-        IGraphicsNode node = abstractGraphicsNodes.get(r);\r
-        Resource rParent = node.getParent().getResource();\r
-        if (!rParent.equals(parent)) {\r
-            // this event may happen, depending of the order of events in transaction\r
-               if (DEBUG) System.out.println("ThreeDimensionalEditorBase.removeNodeP(" + r + ") trying to remove from wrong parent current ("+rParent+") remove parentnode null("+parent+")");    \r
-            return;\r
-        }\r
-        // removing listeners\r
-        propertyQueries.remove(r).dispose();\r
-        transformationQueries.remove(r).dispose();\r
-        scenegraphQueries.remove(r).dispose();\r
-        // remove node's children\r
-        ArrayList<IGraphicsNode> children = new ArrayList<IGraphicsNode>(node.getChildren());\r
-        for (IGraphicsNode n : children) {\r
-            removeNode(r,n.getResource());\r
-        }       \r
-        if (DEBUG) System.out.println("ThreeDimensionalEditorBase.removeNodeP(" + r + ") from ("+parent+")");    \r
-        // remove the node\r
-        \r
-        abstractGraphicsNodes.remove(r);\r
-        if (geometryUpdates.contains(node)) {\r
-               geometryUpdates.remove(node);\r
-        }\r
-        node.dispose();\r
-    }\r
-\r
-    \r
-    /**\r
-     * Query that tracks changes in resources.\r
-     * \r
-     * @author Marko Luukkainen\r
-     *\r
-     */\r
-    public abstract class NodeQuery extends AbstractQuery<Object>{\r
-        protected Resource nodeResource;\r
-        private boolean disposed = false;\r
-        private IQueryListener listener;\r
-        //private OverridingTransactionRunner runner;\r
-        \r
-       \r
-       public NodeQuery(Resource r) {\r
-               this.nodeResource = r;\r
-               //runner = new OverridingTransactionRunner(session,true);\r
-               \r
-       }\r
-       \r
-       protected abstract Object compute2(Graph graph);\r
-       \r
-       @Override\r
-        public Object performQuery(Graph graph) {\r
-               if (disposed) return null;\r
-               return compute2(graph);\r
-        }\r
-       \r
-       /**\r
-        *  \r
-        * @param oldResult result of the query before the change.\r
-        * @param newResult result of the query after the change.\r
-        */\r
-       public abstract boolean updated(Graph graph, Object oldResult, Object newResult);\r
-       \r
-       @Override\r
-       public int getType() {\r
-               return IQuery.SCHEDULED_UPDATE;\r
-       }\r
-       \r
-       @Override\r
-       public void resultChangedRaw(final Object oldResult, final Object newResult) {\r
-               if (disposed)\r
-                       throw new RuntimeException("Updating disposed query"); //return;\r
-               transactionRunner.run(new GraphRequestAdapter() {\r
-               //session.asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               if (!disposed) {\r
-                                       if (oldResult == IQueryListener.NO_VALUE)\r
-                                               updated(g, null, newResult);\r
-                                       else\r
-                                               updated(g, oldResult, newResult);\r
-                               } \r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-\r
-       }\r
-       \r
-       \r
-       @Override\r
-       public boolean equalsQuery(IGraphQuery<Object> other) {\r
-               return nodeResource.equals(((NodeQuery)other).nodeResource);\r
-       }\r
-       \r
-        @Override\r
-        final public int hash() {\r
-            return nodeResource.hashCode();\r
-        }\r
-       \r
-       \r
-       /**\r
-        * Disposes the query\r
-        */\r
-       public void dispose() {\r
-               disposed = true;\r
-               if (DEBUG) System.out.println("NodeQuery " +  nodeResource +  " disposed()" + " " + this.getClass());\r
-       }\r
-       \r
-       //public abstract NodeQuery instantiateQuery(Resource node);\r
-       //public abstract void attach();\r
-       \r
-        @Override\r
-        public boolean isDisposed() {\r
-            return disposed;\r
-        }\r
-        \r
-        @Override\r
-        public IQueryListener getListener() {\r
-               if (listener == null) {\r
-                       listener = new IQueryListener() {\r
-                               @Override\r
-                               public boolean isDisposed() {\r
-                                       return NodeQuery.this.disposed;\r
-                               }\r
-                               \r
-                               @Override\r
-                               public void resultChangedRaw(Object oldResult, Object newResult) {\r
-                                       NodeQuery.this.resultChangedRaw(oldResult, newResult);\r
-                               }\r
-                       };\r
-               }\r
-               return listener;\r
-        }\r
-       \r
-    }\r
-    \r
-    /**\r
-     * \r
-     * Query that tracks changes in scene-graph structure (parent/child relationships).\r
-     * \r
-     * @author Marko Luukkainen\r
-     *\r
-     */\r
-    public abstract class ScenegraphQuery extends NodeQuery {\r
-       \r
-       List<Resource> added = new ArrayList<Resource>();\r
-       List<Resource> removed = new ArrayList<Resource>();\r
-       \r
-       private boolean initialized;\r
-       \r
-       public ScenegraphQuery(Resource nodeResource) {\r
-                       super(nodeResource);\r
-                       initialized = false;\r
-                       if(DEBUG)System.out.println("ScenegraphQuery created for " + nodeResource);\r
-               }\r
-       \r
-       @Override\r
-       public List<Resource> compute2(Graph g) {\r
-               IEntity node = EntityFactory.create(g,nodeResource);\r
-               Collection<IEntity> children = node.getRelatedObjects(Resources.g3dResource.HasChild);\r
-               List<Resource> list = new ArrayList<Resource>();\r
-               for (IEntity n: children)\r
-                       list.add(n.getResource());\r
-               if (DEBUG) System.out.println("ScenegraphQuery " + nodeResource +   " has " + list.size() + " children");\r
-               return list;\r
-       }\r
-       \r
-       @SuppressWarnings("unchecked")\r
-               @Override\r
-       public boolean updated(Graph graph, Object oldResult, Object newResult) {\r
-               List<Resource> oldChildren;\r
-               if (oldResult != null)\r
-                       oldChildren = (List<Resource>)oldResult;\r
-               else\r
-                       oldChildren = new ArrayList<Resource>();\r
-               List<Resource> newChildren      = (List<Resource>)newResult;\r
-               \r
-               if (DEBUG) System.out.println("ScenegraphQuery " + nodeResource +  " updated: had " + oldChildren.size() + " children, but now has " + newChildren.size() + " children");\r
-               added.clear();\r
-               removed.clear();\r
-               if (initialized) {\r
-                               for (Resource r : oldChildren)\r
-                                       if (!newChildren.contains(r))\r
-                                               removed.add(r);\r
-                               for (Resource r : newChildren)\r
-                                       if (!oldChildren.contains(r))\r
-                                               added.add(r);\r
-                               for (Resource r : removed) {\r
-                                       if (DEBUG)\r
-                                               System.out.println("ScenegraphQuery " + nodeResource\r
-                                                               + " removed " + r);\r
-                                       removeNode(nodeResource, r);\r
-                               }\r
-                               if (added.size() > 0) {\r
-                                       G3DNode parent = new G3DNode(graph, nodeResource);\r
-                                       /*\r
-                                        * try {\r
-                                        * \r
-                                        * G3DTools.propagateTransformChange(parent); } catch\r
-                                        * (Exception e) { ErrorLogger.defaultLogError(e); }\r
-                                        */\r
-                                       for (Resource r : added) {\r
-                                               IEntity e = EntityFactory.create(graph, r);\r
-                                               G3DTools.propagateLocalTransformChange(parent, e);\r
-                                               IGraphicsNode n = addNode(parent, e);\r
-                                               shapeAdded(graph, n);\r
-                                       }\r
-                               }\r
-                               return (added.size() > 0 || removed.size() > 0);\r
-               } else {\r
-                       // when query is run for the first time, we can assume that transformations are correct.\r
-                       initialized = true;\r
-                       for (Resource r : newChildren)\r
-                               added.add(r);\r
-                       if (added.size() > 0) {\r
-                                       G3DNode parent = new G3DNode(graph, nodeResource);\r
-                                       for (Resource r : added) {\r
-                                               IEntity e = EntityFactory.create(graph, r);\r
-                                               IGraphicsNode n = addNode(parent, e);\r
-                                               shapeAdded(graph, n);\r
-                                       }\r
-                                       return true;\r
-                               }\r
-                       return false;\r
-               }\r
-               \r
-       }\r
-       \r
-       \r
-       /**\r
-        * This method is run after a node is added to scene-graph.\r
-        * \r
-        * @param graph Graph of the current transaction.\r
-        * @param node the newly added scene-graph node\r
-        */\r
-       public abstract void shapeAdded(Graph graph,IGraphicsNode node);\r
-       \r
-//     @Override\r
-//     public void attach() {\r
-//             scenegraphQueries.put(nodeResource, this);\r
-//     }\r
-       \r
-       \r
-    }\r
-    \r
-    /**\r
-     * Tracks changes in scene-graph nodes' properties\r
-     * \r
-     * @author Marko Luukkainen\r
-     *\r
-     */\r
-    public abstract class NodePropertyQuery extends NodeQuery {\r
\r
-        private boolean initialized;\r
-        \r
-       public NodePropertyQuery(Resource nodeResource) {\r
-               super(nodeResource);\r
-               initialized = false;\r
-               if(DEBUG)System.out.println("NodePropertyQuery created for " + nodeResource);\r
-       }\r
-       \r
-       @Override\r
-       public List<Object> compute2(Graph g) {\r
-               IEntity t = EntityFactory.create(g,nodeResource);\r
-               \r
-               Collection<Property> properties = t.getRelatedProperties(Resources.g3dResource.HasNonTransformation);\r
-               List<Object> propertyValues = new ArrayList<Object>();\r
-               p(properties,propertyValues);\r
-\r
-               return propertyValues;\r
-       }\r
-       \r
-       private void p(Collection<Property> properties, List<Object> propertyValues) {\r
-               for (Property p : properties) {\r
-                       Collection<Property> subProperties = p.getRelatedProperties(p.getGraph().getBuiltins().HasProperty);\r
-                       if (subProperties.size() != 0) {\r
-                               p(subProperties,propertyValues);\r
-                       } \r
-                       if (p.hasValue()){\r
-                               propertyValues.add(p.getValue());\r
-                       }\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean updated(Graph graph, Object oldResult, Object newResult) {\r
-               if (initialized) {\r
-                       if (DEBUG) System.out.println("NodePropertyQuery changed " + nodeResource + " " + abstractGraphicsNodes.size());\r
-               IGraphicsNode mo = abstractGraphicsNodes.get(nodeResource);\r
-               if (mo == null) {\r
-                       if (DEBUG) System.out.println("NodePropertyQuery invalid change " + nodeResource + " " + abstractGraphicsNodes.size());\r
-                       ErrorLogger.defaultLogError("Got update from resource " + nodeResource + " but its not part of the scenegraph", null);\r
-                       dispose();\r
-                       return false;\r
-               }\r
-               shapeUpdated(graph,mo);\r
-               return true;\r
-               } else {\r
-                       initialized = true;\r
-                       return false;\r
-               }\r
-       }\r
-\r
-       \r
-       /**\r
-        * This method is run when a scene-graph node is changed.\r
-        * \r
-        * @param shape the changed node\r
-        */\r
-       public abstract void shapeUpdated(Graph graph,IGraphicsNode shape);\r
-       \r
-//     @Override\r
-//     public void attach() {\r
-//             propertyQueries.put(nodeResource, this);\r
-//     }\r
-       \r
-    }\r
-    \r
-    public abstract class NodeTransformationQuery extends NodeQuery {\r
-       \r
-       private boolean initialized;\r
-       \r
-       public NodeTransformationQuery(Resource nodeResource) {\r
-               super(nodeResource);\r
-               initialized = false;\r
-               if(DEBUG)System.out.println("NodeTransformationQuery created for " + nodeResource);\r
-       }\r
-       \r
-       @Override\r
-       public List<Object> compute2(Graph g) {\r
-               IEntity t = EntityFactory.create(g,nodeResource);\r
-               \r
-               Collection<Property> properties = t.getRelatedProperties(Resources.g3dResource.HasTransformation);\r
-               \r
-               List<Object> propertyValues = new ArrayList<Object>();\r
-               p(properties,propertyValues);\r
-               return propertyValues;\r
-\r
-       }\r
-       \r
-       private void p(Collection<Property> properties, List<Object> propertyValues) {\r
-               for (Property p : properties) {\r
-                       Collection<Property> subProperties = p.getRelatedProperties(p.getGraph().getBuiltins().HasProperty);\r
-                       if (subProperties.size() != 0) {\r
-                               p(subProperties,propertyValues);\r
-                       } \r
-                       if (p.hasValue()){\r
-                               propertyValues.add(p.getValue());\r
-                       }\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean updated(Graph graph,Object oldResult, Object newResult) {\r
-               if (initialized) {\r
-                       if (DEBUG) System.out.println("NodeTransformationQuery changed " + nodeResource + " " + abstractGraphicsNodes.size());\r
-\r
-                       G3DTools.transformationUpdate(graph, nodeResource);\r
-\r
-                       IGraphicsNode mo = abstractGraphicsNodes.get(nodeResource);\r
-               if (mo == null) {\r
-                       if (DEBUG) System.out.println("NodeTransformationQuery invalid change " + nodeResource + " " + abstractGraphicsNodes.size());\r
-                       ErrorLogger.defaultLogError("Got update from resource " + nodeResource + " but its not part of the scenegraph", null);\r
-                       dispose();\r
-                       return false;\r
-               }\r
-               shapeUpdated(graph,mo);\r
-               return true;\r
-               } else {\r
-                       initialized = true;\r
-                       return false;\r
-               }\r
-       }\r
-\r
-       \r
-       /**\r
-        * This method is run when a scene-graph node is changed.\r
-        * \r
-        * @param shape the changed node\r
-        */\r
-       public abstract void shapeUpdated(Graph graph,IGraphicsNode shape);\r
-       \r
-//     @Override\r
-//     public void attach() {\r
-//             transformationQueries.put(nodeResource, this);\r
-//     }\r
-       \r
-    }\r
-    \r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/SelectionAdapter.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/SelectionAdapter.java
deleted file mode 100644 (file)
index 22b6bc6..0000000
+++ /dev/null
@@ -1,445 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.ISelectionChangedListener;\r
-import org.eclipse.jface.viewers.ISelectionProvider;\r
-import org.eclipse.jface.viewers.SelectionChangedEvent;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.gizmo.Gizmo;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.ui.utils.ResourceAdaptionUtils;\r
-\r
-import com.jme.intersection.PickData;\r
-import com.jme.intersection.PickResults;\r
-import com.jme.intersection.TrianglePickResults;\r
-import com.jme.math.Ray;\r
-\r
-import org.simantics.db.Resource;\r
-\r
-/**\r
- * Manages highlighting and selecting of objects.\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public abstract class SelectionAdapter implements ISelectionProvider{\r
-       \r
-       protected ScenegraphAdapter adapter;\r
-       \r
-       private Gizmo currentGizmo = null;\r
-       \r
-       public SelectionAdapter(ScenegraphAdapter adapter) {\r
-               this.adapter = adapter;\r
-       }\r
-       \r
-    public enum SelectionType {\r
-        SET, MODIFY\r
-    };\r
-\r
-    protected SelectionType mouseClickType = SelectionType.SET;\r
-    \r
-    public SelectionType getSelectionType() {\r
-       return mouseClickType;\r
-    }\r
-    \r
-    public void setSelectionType(SelectionType type) {\r
-       mouseClickType = type;\r
-    }\r
-    \r
-    public void setCurrentGizmo(Gizmo gizmo) {\r
-       currentGizmo = gizmo;\r
-    }\r
-    \r
-    /**\r
-     * Lists all selected objects\r
-     * <p>\r
-     * Selection may contain objects that are not in this view: those are NOT\r
-     * returned\r
-     * </p>\r
-     * \r
-     * @return\r
-     */\r
-    public List<IGraphicsNode> getSelectedObjects() {\r
-        return getSelectedObjects(selection);\r
-    }\r
-    \r
-    /**\r
-     * Lists all highlighted objects.\r
-     * <p>\r
-     * Typically there may be only one highlighted object.\r
-     * </p>\r
-     * @return\r
-     */\r
-    public List<IGraphicsNode> getHighlightedObjects() {\r
-        return getSelectedObjects(interactiveSelection);\r
-    }\r
-\r
-    /**\r
-     * Lists all selected objects\r
-     * <p>\r
-     * Selection may contain objects that are not in this view: those are NOT\r
-     * returned\r
-     * </p>\r
-     * \r
-     * @return\r
-     */\r
-    public List<IGraphicsNode> getInteractiveSelectedObjects() {\r
-        return getSelectedObjects(interactiveSelection);\r
-    }\r
-\r
-    /**\r
-     * Lists all selected objects\r
-     * <p>\r
-     * Selection may contain objects that are not in this view: those are NOT\r
-     * returned\r
-     * </p>\r
-     * \r
-     * @return\r
-     */\r
-    protected List<IGraphicsNode> getSelectedObjects(StructuredResourceSelection selection) {\r
-        List<IGraphicsNode> l = new ArrayList<IGraphicsNode>();\r
-        Iterator<Resource> i = selection.iterator();\r
-        while (i.hasNext()) {\r
-            Resource s = i.next();\r
-            IGraphicsNode shape = adapter.getNode(s);\r
-            if (shape != null)\r
-                l.add(shape);\r
-\r
-        }\r
-        return l;\r
-    }\r
-\r
-    /**\r
-     * Return selected objects\r
-     * <p>\r
-     * May contain objects that are NOT in this view\r
-     * </p>\r
-     * \r
-     * @return\r
-     */\r
-    public List<Resource> getSelectedResources() {\r
-        List<Resource> l = new ArrayList<Resource>();\r
-        Iterator<Resource> i = selection.iterator();\r
-        while (i.hasNext()) {\r
-            Resource s = (Resource) i.next();\r
-            l.add(s);\r
-\r
-        }\r
-        return l;\r
-    }\r
-    \r
-    private ArrayList<PickData> processed = new ArrayList<PickData>();\r
-    \r
-    private class ExtTrianglePickResults extends TrianglePickResults {\r
-       public ExtTrianglePickResults() {\r
-               this.setCheckDistance(true);\r
-        }\r
-       \r
-       public void processPick() {\r
-                       processed.clear();\r
-                       if (getNumber() > 0) {\r
-                               for (int j = 0; j < getNumber(); j++) {\r
-                                       PickData pData = getPickData(j);\r
-                                       ArrayList<Integer> tris = pData.getTargetTris();\r
-                                       if (tris != null && tris.size() > 0) {\r
-                                               processed.add(pData);\r
-                                       }\r
-                               }\r
-                               \r
-                       }\r
-                       \r
-               }\r
-    }\r
-    \r
-    private PickResults result = new ExtTrianglePickResults();\r
-\r
-       \r
-       private void pickPrefix(String prefix) {\r
-\r
-               ArrayList<PickData> r= new ArrayList<PickData>();\r
-               for (int i = 0; i < processed.size(); i++) {\r
-                       PickData pData = processed.get(i);\r
-                       if (pData.getTargetMesh().getParentGeom().getName().startsWith(prefix))\r
-                               r.add(pData);\r
-               }\r
-               processed = r;\r
-       }\r
-       \r
-       /**\r
-        * Updates highlighted objects according to mouse position.\r
-        * \r
-        * @param mouseRay\r
-        */\r
-       public void updateHighlights(Ray mouseRay) {\r
-               result.clear();\r
-               adapter.getRenderingComponent().getRoot().calculatePick(mouseRay, result);\r
-               if (currentGizmo != null) {\r
-                       pickPrefix(currentGizmo.getPickPrefix());\r
-               }\r
-               doHighlightPick(processed);\r
-       }\r
-       \r
-       /**\r
-        * Picks highlighted objects\r
-        */\r
-       public void pickHighlighted() {\r
-               doPick(processed);\r
-       }\r
-       \r
-    /**\r
-     * Processes pick.\r
-     * @param result\r
-     */\r
-    protected void doPick(ArrayList<PickData> result) {\r
-        if (result != null) {\r
-\r
-               if (result.size() == 0) {\r
-                       if (mouseClickType != SelectionType.MODIFY)\r
-                    updateSelection(new StructuredResourceSelection());\r
-                       return;\r
-               }\r
-               \r
-               String nodeName = result.get(0).getTargetMesh().getParentGeom().getName();\r
-\r
-            StructuredResourceSelection s = new StructuredResourceSelection();\r
-            \r
-            Resource selectedResource = adapter.getNodeResource(nodeName);\r
-            if (adapter.getNode(selectedResource) == null) {\r
-                updateSelection(new StructuredResourceSelection());\r
-                return;\r
-                //throw new RuntimeException("Picked resource that has no node ?!");\r
-            }\r
-            if (mouseClickType == SelectionType.MODIFY) {\r
-                ArrayList<Resource> selected = new ArrayList<Resource>(getSelectedResources());\r
-                if (selected.contains(selectedResource))\r
-                    selected.remove(selectedResource);\r
-                else\r
-                    selected.add(selectedResource);\r
-                for (Resource r : selected)\r
-                    s.add(r);\r
-\r
-            } else {\r
-                s.add(selectedResource);\r
-            }\r
-\r
-            updateSelection(s);\r
-        } else {\r
-            // System.out.println("Picked nothing");\r
-            if (mouseClickType != SelectionType.MODIFY)\r
-                updateSelection(new StructuredResourceSelection());\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Processes highlight pick\r
-     * @param result\r
-     */\r
-    protected void doHighlightPick(ArrayList<PickData> result) {\r
-        if (result != null) {\r
-\r
-               if (result.size() == 0) {\r
-                       updateGizmo(null);\r
-                //System.out.println("IPicked nothing");\r
-                updateHighlightSelection(new StructuredResourceSelection());\r
-                       return;\r
-               }\r
-               \r
-               String nodeName = result.get(0).getTargetMesh().getParentGeom().getName();\r
-        \r
-            updateGizmo(null);\r
-            \r
-            // System.out.println("hits: " + result);\r
-            StructuredResourceSelection s = new StructuredResourceSelection();\r
-                      \r
-            Resource selectedResource = adapter.getNodeResource(nodeName);\r
-            \r
-            if (selectedResource == null) {\r
-               if (currentGizmo != null && nodeName.startsWith(currentGizmo.getPickPrefix())) {\r
-                    updateGizmo(nodeName);\r
-                } \r
-               return;\r
-            }\r
-            \r
-            if (adapter.getNode(selectedResource) != null)\r
-                s.add(selectedResource);\r
-\r
-            updateHighlightSelection(s);\r
-        } else {\r
-            updateGizmo(null);\r
-            // System.out.println("IPicked nothing");\r
-            updateHighlightSelection(new StructuredResourceSelection());\r
-        }\r
-    }\r
-    \r
-    /**\r
-     * Updates gizmo according to picked object\r
-     * @param pickName\r
-     */\r
-    private void updateGizmo(String pickName) {\r
-        if (currentGizmo != null) {\r
-            currentGizmo.setSelected(pickName);\r
-            if (currentGizmo.isChanged()) {\r
-               adapter.setChanged(true);\r
-                currentGizmo.setChanged(false);\r
-            }\r
-        }\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Contains selection\r
-     */\r
-    protected StructuredResourceSelection selection = new StructuredResourceSelection();\r
-\r
-    protected StructuredResourceSelection interactiveSelection = new StructuredResourceSelection();\r
-    \r
-    public StructuredResourceSelection getCurrentSelection() {\r
-        return selection;\r
-    }\r
-\r
-    public void setCurrentSelection(StructuredResourceSelection s) {\r
-        selection = s;\r
-    }\r
-\r
-    public StructuredResourceSelection getHighlightSelection() {\r
-        return interactiveSelection;\r
-    }\r
-\r
-    protected void setHighlightSelection(StructuredResourceSelection s) {\r
-        interactiveSelection = s;\r
-    }\r
-    \r
-    private ArrayList<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();\r
-\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)\r
-     */\r
-    public void addSelectionChangedListener(ISelectionChangedListener listener) {\r
-        selectionChangedListeners.add(listener);\r
-\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()\r
-     */\r
-    public ISelection getSelection() {\r
-        return selection;\r
-    }\r
-\r
-    \r
-    \r
-    public static StructuredResourceSelection transformSelection(ISelection sel) {\r
-       if (sel instanceof StructuredResourceSelection)\r
-               return (StructuredResourceSelection)sel;\r
-       StructuredResourceSelection res = new StructuredResourceSelection();\r
-       Resource resources[] = ResourceAdaptionUtils.toResources(sel);\r
-       for (Resource r : resources)\r
-               res.add(r);\r
-       return res;\r
-    }\r
-    \r
-\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)\r
-     */\r
-    public void removeSelectionChangedListener(ISelectionChangedListener listener) {\r
-        selectionChangedListeners.remove(listener);\r
-\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)\r
-     */\r
-    public void setSelection(ISelection selection) {\r
-        // System.out.println();\r
-        StructuredResourceSelection s = filterSelection(selection);\r
-        if (this.selection.equals(s))\r
-            return;\r
-        this.selection = s;\r
-        adapter.setChanged(true);\r
-        setEditorSelection();\r
-\r
-    }\r
-\r
-    /**\r
-     * Filters selection given with setSelection(ISelection selection) This\r
-     * allows impemented editors to modify selection before it's applied into\r
-     * this editor\r
-     * \r
-     * @param s\r
-     * @return the filtered selection\r
-     */\r
-    protected abstract StructuredResourceSelection filterSelection(ISelection s);\r
-\r
-    /**\r
-     * Updates visual part of selection event. Use getCurrentSelection() to get\r
-     * the selection\r
-     */\r
-    public abstract void setEditorSelection();\r
-\r
-    /**\r
-     * Updates visual part of selection event. Use getInteractiveSelection() to\r
-     * get the selection\r
-     */\r
-    protected abstract void setEditorHighlightSelection();\r
-\r
-    /**\r
-     * Editor's internal selection update<br>\r
-     * Sends events to other editors and views about changed selection\r
-     * \r
-     * @param selection\r
-     * @return\r
-     */\r
-    public boolean updateSelection(StructuredResourceSelection s) {\r
-        if (this.selection.equals(s))\r
-            return false;\r
-\r
-        this.selection = s;\r
-        adapter.setChanged(true);\r
-        fireSelectionChangedEvent();\r
-        setEditorSelection();\r
-        return true;\r
-    }\r
-\r
-    protected boolean updateHighlightSelection(StructuredResourceSelection s) {\r
-        if (interactiveSelection.equals(s))\r
-            return false;\r
-        this.interactiveSelection = s;\r
-        adapter.setChanged(true);\r
-        setEditorHighlightSelection();\r
-        return true;\r
-    }\r
-\r
-    /**\r
-     * Fires selection changed events.\r
-     */\r
-    protected void fireSelectionChangedEvent() {\r
-        SelectionChangedEvent e = new SelectionChangedEvent(this, this.selection);\r
-        for (ISelectionChangedListener l : selectionChangedListeners)\r
-            l.selectionChanged(e);\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorBase.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorBase.java
deleted file mode 100644 (file)
index 0a04a22..0000000
+++ /dev/null
@@ -1,741 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.awt.event.MouseEvent;\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Stack;\r
-\r
-import javax.vecmath.Tuple3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IContributionItem;\r
-import org.eclipse.jface.action.IMenuListener;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.action.MenuManager;\r
-import org.eclipse.jface.action.Separator;\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.ISelectionChangedListener;\r
-import org.eclipse.jface.viewers.SelectionChangedEvent;\r
-import org.eclipse.swt.events.PaintEvent;\r
-import org.eclipse.swt.events.PaintListener;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Menu;\r
-import org.eclipse.ui.IActionBars;\r
-import org.eclipse.ui.IEditorActionBarContributor;\r
-import org.eclipse.ui.ISharedImages;\r
-import org.eclipse.ui.IWorkbenchActionConstants;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.eclipse.ui.PlatformUI;\r
-import org.eclipse.ui.commands.ICommandService;\r
-import org.eclipse.ui.internal.WorkbenchWindow;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.events.GraphChangeEvent;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.actions.CameraAction;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.actions.InteractiveAction;\r
-import org.simantics.proconf.g3d.base.SelectionAdapter.SelectionType;\r
-import org.simantics.proconf.g3d.common.JmeComposite;\r
-import org.simantics.proconf.g3d.common.JmeSinglePassRenderingComponent;\r
-import org.simantics.proconf.g3d.common.OrbitalCamera;\r
-import org.simantics.proconf.g3d.dialogs.JMEDialog;\r
-import org.simantics.proconf.g3d.dnd.ShapeDropTarget;\r
-import org.simantics.proconf.g3d.gizmo.Gizmo;\r
-import org.simantics.proconf.g3d.input.InputProvider;\r
-import org.simantics.proconf.g3d.input.SWTInputProvider;\r
-import org.simantics.proconf.g3d.scenegraph.IGeometryNode;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.tools.ScenegraphLockTraverser;\r
-import org.simantics.utils.ErrorLogger;\r
-import org.simantics.utils.ui.jface.MenuTools;\r
-\r
-import com.jme.math.Ray;\r
-import com.jme.math.Vector2f;\r
-import com.jme.math.Vector3f;\r
-import com.jme.renderer.ColorRGBA;\r
-\r
-\r
-public abstract class ThreeDimensionalEditorBase implements  Runnable {\r
-\r
-       private Resource inputResource;\r
-       \r
-       private List<EditorContribution> editorContributions = new ArrayList<EditorContribution>();\r
-       \r
-       private EditorContribution currentEditorContribution;\r
-       \r
-    protected List<ContextAction> actions = new ArrayList<ContextAction>();\r
-    \r
-    private List<Action> contributionSelectionActions = new ArrayList<Action>();\r
-      \r
-    protected Composite parent;\r
-    \r
-    protected ISessionContext sessionContext;\r
-    \r
-    protected Session session;\r
-    \r
-    protected ScenegraphAdapter adapter;\r
-    \r
-    protected SelectionAdapter selectionAdapter;\r
-    \r
-    protected Action refreshAction;\r
-    \r
-    protected Action configureJMEAction;\r
-    \r
-    private Action lockScenegraphAction;\r
-\r
-    protected Menu contextMenu;\r
-\r
-    private JmeComposite renderingComposite = null;  \r
-\r
-    protected OrbitalCamera camera = new OrbitalCamera();\r
-\r
-    protected boolean viewChanged = true;\r
-\r
-    private InteractiveAction currentAction = null;\r
-    \r
-    private Gizmo currentGizmo = null;\r
-    \r
-    private InteractiveAction cameraAction = null;\r
-    \r
-    private JmeRenderingComponent component = null;\r
-    \r
-    protected InputProvider input = null;\r
-    \r
-    protected ShapeDropTarget dropTarget;\r
-\r
-//    protected IEditorActionBarContributor actionBarContributor;\r
-    protected IActionBars actionBars;\r
-    protected IToolBarManager toolBarManager;\r
-    protected IMenuManager menuManager;\r
-    \r
-    public ThreeDimensionalEditorBase(ISessionContext session) {\r
-       this.sessionContext = session;\r
-       this.session = session.getSession();\r
-       component = new JmeSinglePassRenderingComponent();\r
-    }\r
-\r
-    public ThreeDimensionalEditorBase(ISessionContext session, JmeRenderingComponent component) {\r
-       this.sessionContext = session;\r
-       this.session = session.getSession();\r
-       this.component = component;\r
-    }\r
-    \r
-//    public void setActionBarContributor(IEditorActionBarContributor contributor) {\r
-//     actionBarContributor = contributor;\r
-//    }\r
-    \r
-    public void setActionBars(IActionBars actionBars) {\r
-       this.actionBars = actionBars;\r
-       this.menuManager = actionBars.getMenuManager();\r
-       this.toolBarManager = actionBars.getToolBarManager();\r
-    }\r
-    \r
-   \r
-    \r
-    \r
-    public ISessionContext getSessionContext() {\r
-       return sessionContext;\r
-    }\r
-    \r
-    public Session getSession() {\r
-       return session;\r
-    }\r
-    \r
-    /**\r
-     * Creates basic UI for ThreeDimenionalEditors.\r
-     * Note : inputResource has not been set at this point.\r
-     * \r
-     * @param graph\r
-     * @param parent\r
-     */\r
-    public void createControl(Graph graph, Composite parent) {\r
-       this.parent = parent;\r
-       renderingComposite = new JmeComposite(parent,component);\r
-       // add listeners to force repaint on size changes\r
-        renderingComposite.getCanvas().addPaintListener(new PaintListener() {\r
-               public void paintControl(PaintEvent e) {\r
-                       viewChanged = true;     \r
-               }\r
-        });\r
-\r
-        \r
-        input = new SWTInputProvider();\r
-        \r
-        renderingComposite.initGL();\r
-        camera.setCamera(component.getCamera());\r
-        camera.updateCamera();  \r
-        makeActions(graph);\r
-        hookContextMenu();\r
-\r
-        // provide selection events for properies view\r
-        this.adapter = createScenegraphAdapter();\r
-        this.selectionAdapter = createSelectionAdapter();\r
-        \r
-        this.selectionAdapter.addSelectionChangedListener(new ISelectionChangedListener() {\r
-               public void selectionChanged(SelectionChangedEvent event) {\r
-                       setCurrentAction(getDefaultAction());   \r
-               }\r
-        });\r
-        hookDragAndDrop();      \r
-        hookInput();\r
-        VisualizationScheduler.getInstance().addVisualization(this);\r
-        \r
-        if (editorContributions.size() > 0) {\r
-            // setActiveEditorContribution(editorContributions.get(0));\r
-           // } else if (editorContributions.size() > 1) {\r
-               // create actions for selecting contribution\r
-               for (EditorContribution ec : editorContributions) {\r
-                       final EditorContribution e = ec;\r
-                       Action a = new Action(e.getName(),Action.AS_RADIO_BUTTON) {\r
-                               @Override\r
-                               public void run() {\r
-                                       \r
-                                       setActiveEditorContribution(e);\r
-                               }\r
-                       };\r
-                       contributionSelectionActions.add(a);\r
-                       \r
-               }\r
-         }\r
-       \r
-    }\r
-    \r
-    public void addEditorContribution(EditorContribution e) {\r
-       if (parent != null)\r
-               throw new RuntimeException("Editor contributions must be added before editor is created.");\r
-       editorContributions.add(e);\r
-    }\r
-    \r
-    private void initializeEditorContributions(Graph graph) {\r
-        for (EditorContribution e : editorContributions) {\r
-               e.initialize(graph);\r
-         }\r
-        if (editorContributions.size() > 0)\r
-                parent.getDisplay().asyncExec(new Runnable() {\r
-                        @Override\r
-                       public void run() {\r
-                                setActiveEditorContribution(editorContributions.get(0));\r
-                       }\r
-                });     \r
-    }\r
-    \r
-    \r
-    private void hookInput() {\r
-        renderingComposite.getCanvas().addKeyListener((SWTInputProvider) input);\r
-        renderingComposite.getCanvas().addMouseListener((SWTInputProvider) input);\r
-        renderingComposite.getCanvas().addMouseMoveListener((SWTInputProvider) input);\r
-        renderingComposite.getCanvas().addMouseTrackListener((SWTInputProvider) input);\r
-        renderingComposite.getCanvas().addFocusListener((SWTInputProvider) input);\r
-    }\r
-    \r
-    protected abstract ScenegraphAdapter createScenegraphAdapter();\r
-    protected abstract SelectionAdapter createSelectionAdapter();\r
-\r
-    \r
-    public JmeComposite getRenderingComposite() {\r
-        return renderingComposite;\r
-   }\r
-    \r
-    public JmeRenderingComponent getRenderingComponent() {\r
-      return component;\r
-    }\r
-\r
-    public ScenegraphAdapter getScenegraphAdapter() {\r
-       return adapter;\r
-    }\r
-    \r
-    public SelectionAdapter getSelectionAdapter() {\r
-       return selectionAdapter;\r
-    }\r
-\r
-    public OrbitalCamera getCamera() {\r
-        return camera;\r
-    }\r
-    \r
-    public void setViewChanged(boolean b) {\r
-        viewChanged = b;\r
-    }\r
-\r
-    protected void hookContextMenu() {\r
-        MenuManager menuMgr = new MenuManager("#PopupMenu");\r
-        menuMgr.setRemoveAllWhenShown(true);\r
-        menuMgr.addMenuListener(new IMenuListener() {\r
-            public void menuAboutToShow(IMenuManager manager) {\r
-               final IMenuManager m = manager;\r
-               GraphRequestAdapter r = new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               ThreeDimensionalEditorBase.this.fillContextMenu(g,m);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               };\r
-               \r
-               session.syncRead(r);\r
-                \r
-            }\r
-        });\r
-\r
-        contextMenu = menuMgr.createContextMenu(renderingComposite);\r
-    }\r
-\r
-    \r
-\r
-    protected void fillContextMenu(Graph graph,IMenuManager manager) {\r
-        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));\r
-        \r
-        List<Resource> selected = selectionAdapter.getSelectedResources();\r
-        for (ContextAction action : actions) {\r
-            if(action.usable(graph,selected)) {\r
-                manager.add(action);\r
-            }\r
-        }\r
-        if (currentEditorContribution != null) {\r
-               currentEditorContribution.fillContextMenu(graph, manager, selectionAdapter.getCurrentSelection());\r
-               for (ContextAction action : currentEditorContribution.getActions()) {\r
-                       if(action.usable(graph,selected)) {\r
-                               manager.add(action);\r
-                }\r
-            }\r
-        }\r
-\r
-    }\r
-\r
-    protected void fillLocalToolBar() {\r
-\r
-       if (currentEditorContribution != null)\r
-               currentEditorContribution.fillLocalToolBar(toolBarManager);\r
-    }\r
-    \r
-    protected void fillLocalPullDown() {\r
-       for (Action a : contributionSelectionActions) {\r
-               IMenuManager menu = MenuTools.getOrCreate(getMenuID(),"View", menuManager);\r
-               menu.add(a);\r
-       }\r
-       MenuTools.getOrCreate(getMenuID(),"Advanced", menuManager).add(refreshAction);\r
-       if (configureJMEAction != null) {\r
-               MenuTools.getOrCreate(getMenuID(),"Advanced", menuManager).add(configureJMEAction);\r
-       }\r
-\r
-       MenuTools.getOrCreate(getMenuID(),"Advanced", menuManager).add(lockScenegraphAction);\r
-       if (currentEditorContribution != null)\r
-               currentEditorContribution.fillLocalPullDown(menuManager);\r
-    }\r
-    \r
-    public String getMenuID() {\r
-       return Long.toString(getInputResource().getResourceId());\r
-    }\r
-\r
-    protected void makeActions(Graph graph) {\r
-        \r
-        refreshAction = new Action() {\r
-\r
-            public void run() {\r
-               GraphRequestAdapter r = new GraphRequestAdapter() {\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-//                              Stack<IGraphicsNode> stack = new Stack<IGraphicsNode>();\r
-//                         stack.push(adapter.getNode(adapter.getRootResource()));\r
-//                         while(!stack.isEmpty()) {\r
-//                             IGraphicsNode node = stack.pop();\r
-//                             stack.addAll(node.getChildren());\r
-//                             if (node instanceof IGeometryNode) {\r
-//                                 ((IGeometryNode)node).updateGeometry(g);\r
-//                             }\r
-//                         }\r
-                                for (IGraphicsNode node : adapter.getNodes())\r
-                                        if (node instanceof IGeometryNode)\r
-                                                ((IGeometryNode)node).updateGeometry(g);\r
-                         viewChanged = true;\r
-                         return GraphRequestStatus.transactionComplete();\r
-                       };\r
-               };\r
-               session.asyncRead(r);\r
-               \r
-            }\r
-        };\r
-        refreshAction.setText("Refresh");\r
-        refreshAction.setToolTipText("Refreshes the visualization");\r
-        refreshAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(\r
-                ISharedImages.IMG_TOOL_UP));\r
-        if (getRenderingComponent() instanceof JmeSinglePassRenderingComponent) {\r
-               configureJMEAction = new Action() {\r
-                       public void run() {\r
-                               JmeSinglePassRenderingComponent c = (JmeSinglePassRenderingComponent)getRenderingComponent();\r
-                               JMEDialog dialog = new JMEDialog(ThreeDimensionalEditorBase.this.parent.getShell());\r
-                               c.getDisplaySystem().setCurrent();\r
-                               dialog.setBounds(c.isShowBounds());\r
-                               dialog.setNormals(c.isShowNormals());\r
-                               dialog.setWireframe(c.isShowWireframe());\r
-                               ColorRGBA col = c.getDisplaySystem().getRenderer().getBackgroundColor();\r
-                               dialog.setFloatColor(new float[]{col.r,col.g,col.b});\r
-                               if (dialog.open() == JMEDialog.CANCEL)\r
-                                       return;\r
-                               c.setShowBounds(dialog.isBounds());\r
-                               c.setShowNormals(dialog.isNormals());\r
-                               c.setShowWireframe(dialog.isWireframe());\r
-                               if (dialog.getFloatColor() != null) {\r
-                                       c.getDisplaySystem().setCurrent();\r
-                                       c.getDisplaySystem().getRenderer().setBackgroundColor(new ColorRGBA(dialog.getFloatColor()[0],dialog.getFloatColor()[1],dialog.getFloatColor()[2],0.f));\r
-                               }\r
-                       }\r
-               };\r
-               configureJMEAction.setText("Configure JME");\r
-               configureJMEAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/wrench.png"));\r
-        }\r
-        \r
-        lockScenegraphAction = new Action("Lock scenegraph",Action.AS_CHECK_BOX) {\r
-               public void run() {\r
-                       new ScenegraphLockTraverser(adapter.getRoot(),this.isChecked());\r
-               }\r
-        };\r
-        \r
-        cameraAction = new CameraAction(this); \r
-        currentAction = cameraAction;\r
-        \r
-        \r
-    }\r
-    \r
-    public InteractiveAction getDefaultAction() {\r
-        return cameraAction;\r
-    }\r
-    \r
-    public void createPickRay(Vector3d o, Vector3d d) {\r
-       Ray r = createPickRay();\r
-       o.x = r.origin.x;\r
-       o.y = r.origin.y;\r
-       o.z = r.origin.z;\r
-       d.x = r.direction.x;\r
-       d.y = r.direction.y;\r
-       d.z = r.direction.z;\r
-       d.normalize();\r
-    }\r
-    \r
-    public Ray createPickRay() {\r
-       Vector2f screenPos = new Vector2f();\r
-               screenPos.set(input.mouseX(),renderingComposite.getBounds().height - input.mouseY());\r
-               \r
-               \r
-               Ray mouseRay;\r
-               if (component.getCamera().isParallelProjection()) {\r
-                       Vector3f worldCoords = renderingComposite.getDisplaySystem().getWorldCoordinates(screenPos, 0.0f);\r
-                       mouseRay = new Ray(worldCoords,\r
-                               component.getCamera().getDirection());\r
-               } else {\r
-                       Vector3f worldCoords = renderingComposite.getDisplaySystem().getWorldCoordinates(screenPos, 1.0f);\r
-                       mouseRay = new Ray(component.getCamera().getLocation(), worldCoords\r
-                                       .subtractLocal(component.getCamera().getLocation()));\r
-               }\r
-               return mouseRay;\r
-    }\r
-    \r
-    public Vector2f getScreenCoord(Tuple3d worldCoord) {\r
-       Vector3f v = renderingComposite.getDisplaySystem().getScreenCoordinates(VecmathJmeTools.get(worldCoord));\r
-       return new Vector2f(v.x,v.y);\r
-    }\r
-    \r
-    \r
-    public InputProvider getInputProvider() {\r
-        return input;\r
-    }\r
-\r
-    /**\r
-     * Changes current action \r
-     * \r
-     * @param type\r
-     */\r
-    public void setCurrentAction(InteractiveAction action) {\r
-       if (currentAction == action)\r
-               return;\r
-       if (toolBarManager != null) {\r
-               toolBarManager.removeAll();\r
-               fillLocalToolBar();\r
-       }\r
-        if (currentAction != null)\r
-            currentAction.deactivate();\r
-        currentAction = action;\r
-        if (currentAction != null) {\r
-            currentAction.activate();\r
-            if (toolBarManager != null) {\r
-               currentAction.fillToolBar(toolBarManager);\r
-            }\r
-        }\r
-        \r
-        updateBars();\r
-    }\r
-    \r
-    public InteractiveAction getCurrentAction() {\r
-       return currentAction;\r
-    }\r
-    \r
-    public void setActiveEditorContribution(EditorContribution contribution) {\r
-       if (currentEditorContribution == contribution)\r
-               return;\r
-       if (currentAction != getDefaultAction())\r
-               return;\r
-       if (currentEditorContribution != null)\r
-               currentEditorContribution.disposeControl();\r
-       currentEditorContribution = contribution;\r
-       int index = editorContributions.indexOf(contribution);\r
-       for (int i = 0; i < contributionSelectionActions.size(); i++) {\r
-               if (i != index)\r
-                       contributionSelectionActions.get(i).setChecked(false);\r
-               else\r
-                       contributionSelectionActions.get(i).setChecked(true);\r
-       }\r
-       if (currentEditorContribution != null)\r
-               currentEditorContribution.createControl(parent);\r
-       \r
-       actionBars.clearGlobalActionHandlers();\r
-       \r
-       parent.layout(true, true);\r
-       if (toolBarManager != null) {\r
-               toolBarManager.removeAll();\r
-               fillLocalToolBar();\r
-       }\r
-       if (menuManager != null) {              \r
-               menuManager.removeAll();\r
-               fillLocalPullDown();\r
-       }\r
-       \r
-       updateBars();\r
-    }\r
-    \r
-    protected void updateBars() {\r
-       // TODO : actionBars.updateActionBars does not update toolbar, updating toolBar directly layouts code \r
-       //        generated widgets top of contributed (extension) widgets. Only way to achieve proper update\r
-       //        is to use WorkbenchWindow.getCoolBarManager.update(true)\r
-        actionBars.updateActionBars();\r
-//     if (toolBarManager != null) {\r
-//             toolBarManager.update(true);\r
-//     }\r
-       WorkbenchWindow w = (WorkbenchWindow)PlatformUI.getWorkbench().getActiveWorkbenchWindow();\r
-        w.getCoolBarManager().update(true);\r
-    }\r
-    \r
-    public void setGizmo(Gizmo gizmo) {\r
-        if (currentGizmo != null) {\r
-               currentGizmo.getNode().removeFromParent();\r
-        }\r
-        currentGizmo = gizmo;\r
-        selectionAdapter.setCurrentGizmo(gizmo);\r
-        viewChanged = true;\r
-    }\r
-    \r
-//    public void setInfoText(String text) {\r
-//        if (useInfoComposite) {\r
-//            infoText.setText(text);\r
-//        }\r
-//    }\r
-\r
-    public void showMessage(String message) {\r
-        MessageDialog.openInformation(parent.getShell(), "Shape Editor", //$NON-NLS-1$\r
-                message);\r
-    }\r
-\r
-\r
-    /**\r
-     * Passing the focus request to the viewer's control.\r
-     */\r
-    public void setFocus() {\r
-       renderingComposite.getCanvas().setFocus();\r
-    }\r
-\r
-    public void dispose() {\r
-       //System.out.println("ThreeDimensionalEditorBase.dispose()");\r
-        VisualizationScheduler.getInstance().removeVisualization(this);\r
-\r
-        if (currentAction != null)\r
-            currentAction.deactivate();\r
-\r
-        for (EditorContribution e : editorContributions)\r
-               e.dispose();\r
-        \r
-        renderingComposite.dispose();\r
-\r
-        // copy of the set is needed to avoid ConcurrentModificationException\r
-        adapter.dispose();\r
-        component.dispose();\r
-    }\r
-\r
-    public final void reload(Graph g, Resource res) {\r
-       inputResource = res;\r
-        reloadFrom(EntityFactory.create(g, res));\r
-        // at this point we can initialize editor contributions, which may require inputResource\r
-        initializeEditorContributions(g);\r
-    }\r
-\r
-    public Resource getInputResource() {\r
-       return inputResource;\r
-    }\r
-    \r
-    public void update(GraphChangeEvent event) {\r
-//        System.out.println("Transaction " + this + " : " + event.getTransactionId() + " Arg1: " + event.getArg1()\r
-//                + " arg2: " + event.getArg2() + " sender: " + event.getSender() + " source: " + event.getSource());\r
-        \r
-//        if (event.added.size() > 0) {\r
-//            System.out.println("Added:");\r
-//            for (Triplet t : event.added)\r
-//                System.out.println(t);\r
-//        }\r
-//        if (event.changed.size() > 0) {\r
-//            System.out.println("Changed:");\r
-//            for (Triplet t : event.changed)\r
-//                System.out.println(t);\r
-//        }\r
-//        if (event.removed.size() > 0) {\r
-//            System.out.println("Removed:");\r
-//            for (Triplet t : event.removed)\r
-//                System.out.println(t);\r
-//        }\r
-\r
-    }\r
-\r
-    \r
-\r
-    /**\r
-     * Loads the initial scene: all further updates to the view are done by\r
-     * listening changes in the shapes and int the shape group\r
-     * \r
-     * @param resource\r
-     */\r
-    protected abstract void reloadFrom(IEntity thing);\r
-\r
-\r
-       protected void viewUpdated() {\r
-\r
-       }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see java.lang.Runnable#run()\r
-     */\r
-    public void run() {\r
-       if (currentEditorContribution != null)\r
-               currentEditorContribution.run();\r
-       if (parent.isDisposed() || !parent.isVisible())\r
-                       return;\r
-       //renderingComposite.getDisplaySystem().setCurrent();\r
-               input.update();\r
-               if (input.mouseClicked()) {\r
-                       int downMask = MouseEvent.CTRL_DOWN_MASK;\r
-\r
-                       if ((input.clickModifiers() & downMask) > 0) {\r
-                               selectionAdapter.setSelectionType(SelectionType.MODIFY);\r
-                       } else {\r
-                               selectionAdapter.setSelectionType(SelectionType.SET);\r
-                       }\r
-               }\r
-               if (input.mouseMoved()) {\r
-                       Ray mouseRay = createPickRay();\r
-                       selectionAdapter.updateHighlights(mouseRay);\r
-               }\r
-               if (currentAction == cameraAction && input.mouseClicked()) {\r
-                       selectionAdapter.pickHighlighted();\r
-               }\r
-               if (currentAction == cameraAction && input.mousePressed()\r
-                               && (input.pressModifiers() & MouseEvent.BUTTON3_MASK) > 0) {\r
-                       Point p = renderingComposite.toDisplay(input.mouseX(), input\r
-                                       .mouseY());\r
-                       contextMenu.setLocation(p.x, p.y);\r
-                       contextMenu.setVisible(true);\r
-               }\r
-\r
-               if (currentAction != null)\r
-                       try {\r
-                               currentAction.update();\r
-                       } catch (Exception e) {\r
-                               ErrorLogger.defaultLogError("Action error!", e);\r
-                               setCurrentAction(getDefaultAction());\r
-                       }\r
-\r
-               if (component.update())\r
-                       viewChanged = true;\r
-                   \r
-               if (!geometryUpdateRequestAdapter.isRunning() && adapter.needsUpdateGeometry()) {\r
-                       session.asyncRead(geometryUpdateRequestAdapter);        \r
-               }\r
-               \r
-               viewChanged |= adapter.isChanged();\r
-                if (viewChanged) {\r
-                       viewChanged = false;\r
-                       adapter.setChanged(false);\r
-                       camera.updateCamera();\r
-                       viewUpdated();\r
-                       component.render();\r
-               }\r
-       }\r
-    // TODO : there is some sort of synchronization bug in rendering:\r
-    //        part of the rendered objects are rendered with different camera transformation than others.\r
-    //        re-rendering the scene hides the worst problems.\r
-    //        Using shadows is the reason: shadowed objects are rendered with different transformation than non-shadowed.\r
-    //private boolean lastChanged = false;\r
-    \r
-    private GeometryUpdateRequestAdapter geometryUpdateRequestAdapter = new GeometryUpdateRequestAdapter();\r
-       \r
-    private class GeometryUpdateRequestAdapter extends GraphRequestAdapter {\r
-       private boolean running;\r
-       @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-               running = true;\r
-                       adapter.updateGeometry(g);\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-               @Override\r
-               public void requestCompleted(GraphRequestStatus status) {\r
-                       running = false;\r
-                       adapter.setChanged(true);\r
-               }\r
-               \r
-               public boolean isRunning() {\r
-                       return running;\r
-               }\r
-    }\r
-\r
-   \r
-    \r
-    protected void hookDragAndDrop() {\r
-       dropTarget = new ShapeDropTarget(this);\r
-    }\r
-\r
-    /**\r
-     * Receives selection changes\r
-     * \r
-     * @param part\r
-     * @param selection\r
-     */\r
-    protected abstract void pageSelectionChanged(IWorkbenchPart part, ISelection selection);\r
-\r
-    /**\r
-     * EditorPart or ViewPart uses this method to forward getAdapter(Class)\r
-     * @see org.eclipse.ui.part.WorkbenchPart.getAdapter(Class adapter)\r
-     * @param adapter\r
-     * @return\r
-     */\r
-    public Object getAdapter(Class adapter) {\r
-       return null;\r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorPart.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorPart.java
deleted file mode 100644 (file)
index 4ad22bd..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import org.eclipse.jface.action.IStatusLineManager;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.ui.IActionBars;\r
-import org.eclipse.ui.IPartListener;\r
-import org.eclipse.ui.ISelectionListener;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.events.GraphChangeEvent;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.proconf.ui.workbench.ResourceEditorPart;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-\r
-public abstract class ThreeDimensionalEditorPart extends ResourceEditorPart implements ThreeDimensionalEditorProvider{\r
-       \r
-       protected Composite parent;\r
-       \r
-       protected ThreeDimensionalEditorBase editor;\r
-\r
-    protected ISelectionListener pageSelectionListener;\r
-\r
-       protected abstract ThreeDimensionalEditorBase createEditor(ISessionContext session);\r
-       \r
-       /**\r
-     * This is a callback that will allow us to create the viewer and it.\r
-     */\r
-    @Override\r
-    public void createPartControl(Composite p) {\r
-       this.parent = p;\r
-        try {\r
-               editor = createEditor(getSessionContext());\r
-               \r
-            // add partlistener that loads the scene-graph when the view has been created\r
-            this.getEditorSite().getPage().addPartListener(new IPartListener() {\r
-               \r
-               boolean opened = false;\r
-               boolean activated = false;\r
-               \r
-                public void partOpened(IWorkbenchPart part) {\r
-                    if (part.equals(ThreeDimensionalEditorPart.this.getEditorSite().getPart())) {\r
-                        opened = true;\r
-                    }\r
-                }\r
-                \r
-                public void partActivated(IWorkbenchPart part) {\r
-                       if (part.equals(ThreeDimensionalEditorPart.this.getEditorSite().getPart())) {\r
-                        if (opened & !activated) {\r
-                               activated = true;\r
-                               load();\r
-                        }\r
-                       }\r
-                }\r
-                \r
-                public void partBroughtToTop(IWorkbenchPart part) {}\r
-                \r
-                public void partClosed(IWorkbenchPart part) {}\r
-                \r
-                public void partDeactivated(IWorkbenchPart part) {}\r
-                \r
-                private void load() {\r
-                       //System.out.println("ThreeDimensionalEditorPart.reload()");\r
-                    Session ses = ThreeDimensionalEditorPart.this.getSession();\r
-                    GraphRequestAdapter r = new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g)\r
-                                       throws Exception {\r
-                                reload(g);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                    };\r
-                    ses.asyncRead(r);\r
-                }\r
-            });\r
-\r
-            IActionBars actionBar = getEditorSite().getActionBars();\r
-//            editor.setActionBarContributor(getEditorSite().getActionBarContributor());\r
-            editor.setActionBars(actionBar);\r
-            getSession().syncRead(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       editor.createControl(g,parent);\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-            });\r
-            \r
-            contributeStatusBar(actionBar.getStatusLineManager());\r
-            hookPageSelection(); \r
-            getSite().setSelectionProvider(editor.selectionAdapter);\r
-            \r
-\r
-\r
-        } catch (Exception e) {\r
-            Display d = getSite().getShell().getDisplay();\r
-            d.asyncExec(new Runnable() {\r
-                public void run() {\r
-                    getSite().getPage().closeEditor(ThreeDimensionalEditorPart.this,false);\r
-                }\r
-            });\r
-\r
-            ErrorLogger logger = ErrorLogger.getDefault();\r
-            logger.logError("Shape editor failed to open, see exception for details", e);\r
-        }\r
-\r
-    }\r
-    \r
-\r
-    protected void contributeStatusBar(IStatusLineManager manager) {\r
-    }\r
-    \r
-    \r
-       @Override\r
-       public void reload(Graph g) {\r
-               Resource inputResource = getInputResource();\r
-               if (inputResource != null) {\r
-                       editor.reload(g,inputResource);\r
-               } else {\r
-                       \r
-                        Display d = getSite().getShell().getDisplay();\r
-                   d.asyncExec(new Runnable() {\r
-                       public void run() {\r
-                               editor.showMessage("Failed to load model.");\r
-                           getSite().getPage().closeEditor(ThreeDimensionalEditorPart.this,false);\r
-                       }\r
-                   });\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public void update(GraphChangeEvent e) {\r
-               editor.update(e);\r
-       }\r
-       \r
-       @Override\r
-       public void setFocus() {\r
-               editor.setFocus();\r
-       }\r
-       \r
-        /**\r
-     * Hooks selection listening\r
-     */\r
-    private void hookPageSelection() {\r
-        pageSelectionListener = new ISelectionListener() {\r
-            public void selectionChanged(IWorkbenchPart part, ISelection selection) {\r
-                if (part == ThreeDimensionalEditorPart.this)\r
-                    return;\r
-                pageSelectionChanged(part, selection);\r
-            }\r
-        };\r
-        getSite().getPage().addPostSelectionListener(pageSelectionListener);\r
-        ISelection sel = getSite().getPage().getSelection();\r
-        IWorkbenchPart wb = getSite().getPage().getActivePart();\r
-        pageSelectionChanged(wb, sel);\r
-    }\r
-    \r
-    /**\r
-     * Receives selection changes\r
-     * \r
-     * @param part\r
-     * @param selection\r
-     */\r
-    protected void pageSelectionChanged(IWorkbenchPart part, ISelection selection) {\r
-       editor.pageSelectionChanged(part, selection);\r
-    }\r
-    \r
-    public void dispose() {\r
-       if (pageSelectionListener != null)\r
-            getSite().getPage().removePostSelectionListener(pageSelectionListener);\r
-        editor.dispose();\r
-       super.dispose();\r
-    }\r
-    \r
-    public ThreeDimensionalEditorBase getEditor() {\r
-       return editor;\r
-    }\r
-    \r
-    @Override\r
-    public Object getAdapter(Class adapter) {\r
-       Object o = super.getAdapter(adapter);\r
-       if (o == null) {\r
-               o = editor.getAdapter(adapter);\r
-       }\r
-       return o;\r
-    }\r
-\r
-\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorProvider.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorProvider.java
deleted file mode 100644 (file)
index df2d14d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-/**\r
- * Interface which selectionProviders containing ThreeDimensionalEditorPart\r
- * must implement. \r
- * \r
- * This enables usage of ThreeDimensionalEditorPart in views, editors, dialogs, and so on.\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public interface ThreeDimensionalEditorProvider {\r
-\r
-       public ThreeDimensionalEditorBase getEditor();\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/TransformationTools.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/TransformationTools.java
deleted file mode 100644 (file)
index 9ca2754..0000000
+++ /dev/null
@@ -1,520 +0,0 @@
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Tuple3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.stubs.Orientation;\r
-import org.simantics.proconf.g3d.stubs.Position;\r
-\r
-public class TransformationTools {\r
-       \r
-       private static boolean DEBUG = false;\r
-       \r
-       private Resource childRelation;\r
-       private Resource parentRelation;\r
-       \r
-       public TransformationTools(Resource childRelation, Resource parentRelation) {\r
-               this.childRelation = childRelation;\r
-               this.parentRelation = parentRelation;\r
-       }\r
-       \r
-       public IEntity getParent(IEntity node) {\r
-               return node.getAtMostOneRelatedObject(parentRelation);\r
-       }\r
-       \r
-       public Point3d getLocalFromWorld(IEntity node, Point3d worldCoord) {\r
-       IEntity parent = getParent(node);\r
-        if (parent == null) {// this is a rootnode ( has no transformation) \r
-               return worldCoord;\r
-        }\r
-\r
-        Point3d local = getLocalFromWorld2(parent,worldCoord);\r
-        return local;\r
-    }\r
-    \r
-    \r
-    private Point3d getLocalFromWorld2(IEntity node, Point3d worldCoord) {\r
-       IEntity parent = getParent(node);\r
-        if (parent == null) {// this is a root node ( has no transformation) \r
-               return worldCoord;\r
-        }\r
-\r
-        Point3d local = getLocalFromWorld2(parent,worldCoord);\r
-        if (node.hasStatement(Resources.g3dResource.HasLocalPosition))\r
-            local.sub(G3DTools.getPoint(node.getSingleRelatedObject(Resources.g3dResource.HasLocalPosition)));\r
-        if (node.hasStatement(Resources.g3dResource.HasLocalOrientation)) {\r
-            Quat4d q = new Quat4d();\r
-            q.set(G3DTools.getOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation)));\r
-            q.inverse();\r
-            MathTools.rotate(q, local, local);\r
-        }\r
-        return local;\r
-    }\r
-    \r
-    public Point3d getWorldFromLocal(IEntity node,Point3d localCoord) {\r
-       IEntity parent = getParent(node);\r
-        if (parent == null) // this is a rootnode ( has no transformation)\r
-            return localCoord;\r
-        return getWorldFromLocal2(parent, localCoord);\r
-    }\r
-    \r
-    private Point3d getWorldFromLocal2(IEntity node,Point3d localCoord) {\r
-       \r
-        if (node.hasStatement(Resources.g3dResource.HasLocalOrientation)) {\r
-            Quat4d q = new Quat4d();\r
-            q.set(G3DTools.getOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation)));\r
-            MathTools.rotate(q, localCoord, localCoord);\r
-        }\r
-        if (node.hasStatement(Resources.g3dResource.HasLocalPosition))\r
-            localCoord.add(G3DTools.getPoint(node.getSingleRelatedObject(Resources.g3dResource.HasLocalPosition)));\r
-        \r
-        IEntity parent = getParent(node);\r
-        if (parent == null) // this is a rootnode ( has no transformation)\r
-            return localCoord;\r
-        \r
-        return getWorldFromLocal2(parent,localCoord);\r
-    }\r
-    \r
-    \r
-    public AxisAngle4d getLocalFromWorld(IEntity node, AxisAngle4d worldRot) {\r
-       IEntity parent = getParent(node);\r
-       if (parent == null) // this is a rootnode ( has no transformation)\r
-            return worldRot;\r
-\r
-        AxisAngle4d local = getLocalFromWorld2(parent,worldRot);\r
-\r
-        return local;\r
-    }\r
-    \r
-    private AxisAngle4d getLocalFromWorld2(IEntity node, AxisAngle4d worldRot) {\r
-       IEntity parent = getParent(node);\r
-        if (parent == null) // this is a rootnode ( has no transformation)\r
-            return worldRot;\r
-        AxisAngle4d local  = getLocalFromWorld2(parent,worldRot);\r
-        \r
-        if (node.hasStatement(Resources.g3dResource.HasLocalOrientation)) {\r
-            Quat4d q = new Quat4d();\r
-            q.set(G3DTools.getOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation)));\r
-            q.inverse();\r
-            Quat4d q2 = new Quat4d();\r
-            q2.set(local);\r
-            q.mul(q2);\r
-            local.set(q);\r
-        }\r
-\r
-        return local;\r
-    }\r
-    \r
-    public AxisAngle4d getWorldFromLocal(IEntity node,AxisAngle4d localRot) {\r
-       IEntity parent = getParent(node);\r
-       if (parent == null)\r
-               return localRot;\r
-\r
-        return getWorldFromLocal2(parent,localRot);\r
-    }\r
-    \r
-    private AxisAngle4d getWorldFromLocal2(IEntity node,AxisAngle4d localRot) {\r
-       \r
-        //System.out.print("wtl " + node.getResource() + " " + localCoord);\r
-        if (node.hasStatement(Resources.g3dResource.HasLocalOrientation)) {\r
-            Quat4d q = new Quat4d();\r
-            q.set(G3DTools.getOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation)));\r
-            Quat4d q2 = new Quat4d();\r
-            q2.set(localRot);\r
-            q.mul(q2);\r
-            localRot.set(q);\r
-        }\r
-        \r
-        IEntity parent = getParent(node);\r
-        if (parent == null) // this is a rootnode ( has no transformation)\r
-            return localRot;\r
-        \r
-        //System.out.println(" " + localCoord);\r
-        return getWorldFromLocal2(parent,localRot);\r
-    }\r
-    \r
-    public Point3d getLocalFromWorldR(IEntity node, Point3d worldCoord) {\r
-       \r
-        Point3d local = getLocalFromWorldR(null,worldCoord);\r
-        if (node.hasStatement(Resources.g3dResource.HasLocalOrientation)) {\r
-            Quat4d q = new Quat4d();\r
-            q.set(G3DTools.getOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation)));\r
-            q.inverse();\r
-            MathTools.rotate(q, local, local);\r
-        }\r
-        \r
-        IEntity parent = getParent(node);\r
-        if (parent == null) // this is a rootnode ( has no transformation)\r
-            return worldCoord;\r
-        \r
-        return local;\r
-    }\r
-    \r
-    public Point3d getWorldFromLocalR(IEntity node,Point3d localCoord) {\r
-       \r
-        if (node.hasStatement(Resources.g3dResource.HasLocalOrientation)) {\r
-            Quat4d q = new Quat4d();\r
-            q.set(G3DTools.getOrientation(node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation)));\r
-            MathTools.rotate(q, localCoord, localCoord);\r
-        } \r
-        \r
-        IEntity parent = getParent(node);\r
-        if (parent == null) // this is a rootnode ( has no transformation)\r
-            return localCoord;\r
-        \r
-        return getWorldFromLocalR(parent,localCoord);\r
-    }\r
-    \r
-    /**\r
-     * Updates transformations of all children of given node\r
-     * @param node\r
-     */\r
-    public void propagateTransformChange(IEntity node) {\r
-        Collection<IEntity> children = node.getRelatedObjects(childRelation);\r
-       IEntity wp = node.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldPosition);\r
-        IEntity wr = node.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldOrientation);\r
-        Quat4d rot = new Quat4d();\r
-        if (wr != null)\r
-            rot.set(G3DTools.getOrientation(wr));\r
-        else\r
-            rot.w = 1.0;\r
-        Point3d pos = new Point3d();\r
-        if (wp != null)\r
-            pos = G3DTools.getPoint(wp);\r
-        if (DEBUG) {\r
-               if (wr != null)\r
-                       System.out.println("propagate transform " + node.getResource() + " " + pos + " " + G3DTools.getOrientation(wr));\r
-               else\r
-                       System.out.println("propagate transform " + node.getResource() + " " + pos);\r
-        }\r
-        for (IEntity n : children) {\r
-            IEntity lPos = n.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalPosition);\r
-            IEntity lRot = n.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalOrientation);\r
-            if (DEBUG) System.out.print(n);\r
-            if (lRot != null) {\r
-               AxisAngle4d la = G3DTools.getOrientation(lRot);\r
-                AxisAngle4d wa = getWorldFromLocal(n, la);\r
-                IEntity wo = n.getSingleRelatedObject(Resources.g3dResource.HasWorldOrientation);\r
-                G3DTools.setOrientation(wo,wa);\r
-                storeProperty(wo.getResource(), wa);\r
-            }\r
-            if (lPos != null) {\r
-                Point3d lp = G3DTools.getPoint(lPos);\r
-                if (DEBUG) System.out.println(lp);\r
-                MathTools.rotate(rot, lp, lp);\r
-                lp.add(pos);\r
-                IEntity nwp = n.getSingleRelatedObject(Resources.g3dResource.HasWorldPosition);\r
-                G3DTools.setTuple3(nwp, lp);\r
-                if (DEBUG) System.out.print(" " + lp);\r
-                storeProperty(nwp.getResource(), lp);\r
-            }\r
-            if (DEBUG) System.out.println();\r
-            propagateTransformChange(n);\r
-            \r
-        }\r
-    }\r
-    \r
-    /**\r
-     * Updates transformation of one child node without changing its local transformation.\r
-     * @param parent\r
-     * @param node\r
-     */\r
-    public void propagateLocalTransformChange(IEntity parent, IEntity node) {\r
-        //Collection<IEntity> children = parent.getRelatedObjects(childRelation);\r
-       IEntity parentWP = parent.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldPosition);\r
-        IEntity parentWR = parent.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldOrientation);\r
-        Quat4d parentWRot = new Quat4d();\r
-        if (parentWR != null) {\r
-            parentWRot.set(G3DTools.getOrientation(parentWR));\r
-           \r
-        } else\r
-            parentWRot.w = 1.0;\r
-        Point3d parentWPos = new Point3d();\r
-        if (parentWP != null) {\r
-            parentWPos = G3DTools.getPoint(parentWP);\r
-        }\r
-        if (DEBUG) {\r
-               if (parentWR != null)\r
-                       System.out.println("propagate transform " + parent.getResource() + " " + parentWPos + " " + G3DTools.getOrientation(parentWR));\r
-               else\r
-                       System.out.println("propagate transform " + parent.getResource() + " " + parentWPos);\r
-        }\r
-        //for (IEntity n : children) {\r
-        //     if (!n.equals(node))\r
-        //             continue;\r
-            IEntity lPos = node.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalPosition);\r
-            IEntity lRot = node.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalOrientation);\r
-            if (DEBUG) System.out.print(node);\r
-            if (lRot != null) {\r
-               AxisAngle4d aa = G3DTools.getOrientation(lRot);\r
-               storeProperty(lRot.getResource(), aa);\r
-                AxisAngle4d la = getWorldFromLocal(node, aa);\r
-                IEntity wo = node.getSingleRelatedObject(Resources.g3dResource.HasWorldOrientation);\r
-                G3DTools.setOrientation(wo,la);\r
-                storeProperty(wo.getResource(), la);\r
-            }\r
-            if (lPos != null) {\r
-                Point3d lp = G3DTools.getPoint(lPos);\r
-                storeProperty(lPos.getResource(), lp);\r
-                MathTools.rotate(parentWRot, lp, lp);\r
-                lp.add(parentWPos);\r
-                IEntity nwp = node.getSingleRelatedObject(Resources.g3dResource.HasWorldPosition);\r
-                G3DTools.setTuple3(nwp, lp);\r
-                storeProperty(nwp.getResource(), lp);\r
-            }\r
-            if (DEBUG) System.out.println();\r
-            propagateTransformChange(node);\r
-            \r
-        }\r
-//    }\r
-    \r
-    public static void resetTransformation(IEntity shape) {\r
-               Graph graph = shape.getGraph();\r
-               if (shape.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalPosition) == null) {\r
-\r
-                       // LocalPosition p = LocalPosition.createDefault(graph);\r
-                       Position p = Position.createDefault(graph);\r
-                       shape.addStatement(Resources.g3dResource.HasLocalPosition, p);\r
-                       // WorldPosition p2 = WorldPosition.createDefault(graph);\r
-                       Position p2 = Position.createDefault(graph);\r
-                       shape.addStatement(Resources.g3dResource.HasWorldPosition, p2);\r
-                       p.setX(new double[] { 0.0 });\r
-                       p.setY(new double[] { 0.0 });\r
-                       p.setZ(new double[] { 0.0 });\r
-\r
-                       p2.setX(new double[] { 0.0 });\r
-                       p2.setY(new double[] { 0.0 });\r
-                       p2.setZ(new double[] { 0.0 });\r
-\r
-               } else {\r
-                       G3DTools.setTuple3(shape.getSingleRelatedObject(Resources.g3dResource.HasLocalPosition), 0.0, 0.0, 0.0);\r
-                       G3DTools.setTuple3(shape.getSingleRelatedObject(Resources.g3dResource.HasWorldPosition), 0.0, 0.0, 0.0);\r
-               }\r
-               if (shape.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalOrientation) == null) {\r
-\r
-                       // LocalOrientation r = LocalOrientationFactory.create(graph);\r
-                       Orientation r = Orientation.createDefault(graph);\r
-                       shape.addStatement(Resources.g3dResource.HasLocalOrientation, r);\r
-                       // WorldOrientation r2 = WorldOrientationFactory.create(graph);\r
-                       Orientation r2 = Orientation.createDefault(graph);\r
-                       shape.addStatement(Resources.g3dResource.HasWorldOrientation, r2);\r
-                       r.setAngle(new double[] { 0.0 });\r
-                       r.setX(new double[] { 1.0 });\r
-                       r.setY(new double[] { 0.0 });\r
-                       r.setZ(new double[] { 0.0 });\r
-                       r2.setAngle(new double[] { 0.0 });\r
-                       r2.setX(new double[] { 1.0 });\r
-                       r2.setY(new double[] { 0.0 });\r
-                       r2.setZ(new double[] { 0.0 });\r
-\r
-               } else {\r
-                       G3DTools.setOrientation(shape.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation),\r
-                                       new AxisAngle4d(0.0, 1.0, 0.0, 0.0));\r
-                       G3DTools.setOrientation(shape.getSingleRelatedObject(Resources.g3dResource.HasWorldOrientation),\r
-                                       new AxisAngle4d(0.0, 1.0, 0.0, 0.0));\r
-               }\r
-       }\r
-    \r
-    /**\r
-     * Updates transformation of one child node without changing its world transformation.\r
-     * @param parent\r
-     * @param node\r
-     */\r
-    public void propagateWorldTransformChange(IEntity parent, IEntity node) {\r
-        //Collection<IEntity> children = parent.getRelatedObjects(childRelation);\r
-       IEntity parentWP = parent.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldPosition);\r
-        IEntity parentWR = parent.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldOrientation);\r
-        Quat4d parentWQuat = new Quat4d();\r
-        if (parentWR != null) {\r
-            parentWQuat.set(G3DTools.getOrientation(parentWR));\r
-        }\r
-        else\r
-            parentWQuat.w = 1.0;\r
-        Point3d parentWPos = new Point3d();\r
-        if (parentWP != null) {\r
-            parentWPos = G3DTools.getPoint(parentWP);\r
-        }\r
-        if (DEBUG){\r
-               if (parentWR != null) \r
-                   System.out.println("propagate transform " + parent.getResource() + " " + parentWPos + " " + G3DTools.getOrientation(parentWR));\r
-               else\r
-                       System.out.println("propagate transform " + parent.getResource() + " " + parentWPos);\r
-        }\r
-        //for (IEntity n : children) {\r
-      //       if (!n.equals(node))\r
-      //               continue;\r
-            IEntity wPos = node.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldPosition);\r
-            IEntity wRot = node.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldOrientation);\r
-            \r
-            if (DEBUG) System.out.print(node);\r
-            if (wRot != null) {\r
-               AxisAngle4d aa = G3DTools.getOrientation(wRot);\r
-               storeProperty(wRot.getResource(), aa);\r
-                AxisAngle4d la = getLocalFromWorld(node, aa);\r
-                IEntity lRot = node.getSingleRelatedObject(Resources.g3dResource.HasLocalOrientation);\r
-                G3DTools.setOrientation(lRot,la);\r
-                storeProperty(lRot.getResource(), la);\r
-            }\r
-            if (wPos != null) {\r
-                Point3d lp = G3DTools.getPoint(wPos);\r
-                storeProperty(wPos.getResource(), lp);\r
-                lp.sub(parentWPos);\r
-                parentWQuat.inverse();     \r
-                MathTools.rotate(parentWQuat, lp, lp);\r
-                IEntity lPos = node.getSingleRelatedObject(Resources.g3dResource.HasLocalPosition);\r
-                G3DTools.setTuple3(lPos, lp);\r
-                storeProperty(lPos.getResource(), lp);\r
-            }\r
-            if (DEBUG) System.out.println();\r
-            propagateTransformChange(node);\r
-            \r
- //       }\r
-    }\r
-        \r
-    public boolean transformationUpdate(Graph graph, Resource resource) {\r
-       \r
-       //resources.startTransaction("transformationUpdate");\r
-       IEntity entity = EntityFactory.create(graph,resource);\r
-       return transformationUpdate(entity);\r
-    }\r
-    \r
-    public boolean transformationUpdate(IEntity node) {\r
-       if (DEBUG) System.out.println("Node transformation update " + node.getResource());\r
-       IEntity worldPos = node.getSingleRelatedObject(Resources.g3dResource.HasWorldPosition);\r
-       IEntity localPos = node.getSingleRelatedObject(Resources.g3dResource.HasLocalPosition);\r
-       IEntity worldOr = node.getAtMostOneRelatedObject(Resources.g3dResource.HasWorldOrientation);\r
-       IEntity localOr = node.getAtMostOneRelatedObject(Resources.g3dResource.HasLocalOrientation);\r
-       \r
-       Tuple3d worldP =G3DTools.getPoint(worldPos);\r
-       Tuple3d localP = G3DTools.getPoint(localPos);\r
-\r
-       AxisAngle4d worldR = null;\r
-       AxisAngle4d localR = null;\r
-       if (worldOr != null) {\r
-               worldR = G3DTools.getOrientation(worldOr);\r
-               localR = G3DTools.getOrientation(localOr);\r
-       }\r
-       \r
-       boolean changed = false;\r
-       if (localP != null && worldP != null) {\r
-               Tuple3d cachedWorldP = (Tuple3d)getProperty(worldPos.getResource());\r
-               Tuple3d cachedLocalP = (Tuple3d)getProperty(localPos.getResource());\r
-               boolean changedLocalP = false;\r
-               boolean changedWorldP = false;\r
-               if (cachedLocalP == null)\r
-                       changedLocalP = true;\r
-               else if (changed(cachedLocalP,localP))\r
-                       changedLocalP = true;\r
-\r
-               if (cachedWorldP == null) {\r
-                       changedWorldP = true;\r
-               } else if (changed(cachedWorldP,worldP)){\r
-                       changedWorldP = true;\r
-               }\r
-               if (changedLocalP) {\r
-                       storeProperty(localPos.getResource(), localP);\r
-                       Tuple3d p = getWorldFromLocal(node, new Point3d(localP));\r
-                       storeProperty(worldPos.getResource(), p);\r
-                       G3DTools.setTuple3(worldPos, p);\r
-                       if (DEBUG) System.out.println("Node changed local: wp " + worldP + " lp " + p + " old " + cachedLocalP);\r
-                       changed = true;\r
-               } else if (changedWorldP) {\r
-                       storeProperty(worldPos.getResource(), worldP);\r
-                       Tuple3d p = getLocalFromWorld(node, new Point3d(worldP));\r
-                       G3DTools.setTuple3(localPos, p);\r
-                       storeProperty(localPos.getResource(), p);\r
-                       if (DEBUG) System.out.println("Node changed world: wp " + worldP + " lp " + p + " old " + cachedWorldP);\r
-                       changed = true;\r
-               }\r
-       }\r
-\r
-       if (localR != null || worldR != null) {\r
-               AxisAngle4d cachedWorldR = (AxisAngle4d)getProperty(worldOr.getResource());\r
-               AxisAngle4d cachedLocalR = (AxisAngle4d)getProperty(localOr.getResource());\r
-               boolean changedLocalR = false;\r
-               boolean changedWorldR = false;\r
-\r
-               if (cachedLocalR == null)\r
-                       changedLocalR = true;\r
-               else if (changed(cachedLocalR,localR))\r
-                       changedLocalR = true;\r
-\r
-               if (cachedWorldR == null) {\r
-                       changedWorldR = true;\r
-               } else if (changed(cachedWorldR,worldR)){\r
-                       changedWorldR = true;\r
-               }\r
-\r
-               if (changedLocalR) {\r
-                       storeProperty(localOr.getResource(), localR);\r
-                       AxisAngle4d p = getWorldFromLocal(node, new AxisAngle4d(localR));\r
-                       G3DTools.setOrientation(worldOr, p);\r
-                       storeProperty(worldOr.getResource(), p);\r
-                       if (DEBUG) System.out.println("Node changed localR: wr " + p + " lr " + localR + " old " + cachedLocalR);\r
-                       changed = true;\r
-               } else if (changedWorldR) {\r
-                       storeProperty(worldOr.getResource(), worldR);\r
-                       AxisAngle4d p = getLocalFromWorld(node, new AxisAngle4d(worldR));\r
-                       G3DTools.setOrientation(localOr, p);\r
-                       storeProperty(localOr.getResource(), p);\r
-                       if (DEBUG) System.out.println("Node changed worldR: wr " + worldR + " lr " + p + " old " + cachedWorldR);\r
-                       changed = true;\r
-               } \r
-       }\r
-\r
-       if (changed)\r
-               propagateTransformChange(node);\r
-       else if (DEBUG)\r
-               System.out.println("No Node transformation change detected " + node.getResource());\r
-       return changed;\r
-    }\r
-    \r
-    public static boolean changed(Tuple3d v1, Tuple3d v2) {\r
-        Vector3d t = new Vector3d(v1);\r
-        t.sub(v2);\r
-        return t.lengthSquared() > 0.00001;\r
-    }\r
-    \r
-    public static boolean changed (double d1 , double d2) {\r
-       return (Math.abs(d1 - d2) > 0.00001 );\r
-               \r
-    }\r
-    \r
-    public static boolean changed(AxisAngle4d aa1, AxisAngle4d aa2) {\r
-        if (Math.abs(aa1.angle - aa2.angle) > 0.00001)\r
-            return true;\r
-        Vector3d t1 = new Vector3d(aa1.x-aa2.x,aa1.y-aa2.y,aa1.z-aa2.z);\r
-        if (t1.lengthSquared() > 0.00001) {\r
-               if (Math.abs(aa1.angle) < 0.0001)\r
-                       return false;\r
-               return true;\r
-        }\r
-        return false;\r
-    }\r
-\r
-    \r
-    private HashMap<Object, Object> properties = new HashMap<Object, Object>();\r
-    \r
-    public Object getProperty(Object key) {\r
-        return properties.get(key);\r
-    }\r
-    \r
-    public void storeProperty(Object key, Object value) {\r
-        properties.put(key, value);\r
-    }\r
-    \r
-    \r
-    \r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/VecmathJmeTools.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/VecmathJmeTools.java
deleted file mode 100644 (file)
index 21cfcff..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import javax.vecmath.Color4f;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-\r
-public class VecmathJmeTools {\r
-       \r
-       public static javax.vecmath.Vector3f get(com.jme.math.Vector3f v) {\r
-               return new javax.vecmath.Vector3f(v.x,v.y,v.z);\r
-       }\r
-       \r
-       public static javax.vecmath.Vector3d getD(com.jme.math.Vector3f v) {\r
-               return new javax.vecmath.Vector3d(v.x,v.y,v.z);\r
-       }\r
-       \r
-       public static com.jme.math.Vector3f get(javax.vecmath.Tuple3f v) {\r
-               return new com.jme.math.Vector3f(v.x,v.y,v.z);\r
-       }\r
-       \r
-       public static com.jme.math.Vector3f get(javax.vecmath.Tuple3d v) {\r
-               return new com.jme.math.Vector3f((float)v.x,(float)v.y,(float)v.z);\r
-       }\r
-       \r
-       public static com.jme.math.Matrix3f get(javax.vecmath.Matrix3d m) {\r
-               return new com.jme.math.Matrix3f((float)m.m00,(float)m.m01,(float)m.m02,(float)m.m10,(float)m.m11,(float)m.m12,(float)m.m20,(float)m.m21,(float)m.m22);\r
-       }\r
-       \r
-       public static javax.vecmath.Quat4f get(com.jme.math.Quaternion v) {\r
-               return new javax.vecmath.Quat4f(v.x,v.y,v.z,v.w);\r
-       }\r
-       \r
-       public static javax.vecmath.Quat4d getD(com.jme.math.Quaternion v) {\r
-               return new javax.vecmath.Quat4d(v.x,v.y,v.z,v.w);\r
-       }\r
-       \r
-       \r
-       public static com.jme.math.Quaternion get(javax.vecmath.Quat4f v) {\r
-               return new com.jme.math.Quaternion(v.x,v.y,v.z,v.w);\r
-       }\r
-       \r
-       public static com.jme.math.Quaternion get(javax.vecmath.Quat4d v) {\r
-               return new com.jme.math.Quaternion((float)v.x,(float)v.y,(float)v.z,(float)v.w);\r
-       }\r
-       \r
-       public static com.jme.math.Quaternion get(javax.vecmath.AxisAngle4f aa) {\r
-               javax.vecmath.Quat4f v = new javax.vecmath.Quat4f();\r
-               v.set(aa);\r
-               return new com.jme.math.Quaternion(v.x,v.y,v.z,v.w);\r
-               \r
-       }\r
-       \r
-       public static com.jme.math.Quaternion get(javax.vecmath.AxisAngle4d aa) {\r
-               javax.vecmath.Quat4f v = new javax.vecmath.Quat4f();\r
-               v.set(aa);\r
-               return new com.jme.math.Quaternion(v.x,v.y,v.z,v.w);\r
-               \r
-       }\r
-       \r
-       public static ColorRGBA get(Color4f c) {\r
-               return new ColorRGBA(c.x,c.y,c.z,c.w);\r
-       }\r
-       \r
-       public static Color4f get(ColorRGBA c) {\r
-               return new Color4f(c.r,c.g,c.b,c.a);\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/VisualizationScheduler.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/VisualizationScheduler.java
deleted file mode 100644 (file)
index e7011eb..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.ArrayList;\r
-\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.ui.PlatformUI;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-\r
-/**\r
- * TODO : This is a copy-paste from old proconf.utils plug-ing:\r
- *             : PreferencePage is not ported,\r
- *             : Using Webmon ?\r
- * \r
- * \r
- * VisualizationScheduler is singleton class that schedules\r
- * visualization redraws. \r
- * \r
- * Scheduler has three behaviour patters: \r
- * \r
- * ONCE : Redraws all visualizations one by one and then sleeps for\r
- *        a while so that visualizations won't use all available cpu-time.\r
- *    \r
- * ALWAYS : Redraws one visualization and sleeps before updating next\r
- *          visualization.\r
- *    \r
- * OFF : uses asyncExec busy-loop (doesn't block eclipse, but other applications may suffer) \r
- * \r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class VisualizationScheduler implements Runnable{\r
-    private static VisualizationScheduler instance;\r
-    private Display display;\r
-    private ArrayList<Runnable> visualizations;\r
-    private boolean isDisposed = false;\r
-    private boolean stateFlag = false;\r
-    private static int sleepTime = 40;\r
-    private int index = 0;\r
-    \r
-    public enum SleepType{ONCE,ALWAYS,OFF};\r
-    \r
-    private static SleepType sleepType = SleepType.ONCE;\r
-    \r
-    private VisualizationScheduler() {\r
-        visualizations = new ArrayList<Runnable>();\r
-        display = PlatformUI.getWorkbench().getDisplay();\r
-        //sleepTime = UtilsPlugin.getDefault().getPreferenceStore().getInt(PreferenceConstants.SLEEP_TIME);\r
-        //sleepType = SleepType.valueOf(UtilsPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.SLEEP_TYPE));\r
-        run();\r
-    }\r
-\r
-    /**\r
-     * Scheduler's run loop<br>\r
-     * <br>\r
-     * Loop contains two stages:<br>\r
-     * In the first stage scheduler runs asyncExec for each visualization\r
-     * and after that it runs itself with asyncExec.<br>\r
-     * In the second stage scheduler runs itself with timerExec which allows OS to run it's own code.\r
-     */\r
-    public void run() {\r
-        if (!isDisposed && !display.isDisposed() && !PlatformUI.getWorkbench().isClosing()) {\r
-            switch(sleepType) {\r
-            case ALWAYS:\r
-               stateFlag = !stateFlag;\r
-                               if (stateFlag) {\r
-                                       if (visualizations.size() > 0) {\r
-                                               if (index >= visualizations.size())\r
-                                                       index = 0;\r
-                                               Runnable scene = visualizations.get(index);\r
-                                               try {\r
-                                                       display.asyncExec(scene);\r
-                                               } catch (Exception e) {\r
-                                                       ErrorLogger.defaultLogWarning("Scheduler exception", e);\r
-                                               }\r
-                                               index++;\r
-                                       }\r
-                                       display.asyncExec(this);\r
-                               } else {\r
-                                       display.timerExec(sleepTime, this);\r
-                               }\r
-               break;\r
-            case ONCE: \r
-               stateFlag = !stateFlag;\r
-               if (stateFlag) {\r
-                       for (Runnable scene : visualizations) {\r
-                       try {\r
-                               display.asyncExec(scene);\r
-                       } catch (Exception e) {\r
-                               ErrorLogger.defaultLogWarning("Scheduler exception",e);\r
-                       }\r
-                       }\r
-                       display.asyncExec(this);\r
-               } else {\r
-                       display.timerExec(sleepTime,this);\r
-               }\r
-               break;\r
-            case OFF: \r
-               for (Runnable scene : visualizations) {\r
-                       try {\r
-                       display.asyncExec(scene);\r
-                       } catch (Exception e) {\r
-                               ErrorLogger.defaultLogWarning("Scheduler exception",e);\r
-                       }\r
-               }\r
-               display.asyncExec(this);\r
-               break;\r
-            }\r
-        }      \r
-    }\r
-    \r
-    /**\r
-     * Adds visualization into scheduler\r
-     * @param scene\r
-     */\r
-    public void addVisualization(Runnable scene) {\r
-        visualizations.add(scene);\r
-    }\r
-    \r
-    /**\r
-     * Removes visualization from scheduler\r
-     * @param scene\r
-     */\r
-    public void removeVisualization(Runnable scene) {\r
-        visualizations.remove(scene);\r
-    }\r
-    \r
-    /**\r
-     * disposes scheduler.\r
-     *\r
-     */\r
-    public void dispose() {\r
-        isDisposed = true;\r
-    } \r
-    \r
-    /**\r
-     * @return scheduler's instance\r
-     */\r
-    public static VisualizationScheduler getInstance() {\r
-        if (instance == null)\r
-            instance = new VisualizationScheduler();\r
-        \r
-        return instance;\r
-    }\r
-\r
-    /**\r
-     * @return the sleep time of the scheduler\r
-     */\r
-    public int getSleepTime() {\r
-        return sleepTime;\r
-    }\r
-\r
-    /**\r
-     * <p>\r
-     * Sets scheduler's sleep time. Larger sleep time gives more\r
-     * cpu time to other applications, but makes visualizations less\r
-     * responsive.\r
-     * </p>\r
-     *  \r
-     * @param sleepTime\r
-     */\r
-    public static void setSleepTime(int time) {\r
-        sleepTime = time;\r
-    }\r
-\r
-//     public boolean isSleepAlways() {\r
-//             return sleepAlways;\r
-//     }\r
-\r
-       /**\r
-        * if this flag is set scheludler gives time to other aplications\r
-        * between each visualization update. Otherwise all visualizations are updated in row and\r
-        * then priority is given to other applications.\r
-        * @param sleepAlways\r
-        */\r
-//     public static void setSleepAlways(boolean sleep) {\r
-//             sleepAlways = sleep;\r
-//     }  \r
-    \r
-    public static SleepType getSleepType() {\r
-       return sleepType;\r
-    }\r
-    \r
-    public static void setSleepType(SleepType s) {\r
-       sleepType = s;\r
-    }\r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/JmeComposite.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/JmeComposite.java
deleted file mode 100644 (file)
index 5cff3ff..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.common;\r
-\r
-\r
-import java.util.logging.LogManager;\r
-\r
-import org.eclipse.core.runtime.Path;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.ControlAdapter;\r
-import org.eclipse.swt.events.ControlEvent;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.opengl.GLCanvas;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.base.ResourceTextureCache;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import com.jme.renderer.Renderer;\r
-import com.jme.renderer.lwjgl.LWJGLRenderer;\r
-import com.jme.scene.Node;\r
-import com.jme.system.DisplaySystem;\r
-import com.jme.system.swt.SWTDisplaySystem;\r
-import com.jme.util.TextureManager;\r
-\r
-\r
-public class JmeComposite extends Composite {\r
-       protected Node rootNode = new Node("root");\r
-       private SWTDisplaySystem displaySystem;\r
-       protected GLCanvas renderingCanvas;\r
-       private JmeRenderingComponent component;\r
-       \r
-       public JmeComposite(Composite parent, JmeRenderingComponent component) {\r
-               super(parent,SWT.NONE);\r
-               if (component == null)\r
-                       throw new NullPointerException("Rendering component must not be null.");\r
-               disableLog();\r
-               //LoggingSystem.getLogger().setLevel(Level.OFF);\r
-               this.component = component;\r
-               this.setLayout(new FillLayout());\r
-               displaySystem = (SWTDisplaySystem)DisplaySystem.getDisplaySystem("SWT");\r
-               renderingCanvas = displaySystem.createCanvas(640, 480, this);\r
-        renderingCanvas.addControlListener(new ControlAdapter() {\r
-            public void controlResized(ControlEvent e) {\r
-                resize();\r
-            }\r
-        });\r
-        \r
-        \r
-       }\r
-       \r
-       private void disableLog() {\r
-               //URL url = FileLocator.find(org.simantics.proconf.g3d.Activator.getDefault().getBundle(),new Path("logging.properties"),null);\r
-               \r
-               try {\r
-                       LogManager.getLogManager().readConfiguration(org.simantics.proconf.g3d.Activator.getDefault().openStream(new Path("logging.properties")));\r
-               } catch (Exception e) {\r
-                       ErrorLogger.defaultLogError(e);\r
-               }\r
-       }\r
-       \r
-       public void resize() {\r
-               displaySystem.setCurrent();\r
-        LWJGLRenderer renderer = (LWJGLRenderer) displaySystem.getRenderer();\r
-        if (renderer!= null) { \r
-            Rectangle r = new Rectangle(renderingCanvas.getClientArea().x,renderingCanvas.getClientArea().y, renderingCanvas.getClientArea().width, renderingCanvas.getClientArea().height );\r
-            if (r.width > 0 && r.height > 0)\r
-            renderer.reinit(r.width, r.height);\r
-            component.resize(r.width, r.height);\r
-        }\r
-    }\r
-       \r
-       public GLCanvas getCanvas() { \r
-        return renderingCanvas;\r
-    }\r
-       \r
-       public Renderer getRenderer() {\r
-               return displaySystem.getRenderer();\r
-       }\r
-       \r
-       public void initGL() {\r
-               component.init(displaySystem);\r
-       }\r
-       \r
-       public void dispose() {\r
-               LWJGLRenderer renderer = (LWJGLRenderer) displaySystem.getRenderer();\r
-               renderer.clearVBOCache();\r
-               renderer.clearQueue();\r
-               renderer.clearStatistics();\r
-               renderingCanvas.dispose();\r
-               if (displaySystem.destroy()) {\r
-                       \r
-                       TextureManager.doTextureCleanup();\r
-                       TextureManager.clearCache();\r
-                       ResourceTextureCache.getInstance().clear();\r
-               }\r
-               super.dispose();\r
-       }\r
-       \r
-       public DisplaySystem getDisplaySystem() {\r
-               return displaySystem;\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/JmeSinglePassRenderingComponent.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/JmeSinglePassRenderingComponent.java
deleted file mode 100644 (file)
index fb9aff6..0000000
+++ /dev/null
@@ -1,411 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.common;\r
-\r
-import java.net.URL;\r
-\r
-import org.eclipse.core.runtime.FileLocator;\r
-import org.eclipse.core.runtime.Path;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.preferences.PreferenceConstants;\r
-\r
-import com.jme.image.Texture;\r
-import com.jme.light.DirectionalLight;\r
-import com.jme.math.Vector3f;\r
-import com.jme.renderer.Camera;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.pass.BasicPassManager;\r
-import com.jme.renderer.pass.RenderPass;\r
-import com.jme.renderer.pass.ShadowedRenderPass;\r
-import com.jme.renderer.swt.SWTRenderer;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.Spatial;\r
-import com.jme.scene.Text;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.LightState;\r
-import com.jme.scene.state.TextureState;\r
-import com.jme.scene.state.WireframeState;\r
-import com.jme.scene.state.ZBufferState;\r
-import com.jme.system.DisplaySystem;\r
-import com.jme.util.TextureManager;\r
-import com.jme.util.Timer;\r
-import com.jme.util.geom.Debugger;\r
-import com.jmex.effects.glsl.BloomRenderPass;\r
-import com.jmex.effects.glsl.SketchRenderPass;\r
-\r
-\r
-public class JmeSinglePassRenderingComponent extends JmeRenderingComponent {\r
-       protected DisplaySystem displaySystem;\r
-       protected Timer timer;\r
-       protected Node rootNode = new Node("Root");\r
-       protected Node shadowRootNode = new Node("Shadow");\r
-       protected Node noCastShadowRootNode = new Node("No Cast Shadow");\r
-       protected Node noShadowRootNode = new Node("No Shadow");\r
-       protected Camera cam;\r
-       protected float near = .1f;\r
-       protected float far = 3000f;\r
-       protected float fov = 55f;\r
-    \r
-       protected int projectionPolicy;\r
-    \r
-    /** The root node of our text. */\r
-       protected Node orthoNode = new Node("ortho");\r
-\r
-    /** Displays all the lovely information at the bottom. */\r
-    protected Text fps;\r
-    protected Text debug;\r
-    protected String debugText  = "";\r
-    public static String fontLocation = "data/defaultfont.tga";//AppProperties.PATH_DEFAULT_FONT;\r
-    \r
-    \r
-    protected BasicPassManager pManager = new BasicPassManager();\r
-    \r
-    private boolean showBounds = false;\r
-    private boolean showNormals = false;\r
-    private WireframeState ws = null;\r
-    \r
-    private boolean projectionUpdated = false;\r
-    \r
-       public JmeSinglePassRenderingComponent() {\r
-               \r
-       }\r
-       \r
-       public void init(DisplaySystem displaySystem) {\r
-               this.displaySystem = displaySystem;\r
-               cam = displaySystem.getRenderer().createCamera(\r
-                displaySystem.getRenderer().getWidth(), displaySystem.getRenderer().getHeight());\r
-               displaySystem.getRenderer().setBackgroundColor(new ColorRGBA(0.2f,0.2f,0.2f,0.f));//(0.357F, 0.647F, 0.890F, 1.0F));\r
-        displaySystem.getRenderer().getQueue().setTwoPassTransparency(true);\r
-               cam.setFrustumPerspective(fov,\r
-                (float) displaySystem.getRenderer().getWidth()/\r
-                (float) displaySystem.getRenderer().getHeight(),near, far);\r
-        projectionPolicy = PERSPECTIVE_PROJECTION;\r
-        Vector3f loc = new Vector3f(0.0f, 0.0f, 10.0f);\r
-        Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);\r
-        Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);\r
-        Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);\r
-        /** Move our camera to a correct place and orientation. */\r
-        cam.setFrame(loc, left, up, dir);\r
-        /** Signal that we've changed our camera's location/frustum. */\r
-        cam.update();\r
-        displaySystem.getRenderer().setCamera(cam);\r
-        timer = Timer.getTimer();\r
-        displaySystem.setTitle("ShapeEditor");\r
-        displaySystem.getRenderer().enableStatistics(true);\r
-        \r
-        initRoot();\r
-       }\r
-       \r
-       protected Texture loadFontTexture() {\r
-               URL url = FileLocator.find(org.simantics.proconf.g3d.Activator.getDefault().getBundle(),new Path(fontLocation),null);\r
-        return TextureManager.loadTexture(url, Texture.MM_LINEAR,\r
-                Texture.FM_LINEAR);\r
-       }\r
-       \r
-       protected void initRoot() {\r
-               ZBufferState buf = displaySystem.getRenderer().createZBufferState();\r
-        buf.setEnabled(true);\r
-        buf.setFunction(ZBufferState.CF_LEQUAL);\r
-        //buf.setWritable(false);\r
-        rootNode.setRenderState(buf);   \r
-        rootNode.attachChild(noShadowRootNode);\r
-        rootNode.attachChild(noCastShadowRootNode);\r
-        rootNode.attachChild(shadowRootNode);\r
-        noShadowRootNode.setCullMode(Spatial.CULL_NEVER);\r
-        \r
-        //PointLight light = new PointLight();\r
-        DirectionalLight light = new DirectionalLight();\r
-        light.setDiffuse( new ColorRGBA( 0.75f, 0.75f, 0.75f, 0.75f ) );\r
-        light.setAmbient( new ColorRGBA( 0.5f, 0.5f, 0.5f, 0.5f ) );\r
-        //light.setLocation( new Vector3f( 100, 100, 100 ) );\r
-        light.setDirection(new Vector3f( -100, -150, -100 ));\r
-        light.setEnabled( true );\r
-        light.setShadowCaster(true);\r
-        \r
-        LightState lightState = displaySystem.getRenderer().createLightState();\r
-        lightState.setEnabled( true );\r
-        lightState.attach( light );\r
-        lightState.setSeparateSpecular(true);\r
-        lightState.setTwoSidedLighting(false);\r
-        rootNode.setRenderState( lightState );\r
-        \r
-        ws = displaySystem.getRenderer().createWireframeState();\r
-        ws.setEnabled(false);\r
-        rootNode.setRenderState(ws);\r
-        \r
-        AlphaState as1 = displaySystem.getRenderer().createAlphaState();\r
-        as1.setBlendEnabled(true);\r
-        as1.setSrcFunction(AlphaState.SB_SRC_ALPHA);\r
-        as1.setDstFunction(AlphaState.DB_ONE);\r
-        as1.setTestEnabled(true);\r
-        as1.setTestFunction(AlphaState.TF_GREATER);\r
-        as1.setEnabled(true);\r
-        \r
-        TextureState font = displaySystem.getRenderer().createTextureState();\r
-        /** The texture is loaded from fontLocation */\r
-        font.setTexture(loadFontTexture());\r
-\r
-        font.setEnabled(true);\r
-\r
-        // Then our font Text object.\r
-        /** This is what will actually have the text at the bottom. */\r
-        fps = new Text("FPS label", "");\r
-        fps.setCullMode(Spatial.CULL_NEVER);\r
-        fps.setTextureCombineMode(TextureState.REPLACE);\r
-        \r
-        debug = new Text("Debug", "Debug");\r
-        debug.setCullMode(Spatial.CULL_NEVER);\r
-        debug.setTextureCombineMode(TextureState.REPLACE);\r
-        debug.setLocalTranslation(new Vector3f(1.f,10.f,0.f));\r
-\r
-        // Finally, a stand alone node (not attached to root on purpose)\r
-        Node fpsNode = new Node("FPS node");\r
-        fpsNode.attachChild(fps);\r
-        fpsNode.attachChild(debug);\r
-        fpsNode.setRenderState(font);\r
-        fpsNode.setRenderState(as1);\r
-        fpsNode.setCullMode(Spatial.CULL_NEVER);\r
-        orthoNode.attachChild(fpsNode);\r
-        \r
-        rootNode.updateGeometricState(0.0f, true);\r
-        rootNode.updateRenderState();\r
-        \r
-        orthoNode.updateGeometricState(0.0f, true);\r
-        orthoNode.updateRenderState();\r
-        if (Activator.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.SHADOWS)) {\r
-               ShadowedRenderPass shadowRootPass = new ShadowedRenderPass();\r
-               shadowRootPass.add(shadowRootNode);\r
-               shadowRootPass.add(noCastShadowRootNode);\r
-               shadowRootPass.addOccluder(shadowRootNode);\r
-               pManager.add(shadowRootPass);\r
-               //rootPass.setRenderShadows(false);\r
-               shadowRootPass.setShadowColor(new ColorRGBA(0.1f,0.1f,0.1f,0.9f));\r
-               shadowRootPass.setLightingMethod(ShadowedRenderPass.MODULATIVE);\r
-               RenderPass rootPass = new RenderPass();\r
-               rootPass.add(noShadowRootNode);\r
-               pManager.add(rootPass);\r
-        } else {\r
-               RenderPass rootPass = new RenderPass();\r
-               rootPass.add(rootNode);\r
-               pManager.add(rootPass);\r
-        }\r
-               \r
-               String postProcess = Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.POST_PROCESS);\r
-               if (postProcess.startsWith("bloom")) {\r
-                       BloomRenderPass bloomRenderPass = new BloomRenderPass(cam, 4);\r
-                       if (bloomRenderPass.isSupported()) {\r
-                               bloomRenderPass.add(rootNode);\r
-                               bloomRenderPass.setUseCurrentScene(false);\r
-                               pManager.add(bloomRenderPass);\r
-                       }\r
-               } else if (postProcess.startsWith("sketch")) {\r
-                       SketchRenderPass sketchRenderPass = new SketchRenderPass(cam, 4);\r
-                       if (sketchRenderPass.isSupported()) {\r
-                               sketchRenderPass.add(rootNode);\r
-                               pManager.add(sketchRenderPass);\r
-                       }\r
-               }\r
-\r
-               \r
-               RenderPass fpsPass = new RenderPass();\r
-               fpsPass.add(orthoNode);\r
-               pManager.add(fpsPass);\r
-       }\r
-       \r
-       public void render() {\r
-               displaySystem.setCurrent();\r
-                /** Recalculate the framerate. */\r
-        timer.update();\r
-        \r
-          /** Update tpf to time per frame according to the Timer. */\r
-        float tpf = timer.getTimePerFrame();\r
-        /** Send the fps to our fps bar at the bottom. */\r
-        fps.print("FPS: " + (int) timer.getFrameRate() + " - "\r
-                + displaySystem.getRenderer().getStatistics());\r
-        /**\r
-         * Update the physics for this world.\r
-         */\r
-        debug.print(debugText);\r
-\r
-        /** Update controllers/render states/transforms/bounds for rootNode. */\r
-        rootNode.updateGeometricState(tpf, true);\r
-        rootNode.updateRenderState();\r
-       \r
-        orthoNode.updateGeometricState(tpf, true);\r
-        orthoNode.updateRenderState();\r
-        \r
-        displaySystem.getRenderer().clearStatistics();\r
-        /** Clears the previously rendered information. */\r
-        displaySystem.getRenderer().clearBuffers();\r
-\r
-        pManager.updatePasses(tpf);\r
-        \r
-        pManager.renderPasses(displaySystem.getRenderer());\r
-        if ( showBounds ) {\r
-            Debugger.drawBounds( shadowRootNode, displaySystem.getRenderer(), true );\r
-        }\r
-\r
-        if ( showNormals ) {\r
-            Debugger.drawNormals( shadowRootNode, displaySystem.getRenderer());\r
-        }\r
-        displaySystem.getRenderer().displayBackBuffer();\r
-        \r
-        \r
-        \r
-        //swap buffers\r
-        ((SWTRenderer)displaySystem.getRenderer()).swap();\r
-       }\r
-       \r
-       @Override\r
-       public void resize(int width, int height) {\r
-               updateProjection();\r
-       }\r
-       \r
-       @Override\r
-       public Node getShadowRoot() {\r
-               return shadowRootNode;\r
-       }\r
-       \r
-       @Override\r
-       public Node getNoCastRoot() {\r
-               return noCastShadowRootNode;\r
-       }\r
-       \r
-       @Override\r
-       public Node getRoot() {\r
-               return rootNode;\r
-       }\r
-       \r
-       @Override\r
-       public Node getOrthoNode() {\r
-               return orthoNode;\r
-       }\r
-       \r
-       @Override\r
-       public Node getNoShadowRoot() {\r
-               return noShadowRootNode;\r
-       }\r
-       \r
-//     public void setRootNode(Node node) {\r
-//             rootNode = node;\r
-//             initRoot();\r
-//     }\r
-       \r
-       @Override\r
-       public int getProjectionPolicy() {\r
-               return projectionPolicy;\r
-       }\r
-       \r
-       @Override\r
-       public void setProjectionPolicy(int policy) {\r
-               if (policy != projectionPolicy) {\r
-                       projectionPolicy = policy;\r
-                       updateProjection();\r
-               }\r
-       }\r
-       \r
-       private void updateProjection() {\r
-               switch (projectionPolicy) {\r
-               case PERSPECTIVE_PROJECTION:\r
-                       cam.setParallelProjection(false);\r
-                       cam.setFrustumPerspective(fov,\r
-                       (float) displaySystem.getRenderer().getWidth() /\r
-                       (float) displaySystem.getRenderer().getHeight(),near, far);\r
-                       break;\r
-                       \r
-               case PARALLEL_PROJECTION:\r
-                       cam.setParallelProjection(true);\r
-                       break;\r
-               }\r
-               cam.update();\r
-               projectionUpdated = true;\r
-       }\r
-       \r
-       @Override\r
-       public float getScreenScale() {\r
-               //System.out.println(cam.getFrustumLeft() + " " + cam.getFrustumRight() + " " + cam.getFrustumBottom() + " " + cam.getFrustumTop()+ " " + cam.getFrustumNear() + " " + cam.getFrustumFar());\r
-               return Math.abs(cam.getFrustumTop());\r
-       }\r
-       \r
-       @Override\r
-       public void setScreenScale(float screenScale) {\r
-               float aspect = (float) displaySystem.getRenderer().getWidth() /\r
-        (float) displaySystem.getRenderer().getHeight();\r
-               cam.setFrustum(-screenScale*8.f, cam.getFrustumFar(), -screenScale*aspect, screenScale*aspect, -screenScale, screenScale);\r
-       }\r
-       \r
-       @Override\r
-       public float getFieldOfView() {\r
-               return fov;\r
-       }\r
-       \r
-       @Override\r
-       public void dispose() {\r
-               pManager.cleanUp();\r
-               rootNode.dispose();\r
-               rootNode = null;\r
-               noShadowRootNode = null;\r
-               noCastShadowRootNode = null;\r
-               orthoNode = null;\r
-               shadowRootNode = null;\r
-       }\r
-       \r
-       @Override\r
-       public boolean update() {\r
-               if (!projectionUpdated) {\r
-                       return false;\r
-               }\r
-               projectionUpdated = false;\r
-               return true;\r
-       }\r
-       \r
-       @Override\r
-       public Camera getCamera() {\r
-               return cam;\r
-       }\r
-       \r
-       @Override\r
-       public DisplaySystem getDisplaySystem() {\r
-               return displaySystem;\r
-       }\r
-       \r
-       public void setDebugText(String text) {\r
-               this.debugText = text;\r
-               //System.out.println("JmeSinglePass.setDebugText() " + text);\r
-       }\r
-       \r
-       public void setShowNormals(boolean b) {\r
-               showNormals = b;\r
-       }\r
-       \r
-       public void setShowBounds(boolean b) {\r
-               showBounds = b;\r
-       }\r
-       \r
-       public void setShowWireframe(boolean b) {\r
-               ws.setEnabled(b);\r
-       }\r
-       \r
-       public boolean isShowNormals() {\r
-               return showNormals;\r
-       }\r
-       \r
-       public boolean isShowBounds() {\r
-               return showBounds;\r
-       }\r
-       \r
-       public boolean isShowWireframe() {\r
-               return ws.isEnabled();\r
-       }\r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/OrbitalCamera.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/OrbitalCamera.java
deleted file mode 100644 (file)
index 4b0aa6f..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.common;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Matrix3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-\r
-import com.jme.renderer.Camera;\r
-\r
-\r
-/**\r
- * Orbital camera\r
- * <p>\r
- * Modified version of fi.vtt.proconf.webmon.graphics3d.utils.OrbitalCamera<br>\r
- *  Using floats instead of double<br>\r
- * </p>\r
- * \r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class OrbitalCamera {\r
-    \r
-    private Vector3d up = new Vector3d(0.0,1.0,0.0);\r
-    private static Vector3d up2 = new Vector3d(0.0,0.0,-1.0);\r
-    private static double minDistance = 0.5;\r
-    private Vector3d target = new Vector3d();\r
-    private Vector3d cameraPos = new Vector3d(10.0,0.0,0.0);\r
-    \r
-    \r
-    public void translate(Vector3d v) {\r
-        target.add(v);\r
-        cameraPos.add(v);\r
-    }\r
-    \r
-    public void rotateAroundTarget(Vector3d axis, double angle) {\r
-        Vector3d temp = new Vector3d(cameraPos);\r
-        temp.sub(target);\r
-        Matrix3d rotation = new Matrix3d();\r
-        rotation.set(new AxisAngle4d(axis,angle));\r
-        rotation.transform(temp);\r
-        temp.add(target);\r
-        cameraPos.set(temp);      \r
-    }\r
-    \r
-    public Vector3d getUnNormalizedHeading() {\r
-        Vector3d heading = new Vector3d(target);\r
-        heading.sub(cameraPos);\r
-        return heading;\r
-    }\r
-    \r
-    public Vector3d getUnNormalizedRight() {\r
-        Vector3d heading = getUnNormalizedHeading();\r
-        Vector3d right = new Vector3d();\r
-        right.cross(heading,up);\r
-        if (right.lengthSquared() < 0.01)\r
-            right.cross(heading,up2);\r
-        return right;\r
-    }\r
-    \r
-    public double getDistanceToTarget() {\r
-        Vector3d t = new Vector3d(target);\r
-        t.sub(cameraPos);\r
-        return t.length();\r
-    }\r
-    \r
-    public void moveToTarget(double distance) {\r
-        Vector3d heading = getUnNormalizedHeading();\r
-        double length = heading.length();\r
-        if (length + distance < minDistance) {\r
-            // cannot move closer\r
-            return;\r
-        }\r
-        heading.scale(distance / length); //normalizing and scaling by distance\r
-        cameraPos.add(heading);\r
-    }\r
-    \r
-    public void moveScaledToTarget(double s) {\r
-        Vector3d heading = getUnNormalizedHeading();\r
-        double currentLength = heading.length();\r
-        double length = currentLength * (1.0 - s);// heading.length();\r
-        if (length < minDistance) {\r
-           s = -minDistance / currentLength + 1.0;\r
-        }\r
-        heading.scale(s);\r
-         //normalizing and scaling by distance\r
-        cameraPos.add(heading);\r
-    }\r
-    \r
-    public void rotateUp(double angle) {\r
-        Vector3d right = getUnNormalizedRight();\r
-        double length = right.length();\r
-        // TODO : better handling of singular cases\r
-        if (length > 0.01)\r
-            right.scale(1.0/length);\r
-        else \r
-            right.set(-1.0,0.0,0.0);\r
-        rotateAroundTarget(right,angle);\r
-    }\r
-    \r
-    public void rotateRight(double angle) {\r
-        rotateAroundTarget(up,angle);\r
-    }\r
-    \r
-    public void moveRight(double length) {\r
-        Vector3d right = getUnNormalizedRight();\r
-        right.normalize();\r
-        right.scale(length);\r
-        translate(right);\r
-    }\r
-    \r
-    public void moveUp(double length) {\r
-        Vector3d u = new Vector3d(up);\r
-        u.scale(length);\r
-        translate(u);\r
-    }\r
-    \r
-    public void moveFront(double length) {\r
-        Vector3d right = getUnNormalizedRight();\r
-        Vector3d front = new Vector3d();\r
-        front.cross(up,right);\r
-        front.normalize();\r
-        front.scale(length);\r
-        translate(front);\r
-    }\r
-    \r
-    public void updateCamera() {\r
-       Vector3d t = new Vector3d(cameraPos);\r
-       t.sub(target);\r
-       t.normalize();\r
-       cam.setLocation(VecmathJmeTools.get(cameraPos));\r
-       \r
-       if (Math.abs(t.dot(up)) > 0.99) {\r
-               cam.lookAt(VecmathJmeTools.get(target), VecmathJmeTools.get(up2));      \r
-       } else {\r
-               cam.lookAt(VecmathJmeTools.get(target), VecmathJmeTools.get(up));\r
-       }\r
-       cam.update();\r
-       cam.apply();\r
-       \r
-    }\r
-\r
-    /**\r
-     * @return Returns the cameraPos.\r
-     */\r
-    public Vector3d getCameraPos() {\r
-        return cameraPos;\r
-    }\r
-\r
-    /**\r
-     * @param cameraPos The cameraPos to set.\r
-     */\r
-    public void setCameraPos(Vector3d cameraPos) {\r
-        this.cameraPos = cameraPos;\r
-    }\r
-\r
-    /**\r
-     * @return Returns the target.\r
-     */\r
-    public Vector3d getTarget() {\r
-        return target;\r
-    }\r
-\r
-    /**\r
-     * @param target The target to set.\r
-     */\r
-    public void setTarget(Vector3d target) {\r
-        this.target = target;\r
-    }\r
-    \r
-    public void setCameraPosRelativeToTarget(Vector3d targetToCam) {\r
-        targetToCam.add(target);\r
-        setCameraPos(targetToCam);\r
-    }\r
-    \r
-    public void setUp(Vector3d v) {\r
-        up.set(v);\r
-    }\r
-    \r
-    public Vector3d getUp() {\r
-        return up;\r
-    }\r
-    \r
-    public void setDefaultUp() {\r
-        up.set(0.0,1.0,0.0);\r
-    }\r
-    \r
-    private Camera cam;\r
-    \r
-    public void setCamera(Camera cam) {\r
-       this.cam = cam;\r
-    }\r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/PropertyTester2.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/PropertyTester2.java
deleted file mode 100644 (file)
index 0f57f7a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.simantics.proconf.g3d.common;\r
-\r
-import org.eclipse.core.expressions.PropertyTester;\r
-\r
-public class PropertyTester2 extends PropertyTester {\r
-\r
-       public PropertyTester2() {\r
-               // TODO Auto-generated constructor stub\r
-       }\r
-\r
-       @Override\r
-       public boolean test(Object receiver, String property, Object[] args,\r
-                       Object expectedValue) {\r
-               // TODO Auto-generated method stub\r
-               return false;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/StructuredResourceSelection.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/common/StructuredResourceSelection.java
deleted file mode 100644 (file)
index a13062a..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.common;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.simantics.db.Resource;\r
-\r
-\r
-/**\r
- * StructuredSelection that contains ResourceSelections\r
- * \r
- * @author Marko Luukkainen\r
- * @author Tuukka Lehtonen\r
- */\r
-public class StructuredResourceSelection implements IStructuredSelection {\r
-    \r
-    public static final StructuredResourceSelection EMPTY = new StructuredResourceSelection() {\r
-        // Create an empty fixed size List to ensure the list is not modified.\r
-        private List<Resource> empty = Arrays.asList(); \r
-        \r
-        public void add(Resource rs) {\r
-            throw new UnsupportedOperationException("BUG: attempted to modify StructuredResourceSelection.EMPTY");\r
-        }\r
-        public List<Resource> getSelectionList() {\r
-            return empty;\r
-        }\r
-    };\r
-\r
-    private List<Resource> selections;\r
-    \r
-    /**\r
-     * Creates a new selection that doesn't contain any items\r
-     */\r
-    public StructuredResourceSelection() {\r
-    }\r
-\r
-    public StructuredResourceSelection(Resource rs) {\r
-        getSelectionList().add(rs);\r
-    }\r
-\r
-    public StructuredResourceSelection(Resource... rss) {\r
-        List<Resource> s = getSelectionList();\r
-        for (Resource rs : rss)\r
-            s.add(rs);\r
-    }\r
-\r
-    public void add(Resource rs) {\r
-        getSelectionList().add(rs);\r
-    }\r
-\r
-    public List<Resource> getSelectionList() {\r
-        if (selections == null) {\r
-            selections = new ArrayList<Resource>();\r
-        }\r
-        return selections;\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.ISelection#isEmpty()\r
-     */\r
-    public boolean isEmpty() {\r
-        return selections == null || selections.isEmpty();\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.IStructuredSelection#getFirstElement()\r
-     */\r
-    public Object getFirstElement() {\r
-        if (!isEmpty())\r
-            return selections.get(0);\r
-        return null;\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.IStructuredSelection#iterator()\r
-     */\r
-    public Iterator<Resource> iterator() {\r
-        return getSelectionList().iterator();\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.IStructuredSelection#size()\r
-     */\r
-    public int size() {\r
-        return selections == null ? 0 : selections.size();\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.IStructuredSelection#toArray()\r
-     */\r
-    public Object[] toArray() {\r
-        return selections == null ? new Object[0] : selections.toArray();\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see org.eclipse.jface.viewers.IStructuredSelection#toList()\r
-     */\r
-    public List<Resource> toList() {\r
-        return selections == null ? Arrays.asList(new Resource[0]) : selections;\r
-    }\r
-\r
-    /**\r
-     * Returns whether this structured selection is equal to the given object.\r
-     * Two structured selections are equal iff they contain the same elements\r
-     * in the same order.\r
-     *\r
-     * @param o the other object\r
-     * @return <code>true</code> if they are equal, and <code>false</code> otherwise\r
-     */\r
-    public boolean equals(Object o) {\r
-        if (this == o) {\r
-            return true;\r
-        }\r
-        // null and other classes\r
-        if (!(o instanceof StructuredResourceSelection)) {\r
-            return false;\r
-        }\r
-        StructuredResourceSelection other = (StructuredResourceSelection) o;\r
-\r
-        // either or both empty?\r
-        if (isEmpty()) {\r
-            return other.isEmpty();\r
-        }\r
-        if (other.isEmpty()) {\r
-            return false;\r
-        }\r
-\r
-        // check size\r
-        if (size() != other.size())\r
-            return false;\r
-        \r
-        // element comparison\r
-        Iterator<Resource> it = iterator();\r
-        Iterator<Resource> otherIt = other.iterator();\r
-        while (it.hasNext()) {\r
-            if (!it.next().equals(otherIt.next()))\r
-                return false;\r
-        }\r
-        \r
-        return true;\r
-    }\r
-    \r
-    @Override\r
-    public String toString() {\r
-       return Arrays.toString(getSelectionList().toArray());\r
-    }\r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dialogs/JMEDialog.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dialogs/JMEDialog.java
deleted file mode 100644 (file)
index 9e2950d..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.dialogs;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.MouseAdapter;\r
-import org.eclipse.swt.events.MouseEvent;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.graphics.RGB;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.ColorDialog;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-public class JMEDialog extends Dialog {\r
-       private boolean bounds;\r
-       private boolean normals;\r
-       private boolean wireframe;\r
-       private float[] floatColor = null;\r
-       private Button boundsButton;\r
-       private Button normalsButton;\r
-       private Button wireframeButton;\r
-       private Composite colorComposite;\r
-       private Color color = null;\r
-       \r
-       public JMEDialog(Shell parentShell) {\r
-               super(parentShell);\r
-       }\r
-\r
-       \r
-       @Override\r
-       protected void configureShell(Shell newShell) {\r
-               super.configureShell(newShell);\r
-               newShell.setText("Configure new pipeline");\r
-       }\r
-       \r
-       @Override\r
-       protected Control createDialogArea(Composite parent) {\r
-               Composite composite = (Composite) super.createDialogArea(parent);\r
-               Label label = new Label(composite, SWT.WRAP);\r
-        label.setText("JME Configuration");\r
-        GridData data = new GridData(GridData.GRAB_HORIZONTAL\r
-                | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
-                | GridData.VERTICAL_ALIGN_CENTER);\r
-               \r
-        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-        boundsButton = new Button(composite,SWT.CHECK);\r
-        boundsButton.setText("Show bounds");\r
-        boundsButton.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       bounds = boundsButton.getSelection();\r
-               }\r
-        });\r
-        boundsButton.setSelection(bounds);\r
-        normalsButton = new Button(composite,SWT.CHECK);\r
-        normalsButton.setText("Show normals");\r
-        normalsButton.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       normals = normalsButton.getSelection();\r
-               }\r
-        });\r
-        normalsButton.setSelection(normals);\r
-        wireframeButton = new Button(composite,SWT.CHECK);\r
-        wireframeButton.setText("Show wireframe");\r
-        wireframeButton.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       wireframe = wireframeButton.getSelection();\r
-               }\r
-        });\r
-        wireframeButton.setSelection(wireframe);\r
-        \r
-        colorComposite = new Composite(composite,SWT.BORDER);\r
-        colorComposite.addMouseListener(new MouseAdapter() {\r
-               @Override\r
-               public void mouseUp(MouseEvent e) {\r
-                       ColorDialog dialog = new ColorDialog(JMEDialog.this.getShell());\r
-                       RGB rgb = dialog.open();\r
-                       if (rgb != null) {\r
-                               if (color != null)\r
-                                       color.dispose();\r
-                               color = new Color(JMEDialog.this.getShell().getDisplay(),rgb);\r
-                               colorComposite.setBackground(color);\r
-                               floatColor = new float[]{rgb.red/255.f,rgb.green/255.f,rgb.blue/255.f};\r
-                       }\r
-               }\r
-        });\r
-               updateColor();\r
-               \r
-               return composite;\r
-       }\r
-       \r
-       @Override\r
-       public int open() {\r
-               return super.open();\r
-       }\r
-\r
-\r
-       public boolean isBounds() {\r
-               return bounds;\r
-       }\r
-\r
-\r
-       public void setBounds(boolean bounds) {\r
-               this.bounds = bounds;\r
-       }\r
-\r
-\r
-       public boolean isNormals() {\r
-               return normals;\r
-       }\r
-\r
-\r
-       public void setNormals(boolean normals) {\r
-               this.normals = normals;\r
-       }\r
-\r
-\r
-       public boolean isWireframe() {\r
-               return wireframe;\r
-       }\r
-\r
-\r
-       public void setWireframe(boolean wireframe) {\r
-               this.wireframe = wireframe;\r
-       }\r
-       \r
-       \r
-       public float[] getFloatColor() {\r
-               return floatColor;\r
-       }\r
-\r
-       public void setFloatColor(float[] c) {\r
-               this.floatColor = c;\r
-               if (floatColor == null)\r
-                       return;\r
-               \r
-               updateColor();\r
-       }\r
-       \r
-       private void updateColor() {\r
-               if (colorComposite == null)\r
-                       return;\r
-               if (color != null)\r
-                       color.dispose();\r
-               RGB rgb = new RGB((int)(floatColor[0]*255.f),(int)(floatColor[1]*255.f),(int)(floatColor[2]*255.f));\r
-               color = new Color(JMEDialog.this.getShell().getDisplay(),rgb);\r
-               colorComposite.setBackground(color);\r
-       }\r
-\r
-       \r
-\r
-\r
-       \r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dnd/DropListener.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dnd/DropListener.java
deleted file mode 100644 (file)
index 70e9610..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.dnd;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-\r
-\r
-\r
-public interface DropListener {\r
-       \r
-       boolean acceptDrop(StructuredResourceSelection s, Resource res[]);\r
-       void doDrop(StructuredResourceSelection s, Resource res[]);\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dnd/ShapeDropTarget.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/dnd/ShapeDropTarget.java
deleted file mode 100644 (file)
index fe832e6..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.dnd;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.eclipse.swt.dnd.DND;\r
-import org.eclipse.swt.dnd.DropTarget;\r
-import org.eclipse.swt.dnd.DropTargetEvent;\r
-import org.eclipse.swt.dnd.DropTargetListener;\r
-import org.eclipse.swt.dnd.TextTransfer;\r
-import org.eclipse.swt.dnd.Transfer;\r
-import org.eclipse.swt.dnd.TransferData;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.ui.dnd.ResourceReferenceTransfer;\r
-\r
-public class ShapeDropTarget implements DropTargetListener{\r
-       ThreeDimensionalEditorBase editor;\r
-       List<DropListener> listeners;\r
-       final Control control;\r
-    private DropTarget target; \r
-    \r
-       public ShapeDropTarget(ThreeDimensionalEditorBase editor) {\r
-               this.editor = editor;\r
-               listeners = new ArrayList<DropListener>();\r
-               this.control = editor.getRenderingComposite();\r
-        \r
-        target = new DropTarget(control, DND.DROP_LINK);\r
-        target.setTransfer(new Transfer[] { ResourceReferenceTransfer.getInstance() });\r
-        target.addDropListener(this);  \r
-       }\r
-       \r
-       public void addDropListener(DropListener listener) {\r
-               listeners.add(listener);\r
-       }\r
-       \r
-       public void removeDropListener(DropListener listener) {\r
-               listeners.remove(listener);\r
-       }\r
-       \r
-       @Override\r
-       public void dragEnter(DropTargetEvent event) {\r
-               event.detail = DND.DROP_LINK;\r
-               dragOver(event);\r
-       }\r
-       \r
-       public void dragOperationChanged(DropTargetEvent event) {\r
-    }\r
-       \r
-       public void dropAccept(DropTargetEvent event) {\r
-    }\r
-       \r
-       public void dragLeave(DropTargetEvent event) {\r
-    }\r
-\r
-       \r
-       @Override\r
-       public void dragOver(DropTargetEvent event) {\r
-               // FIXME : a hack to get the actual data (probably works only in Windows)\r
-               TransferData data = event.currentDataType;\r
-               if(!TextTransfer.getInstance().isSupportedType(data))\r
-                       return;\r
-               Object o = TextTransfer.getInstance().nativeToJava(data);\r
-               \r
-               Point p = getLocalCoords(event);\r
-               editor.getInputProvider().setMouseMoved(true);\r
-               editor.getInputProvider().setMouseX(p.x);\r
-               editor.getInputProvider().setMouseY(p.y);\r
-               editor.run();\r
-               StructuredResourceSelection sel = editor.getSelectionAdapter().getHighlightSelection();\r
-               \r
-               event.data = o;\r
-               Resource ids[] = parseEventData(event);\r
-               for (DropListener l : listeners) {\r
-                       if(l.acceptDrop(sel, ids)) {\r
-                               event.detail = DND.DROP_LINK;\r
-                               return;\r
-                       }\r
-               }\r
-               event.detail = DND.DROP_NONE;           \r
-       }\r
-       \r
-       @Override\r
-       public void drop(DropTargetEvent event) {\r
-               StructuredResourceSelection sel = editor.getSelectionAdapter().getHighlightSelection();\r
-               Resource ids[] = parseEventData(event);\r
-               for (DropListener l : listeners) {\r
-                       if(l.acceptDrop(sel, ids)) {\r
-                               l.doDrop(sel, ids);\r
-                               return;\r
-                       }\r
-               }\r
-       }\r
-       \r
-       protected Point getLocalCoords(DropTargetEvent event) {\r
-               return editor.getRenderingComposite().toControl(event.x, event.y);\r
-       }\r
-       \r
-       public void dispose()\r
-    {\r
-        target.removeDropListener(this);\r
-        target = null;\r
-    }\r
-       \r
-       private Resource[] parseEventData(DropTargetEvent event) {\r
-        if (ResourceReferenceTransfer.getInstance().isSupportedType(event.currentDataType) && (event.data instanceof Resource[])) {\r
-            return (Resource[]) event.data;\r
-        }\r
-        return null;\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/AbstractGizmo.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/AbstractGizmo.java
deleted file mode 100644 (file)
index e6f7b61..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.gizmo;\r
-\r
-import javax.vecmath.AxisAngle4f;\r
-import javax.vecmath.Color4f;\r
-import javax.vecmath.Quat4f;\r
-import javax.vecmath.Tuple3d;\r
-import javax.vecmath.Tuple3f;\r
-import javax.vecmath.Vector3d;\r
-import javax.vecmath.Vector3f;\r
-\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-import org.simantics.proconf.g3d.preferences.PreferenceConstants;\r
-\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.Node;\r
-\r
-\r
-public abstract class AbstractGizmo implements Gizmo{\r
-    \r
-       private Node position;\r
-       private Node rotate;\r
-       private Node scale;\r
-       \r
-    private boolean changed = false;\r
-    \r
-    private double userScale = 1.0;\r
-    \r
-    public AbstractGizmo() {\r
-        createGroups();\r
-    }\r
-    \r
-    public void setChanged(boolean b) {\r
-        changed = b;\r
-    }\r
-    \r
-    public boolean isChanged() {\r
-        return changed;\r
-    }\r
-    \r
-    public double getUserScale() {\r
-       return Activator.getDefault().getPreferenceStore().getDouble(PreferenceConstants.GIZMO_SCALE);\r
-    }\r
-    \r
-    \r
-    public void setScale(float scale) {\r
-        this.scale.setLocalScale(scale);\r
-    }\r
-    \r
-    public void setScale(Vector3f scale) {\r
-        this.scale.setLocalScale(VecmathJmeTools.get(scale));\r
-    }\r
-    \r
-    public Vector3d getPosition() {\r
-       return VecmathJmeTools.getD(position.getWorldTranslation());\r
-    }\r
-    \r
-    public Vector3f getPositionFloat() {\r
-        return VecmathJmeTools.get(position.getWorldTranslation());\r
-    }\r
-    \r
-    public void setPosition(Tuple3d position) {\r
-        this.position.setLocalTranslation(VecmathJmeTools.get(position));\r
-    }\r
-    \r
-    public void setPosition(Vector3f position) {\r
-       this.position.setLocalTranslation(VecmathJmeTools.get(position));\r
-    }\r
-    \r
-    public void setRotation(Quat4f q) {\r
-       rotate.setLocalRotation(VecmathJmeTools.get(q));\r
-    }\r
-    \r
-    public void setRotation(AxisAngle4f q) {\r
-        rotate.setLocalRotation(VecmathJmeTools.get(q));\r
-    }\r
-    \r
-    public Node getNode() {\r
-       userScale = getUserScale();\r
-       return position;\r
-    }\r
-    \r
-    protected Node getGizmoNode() {\r
-       return scale;\r
-    }\r
-    \r
-    private void createGroups() {\r
-\r
-       position = new Node();\r
-       rotate = new Node();\r
-       scale = new Node();\r
-       position.attachChild(rotate);\r
-       rotate.attachChild(scale);\r
-       position.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-    }\r
-\r
-    public void update(Tuple3d position, Tuple3d cameraPosition, JmeRenderingComponent component) {\r
-        setPosition(position);\r
-        com.jme.math.Vector3f p = VecmathJmeTools.get(position);\r
-        p.subtractLocal(VecmathJmeTools.get(cameraPosition));\r
-        rotate.getLocalRotation().inverse().multLocal(p);\r
-        if (component.getProjectionPolicy() == JmeRenderingComponent.PERSPECTIVE_PROJECTION) {\r
-\r
-            double distance = p.length();\r
-            // (bug caused in Xith->JME translation ?)\r
-            p.negateLocal();\r
-            double fov = component.getFieldOfView();\r
-            float s = (float) (Math.sin(fov) * distance * 0.1); // scaling factor was 0.2 with Xith\r
-            s *= (float)userScale;\r
-            Vector3f scale = new Vector3f(1.f, 1.f, 1.f);\r
-            \r
-            if (p.x > 0.f)\r
-                scale.x = -1.f;\r
-            if (p.y > 0.f)\r
-                scale.y = -1.f;\r
-            if (p.z > 0.f)\r
-                scale.z = -1.f;\r
-            scale.scale(s);\r
-            setScale(scale);\r
-        } else {\r
-            Vector3f scale = new Vector3f(1.f, 1.f, 1.f);\r
-            float s = component.getScreenScale() / 5.f;\r
-            s *= (float)userScale;\r
-            if (p.x > 0.f)\r
-                scale.x = -1.f;\r
-            if (p.y > 0.f)\r
-                scale.y = -1.f;\r
-            if (p.z > 0.f)\r
-                scale.z = -1.f;\r
-            scale.scale(s);\r
-            setScale(scale);\r
-\r
-        }\r
-    }\r
-\r
-    public void update(Tuple3d cameraPosition, JmeRenderingComponent component) {\r
-\r
-       com.jme.math.Vector3f p = VecmathJmeTools.get(getPosition());\r
-        p.subtractLocal(VecmathJmeTools.get(cameraPosition));\r
-        rotate.getLocalRotation().inverse().multLocal(p);\r
-        if (component.getProjectionPolicy() == JmeRenderingComponent.PERSPECTIVE_PROJECTION) {\r
-\r
-            double distance = p.length();\r
-            double fov = component.getFieldOfView();\r
-            float s = (float)(Math.sin(fov) * distance * 0.1); // scaling factor was 0.2 with Xith\r
-            s *= (float)userScale;\r
-            Vector3f scale = new Vector3f(1.f,1.f,1.f);\r
-            if (p.x > 0.f)\r
-                scale.x = -1.f;\r
-            if (p.y > 0.f)\r
-                scale.y = -1.f;\r
-            if (p.z > 0.f)\r
-                scale.z = -1.f;\r
-            scale.scale(s);\r
-            setScale(scale);\r
-        } else {\r
-            \r
-            Vector3f scale = new Vector3f(1.f,1.f,1.f);\r
-            float s = component.getScreenScale()/5.f;\r
-            s *= (float)userScale;\r
-            if (p.x > 0.f)\r
-                scale.x = -1.f;\r
-            if (p.y > 0.f)\r
-                scale.y = -1.f;\r
-            if (p.z > 0.f)\r
-                scale.z = -1.f;\r
-            scale.scale(s);\r
-            setScale(scale);\r
-            \r
-        }\r
-    }\r
-    \r
-    protected void setCoordinate(float array[], int index, Tuple3f c) {\r
-       index *= 3;\r
-       array[index++] = c.x;\r
-       array[index++] = c.y;\r
-       array[index] = c.z;\r
-    }\r
-    \r
-    protected void setColor(float array[], int index, Color4f c) {\r
-       index *= 4;\r
-       array[index++] = c.x;\r
-       array[index++] = c.y;\r
-       array[index++] = c.z;\r
-       array[index] = c.w;\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/Gizmo.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/Gizmo.java
deleted file mode 100644 (file)
index 0e791ca..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.gizmo;\r
-\r
-import com.jme.scene.Node;\r
-\r
-/**\r
- * Interface for gizmos, interactive components in the scene-graph.\r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public interface Gizmo {\r
-\r
-       /**\r
-        * Must return unique identifier for this gizmo\r
-        * @return\r
-        */\r
-    public abstract String getPickPrefix();\r
-\r
-    /**\r
-     * Sets selected component (where mouse is hovering) by using its name.\r
-     * Name includes pick prefix\r
-     * @param name\r
-     */\r
-    public abstract void setSelected(String name);\r
-\r
-    /**\r
-     * Returns root-node of the gizmo. It is used for inserting the gizmo into scenegraph.\r
-     * @return\r
-     */\r
-    public abstract Node getNode();\r
-    \r
-    /**\r
-     * Returns true if gizmo needs to be redrawn.\r
-     * @return\r
-     */\r
-    public boolean isChanged();\r
-    \r
-    public void setChanged(boolean b);\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/MultiSelectionGizmo.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/MultiSelectionGizmo.java
deleted file mode 100644 (file)
index b73b886..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.gizmo;\r
-\r
-import java.nio.FloatBuffer;\r
-\r
-import javax.vecmath.Color4f;\r
-\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-\r
-\r
-public abstract class MultiSelectionGizmo extends AbstractGizmo {\r
-    \r
-    public static final int UNSELECTED = 0;\r
-    public static final int SELECTED = 1;\r
-\r
-       private TriMesh geoms[] = new TriMesh[4];\r
-       private ColorRGBA colors[][] = new ColorRGBA[4][2];\r
-   \r
-\r
-    private boolean selected[];\r
-    \r
-    \r
-    private int selectedIndex = -1;\r
-    \r
-    \r
-    public MultiSelectionGizmo() {\r
-        super();\r
-\r
-        colors = new ColorRGBA[getCount()][2];\r
-        geoms = new TriMesh[getCount()];\r
-        selected = new boolean[getCount()];\r
-        for (int i = 0; i < selected.length; i++) {\r
-            selected[i] = false;\r
-        }\r
-    }\r
-    \r
-    protected abstract int getCount();\r
-    protected abstract int getIndexForName(String name);\r
-    \r
-    public int getSelected() {\r
-        return selectedIndex;\r
-    }\r
-    \r
-    private void updateColor(int index, int selected) {\r
-\r
-       FloatBuffer buff = geoms[index].getColorBuffer(0);\r
-       for (int i = 0; i < geoms[index].getBatch(0).getVertexCount(); i++) {\r
-               BufferUtils.setInBuffer(colors[index][selected], buff, i);\r
-        }\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.common.Gizmo#changeSelected(java.lang.String)\r
-     */\r
-    public void setSelected(String name) {\r
-        \r
-        if (name == null) {\r
-            for (int j = 0; j < getCount(); j++) {\r
-                if (selected[j]) {\r
-                    selected[j] = false;\r
-                    updateColor(j,UNSELECTED);\r
-                    setChanged(true);\r
-                }\r
-            }\r
-            selectedIndex = -1;\r
-            return;\r
-        }\r
-        int index = getIndexForName(name);\r
-        if (index == -1)\r
-            return;\r
-        selectedIndex = index;\r
-        if (!selected[index]) {\r
-            selected[index] = true;\r
-            updateColor(index,SELECTED);\r
-            setChanged(true);\r
-        }\r
-        for (int j = 0; j < getCount(); j++) {\r
-            if (j != index) {\r
-                if (selected[j]) {\r
-                    selected[j] = false;\r
-                    updateColor(j,UNSELECTED);\r
-                    setChanged(true);\r
-                }\r
-            }\r
-        } \r
-    }\r
-    \r
-    \r
-    protected void setGeometry(int index, TriMesh geom) {\r
-        geoms[index] = geom;\r
-    }\r
-    \r
-    protected void setColor(int index, int selected, Color4f color) {\r
-        colors[index][selected] = VecmathJmeTools.get(color);\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/RotateGizmo.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/RotateGizmo.java
deleted file mode 100644 (file)
index dcf18d5..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.gizmo;\r
-\r
-import javax.vecmath.Color4f;\r
-import javax.vecmath.Point3f;\r
-\r
-import com.jme.bounding.BoundingBox;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.ZBufferState;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-\r
-\r
-public class RotateGizmo extends MultiSelectionGizmo {\r
-\r
-    \r
-    public static String PICK_NAME = "rotate";\r
-    public static String X_NAME = "rx";\r
-    public static String Y_NAME = "ry";\r
-    public static String Z_NAME = "rz";\r
-    public static String XYZ_NAME = "ra";\r
-    \r
-    public static final int X = 0;\r
-    public static final int Y = 1;\r
-    public static final int Z = 2;\r
-    public static final int XYZ = 3;\r
-    \r
-\r
-    \r
-    \r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.common.Gizmo#getPickPrefix()\r
-     */\r
-    public String getPickPrefix() {\r
-        return PICK_NAME;\r
-    }\r
-    \r
-    public int getIndexForName(String name) {\r
-        if (!name.startsWith(PICK_NAME)) {\r
-            return -1;\r
-        }\r
-        name = name.substring(PICK_NAME.length());\r
-        if (name.startsWith(X_NAME))\r
-            return X;\r
-        if (name.startsWith(Y_NAME))\r
-            return Y;\r
-        if (name.startsWith(Z_NAME))\r
-            return Z;\r
-        if (name.startsWith(XYZ_NAME))\r
-            return XYZ;\r
-        return -1;\r
-    }\r
-    \r
-\r
-    @Override\r
-    public int getCount() {\r
-        return 4;\r
-    }\r
-\r
-    public RotateGizmo(Renderer renderer) {\r
-       super();\r
-       float radius = 2.f;\r
-       float radius2 = 1.8f;\r
-        int div = 9;\r
-        \r
-        float x[] = new float[div+1];\r
-        float y[] = new float[div+1];\r
-        float x2[] = new float[div+1];\r
-        float y2[] = new float[div+1];\r
-        x[0] = radius;\r
-        y[0] = 0.f;\r
-        x[div] = 0.f;\r
-        y[div] = radius;\r
-        x2[0] = radius2;\r
-        y2[0] = 0.f;\r
-        x2[div] = 0.f;\r
-        y2[div] = radius2;\r
-        \r
-        for (int i = 1; i < div; i++) {\r
-            float angle = (float)i/(float)div;\r
-            angle *= Math.PI * 0.5f;\r
-            float c = (float)Math.cos(angle);\r
-            float s = (float)Math.sin(angle);\r
-            x[i] = radius * c;\r
-            y[i] = radius * s;\r
-            x2[i] = radius2 * c;\r
-            y2[i] = radius2 * s;\r
-\r
-        }\r
-         \r
-        Color4f colorx = new Color4f(0.5f,0.f,0.f,0.5f);\r
-        Color4f colory = new Color4f(0.f,0.5f,0.f,0.5f);\r
-        Color4f colorz = new Color4f(0.f,0.f,0.5f,0.5f);\r
-        Color4f scolorx = new Color4f(1.f,0.f,0.f,0.7f);\r
-        Color4f scolory = new Color4f(0.f,1.f,0.f,0.7f);\r
-        Color4f scolorz = new Color4f(0.f,0.f,1.f,0.7f);\r
-\r
-        \r
-        Color4f colorxyz = new Color4f();\r
-        colorxyz.x = colorx.x + colory.x + colorz.x;\r
-        colorxyz.y = colorx.y + colory.y + colorz.y;\r
-        colorxyz.z = colorx.z +colory.z + colorz.z;\r
-        colorxyz.w = 0.5f;\r
-        \r
-        Color4f scolorxyz = new Color4f();\r
-        scolorxyz.x = scolorx.x + scolory.x + scolorz.x;\r
-        scolorxyz.y = scolorx.y + scolory.y + scolorz.y;\r
-        scolorxyz.z = scolorx.z + scolory.z + scolorz.z;\r
-        scolorxyz.w = 0.5f;\r
-        \r
-        int  numVertices = div*2;\r
-        float coordinates[] = new float[numVertices*3 + numVertices*3];\r
-        float cols[] = new float[numVertices*4*2];\r
-        int[] indices = new int[numVertices*3-6+numVertices*3 - 12];\r
-        for (int i = 0; i < div; i++) {\r
-            if (i == 0) {\r
-                indices[0] = 0;\r
-                indices[1] = 1;\r
-                indices[2] = 2;\r
-                continue;\r
-            }\r
-            int vIndex = i * 2 - 1;\r
-            int index = i * 6 - 3;\r
-            if (i == div - 1) {\r
-                indices[index] = vIndex;\r
-                indices[index+1] = vIndex+1;\r
-                indices[index+2] = vIndex+2;\r
-               \r
-            } else {\r
-                indices[index] = vIndex;\r
-                indices[index+1] = vIndex+1;\r
-                indices[index+2] = vIndex+2;\r
-                indices[index+3] = vIndex+1;\r
-                indices[index+4] = vIndex+3;\r
-                indices[index+5] = vIndex+2;\r
-            }\r
-        }\r
-        \r
-        for (int i = div+1; i < div * 2 - 1; i++) {\r
-            int vIndex = i * 2 - 1;\r
-            int index = i * 6 - 12;\r
-\r
-                indices[index] = vIndex;\r
-                indices[index+1] = vIndex+1;\r
-                indices[index+2] = vIndex+2;\r
-                indices[index+3] = vIndex+1;\r
-                indices[index+4] = vIndex+3;\r
-                indices[index+5] = vIndex+2;\r
-        }\r
-        \r
-        for (int i = 0; i < numVertices*2; i++)\r
-          setColor(cols,i, colorx);\r
-        \r
-        setCoordinate(coordinates,0, new Point3f(0.f, x[0], 0.f));\r
-        for (int i = 1; i < div; i++) {\r
-            int index = i * 2 - 1;\r
-            setCoordinate(coordinates,index,new Point3f(0.f,x[i],y[i]));\r
-            setCoordinate(coordinates,index+1,new Point3f(y[1],x[i],y[i]));  \r
-        }\r
-        setCoordinate(coordinates,numVertices - 1, new Point3f(0.f, 0.f, y[div]));\r
-        \r
-        setCoordinate(coordinates,numVertices, new Point3f(0.f, x2[0], 0.f));\r
-        for (int i = 1; i < div; i++) {\r
-            int index = (div+i) * 2 - 1;\r
-            setCoordinate(coordinates,index,new Point3f(y[1],x[i],y[i]));\r
-            setCoordinate(coordinates,index+1,new Point3f(y2[1],x2[i],y2[i]));  \r
-        }\r
-        setCoordinate(coordinates,numVertices*2 - 1, new Point3f(0.f, 0.f, y2[div]));\r
-       \r
-        TriMesh linex = new TriMesh(PICK_NAME+X_NAME,BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        \r
-        for (int i = 0; i < numVertices*2; i++)\r
-          setColor(cols,i, colory);\r
-        \r
-        setCoordinate(coordinates,0, new Point3f(x[0], 0.f, 0.f));\r
-        for (int i = 1; i < div; i++) {\r
-            int index = i * 2 - 1;\r
-            setCoordinate(coordinates,index,new Point3f(x[i],0.f,y[i]));\r
-            setCoordinate(coordinates,index+1,new Point3f(x[i],y[1],y[i]));  \r
-        }\r
-        setCoordinate(coordinates,numVertices - 1, new Point3f(0.f, 0.f, y[div]));\r
-        \r
-        setCoordinate(coordinates,numVertices, new Point3f(x2[0], 0.f, 0.f));\r
-        for (int i = 1; i < div; i++) {\r
-            int index = (div+i) * 2 - 1;\r
-            setCoordinate(coordinates,index,new Point3f(x[i],y[1],y[i]));\r
-            setCoordinate(coordinates,index+1,new Point3f(x2[i],y2[1],y2[i]));  \r
-        }\r
-        setCoordinate(coordinates,numVertices*2 - 1, new Point3f(0.f, 0.f, y2[div]));\r
-\r
-        TriMesh liney = new TriMesh(PICK_NAME+Y_NAME,BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        \r
-        for (int i = 0; i < numVertices*2; i++)\r
-          setColor(cols,i, colorz);\r
-        \r
-        setCoordinate(coordinates,0, new Point3f(0.f, x[0], 0.f));\r
-        for (int i = 1; i < div; i++) {\r
-            int index = i * 2 - 1;\r
-            setCoordinate(coordinates,index,new Point3f(y[i],x[i],0.f));\r
-            setCoordinate(coordinates,index+1,new Point3f(y[i],x[i],y[1]));  \r
-        }\r
-        setCoordinate(coordinates,numVertices - 1, new Point3f(y[div],0.f, 0.f));\r
-\r
-        setCoordinate(coordinates,numVertices, new Point3f(0.f, x2[0], 0.f));\r
-        for (int i = 1; i < div; i++) {\r
-            int index = (div+i) * 2 - 1;\r
-            setCoordinate(coordinates,index,new Point3f(y[i],x[i],y[1]));\r
-            setCoordinate(coordinates,index+1,new Point3f(y2[i],x2[i],y2[1]));  \r
-        }\r
-        setCoordinate(coordinates,numVertices*2 - 1, new Point3f(y2[div],0.f, 0.f));\r
-\r
-        TriMesh linez = new TriMesh(PICK_NAME+Z_NAME,BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        \r
-        numVertices = (div-2)*3+1;\r
-        coordinates = new float[numVertices*3];\r
-        cols = new float[numVertices*4];\r
-        indices = new int[(div-2)*3*3];\r
-        \r
-        for (int i = 0; i < numVertices; i++)\r
-            setColor(cols,i, colorxyz);\r
-        float center = radius * 0.5f;//(float)Math.cos(Math.PI*0.25);\r
-        setCoordinate(coordinates,0,new Point3f(center,center,center));\r
-        for (int i = 1; i < div; i++) {\r
-            int index = i;\r
-            setCoordinate(coordinates,index,new Point3f(y2[1],x2[i],y2[i]));\r
-        }\r
-        for (int i = 1; i < div; i++) {\r
-            int index = i + div-1 - 1;\r
-            setCoordinate(coordinates,index,new Point3f(y2[i],y2[1],x2[i]));\r
-        }\r
-        for (int i = 1; i < div-1; i++) {\r
-            int index = i + 2*(div-1) -2;\r
-            setCoordinate(coordinates,index,new Point3f(x2[i],y2[i],y2[1]));\r
-        }\r
-        for (int i = 0; i < (div-2)*3; i++) {\r
-            int index = i*3;\r
-            int iindex = i+1;\r
-            indices[index] = 0;\r
-            indices[index+1] = iindex;\r
-            indices[index+2] = iindex+1;\r
-            if (iindex == (numVertices -1))\r
-                indices[index+2] = 1;\r
-            \r
-        }\r
-\r
-        TriMesh trianglexyz = new TriMesh(PICK_NAME+XYZ_NAME,BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        \r
-        getGizmoNode().attachChild(linex);\r
-        getGizmoNode().attachChild(liney);\r
-        getGizmoNode().attachChild(linez);\r
-        getGizmoNode().attachChild(trianglexyz);\r
-        getGizmoNode().setModelBound(new BoundingBox());\r
-        getGizmoNode().updateModelBound();\r
-        \r
-        linex.getBatch(0).setCastsShadows(false);\r
-        liney.getBatch(0).setCastsShadows(false);\r
-        linez.getBatch(0).setCastsShadows(false);\r
-        trianglexyz.getBatch(0).setCastsShadows(false);\r
-        \r
-        setGeometry(0,linex);\r
-        setGeometry(1,liney);\r
-        setGeometry(2,linez);\r
-        setGeometry(3,trianglexyz);\r
-             \r
-        setColor(0,0,colorx);\r
-        setColor(0,1,scolorx);\r
-        setColor(1,0,colory);\r
-        setColor(1,1,scolory);\r
-        setColor(2,0,colorz);\r
-        setColor(2,1,scolorz);\r
-        setColor(3,0,colorxyz);\r
-        setColor(3,1,scolorxyz);\r
-        \r
-        AlphaState as = renderer.createAlphaState();\r
-        as.setBlendEnabled(true);\r
-        as.setSrcFunction(AlphaState.DB_SRC_ALPHA);\r
-        as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as.setEnabled(true);\r
-        getGizmoNode().setRenderState(as);\r
-        MaterialState ms = renderer.createMaterialState();\r
-        ms.setColorMaterial(MaterialState.CM_AMBIENT_AND_DIFFUSE);\r
-        ms.setMaterialFace(MaterialState.MF_FRONT_AND_BACK);\r
-        getGizmoNode().setRenderState(ms);\r
-        ZBufferState zs = renderer.createZBufferState();\r
-        zs.setFunction(ZBufferState.CF_ALWAYS);\r
-        zs.setEnabled(true);\r
-        getGizmoNode().setRenderState(zs);\r
-        \r
-        \r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/TransformGizmo.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/TransformGizmo.java
deleted file mode 100644 (file)
index b0e6df4..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.gizmo;\r
-\r
-import javax.vecmath.Color4f;\r
-import javax.vecmath.Point3f;\r
-\r
-import com.jme.bounding.BoundingBox;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.ZBufferState;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-\r
-public class TransformGizmo extends MultiSelectionGizmo {\r
-\r
-    \r
-    public static String PICK_NAME = "translate";\r
-    public static String X_NAME = "ax";\r
-    public static String Y_NAME = "ay";\r
-    public static String Z_NAME = "az";\r
-    public static String XZ_NAME = "xz";\r
-    public static String XY_NAME = "xy";\r
-    public static String YZ_NAME = "yz";\r
-    public static String XYZ_NAME = "aa";\r
-    \r
-    public static final int X = 0;\r
-    public static final int Y = 1;\r
-    public static final int Z = 2;\r
-    public static final int XY = 3;\r
-    public static final int XZ = 4;\r
-    public static final int YZ = 5;\r
-    public static final int XYZ = 6;\r
-\r
-    \r
-    \r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.common.Gizmo#getPickPrefix()\r
-     */\r
-    public String getPickPrefix() {\r
-        return PICK_NAME;\r
-    }\r
-    \r
-    public int getIndexForName(String name) {\r
-        if (!name.startsWith(PICK_NAME)) {\r
-            return -1;\r
-        }\r
-        name = name.substring(PICK_NAME.length());\r
-        if (name.startsWith(X_NAME))\r
-            return X;\r
-        if (name.startsWith(Y_NAME))\r
-            return Y;\r
-        if (name.startsWith(Z_NAME))\r
-            return Z;\r
-        if (name.startsWith(XY_NAME))\r
-            return XY;\r
-        if (name.startsWith(XZ_NAME))\r
-            return XZ;\r
-        if (name.startsWith(YZ_NAME))\r
-            return YZ;\r
-        if (name.startsWith(XYZ_NAME))\r
-            return XYZ;\r
-        return -1;\r
-    }\r
-    \r
-    @Override\r
-    public int getCount() {\r
-        return 7;\r
-    }\r
-\r
-    \r
-    /*\r
-     public TransformGizmo() {\r
-     */\r
-    public TransformGizmo(Renderer renderer) {\r
-        super();\r
-        float size = 2.f;\r
-        float sizeD2 = 1.f;\r
-        float offset = 0.2f;\r
-        \r
-        Color4f colorx = new Color4f(0.5f,0.f,0.f,0.5f);\r
-        Color4f colory = new Color4f(0.f,0.5f,0.f,0.5f);\r
-        Color4f colorz = new Color4f(0.f,0.f,0.5f,0.5f);\r
-        Color4f scolorx = new Color4f(1.f,0.f,0.f,0.7f);\r
-        Color4f scolory = new Color4f(0.f,1.f,0.f,0.7f);\r
-        Color4f scolorz = new Color4f(0.f,0.f,1.f,0.7f);\r
-        \r
-        Color4f colorxy = new Color4f();\r
-        colorxy.x = colorx.x + colory.x;\r
-        colorxy.y = colorx.y + colory.y;\r
-        colorxy.z = colorx.z + colory.z;\r
-        colorxy.w = 0.5f;\r
-        \r
-        Color4f colorxz = new Color4f();\r
-        colorxz.x = colorx.x + colorz.x;\r
-        colorxz.y = colorx.y + colorz.y;\r
-        colorxz.z = colorx.z + colorz.z;\r
-        colorxz.w = 0.5f;\r
-        \r
-        Color4f coloryz = new Color4f();\r
-        coloryz.x = colory.x + colorz.x;\r
-        coloryz.y = colory.y + colorz.y;\r
-        coloryz.z = colory.z + colorz.z;\r
-        coloryz.w = 0.5f;\r
-        \r
-        Color4f colorxyz = new Color4f();\r
-        colorxyz.x = colorx.x + colory.x + colorz.x;\r
-        colorxyz.y = colorx.y + colory.y + colorz.y;\r
-        colorxyz.z = colorx.z +colory.z + colorz.z;\r
-        colorxyz.w = 0.5f;\r
-        \r
-        Color4f scolorxy = new Color4f();\r
-        scolorxy.x = scolory.x + scolorx.x;\r
-        scolorxy.y = scolory.y + scolorx.y;\r
-        scolorxy.z = scolory.z + scolorx.z;\r
-        scolorxy.w = 0.5f;\r
-        \r
-        Color4f scolorxz = new Color4f();\r
-        scolorxz.x = scolorx.x + scolorz.x;\r
-        scolorxz.y = scolorx.y + scolorz.y;\r
-        scolorxz.z = scolorx.z + scolorz.z;\r
-        scolorxz.w = 0.5f;\r
-        \r
-        Color4f scoloryz = new Color4f();\r
-        scoloryz.x = scolory.x + scolorz.x;\r
-        scoloryz.y = scolory.y + scolorz.y;\r
-        scoloryz.z = scolory.z + scolorz.z;\r
-        scoloryz.w = 0.5f;\r
-        \r
-        Color4f scolorxyz = new Color4f();\r
-        scolorxyz.x = scolorx.x + scolory.x + scolorz.x;\r
-        scolorxyz.y = scolorx.y + scolory.y + scolorz.y;\r
-        scolorxyz.z = scolorx.z + scolory.z + scolorz.z;\r
-        scolorxyz.w = 0.5f;\r
-        \r
-        \r
-        float coordinates[] = new float[6*3];\r
-        float cols[] = new float[6*4];\r
-        int[] indices = new int[]{0,1,3,\r
-                                  1,2,3,\r
-                                  0,3,5,\r
-                                  3,4,5};\r
-        for (int i = 0; i < 6; i++)\r
-          setColor(cols,i, colorx);\r
-\r
-        setCoordinate(coordinates,0, new Point3f(size, 0.f, 0.f));\r
-        setCoordinate(coordinates,1, new Point3f(size - offset, offset, 0.f));\r
-        setCoordinate(coordinates,2, new Point3f(sizeD2 - offset, offset, 0.f));\r
-        setCoordinate(coordinates,3, new Point3f(sizeD2, 0.f, 0.f));\r
-        setCoordinate(coordinates,4, new Point3f(sizeD2 - offset, 0.f, offset));\r
-        setCoordinate(coordinates,5, new Point3f(size - offset, 0.f, offset));\r
-\r
-        TriMesh linex = new TriMesh("",BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        for (int i = 0; i < 6; i++)\r
-          setColor(cols,i, colory);\r
-\r
-        setCoordinate(coordinates,0, new Point3f(0.f, size, 0.f));\r
-        setCoordinate(coordinates,1, new Point3f(offset, size - offset, 0.f));\r
-        setCoordinate(coordinates,2, new Point3f(offset, sizeD2 - offset, 0.f));\r
-        setCoordinate(coordinates,3, new Point3f(0.f, sizeD2, 0.f));\r
-        setCoordinate(coordinates,4, new Point3f(0.f, sizeD2 - offset, offset));\r
-        setCoordinate(coordinates,5, new Point3f(0.f, size - offset, offset));\r
-\r
-        TriMesh liney = new TriMesh("",BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        for (int i = 0; i < 6; i++)\r
-          setColor(cols,i, colorz);\r
-\r
-        setCoordinate(coordinates,0, new Point3f(0.f, 0.f,size));\r
-        setCoordinate(coordinates,1, new Point3f(offset, 0.f, size - offset));\r
-        setCoordinate(coordinates,2, new Point3f(offset, 0.f, sizeD2 - offset));\r
-        setCoordinate(coordinates,3, new Point3f(0.f, 0.f, sizeD2));\r
-        setCoordinate(coordinates,4, new Point3f(0.f, offset, sizeD2 - offset));\r
-        setCoordinate(coordinates,5, new Point3f(0.f, offset, size - offset));\r
-\r
-        TriMesh linez = new TriMesh("",BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        // TODO : picking did not work properly without chancing indices; this must be investigated \r
-        indices = new int[]{2,1,3,0,1,3};//{0,1,3,1,2,3};\r
-        coordinates = new float[4*3];\r
-        cols = new float[4*4];\r
-        \r
-        for (int i = 0; i < 4; i++)\r
-           setColor(cols,i, colorxz);\r
-        setCoordinate(coordinates,0, new Point3f(offset, 0.f, size-offset));\r
-        setCoordinate(coordinates,1, new Point3f(offset, 0.f, sizeD2 - offset));\r
-        setCoordinate(coordinates,2, new Point3f(sizeD2 - offset, 0.f, offset));\r
-        setCoordinate(coordinates,3, new Point3f(size-offset, 0.f, offset));\r
-\r
-        TriMesh trianglexz = new TriMesh("",BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        for (int i = 0; i < 4; i++)\r
-            setColor(cols,i, colorxy);\r
-        setCoordinate(coordinates,0, new Point3f(offset, size-offset, 0.f));\r
-        setCoordinate(coordinates,1, new Point3f(offset, sizeD2 - offset, 0.f));\r
-        setCoordinate(coordinates,2, new Point3f(sizeD2 - offset, offset, 0.f));\r
-        setCoordinate(coordinates,3, new Point3f(size-offset, offset, 0.f));\r
-\r
-        TriMesh trianglexy = new TriMesh("",BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        for (int i = 0; i < 4; i++)\r
-            setColor(cols,i, coloryz);\r
-        setCoordinate(coordinates,0, new Point3f( 0.f,offset, size-offset));\r
-        setCoordinate(coordinates,1, new Point3f( 0.f,offset, sizeD2 - offset));\r
-        setCoordinate(coordinates,2, new Point3f( 0.f,sizeD2 - offset, offset));\r
-        setCoordinate(coordinates,3, new Point3f( 0.f,size-offset, offset));\r
-\r
-        TriMesh triangleyz = new TriMesh("",BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        indices = new int[]{0,1,2,\r
-                            0,2,3,\r
-                            0,3,4,\r
-                            0,4,5,\r
-                            0,5,6,\r
-                            0,6,7,\r
-                            0,7,8,\r
-                            0,8,9,\r
-                            0,9,1};\r
-        coordinates = new float[10*3];\r
-        cols = new float[10*4];\r
-        \r
-        for (int i = 0; i < 10; i++)\r
-            setColor(cols,i, colorxyz);\r
-        setCoordinate(coordinates,0, new Point3f(0.f, 0.f, 0.f));\r
-        setCoordinate(coordinates,1, new Point3f(sizeD2, 0.f, 0.f));\r
-        setCoordinate(coordinates,2, new Point3f(sizeD2 - offset, offset, 0.f));\r
-        setCoordinate(coordinates,3, new Point3f(offset, sizeD2 - offset, 0.f));\r
-        setCoordinate(coordinates,4, new Point3f(0.f, sizeD2, 0.f));\r
-        setCoordinate(coordinates,5, new Point3f(0.f, sizeD2 - offset, offset));\r
-        setCoordinate(coordinates,6, new Point3f(0.f, offset, sizeD2-offset));\r
-        setCoordinate(coordinates,7, new Point3f(0.f, 0.f, sizeD2));\r
-        setCoordinate(coordinates,8, new Point3f(offset, 0.f, sizeD2-offset));\r
-        setCoordinate(coordinates,9, new Point3f(sizeD2-offset, 0.f, offset));\r
-        \r
-        TriMesh trianglexyz = new TriMesh("",BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        linex.setName(PICK_NAME+X_NAME);\r
-        liney.setName(PICK_NAME+Y_NAME);\r
-        linez.setName(PICK_NAME+Z_NAME);\r
-        trianglexy.setName(PICK_NAME+XY_NAME);\r
-        trianglexz.setName(PICK_NAME+XZ_NAME);\r
-        triangleyz.setName(PICK_NAME+YZ_NAME);\r
-        trianglexyz.setName(PICK_NAME+XYZ_NAME);\r
-        \r
-        linex.getBatch(0).setCastsShadows(false);\r
-        liney.getBatch(0).setCastsShadows(false);\r
-        linez.getBatch(0).setCastsShadows(false);\r
-        trianglexy.getBatch(0).setCastsShadows(false);\r
-        trianglexz.getBatch(0).setCastsShadows(false);\r
-        triangleyz.getBatch(0).setCastsShadows(false);\r
-        trianglexyz.getBatch(0).setCastsShadows(false);\r
-\r
-        getGizmoNode().attachChild(linex);\r
-        getGizmoNode().attachChild(liney);\r
-        getGizmoNode().attachChild(linez);\r
-        getGizmoNode().attachChild(trianglexy);\r
-        getGizmoNode().attachChild(trianglexz);\r
-        getGizmoNode().attachChild(triangleyz);\r
-        getGizmoNode().attachChild(trianglexyz);\r
-        getGizmoNode().setModelBound(new BoundingBox());\r
-        getGizmoNode().updateModelBound();\r
-\r
-        setGeometry(0,linex);\r
-        setGeometry(1,liney);\r
-        setGeometry(2,linez);\r
-        setGeometry(3,trianglexy);\r
-        setGeometry(4,trianglexz);\r
-        setGeometry(5,triangleyz);\r
-        setGeometry(6,trianglexyz);\r
-       \r
-        \r
-        setColor(0,0,colorx);\r
-        setColor(0,1,scolorx);\r
-        setColor(1,0,colory);\r
-        setColor(1,1,scolory);\r
-        setColor(2,0,colorz);\r
-        setColor(2,1,scolorz);\r
-        setColor(3,0,colorxy);\r
-        setColor(3,1,scolorxy);\r
-        setColor(4,0,colorxz);\r
-        setColor(4,1,scolorxz);\r
-        setColor(5,0,coloryz);\r
-        setColor(5,1,scoloryz);\r
-        setColor(6,0,colorxyz);\r
-        setColor(6,1,scolorxyz);\r
-        \r
-\r
-        AlphaState as = renderer.createAlphaState();   \r
-        as.setBlendEnabled(true);\r
-        as.setSrcFunction(AlphaState.DB_SRC_ALPHA);\r
-        as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as.setEnabled(true);\r
-        getGizmoNode().setRenderState(as);\r
-        MaterialState ms = renderer.createMaterialState();\r
-        ms.setColorMaterial(MaterialState.CM_AMBIENT_AND_DIFFUSE);\r
-        ms.setMaterialFace(MaterialState.MF_FRONT_AND_BACK);\r
-        getGizmoNode().setRenderState(ms);\r
-        ZBufferState zs = renderer.createZBufferState();\r
-        zs.setFunction(ZBufferState.CF_ALWAYS);\r
-        zs.setEnabled(true);\r
-        zs.setWritable(false);\r
-        getGizmoNode().setRenderState(zs);\r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/TransformInlineGizmo.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/gizmo/TransformInlineGizmo.java
deleted file mode 100644 (file)
index 23ba6e0..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.gizmo;\r
-\r
-import java.nio.FloatBuffer;\r
-\r
-import javax.vecmath.Color4f;\r
-import javax.vecmath.Point3f;\r
-import javax.vecmath.Vector3f;\r
-\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-\r
-import com.jme.bounding.BoundingBox;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.ZBufferState;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-\r
-public class TransformInlineGizmo extends AbstractGizmo {\r
-\r
-       TriMesh geom = new TriMesh();\r
-       ColorRGBA colors[] = new ColorRGBA[2];\r
-   \r
-    \r
-    public static String PICK_NAME = "translate";\r
-    public static String X_NAME = "ax";\r
-    \r
-    public static final int X = 0;\r
-    \r
-    public static final int SELECTED = 1;\r
-    public static final int UNSELECTED = 0;\r
-      \r
-    private boolean selected = false;\r
-    \r
-    \r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.common.Gizmo#getPickPrefix()\r
-     */\r
-    public String getPickPrefix() {\r
-        return PICK_NAME;\r
-    }\r
-    \r
-    public int getIndexForName(String name) {\r
-        if (!name.startsWith(PICK_NAME)) {\r
-            return -1;\r
-        }\r
-        name = name.substring(PICK_NAME.length());\r
-        if (name.startsWith(X_NAME))\r
-            return X;\r
-        return -1;\r
-    }\r
-    \r
-    private void updateColor(int sel) {\r
-       FloatBuffer buff = geom.getColorBuffer(0);\r
-       for (int i = 0; i < geom.getBatch(0).getVertexCount(); i++) {\r
-               BufferUtils.setInBuffer(colors[sel], buff, i);\r
-        }\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.common.Gizmo#changeSelected(java.lang.String)\r
-     */\r
-    public void setSelected(String name) {\r
-        \r
-        if (name == null) {\r
-               setChanged(true);\r
-            updateColor(UNSELECTED);\r
-            selected = false;\r
-            return;\r
-        }\r
-        int index = getIndexForName(name);\r
-        if (index == -1) {\r
-            selected = false;\r
-            return;\r
-        }\r
-\r
-        selected = true;\r
-        updateColor(SELECTED);\r
-        setChanged(true);\r
-        \r
-    }\r
-    \r
-    @Override\r
-    public void setScale(Vector3f scale) {\r
-       /**\r
-        * A bug in JME (?)\r
-        * Negative scaling breaks picking (ray hits the bounding box, but ray doesn't intersect any triangles) \r
-        */\r
-       scale.x = Math.abs(scale.x);\r
-       scale.y = Math.abs(scale.y);\r
-       scale.z = Math.abs(scale.z);\r
-       \r
-       super.setScale(scale);\r
-    }\r
-    \r
-    \r
-    /*\r
-     public TransformInlineGizmo(){\r
-     */\r
-    public TransformInlineGizmo(Renderer renderer) {\r
-       super();\r
-        float size = 2.f;\r
-        float sizeD2 = 1.f;\r
-        float offset = 0.07f;\r
-        \r
-        Color4f colorx = new Color4f(0.5f,0.f,0.f,0.5f);\r
-        Color4f scolorx = new Color4f(1.f,0.f,0.f,0.7f);\r
-        \r
-\r
-        float coordinates[] = new float[18*3];\r
-        float cols[] = new float[18*4];\r
-        int[] indices = new int[]{0,2,1,\r
-                                  0,3,2,\r
-                                  0,4,3,\r
-                                  0,1,4,\r
-                                  1,2,6,\r
-                                  1,6,5,\r
-                                  2,3,7,\r
-                                  2,7,6,\r
-                                  3,4,8,\r
-                                  3,8,7,\r
-                                  4,1,5,\r
-                                  4,5,8,\r
-                                  5,6,7,\r
-                                  5,7,8,\r
-                                  \r
-                                  9,11,10,\r
-                                  9,12,11,\r
-                                  9,13,12,\r
-                                  9,10,13,\r
-                                  10,11,15,\r
-                                  10,15,14,\r
-                                  11,12,16,\r
-                                  11,16,15,\r
-                                  12,13,17,\r
-                                  12,17,16,\r
-                                  13,10,14,\r
-                                  13,14,17,\r
-                                  14,15,16,\r
-                                  14,16,17\r
-                                  \r
-                                                         };\r
-        for (int i = 0; i < 18; i++)\r
-          setColor(cols,i, colorx);\r
-\r
-        setCoordinate(coordinates,0, new Point3f(size, 0.f, 0.f));\r
-        setCoordinate(coordinates,1, new Point3f(size - offset*2, offset, offset));\r
-        setCoordinate(coordinates,2, new Point3f(size - offset*2, offset, -offset));\r
-        setCoordinate(coordinates,3, new Point3f(size - offset*2, -offset, -offset));\r
-        setCoordinate(coordinates,4, new Point3f(size - offset*2, -offset, offset));\r
-        setCoordinate(coordinates,5, new Point3f(sizeD2, offset, offset));\r
-        setCoordinate(coordinates,6, new Point3f(sizeD2, offset, -offset));\r
-        setCoordinate(coordinates,7, new Point3f(sizeD2, -offset, -offset));\r
-        setCoordinate(coordinates,8, new Point3f(sizeD2, -offset, offset));\r
-        \r
-        setCoordinate(coordinates,9, new Point3f(-size, 0.f, 0.f));\r
-        setCoordinate(coordinates,10, new Point3f(-size + offset*2, offset, offset));\r
-        setCoordinate(coordinates,11, new Point3f(-size + offset*2, offset, -offset));\r
-        setCoordinate(coordinates,12, new Point3f(-size + offset*2, -offset, -offset));\r
-        setCoordinate(coordinates,13, new Point3f(-size + offset*2, -offset, offset));\r
-        setCoordinate(coordinates,14, new Point3f(-sizeD2, offset, offset));\r
-        setCoordinate(coordinates,15, new Point3f(-sizeD2, offset, -offset));\r
-        setCoordinate(coordinates,16, new Point3f(-sizeD2, -offset, -offset));\r
-        setCoordinate(coordinates,17, new Point3f(-sizeD2, -offset, offset));\r
-\r
-        TriMesh linex = new TriMesh(PICK_NAME+X_NAME,BufferUtils.createFloatBuffer(coordinates),null,BufferUtils.createFloatBuffer(cols),null,BufferUtils.createIntBuffer(indices));\r
-        \r
-        getGizmoNode().attachChild(linex);\r
-        getGizmoNode().setModelBound(new BoundingBox());\r
-        getGizmoNode().updateModelBound();\r
-\r
-        geom = linex;\r
-        geom.getBatch(0).setCastsShadows(false);\r
-\r
-        colors[0] = VecmathJmeTools.get(colorx);\r
-        colors[1] = VecmathJmeTools.get(scolorx);\r
-        \r
-        AlphaState as = renderer.createAlphaState();\r
-        as.setBlendEnabled(true);\r
-        as.setSrcFunction(AlphaState.DB_SRC_ALPHA);\r
-        as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as.setEnabled(true);\r
-        getGizmoNode().setRenderState(as);\r
-        MaterialState ms = renderer.createMaterialState();\r
-        ms.setColorMaterial(MaterialState.CM_AMBIENT_AND_DIFFUSE);\r
-        ms.setMaterialFace(MaterialState.MF_FRONT_AND_BACK);\r
-        getGizmoNode().setRenderState(ms);\r
-        ZBufferState zs = renderer.createZBufferState();\r
-        zs.setFunction(ZBufferState.CF_ALWAYS);\r
-        zs.setEnabled(true);\r
-        getGizmoNode().setRenderState(zs);\r
-        \r
-    }\r
-    \r
-\r
-    public boolean isSelected() {\r
-        return selected;\r
-    }\r
-\r
-    public void setSelected(boolean selected) {\r
-        this.selected = selected;\r
-    }\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/AWTInputProvider.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/AWTInputProvider.java
deleted file mode 100644 (file)
index ec15239..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.input;\r
-\r
-import java.awt.event.KeyEvent;\r
-import java.awt.event.KeyListener;\r
-import java.awt.event.MouseEvent;\r
-import java.awt.event.MouseListener;\r
-import java.awt.event.MouseMotionListener;\r
-\r
-public class AWTInputProvider implements KeyListener, MouseListener, MouseMotionListener , InputProvider{\r
-    \r
-    private boolean keyPressed[] = new boolean[1024];\r
-    private boolean keyTemp[] = new boolean[1024];\r
-    private boolean keyDown[] = new boolean[1024];\r
-    private boolean keyUp[] = new boolean[1024];\r
-    \r
-    private int awtMouseX = 0;\r
-    private int awtMouseY = 0;\r
-    private boolean awtPressed = false;\r
-    private boolean awtDragged = false;\r
-    private boolean awtReleased = false;\r
-    private boolean awtMouseClicked = false;\r
-    private boolean awtMouseMoved = false;\r
-    \r
-    private int awtPressModifiers = 0;\r
-    private int awtDragModifiers = 0;\r
-    private int awtClickModifiers = 0;\r
-    private int awtMoveModifiers = 0;\r
-    private int awtClickButton = 0;\r
-     \r
-    private int mouseX = 0;\r
-    private int mouseY = 0;\r
-    \r
-    private int prevMouseX = 0;\r
-    private int prevMouseY = 0;\r
-    \r
-    private boolean mousePressed = false;\r
-    private boolean mouseDragged = false;\r
-    private boolean mouseReleased = false;\r
-    private boolean mouseClicked = false;\r
-    private boolean mouseMoved = false;\r
-    \r
-    private int pressModifiers = 0;\r
-    private int clickModifiers = 0;\r
-    private int dragModifiers = 0;\r
-    private int clickButton = 0;\r
-    private int moveModifiers = 0;\r
-    \r
-    public AWTInputProvider() {\r
-        for (int i = 0; i < keyDown.length; i++) {\r
-            keyDown[i] = false;\r
-            keyTemp[i] = false;\r
-            keyPressed[i] = false;  \r
-            keyUp[i] = false;\r
-        }\r
-    }\r
-    \r
-    public boolean keyPressed(int i) {\r
-        return keyPressed[i];\r
-    }\r
-    \r
-    public boolean keyDown(int i) {\r
-        return keyDown[i];\r
-    }\r
-    \r
-    public boolean keyUp(int i) {\r
-       return keyUp[i];\r
-    }\r
-    \r
-    public int mouseX() {\r
-        return mouseX;\r
-    }\r
-    \r
-    public int mouseY() {\r
-        return mouseY;\r
-    }\r
-    \r
-    public int prevMouseX() {\r
-        return prevMouseX;\r
-    }\r
-    \r
-    public int prevMouseY() {\r
-        return prevMouseY;\r
-    }\r
-    \r
-    public boolean mousePressed() {\r
-        return mousePressed;\r
-    }\r
-    \r
-    public boolean mouseMoved() {\r
-        return mouseMoved;\r
-    }\r
-    \r
-    public boolean mouseReleased() {\r
-        return mouseReleased;\r
-    }\r
-    \r
-    public boolean mouseClicked() {\r
-        return mouseClicked;\r
-    }\r
-    \r
-    public boolean mouseDragged() {\r
-        return mouseDragged;\r
-    }\r
-    \r
-    public int pressModifiers() {\r
-        return pressModifiers;\r
-    }\r
-    \r
-    public int clickModifiers() {\r
-        return clickModifiers;\r
-    }\r
-    \r
-    public int dragModifiers() {\r
-        return dragModifiers;\r
-    }\r
-    \r
-    public int moveModifiers() {\r
-        return moveModifiers;\r
-    }\r
-    \r
-    public int clickButton() {\r
-        return clickButton;\r
-    }\r
-    \r
-    \r
-    public void update() {\r
-        prevMouseX = mouseX;\r
-        prevMouseY = mouseY;\r
-        mouseX = awtMouseX;\r
-        mouseY = awtMouseY;\r
-        //System.out.println(mouseX + " " + mouseY);\r
-        mousePressed = awtPressed;\r
-        awtPressed = false;\r
-        mouseReleased = awtReleased;\r
-        awtReleased = false;\r
-        mouseMoved = awtMouseMoved;\r
-        awtMouseMoved = false;\r
-        mouseDragged = awtDragged;\r
-        awtDragged = false;\r
-        mouseClicked = awtMouseClicked;\r
-        awtMouseClicked = false;\r
-        pressModifiers = awtPressModifiers;\r
-       // awtPressModifiers = 0;\r
-        clickModifiers = awtClickModifiers;\r
-        //awtClickModifiers = 0;\r
-        dragModifiers = awtDragModifiers;\r
-       // awtDragModifiers = 0;\r
-        moveModifiers = awtMoveModifiers;\r
-        //awtMoveModifiers = 0;\r
-        clickButton = awtClickButton;\r
-        awtClickButton = 0;\r
-        for (int i = 0; i < keyDown.length; i++) {\r
-            if (keyDown[i] && !keyTemp[i]) {\r
-              keyTemp[i] = true;\r
-              keyPressed[i] = true;\r
-            }\r
-            else if (keyDown[i] && keyTemp[i]) {\r
-             keyPressed[i] = false;\r
-            }\r
-            else if (!keyDown[i] && keyTemp[i]) {\r
-               keyUp[i] = true;\r
-               keyTemp[i] = false;\r
-                keyPressed[i] = false;\r
-            }\r
-            else if (!keyDown[i]) {\r
-              keyTemp[i] = false;\r
-              keyPressed[i] = false;\r
-              keyUp[i] = false;\r
-            }\r
-          }\r
-    \r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)\r
-     */\r
-    public void mouseDragged(MouseEvent e) {\r
-        awtMouseX = e.getX();\r
-        awtMouseY = e.getY();\r
-        awtDragged = true;\r
-        awtDragModifiers = e.getModifiers() | e.getButton();\r
-    }\r
\r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)\r
-     */\r
-    public void mouseReleased(MouseEvent e) {\r
-        awtReleased = true;\r
-        //ms.set(msTmp);\r
-\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
-     */\r
-    public void mouseClicked(MouseEvent e) {\r
-\r
-        awtMouseX = e.getX();\r
-        awtMouseY = e.getY();\r
-        e.getButton();\r
-        \r
-        awtClickModifiers  = e.getModifiersEx();\r
-        awtClickButton = e.getButton();\r
-        awtMouseClicked = true;\r
-\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)\r
-     */\r
-    public void mouseEntered(MouseEvent arg0) {\r
-\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)\r
-     */\r
-    public void mouseExited(MouseEvent arg0) {\r
-\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)\r
-     */\r
-    public void mouseMoved(MouseEvent arg0) {\r
-\r
-        awtMouseMoved = true;\r
-        awtMouseX = arg0.getX();\r
-        awtMouseY = arg0.getY();\r
-        awtMoveModifiers  = arg0.getModifiersEx();\r
-\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)\r
-     */\r
-    public void keyPressed(KeyEvent arg0) {\r
-           keyDown[arg0.getKeyCode()] = true;\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)\r
-     */\r
-    public void keyReleased(KeyEvent arg0) {\r
-           keyDown[arg0.getKeyCode()] = false;\r
-    }\r
-    \r
\r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)\r
-     */\r
-    public void keyTyped(KeyEvent e) {\r
-\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)\r
-     */\r
-    public void mousePressed(MouseEvent e) {\r
-        awtMouseX = e.getX();\r
-        awtMouseY = e.getY();\r
-        awtPressed = true;\r
-        awtPressModifiers = e.getModifiers() | e.getButton();\r
-    }\r
-    \r
-    public void setMouseMoved(boolean b) {\r
-\r
-    }\r
-    \r
-    public void setMouseX(int x) {\r
-\r
-    }\r
-    \r
-    public void setMouseY(int y) {\r
-\r
-    }\r
-    \r
-    public String toString() {\r
-        String s = "";\r
-        s += "(" + mouseX + "," + mouseY + ")\n";\r
-        s += "Pressed " + mousePressed + "\n";\r
-        s += "Released " + mouseReleased + "\n";\r
-        s += "Moved " + mouseMoved + "\n";\r
-        s += "Dragged " + mouseDragged + "\n";\r
-        s += "Clicked " + mouseClicked + "\n";\r
-        s += "DragModifiers " + dragModifiers + "\n";\r
-        s += "ClickModifiers " + clickModifiers + "\n";\r
-        s += "PressModifiers " + pressModifiers + "\n";\r
-        return s;\r
-    }\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/InputProvider.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/InputProvider.java
deleted file mode 100644 (file)
index 1f1f56b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.input;\r
-\r
-\r
-/**\r
- * InputProvider is used to listen inputs from AWT-thread, \r
- * and then input actions can be polled from the provider.\r
- * \r
- * TODO : use methods instead of public members\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public interface InputProvider {\r
-    \r
-    \r
-    \r
-    public boolean keyPressed(int i);\r
-    \r
-    public boolean keyDown(int i);\r
-    \r
-    public boolean keyUp(int i);\r
-    \r
-    public int mouseX();\r
-    \r
-    public int mouseY();\r
-    \r
-    public int prevMouseX();\r
-    \r
-    public int prevMouseY();\r
-    \r
-    public boolean mousePressed();\r
-    \r
-    public boolean mouseMoved();\r
-    \r
-    public boolean mouseReleased();\r
-    \r
-    public boolean mouseClicked();\r
-    \r
-    public boolean mouseDragged();\r
-    \r
-    public int pressModifiers();\r
-    \r
-    public int clickModifiers();\r
-    \r
-    public int dragModifiers();\r
-    \r
-    public int moveModifiers();\r
-    \r
-    public int clickButton();\r
-    \r
-    \r
-    public void update();\r
-    \r
-    // FIXME : when dnd is used, mouse inputs won't get passed\r
-    \r
-    public void setMouseX(int x);\r
-    public void setMouseY(int y);\r
-    public void setMouseMoved(boolean b);\r
-    \r
-    \r
-   \r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/SWTInputProvider.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/input/SWTInputProvider.java
deleted file mode 100644 (file)
index a21d3b7..0000000
+++ /dev/null
@@ -1,511 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.input;\r
-\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.FocusEvent;\r
-import org.eclipse.swt.events.FocusListener;\r
-import org.eclipse.swt.events.KeyEvent;\r
-import org.eclipse.swt.events.KeyListener;\r
-import org.eclipse.swt.events.MouseEvent;\r
-import org.eclipse.swt.events.MouseListener;\r
-import org.eclipse.swt.events.MouseMoveListener;\r
-import org.eclipse.swt.events.MouseTrackListener;\r
-\r
-public class SWTInputProvider implements KeyListener, MouseListener, MouseMoveListener, MouseTrackListener, InputProvider, FocusListener {\r
-    \r
-    private static final int PRESS_TIME = 200;\r
-    \r
-    private boolean keyPressed[] = new boolean[1024];\r
-    private boolean keyTemp[] = new boolean[1024];\r
-    private boolean keyDown[] = new boolean[1024];\r
-    private boolean keyUp[] = new boolean[1024];\r
-    \r
-    private int awtMouseX = 0;\r
-    private int awtMouseY = 0;\r
-    private boolean awtPressed = false;\r
-    private boolean awtDragged = false;\r
-    private boolean awtReleased = false;\r
-    private boolean awtMouseClicked = false;\r
-    private boolean awtMouseMoved = false;\r
-    \r
-    private boolean swtMouse1Down = false;\r
-    private boolean swtMouse2Down = false;\r
-    private boolean swtMouse3Down = false;\r
-    \r
-    long mouse1DownTime = 0;\r
-    long mouse2DownTime = 0;\r
-    long mouse3DownTime = 0;\r
-    \r
-    private int awtPressModifiers = 0;\r
-    private int awtDragModifiers = 0;\r
-    private int awtClickModifiers = 0;\r
-    private int awtMoveModifiers = 0;\r
-    private int awtClickButton = 0;\r
-     \r
-    private int mouseX = 0;\r
-    private int mouseY = 0;\r
-    \r
-    private int prevMouseX = 0;\r
-    private int prevMouseY = 0;\r
-    \r
-    private boolean mousePressed = false;\r
-    private boolean mouseDragged = false;\r
-    private boolean mouseReleased = false;\r
-    private boolean mouseClicked = false;\r
-    private boolean mouseMoved = false;\r
-    \r
-    private int pressModifiers = 0;\r
-    private int clickModifiers = 0;\r
-    private int dragModifiers = 0;\r
-    private int clickButton = 0;\r
-    private int moveModifiers = 0;\r
-    \r
-    public SWTInputProvider() {\r
-        reset();\r
-    }\r
-    \r
-    private void reset() {\r
-       for (int i = 0; i < keyDown.length; i++) {\r
-            keyDown[i] = false;\r
-            keyTemp[i] = false;\r
-            keyPressed[i] = false; \r
-            keyUp[i] = false;\r
-        }\r
-        mousePressed = false;\r
-        mouseDragged = false;\r
-        mouseReleased = false;\r
-        mouseClicked = false;\r
-        mouseMoved = false;\r
-        \r
-        pressModifiers = 0;\r
-        clickModifiers = 0;\r
-        dragModifiers = 0;\r
-        clickButton = 0;\r
-        moveModifiers = 0;\r
-    }\r
-    \r
-    public boolean keyPressed(int i) {\r
-        return keyPressed[i];\r
-    }\r
-    \r
-    public boolean keyDown(int i) {\r
-        return keyDown[i];\r
-    }\r
-    \r
-    public boolean keyUp(int i) {\r
-       return keyUp[i];\r
-    }\r
-    \r
-    public int mouseX() {\r
-        return mouseX;\r
-    }\r
-    \r
-    public int mouseY() {\r
-        return mouseY;\r
-    }\r
-    \r
-    public int prevMouseX() {\r
-        return prevMouseX;\r
-    }\r
-    \r
-    public int prevMouseY() {\r
-        return prevMouseY;\r
-    }\r
-    \r
-    public boolean mousePressed() {\r
-        return mousePressed;\r
-    }\r
-    \r
-    public boolean mouseMoved() {\r
-        return mouseMoved;\r
-    }\r
-    \r
-    public boolean mouseReleased() {\r
-        return mouseReleased;\r
-    }\r
-    \r
-    public boolean mouseClicked() {\r
-        return mouseClicked;\r
-    }\r
-    \r
-    public boolean mouseDragged() {\r
-        return mouseDragged;\r
-    }\r
-    \r
-    public int pressModifiers() {\r
-        return pressModifiers;\r
-    }\r
-    \r
-    public int clickModifiers() {\r
-        return clickModifiers;\r
-    }\r
-    \r
-    public int dragModifiers() {\r
-        return dragModifiers;\r
-    }\r
-    \r
-    public int moveModifiers() {\r
-        return moveModifiers;\r
-    }\r
-    \r
-    public int clickButton() {\r
-        return clickButton;\r
-    }\r
-    \r
-    \r
-    public void update() {\r
-        prevMouseX = mouseX;\r
-        prevMouseY = mouseY;\r
-        mouseX = awtMouseX;\r
-        mouseY = awtMouseY;\r
-        //System.out.println(mouseX + " " + mouseY);\r
-        mousePressed = awtPressed;\r
-        awtPressed = false;\r
-        mouseReleased = awtReleased;\r
-        awtReleased = false;\r
-        mouseMoved = awtMouseMoved;\r
-        awtMouseMoved = false;\r
-        mouseDragged = awtDragged;\r
-        awtDragged = false;\r
-        mouseClicked = awtMouseClicked;\r
-        awtMouseClicked = false;\r
-        pressModifiers = awtPressModifiers;\r
-       // awtPressModifiers = 0;\r
-        clickModifiers = awtClickModifiers;\r
-        //awtClickModifiers = 0;\r
-        dragModifiers = awtDragModifiers;\r
-       // awtDragModifiers = 0;\r
-        moveModifiers = awtMoveModifiers;\r
-        //awtMoveModifiers = 0;\r
-        clickButton = awtClickButton;\r
-        awtClickButton = 0;\r
-        for (int i = 0; i < keyDown.length; i++) {\r
-            if (keyDown[i] && !keyTemp[i]) {\r
-              keyTemp[i] = true;\r
-              keyPressed[i] = true;\r
-            }\r
-            else if (keyDown[i] && keyTemp[i]) {\r
-             keyPressed[i] = false;\r
-            }\r
-            else if (!keyDown[i] && keyTemp[i]) {\r
-               keyUp[i] = true;\r
-               keyTemp[i] = false;\r
-                keyPressed[i] = false;\r
-            }\r
-            else if (!keyDown[i]) {\r
-              keyTemp[i] = false;\r
-              keyPressed[i] = false;\r
-              keyUp[i] = false;\r
-            }\r
-          }\r
-    \r
-    }\r
-    \r
\r
-\r
-\r
-    private int getAWTKeyCode(int swtKeyCode) {\r
-        if(swtKeyCode > keyDown.length) {\r
-            int keyCode = 0;\r
-            switch (swtKeyCode) {\r
-            case SWT.CTRL:\r
-                keyCode = java.awt.event.KeyEvent.VK_CONTROL;\r
-                break;\r
-            case SWT.ALT:\r
-                keyCode = java.awt.event.KeyEvent.VK_ALT;\r
-                break;\r
-            \r
-            case SWT.SHIFT:\r
-                keyCode = java.awt.event.KeyEvent.VK_SHIFT;\r
-                break;\r
-            case SWT.ARROW_LEFT:\r
-                keyCode = java.awt.event.KeyEvent.VK_LEFT;\r
-                break;\r
-            case SWT.ARROW_RIGHT:\r
-                keyCode = java.awt.event.KeyEvent.VK_RIGHT;\r
-                break;\r
-            case SWT.ARROW_UP:\r
-                keyCode = java.awt.event.KeyEvent.VK_UP;\r
-                break;\r
-            case SWT.ARROW_DOWN:\r
-                keyCode = java.awt.event.KeyEvent.VK_DOWN;\r
-                break;\r
-            case SWT.KEYPAD_0:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD0;\r
-                break;\r
-            case SWT.KEYPAD_1:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD1;\r
-                break;\r
-            case SWT.KEYPAD_2:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD2;\r
-                break;\r
-            case SWT.KEYPAD_3:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD3;\r
-                break;\r
-            case SWT.KEYPAD_4:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD4;\r
-                break;\r
-            case SWT.KEYPAD_5:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD5;\r
-                break;\r
-            case SWT.KEYPAD_6:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD6;\r
-                break;\r
-            case SWT.KEYPAD_7:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD7;\r
-                break;\r
-            case SWT.KEYPAD_8:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD8;\r
-                break;\r
-            case SWT.KEYPAD_9:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUMPAD9;\r
-                break;\r
-            case SWT.KEYPAD_CR:\r
-                keyCode = java.awt.event.KeyEvent.VK_ENTER;\r
-                break;\r
-            case SWT.NUM_LOCK:\r
-                keyCode = java.awt.event.KeyEvent.VK_NUM_LOCK;\r
-                break;\r
-            case SWT.SCROLL_LOCK:\r
-                keyCode = java.awt.event.KeyEvent.VK_SCROLL_LOCK;\r
-                break;\r
-            case SWT.CAPS_LOCK:\r
-                keyCode = java.awt.event.KeyEvent.VK_CAPS_LOCK;\r
-                break;\r
-            case SWT.INSERT:\r
-                keyCode = java.awt.event.KeyEvent.VK_INSERT;\r
-                break;\r
-            case SWT.HOME:\r
-                keyCode = java.awt.event.KeyEvent.VK_HOME;\r
-                break;\r
-            case SWT.END:\r
-                keyCode = java.awt.event.KeyEvent.VK_END;\r
-                break;\r
-            case SWT.PAGE_UP:\r
-                keyCode = java.awt.event.KeyEvent.VK_PAGE_UP;\r
-                break;\r
-            case SWT.PAGE_DOWN:\r
-                keyCode = java.awt.event.KeyEvent.VK_PAGE_DOWN;\r
-                break;\r
-            case SWT.PAUSE:\r
-                keyCode = java.awt.event.KeyEvent.VK_PAUSE;   \r
-                break;\r
-            case SWT.BREAK:\r
-                keyCode = java.awt.event.KeyEvent.VK_PAUSE;   \r
-                break;\r
-            case SWT.PRINT_SCREEN:\r
-                keyCode = java.awt.event.KeyEvent.VK_PRINTSCREEN;   \r
-                break;   \r
-            case SWT.HELP:\r
-                keyCode = java.awt.event.KeyEvent.VK_HELP;\r
-                break;\r
-            default :\r
-                keyCode = 0;\r
-               break;\r
-            }\r
-            \r
-            return keyCode;\r
-        } else if (swtKeyCode == 8) {\r
-               return java.awt.event.KeyEvent.VK_BACK_SPACE;\r
-        }\r
-        else if (swtKeyCode >= 97 )\r
-               return swtKeyCode - 32;\r
-        else\r
-               return swtKeyCode;\r
-    }\r
-\r
-    \r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)\r
-     */\r
-    public void keyPressed(KeyEvent arg0) {\r
-       //System.out.println("KeyPressed " + arg0.character + " " + arg0.keyCode + " " + getAWTKeyCode(arg0.keyCode));\r
-           keyDown[getAWTKeyCode(arg0.keyCode)] = true;\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)\r
-     */\r
-    public void keyReleased(KeyEvent arg0) {\r
-       //System.out.println("KeyReleased " + arg0.character + " " + arg0.keyCode + " " + getAWTKeyCode(arg0.keyCode));\r
-        \r
-           keyDown[getAWTKeyCode(arg0.keyCode)] = false;\r
-    }\r
-\r
-    public void mouseMove(MouseEvent e) {\r
-        awtMouseX = e.x;\r
-        awtMouseY = e.y;      \r
-        if (swtMouse1Down || swtMouse2Down || swtMouse3Down) {\r
-               // comparing times so that drag event won't be send at the time when mouse button was pressed\r
-               long time = e.time & 0xFFFFFFFFL;\r
-               boolean drag = false;\r
-               if (swtMouse1Down) {\r
-                       drag = time > mouse1DownTime;\r
-               } else if (swtMouse2Down) {\r
-                       drag = time > mouse2DownTime;\r
-               } else {\r
-                       drag = time > mouse3DownTime;\r
-               }\r
-               if (drag)  {\r
-                       awtDragged = true;\r
-                       awtDragModifiers = createButtonMask(e);\r
-               }\r
-        } else {\r
-            awtMoveModifiers = createButtonMask(e);\r
-            awtMouseMoved = true;\r
-        }\r
-    }\r
-\r
-    public void mouseDoubleClick(MouseEvent e) {\r
-        /*\r
-        awtMouseClicked = true;\r
-        awtClickModifiers = createButtonMask(e);\r
-        switch (e.button) {\r
-            case 1:\r
-                awtClickButton = java.awt.event.MouseEvent.BUTTON1;\r
-                break;\r
-            case 2:\r
-                awtClickButton = java.awt.event.MouseEvent.BUTTON2;\r
-                break;\r
-            case 3:\r
-                awtClickButton = java.awt.event.MouseEvent.BUTTON3;\r
-                break;\r
-                \r
-        }\r
-        */\r
-    }\r
-    \r
-    private int createButtonMask(MouseEvent e) {\r
-        int mask = 0;\r
-        if (swtMouse1Down)\r
-            mask |= java.awt.event.MouseEvent.BUTTON1_DOWN_MASK | java.awt.event.MouseEvent.BUTTON1_MASK;\r
-        if (swtMouse2Down)\r
-            mask |= java.awt.event.MouseEvent.BUTTON2_DOWN_MASK | java.awt.event.MouseEvent.BUTTON2_MASK;\r
-        if (swtMouse3Down)\r
-            mask |= java.awt.event.MouseEvent.BUTTON3_DOWN_MASK | java.awt.event.MouseEvent.BUTTON3_MASK;\r
-        if ((e.stateMask & SWT.CTRL) > 0) \r
-              mask |= java.awt.event.MouseEvent.CTRL_DOWN_MASK | java.awt.event.MouseEvent.CTRL_MASK;\r
-        if ((e.stateMask & SWT.CTRL) > 0)  \r
-              mask |= java.awt.event.MouseEvent.ALT_DOWN_MASK | java.awt.event.MouseEvent.ALT_MASK;\r
-        \r
-        \r
-        return mask;\r
-    }\r
-\r
-    public void mouseDown(MouseEvent e) {\r
-        switch (e.button) {\r
-            case 1:\r
-                swtMouse1Down = true;\r
-                mouse1DownTime = e.time & 0xFFFFFFFFL;\r
-                break;\r
-            case 2:\r
-                swtMouse2Down = true;\r
-                mouse2DownTime = e.time & 0xFFFFFFFFL;\r
-                break;\r
-            case 3:\r
-                swtMouse3Down = true;\r
-                mouse3DownTime = e.time & 0xFFFFFFFFL;\r
-        };\r
-        \r
-        awtPressed = true;\r
-        awtPressModifiers = createButtonMask(e);\r
-    }\r
-\r
-    public void mouseUp(MouseEvent e) {\r
-        long mouseUpTime = e.time & 0xFFFFFFFFL;\r
-        long delta = 1000;\r
-        switch (e.button) {\r
-        case 1:\r
-            swtMouse1Down = false;\r
-            delta = mouseUpTime - mouse1DownTime;\r
-            break;\r
-        case 2:\r
-            swtMouse2Down = false;\r
-            delta = mouseUpTime - mouse2DownTime;\r
-            break;\r
-        case 3:\r
-            swtMouse3Down = false;\r
-            delta = mouseUpTime - mouse3DownTime;\r
-        };\r
-        awtReleased = true;\r
-        \r
-        if (delta < PRESS_TIME) {\r
-            awtMouseClicked = true;\r
-            awtClickModifiers = createButtonMask(e);\r
-            switch (e.button) {\r
-                case 1:\r
-                    awtClickButton = java.awt.event.MouseEvent.BUTTON1;\r
-                    break;\r
-                case 2:\r
-                    awtClickButton = java.awt.event.MouseEvent.BUTTON2;\r
-                    break;\r
-                case 3:\r
-                    awtClickButton = java.awt.event.MouseEvent.BUTTON3;\r
-                    break;\r
-                    \r
-            }\r
-        }\r
-    }\r
-    \r
-    \r
-    public void mouseEnter(MouseEvent e) {\r
-        \r
-    }\r
-    \r
-    public void mouseExit(MouseEvent e) {\r
-        awtReleased = false;\r
-        awtPressed = false;\r
-        swtMouse1Down = false;\r
-        swtMouse2Down = false;\r
-        swtMouse3Down = false;\r
-        \r
-        \r
-    }\r
-    \r
-    public void focusGained(FocusEvent e) {\r
-\r
-    }\r
-    \r
-    public void focusLost(FocusEvent e) {\r
-       reset();\r
-    }\r
-    \r
-    public void mouseHover(MouseEvent e) {\r
-\r
-    }\r
-    \r
-    public void setMouseMoved(boolean b) {\r
-       awtMouseMoved = b;\r
-    }\r
-    \r
-    public void setMouseX(int x) {\r
-       awtMouseX = x;\r
-    }\r
-    \r
-    public void setMouseY(int y) {\r
-       awtMouseY = y;\r
-    }\r
-\r
-    public String toString() {\r
-        String s = "";\r
-        s += "(" + mouseX + "," + mouseY + ")\n";\r
-        s += "Pressed " + mousePressed + "\n";\r
-        s += "Released " + mouseReleased + "\n";\r
-        s += "Moved " + mouseMoved + "\n";\r
-        s += "Dragged " + mouseDragged + "\n";\r
-        s += "Clicked " + mouseClicked + "\n";\r
-        s += "DragModifiers " + dragModifiers + "\n";\r
-        s += "ClickModifiers " + clickModifiers + "\n";\r
-        s += "PressModifiers " + pressModifiers + "\n";\r
-        return s;\r
-    }\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/G3DPreferencesPage.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/G3DPreferencesPage.java
deleted file mode 100644 (file)
index 98230eb..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.preferences;
-
-import org.eclipse.jface.preference.*;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.IWorkbench;
-import org.simantics.proconf.g3d.Activator;
-
-
-/**
- * This class represents a preference page that
- * is contributed to the Preferences dialog. By 
- * subclassing <samp>FieldEditorPreferencePage</samp>, we
- * can use the field support built into JFace that allows
- * us to create a page that is small and knows how to 
- * save, restore and apply itself.
- * <p>
- * This page is used to modify preferences only. They
- * are stored in the preference store that belongs to
- * the main plug-in class. That way, preferences can
- * be accessed directly via the preference store.
- */
-
-public class G3DPreferencesPage
-       extends FieldEditorPreferencePage
-       implements IWorkbenchPreferencePage {
-
-       public G3DPreferencesPage() {
-               super(GRID);
-               setPreferenceStore(Activator.getDefault().getPreferenceStore());
-               setDescription("A demonstration of a preference page implementation");
-       }
-       
-       /**
-        * Creates the field editors. Field editors are abstractions of
-        * the common GUI blocks needed to manipulate various types
-        * of preferences. Each field editor knows how to save and
-        * restore itself.
-        */
-       public void createFieldEditors() {
-//             addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, 
-//                             "&Directory preference:", getFieldEditorParent()));
-//             addField(
-//                     new BooleanFieldEditor(
-//                             PreferenceConstants.P_BOOLEAN,
-//                             "&An example of a boolean preference",
-//                             getFieldEditorParent()));
-//
-//             addField(new RadioGroupFieldEditor(
-//                             PreferenceConstants.P_CHOICE,
-//                     "An example of a multiple-choice preference",
-//                     1,
-//                     new String[][] { { "&Choice 1", "choice1" }, {
-//                             "C&hoice 2", "choice2" }
-//             }, getFieldEditorParent()));
-//             addField(
-//                     new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));
-               addField(new BooleanFieldEditor(PreferenceConstants.SHADOWS,"Use Shadows",getFieldEditorParent()));
-               addField(new RadioGroupFieldEditor(PreferenceConstants.POST_PROCESS, "Post Processing", 1,
-                               new String[][] { { "None", "none" }, 
-                                                                { "Sketch", "sketch" },
-                                                                { "Bloom", "bloom" }}, 
-                                                                getFieldEditorParent()));
-               addField(new ScaleFieldEditor(PreferenceConstants.GIZMO_SCALE,"Gizmo scale",getFieldEditorParent(),5,100,1,10) {
-                       private double oldValue;
-                       
-                       @Override
-                       protected void doStore() {
-                               getPreferenceStore()
-                .setValue(getPreferenceName(), scale.getSelection()*0.1);
-                       }
-                       
-                       @Override
-                       protected void doLoadDefault() {
-                               if (scale != null) {
-                           double value = getPreferenceStore().getDefaultDouble(getPreferenceName());
-                           scale.setSelection((int)(value*10.0));
-                       }
-                       valueChanged();
-                       }
-                       
-                       @Override
-                       protected void doLoad() {
-                               if (scale != null) {
-                                       double value = getPreferenceStore().getDouble(getPreferenceName());
-                           scale.setSelection((int)(value*10.0));
-                           oldValue = value;
-                       };
-                       }
-                       
-                       @Override
-                       protected void valueChanged() {
-                       setPresentsDefaultValue(false);
-
-                       double newValue = scale.getSelection()*0.1;
-                       if (newValue != oldValue) {
-                           fireStateChanged(IS_VALID, false, true);
-                           fireValueChanged(VALUE, new Double(oldValue),
-                                   new Double(newValue));
-                           oldValue = newValue;
-                       }
-                   }
-               });
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
-        */
-       public void init(IWorkbench workbench) {
-       }
-       
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/PreferenceConstants.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/PreferenceConstants.java
deleted file mode 100644 (file)
index c0163e7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.preferences;
-
-/**
- * Constant definitions for plug-in preferences
- */
-public class PreferenceConstants {
-
-       public static final String POST_PROCESS = "postProcess";
-       public static final String SHADOWS = "shadows";
-       public static final String GIZMO_SCALE = "gizmoScale";
-       
-}
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/PreferenceInitializer.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/preferences/PreferenceInitializer.java
deleted file mode 100644 (file)
index 5a40d2f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.simantics.proconf.g3d.Activator;
-
-
-/**
- * Class used to initialize default preference values.
- */
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
-        */
-       public void initializeDefaultPreferences() {
-               IPreferenceStore store = Activator.getDefault()
-                               .getPreferenceStore();
-//             store.setDefault(PreferenceConstants.P_BOOLEAN, true);
-//             store.setDefault(PreferenceConstants.P_CHOICE, "choice2");
-//             store.setDefault(PreferenceConstants.P_STRING,"Default value");
-               store.setDefault(PreferenceConstants.POST_PROCESS, "none");
-               store.setDefault(PreferenceConstants.SHADOWS, true);
-               store.setDefault(PreferenceConstants.GIZMO_SCALE, 1.0);
-       }
-
-}
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/AbstractGraphicsNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/AbstractGraphicsNode.java
deleted file mode 100644 (file)
index d1dde38..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.AxisAngle4f;\r
-import javax.vecmath.Matrix3d;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Vector3f;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import com.jme.scene.Node;\r
-\r
-\r
-public abstract class AbstractGraphicsNode implements ISelectableNode {\r
-\r
-       protected ThreeDimensionalEditorBase editor;\r
-       \r
-    protected IGraphicsNode parent = null;\r
-\r
-    protected Resource shapeResource = null;\r
-  \r
-    protected boolean selected;\r
-\r
-    protected Node parentGroup = null;\r
-    protected Node transform = null;\r
-   // protected Node center = null;\r
-    \r
-    protected String id;\r
\r
-    private ArrayList<IGraphicsNode> children = new ArrayList<IGraphicsNode>();\r
-\r
-    public AbstractGraphicsNode(ThreeDimensionalEditorBase editor, IGraphicsNode parent, Graph graph, Resource shapeResource) {\r
-        assert (parent != null);\r
-        this.editor = editor;\r
-        this.parent = parent;\r
-        this.parentGroup = parent.getGroup();\r
-        this.shapeResource = shapeResource;\r
-        this.id = editor.getScenegraphAdapter().getNodeUID(shapeResource);\r
-        createGroups();\r
-        updateTransform(graph);\r
-        parent.addChild(this);\r
-    }\r
-    \r
-    @Override\r
-    public String getID() {\r
-       return id;\r
-    }\r
-    \r
-    public void setID(String id) {\r
-       this.id = id;\r
-    }\r
-\r
-    \r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.geometry.IGraphicsNode#getParent()\r
-     */\r
-    public IGraphicsNode getParent() {\r
-        return parent;\r
-    }\r
-    \r
-    public Collection<IGraphicsNode> getChildren() {\r
-        return children;\r
-    }\r
-\r
-    private void createGroups() {\r
-       transform = new Node(); // TODO : uid\r
-       parentGroup.attachChild(transform);\r
-    }\r
-    \r
-    public void addChild(IGraphicsNode node) {\r
-        children.add(node);\r
-    }\r
-    \r
-    public void removeChild(IGraphicsNode node) {\r
-        children.remove(node);\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.geometry.IGraphicsNode#getGroup()\r
-     */\r
-    public Node getGroup() {\r
-       //return center;\r
-       \r
-       return transform;\r
-    }\r
-\r
-    /**\r
-     * Updates rotation and translation of the shape without recalculating\r
-     * geometry\r
-     */\r
-    public void updateTransform(Graph graph) {\r
-       G3DNode shape = getG3DNode(graph);\r
-       if (shape.getLocalPosition() != null)\r
-            transform.setLocalTranslation(VecmathJmeTools.get(G3DTools.getVectorFloat(shape.getLocalPosition())));\r
-        if (shape.getLocalOrientation() != null) \r
-            transform.setLocalRotation(VecmathJmeTools.get(G3DTools.getOrientationFloat(shape.getLocalOrientation())));\r
-//        if (GraphicsNodeTools.hasCenter(shape)) {\r
-//             center.setLocalTranslation(VecmathJmeTools.get(GraphicsNodeTools.getCenterFloat(shape)));\r
-//        }\r
-        // FIXME : typically transforms are updated once per frame (root as initiator) but with threaded access transformation may be read wrong.\r
-        transform.updateWorldVectors();\r
-        editor.getScenegraphAdapter().setChanged(true);\r
-    }\r
-\r
-\r
-    \r
-    protected void update(Matrix3d aa) {\r
-        transform.setLocalRotation(VecmathJmeTools.get(aa));\r
-    }\r
-    protected void update(AxisAngle4f aa) {\r
-        transform.setLocalRotation(VecmathJmeTools.get(aa));\r
-    }\r
-    \r
-    protected void update(AxisAngle4d aa) {\r
-        transform.setLocalRotation(VecmathJmeTools.get(aa));\r
-    }\r
-    \r
-    protected void update(Quat4d q) {\r
-        transform.setLocalRotation(VecmathJmeTools.get(q));\r
-    }\r
-    \r
-    protected void update(Vector3f v) {\r
-        transform.setLocalTranslation(VecmathJmeTools.get(v));\r
-    }\r
-\r
-\r
-    public void setSelected(boolean selected) {\r
-        if (this.selected == selected)\r
-            return;\r
-        this.selected = selected;\r
-    }\r
-\r
-    public boolean isSelected() {\r
-        return selected;\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.geometry.IGraphicsNode#getResource()\r
-     */\r
-    public Resource getResource() {\r
-        return shapeResource;\r
-    }\r
-\r
-    public G3DNode getG3DNode(Graph graph) {\r
-        return new G3DNode(graph,shapeResource);\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see fi.vtt.proconf.shapeeditor.geometry.IGraphicsNode#dispose()\r
-     */\r
-    public void dispose() {\r
-//        if (children.size() != 0) {\r
-//            System.out.print(getResource() + " contains children: ");\r
-//            ArrayList<IGraphicsNode> c = new ArrayList<IGraphicsNode>(children);\r
-//            for (IGraphicsNode n : c) {\r
-//              System.out.print(n.getResource() + " ");\r
-//            }\r
-//            System.out.println();\r
-//            return;\r
-//        }\r
-        assert (children.size() == 0);\r
-\r
-        transform.removeFromParent();\r
-        transform.dispose();\r
-        if (parent != null)\r
-            parent.removeChild(this);\r
-    }\r
-    \r
-    \r
-    public abstract void setPickable(boolean pickable);\r
-    \r
-    public String toString() {\r
-        return  this.getClass().toString();\r
-    }\r
-    \r
-    @Override\r
-    public int hashCode() {\r
-       return shapeResource.hashCode();\r
-    }\r
-\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/IGeometryNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/IGeometryNode.java
deleted file mode 100644 (file)
index 94d3dae..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-import org.simantics.db.Graph;\r
-\r
-public interface IGeometryNode extends IGraphicsNode{\r
-       \r
-       public void updateGeometry(Graph graph);\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/IGraphicsNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/IGraphicsNode.java
deleted file mode 100644 (file)
index a72aa5f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import com.jme.scene.Node;\r
-\r
-public interface IGraphicsNode {\r
-\r
-    public IGraphicsNode getParent();\r
-\r
-    public Node getGroup();\r
-\r
-    public Resource getResource();\r
-\r
-    /**\r
-     * Disposes the node. Disposing of node that has children is not allowed.\r
-     */\r
-    public void dispose();\r
-\r
-    public void updateTransform(Graph graph);\r
-    \r
-    public G3DNode getG3DNode(Graph graph);\r
-    \r
-    public void addChild(IGraphicsNode node);\r
-    public void removeChild(IGraphicsNode node);\r
-    public Collection<IGraphicsNode> getChildren();\r
-\r
-    \r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ISelectableNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ISelectableNode.java
deleted file mode 100644 (file)
index 4abd1b3..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-public interface ISelectableNode extends IGraphicsNode{\r
-    public void setVisible(boolean visible);\r
-    public boolean isVisible();\r
-    public void setSelected(boolean selected);\r
-    public boolean isSelected();\r
-    public void setHighlighted(boolean higlighted);\r
-    public boolean isHighlighted();\r
-    public void setPickable(boolean pickable);\r
-    public String getID();\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ModelNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ModelNode.java
deleted file mode 100644 (file)
index 40e845a..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.animation.Animatable;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.stubs.G3DModel;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-public class ModelNode extends AbstractGraphicsNode implements Animatable, IGeometryNode{\r
-       protected List<ShapeNode> shapes = new ArrayList<ShapeNode>();\r
-    private boolean highlighted;\r
-   \r
-    protected Resource modelResource;\r
-    \r
-    private boolean geometryCreated = false;\r
-    \r
-    public ModelNode(ThreeDimensionalEditorBase editor,IGraphicsNode parent, Graph graph, Resource shapeResource) {\r
-       super(editor,parent, graph, shapeResource);\r
-       \r
-    }\r
-    \r
-    protected void createGeometry(Graph graph) {\r
-       \r
-       if (modelResource != null) {\r
-               G3DModel model = getG3DModel(graph);\r
-            Collection<G3DNode> nodes = model.getChild();\r
-            if (nodes.size() == 0) {\r
-                ErrorLogger.defaultLogError("ModelNode " + model.getResource() + " has no shapes", null);\r
-                return;\r
-            }\r
-            for (G3DNode node: nodes) {\r
-                ShapeNode shape = new ShapeNode(editor,this,graph,node.getResource());\r
-                shapes.add(shape);\r
-\r
-                shape.setID(getID());\r
-                shape.setVisible(true);\r
-                shape.updateGeometry(graph);\r
-                createRecursive(graph,shape);\r
-            } \r
-            geometryCreated = true;\r
-        }\r
-    }\r
-    \r
-    private void createRecursive(Graph graph,IGraphicsNode parentNode) {\r
-       Collection<G3DNode> nodes = parentNode.getG3DNode(graph).getChild();\r
-        for (G3DNode node: nodes) {\r
-                if (node.getRelatedObjects(Resources.g3dResource.GeometryDefinitionOf).size() == 0) {\r
-                        ShapeNode shape = new ShapeNode(editor,parentNode,graph,node.getResource());\r
-                        shapes.add(shape);\r
-\r
-                        shape.setID(getID());\r
-                        shape.setVisible(true);\r
-                        shape.updateGeometry(graph);\r
-                        createRecursive(graph,shape);\r
-                }\r
-         } \r
-    }\r
-    \r
-    public void updateGeometry(Graph graph) {\r
-       if (!geometryCreated) {\r
-               createGeometry(graph);\r
-               return;\r
-       }\r
-       updateTransform(graph);\r
-//     for (IGraphicsNode node : getChildren()) {\r
-//                     ((IGeometryNode)node).updateGeometry();\r
-//             }\r
-       for (ShapeNode node : shapes)\r
-            node.updateGeometry(graph);\r
-    }\r
-    \r
-    public boolean isVisible() {\r
-        for (IGraphicsNode n : getChildren())\r
-                       if (n instanceof ISelectableNode)\r
-               if (!((ISelectableNode)n).isVisible())\r
-                       return false;\r
-       return true;\r
-   }\r
-    \r
-    public void setVisible(boolean visible) {\r
-        for (IGraphicsNode node : getChildren()) {\r
-               if (node instanceof ISelectableNode)\r
-                       ((ISelectableNode)node).setVisible(visible);\r
-        }\r
-    }\r
-    \r
-    @Override\r
-    public void dispose() {\r
-        // shapes must be removed reverse order (leafs first)\r
-       for (int i = shapes.size() - 1; i >= 0; i--) {\r
-               shapes.get(i).dispose();\r
-       }\r
-        super.dispose();\r
-    }\r
-    \r
-    \r
-    @Override\r
-    public void setPickable(boolean pickable) {\r
-        for(ShapeNode n : shapes) {\r
-            n.setPickable(pickable);\r
-        }\r
-    }\r
-    \r
-    public boolean isHighlighted() {\r
-        return highlighted;\r
-    }\r
-    \r
-    public void setHighlighted(boolean selected) {\r
-        if (this.highlighted == selected)\r
-            return;\r
-        this.highlighted = selected;\r
-        for (ShapeNode n : shapes)\r
-            n.setHighlighted(selected);\r
-        \r
-    }\r
-    \r
-    @Override\r
-    public void setSelected(boolean selected) {\r
-        if (this.selected == selected)\r
-            return;\r
-        this.selected = selected;\r
-        for (ShapeNode n : shapes)\r
-            n.setSelected(selected);\r
-    }\r
-    \r
-    public void animate(double delta, double frameTime) {\r
-        for (ShapeNode n : shapes)\r
-            n.animate(delta,frameTime);\r
-    }\r
-    \r
-    public G3DModel getG3DModel(Graph graph) {\r
-       return new G3DModel(graph, modelResource);\r
-    }\r
-    \r
-    public boolean setAnimation(Graph graph, Resource animation) {\r
-        if (modelResource == null) {\r
-            ErrorLogger.getDefault().logWarning("Cannot set animation for " + shapeResource + " since it has no graphics", null);\r
-            return false;    \r
-        }\r
-        Collection<Resource> animations = graph.getObjects(modelResource, Resources.animationResource.HasAnimation);\r
-        if (!animations.contains(animation)) {\r
-            ErrorLogger.getDefault().logWarning("Cannot set animation for " + shapeResource + " since it doesn't have requested animation " + animation.getResource(), null);\r
-            return false;\r
-        }\r
-  \r
-        boolean set = false;\r
-        for (ShapeNode n : shapes) {\r
-            if (n.setAnimation(graph,animation))\r
-                set = true;\r
-        }\r
-        return set;\r
-    }\r
-    \r
-    public boolean setRandomAnimation(Graph graph) {\r
-        if (modelResource == null) {\r
-            ErrorLogger.getDefault().logWarning("Cannot set animation for " + shapeResource + " since it has no graphics", null);\r
-            return false;    \r
-        }\r
-        G3DModel model = getG3DModel(graph);\r
-        Collection<org.simantics.g2d.stubs.anim.Animation> animations = model.getAnimation();\r
-        int num = animations.size();\r
-        if (num == 0) {\r
-            ErrorLogger.getDefault().logWarning("Cannot set animation for " + shapeResource + " since it has no animations", null);\r
-            return false;            \r
-        }\r
-        int random = (int)Math.round(Math.random() * (num-1));\r
-        Iterator<org.simantics.g2d.stubs.anim.Animation> i = animations.iterator();\r
-        while(random > 0) {\r
-            i.next();\r
-            random--;\r
-        }\r
-        return setAnimation(graph,i.next().getResource());\r
-        \r
-    }\r
-    \r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/NonTransformableNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/NonTransformableNode.java
deleted file mode 100644 (file)
index 2c02097..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import com.jme.scene.Node;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-\r
-public abstract class NonTransformableNode implements IGraphicsNode {\r
-\r
-    private IGraphicsNode parent;\r
-    private ArrayList<IGraphicsNode> children = new ArrayList<IGraphicsNode>();\r
-    protected Node parentGroup = null;\r
-    protected Resource nodeResource;\r
-\r
-    public NonTransformableNode(IGraphicsNode parent, Resource nodeResource) {\r
-       this.parent = parent;\r
-        this.nodeResource = nodeResource;\r
-        parentGroup = parent.getGroup();\r
-        parent.addChild(this);\r
-    }\r
-\r
-    public void addChild(IGraphicsNode node) {\r
-        children.add(node);\r
-        \r
-    }\r
-    \r
-    public Collection<IGraphicsNode> getChildren() {\r
-        return children;\r
-    }\r
-    \r
-    public void removeChild(IGraphicsNode node) {\r
-        children.remove(node);\r
-        \r
-    }\r
-\r
-    public void dispose() {\r
-        assert(children.size() == 0);\r
-        if (parent != null)\r
-            parent.removeChild(this);       \r
-    }\r
-\r
-    public G3DNode getG3DNode(Graph graph) {\r
-        return new G3DNode(graph, nodeResource);\r
-    }\r
-    \r
-    public Node getGroup() {\r
-       return parentGroup;\r
-    }\r
-\r
-\r
-    public IGraphicsNode getParent() {\r
-        return parent;\r
-    }\r
-\r
-\r
-    public Resource getResource() {\r
-        return nodeResource;\r
-    }\r
-\r
-    public void updateTransform(Graph graph) {\r
-        \r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ParameterizedModelNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ParameterizedModelNode.java
deleted file mode 100644 (file)
index 511a2fa..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.ContextGraph;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.equation.solver.Solver;\r
-import org.simantics.g2d.stubs.anim.Animation;\r
-import org.simantics.layer0.utils.Property;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.Statement;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.stubs.G3DModel;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-/**\r
- * IGraphicsNode for parameterized models. Implementation assumes that G3DNode itself does not contain\r
- * graphical representation but has link to it. \r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class ParameterizedModelNode extends ModelNode {\r
-       \r
-       /**\r
-        * @param editor\r
-        * @param parent\r
-        * @param graph\r
-        * @param resource this node (G3DNode).\r
-        * @param nodeToModelRelation relation from this node to the model, or from type of this node to the model.\r
-        * @param modelToParametersRelation relation from the model to its sizing parameters\r
-        */\r
-       public ParameterizedModelNode(ThreeDimensionalEditorBase editor, IGraphicsNode parent, Graph graph, Resource resource, Resource nodeToModelRelation) {\r
-               super(editor,parent,graph,resource);\r
-               G3DNode shape = getG3DNode(graph);\r
-               List<IEntity> models = new ArrayList<IEntity>();\r
-               models.addAll(shape.getRelatedObjects(nodeToModelRelation));\r
-               if (models.size() == 0) {\r
-                       Collection<IEntity> types = shape.getTypes();\r
-                       for (IEntity type : types) {\r
-                               models.addAll(type.getRelatedObjects(nodeToModelRelation));\r
-                       }\r
-               }\r
-               if (models.size() != 1)\r
-                       throw new IllegalArgumentException("Cannot find proper model: found " + models.size() + " models.");\r
-               \r
-               this.modelResource = models.iterator().next().getResource();\r
-       }\r
-       \r
-       @Override\r
-       protected void createGeometry(Graph graph) {\r
-               super.createGeometry(createParameterization(graph));\r
-       }\r
-       \r
-       @Override\r
-       public void updateGeometry(Graph graph) {               \r
-               super.updateGeometry(createParameterization(graph));\r
-       }\r
-       \r
-       private void updateSizeParameters(ContextGraph graph, Solver solver) {\r
-               Builtins builtins = graph.getBuiltins();\r
-\r
-               \r
-               G3DNode node = getG3DNode(graph);\r
-               //Collection<Property> nodeProperties = node.getRelatedProperties(builtins.HasProperty);\r
-               Collection<Statement> nodeProperties = node.getRelatedStatements(builtins.HasProperty);\r
-               G3DModel model = getG3DModel(graph);\r
-               Collection<Property> modelProperties = model.getRelatedProperties(Resources.g3dResource.HasSizingParameter);\r
-               \r
-               // there are no relations between then nodes properties and the model's sizing parameters\r
-               // link between them is done by matching names\r
-               for (Property m : modelProperties) {\r
-                       boolean set = false;\r
-                       //if(m.canBeSet(builtins.HasName)) {\r
-\r
-                               String modelPropertyname = m.getAtMostOneRelatedProperty(builtins.HasName).getScalarString();\r
-                               for (Statement n : nodeProperties) {\r
-                                       String relationName = n.getPredicate().getName();\r
-                                       if (relationName.startsWith("Has "))\r
-                                               relationName = relationName.substring(4);\r
-                                       if (relationName.equalsIgnoreCase(modelPropertyname)) {\r
-                                               // found a match\r
-                                               // set property's value for Solver\r
-                                               solver.setValue(m.getResource(), graph.getValueAsObject(n.getObject().getResource()));\r
-                                               set = true;\r
-                                               break;\r
-                                       }\r
-                                       \r
-                               }\r
-                               if (!set) {\r
-                                       ErrorLogger.defaultLogError("Cannot map property " + modelPropertyname, null);\r
-                               }\r
-                       //}\r
-                       \r
-               }\r
-               \r
-               for (Property p : modelProperties) {\r
-                       IEntity t = EntityFactory.create(graph, p.getResource());\r
-                       Collection<IEntity> exp = t.getRelatedObjects(Resources.equationResource.HasTarget);\r
-                       if (exp.size() > 0) { \r
-                               Iterator<IEntity> i = exp.iterator();\r
-                               while(i.hasNext())\r
-                                       solver.evaluate(i.next());\r
-                       } else\r
-                               ErrorLogger.defaultLogError("Model property " + p + " is not bound to a expression",null);\r
-               }\r
-               solver.pushToGraph(graph);\r
-               Collection<Animation> animations = model.getAnimation();\r
-        for (Animation animation : animations) {\r
-               Collection<org.simantics.g2d.stubs.anim.Interpolator> interpolators = animation.getInterpolator();\r
-               for (org.simantics.g2d.stubs.anim.Interpolator interpolator : interpolators) {\r
-                       IEntity target = interpolator.getTarget();\r
-                       // check all model properties\r
-                       for (Property p : modelProperties) {\r
-                               IEntity t = EntityFactory.create(graph,p.getResource());\r
-                               // get parameterization equations\r
-                               Collection<IEntity> equations = t.getRelatedObjects(Resources.equationResource.HasTarget);\r
-                               // get parameterized values\r
-                               Collection<IEntity> parameterTargets = new ArrayList<IEntity>();\r
-                               for (IEntity eq : equations) {\r
-                                       Collection<IEntity> tgts = eq.getRelatedObjects(Resources.equationResource.HasTarget);\r
-                                       assert(tgts.size() == 1);\r
-                                       parameterTargets.add(tgts.iterator().next());\r
-                               }\r
-                               // do matching between interpolator targets and parameterized values\r
-                               // TODO : old system did not have inverse relations but current system does.\r
-                               //                it is possible to take interpolation target and find if it is connected to an equation\r
-                               //                this would make code much faster (no more stupid loops over everything)\r
-                               for (IEntity d : parameterTargets) {\r
-                                       if (d.getResource().equals(target.getResource())) {\r
-                                               // get default value for sizing property\r
-                                               Collection<IEntity> prop = t.getRelatedObjects(Resources.g3dResource.HasDefaultDoubleValue);\r
-                                               if (prop.size() == 1) {\r
-                                                       Resources.curveBuilder.parameterize(interpolator, prop.iterator().next().toProperty().getDoubleArray(), p.getDoubleArray());\r
-                                       } else {\r
-                                               ErrorLogger.defaultLogError("Cannot parameterize interpolator " + interpolator.getResource() + " of animation " + animation.getResource() + " since parameter " + p.getResource() + " has no default value", null);\r
-                                       }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-        }\r
-       \r
-       }\r
-       \r
-       protected Graph createParameterization(Graph graph) {\r
-               // create ContextGraph if needed\r
-               ContextGraph g;\r
-               if (!(graph instanceof ContextGraph))\r
-                       g = new ContextGraph(graph);\r
-               else\r
-                       g = (ContextGraph)graph;\r
-               // set the context\r
-               g.setContext(this.shapeResource);\r
-               // create solver and calculate parameterized values\r
-               Solver solver = new Solver();\r
-               updateSizeParameters(g, solver);\r
-               // push parameterized values to context\r
-               solver.pushToGraph(g);\r
-               // return graph with parameterized values\r
-               return g;\r
-       }\r
-       \r
-       @Override\r
-       public boolean setAnimation(Graph graph, Resource animation) {          \r
-               return super.setAnimation(createParameterization(graph), animation);\r
-       }\r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/RootGraphicsNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/RootGraphicsNode.java
deleted file mode 100644 (file)
index 9937f4c..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import com.jme.scene.Node;\r
-\r
-public class RootGraphicsNode implements IGraphicsNode {\r
-\r
-       JmeRenderingComponent component;\r
-    Resource rootNode;\r
-    private ArrayList<IGraphicsNode> children = new ArrayList<IGraphicsNode>();\r
-\r
-    \r
-    public RootGraphicsNode(JmeRenderingComponent component, Resource rootNode) {\r
-        this.component = component;\r
-        this.rootNode = rootNode;\r
-    }\r
-    \r
-    public void addChild(IGraphicsNode node) {\r
-        children.add(node);\r
-    }\r
-    \r
-    public void removeChild(IGraphicsNode node) {\r
-        children.remove(node);\r
-    }\r
-    \r
-    public Collection<IGraphicsNode> getChildren() {\r
-        return children;\r
-    }\r
-\r
-    public void dispose() {\r
-        //throw new RuntimeException("Root cannot be disposed");\r
-    }\r
-\r
-    public Node getGroup() {\r
-       return component.getShadowRoot();\r
-    }\r
-\r
-    public IGraphicsNode getParent() {\r
-        return null;\r
-    }\r
-\r
-    public Resource getResource() {\r
-        return rootNode;\r
-    }\r
-\r
-    public void updateTransform(Graph graph) {\r
-\r
-    }\r
-    \r
-    public String toString() {\r
-        return this.getClass().toString();\r
-    }\r
-\r
-    public G3DNode getG3DNode(Graph graph) {\r
-        return new G3DNode(graph, rootNode);\r
-    }\r
-    \r
-\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ShapeNode.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ShapeNode.java
deleted file mode 100644 (file)
index 7c89be4..0000000
+++ /dev/null
@@ -1,719 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.scenegraph;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Quat4d;\r
-\r
-import org.simantics.g2d.stubs.anim.Interpolator;\r
-import org.simantics.animation.curve.SlerpCurve;\r
-import org.simantics.animation.curve.TCBCurve;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.animation.Animatable;\r
-import org.simantics.proconf.g3d.animation.Animation;\r
-import org.simantics.proconf.g3d.animation.ChanneledColorInterpolator;\r
-import org.simantics.proconf.g3d.animation.ChanneledPositionInterpolator;\r
-import org.simantics.proconf.g3d.animation.ConstantInterpolator;\r
-import org.simantics.proconf.g3d.animation.ScalarInterpolator;\r
-import org.simantics.proconf.g3d.animation.SlerpInterpolator;\r
-import org.simantics.proconf.g3d.animation.TCBInterpolator;\r
-import org.simantics.proconf.g3d.base.AppearanceTools;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.GeometryProvider;\r
-import org.simantics.proconf.g3d.base.GeometryProviderRegistry;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.stubs.Appearance;\r
-import org.simantics.proconf.g3d.stubs.Color;\r
-import org.simantics.proconf.g3d.stubs.G3DModel;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.proconf.g3d.stubs.Orientation;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import com.jme.bounding.BoundingBox;\r
-import com.jme.bounding.CollisionTreeManager;\r
-import com.jme.intersection.PickResults;\r
-import com.jme.math.Ray;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.SharedMesh;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.RenderState;\r
-import com.jme.scene.state.WireframeState;\r
-import com.jme.scene.state.ZBufferState;\r
-\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.ContextGraph;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-\r
-public class ShapeNode extends AbstractGraphicsNode implements Animatable, IGeometryNode{\r
-\r
-    public static final int NORMAL = 0;\r
-    public static final int TRANSPARENT = 1;\r
-    public static final int SELECTED_EDGE = 2;\r
-    public static final int HIGHLIGHTED_EDGE = 3;\r
-    \r
-    private boolean highlighted = false;\r
-\r
-    protected Geometry mesh = null;\r
-    protected Geometry lines = null;\r
-    protected Geometry[] geometry = null;\r
-\r
-    private boolean visible[] = new boolean[4];\r
-    \r
-    private Node body;\r
-    private Node transparent;\r
-    private Node edge;\r
-\r
-    private MaterialState selectedEdgeState;\r
-    private MaterialState highlightedEdgeState;\r
-    \r
-    private Collection<RenderState> renderStates;\r
-    private boolean isTransparent;\r
-    \r
-\r
-    public ShapeNode(ThreeDimensionalEditorBase editor,IGraphicsNode parent, Graph graph, Resource shapeResource) {\r
-        super(editor,parent, graph, shapeResource);\r
-        for (int i = 0; i < visible.length; i++)\r
-            visible[i] = false;\r
-        \r
-        body = new Node();\r
-\r
-        body.setName(id); \r
-        \r
-        \r
-        transparent = new Node() {\r
-               private static final long serialVersionUID = 1L;\r
-               @Override\r
-               public void calculatePick(Ray ray, PickResults results) {\r
-               \r
-               }\r
-        };\r
-        \r
-       // transparent.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-        \r
-        edge = new Node(){\r
-               private static final long serialVersionUID = 1L;\r
-               @Override\r
-               public void calculatePick(Ray ray, PickResults results) {\r
-               \r
-               }\r
-        };\r
-        transparent.setIsCollidable(false);\r
-        edge.setIsCollidable(false);\r
-        \r
-        MaterialState ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-        ms.setDiffuse(new ColorRGBA(0.0f, 0.75f, 0.0f,0.3f));\r
-        ms.setEmissive(new ColorRGBA(0f, 0f, 0f,0.3f));\r
-        ms.setSpecular(new ColorRGBA(0.5f, 0.5f, 0.5f,0.3f));\r
-        ms.setAmbient(new ColorRGBA(0.0f, 0.75f, 0.0f,0.3f));\r
-        ms.setShininess(128.f);\r
-        ms.setMaterialFace(MaterialState.MF_FRONT_AND_BACK);\r
-        transparent.setRenderState(ms);\r
-        \r
-        AlphaState as = editor.getRenderingComponent().getDisplaySystem().getRenderer().createAlphaState();\r
-        as.setBlendEnabled(true);\r
-        as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as.setSrcFunction(AlphaState.DB_SRC_ALPHA);\r
-        transparent.setRenderState(as);\r
-        \r
-        ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-        ms.setDiffuse(new ColorRGBA(1.f, 1.f, 1.f, 1.f));\r
-        ms.setEmissive(new ColorRGBA(1.f, 1.f, 1.f, 1.f));\r
-        ms.setSpecular(new ColorRGBA(1.f, 1.f, 1.f, 1.f));\r
-        ms.setAmbient(new ColorRGBA(1.f, 1.f, 1.f, 1.f));\r
-        ms.setShininess(128.f);\r
-        selectedEdgeState = ms;\r
-        \r
-        ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-        ms.setDiffuse(new ColorRGBA(1.f, 0.f, 1.f, 1.f));\r
-        ms.setEmissive(new ColorRGBA(1.f, 0.f, 1.f, 1.f));\r
-        ms.setSpecular(new ColorRGBA(1.f, 0.f, 1.f, 1.f));\r
-        ms.setAmbient(new ColorRGBA(1.f, 0.f, 1.f, 1.f));\r
-        ms.setShininess(128.f);\r
-        \r
-        highlightedEdgeState = ms;\r
-\r
-        \r
-    }\r
-\r
-\r
-    /**\r
-     * This method is used to get implementation specific geometry.\r
-     * Arrays first element is a mesh, second contains edges.\r
-     * @return\r
-     */\r
-    public Geometry[] getGeometry(Graph graph, boolean update) {\r
-       G3DNode shape = getG3DNode(graph);\r
-       final GeometryProvider provider = GeometryProviderRegistry.getGeometryProvider(shape);\r
-       if (!update) {\r
-               return provider.getGeometryFromResource(shape, false);\r
-       } else {\r
-               if (geometry == null) {\r
-                               geometry = provider.getGeometryFromResource(shape, false);\r
-                       } else {\r
-                               provider.reconstructGeometry(shape, false, geometry);\r
-                       }\r
-               return geometry;\r
-       }\r
-    }\r
-\r
-    /**\r
-     * Updates shapes and it's ancestors geometry\r
-     */\r
-    public void updateGeometry(Graph graph) {\r
-        updateTransform(graph);\r
-       // cleanAnimation();\r
-        //System.out.println("ShapeNode.updateGeometry() " + name);\r
-        if (geometry == null) {\r
-               Geometry g[] = getGeometry(graph,true);\r
-               if (g != null) {\r
-                               mesh = g[0];\r
-                               //TODO : uid\r
-                               mesh.setName(id); \r
-                               mesh.setModelBound(new BoundingBox());\r
-                               if (g.length > 1) {\r
-                                       lines = g[1];\r
-                               } else {\r
-                                       lines = null;\r
-                               }\r
-                               body.attachChild(mesh);\r
-                               transparent.detachAllChildren();\r
-                               SharedMesh m = new SharedMesh("",(TriMesh)mesh);\r
-                               m.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-                               m.getBatch(0).setCastsShadows(false);\r
-                               transparent.attachChild(m);\r
-                               \r
-                               \r
-                               if (lines == null) {\r
-                                       WireframeState ws = editor.getRenderingComponent().getDisplaySystem().getRenderer().createWireframeState();\r
-                                       edge.attachChild(new SharedMesh("",(TriMesh)mesh));\r
-                                       edge.setRenderState(ws);\r
-                               } else {\r
-                                       ZBufferState zs = editor.getRenderingComponent().getDisplaySystem().getRenderer().createZBufferState();\r
-                           zs.setFunction(ZBufferState.CF_ALWAYS);\r
-                           AlphaState as = editor.getRenderingComponent().getDisplaySystem().getRenderer().createAlphaState();\r
-                           as.setBlendEnabled(true);\r
-                           as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-                           as.setSrcFunction(AlphaState.DB_SRC_ALPHA);\r
-                           lines.setRenderState(zs);\r
-                           lines.setRenderState(as);\r
-                           lines.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-                           edge.attachChild(lines);\r
-                               }\r
-\r
-               }\r
-        }\r
-        if (geometry != null) {\r
-               getGeometry(graph,true);\r
-\r
-            \r
-            G3DNode shape = getG3DNode(graph);\r
-            if (renderStates == null)\r
-               updateAppearance(shape);\r
-\r
-            if (isVisible()) {\r
-               getGroup().attachChild(body);\r
-            } else {\r
-               body.removeFromParent();\r
-            }\r
-            if (isTransparentVisible()) {\r
-               getGroup().attachChild(transparent);\r
-               //setVisible(TRANSPARENT, true);\r
-            } else {\r
-               transparent.removeFromParent();\r
-            }\r
-\r
-            if (isSelectedVisible() || isHighlightedVisible()) {\r
-               getGroup().attachChild(edge);\r
-               //setVisible(SELECTED_EDGE, true);\r
-            } else {\r
-               edge.removeFromParent();\r
-               //setVisible(SELECTED_EDGE,false);\r
-            }\r
-            \r
-            \r
-            mesh.updateModelBound();\r
-            CollisionTreeManager.getInstance().updateCollisionTree(mesh);\r
-            //mesh.updateCollisionTree();\r
-  \r
-        }\r
-    }\r
-    \r
-    protected void updateAppearance(IEntity shape) {\r
-       Collection<IEntity> appearanceResource;\r
-        if ((appearanceResource = shape.getRelatedObjects(Resources.g3dResource.HasAppearance)) != null && appearanceResource.size() > 0) {\r
-            renderStates = AppearanceTools.getAppearance(new Appearance(shape.getGraph(),appearanceResource.iterator().next().getResource()), editor.getRenderingComponent().getDisplaySystem().getRenderer());\r
-        } else {\r
-               renderStates = getMaterial();\r
-        }\r
-        \r
-        isTransparent = false;\r
-        for (RenderState s : renderStates) {\r
-               if (s instanceof AlphaState)\r
-                       isTransparent = true;\r
-        }\r
-        setAppearance();\r
-    }\r
-    \r
-    protected void setAppearance() {\r
-       if (mesh ==  null || renderStates == null) {\r
-               return;\r
-       }\r
-               for (RenderState s : renderStates)\r
-                       mesh.setRenderState(s);\r
-               if (isTransparent)\r
-                       mesh.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-               else\r
-                       mesh.setRenderQueueMode(Renderer.QUEUE_OPAQUE);\r
-    }\r
-\r
-    public void setSelected(boolean selected) {\r
-        if (this.selected == selected)\r
-            return;\r
-        this.selected = selected;\r
-        if (selected) {\r
-\r
-            setSelectedVisible(true);\r
-            setTransparentVisible(true);\r
-        } else {\r
-            setSelectedVisible(false);\r
-            setTransparentVisible(false);\r
-        }\r
-    }\r
-\r
-    public boolean isSelected() {\r
-        return selected;\r
-    }\r
-    \r
-    \r
-\r
-    public boolean isHighlighted() {\r
-        return highlighted;\r
-    }\r
-\r
-    public void setHighlighted(boolean highlighted) {\r
-        if (this.highlighted == highlighted)\r
-            return;\r
-        this.highlighted = highlighted;\r
-        if (highlighted) {\r
-            setHighlightedVisible(true);\r
-        } else {\r
-            setHighlightedVisible(false);\r
-        }\r
-    }\r
-    \r
-    public boolean isVisible(int shape) {\r
-        return visible[shape];\r
-    }\r
-    \r
-    public void setVisible(int shape, boolean visible) {\r
-        if (this.visible[shape] == visible)\r
-            return;   \r
-        this.visible[shape] = visible;\r
-        if (mesh == null) {\r
-               return;\r
-        }\r
-        if (this.visible[NORMAL]){\r
-               getGroup().attachChild(body);\r
-        } else {\r
-               body.removeFromParent();\r
-        }\r
-        if (this.visible[TRANSPARENT]) {\r
-               getGroup().attachChild(transparent);\r
-        } else {\r
-               transparent.removeFromParent();\r
-        }\r
-        if (this.visible[SELECTED_EDGE] || this.visible[HIGHLIGHTED_EDGE]) {\r
-               if (this.visible[HIGHLIGHTED_EDGE])\r
-                       edge.setRenderState(highlightedEdgeState);\r
-               else\r
-                       edge.setRenderState(selectedEdgeState);\r
-               getGroup().attachChild(edge);\r
-               edge.updateRenderState();\r
-        } else {\r
-               edge.removeFromParent();\r
-        } \r
-    }\r
-\r
-    public boolean isVisible() {\r
-        return isVisible(NORMAL);\r
-    }\r
-\r
-    public void setVisible(boolean visible) {\r
-        setVisible(NORMAL, visible);\r
-    }\r
-\r
-    public boolean isSelectedVisible() {\r
-        return isVisible(SELECTED_EDGE);\r
-    }\r
-\r
-    public void setSelectedVisible(boolean visible) {\r
-        setVisible(SELECTED_EDGE, visible);\r
-    }\r
-\r
-    public boolean isHighlightedVisible() {\r
-        return isVisible(HIGHLIGHTED_EDGE);\r
-    }\r
-\r
-    public void setHighlightedVisible(boolean visible) {\r
-        setVisible(HIGHLIGHTED_EDGE, visible);\r
-        \r
-    }\r
-\r
-    \r
-\r
-    public boolean isTransparentVisible() {\r
-        return isVisible(TRANSPARENT);\r
-    }\r
-\r
-    public void setTransparentVisible(boolean visible) {\r
-        setVisible(TRANSPARENT, visible);\r
-    }\r
-\r
-    public void setPickable(boolean pickable) {\r
-       body.setIsCollidable(pickable);\r
-    }\r
-    \r
-    public Collection<RenderState> getMaterial() {\r
-       List<RenderState> states = new ArrayList<RenderState>();\r
-       MaterialState ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-       ms.setEmissive(new ColorRGBA(0.f,0.f,0.f,0.f));\r
-       ms.setSpecular(new ColorRGBA(1.f,1.f,1.f,1.f));\r
-       ms.setDiffuse(new ColorRGBA(0.75f,0.f,0.f,0.f));\r
-       ms.setAmbient(new ColorRGBA(0.75f,0.f,0.f,0.f));\r
-       ms.setEnabled(true);\r
-       ms.setShininess(128.f);\r
-       states.add(ms);\r
-\r
-       return states;  \r
-    }\r
-    \r
-    private Animation animation;\r
-    private static int preCalcSteps = 9;\r
-    private Geometry[] preCalc = null;\r
-    private int currentPreCalc = 0;\r
-    \r
-    public void animate(double delta,double frameTime) {\r
-        if (animation != null)\r
-            animation.interpolate(delta);\r
-        if (preCalc != null) {\r
-            int newPreCalc = (int)Math.round(delta*(preCalc.length-1));\r
-            if (currentPreCalc != newPreCalc) {\r
-\r
-               preCalc[currentPreCalc].removeFromParent();\r
-                currentPreCalc = newPreCalc;\r
-                \r
-                body.attachChild(preCalc[currentPreCalc]);\r
-            }\r
-        }\r
-    }\r
-    \r
-    private void cleanAnimation() {\r
-       this.animation = null;\r
-       if (preCalc != null) {\r
-               for (Geometry g : preCalc) {\r
-                       if (g != null) {\r
-                               g.removeFromParent();\r
-                               g.clearBuffers();\r
-                       }\r
-               }\r
-               preCalc = null;\r
-       }\r
-    }\r
-\r
-    /**\r
-     * Sets shape's animation\r
-     * TODO : multiple animations at the same time! (must check common animatable properties)\r
-     * TODO : initial values (material, ..) (requires changes in the ontology)\r
-     * TODO : messy code, refactor!\r
-     * TODO : calculate number of required pre-calculated geometries \r
-     * @param animation\r
-     */\r
-    public boolean setAnimation(Graph g, Resource res) {\r
-       ContextGraph graph;\r
-       if (g instanceof ContextGraph) {\r
-               graph = (ContextGraph)g;\r
-       } else {\r
-               graph = new ContextGraph(g);\r
-               graph.setContext(shapeResource);\r
-       }\r
-       cleanAnimation();\r
-       if (res == null) {\r
-               if (isVisible())\r
-                       body.attachChild(mesh);\r
-            return false;\r
-        }\r
-       org.simantics.g2d.stubs.anim.Animation animation = new org.simantics.g2d.stubs.anim.Animation(graph,res);\r
-       G3DNode shape = getG3DNode(graph);\r
-        G3DNode modelResource = G3DTools.getModelFromResource(graph,shape.getResource());\r
-        assert (modelResource != null);\r
-        G3DModel model = new G3DModel(graph,modelResource.getResource());\r
-        Collection<org.simantics.g2d.stubs.anim.Animation> animations = model.getAnimation();\r
-        boolean found = false;\r
-        for (org.simantics.g2d.stubs.anim.Animation a : animations) {\r
-            if (a.getResource().equals(animation.getResource())) {\r
-                found = true;\r
-                break;\r
-            }\r
-        }\r
-        if (!found) {\r
-            ErrorLogger.getDefault().logWarning("Shape " + shape.getResource() + " cannot handle animation " + animation.getResource() + " because it isn't model's animation", null);\r
-            return false;\r
-        }\r
-        Collection<org.simantics.g2d.stubs.anim.Interpolator> interpolators = animation.getInterpolator();\r
-        List<org.simantics.g2d.stubs.anim.Interpolator> handled = new ArrayList<org.simantics.g2d.stubs.anim.Interpolator>();\r
-        List<org.simantics.g2d.stubs.anim.Interpolator> precalculated = new ArrayList<org.simantics.g2d.stubs.anim.Interpolator>();\r
-        for (org.simantics.g2d.stubs.anim.Interpolator i : interpolators) {\r
-            IEntity target = i.getTarget();\r
-            if (G3DTools.hasProperty(graph,shape.getResource(),target.getResource()))\r
-                handled.add(i);\r
-            else if (G3DTools.hasSubProperty(graph,shape.getResource(),target.getResource())) {\r
-                precalculated.add(i);\r
-            }\r
-        }\r
-        if (handled.size() == 0 && precalculated.size() == 0) {\r
-            ErrorLogger.getDefault().logWarning("Shape " + shape.getResource() + " cannot handle animation " + animation.getResource() + " since it doesn't change any of shape's properties", null);\r
-            return false;\r
-        }\r
-        \r
-        \r
-        this.animation = new Animation();\r
-        \r
-        org.simantics.g2d.stubs.anim.Interpolator[] pos = new org.simantics.g2d.stubs.anim.Interpolator[3];\r
-        org.simantics.g2d.stubs.anim.Interpolator[] ambient = new org.simantics.g2d.stubs.anim.Interpolator[3];\r
-        org.simantics.g2d.stubs.anim.Interpolator[] diffuse = new org.simantics.g2d.stubs.anim.Interpolator[3];\r
-        org.simantics.g2d.stubs.anim.Interpolator[] specular = new org.simantics.g2d.stubs.anim.Interpolator[3];\r
-        org.simantics.g2d.stubs.anim.Interpolator[] emissive = new org.simantics.g2d.stubs.anim.Interpolator[3];\r
-\r
-        Builtins builtins = graph.getBuiltins();\r
-\r
-        \r
-        for (org.simantics.g2d.stubs.anim.Interpolator i : handled) {\r
-            IEntity target = i.getTarget();\r
-            //if (target.isInstanceOf(Resources.g3dResource.LocalOrientation)) {\r
-            if (target.isInstanceOf(Resources.g3dResource.Orientation) && target.getRelatedObjects(Resources.g3dResource.LocalOrientationOf).size() == 1) {\r
-                SlerpInterpolator si = new SlerpInterpolator((SlerpCurve)Resources.curveBuilder.loadInterpolator(i));\r
-                si.setTarget(transform);\r
-                this.animation.addInterpolator(si);\r
-            } else if (target.isInstanceOf(builtins.Double)) {\r
-               Resource targetResource = target.getResource();\r
-               Collection<IEntity> p = target.getRelatedObjects(builtins.PropertyOf);\r
-                if (p.size() == 1) {\r
-                    IEntity parent = p.iterator().next();\r
-                    //if (parent.isInstanceOf(Resources.g3dResource.LocalPosition)) {\r
-                    if (parent.isInstanceOf(Resources.g3dResource.Position) && parent.getRelatedObjects(Resources.g3dResource.LocalPositionOf).size() == 1) {\r
-                        if (parent.getSingleRelatedObject(Resources.g3dResource.HasX).getResource().equals(targetResource)) {\r
-                             pos[0] = i;\r
-                        } else if (parent.getSingleRelatedObject(Resources.g3dResource.HasY).getResource().equals(targetResource)) {\r
-                            pos[1] = i;\r
-                        } else if (parent.getSingleRelatedObject(Resources.g3dResource.HasZ).getResource().equals(targetResource)) {\r
-                            pos[2] = i;\r
-                        } else {\r
-                            ErrorLogger.getDefault().logWarning("Cannot map animation interpolator " + i.getResource() + " to target (Position ?)" + target.getResource(),  null);\r
-                        }\r
-                    } else if (parent.isInstanceOf(Resources.g3dResource.Color)) {\r
-                        org.simantics.g2d.stubs.anim.Interpolator[] color = null;\r
-                        if (parent.isInstanceOf(Resources.g3dResource.Color) && parent.getRelatedObjects(Resources.g3dResource.AmbientColorOf).size() > 0) {\r
-                                color = ambient;\r
-                        } else if (parent.isInstanceOf(Resources.g3dResource.Color)&& parent.getRelatedObjects(Resources.g3dResource.DiffuseColorOf).size() > 0) {\r
-                                color = diffuse;\r
-                        } else if (parent.isInstanceOf(Resources.g3dResource.Color) && parent.getRelatedObjects(Resources.g3dResource.SpecularColorOf).size() > 0) {\r
-                                color = specular;\r
-                        } else if (parent.isInstanceOf(Resources.g3dResource.Color) && parent.getRelatedObjects(Resources.g3dResource.EmissiveColorOf).size() > 0) {\r
-                                color = emissive;\r
-                        } else {\r
-                            ErrorLogger.getDefault().logWarning("Cannot map animation interpolator " + i.getResource() + " to target (Color)" + target.getResource() + " unknown color type",  null);\r
-                        }\r
-                        if (color != null) {\r
-                            if (parent.getSingleRelatedObject(Resources.g3dResource.HasRed).getResource().equals(targetResource)) {\r
-                                color[0] = i;\r
-                            } else if (parent.getSingleRelatedObject(Resources.g3dResource.HasGreen).getResource().equals(targetResource)) {\r
-                                color[1] = i;\r
-                            } else if (parent.getSingleRelatedObject(Resources.g3dResource.HasBlue).getResource().equals(targetResource)) {\r
-                                color[2] = i;\r
-                            } else {\r
-                                ErrorLogger.getDefault().logWarning(\r
-                                        "Cannot map animation interpolator " + i.getResource()\r
-                                                + " to target (Color ?)" + target.getResource(), null);\r
-                            }\r
-                        }\r
-                    } else if (parent.isInstanceOf(Resources.g3dResource.Material)) {\r
-                       // TODO : transparency or shininess     \r
-                    } else {\r
-                        ErrorLogger.getDefault().logWarning("Cannot map animation interpolator " + i.getResource() + " to target" + target.getResource() + " adding it to precalculated interpolators",  null);\r
-                        precalculated.add(i);\r
-                    }\r
-                } else {\r
-                    if (p.size() == 0) {\r
-                        ErrorLogger.getDefault().logWarning("Cannot map animation interpolator " + i.getResource() + " to target (Double)" + target.getResource() + " since it is not a part of a property",  null);\r
-                    } else {\r
-                        ErrorLogger.getDefault().logWarning("Cannot map animation interpolator " + i.getResource() + " to target (Double)" + target.getResource() + " since it acts as a property to more than one entity",  null);  \r
-                    }\r
-                }\r
-            } else {\r
-                ErrorLogger.getDefault().logWarning("Cannot map animation interpolator " + i.getResource() + " to target" + target.getResource(),  null);\r
-            }\r
-        }\r
-        \r
-        if (pos[0] != null || pos[1] != null || pos[2] != null) {\r
-            ScalarInterpolator xIp;\r
-            ScalarInterpolator yIp;\r
-            ScalarInterpolator zIp;\r
-            if (pos[0] != null) {\r
-                xIp = new TCBInterpolator((TCBCurve)Resources.curveBuilder.loadInterpolator(pos[0]));\r
-            } else {\r
-                xIp = new ConstantInterpolator(shape.getLocalPosition().getX()[0]);\r
-            }\r
-            if (pos[1] != null) {\r
-                yIp = new TCBInterpolator((TCBCurve)Resources.curveBuilder.loadInterpolator(pos[1]));\r
-            } else {\r
-                yIp = new ConstantInterpolator(shape.getLocalPosition().getY()[0]);\r
-            }\r
-            if (pos[2] != null) {\r
-                zIp = new TCBInterpolator((TCBCurve)Resources.curveBuilder.loadInterpolator(pos[2]));\r
-            } else {\r
-                zIp = new ConstantInterpolator(shape.getLocalPosition().getZ()[0]);\r
-            }\r
-            ChanneledPositionInterpolator ip = new ChanneledPositionInterpolator(xIp,yIp,zIp);\r
-            ip.setTarget(transform);\r
-            this.animation.addInterpolator(ip);\r
-        \r
-        }  \r
-        addColorInterpolator(shape, ambient, ChanneledColorInterpolator.AMBIENT);\r
-        addColorInterpolator(shape, diffuse, ChanneledColorInterpolator.DIFFUSE);\r
-        addColorInterpolator(shape, emissive, ChanneledColorInterpolator.EMISSIVE);\r
-        addColorInterpolator(shape, specular, ChanneledColorInterpolator.SPECULAR);\r
-        \r
-        if (precalculated.size() == 0) {\r
-            preCalc = null;\r
-        } else {\r
-                preCalc = new Geometry[preCalcSteps+1];\r
-                for (int i = 0; i <= preCalcSteps; i++) {\r
-                    double delta = ((double)i / (double)preCalcSteps);\r
-                    // TODO : copy-paste from CSGAnimatorView\r
-                    // FIXME : does not update transformations (since ContextGraph does not support queries for context dependent values)\r
-                    for (Interpolator ip : precalculated) {\r
-                        if (ip.isInstanceOf(Resources.animationResource.ScalarInterpolator)) {\r
-                            // TODO : creating curve each time when time is set is slow.\r
-                            // Curve should be cached\r
-                            TCBCurve c = (TCBCurve)Resources.curveBuilder.loadInterpolator(ip);\r
-                            double out = c.evaluate(delta);\r
-                            //Double d = DoubleFactory.create(ip.getTarget());\r
-                            //d.setValue(new double[]{out});\r
-                            IEntity d = ip.getTarget();\r
-                            d.toProperty().setDoubleArray(new double[]{out});\r
-                        } else if (ip.isInstanceOf(Resources.animationResource.SlerpInterpolator)) {\r
-                            // TODO : creating curve each time when time is set is slow.\r
-                            // Curve should be cached\r
-                            SlerpCurve c = (SlerpCurve)Resources.curveBuilder.loadInterpolator(ip);\r
-                            Quat4d out = c.evaluate(delta);\r
-                            Orientation r = new Orientation(ip.getTarget());\r
-                            AxisAngle4d aa = new AxisAngle4d();\r
-                            aa.set(out);\r
-                            G3DTools.setOrientation(r, aa);\r
-                        }\r
-                    }\r
-                    preCalc[i] = getGeometry(graph,false)[0];\r
-                    preCalc[i].setIsCollidable(false);\r
-                    AppearanceTools.copyMaterial(mesh, preCalc[i]);\r
-                }\r
-                \r
-                // We'll have to remove original (non-animated) shape from the node\r
-                mesh.removeFromParent();\r
-                body.attachChild(preCalc[0]);\r
-           \r
-        }\r
-        return true;\r
-    }\r
-    \r
-    private void addColorInterpolator(G3DNode shape, org.simantics.g2d.stubs.anim.Interpolator[] color, int type) {\r
-        if (color[0] != null || color[1] != null || color[2] != null) {\r
-            ScalarInterpolator xIp;\r
-            ScalarInterpolator yIp;\r
-            ScalarInterpolator zIp;\r
-            Color col = null;\r
-            Collection<IEntity> appearanceResource = shape.getRelatedObjects(Resources.g3dResource.HasAppearance);\r
-            if (appearanceResource.size() == 0) {\r
-                ErrorLogger.getDefault().logWarning("Cannot create interpolator for color because shape " + shape.getResource() + " has no appearance", null);\r
-            }\r
-            Appearance a = new Appearance(shape.getGraph(),appearanceResource.iterator().next().getResource());\r
-            switch (type) {\r
-                case ChanneledColorInterpolator.AMBIENT:\r
-                    col = a.getMaterial().getAmbientColor();\r
-                    break;\r
-                case ChanneledColorInterpolator.DIFFUSE:\r
-                    col = a.getMaterial().getDiffuseColor();\r
-                    break;\r
-                case ChanneledColorInterpolator.EMISSIVE:\r
-                    col = a.getMaterial().getEmissiveColor();\r
-                    break;\r
-                case ChanneledColorInterpolator.SPECULAR:\r
-                    col = a.getMaterial().getSpecularColor();\r
-                    break;\r
-                default:\r
-                    ErrorLogger.defaultLogError("Unknown color type", null);\r
-                    return;\r
-            }\r
-\r
-            if (color[0] != null) {\r
-                xIp = new TCBInterpolator((TCBCurve)Resources.curveBuilder.loadInterpolator(color[0]));//CurveUtils.loadCurve(color[0].getResource()));\r
-            } else {\r
-                xIp = new ConstantInterpolator(col.getRed()[0]);\r
-            }\r
-            if (color[1] != null) {\r
-                yIp = new TCBInterpolator((TCBCurve)Resources.curveBuilder.loadInterpolator(color[1]));//CurveUtils.loadCurve(color[1].getResource()));\r
-            } else {\r
-                yIp = new ConstantInterpolator(col.getGreen()[0]);\r
-            }\r
-            if (color[1] != null) {\r
-                zIp = new TCBInterpolator((TCBCurve)Resources.curveBuilder.loadInterpolator(color[2]));//CurveUtils.loadCurve(color[2].getResource()));\r
-            } else {\r
-                zIp = new ConstantInterpolator(col.getBlue()[0]);\r
-            }\r
-            ChanneledColorInterpolator ip = new ChanneledColorInterpolator(xIp,yIp,zIp);\r
-            ip.setType(type);\r
-            ip.setTarget(mesh.getRenderState(RenderState.RS_MATERIAL));\r
-            this.animation.addInterpolator(ip);\r
-        } \r
-    }\r
-    \r
-    public boolean setRandomAnimation(Graph graph) {\r
-        return false;\r
-    }\r
-    \r
-    public void dispose() {\r
-//     mesh.clearBuffers();\r
-//     mesh.clearBatches();\r
-//     lines.clearBuffers();\r
-//     lines.clearBatches();\r
-       if (mesh != null) {\r
-               mesh.removeFromParent();\r
-               mesh.dispose();\r
-               mesh = null;\r
-       }\r
-       if (lines != null) {\r
-               lines.removeFromParent();\r
-               lines.dispose();\r
-               lines = null;\r
-       }\r
-       super.dispose();\r
-    }\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/AxesShape.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/AxesShape.java
deleted file mode 100644 (file)
index 461087c..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapes;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Line;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-public class AxesShape {\r
-    \r
-\r
-       public static Geometry getShape(Renderer renderer) {\r
-        float[] coords = new float[]{0.f,0.f,0.f,\r
-                          1.f,0.f,0.f,\r
-                          0.f,0.f,0.f,\r
-                          0.f,1.f,0.f,\r
-                          0.f,0.f,0.f,\r
-                          0.f,0.f,1.f};\r
-        float colors[] = new float[]{1.f,0.f,0.f,0.f,\r
-                          1.f,0.f,0.f,0.f,\r
-                          0.f,1.f,0.f,0.f,\r
-                          0.f,1.f,0.f,0.f,\r
-                          0.f,0.f,1.f,0.f,\r
-                          0.f,0.f,1.f,0.f};\r
-        \r
-\r
-        Line shape = new Line("",BufferUtils.createFloatBuffer(coords),null,BufferUtils.createFloatBuffer(colors),null);\r
-        shape.setMode(Line.SEGMENTS);\r
-        shape.setIsCollidable(false);\r
-        shape.setLineWidth(3.f);\r
-        MaterialState ms = renderer.createMaterialState();\r
-        ms.setColorMaterial(MaterialState.CM_EMISSIVE);\r
-        ms.setEmissive(new ColorRGBA(1.f,1.f,1.f,1.f));\r
-        shape.setRenderState(ms);\r
-        \r
-        return shape;\r
-       \r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/FloorShape.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/FloorShape.java
deleted file mode 100644 (file)
index cd289ad..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapes;\r
-\r
-import java.net.URL;\r
-\r
-import org.eclipse.core.runtime.FileLocator;\r
-import org.eclipse.core.runtime.Path;\r
-\r
-import com.jme.image.Texture;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.TextureState;\r
-import com.jme.util.TextureManager;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-public class FloorShape {\r
-       \r
-       private static String textureLocation = "src/jmetest/data/texture/Detail.jpg";\r
-\r
-       public static Geometry getShape(Renderer renderer, float size, float texScale) {\r
-\r
-               float coords[] = new float[3 * 4];\r
-               float normals[] = new float[3 * 4];\r
-               float texcoords[] = new float[2 * 4];\r
-               int indices[] = new int[] { 0, 2, 1, 1, 2, 3 };\r
-               coords[0] = -size;\r
-               coords[1] = 0.f;\r
-               coords[2] = -size;\r
-               coords[3] = size;\r
-               coords[4] = 0.f;\r
-               coords[5] = -size;\r
-               coords[6] = -size;\r
-               coords[7] = 0.f;\r
-               coords[8] = size;\r
-               coords[9] = size;\r
-               coords[10] = 0.f;\r
-               coords[11] = size;\r
-               texcoords[0] = -size*texScale;\r
-               texcoords[1] = -size*texScale;\r
-               texcoords[2] = size*texScale;\r
-               texcoords[3] = -size*texScale;\r
-               texcoords[4] = -size*texScale;\r
-               texcoords[5] = size*texScale;\r
-               texcoords[6] = size*texScale;\r
-               texcoords[7] = size*texScale;\r
-               normals[0] = 0.f;\r
-               normals[1] = 1.f;\r
-               normals[2] = 0.f;\r
-               normals[3] = 0.f;\r
-               normals[4] = 1.f;\r
-               normals[5] = 0.f;\r
-               normals[6] = 0.f;\r
-               normals[7] = 1.0f;\r
-               normals[8] = 0.f;\r
-               normals[9] = 0.f;\r
-               normals[10] = 1.f;\r
-               normals[11] = 0.f;\r
-      \r
-        TriMesh shape = new TriMesh("",BufferUtils.createFloatBuffer(coords),BufferUtils.createFloatBuffer(normals),null,BufferUtils.createFloatBuffer(texcoords),BufferUtils.createIntBuffer(indices));\r
-        MaterialState ms = renderer.createMaterialState();\r
-        ms.setEmissive(new ColorRGBA(0.5f,0.5f,0.5f,0.f));\r
-        ms.setDiffuse(new ColorRGBA(1.f,1.f,1.f,0.f));\r
-        ms.setShininess(128.f);\r
-        shape.setRenderState(ms);\r
-        shape.setCullMode(Geometry.CULL_NEVER);\r
-\r
-        TextureState ts = renderer.createTextureState();\r
-        URL url = FileLocator.find(com.jme.eclipse.Activator.getDefault().getBundle(),new Path(textureLocation),null);\r
-        Texture tex = TextureManager.loadTexture(url, Texture.MM_LINEAR_LINEAR,\r
-                Texture.FM_LINEAR);\r
-        tex.setWrap(Texture.WM_WRAP_S_WRAP_T);\r
-        ts.setTexture(tex);\r
-        shape.setRenderState(ts);\r
-        shape.lockShadows();\r
-        return shape;\r
-       \r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/GridShape.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/GridShape.java
deleted file mode 100644 (file)
index 284b357..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapes;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Line;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-public class GridShape {\r
-    \r
\r
-       public static Geometry getShape(Renderer renderer, int lineCount, float delta) {\r
-           \r
-        float[] coords = new float[lineCount*lineCount*2*3];\r
-        float size = delta * lineCount;\r
-        float halfSize = size * 0.5f;\r
-        \r
-        for (int i = 0 ; i <= lineCount; i++) {\r
-            int index = i*3*2;\r
-            coords[index++] = -halfSize + i * delta;\r
-            coords[index++] = 0.f;\r
-            coords[index++] = -halfSize;\r
-            coords[index++] = -halfSize + i * delta;\r
-            coords[index++] = 0.f;\r
-            coords[index++] = +halfSize;\r
-        }\r
-        for (int i = 0 ; i <= lineCount; i++) {\r
-            int index = (i + lineCount + 1)*3*2;\r
-            coords[index++] = -halfSize;\r
-            coords[index++] = 0.f;\r
-            coords[index++] = -halfSize + i * delta;\r
-            coords[index++] = +halfSize;\r
-            coords[index++] = 0.f;\r
-            coords[index++] = -halfSize + i * delta;\r
-        }\r
-\r
-        Line shape = new Line("",BufferUtils.createFloatBuffer(coords),null,null,null);\r
-        MaterialState ms = renderer.createMaterialState();\r
-        ms.setEmissive(new ColorRGBA(1.f,1.f,1.f,0.f));\r
-        shape.setRenderState(ms);\r
-        shape.setCullMode(Geometry.CULL_NEVER);\r
-        return shape;\r
-       \r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/Quad.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/shapes/Quad.java
deleted file mode 100644 (file)
index cab5e37..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.shapes;\r
-\r
-import java.nio.FloatBuffer;\r
-\r
-import com.jme.math.Vector3f;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.scene.batch.TriangleBatch;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-public class Quad extends TriMesh {\r
-\r
-       private static final long serialVersionUID = 1L;\r
-\r
-    public Quad() {\r
-        \r
-    }\r
-    \r
-       /**\r
-        * Constructor creates a new <code>Quad</code> object. That data for the\r
-        * <code>Quad</code> is not set until a call to <code>initialize</code>\r
-        * is made.\r
-        * \r
-        * @param name\r
-        *            the name of this <code>Quad</code>.\r
-        */\r
-       public Quad(String name) {\r
-               super(name);\r
-       }\r
-\r
-       /**\r
-        * Constructor creates a new <code>Quade</code> object with the provided\r
-        * width and height.\r
-        * \r
-        * @param name\r
-        *            the name of the <code>Quad</code>.\r
-        * @param width\r
-        *            the width of the <code>Quad</code>.\r
-        * @param height\r
-        *            the height of the <code>Quad</code>.\r
-        */\r
-       public Quad(String name, float width, float height) {\r
-               super(name);\r
-               initialize(width, height);\r
-       }\r
-\r
-       /**\r
-        * <code>resize</code> changes the width and height of the given quad by\r
-        * altering its vertices.\r
-        * \r
-        * @param width\r
-        *            the new width of the <code>Quad</code>.\r
-        * @param height\r
-        *            the new height of the <code>Quad</code>.\r
-        */\r
-       public void resize(float width, float height) {\r
-        TriangleBatch batch = getBatch(0);\r
-               batch.getVertexBuffer().clear();\r
-               batch.getVertexBuffer().put(-width / 2f).put(height / 2f).put(0);\r
-               batch.getVertexBuffer().put(-width / 2f).put(-height / 2f).put(0);\r
-               batch.getVertexBuffer().put(width / 2f).put(-height / 2f).put(0);\r
-               batch.getVertexBuffer().put(width / 2f).put(height / 2f).put(0);\r
-       }\r
-\r
-       /**\r
-        * \r
-        * <code>initialize</code> builds the data for the <code>Quad</code>\r
-        * object.\r
-        * \r
-        * \r
-        * @param width\r
-        *            the width of the <code>Quad</code>.\r
-        * @param height\r
-        *            the height of the <code>Quad</code>.\r
-        */\r
-       public void initialize(float width, float height) {\r
-        TriangleBatch batch = getBatch(0);\r
-               batch.setVertexCount(4);\r
-               batch.setVertexBuffer(BufferUtils.createVector3Buffer(batch.getVertexCount()));\r
-               batch.setNormalBuffer(BufferUtils.createVector3Buffer(batch.getVertexCount()));\r
-        FloatBuffer tbuf = BufferUtils.createVector2Buffer(batch.getVertexCount());\r
-        setTextureBuffer(0,tbuf);\r
-           batch.setTriangleQuantity(2);\r
-           batch.setIndexBuffer(BufferUtils.createIntBuffer(batch.getTriangleCount() * 3));\r
-\r
-               batch.getVertexBuffer().put(-width / 2f).put(height / 2f).put(0);\r
-               batch.getVertexBuffer().put(-width / 2f).put(-height / 2f).put(0);\r
-               batch.getVertexBuffer().put(width / 2f).put(-height / 2f).put(0);\r
-               batch.getVertexBuffer().put(width / 2f).put(height / 2f).put(0);\r
-\r
-               batch.getNormalBuffer().put(0).put(0).put(1);\r
-               batch.getNormalBuffer().put(0).put(0).put(1);\r
-               batch.getNormalBuffer().put(0).put(0).put(1);\r
-               batch.getNormalBuffer().put(0).put(0).put(1);\r
-\r
-        \r
-               tbuf.put(0).put(0);\r
-        tbuf.put(0).put(1);\r
-        tbuf.put(1).put(1);\r
-        tbuf.put(1).put(0);\r
-\r
-           setDefaultColor(ColorRGBA.white);\r
-\r
-           batch.getIndexBuffer().put(0);\r
-           batch.getIndexBuffer().put(1);\r
-           batch.getIndexBuffer().put(2);\r
-           batch.getIndexBuffer().put(0);\r
-           batch.getIndexBuffer().put(2);\r
-           batch.getIndexBuffer().put(3);\r
-       }\r
-\r
-       /**\r
-        * <code>getCenter</code> returns the center of the <code>Quad</code>.\r
-        * \r
-        * @return Vector3f the center of the <code>Quad</code>.\r
-        */\r
-       public Vector3f getCenter() {\r
-               return worldTranslation;\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/OEPathSelectionListener.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/OEPathSelectionListener.java
deleted file mode 100644 (file)
index 1af0908..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.tools;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.viewers.ISelectionChangedListener;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.jface.viewers.SelectionChangedEvent;\r
-import org.simantics.layer0.utils.viewpoints.TraversalPath;\r
-import org.simantics.proconf.browsing.MutableCachedGraphTreeNode;\r
-\r
-/**\r
- * SelectionListener for OntologyExplorer\r
- * \r
- * Returns Selection as TraversalPath\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public abstract class OEPathSelectionListener implements ISelectionChangedListener{\r
-       @SuppressWarnings("unchecked")\r
-       public void selectionChanged(SelectionChangedEvent event) {\r
-               IStructuredSelection s = (IStructuredSelection)event.getSelection();\r
-               List<TraversalPath> paths = new ArrayList<TraversalPath>();\r
-               Iterator<MutableCachedGraphTreeNode> i = s.iterator();\r
-               while(i.hasNext()) {\r
-                       MutableCachedGraphTreeNode node = i.next();\r
-                       TraversalPath path = (TraversalPath)node.getObject();\r
-                       paths.add(path);\r
-               }       \r
-               pathSelectionUpdated(paths);\r
-       }\r
-       \r
-       protected abstract void pathSelectionUpdated(List<TraversalPath> paths);\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/OESelectionListener.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/OESelectionListener.java
deleted file mode 100644 (file)
index 54e4619..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.tools;\r
-\r
-import java.util.Iterator;\r
-\r
-import org.eclipse.jface.viewers.ISelectionChangedListener;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.jface.viewers.SelectionChangedEvent;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.browsing.providers.TreeObject;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-\r
-/**\r
- * SelectionListener for OntologyExplorer\r
- * \r
- * Returns selection as StrcturedResourceSelection\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public abstract class OESelectionListener implements ISelectionChangedListener { \r
-       @SuppressWarnings("unchecked")\r
-       public void selectionChanged(SelectionChangedEvent event) {\r
-               IStructuredSelection s = (IStructuredSelection)event.getSelection();\r
-               StructuredResourceSelection sel = new StructuredResourceSelection();\r
-               Iterator<TreeObject> i = s.iterator();\r
-               while(i.hasNext()) {\r
-                       TreeObject node = i.next();\r
-                       sel.add((Resource)node.getAdapter(Resource.class));\r
-               }\r
-               resourceSelectionUpdated(sel);\r
-       }\r
-       \r
-       protected abstract void resourceSelectionUpdated(StructuredResourceSelection selection);\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/PropertyTree.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/PropertyTree.java
deleted file mode 100644 (file)
index ea7f62d..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.tools;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Tree;\r
-import org.eclipse.swt.widgets.TreeItem;\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.ResourceDebugUtils;\r
-import org.simantics.layer0.utils.Statement;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-\r
-/**\r
- * PropertyTree finds common properties for set of objects, and\r
- * then based on user's selection returns all property instances.\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class PropertyTree {\r
-    private Tree tree;\r
-    private Session session;\r
-    \r
-    \r
-    public PropertyTree(Tree tree, Session session) {\r
-        this.tree = tree;\r
-        this.session = session;\r
-    }\r
-    \r
-    public void setProperties(List<Resource> selectedInstances) {\r
-        tree.removeAll();\r
-        addProperties(null,selectedInstances);\r
-        tree.redraw();\r
-    }\r
-    \r
-    public void setProperties(StructuredResourceSelection selection) {\r
-        ArrayList<Resource> selectedInstances = new ArrayList<Resource>();\r
-        for (Resource r : selection.getSelectionList()) {\r
-            if (!contains(selectedInstances,r)) {\r
-               selectedInstances.add(r);\r
-                \r
-                //System.out.println("Added " + name.getName());\r
-            } else {\r
-               \r
-               // System.out.println("Discarded " + name.getName());\r
-            }\r
-        }\r
-        setProperties(selectedInstances);\r
-    }\r
-    \r
-    public Tree getTree() {\r
-        return tree;\r
-    }\r
-\r
-    private void addProperties(final TreeItem parent, final List<Resource> selectedInstances) {\r
-       session.asyncRead(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       Builtins builtins = g.getBuiltins();\r
-                       ArrayList<Resource> relationTypes = new ArrayList<Resource>();\r
-               for (Resource resource : selectedInstances) {\r
-                   IEntity thing = EntityFactory.create(g, resource);\r
-                   \r
-                   Collection<Statement> properties = thing.getRelatedStatements(builtins.HasProperty);\r
-                  // RelationSet properties = resource.getRelatedResourcesWithRelationIds(GlobalIdMap.get(Builtins.HasProperty));\r
-                   \r
-                   for (Statement r : properties) {\r
-                       // Statement contains relation from instance to property(instance)\r
-                       // Find the property's type(s)\r
-                       // TODO : seems to be bad way of finding type\r
-                       Collection<IEntity> types = r.getObject().getRelatedObjects(builtins.InstanceOf);\r
-                       if (types.size() != 1)\r
-                               throw new UnsupportedOperationException("Cannot support multi-instances");\r
-                       IEntity type = types.iterator().next();\r
-                       if (!contains(relationTypes, r.getPredicate().getResource())) {\r
-                           \r
-                           if (type.isInheritedFrom(builtins.Double)) {\r
-                               \r
-                               relationTypes.add(r.getPredicate().getResource());\r
-                              \r
-                               //System.out.println("Added " + name.getName() + " " + type.getId() + " " + r.getRelationId() + " " + relationType.getId());\r
-                               final String name = getNameForThing(r.getPredicate());//getNameForThing(thing);\r
-                               final Object treeData = r.getPredicate().getResource();\r
-                               Display.getDefault().asyncExec(new Runnable() {\r
-                               //parent.getDisplay().asyncExec(new Runnable() {\r
-                                       TreeItem item = null;\r
-                                       @Override\r
-                                       public void run() {\r
-                                               if (parent != null)\r
-                                           item = new TreeItem(parent,SWT.NONE);\r
-                                       else\r
-                                           item = new TreeItem(tree,SWT.NONE);\r
-                                       item.setData(treeData);\r
-                                       item.setText(name);\r
-                                               \r
-                                       }\r
-                               });\r
-                               \r
-                           } else {\r
-                               //Resource pproperties[] = r.getRelatedResources(GlobalIdMap.get(Builtins.PropertyRelationType));\r
-                                   //Resource pproperties[] = resource.get(r.getObjectId()).getRelatedResources(GlobalIdMap.get(Builtins.HasProperty));\r
-                                   Collection<IEntity> pproperties = r.getObject().getRelatedObjects(builtins.HasProperty);\r
-                               if (pproperties.size() > 0) {\r
-                                       final ArrayList<Resource> list = new ArrayList<Resource>();\r
-                                       list.add(r.getObject().getResource());\r
-                                      \r
-                                       final String name = getNameForThing(r.getPredicate());//getNameForThing(thing);\r
-                                       final Object treeData = r.getPredicate().getResource();\r
-                                       relationTypes.add(r.getPredicate().getResource());\r
-                                       Display.getDefault().asyncExec(new Runnable() {\r
-                                       //parent.getDisplay().asyncExec(new Runnable() {\r
-                                               @Override\r
-                                               public void run() {\r
-                                                       TreeItem item = null;\r
-                                                                               if (parent != null)\r
-                                                                                       item = new TreeItem(parent, SWT.NONE);\r
-                                                                               else\r
-                                                                                       item = new TreeItem(tree, SWT.NONE);\r
-                                                                               item.setText(name);\r
-                                                                               item.setData(treeData);\r
-                                                                               addProperties(item,list);\r
-                                               }\r
-                                       });\r
-                                   }\r
-                           }\r
-                       } \r
-                   }\r
-               }\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-       });\r
-        \r
-    }\r
-    \r
-    private String getNameForThing(IEntity thing) {\r
-       return ResourceDebugUtils.getReadableNameForEntity(thing);\r
-        /*\r
-        String tName = thing.getName();\r
-         if (tName == null) {\r
-               Collection<Thing> ptypes = thing.getTypes();\r
-               for (Thing pt : ptypes) {\r
-                       tName = pt.getName();\r
-                       if (tName != null)\r
-                               break;\r
-               }\r
-         }\r
-         if (tName == null)\r
-                return "Error / no name for " + thing;\r
-         return tName;\r
-         */\r
-    }\r
-    \r
-    private boolean contains(java.util.List<Resource> list, Resource value) {\r
-        for (int i = 0; i < list.size(); i++) {\r
-            if (list.get(i).equals(value))\r
-                return true;\r
-        }\r
-        return false;\r
-    }\r
-    \r
-    /**\r
-     * Returns all properties (instances) contained in the list depending on selection in the tree and \r
-     * TODO : currently can be run only in UI -thread with transaction.\r
-     * \r
-     * @param graph\r
-     * @param shapes\r
-     * @return\r
-     */\r
-    public List<Resource> findLeafPropertyInstances(Graph graph,List<Resource> shapes) {\r
-        TreeItem[] selectedProperties = tree.getSelection();\r
-        List<Resource> props = new ArrayList<Resource>();\r
-        for (TreeItem propertyItem : selectedProperties) {\r
-            \r
-            TreeItem t = propertyItem;\r
-            boolean c = false;\r
-            // if list contains treeNode's parent, node's property is already mapped / will be mapped later\r
-            while (t.getParentItem() != null) {\r
-                if (contains(selectedProperties, t.getParentItem())) {\r
-                    c = true;\r
-                    break;\r
-                }\r
-                t = t.getParentItem();\r
-\r
-            }\r
-            if (!c) {\r
-               props.addAll(findLeafProperties(graph,shapes, propertyItem));\r
-            }\r
-        }\r
-        return props;\r
-    }\r
-    \r
-    public List<Resource> findPropertyInstances(Graph graph,List<Resource> shapes) {\r
-        TreeItem[] selectedProperties = tree.getSelection();\r
-        List<Resource> props = new ArrayList<Resource>();\r
-        for (TreeItem propertyItem : selectedProperties) {\r
-            \r
-            TreeItem t = propertyItem;\r
-            boolean c = false;\r
-            // if list contains treeNode's parent, node's property is already mapped / will be mapped later\r
-            while (t.getParentItem() != null) {\r
-                if (contains(selectedProperties, t.getParentItem())) {\r
-                    c = true;\r
-                    break;\r
-                }\r
-                t = t.getParentItem();\r
-\r
-            }\r
-            if (!c) {\r
-               props.addAll(findProperties(graph,shapes, propertyItem));\r
-            }\r
-        }\r
-        return props;\r
-    }\r
-    \r
-    private List<Resource> findProperties(Graph graph,java.util.List<Resource> shapes, TreeItem propertyItem) {\r
-        ArrayList<Resource> propertyChain = new ArrayList<Resource>();\r
-        TreeItem t = propertyItem;\r
-        while (t != null) {\r
-            propertyChain.add((Resource) t.getData());\r
-            t = t.getParentItem();\r
-        }\r
-        \r
-        return findProperties(graph,shapes,propertyChain);\r
-       \r
-    }\r
-    \r
-    private List<Resource> findLeafProperties(Graph graph,java.util.List<Resource> shapes, TreeItem propertyItem) {\r
-        ArrayList<Resource> propertyChain = new ArrayList<Resource>();\r
-        TreeItem t = propertyItem;\r
-        while (t != null) {\r
-            propertyChain.add((Resource)t.getData());\r
-            t = t.getParentItem();\r
-        }\r
-        // now propertyChain contains property hierarchy from leaf to root\r
-        //Long typeID = (Long) propertyItem.getData();\r
-        if (propertyItem.getItemCount() == 0) { \r
-            return findProperties(graph,shapes,propertyChain);\r
-        } else {\r
-            List<Resource> props = new ArrayList<Resource>();\r
-            //Long typeID = (Long) propertyItem.getData();\r
-            TreeItem children[] = propertyItem.getItems();\r
-            //ArrayList<Resource> props = getPropertiesForType(shapes, typeID);\r
-            for (TreeItem i : children)\r
-                //mapProperty(parameter,props, i);\r
-                props.addAll(findLeafProperties(graph,shapes, i));\r
-            return props;\r
-        }\r
-    }\r
-    \r
-    private List<Resource> findProperties(Graph graph, java.util.List<Resource> shapes, ArrayList<Resource> propertyChain) {\r
-        ArrayList<Resource> res = new ArrayList<Resource>(shapes);\r
-        // propertyChain contains hierarhy of properties form leaf to root :\r
-        // we'll find root property from shapes and then iterate each property instance\r
-        // until we'll fin all requested properties (first element in property chain)\r
-        \r
-//        System.out.print("instances ");\r
-//        for (Resource r : res) {\r
-//            System.out.print(r + " ");\r
-//        }\r
-//        System.out.println();\r
-        \r
-        while (propertyChain.size() > 0) {\r
-            res = getPropertiesForType(graph, res, propertyChain.get(propertyChain.size() - 1));\r
-//            System.out.print(propertyChain.get(propertyChain.size() - 1) +" instances ");\r
-//            for (Resource r : res) {\r
-//                System.out.print(r + " ");\r
-//            }\r
-//            System.out.println();\r
-            propertyChain.remove(propertyChain.size() - 1);\r
-        }\r
-        // now res contains all instances of requested property\r
-        return res;\r
-    }\r
-    \r
-    private ArrayList<Resource> getPropertiesForType(Graph graph,java.util.List<Resource> instances, Resource typeID) {\r
-        ArrayList<Resource> properties = new ArrayList<Resource>();\r
-        for (Resource instance : instances) {\r
-               IEntity t = EntityFactory.create(graph,instance);\r
-               Collection<IEntity> props = t.getRelatedObjects(typeID);\r
-            for (IEntity p : props)\r
-                properties.add(p.getResource());\r
-                \r
-        }\r
-        return properties;\r
-    }\r
-    \r
-    private boolean contains(TreeItem items[], TreeItem item) {\r
-        for (TreeItem i : items)\r
-            if (i.equals(item))\r
-                return true;\r
-        return false;\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/ScenegraphLockTraverser.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/tools/ScenegraphLockTraverser.java
deleted file mode 100644 (file)
index c3bf357..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.simantics.proconf.g3d.tools;\r
-\r
-import java.util.ArrayList;\r
-\r
-import com.jme.scene.Node;\r
-import com.jme.scene.Spatial;\r
-\r
-public class ScenegraphLockTraverser {\r
-       Node root;\r
-       boolean lock;\r
-       public ScenegraphLockTraverser(Node root, boolean lock) {\r
-               this.root = root;\r
-               this.lock = lock;\r
-               lock(root);\r
-       }\r
-       \r
-       private void lock(Spatial spatial) {\r
-               if (lock)\r
-                       spatial.lock();\r
-               else\r
-                       spatial.unlock();\r
-               if (spatial instanceof Node) {\r
-                       Node node = (Node)spatial;\r
-                       ArrayList<Spatial> children = node.getChildren();\r
-               for (Spatial s : children) {\r
-                       s.lock();\r
-                       lock(s);\r
-               }\r
-               }\r
-               \r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/AppearanceEditor.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/AppearanceEditor.java
deleted file mode 100644 (file)
index 6917078..0000000
+++ /dev/null
@@ -1,1146 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.views;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.MouseAdapter;\r
-import org.eclipse.swt.events.MouseEvent;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.graphics.RGB;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.ColorDialog;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Slider;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.StubLinkedList;\r
-import org.simantics.layer0.utils.internal.Entity;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.base.AppearanceTools;\r
-import org.simantics.proconf.g3d.stubs.Appearance;\r
-import org.simantics.proconf.g3d.stubs.ImageTexture;\r
-import org.simantics.proconf.g3d.stubs.Material;\r
-import org.simantics.proconf.g3d.stubs.MultiTexture;\r
-import org.simantics.proconf.g3d.stubs.Shader;\r
-import org.simantics.proconf.g3d.stubs.Texture;\r
-import org.simantics.proconf.g3d.stubs.TextureCoordinateGenerator;\r
-import org.simantics.proconf.image.ImageUtils;\r
-import org.simantics.proconf.image.interfaces.IImage;\r
-import org.simantics.proconf.image.interfaces.IImageFactory;\r
-import org.simantics.proconf.image.ui.ImageComposite;\r
-import org.simantics.proconf.ui.utils.ResourceAdaptionUtils;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-\r
-public class AppearanceEditor extends SinglePageResourceView{\r
-\r
-    //Appearance appearance;\r
-       Resource shapeResource;\r
-       Resource appearanceResource;\r
-       \r
-       private enum EditorState{NONE,NO_SHAPE,NO_APPEARANCE, APPEARANCE};\r
-       EditorState state = EditorState.NONE;\r
-       \r
-    Button materialButton;\r
-    \r
-    Composite ambientComposite;\r
-    Composite diffuseComposite;\r
-    Composite specularComposite;\r
-    Composite emissiveComposite;\r
-    Slider specularSlider;\r
-    Slider transparencySlider;\r
-    \r
-    \r
-    Composite textureParent;\r
-    \r
-    Button textureButton;\r
-    Button addTextureButton;\r
-    \r
-    \r
-    //Image image = null;\r
-    \r
-    boolean updating = false;\r
-    \r
-    private ArrayList<TextureComposite> textureComposites = new ArrayList<TextureComposite>();\r
-    \r
-    Button shaderButton;\r
-    Text fragmentShaderText; \r
-    Text vertexShaderText; \r
-    \r
-    Button apply3Button;\r
-    Button apply2Button;\r
-    Button applyButton;\r
-    \r
-    public AppearanceEditor() {\r
-       super();\r
-        //super(Activator.PLUGIN_ID);\r
-       \r
-    }\r
-    \r
-    @Override\r
-    public void createPartControl(Composite parent) {\r
-       super.createPartControl(parent);\r
-       createWidgets();\r
-    }\r
-\r
-    @Override\r
-    protected String getFormText() {\r
-        return "Appearance Editor";\r
-    }\r
-\r
-//    @Override\r
-//    protected void beforeCreateWidgets() {\r
-//        if (!(getInputResource().isInstanceOf(GlobalIdMap.get(ThreeDimensionalModelingOntologyMapping.APPEARANCE))))\r
-//            throw new RuntimeException("Trying to open resource that is not appearance");\r
-//        appearance = AppearanceFactory.create(getInputResource());\r
-//    }\r
-    \r
-    \r
-\r
-    @Override\r
-    protected void createWidgets() {\r
-       \r
-       if (shapeResource == null) {\r
-               if (state != EditorState.NO_SHAPE) {\r
-                       clearForm();\r
-                       state = EditorState.NO_SHAPE;\r
-                       toolkit.createLabel(getBody(), "No shape selected");\r
-                       getActiveForm().layout(true, true);\r
-               }\r
-       } else if (appearanceResource == null){\r
-               if (state != EditorState.NO_APPEARANCE) {\r
-                       clearForm();\r
-                       state = EditorState.NO_APPEARANCE;\r
-                       toolkit.createLabel(getBody(), "Selected shape does not have material definition.");\r
-                       Button b = toolkit.createButton(getBody(), "Create Appearance", SWT.PUSH);\r
-                       b.addSelectionListener(new SelectionAdapter() {\r
-                               @Override\r
-                               public void widgetSelected(SelectionEvent e) {\r
-                                       getSession().asyncWrite(new GraphRequestAdapter() {\r
-                                               @Override\r
-                                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                                       Appearance appearance = Appearance.createDefault(g);\r
-                                                       appearanceResource = appearance.getResource();\r
-                                                       g.addStatement(shapeResource, Resources.g3dResource.HasAppearance, appearanceResource);\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               }\r
-                                               \r
-                                               @Override\r
-                                               public void requestCompleted( GraphRequestStatus status) {\r
-                                                       reloadInUIThread();\r
-                                               }\r
-                                       });\r
-\r
-                               }\r
-                       });\r
-                       getActiveForm().layout(true, true);\r
-               }\r
-       } else {\r
-               if (state != EditorState.APPEARANCE) {\r
-                       clearForm();\r
-                       state = EditorState.APPEARANCE;\r
-                       createMaterialGroup(newGridSection(2, 2, false, false, "Material", "Material properties"));\r
-                       createTextureGroup(newGridSection(1, 1, false, false, "Texture", "Texture properties"));\r
-                       createShaderGroup(newGridSection(2, 2, false, false, "Shader", "Shader properties"));\r
-                       getActiveForm().layout(true, true);\r
-               }\r
-               \r
-       }\r
-    }\r
-    \r
-    @Override\r
-    public void clearForm() {\r
-       super.clearForm();\r
-       textureComposites.clear();\r
-    }\r
-    \r
-    @Override\r
-    protected void pageSelectionChanged(IWorkbenchPart part, ISelection selection) {\r
-       Resource res[] = ResourceAdaptionUtils.toResources(selection);\r
-       if (res.length == 0) {\r
-               shapeResource = null;\r
-               appearanceResource = null;\r
-               reload();\r
-               return;\r
-       }\r
-       final Resource sel = res[0];\r
-       if (sel.equals(shapeResource))\r
-                       return;\r
-       //System.out.println("AppearanceEditor.pageSelectionChanged");\r
-       getSession().asyncRead(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       \r
-                       shapeResource = null;\r
-                       appearanceResource = null;\r
-                       // selected object must be a shape\r
-                       if (!g.isInstanceOf(sel, Resources.g3dResource.Shape)) {\r
-                               return GraphRequestStatus.transactionCancel();\r
-                       }\r
-                       // the shape must not be ah geometry definition\r
-                       if (g.getObjects(sel, Resources.g3dResource.GeometryDefinitionOf).size() > 0)\r
-                               return GraphRequestStatus.transactionCancel();\r
-                       \r
-                       shapeResource = sel;\r
-                       Collection<Resource> res = g.getObjects(shapeResource, Resources.g3dResource.HasAppearance);\r
-                       if (res.size() == 1)\r
-                               appearanceResource = res.iterator().next();\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-               \r
-               @Override\r
-               public void requestCompleted(GraphRequestStatus status) {\r
-                       reloadInUIThread();\r
-               }\r
-       });\r
-    }\r
-    \r
-    public void reloadInUIThread() {\r
-       parent.getDisplay().asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               reload();\r
-                       }\r
-               });\r
-    }\r
-    \r
-    public void reload() {\r
-        if (updating)\r
-             return;\r
-       createWidgets();\r
-       if (state == EditorState.APPEARANCE) {\r
-               getSession().asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               reload(g);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-       }\r
-    }\r
-\r
-    @Override\r
-    public void reload(Graph g) {\r
-        if (updating)\r
-            return;\r
-        if (state != EditorState.APPEARANCE) {\r
-               return;\r
-        }\r
-        Appearance appearance = new Appearance(g,appearanceResource);\r
-        Material m = appearance.getMaterial();\r
-        Texture t = appearance.getTexture();\r
-        Shader s = appearance.getShader();\r
-        loadMaterial(m);\r
-        loadTexture(t);\r
-        loadShader(s);\r
-\r
-\r
-    }\r
-    \r
-    private void loadMaterial(Material m) {\r
-       final boolean hasMaterial;\r
-       final Color ambient;\r
-       final Color diffuse;\r
-       final Color specular;\r
-       final Color emissive;\r
-       final int shininess;\r
-       final int transparency;\r
-       if (m == null) {\r
-               hasMaterial = false;\r
-               ambient = null;\r
-               diffuse = null;\r
-               specular = null;\r
-               emissive = null;\r
-               shininess = 0;\r
-               transparency = 0;\r
-       } else {\r
-               hasMaterial = true;\r
-               ambient = AppearanceTools.getColor(m.getAmbientColor(), this.getBody().getDisplay());\r
-               diffuse = AppearanceTools.getColor(m.getDiffuseColor(), this.getBody().getDisplay());\r
-               specular = AppearanceTools.getColor(m.getSpecularColor(), this.getBody().getDisplay());\r
-               emissive = AppearanceTools.getColor(m.getEmissiveColor(), this.getBody().getDisplay());\r
-               shininess = (int)m.getShininess()[0];\r
-               transparency = (int)(m.getTransparency()[0]*100.0);\r
-       }\r
-       parent.getDisplay().asyncExec(new Runnable() {\r
-               @Override\r
-               public void run() {\r
-                       boolean t = hasMaterial;\r
-                   materialButton.setSelection(t);\r
-                   ambientComposite.setEnabled(t);\r
-                   diffuseComposite.setEnabled(t);\r
-                   specularComposite.setEnabled(t);\r
-                   emissiveComposite.setEnabled(t);\r
-                   specularSlider.setEnabled(t);\r
-                   transparencySlider.setEnabled(t);\r
-                       if (hasMaterial) {\r
-                   ambientComposite.setBackground(ambient);\r
-                   diffuseComposite.setBackground(diffuse);\r
-                   specularComposite.setBackground(specular);\r
-                   emissiveComposite.setBackground(emissive);\r
-                   specularSlider.setSelection(shininess);\r
-                   transparencySlider.setSelection(transparency);\r
-               } else {\r
-                       Color c = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY);\r
-                       ambientComposite.setBackground(c);\r
-                   diffuseComposite.setBackground(c);\r
-                   specularComposite.setBackground(c);\r
-                   emissiveComposite.setBackground(c);\r
-               }\r
-                       \r
-               };\r
-       });\r
-        \r
-    }\r
-    \r
-    private void loadTexture(Texture t) {\r
-       //System.out.println("AppearanceEditor.loadTexture");\r
-        if (t == null) {\r
-               parent.getDisplay().asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               textureButton.setSelection(false);\r
-                       }\r
-               });\r
-            \r
-            return;\r
-        }\r
-        parent.getDisplay().asyncExec(new Runnable() {\r
-               @Override\r
-               public void run() {\r
-                       textureButton.setSelection(true);\r
-               }\r
-        });\r
-        \r
-        if (t.isInstanceOf(Resources.g3dResource.ImageTexture)) {\r
-            //final ImageTexture t2 = new ImageTexture(t);\r
-               final Resource t2 = t.getResource();\r
-               parent.getDisplay().asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               while (textureComposites.size() > 1) {\r
-                           textureComposites.remove(textureComposites.size()-1).dispose();\r
-                       }\r
-                       if (textureComposites.size() == 0) {\r
-                           textureComposites.add(new TextureComposite(textureParent,SWT.NONE));\r
-                       }\r
-                       getSession().asyncWrite(new GraphRequestAdapter() {\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       try {\r
-                                   textureComposites.get(0).update(new ImageTexture(g,t2));\r
-                               } catch (Exception e) {\r
-                                   ErrorLogger.defaultLogError(e);\r
-                               }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                               };\r
-                   \r
-                       });\r
-                       }\r
-               });\r
-            \r
-            \r
-        } else if (t.isInstanceOf(Resources.g3dResource.MultiTexture)) {\r
-            \r
-            MultiTexture mt = new MultiTexture(t);\r
-            StubLinkedList<IEntity> elements = new StubLinkedList<IEntity>(mt.getMultiTextureElementList());\r
-            final Resource listResource = mt.getMultiTextureElementList().getResource();\r
-            final int count = elements.size();\r
-            parent.getDisplay().asyncExec(new Runnable() {\r
-               @Override\r
-               public void run() {\r
-                       while (textureComposites.size() > count) {\r
-                        textureComposites.get(textureComposites.size()-1).dispose();\r
-                        textureComposites.remove(textureComposites.size()-1);\r
-                    }\r
-                    while (textureComposites.size() < count) {\r
-                        textureComposites.add(new TextureComposite(textureParent,SWT.NONE));\r
-                    }\r
-                       getSession().asyncWrite(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g)\r
-                                               throws Exception {\r
-                                       StubLinkedList<IEntity> elements = new StubLinkedList<IEntity>(new Entity(g,listResource));\r
-                                       Iterator<IEntity> i = elements.iterator();\r
-                           int index = 0;\r
-                           while (i.hasNext()) {\r
-                               //MultiTextureElement e = new MultiTextureElement(i.next());\r
-                               //int index = e.getMultiTextureIndexValue();\r
-                               Texture tex = new Texture(i.next());//e.getTexture();\r
-                               if (tex.isInstanceOf(Resources.g3dResource.ImageTexture)) {\r
-                                   ImageTexture t2 = new ImageTexture(tex);\r
-                                   try {\r
-                                       textureComposites.get(index).update(t2);\r
-                                   } catch (Exception err) {\r
-                                       ErrorLogger.defaultLogError(err);\r
-                                   }\r
-                               }\r
-                               index++;\r
-                           }\r
-                                       return null;\r
-                               }\r
-                       });\r
-               }\r
-            });\r
-            \r
-            \r
-            \r
-        }\r
-    }\r
-    \r
-    private void loadShader(Shader s) {\r
-       final boolean hasShader = (s != null);\r
-       final String vertexShader;\r
-       final String fragmentShader;\r
-       if (hasShader) {\r
-               vertexShader = s.getVertexShader()[0];\r
-               fragmentShader = s.getFragmentShader()[0];\r
-       } else {\r
-               vertexShader = null;\r
-               fragmentShader = null;\r
-       }\r
-       parent.getDisplay().asyncExec(new Runnable() {\r
-               @Override\r
-               public void run() {\r
-                       if (!hasShader) {\r
-                   shaderButton.setSelection(false);\r
-               } else {\r
-                   shaderButton.setSelection(true);\r
-                   vertexShaderText.setText(vertexShader);\r
-                   fragmentShaderText.setText(fragmentShader);\r
-               }\r
-                       \r
-               }\r
-       });\r
-        \r
-    }\r
-    \r
-    private void createMaterialGroup(Composite parent) {\r
-        toolkit.paintBordersFor(parent);\r
-        toolkit.setBorderStyle(SWT.BORDER);\r
-        \r
-        materialButton = toolkit.createButton(parent, "Has Material", SWT.CHECK);\r
-        materialButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-               boolean t = materialButton.getSelection();\r
-                   ambientComposite.setEnabled(t);\r
-                   diffuseComposite.setEnabled(t);\r
-                   specularComposite.setEnabled(t);\r
-                   emissiveComposite.setEnabled(t);\r
-                   specularSlider.setEnabled(t);\r
-                   transparencySlider.setEnabled(t);\r
-                \r
-            }\r
-        });\r
-        GridData data = new GridData(GridData.FILL, GridData.FILL, false, false,2,1);\r
-        materialButton.setLayoutData(data);\r
-     \r
-        data = new GridData(GridData.FILL, GridData.FILL, false, false,1,1);\r
-        data.widthHint = 100;\r
-        data.heightHint = 20;\r
-\r
-        toolkit.createLabel(parent, "Ambient");\r
-        ambientComposite = toolkit.createComposite(parent, SWT.BORDER);\r
-        ambientComposite.setLayoutData(data);\r
-        ambientComposite.addMouseListener(new MouseAdapter() {\r
-           @Override\r
-            public void mouseUp(MouseEvent e) {\r
-                ColorDialog dialog = new ColorDialog(AppearanceEditor.this.getBody().getShell());\r
-                RGB rgb = dialog.open();\r
-                if (rgb != null) {\r
-                    ambientComposite.setBackground(new Color(AppearanceEditor.this.getBody().getDisplay(),rgb));\r
-                    \r
-                }\r
-           } \r
-        });\r
-\r
-        toolkit.createLabel(parent, "Diffuse");\r
-        diffuseComposite = toolkit.createComposite(parent, SWT.BORDER);\r
-        diffuseComposite.setLayoutData(data);\r
-        diffuseComposite.addMouseListener(new MouseAdapter() {\r
-            @Override\r
-             public void mouseUp(MouseEvent e) {\r
-                 ColorDialog dialog = new ColorDialog(AppearanceEditor.this.getBody().getShell());\r
-                 RGB rgb = dialog.open();\r
-                 if (rgb != null) {\r
-                     diffuseComposite.setBackground(new Color(AppearanceEditor.this.getBody().getDisplay(),rgb));\r
-                     \r
-                 }\r
-            } \r
-         });\r
-        toolkit.createLabel(parent, "Specular");\r
-        specularComposite = toolkit.createComposite(parent, SWT.BORDER);\r
-        specularComposite.setLayoutData(data);\r
-        specularComposite.addMouseListener(new MouseAdapter() {\r
-            @Override\r
-             public void mouseUp(MouseEvent e) {\r
-                 ColorDialog dialog = new ColorDialog(AppearanceEditor.this.getBody().getShell());\r
-                 \r
-                 RGB rgb = dialog.open();\r
-                 if (rgb != null) {\r
-                     specularComposite.setBackground(new Color(AppearanceEditor.this.getBody().getDisplay(),rgb));\r
-                     \r
-                 }\r
-            } \r
-         });\r
-        toolkit.createLabel(parent, "Emissive");\r
-        emissiveComposite = toolkit.createComposite(parent, SWT.BORDER);\r
-        emissiveComposite.setLayoutData(data);\r
-        emissiveComposite.addMouseListener(new MouseAdapter() {\r
-            @Override\r
-             public void mouseUp(MouseEvent e) {\r
-                 ColorDialog dialog = new ColorDialog(AppearanceEditor.this.getBody().getShell());\r
-                 RGB rgb = dialog.open();\r
-                 if (rgb != null) {\r
-                     emissiveComposite.setBackground(new Color(AppearanceEditor.this.getBody().getDisplay(),rgb));\r
-                     \r
-                 }\r
-            } \r
-         });\r
-        toolkit.createLabel(parent, "Shininess");\r
-        specularSlider = new Slider(parent,SWT.NONE);\r
-        specularSlider.setValues(20, 0, 255, 1, 1, 10);\r
-        toolkit.adapt(specularSlider, true, true);\r
-        toolkit.createLabel(parent, "Transparency");\r
-        transparencySlider = new Slider(parent,SWT.NONE);\r
-        transparencySlider.setValues(0, 0, 100, 1, 1, 10);\r
-        toolkit.adapt(transparencySlider, true, true);\r
-        apply2Button = toolkit.createButton(parent, "Apply", SWT.PUSH);\r
-        apply2Button.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                convertMaterial();\r
-            }\r
-        });\r
-        \r
-    }\r
-    \r
-    private void createTextureGroup(Composite parent) {\r
-        textureParent = parent;\r
-        toolkit.paintBordersFor(parent);\r
-        toolkit.setBorderStyle(SWT.BORDER);\r
-        \r
-        textureButton = toolkit.createButton(parent, "Has Texture", SWT.CHECK);\r
-        textureButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                //loadImageButton.setEnabled(textureButton.getSelection());\r
-                //imageComposite.setEnabled(textureButton.getSelection());\r
-                //textureButton.setEnabled(textureButton.getSelection());\r
-                \r
-            }\r
-        });\r
-        \r
-        \r
-        \r
-        textureButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                //loadImageButton.setEnabled(textureButton.getSelection());\r
-                //imageComposite.setEnabled(textureButton.getSelection());\r
-                //textureButton.setEnabled(textureButton.getSelection());\r
-                \r
-            }\r
-        });\r
-        addTextureButton = toolkit.createButton(parent, "Add Texture", SWT.PUSH);\r
-        addTextureButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                textureComposites.add(new TextureComposite(textureParent,SWT.NONE));\r
-            }\r
-        });\r
-        applyButton = toolkit.createButton(parent, "Apply", SWT.PUSH);\r
-        applyButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                convertImage();\r
-            }\r
-        });\r
-        \r
-    }\r
-    \r
-    private void createShaderGroup(Composite parent) {\r
-        toolkit.paintBordersFor(parent);\r
-        toolkit.setBorderStyle(SWT.BORDER);\r
-        GridData data = new GridData(SWT.FILL,SWT.FILL,true,true,2,1);\r
-        shaderButton = toolkit.createButton(parent, "Has Shader", SWT.CHECK);\r
-        shaderButton.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-               \r
-                \r
-            }\r
-        });\r
-        shaderButton.setLayoutData(data);\r
-        data = new GridData(SWT.FILL,SWT.FILL,true,true,1,1);\r
-        data.widthHint = 400;\r
-        data.heightHint = 200;\r
-        toolkit.createLabel(parent, "Vertex Shader");\r
-        vertexShaderText = toolkit.createText(parent,"", SWT.MULTI);\r
-        vertexShaderText.setLayoutData(data);\r
-        toolkit.createLabel(parent, "Fragment Shader");\r
-        fragmentShaderText = toolkit.createText(parent,"", SWT.MULTI);\r
-        fragmentShaderText.setLayoutData(data);\r
-        apply3Button = toolkit.createButton(parent, "Apply", SWT.PUSH);\r
-        apply3Button.addSelectionListener(new SelectionAdapter() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-                convertShader();\r
-            }\r
-        });\r
-    }\r
-    \r
-    \r
-    \r
-    private void convertShader() {\r
-        updating = true;\r
-        final boolean hasShader = shaderButton.getSelection();\r
-        final String vertexShader = vertexShaderText.getText();\r
-        final String fragmentShader = fragmentShaderText.getText();\r
-        getSession().asyncWrite(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       Appearance appearance = new Appearance(g,appearanceResource);\r
-                       if (hasShader) {\r
-                    Shader s = appearance.getShader();\r
-                    if (s == null) {\r
-                        s = Shader.createDefault(g);\r
-                        appearance.setShader(s);\r
-\r
-                    }\r
-                    s.setVertexShader(vertexShader);\r
-                    s.setFragmentShader(fragmentShader);\r
-                } else {\r
-                    appearance.setShader(null);\r
-                }\r
-                       \r
-                       updating = false;\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-        });\r
-        \r
-        \r
-    }\r
-    \r
-    private void convertMaterial() {\r
-        updating = true;\r
-        \r
-        final boolean hasMaterial = materialButton.getSelection();\r
-        final Color ambientColor = ambientComposite.getBackground();\r
-        final Color diffuseColor = diffuseComposite.getBackground();\r
-        final Color specularColor = specularComposite.getBackground();\r
-        final Color emissiveColor = emissiveComposite.getBackground();\r
-        final double shininess = (double)specularSlider.getSelection();\r
-        final double transparency = (double)transparencySlider.getSelection()/ 100.0;\r
-        \r
-        getSession().asyncWrite(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       Appearance appearance = new Appearance(g,appearanceResource);\r
-                       if (hasMaterial) {\r
-                    Material m = appearance.getMaterial();\r
-                    if (m == null) {\r
-                        m = Material.createDefault(g);\r
-                    }\r
-                    org.simantics.proconf.g3d.stubs.Color aColor = m.getAmbientColor();\r
-                    org.simantics.proconf.g3d.stubs.Color dColor = m.getDiffuseColor();\r
-                    org.simantics.proconf.g3d.stubs.Color sColor = m.getSpecularColor();\r
-                    org.simantics.proconf.g3d.stubs.Color eColor = m.getEmissiveColor();\r
-                    AppearanceTools.setColor(aColor,ambientColor);\r
-                    AppearanceTools.setColor(dColor,diffuseColor);\r
-                    AppearanceTools.setColor(sColor, specularColor);\r
-                    AppearanceTools.setColor(eColor, emissiveColor);\r
-                    m.setShininess(shininess);\r
-                    m.setTransparency(transparency);\r
-                    appearance.setMaterial(m);\r
-                } else {\r
-                       appearance.removeRelatedStatements(Resources.g3dResource.HasMaterial);\r
-                }\r
-                       \r
-                       updating = false;\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-        });\r
-        \r
-    }\r
-    \r
-    private void convertImage() {\r
-        updating = true;\r
-        getSession().syncWrite(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       Appearance appearance = new Appearance(g,appearanceResource);\r
-                       Texture t = appearance.getTexture();\r
-                if (textureComposites.size() == 1) {\r
-                    ImageTexture t2 = null;\r
-                    if (t != null && t.isInstanceOf(Resources.g3dResource.ImageTexture)) {\r
-                        t2 = new ImageTexture(t);\r
-                    } else {\r
-                        t2 = ImageTexture.createDefault(g);\r
-                        appearance.setTexture(t2);\r
-                    }\r
-                    final Resource mode = textureComposites.get(0).getModeType();\r
-                               \r
-\r
-                    if (mode != null)\r
-                        t2.setTextureMode(mode);\r
-                    textureComposites.get(0).getTexture(t2);\r
-                    \r
-                } else if (textureComposites.size() > 1) {\r
-                    MultiTexture mt = null;\r
-                    if (t != null\r
-                            && t.isInstanceOf(Resources.g3dResource.MultiTexture)) {\r
-                        mt = new MultiTexture(t);\r
-                    } else {\r
-                        mt = MultiTexture.createDefault(g);\r
-                        appearance.setTexture(mt);\r
-                    }\r
-                    StubLinkedList<IEntity> elements = new StubLinkedList<IEntity>(mt.getMultiTextureElementList());\r
-                    //PropertyTypeSet<MultiTextureElement> elements = mt.getMultiTextureElementSet();\r
-                    Iterator<IEntity> it = elements.iterator();\r
-                    for (int i = 0; i < textureComposites.size(); i++) {\r
-                        TextureComposite tc = textureComposites.get(i);\r
-                        \r
-                        ImageTexture tex = null;\r
-                        if (it.hasNext())\r
-                               tex = new ImageTexture(it.next());\r
-                        else {\r
-                               tex = ImageTexture.createDefault(g);\r
-                               elements.add(i,tex);\r
-                        }\r
-                        Resource mode = tc.getModeType();\r
-                        if (mode == null)\r
-                            tex.setTextureMode(Resources.g3dResource.CombineMode_modulate);\r
-                        else\r
-                            tex.setTextureMode(mode);\r
-                        \r
-                        textureComposites.get(i).getTexture(tex);\r
-                        \r
-                    }\r
-                } else {\r
-                    appearance.setTexture(null);\r
-                }\r
-          \r
-                updating = false;\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-        });\r
-     \r
-            \r
-           \r
-        \r
-    }\r
-\r
-    private class TextureComposite extends Composite {\r
-        private Button textureGeneratorButton;\r
-        private Button sphereMapButton;\r
-        private Button eyeLinearButton;\r
-        private Button objectLinearButton;\r
-        private Button normalMapButton;\r
-        private Button reflectionMapButton;\r
-        \r
-        private Button modulateButton;\r
-        private Button replaceButton;\r
-        private Button decalButton;\r
-        private Button blendButton;\r
-        \r
-        \r
-        \r
-        private Button loadImageButton;\r
-        private ImageComposite imageComposite;\r
-        private Button removeButton;\r
-        \r
-        \r
-        public TextureComposite(Composite parent, int style) {\r
-            super(parent,style);\r
-            GridLayout layout = new GridLayout(2,false);\r
-            this.setLayout(layout);\r
-            \r
-            loadImageButton = toolkit.createButton(this, "Load Texture", SWT.PUSH);\r
-            loadImageButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-\r
-                       IImage[] images = ImageUtils.loadImagesDialog(getSite().getShell(), false, ImageUtils.getImageFactories());\r
-                       if (images == null)\r
-                               return;\r
-                       IImage image = images[0];\r
-                       setImage(image);\r
-\r
-                }\r
-            });\r
-            GridData data = new GridData(SWT.LEFT,SWT.FILL,false,false,2,1);\r
-            \r
-            loadImageButton.setLayoutData(data);\r
-            data = new GridData(SWT.FILL,SWT.FILL,true,true,2,1);\r
-            imageComposite = new ImageComposite(this,SWT.BORDER);\r
-            imageComposite.setLayoutData(data);\r
-            \r
-            Composite texGenComposite = toolkit.createComposite(this, SWT.BORDER);\r
-            layout = new GridLayout(1,false);\r
-            texGenComposite.setLayout(layout);\r
-            data = new GridData(SWT.FILL,SWT.FILL,true,true,1,1);\r
-            data.heightHint = 140;\r
-            texGenComposite.setLayoutData(data);\r
-            textureGeneratorButton = toolkit.createButton(texGenComposite, "Has Texture Coordinate Generator", SWT.CHECK);\r
-            textureGeneratorButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                    sphereMapButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    eyeLinearButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    objectLinearButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    normalMapButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    reflectionMapButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    \r
-                }\r
-            });\r
-            \r
-            sphereMapButton = toolkit.createButton(texGenComposite, "Shpere Map", SWT.RADIO);\r
-            sphereMapButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                    if (!sphereMapButton.getSelection()) {\r
-                        sphereMapButton.setSelection(true);\r
-                    } else {\r
-                        eyeLinearButton.setSelection(false);\r
-                        objectLinearButton.setSelection(false);\r
-                        normalMapButton.setSelection(false);\r
-                        reflectionMapButton.setSelection(false);\r
-                    }\r
-                }\r
-            });\r
-            eyeLinearButton = toolkit.createButton(texGenComposite, "Eye Linear", SWT.RADIO);\r
-            eyeLinearButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                    if (!eyeLinearButton.getSelection()) {\r
-                        eyeLinearButton.setSelection(true);\r
-                    } else {\r
-                        sphereMapButton.setSelection(false);\r
-                        objectLinearButton.setSelection(false);\r
-                        normalMapButton.setSelection(false);\r
-                        reflectionMapButton.setSelection(false);\r
-                    }\r
-                }\r
-            });\r
-            objectLinearButton = toolkit.createButton(texGenComposite, "Object Linear", SWT.RADIO);\r
-            objectLinearButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                    if (!objectLinearButton.getSelection()) {\r
-                        objectLinearButton.setSelection(true);\r
-                    } else {\r
-                        eyeLinearButton.setSelection(false);\r
-                        sphereMapButton.setSelection(false);\r
-                        normalMapButton.setSelection(false);\r
-                        reflectionMapButton.setSelection(false);\r
-                    }\r
-                }\r
-            });\r
-            normalMapButton = toolkit.createButton(texGenComposite, "Normal Map", SWT.RADIO);\r
-            normalMapButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                    if (!normalMapButton.getSelection()) {\r
-                        normalMapButton.setSelection(true);\r
-                    } else {\r
-                        eyeLinearButton.setSelection(false);\r
-                        objectLinearButton.setSelection(false);\r
-                        sphereMapButton.setSelection(false);\r
-                        reflectionMapButton.setSelection(false);\r
-                    }\r
-                }\r
-            });\r
-            reflectionMapButton = toolkit.createButton(texGenComposite, "Reflection Map", SWT.RADIO);\r
-            reflectionMapButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                    if (!reflectionMapButton.getSelection()) {\r
-                        reflectionMapButton.setSelection(true);\r
-                    } else {\r
-                        eyeLinearButton.setSelection(false);\r
-                        objectLinearButton.setSelection(false);\r
-                        normalMapButton.setSelection(false);\r
-                        sphereMapButton.setSelection(false);\r
-                    }\r
-                }\r
-            });\r
-            \r
-            Composite texModeComposite = toolkit.createComposite(this, SWT.BORDER);\r
-            texModeComposite.setLayout(layout);\r
-            texModeComposite.setLayoutData(data);\r
-            modulateButton = toolkit.createButton(texModeComposite, "Modulate", SWT.RADIO);\r
-            modulateButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                        modulateButton.setSelection(true);\r
-                        replaceButton.setSelection(false);\r
-                        blendButton.setSelection(false);\r
-                        decalButton.setSelection(false);\r
-\r
-                }\r
-            });\r
-            blendButton = toolkit.createButton(texModeComposite, "Blend", SWT.RADIO);\r
-            blendButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                        modulateButton.setSelection(false);\r
-                        replaceButton.setSelection(false);\r
-                        blendButton.setSelection(true);\r
-                        decalButton.setSelection(false);\r
-\r
-                }\r
-            });\r
-            replaceButton = toolkit.createButton(texModeComposite, "Replace", SWT.RADIO);\r
-            replaceButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                        modulateButton.setSelection(false);\r
-                        replaceButton.setSelection(true);\r
-                        blendButton.setSelection(false);\r
-                        decalButton.setSelection(false);\r
-\r
-                }\r
-            });\r
-            decalButton = toolkit.createButton(texModeComposite, "Decal", SWT.RADIO);\r
-            decalButton.addSelectionListener(new SelectionAdapter() {\r
-                public void widgetSelected(SelectionEvent e) {\r
-                        modulateButton.setSelection(false);\r
-                        replaceButton.setSelection(false);\r
-                        blendButton.setSelection(false);\r
-                        decalButton.setSelection(true);\r
-\r
-                }\r
-            });\r
-            \r
-            removeButton = toolkit.createButton(this, "Remove texture", SWT.PUSH);\r
-            parent.getParent().getParent().layout(true, true);\r
-        }\r
-        \r
-        public void setImage(IImage image) {\r
-            imageComposite.setImage(image);\r
-        }\r
-        \r
-        public IImage getImage() {\r
-            return imageComposite.getImage();\r
-        }\r
-        \r
-        public void update(ImageTexture t2) throws Exception {\r
-               Graph graph = t2.getGraph();\r
-            org.simantics.image.stubs.Image i = t2.getImage();\r
-            IImageFactory f = ImageUtils.getImageFactoryForResource(graph,i.getResource());\r
-            final IImage p = f.createImageForResource(graph,i.getResource());\r
-//            PixelDimension pd = p.getDimensions().getPixelDimension();\r
-//            if (pd==null) pd = AppearanceTools.DEFAULT_SIZE;\r
-//             final ImageData id = p.rasterize(pd.getWidth(), pd.getHeight());\r
-            \r
-            parent.getDisplay().asyncExec(new Runnable() {\r
-               @Override\r
-               public void run() {\r
-                       //Image im = new Image(AppearanceEditor.this.getBody().getDisplay(),id);\r
-                       //imageComposite.setImage(im);\r
-                    //showImage();\r
-                       setImage(p);\r
-\r
-               }\r
-            });\r
-            \r
-            TextureCoordinateGenerator gen = t2.getTextureCoordinateGenerator();\r
-            final boolean tg;\r
-            final boolean sm;\r
-            final boolean el;\r
-            final boolean ol;\r
-            final boolean nm;\r
-            final boolean rm;\r
-            if (gen == null) {\r
-               tg = false;\r
-               sm = false;\r
-               el = false;\r
-               ol = false;\r
-               nm = false;\r
-               rm = false;\r
-            } else {\r
-                //type = gen.getTextureCoordinateGeneratorTypeValue();\r
-                //textureGeneratorButton.setSelection(true);\r
-                tg = true;\r
-                if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_sphere)) {\r
-                       sm = true;\r
-                       el = false;\r
-                       ol = false;\r
-                       nm = false;\r
-                       rm = false;\r
-                } else if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_eyelinear)) {\r
-                       sm = false;\r
-                       el = true;\r
-                       ol = false;\r
-                       nm = false;\r
-                       rm = false;\r
-                } else if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_objectlinear)) {\r
-                       sm = false;\r
-                       el = false;\r
-                       ol = true;\r
-                       nm = false;\r
-                       rm = false;\r
-                } else if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_normal)) {\r
-                       sm = false;\r
-                       el = false;\r
-                       ol = false;\r
-                       nm = true;\r
-                       rm = false;\r
-                } else if (gen.equals(Resources.g3dResource.TextureCoordinateGenerator_reflection)) {\r
-                       sm = false;\r
-                       el = false;\r
-                       ol = false;\r
-                       nm = false;\r
-                       rm = true;\r
-                } else {\r
-                       sm = false;\r
-                       el = false;\r
-                       ol = false;\r
-                       nm = false;\r
-                       rm = false;\r
-                }\r
-                \r
-            }\r
-            \r
-            parent.getDisplay().asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               textureGeneratorButton.setSelection(tg);\r
-                               sphereMapButton.setSelection(sm);\r
-                               eyeLinearButton.setSelection(el);\r
-                               objectLinearButton.setSelection(ol);\r
-                               normalMapButton.setSelection(nm);\r
-                               reflectionMapButton.setSelection(rm);\r
-                               sphereMapButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    eyeLinearButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    objectLinearButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    normalMapButton.setEnabled(textureGeneratorButton.getSelection());\r
-                    reflectionMapButton.setEnabled(textureGeneratorButton.getSelection());\r
-                               \r
-                       }\r
-               });\r
-        }\r
-        \r
-        \r
-        public Resource getGenType() {\r
-            if (sphereMapButton.getSelection())\r
-                return Resources.g3dResource.TextureCoordinateGenerator_sphere;\r
-            else if (eyeLinearButton.getSelection())\r
-               return Resources.g3dResource.TextureCoordinateGenerator_eyelinear;\r
-            else if (objectLinearButton.getSelection())\r
-               return Resources.g3dResource.TextureCoordinateGenerator_objectlinear;\r
-            else if (normalMapButton.getSelection())\r
-               return Resources.g3dResource.TextureCoordinateGenerator_normal;\r
-            else if (reflectionMapButton.getSelection())\r
-               return Resources.g3dResource.TextureCoordinateGenerator_reflection;\r
-            return null;\r
-        }\r
-        \r
-        public Resource getModeType() {\r
-            if (modulateButton.getSelection())\r
-                return Resources.g3dResource.MultiTextureMode_modulate;\r
-            else if (replaceButton.getSelection())\r
-               return Resources.g3dResource.MultiTextureMode_replace;\r
-            else if (blendButton.getSelection())\r
-               return Resources.g3dResource.MultiTextureMode_blend;\r
-            else if (decalButton.getSelection())\r
-               return Resources.g3dResource.MultiTextureMode_decal;\r
-\r
-            return null;\r
-        }\r
-        \r
-        public void getTexture(ImageTexture t2) throws Exception{\r
-               Graph g = t2.getGraph();\r
-               IImage image = getImage();\r
-               if (image != null) {\r
-                       Resource res = image.instantiateAsResource(g);\r
-                       t2.setImage(res);\r
-               }\r
-               final Resource t2res = t2.getResource();\r
-\r
-                       if (textureGeneratorButton.getSelection()) {\r
-                               final Resource type;\r
-                               if (sphereMapButton.getSelection())\r
-                                       type = Resources.g3dResource.TextureCoordinateGenerator_sphere;\r
-                               else if (eyeLinearButton.getSelection())\r
-                                       type = Resources.g3dResource.TextureCoordinateGenerator_eyelinear;\r
-                               else if (objectLinearButton.getSelection())\r
-                                       type = Resources.g3dResource.TextureCoordinateGenerator_objectlinear;\r
-                               else if (normalMapButton.getSelection())\r
-                                       type = Resources.g3dResource.TextureCoordinateGenerator_normal;\r
-                               else if (reflectionMapButton.getSelection())\r
-                                       type = Resources.g3dResource.TextureCoordinateGenerator_reflection;\r
-                               else\r
-                                       type = null;\r
-                               if (type != null) {\r
-                                       getSession().asyncWrite(new GraphRequestAdapter() {\r
-                                               @Override\r
-                                               public GraphRequestStatus perform(Graph g)\r
-                                                               throws Exception {\r
-                                                       ImageTexture t2 = new ImageTexture(g, t2res);\r
-                                                       t2.setTextureCoordinateGenerator(type);\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               }\r
-                                       });\r
-\r
-                               }\r
-\r
-                       }\r
-        }\r
-        \r
-        /*\r
-                * public void getTexture(ImageTexture t2) { if\r
-                * (imageComposite.getImage() != null) { ImageData data =\r
-                * imageComposite.getImage().getImageData(); if (!data.palette.isDirect) {\r
-                * throw new RuntimeException("Not direct"); } int bytes = 0; String\r
-                * type = ""; if (data.depth != 32 && data.depth != 24) { throw new\r
-                * UnsupportedOperationException("Cannot handle bitdepth " +\r
-                * data.depth); } if (data.depth == 32) { bytes = 4; type = "RGBA"; }\r
-                * else if (data.depth == 24) { bytes = 3; type = "RGB"; } String size =\r
-                * data.width + " " + data.height; byte texturedata[] = new\r
-                * byte[data.width * data.height * bytes]; for (int y = 0; y <\r
-                * data.height; y++) { for (int x = 0; x < data.width; x++) { int index =\r
-                * (y * data.width + x) * bytes;\r
-                * \r
-                * texturedata[index] = data.data[index]; texturedata[index + 1] =\r
-                * data.data[index + 1]; texturedata[index + 2] = data.data[index + 2];\r
-                * if (bytes == 4) texturedata[index + 3] = data.data[index + 3];\r
-                *  } } String base64 = new\r
-                * sun.misc.BASE64Encoder().encode(texturedata); // if\r
-                * (coreTC.getCurrentTransaction() == null)\r
-                * \r
-                * \r
-                * \r
-                * fi.vtt.proconf.threedimensionalmodeling.stub.v1_0.Image i =\r
-                * t2.getImage(); if (i == null) { i = ImageFactory.instantiate(graph);\r
-                * graph.commitChanges(this); t2.setImage(i); }\r
-                * i.setImageDataValue(base64); i.setImageTypeValue(type);\r
-                * i.setImageSizeValue(size); graph.commitChanges(this); if\r
-                * (textureGeneratorButton.getSelection()) { type = null; if\r
-                * (sphereMapButton.getSelection()) type =\r
-                * AppearanceTools.TEXTURE_COORD_GEN_SPHERE; else if\r
-                * (eyeLinearButton.getSelection()) type =\r
-                * AppearanceTools.TEXTURE_COORD_GEN_EYE_LINEAR; else if\r
-                * (objectLinearButton.getSelection()) type =\r
-                * AppearanceTools.TEXTURE_COORD_GEN_OBJECT_LINEAR; else if\r
-                * (normalMapButton.getSelection()) type =\r
-                * AppearanceTools.TEXTURE_COORD_GEN_NORMAL; else if\r
-                * (reflectionMapButton.getSelection()) type =\r
-                * AppearanceTools.TEXTURE_COORD_GEN_REFLECTION; else type = null; if\r
-                * (type != null) { TextureCoordinateGenerator gen =\r
-                * t2.getTextureCoordinateGenerator(); if (gen == null) { gen =\r
-                * TextureCoordinateGeneratorFactory.instantiate(graph);\r
-                * graph.commitChanges(this); t2.setTextureCoordinateGenerator(gen); }\r
-                * gen.setTextureCoordinateGeneratorTypeValue(type);\r
-                * graph.commitChanges(this); }\r
-                *  } else { //t2.setTextureCoordinateGenerator(null);\r
-                * graph.commitChanges(this); }\r
-                *  } }\r
-                */\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/ScenegraphViewPart.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/ScenegraphViewPart.java
deleted file mode 100644 (file)
index ee3f127..0000000
+++ /dev/null
@@ -1,610 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.views;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.jface.viewers.ITreeContentProvider;\r
-import org.eclipse.jface.viewers.LabelProvider;\r
-import org.eclipse.jface.viewers.TreeViewer;\r
-import org.eclipse.jface.viewers.Viewer;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.IActionBars;\r
-import org.eclipse.ui.IPartListener;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.eclipse.ui.IWorkbenchWindow;\r
-import org.eclipse.ui.PlatformUI;\r
-import org.eclipse.ui.part.ViewPart;\r
-import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;\r
-import org.eclipse.ui.views.properties.IPropertyDescriptor;\r
-import org.eclipse.ui.views.properties.IPropertySource;\r
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;\r
-import org.simantics.proconf.g3d.Activator;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorPart;\r
-import org.simantics.proconf.g3d.scenegraph.IGeometryNode;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.ISelectableNode;\r
-import org.simantics.utils.ui.gfx.ImageCache;\r
-\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.SceneElement;\r
-import com.jme.scene.Spatial;\r
-import com.jme.scene.batch.GeomBatch;\r
-\r
-public class ScenegraphViewPart extends ViewPart{\r
-       \r
-       private static final ImageDescriptor GEOMETRY_IMAGE = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/geometry.png");\r
-       private static final ImageDescriptor BATCH_IMAGE = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/batch.png");\r
-       private static final ImageDescriptor NODE_IMAGE = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/node.png");\r
-               \r
-       \r
-       TreeViewer viewer;\r
-       \r
-       IPartListener listener;\r
-       \r
-       Action showJMEAction;\r
-       \r
-       @Override\r
-       public void createPartControl(Composite parent) {\r
-\r
-               viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL| SWT.V_SCROLL);\r
-               viewer.setContentProvider(new GNScenegraphContentProvider());\r
-               viewer.setLabelProvider(new GNScenegraphLabelProvider());\r
-               getSite().setSelectionProvider(viewer);\r
-               \r
-               makeActions();\r
-               \r
-               IActionBars actionBar = getViewSite().getActionBars();\r
-               contributeToActionBars(actionBar);\r
-               \r
-               listener = new IPartListener() {\r
-                       @Override\r
-                       public void partActivated(IWorkbenchPart part) {\r
-                               if (part instanceof ThreeDimensionalEditorPart) {\r
-                                       ThreeDimensionalEditorPart p = (ThreeDimensionalEditorPart)part;\r
-                                       Object newInput = p.getEditor();\r
-                                       if (viewer.getInput() != newInput)\r
-                                               viewer.setInput(newInput);\r
-                               } else {\r
-                                       //viewer.setInput(null);\r
-                               }\r
-                               \r
-                       }\r
-                       \r
-                       @Override\r
-                       public void partBroughtToTop(IWorkbenchPart part) {\r
-\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void partClosed(IWorkbenchPart part) {\r
-\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void partDeactivated(IWorkbenchPart part) {\r
-\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void partOpened(IWorkbenchPart part) {\r
-\r
-                       }\r
-               };\r
-               for (IWorkbenchWindow w : PlatformUI.getWorkbench().getWorkbenchWindows()) {\r
-                       w.getPartService().addPartListener(listener);\r
-                               \r
-               }\r
-               \r
-       }\r
-       \r
-       protected void makeActions() {\r
-               showJMEAction = new Action("jME",Action.AS_CHECK_BOX) {\r
-                       @Override\r
-                       public void run() {\r
-                               Object input = viewer.getInput();\r
-                               viewer.setInput(null);\r
-                               if (this.isChecked()) {\r
-                                       viewer.setContentProvider(new JMEScenegraphContentProvider());\r
-                                       viewer.setLabelProvider(new JMEScenegraphLabelProvider());\r
-                               } else {\r
-                                       viewer.setContentProvider(new GNScenegraphContentProvider());\r
-                                       viewer.setLabelProvider(new GNScenegraphLabelProvider());\r
-                               }\r
-                               viewer.setInput(input);\r
-                       }\r
-               };\r
-       }\r
-       \r
-       protected void contributeToActionBars(IActionBars bars) {\r
-               fillLocalToolBar(bars.getToolBarManager());\r
-               fillLocalPullDown(bars.getMenuManager());\r
-               bars.updateActionBars();\r
-       }\r
-\r
-       protected void fillLocalToolBar(IToolBarManager manager) {\r
-               manager.add(showJMEAction);\r
-       }\r
-\r
-       protected void fillLocalPullDown(IMenuManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void setFocus() {\r
-               viewer.getControl().setFocus();\r
-       }\r
-       \r
-       public void dispose() {\r
-               for (IWorkbenchWindow w : PlatformUI.getWorkbench().getWorkbenchWindows()) {\r
-                       w.getPartService().removePartListener(listener);\r
-                               \r
-               }\r
-               super.dispose();\r
-       }\r
-       \r
-\r
-       private class JMEScenegraphContentProvider implements ITreeContentProvider {\r
-               @Override\r
-               public Object[] getChildren(Object parentElement) {\r
-                       if (parentElement instanceof JMEAdaptable)\r
-                               parentElement = ((JMEAdaptable)parentElement).getElement();\r
-                       \r
-                       if (parentElement instanceof Node) {\r
-                               Node n = (Node)parentElement;\r
-                               Object o[] = new Object[n.getChildren().size()];\r
-                               for (int i = 0; i < n.getChildren().size(); i++) {\r
-                                       o[i] = new JMEAdaptable(n.getChild(i));\r
-                               }\r
-                               return o;\r
-                       }\r
-                       if (parentElement instanceof Geometry) {\r
-                               Geometry g = (Geometry)parentElement;\r
-                               Object o[] = new Object[g.getBatchCount()];\r
-                               for (int i = 0 ; i < g.getBatchCount(); i++)\r
-                                       o[i] = new JMEAdaptable(g.getBatch(i));\r
-                               return o;\r
-                       }\r
-                       return null;\r
-               }\r
-               \r
-               @Override\r
-               public Object[] getElements(Object inputElement) {\r
-                       if (inputElement instanceof ThreeDimensionalEditorBase) {\r
-                               SceneElement root = ((ThreeDimensionalEditorBase)inputElement).getRenderingComponent().getRoot();\r
-                               if (root != null)\r
-                                       return new Object[]{new JMEAdaptable(root)};\r
-                       }\r
-                       return new Object[0];\r
-               }\r
-               \r
-               @Override\r
-               public Object getParent(Object element) {\r
-                       SceneElement e;\r
-                       if (element instanceof JMEAdaptable)\r
-                               e = ((JMEAdaptable)element).getElement();\r
-                       else\r
-                               e = (SceneElement)element;\r
-                       if (e instanceof Spatial) {\r
-                               Spatial s = (Spatial)e;\r
-                               return s.getParent();\r
-                       } \r
-                       if (e instanceof GeomBatch) {\r
-                               GeomBatch g = (GeomBatch)e;\r
-                               return g.getParentGeom();\r
-                       }\r
-                       return null;\r
-               }\r
-               \r
-               @Override\r
-               public boolean hasChildren(Object element) {\r
-                       if (element instanceof JMEAdaptable)\r
-                               element = ((JMEAdaptable)element).getElement();\r
-                       if (element instanceof Node) {\r
-                               Node n = (Node)element;\r
-                               if (n.getChildren() == null)\r
-                                       return false;\r
-                               return n.getChildren().size() > 0;\r
-                       }\r
-                       if (element instanceof Geometry) {\r
-                               Geometry g = (Geometry)element;\r
-                               return g.getBatchCount() > 0;\r
-                       }\r
-                       return false;\r
-               }\r
-               \r
-               @Override\r
-               public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {\r
-                       \r
-               }\r
-               \r
-               @Override\r
-               public void dispose() {\r
-                       \r
-               }\r
-       }\r
-       \r
-       private class JMEScenegraphLabelProvider extends LabelProvider {\r
-               @Override\r
-               public String getText(Object element) {\r
-                       if (element == null)\r
-                               return null;\r
-                       if (element instanceof JMEAdaptable)\r
-                               element = ((JMEAdaptable)element).getElement();\r
-                       SceneElement e = (SceneElement)element;\r
-                       return e.getName() + " : " + e.getClass();\r
-               }\r
-               \r
-               @Override\r
-               public Image getImage(Object element) {\r
-                       if (element == null)\r
-                               return null;\r
-                       if (element instanceof JMEAdaptable)\r
-                               element = ((JMEAdaptable)element).getElement();\r
-                       ImageDescriptor desc = null;\r
-                       if (element instanceof GeomBatch)\r
-                               desc = BATCH_IMAGE;\r
-                       else if (element instanceof Geometry)\r
-                               desc = GEOMETRY_IMAGE;\r
-                       else if (element instanceof Node)\r
-                               desc = NODE_IMAGE;\r
-                       else \r
-                               return null;\r
-                       return ImageCache.getInstance().getImage(desc);\r
-               }\r
-       }\r
-       \r
-       private class GNScenegraphContentProvider implements ITreeContentProvider {\r
-               @Override\r
-               public Object[] getChildren(Object parentElement) {\r
-                       if (parentElement instanceof GNAdaptable)\r
-                               parentElement = ((GNAdaptable)parentElement).getNode();\r
-                       IGraphicsNode node = (IGraphicsNode)parentElement;\r
-                       Object children[] = new Object[node.getChildren().size()];\r
-                       Iterator<IGraphicsNode> it = node.getChildren().iterator();\r
-                       for (int i = 0; i < node.getChildren().size(); i++) {\r
-                               children[i] = new GNAdaptable(it.next());\r
-                       }\r
-                       return children;\r
-               }\r
-               \r
-               @Override\r
-               public Object[] getElements(Object inputElement) {\r
-                       if (inputElement instanceof ThreeDimensionalEditorBase) {\r
-                               IGraphicsNode root = ((ThreeDimensionalEditorBase)inputElement).getScenegraphAdapter().getRootNode();\r
-                               if (root != null)\r
-                                       return new Object[]{new GNAdaptable(root)};\r
-                       }\r
-                       return new Object[0];\r
-               }\r
-               \r
-               @Override\r
-               public Object getParent(Object element) {\r
-                       if (element instanceof GNAdaptable)\r
-                               element = ((GNAdaptable)element).getNode();\r
-                       IGraphicsNode node = (IGraphicsNode)element;\r
-                       return node.getParent();\r
-               }\r
-               \r
-               @Override\r
-               public boolean hasChildren(Object element) {\r
-                       if (element instanceof GNAdaptable)\r
-                               element = ((GNAdaptable)element).getNode();\r
-                       IGraphicsNode node = (IGraphicsNode)element;\r
-                       return node.getChildren().size() > 0;\r
-               }\r
-               \r
-               @Override\r
-               public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {\r
-                       \r
-               }\r
-               \r
-               @Override\r
-               public void dispose() {\r
-                       \r
-               }\r
-       }\r
-       \r
-       private class GNScenegraphLabelProvider extends LabelProvider {\r
-               @Override\r
-               public String getText(Object element) {\r
-                       if (element instanceof GNAdaptable)\r
-                               element = ((GNAdaptable)element).getNode();\r
-                       IGraphicsNode node = (IGraphicsNode)element;\r
-                       return node.getGroup().getName() + " : " + node.getClass();\r
-               }\r
-               \r
-               @Override\r
-               public Image getImage(Object element) {\r
-                       ImageDescriptor desc = NODE_IMAGE;\r
-//                     if (element instanceof GeomBatch)\r
-//                             desc = BATCH_IMAGE;\r
-//                     else if (element instanceof Geometry)\r
-//                             desc = GEOMETRY_IMAGE;\r
-//                     else if (element instanceof Node)\r
-//                             desc = NODE_IMAGE;\r
-//                     else \r
-//                             return null;\r
-                       return ImageCache.getInstance().getImage(desc);\r
-               }\r
-       }\r
-       \r
-       private class JMEAdaptable implements IAdaptable {\r
-               SceneElement element;\r
-                               \r
-               public JMEAdaptable(SceneElement element) {\r
-                       assert (element != null);\r
-                       this.element = element;\r
-               }\r
-               \r
-               @SuppressWarnings("unchecked")\r
-               @Override\r
-               public Object getAdapter(Class adapter) {\r
-               if (adapter == IPropertySource.class) {\r
-                   return new JMEProperties(element);\r
-               }\r
-               return null;\r
-               }\r
-               \r
-               public SceneElement getElement() {\r
-                       return element;\r
-               }\r
-       }\r
-       \r
-       private class GNAdaptable implements IAdaptable {\r
-               IGraphicsNode node;\r
-                               \r
-               public GNAdaptable(IGraphicsNode node) {\r
-                       assert (node != null);\r
-                       this.node = node;\r
-               }\r
-               \r
-               @SuppressWarnings("unchecked")\r
-               @Override\r
-               public Object getAdapter(Class adapter) {\r
-               if (adapter == IPropertySource.class) {\r
-                   return new GNProperties(node);\r
-               }\r
-               return null;\r
-               }\r
-               \r
-               public IGraphicsNode getNode() {\r
-                       return node;\r
-               }\r
-       }\r
-       \r
-       private static final String NAME = "name";\r
-       private static final String CULL_MODE = "cullmode";\r
-       private static final String CULL_MODES[] = {"Inherit","Dynamic","Always","Never"};\r
-       private static final String LIGHT_MODE = "lightmode";\r
-       private static final String LIGHT_MODES[] = {"Off","Combine First","Combine Closest","Combine Recent Enabled","Inherit","Replace"};\r
-       private static final String LOCAL_CULL_MODE = "localcullmode";\r
-       private static final String LOCAL_LIGHT_MODE = "locallightmode";\r
-       private static final String LOCAL_NORMALS_MODE = "localnormalsmode";\r
-       private static final String LOCAL_RENDER_QUEUE_MODE ="localrenderqueuemode";\r
-       private static final String LOCAL_TEXTURE_COMBINE_MODE = "localtexturecombinemode";\r
-       private static final String LOCKS = "locks";\r
-       private static final String NORMALS_MODE = "normalsmode";\r
-       private static final String NORMALS_MODES[] = {"Inherit","Use Provided","Normalize Provided","Normalize if scaled","Off"};\r
-       private static final String RENDER_QUEUE_MODE = "renderqueuemode";\r
-       private static final String RENDER_QUEUE_MODES[] = {"Inherit","Skip","Opaque","Transparent","Ortho"};\r
-       private static final String TEXTURE_COMBINE_MODE = "texturecombinemode";\r
-       private static final String TEXTURE_COMBINE_MODES[] = {"Off","First","Closest","Recent enabled","Inherit","Replace"};\r
-       \r
-       private static final String BOOLEAN_VALUES[] = {"False","True"};\r
-       \r
-       private class JMEProperties implements IPropertySource {        \r
-               \r
-               SceneElement element;\r
-               \r
-               public JMEProperties(SceneElement element) {\r
-                       this.element = element;\r
-               }\r
-               \r
-               @Override\r
-               public Object getEditableValue() {\r
-                       return this;\r
-               }\r
-               \r
-               @Override\r
-               public IPropertyDescriptor[] getPropertyDescriptors() {\r
-                       List<IPropertyDescriptor> desc = new ArrayList<IPropertyDescriptor>();\r
-                       desc.add(new TextPropertyDescriptor(NAME,"Name"));\r
-                       desc.add(new ComboBoxPropertyDescriptor(CULL_MODE,"Cull Mode",CULL_MODES));\r
-                       desc.add(new ComboBoxPropertyDescriptor(LIGHT_MODE,"Light Combine Mode",LIGHT_MODES));\r
-                       desc.add(new ComboBoxPropertyDescriptor(LOCAL_CULL_MODE,"Local Cull Mode",CULL_MODES));\r
-                       desc.add(new ComboBoxPropertyDescriptor(LOCAL_LIGHT_MODE,"Local Light Combine Mode",LIGHT_MODES));\r
-                       desc.add(new ComboBoxPropertyDescriptor(LOCAL_NORMALS_MODE,"Local Normals Mode",NORMALS_MODES));\r
-                       desc.add(new ComboBoxPropertyDescriptor(LOCAL_RENDER_QUEUE_MODE,"Local Render Queue Mode",RENDER_QUEUE_MODES));\r
-                       desc.add(new ComboBoxPropertyDescriptor(LOCAL_TEXTURE_COMBINE_MODE,"Local Texture Combine Mode",TEXTURE_COMBINE_MODES));\r
-                       desc.add(new TextPropertyDescriptor(LOCKS,"Locks"));\r
-                       desc.add(new ComboBoxPropertyDescriptor(NORMALS_MODE,"Normals Mode",NORMALS_MODES));\r
-                       desc.add(new ComboBoxPropertyDescriptor(RENDER_QUEUE_MODE,"Render Queue Mode",RENDER_QUEUE_MODES));\r
-                       desc.add(new ComboBoxPropertyDescriptor(TEXTURE_COMBINE_MODE,"Texture Combine Mode",TEXTURE_COMBINE_MODES));\r
-                       return desc.toArray(new IPropertyDescriptor[desc.size()]);\r
-\r
-               }\r
-               \r
-               @Override\r
-               public Object getPropertyValue(Object id) {\r
-                       if (id == NAME) {\r
-                               return element.getName();\r
-                       } else if (id == CULL_MODE) {\r
-                               return element.getCullMode();\r
-                       } else if (id == LIGHT_MODE) {\r
-                               return element.getLightCombineMode();\r
-                       } else if (id == LOCAL_CULL_MODE) {\r
-                               return element.getLocalCullMode();\r
-                       } else if (id == LOCAL_LIGHT_MODE) {\r
-                               return element.getLocalLightCombineMode();\r
-                       } else if (id == LOCAL_NORMALS_MODE) {\r
-                               return element.getLocalNormalsMode();\r
-                       } else if (id == LOCAL_RENDER_QUEUE_MODE) {\r
-                               return element.getLocalRenderQueueMode();\r
-                       } else if (id == LOCAL_TEXTURE_COMBINE_MODE) {\r
-                               return element.getLocalTextureCombineMode();\r
-                       } else if (id == LOCKS) {\r
-                               return element.getLocks();\r
-                       } else if (id == NORMALS_MODE) {\r
-                               return element.getNormalsMode();\r
-                       } else if (id == RENDER_QUEUE_MODE) {\r
-                               return element.getRenderQueueMode();\r
-                       } else if (id == TEXTURE_COMBINE_MODE) {\r
-                               return element.getTextureCombineMode();\r
-                       }\r
-                       \r
-//                     element.getZOrder();\r
-//                     element.isCollidable();\r
-\r
-                       return null;\r
-               }\r
-               \r
-               @Override\r
-               public boolean isPropertySet(Object id) {\r
-                       return false;\r
-               }\r
-               \r
-               @Override\r
-               public void resetPropertyValue(Object id) {\r
-                       \r
-               }\r
-               \r
-               @Override\r
-               public void setPropertyValue(Object id, Object value) {\r
-                       if (id == NAME) {\r
-                               element.setName((String)value);\r
-                       } else if (id == CULL_MODE) {\r
-                               element.setCullMode((Integer)value);\r
-                       } else if (id == LIGHT_MODE) {\r
-                               element.setLightCombineMode((Integer)value);\r
-                       } else if (id == LOCAL_CULL_MODE) {\r
-                               \r
-                       } else if (id == LOCAL_LIGHT_MODE) {\r
-                               \r
-                       } else if (id == LOCAL_NORMALS_MODE) {\r
-                               \r
-                       } else if (id == LOCAL_RENDER_QUEUE_MODE) {\r
-                               \r
-                       } else if (id == LOCAL_TEXTURE_COMBINE_MODE) {\r
-                               \r
-                       } else if (id == LOCKS) {\r
-                               element.setLocks((Integer)value);\r
-                       } else if (id == NORMALS_MODE) {\r
-                               element.setNormalsMode((Integer)value);\r
-                       } else if (id == RENDER_QUEUE_MODE) {\r
-                               element.setRenderQueueMode((Integer)value);\r
-                       } else if (id == TEXTURE_COMBINE_MODE) {\r
-                               element.setTextureCombineMode((Integer)value);\r
-                       }\r
-                       \r
-               }\r
-\r
-       }\r
-       \r
-       private static final String SELECTED = "selected";\r
-       private static final String HIGHLIGHTED = "highlighted";\r
-       private static final String VISIBLE = "visible";\r
-       \r
-       private class GNProperties implements IPropertySource {\r
-               IGraphicsNode node;\r
-               \r
-               public GNProperties(IGraphicsNode node) {\r
-                       this.node = node;\r
-               }\r
-               \r
-               \r
-               @Override\r
-               public Object getEditableValue() {\r
-                       return this;\r
-               }\r
-               \r
-               @Override\r
-               public IPropertyDescriptor[] getPropertyDescriptors() {\r
-                       List<IPropertyDescriptor> desc = new ArrayList<IPropertyDescriptor>();\r
-                       if (node instanceof ISelectableNode) {\r
-                               //ISelectableNode n = (ISelectableNode)node;\r
-                               \r
-                               desc.add(new ComboBoxPropertyDescriptor(SELECTED,"Selected",BOOLEAN_VALUES));\r
-                               desc.add(new ComboBoxPropertyDescriptor(HIGHLIGHTED,"Highlighted",BOOLEAN_VALUES));\r
-                               desc.add(new ComboBoxPropertyDescriptor(VISIBLE,"Visible",BOOLEAN_VALUES));\r
-                               \r
-                       }\r
-                       return desc.toArray(new IPropertyDescriptor[desc.size()]);\r
-               }\r
-               \r
-               @Override\r
-               public Object getPropertyValue(Object id) {\r
-                       if (node instanceof ISelectableNode) {\r
-                               ISelectableNode n = (ISelectableNode)node;\r
-                               if (id == SELECTED) {\r
-                                       if (n.isSelected())\r
-                                               return 1;\r
-                                       return 0;\r
-                               } else if (id == HIGHLIGHTED) {\r
-                                       if (n.isHighlighted())\r
-                                               return 1;\r
-                                       return 0;\r
-                               } else if (id == VISIBLE) {\r
-                                       if (n.isVisible())\r
-                                               return 1;\r
-                                       return 0;\r
-                               }\r
-                       }\r
-                       if (node instanceof IGeometryNode) {\r
-                               //IGeometryNode n = (IGeometryNode)node;\r
-                       }\r
-\r
-                       return null;\r
-               }\r
-               \r
-               @Override\r
-               public boolean isPropertySet(Object id) {\r
-                       return false;\r
-               }\r
-               \r
-               @Override\r
-               public void resetPropertyValue(Object id) {\r
-\r
-               }\r
-               \r
-               @Override\r
-               public void setPropertyValue(Object id, Object value) {\r
-                       if (node instanceof ISelectableNode) {\r
-                               ISelectableNode n = (ISelectableNode)node;\r
-                               boolean b = ((Integer)value) == 1;\r
-                               if (id == SELECTED) {\r
-                                       n.setSelected(b);\r
-                               } else if (id == HIGHLIGHTED) {\r
-                                       n.setHighlighted(b);\r
-                               } else if (id == VISIBLE) {\r
-                                       n.setVisible(b);\r
-                               }\r
-                       }\r
-                       \r
-               }\r
-\r
-               \r
-       }\r
-       \r
-}\r
-       \r
-\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/SinglePageResourceEditor.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/SinglePageResourceEditor.java
deleted file mode 100644 (file)
index 1caba9d..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.views;\r
-\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.ui.IPartListener;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.eclipse.ui.forms.events.ExpansionAdapter;\r
-import org.eclipse.ui.forms.events.ExpansionEvent;\r
-import org.eclipse.ui.forms.widgets.FormToolkit;\r
-import org.eclipse.ui.forms.widgets.ScrolledForm;\r
-import org.eclipse.ui.forms.widgets.Section;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Session;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.ui.workbench.ResourceEditorPart;\r
-import org.simantics.utils.ErrorLogger;\r
-import org.simantics.utils.ui.ISelectionUtils;\r
-import org.simantics.utils.ui.jface.BaseSelectionProvider;\r
-\r
-\r
-\r
-public abstract class SinglePageResourceEditor extends ResourceEditorPart {\r
-       private ScrolledForm form;\r
-       private BaseSelectionProvider defaultInputSelectionProvider = new BaseSelectionProvider();\r
-       protected FormToolkit toolkit;\r
-       \r
-       @Override\r
-       public void createPartControl(Composite parent) {\r
-               this.getEditorSite().getPage().addPartListener(new IPartListener() {\r
-               \r
-               boolean opened = false;\r
-               boolean activated = false;\r
-               \r
-            public void partOpened(IWorkbenchPart part) {\r
-                if (part.equals(SinglePageResourceEditor.this.getEditorSite().getPart())) {\r
-                    opened = true;\r
-                }\r
-            }\r
-            \r
-            public void partActivated(IWorkbenchPart part) {\r
-               if (part.equals(SinglePageResourceEditor.this.getEditorSite().getPart())) {\r
-                    if (opened & !activated) {\r
-                       activated = true;\r
-                       load();\r
-                    }\r
-               }\r
-            }\r
-            \r
-            public void partBroughtToTop(IWorkbenchPart part) {}\r
-            \r
-            public void partClosed(IWorkbenchPart part) {}\r
-            \r
-            public void partDeactivated(IWorkbenchPart part) {}\r
-            \r
-            private void load() {\r
-               Session ses = SinglePageResourceEditor.this.getSession();\r
-                GraphRequestAdapter r = new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g)\r
-                                       throws Exception {\r
-                                reload(g);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                };\r
-                ses.asyncRead(r);\r
-            }\r
-        });\r
-               try {\r
-                       toolkit = new FormToolkit(parent.getDisplay());\r
-                       form = getToolkit().createScrolledForm(parent);\r
-\r
-                       GridLayout layout = new GridLayout(2, false);\r
-                       form.getBody().setLayout(layout);\r
-                       form.getBody().setLayoutData(\r
-                                       new GridData(GridData.FILL, GridData.FILL, true, true));\r
-\r
-                       // By default make this ViewPart use a default ISelectionProvider\r
-                       // that will offer the viewparts input resource as its selection.\r
-                       // The Resource is wrapped into a ResourceSelection object.\r
-                       // Any widgets created in createWidgets may override the default\r
-                       // selection provider.\r
-                       getEditorSite().setSelectionProvider(defaultInputSelectionProvider);\r
-\r
-                       beforeCreateWidgets();\r
-                       createWidgets();\r
-\r
-                       //reload();\r
-\r
-                       form.setText(getFormText());\r
-\r
-                       // Finally Set the default selection which will have an effect only\r
-                       // if nothing in createWidgets has overridden the default selection\r
-                       // provider.\r
-                       ISelection s = ISelectionUtils\r
-                                       .createSelection(new StructuredResourceSelection(\r
-                                                       getInputResource()));\r
-                       defaultInputSelectionProvider.setSelection(s);\r
-\r
-               } catch (Exception e) {\r
-                       Display d = getSite().getShell().getDisplay();\r
-                       d.asyncExec(new Runnable() {\r
-                               public void run() {\r
-                                       getSite().getPage().closeEditor(\r
-                                                       SinglePageResourceEditor.this, false);\r
-                               }\r
-                       });\r
-\r
-                       ErrorLogger.defaultLogError("Single-page type editor failed to open, see exception for details",e);\r
-               }\r
-       }\r
-\r
-       public ScrolledForm getActiveForm() {\r
-               return form;\r
-       }\r
-\r
-       protected Composite getBody() {\r
-               return form.getBody();\r
-       }\r
-\r
-       public Composite newGridSection(int formColumns, int childColumns,\r
-                       boolean equalWidth, boolean grabVertical, String text,\r
-                       String description) {\r
-               return newGridSection(getBody(), formColumns, childColumns, equalWidth,\r
-                               grabVertical, text, description);\r
-       }\r
-\r
-       public Composite newGridSection(Composite parent, int formColumns,\r
-                       int childColumns, boolean equalWidth, boolean grabVertical,\r
-                       String text, String description) {\r
-               FormToolkit toolkit = getToolkit();\r
-\r
-               Section section = toolkit.createSection(parent, Section.DESCRIPTION\r
-                               | Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED);\r
-               section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,\r
-                               grabVertical, formColumns, 1));\r
-               section.addExpansionListener(new ExpansionAdapter() {\r
-                       public void expansionStateChanged(ExpansionEvent e) {\r
-                               //System.out.println("SinglePageTypeEditor: expansionStateChanged " + e);\r
-                               //reflow(true);\r
-                       }\r
-               });\r
-               section.setText(text);\r
-               section.setDescription(description);\r
-               Composite sectionClient = toolkit.createComposite(section);\r
-               sectionClient.setLayout(new GridLayout(childColumns, equalWidth));\r
-               sectionClient.setLayoutData(new GridData());\r
-               section.setClient(sectionClient);\r
-               return sectionClient;\r
-       }\r
-\r
-       \r
-\r
-       //----------------------------------------------------------------------\r
-       // Getters\r
-\r
-       public FormToolkit getToolkit() {\r
-               return toolkit;\r
-       }\r
-\r
-       //----------------------------------------------------------------------\r
-       // Event utilities\r
-\r
-       public void reflow(boolean flushCache) {\r
-               //System.out.println("FormTypeEditorBase.reflow(" + flushCache + ")");\r
-               getActiveForm().reflow(flushCache);\r
-       }\r
-\r
-       @Override\r
-       public void dispose() {\r
-               if (toolkit != null) {\r
-                       toolkit.dispose();\r
-               }\r
-               super.dispose();\r
-       }\r
-\r
-       @Override\r
-       public void setFocus() {\r
-               //System.out.println("FormTypeEditorBase.setFocus(): Input = " + getInput());\r
-               ScrolledForm form = getActiveForm();\r
-               if (form != null) {\r
-                       form.setFocus();\r
-               }\r
-       }\r
-\r
-       protected abstract String getFormText();\r
-\r
-       /**\r
-        * Returns null by default which makes {@link #updateTitle()} not set the\r
-        * part name programmatically, i.e. the plugin-defined view name will stay.\r
-        * \r
-        * @return\r
-        */\r
-       protected String getTitleText() {\r
-               return null;\r
-       }\r
-\r
-       /**\r
-        * Return null by default which makes {@link #updateTitle()} clear the\r
-        * tooltip.\r
-        * \r
-        * @return\r
-        */\r
-       protected String getTitleTooltip() {\r
-               return null;\r
-       }\r
-\r
-       /**\r
-        * A method for performing initializations just before UI initialization.\r
-        */\r
-       protected void beforeCreateWidgets() {\r
-       }\r
-\r
-       /**\r
-        * A method for initializing the UI of the view.\r
-        */\r
-       protected void createWidgets() {\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/SinglePageResourceView.java b/dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/views/SinglePageResourceView.java
deleted file mode 100644 (file)
index d1d3dfd..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.simantics.proconf.g3d.views;\r
-\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.ui.ISelectionListener;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.eclipse.ui.forms.events.ExpansionAdapter;\r
-import org.eclipse.ui.forms.events.ExpansionEvent;\r
-import org.eclipse.ui.forms.widgets.FormToolkit;\r
-import org.eclipse.ui.forms.widgets.ScrolledForm;\r
-import org.eclipse.ui.forms.widgets.Section;\r
-import org.simantics.proconf.ui.workbench.GraphAccessViewPart;\r
-import org.simantics.utils.ui.jface.BaseSelectionProvider;\r
-\r
-public abstract class SinglePageResourceView extends GraphAccessViewPart{\r
-       protected Composite parent;\r
-       private ScrolledForm form;\r
-       private BaseSelectionProvider defaultInputSelectionProvider = new BaseSelectionProvider();\r
-       protected FormToolkit toolkit;\r
-       protected ISelectionListener pageSelectionListener;\r
-       \r
-       @Override\r
-       public void createPartControl(Composite parent) {\r
-               super.createPartControl(parent);\r
-               this.parent = parent;\r
-\r
-               toolkit = new FormToolkit(parent.getDisplay());\r
-               form = getToolkit().createScrolledForm(parent);\r
-\r
-               GridLayout layout = new GridLayout(2, false);\r
-               form.getBody().setLayout(layout);\r
-               form.getBody().setLayoutData(\r
-                               new GridData(GridData.FILL, GridData.FILL, true, true));\r
-\r
-               getViewSite().setSelectionProvider(defaultInputSelectionProvider);\r
-\r
-               // createWidgets();\r
-\r
-               form.setText(getFormText());\r
-\r
-               hookPageSelection();\r
-\r
-       }\r
-       \r
-       \r
-    /**\r
-     * Receives selection changes\r
-     * \r
-     * @param part\r
-     * @param selection\r
-     */\r
-    protected void pageSelectionChanged(IWorkbenchPart part, ISelection selection) {\r
-       \r
-    }\r
-       \r
-       \r
-       \r
-       \r
-       \r
-       protected abstract String getFormText();\r
-       \r
-       protected abstract void createWidgets();\r
-       \r
-       @Override\r
-       public void setFocus() {\r
-               //System.out.println("FormTypeEditorBase.setFocus(): Input = " + getInput());\r
-               ScrolledForm form = getActiveForm();\r
-               if (form != null) {\r
-                       form.setFocus();\r
-               }\r
-       }\r
-       \r
-       public FormToolkit getToolkit() {\r
-               return toolkit;\r
-       }\r
-       \r
-       public ScrolledForm getActiveForm() {\r
-               return form;\r
-       }\r
-       \r
-       public void clearForm() {\r
-               for (Control c : form.getBody().getChildren())\r
-                       c.dispose();\r
-               \r
-       }\r
-       \r
-       protected Composite getBody() {\r
-        return form.getBody();\r
-    }\r
-       \r
-       public Composite newGridSection(\r
-            int formColumns,\r
-            int childColumns,\r
-            boolean equalWidth,\r
-            boolean grabVertical,\r
-            String text,\r
-            String description) \r
-    {\r
-        return newGridSection(getBody(), formColumns, childColumns, equalWidth, grabVertical, text, description);\r
-    }\r
-\r
-    public Composite newGridSection(\r
-            Composite parent,\r
-            int formColumns,\r
-            int childColumns,\r
-            boolean equalWidth,\r
-            boolean grabVertical,\r
-            String text,\r
-            String description)\r
-    {\r
-        FormToolkit toolkit = getToolkit();\r
-        \r
-        Section section = toolkit.createSection(parent,\r
-                Section.DESCRIPTION | Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED);\r
-        section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, grabVertical, formColumns, 1));\r
-        section.addExpansionListener(new ExpansionAdapter() {\r
-            public void expansionStateChanged(ExpansionEvent e) {\r
-                //System.out.println("SinglePageTypeEditor: expansionStateChanged " + e);\r
-                //reflow(true);\r
-            }\r
-        });\r
-        section.setText(text);\r
-        section.setDescription(description);\r
-        Composite sectionClient = toolkit.createComposite(section);\r
-        sectionClient.setLayout(new GridLayout(childColumns, equalWidth));\r
-        sectionClient.setLayoutData(new GridData());\r
-        section.setClient(sectionClient);\r
-        return sectionClient;\r
-    }\r
-    \r
-    public void dispose() {\r
-       if (pageSelectionListener != null)\r
-            getSite().getPage().removePostSelectionListener(pageSelectionListener);\r
-    \r
-       super.dispose();\r
-    }\r
-    \r
-    private void hookPageSelection() {\r
-        pageSelectionListener = new ISelectionListener() {\r
-            public void selectionChanged(IWorkbenchPart part, ISelection selection) {\r
-                if (part == SinglePageResourceView.this)\r
-                    return;\r
-                pageSelectionChanged(part, selection);\r
-            }\r
-        };\r
-        getSite().getPage().addPostSelectionListener(pageSelectionListener);\r
-        ISelection sel = getSite().getPage().getSelection();\r
-        IWorkbenchPart wb = getSite().getPage().getActivePart();\r
-        pageSelectionChanged(wb, sel);\r
-    }\r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/.classpath b/dev/org.simantics.proconf.processeditor/.classpath
deleted file mode 100644 (file)
index 0215967..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
-       <classpathentry kind="output" path="bin"/>\r
-</classpath>\r
diff --git a/dev/org.simantics.proconf.processeditor/.project b/dev/org.simantics.proconf.processeditor/.project
deleted file mode 100644 (file)
index 4f2fb46..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>org.simantics.proconf.processeditor</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.ManifestBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.SchemaBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.pde.PluginNature</nature>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/dev/org.simantics.proconf.processeditor/META-INF/MANIFEST.MF b/dev/org.simantics.proconf.processeditor/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index 2c2e6e9..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Processeditor Plug-in
-Bundle-SymbolicName: fi.vtt.simantics.processeditor;singleton:=true
-Bundle-Version: 1.0.0
-Bundle-Activator: fi.vtt.simantics.processeditor.Activator
-Bundle-Vendor: VTT
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- com.jme.eclipse,
- org.simantics.g2d.stubs,
- org.simantics.proconf.ui,
- org.simantics.proconf.g3d,
- org.simantics.proconf.image,
- org.simantics.layer0.stubs,
- org.simantics.layer0.utils,
- org.simantics.utils,
- org.simantics.utils.datastructures,
- javax.vecmath,
- org.simantics.proconf.ode,
- org.simantics.proconf.browsing,
- org.simantics.utils.ui,
- org.simantics.utils.ui.workbench,
- org.simantics.proconf.g3d.shapeeditor,
- org.eclipse.ui.views
-Eclipse-LazyStart: true
diff --git a/dev/org.simantics.proconf.processeditor/build.properties b/dev/org.simantics.proconf.processeditor/build.properties
deleted file mode 100644 (file)
index 6f20375..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/\r
-output.. = bin/\r
-bin.includes = META-INF/,\\r
-               .,\\r
-               plugin.xml\r
diff --git a/dev/org.simantics.proconf.processeditor/data/dcp.mtl b/dev/org.simantics.proconf.processeditor/data/dcp.mtl
deleted file mode 100644 (file)
index e30d811..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# Blender3D MTL File: dcp.blend\r
-# Material Count: 0\r
diff --git a/dev/org.simantics.proconf.processeditor/data/dcp.obj b/dev/org.simantics.proconf.processeditor/data/dcp.obj
deleted file mode 100644 (file)
index 8b19e69..0000000
+++ /dev/null
@@ -1,476 +0,0 @@
-# Blender v242 OBJ File: dcp.blend\r
-# www.blender3d.org\r
-mtllib dcp.mtl\r
-o Sphere_Sphere\r
-v 0.092388 -0.000000 -0.038268\r
-v -0.092388 0.014645 -0.035355\r
-v -0.070711 0.027060 -0.065328\r
-v -0.038268 0.035355 -0.085355\r
-v 0.000000 0.038268 -0.092388\r
-v 0.038268 0.035355 -0.085355\r
-v 0.070711 0.027060 -0.065328\r
-v 0.092388 0.014645 -0.035355\r
-v 0.092388 0.027060 -0.027060\r
-v 0.070711 0.050000 -0.050000\r
-v 0.038268 0.065328 -0.065328\r
-v 0.000000 0.070711 -0.070711\r
-v -0.038268 0.065328 -0.065328\r
-v -0.070711 0.050000 -0.050000\r
-v -0.092388 0.027060 -0.027060\r
-v -0.092388 0.035355 -0.014645\r
-v -0.070711 0.065328 -0.027060\r
-v -0.038268 0.085355 -0.035355\r
-v 0.000000 0.092388 -0.038268\r
-v 0.038268 0.085355 -0.035355\r
-v 0.070711 0.065328 -0.027060\r
-v 0.092388 0.035355 -0.014645\r
-v 0.092388 0.038268 0.000000\r
-v 0.070711 0.070711 0.000000\r
-v 0.038268 0.092388 0.000000\r
-v 0.000000 0.100000 0.000000\r
-v -0.038268 0.092388 -0.000000\r
-v -0.070711 0.070711 -0.000000\r
-v -0.092388 0.038268 -0.000000\r
-v -0.092388 0.035355 0.014645\r
-v -0.070711 0.065328 0.027060\r
-v -0.038268 0.085355 0.035355\r
-v 0.000000 0.092388 0.038268\r
-v 0.038268 0.085355 0.035355\r
-v 0.070711 0.065328 0.027060\r
-v 0.092388 0.035355 0.014645\r
-v 0.092388 0.027060 0.027060\r
-v 0.070711 0.050000 0.050000\r
-v 0.038268 0.065328 0.065328\r
-v 0.000000 0.070711 0.070711\r
-v -0.038268 0.065328 0.065328\r
-v -0.070711 0.050000 0.050000\r
-v -0.092388 0.027060 0.027060\r
-v -0.092388 0.014645 0.035355\r
-v -0.070711 0.027060 0.065328\r
-v -0.038268 0.035355 0.085355\r
-v -0.000000 0.038268 0.092388\r
-v 0.038268 0.035355 0.085355\r
-v 0.070711 0.027060 0.065328\r
-v 0.092388 0.014645 0.035355\r
-v 0.092388 -0.000000 0.038268\r
-v 0.070711 -0.000000 0.070711\r
-v 0.038268 -0.000000 0.092388\r
-v -0.000000 0.000000 0.100000\r
-v -0.038268 -0.000000 0.092388\r
-v -0.070711 -0.000000 0.070711\r
-v -0.092388 0.000000 0.038268\r
-v -0.092388 -0.014645 0.035355\r
-v -0.070711 -0.027060 0.065328\r
-v -0.038268 -0.035355 0.085355\r
-v -0.000000 -0.038268 0.092388\r
-v 0.038268 -0.035355 0.085355\r
-v 0.070711 -0.027060 0.065328\r
-v 0.092388 -0.014645 0.035355\r
-v 0.092388 -0.027060 0.027060\r
-v 0.070711 -0.050000 0.050000\r
-v 0.038268 -0.065328 0.065328\r
-v -0.000000 -0.070711 0.070711\r
-v -0.038268 -0.065328 0.065328\r
-v -0.070711 -0.050000 0.050000\r
-v -0.092388 -0.027060 0.027060\r
-v -0.100000 -0.000000 0.000000\r
-v -0.092388 -0.035355 0.014645\r
-v -0.070711 -0.065328 0.027060\r
-v -0.038268 -0.085355 0.035355\r
-v -0.000000 -0.092388 0.038268\r
-v 0.038268 -0.085355 0.035355\r
-v 0.070711 -0.065328 0.027060\r
-v 0.092388 -0.035355 0.014645\r
-v 0.092388 -0.038268 0.000000\r
-v 0.070711 -0.070711 0.000000\r
-v 0.038268 -0.092388 0.000000\r
-v 0.000000 -0.100000 0.000000\r
-v -0.038268 -0.092388 -0.000000\r
-v -0.070711 -0.070711 -0.000000\r
-v -0.092388 -0.038268 -0.000000\r
-v -0.092388 -0.035355 -0.014645\r
-v -0.070711 -0.065328 -0.027060\r
-v -0.038268 -0.085355 -0.035355\r
-v 0.000000 -0.092388 -0.038268\r
-v 0.038268 -0.085355 -0.035355\r
-v 0.070711 -0.065328 -0.027060\r
-v 0.092388 -0.035355 -0.014645\r
-v 0.092388 -0.027060 -0.027060\r
-v 0.070711 -0.050000 -0.050000\r
-v 0.038268 -0.065328 -0.065328\r
-v 0.000000 -0.070711 -0.070711\r
-v -0.038268 -0.065328 -0.065328\r
-v -0.070711 -0.050000 -0.050000\r
-v -0.092388 -0.027060 -0.027060\r
-v -0.092388 -0.014645 -0.035355\r
-v -0.070711 -0.027060 -0.065328\r
-v -0.038268 -0.035355 -0.085355\r
-v 0.000000 -0.038268 -0.092388\r
-v 0.038268 -0.035355 -0.085355\r
-v 0.070711 -0.027060 -0.065328\r
-v 0.092388 -0.014645 -0.035355\r
-v 0.070711 0.000000 -0.070711\r
-v 0.038268 0.000000 -0.092388\r
-v 0.000000 0.000000 -0.100000\r
-v -0.038268 0.000000 -0.092388\r
-v -0.070711 0.000000 -0.070711\r
-v -0.092388 0.000000 -0.038268\r
-v 0.232388 -0.014645 -0.035355\r
-v 0.232388 -0.027060 -0.027060\r
-v 0.232388 -0.035355 -0.014645\r
-v 0.232388 -0.038268 0.000000\r
-v 0.232388 -0.035355 0.014645\r
-v 0.232388 -0.027060 0.027060\r
-v 0.232388 -0.014645 0.035355\r
-v 0.232388 -0.000000 0.038268\r
-v 0.232388 0.014645 0.035355\r
-v 0.232388 0.027060 0.027060\r
-v 0.232388 0.035355 0.014645\r
-v 0.232388 0.038268 0.000000\r
-v 0.232388 0.035355 -0.014645\r
-v 0.232388 0.027060 -0.027060\r
-v 0.232388 0.014645 -0.035355\r
-v 0.232388 -0.000000 -0.038268\r
-v 0.231045 -0.000000 -0.153073\r
-v 0.231045 0.058579 -0.141421\r
-v 0.511493 -0.000000 0.000000\r
-v 0.231045 0.108239 -0.108239\r
-v 0.231045 0.141421 -0.058579\r
-v 0.231045 0.153073 0.000000\r
-v 0.231045 0.141421 0.058579\r
-v 0.231045 0.108239 0.108239\r
-v 0.231045 0.058579 0.141421\r
-v 0.231045 -0.000000 0.153073\r
-v 0.231045 -0.058579 0.141421\r
-v 0.231045 -0.108239 0.108239\r
-v 0.231045 -0.141421 0.058579\r
-v 0.231045 -0.153073 0.000000\r
-v 0.231045 -0.141421 -0.058579\r
-v 0.231045 -0.108239 -0.108239\r
-v 0.231045 -0.058579 -0.141421\r
-vn -0.999929 -0.002325 0.011699\r
-vn -0.999929 -0.006629 0.009917\r
-vn -0.999929 -0.009918 0.006627\r
-vn -0.999929 -0.011699 0.002327\r
-vn -0.999929 -0.011699 -0.002327\r
-vn -0.999929 -0.009918 -0.006627\r
-vn -0.999929 -0.006627 -0.009918\r
-vn -0.999929 -0.002327 -0.011699\r
-vn -0.999929 0.002327 -0.011699\r
-vn -0.999929 0.006627 -0.009918\r
-vn -0.999929 0.009918 -0.006627\r
-vn -0.999929 0.011699 -0.002327\r
-vn -0.999929 0.011699 0.002327\r
-vn -0.999929 0.009918 0.006627\r
-vn -0.999929 0.006627 0.009918\r
-vn -0.999929 0.002327 0.011699\r
-vn -1.000000 0.000000 0.000000\r
-vn -0.924070 0.146245 -0.353099\r
-vn -0.924070 0.000000 -0.382183\r
-vn -0.707602 0.270394 -0.652791\r
-vn -0.707602 0.000000 -0.706565\r
-vn -0.383129 0.353465 -0.853359\r
-vn -0.383129 0.000000 -0.923673\r
-vn 0.000000 0.382672 -0.923856\r
-vn 0.000000 0.000000 -1.000000\r
-vn 0.383129 0.353465 -0.853359\r
-vn 0.383129 0.000000 -0.923673\r
-vn 0.707602 0.270394 -0.652791\r
-vn 0.707602 0.000000 -0.706565\r
-vn 0.474532 0.336833 -0.813227\r
-vn 0.474532 0.000000 -0.880215\r
-vn 0.707602 0.499619 -0.499619\r
-vn 0.474532 0.622395 -0.622395\r
-vn 0.383129 0.653127 -0.653127\r
-vn 0.000000 0.707083 -0.707083\r
-vn -0.383129 0.653127 -0.653127\r
-vn -0.707602 0.499619 -0.499619\r
-vn -0.924070 0.270241 -0.270241\r
-vn -0.924070 0.353099 -0.146245\r
-vn -0.707602 0.652791 -0.270394\r
-vn -0.383129 0.853359 -0.353465\r
-vn 0.000000 0.923856 -0.382672\r
-vn 0.383129 0.853359 -0.353465\r
-vn 0.707602 0.652791 -0.270394\r
-vn 0.474532 0.813227 -0.336833\r
-vn 0.707602 0.706565 0.000000\r
-vn 0.474532 0.880215 0.000000\r
-vn 0.383129 0.923673 0.000000\r
-vn 0.000000 1.000000 0.000000\r
-vn -0.383129 0.923673 0.000000\r
-vn -0.707602 0.706565 0.000000\r
-vn -0.924070 0.382183 0.000000\r
-vn -0.924070 0.353099 0.146245\r
-vn -0.707602 0.652791 0.270394\r
-vn -0.383129 0.853359 0.353465\r
-vn 0.000000 0.923856 0.382672\r
-vn 0.383129 0.853359 0.353465\r
-vn 0.707602 0.652791 0.270394\r
-vn 0.474532 0.813227 0.336833\r
-vn 0.707602 0.499619 0.499619\r
-vn 0.474532 0.622395 0.622395\r
-vn 0.383129 0.653127 0.653127\r
-vn 0.000000 0.707083 0.707083\r
-vn -0.383129 0.653127 0.653127\r
-vn -0.707602 0.499619 0.499619\r
-vn -0.924070 0.270241 0.270241\r
-vn -0.924070 0.146245 0.353099\r
-vn -0.707602 0.270394 0.652791\r
-vn -0.383129 0.353465 0.853359\r
-vn 0.000000 0.382672 0.923856\r
-vn 0.383129 0.353465 0.853359\r
-vn 0.707602 0.270394 0.652791\r
-vn 0.474532 0.336833 0.813227\r
-vn 0.707602 0.000000 0.706565\r
-vn 0.474532 0.000000 0.880215\r
-vn 0.383129 0.000000 0.923673\r
-vn 0.000000 0.000000 1.000000\r
-vn -0.383129 0.000000 0.923673\r
-vn -0.707602 0.000000 0.706565\r
-vn -0.924070 0.000000 0.382183\r
-vn -0.924070 -0.146245 0.353099\r
-vn -0.707602 -0.270394 0.652791\r
-vn -0.383129 -0.353465 0.853359\r
-vn 0.000000 -0.382672 0.923856\r
-vn 0.383129 -0.353465 0.853359\r
-vn 0.707602 -0.270394 0.652791\r
-vn 0.474532 -0.336833 0.813227\r
-vn 0.707602 -0.499619 0.499619\r
-vn 0.474532 -0.622395 0.622395\r
-vn 0.383129 -0.653127 0.653127\r
-vn 0.000000 -0.707083 0.707083\r
-vn -0.383129 -0.653127 0.653127\r
-vn -0.707602 -0.499619 0.499619\r
-vn -0.924070 -0.270241 0.270241\r
-vn -0.924070 -0.353099 0.146245\r
-vn -0.707602 -0.652791 0.270394\r
-vn -0.383129 -0.853359 0.353465\r
-vn 0.000000 -0.923856 0.382672\r
-vn 0.383129 -0.853359 0.353465\r
-vn 0.707602 -0.652791 0.270394\r
-vn 0.474532 -0.813227 0.336833\r
-vn 0.707602 -0.706565 0.000000\r
-vn 0.474532 -0.880215 0.000000\r
-vn 0.383129 -0.923673 0.000000\r
-vn 0.000000 -1.000000 0.000000\r
-vn -0.383129 -0.923673 0.000000\r
-vn -0.707602 -0.706565 0.000000\r
-vn -0.924070 -0.382183 0.000000\r
-vn -0.924070 -0.353099 -0.146245\r
-vn -0.707602 -0.652791 -0.270394\r
-vn -0.383129 -0.853359 -0.353465\r
-vn 0.000000 -0.923856 -0.382672\r
-vn 0.383129 -0.853359 -0.353465\r
-vn 0.707602 -0.652791 -0.270394\r
-vn 0.474532 -0.813227 -0.336833\r
-vn 0.707602 -0.499619 -0.499619\r
-vn 0.474532 -0.622395 -0.622395\r
-vn 0.383129 -0.653127 -0.653127\r
-vn 0.000000 -0.707083 -0.707083\r
-vn -0.383129 -0.653127 -0.653127\r
-vn -0.707602 -0.499619 -0.499619\r
-vn -0.924070 -0.270241 -0.270241\r
-vn -0.924070 -0.146245 -0.353099\r
-vn -0.707602 -0.270394 -0.652791\r
-vn -0.383129 -0.353465 -0.853359\r
-vn 0.000000 -0.382672 -0.923856\r
-vn 0.383129 -0.353465 -0.853359\r
-vn 0.707602 -0.270394 -0.652791\r
-vn 0.474532 -0.336833 -0.813227\r
-vn -0.718070 0.000000 -0.695944\r
-vn -0.718070 -0.266305 -0.642964\r
-vn -0.718070 -0.492080 -0.492080\r
-vn -0.718070 -0.642964 -0.266305\r
-vn -0.718070 -0.695944 0.000000\r
-vn -0.718070 -0.642964 0.266305\r
-vn -0.718070 -0.492080 0.492080\r
-vn -0.718070 -0.266305 0.642964\r
-vn -0.718070 0.000000 0.695944\r
-vn -0.718070 0.266305 0.642964\r
-vn -0.718070 0.492080 0.492080\r
-vn -0.718070 0.642964 0.266305\r
-vn -0.718070 0.695944 0.000000\r
-vn -0.718070 0.642964 -0.266305\r
-vn -0.718070 0.492080 -0.492080\r
-vn -0.718070 0.266305 -0.642964\r
-vn -0.526292 0.000000 -0.850276\r
-vn -0.526292 0.325388 -0.785546\r
-vn 1.000000 0.000000 0.000000\r
-vn -0.526292 0.601245 -0.601245\r
-vn -0.526292 0.785546 -0.325388\r
-vn -0.526292 0.850276 0.000000\r
-vn -0.526292 0.785546 0.325388\r
-vn -0.526292 0.601245 0.601245\r
-vn -0.526292 0.325388 0.785546\r
-vn -0.526292 0.000000 0.850276\r
-vn -0.526292 -0.325388 0.785546\r
-vn -0.526292 -0.601245 0.601245\r
-vn -0.526292 -0.785546 0.325388\r
-vn -0.526292 -0.850276 0.000000\r
-vn -0.526292 -0.785546 -0.325388\r
-vn -0.526292 -0.601245 -0.601245\r
-vn -0.526292 -0.325388 -0.785546\r
-usemtl (null)\r
-usemtl (null)\r
-s off\r
-f 129//1 128//1 131//1 130//1\r
-f 128//2 127//2 133//2 131//2\r
-f 127//3 126//3 134//3 133//3\r
-f 126//4 125//4 135//4 134//4\r
-f 125//5 124//5 136//5 135//5\r
-f 124//6 123//6 137//6 136//6\r
-f 123//7 122//7 138//7 137//7\r
-f 122//8 121//8 139//8 138//8\r
-f 121//9 120//9 140//9 139//9\r
-f 120//10 119//10 141//10 140//10\r
-f 119//11 118//11 142//11 141//11\r
-f 118//12 117//12 143//12 142//12\r
-f 117//13 116//13 144//13 143//13\r
-f 116//14 115//14 145//14 144//14\r
-f 115//15 114//15 146//15 145//15\r
-f 114//16 129//16 130//16 146//16\r
-s 1\r
-f 72//17 2//18 113//19\r
-f 113//19 2//18 3//20 112//21\r
-f 112//21 3//20 4//22 111//23\r
-f 111//23 4//22 5//24 110//25\r
-f 110//25 5//24 6//26 109//27\r
-f 109//27 6//26 7//28 108//29\r
-f 8//30 1//31 108//29 7//28\r
-f 7//28 10//32 9//33 8//30\r
-f 6//26 11//34 10//32 7//28\r
-f 5//24 12//35 11//34 6//26\r
-f 4//22 13//36 12//35 5//24\r
-f 3//20 14//37 13//36 4//22\r
-f 2//18 15//38 14//37 3//20\r
-f 72//17 15//38 2//18\r
-f 72//17 16//39 15//38\r
-f 15//38 16//39 17//40 14//37\r
-f 14//37 17//40 18//41 13//36\r
-f 13//36 18//41 19//42 12//35\r
-f 12//35 19//42 20//43 11//34\r
-f 11//34 20//43 21//44 10//32\r
-f 10//32 21//44 22//45 9//33\r
-f 21//44 24//46 23//47 22//45\r
-f 20//43 25//48 24//46 21//44\r
-f 19//42 26//49 25//48 20//43\r
-f 18//41 27//50 26//49 19//42\r
-f 17//40 28//51 27//50 18//41\r
-f 16//39 29//52 28//51 17//40\r
-f 72//17 29//52 16//39\r
-f 72//17 30//53 29//52\r
-f 29//52 30//53 31//54 28//51\r
-f 28//51 31//54 32//55 27//50\r
-f 27//50 32//55 33//56 26//49\r
-f 26//49 33//56 34//57 25//48\r
-f 25//48 34//57 35//58 24//46\r
-f 24//46 35//58 36//59 23//47\r
-f 35//58 38//60 37//61 36//59\r
-f 34//57 39//62 38//60 35//58\r
-f 33//56 40//63 39//62 34//57\r
-f 32//55 41//64 40//63 33//56\r
-f 31//54 42//65 41//64 32//55\r
-f 30//53 43//66 42//65 31//54\r
-f 72//17 43//66 30//53\r
-f 72//17 44//67 43//66\r
-f 43//66 44//67 45//68 42//65\r
-f 42//65 45//68 46//69 41//64\r
-f 41//64 46//69 47//70 40//63\r
-f 40//63 47//70 48//71 39//62\r
-f 39//62 48//71 49//72 38//60\r
-f 38//60 49//72 50//73 37//61\r
-f 49//72 52//74 51//75 50//73\r
-f 48//71 53//76 52//74 49//72\r
-f 47//70 54//77 53//76 48//71\r
-f 46//69 55//78 54//77 47//70\r
-f 45//68 56//79 55//78 46//69\r
-f 44//67 57//80 56//79 45//68\r
-f 72//17 57//80 44//67\r
-f 72//17 58//81 57//80\r
-f 57//80 58//81 59//82 56//79\r
-f 56//79 59//82 60//83 55//78\r
-f 55//78 60//83 61//84 54//77\r
-f 54//77 61//84 62//85 53//76\r
-f 53//76 62//85 63//86 52//74\r
-f 52//74 63//86 64//87 51//75\r
-f 63//86 66//88 65//89 64//87\r
-f 62//85 67//90 66//88 63//86\r
-f 61//84 68//91 67//90 62//85\r
-f 60//83 69//92 68//91 61//84\r
-f 59//82 70//93 69//92 60//83\r
-f 58//81 71//94 70//93 59//82\r
-f 72//17 71//94 58//81\r
-f 72//17 73//95 71//94\r
-f 71//94 73//95 74//96 70//93\r
-f 70//93 74//96 75//97 69//92\r
-f 69//92 75//97 76//98 68//91\r
-f 68//91 76//98 77//99 67//90\r
-f 67//90 77//99 78//100 66//88\r
-f 66//88 78//100 79//101 65//89\r
-f 78//100 81//102 80//103 79//101\r
-f 77//99 82//104 81//102 78//100\r
-f 76//98 83//105 82//104 77//99\r
-f 75//97 84//106 83//105 76//98\r
-f 74//96 85//107 84//106 75//97\r
-f 73//95 86//108 85//107 74//96\r
-f 72//17 86//108 73//95\r
-f 72//17 87//109 86//108\r
-f 86//108 87//109 88//110 85//107\r
-f 85//107 88//110 89//111 84//106\r
-f 84//106 89//111 90//112 83//105\r
-f 83//105 90//112 91//113 82//104\r
-f 82//104 91//113 92//114 81//102\r
-f 81//102 92//114 93//115 80//103\r
-f 92//114 95//116 94//117 93//115\r
-f 91//113 96//118 95//116 92//114\r
-f 90//112 97//119 96//118 91//113\r
-f 89//111 98//120 97//119 90//112\r
-f 88//110 99//121 98//120 89//111\r
-f 87//109 100//122 99//121 88//110\r
-f 72//17 100//122 87//109\r
-f 72//17 101//123 100//122\r
-f 100//122 101//123 102//124 99//121\r
-f 99//121 102//124 103//125 98//120\r
-f 98//120 103//125 104//126 97//119\r
-f 97//119 104//126 105//127 96//118\r
-f 96//118 105//127 106//128 95//116\r
-f 95//116 106//128 107//129 94//117\r
-f 1//31 107//129 106//128 108//29\r
-f 105//127 109//27 108//29 106//128\r
-f 104//126 110//25 109//27 105//127\r
-f 103//125 111//23 110//25 104//126\r
-f 102//124 112//21 111//23 103//125\r
-f 101//123 113//19 112//21 102//124\r
-f 72//17 113//19 101//123\r
-f 107//129 1//31 129//130 114//131\r
-f 94//117 107//129 114//131 115//132\r
-f 93//115 94//117 115//132 116//133\r
-f 80//103 93//115 116//133 117//134\r
-f 79//101 80//103 117//134 118//135\r
-f 65//89 79//101 118//135 119//136\r
-f 64//87 65//89 119//136 120//137\r
-f 51//75 64//87 120//137 121//138\r
-f 50//73 51//75 121//138 122//139\r
-f 37//61 50//73 122//139 123//140\r
-f 36//59 37//61 123//140 124//141\r
-f 23//47 36//59 124//141 125//142\r
-f 22//45 23//47 125//142 126//143\r
-f 9//33 22//45 126//143 127//144\r
-f 8//30 9//33 127//144 128//145\r
-f 1//31 8//30 128//145 129//130\r
-f 130//146 131//147 132//148\r
-f 131//147 133//149 132//148\r
-f 133//149 134//150 132//148\r
-f 134//150 135//151 132//148\r
-f 135//151 136//152 132//148\r
-f 136//152 137//153 132//148\r
-f 137//153 138//154 132//148\r
-f 138//154 139//155 132//148\r
-f 139//155 140//156 132//148\r
-f 140//156 141//157 132//148\r
-f 141//157 142//158 132//148\r
-f 142//158 143//159 132//148\r
-f 143//159 144//160 132//148\r
-f 144//160 145//161 132//148\r
-f 145//161 146//162 132//148\r
-f 146//162 130//146 132//148\r
diff --git a/dev/org.simantics.proconf.processeditor/icons/Component.png b/dev/org.simantics.proconf.processeditor/icons/Component.png
deleted file mode 100644 (file)
index 0d43ef5..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/Component.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/Component.svg b/dev/org.simantics.proconf.processeditor/icons/Component.svg
deleted file mode 100644 (file)
index eaf3034..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44+devel"
-   version="1.0"
-   sodipodi:docname="Component.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   sodipodi:docbase="C:\Documents and Settings\Make\Desktop"
-   inkscape:export-filename="C:\Documents and Settings\Make\Desktop\Component.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4"
-   sodipodi:modified="true">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient3133">
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="0"
-         id="stop3135" />
-      <stop
-         id="stop3141"
-         offset="0.5"
-         style="stop-color:#cbcbcb;stop-opacity:1;" />
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="1"
-         id="stop3137" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3133"
-       id="linearGradient5083"
-       x1="45.114037"
-       y1="48.248638"
-       x2="45.114037"
-       y2="82.201416"
-       gradientUnits="userSpaceOnUse" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3133"
-       id="linearGradient3152"
-       x1="21.809525"
-       y1="10.776942"
-       x2="74.932327"
-       y2="10.776942"
-       gradientUnits="userSpaceOnUse" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3133"
-       id="linearGradient4129"
-       x1="34.842106"
-       y1="25.93985"
-       x2="62.776943"
-       y2="25.93985"
-       gradientUnits="userSpaceOnUse" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.98"
-     inkscape:cx="50"
-     inkscape:cy="65.037594"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1680"
-     inkscape:window-height="994"
-     inkscape:window-x="1276"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:url(#linearGradient5083);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect2160"
-       width="77.318306"
-       height="29.949863"
-       x="11.403508"
-       y="50.250629" />
-    <rect
-       style="fill:url(#linearGradient4129);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect2171"
-       width="23.934837"
-       height="17.167919"
-       x="36.842106"
-       y="32.957397" />
-    <rect
-       style="fill:url(#linearGradient3152);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect2173"
-       width="49.122807"
-       height="13.283208"
-       x="23.809525"
-       y="19.674185" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/Elbow.png b/dev/org.simantics.proconf.processeditor/icons/Elbow.png
deleted file mode 100644 (file)
index bbaa16e..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/Elbow.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/Elbow.svg b/dev/org.simantics.proconf.processeditor/icons/Elbow.svg
deleted file mode 100644 (file)
index 611748a..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44+devel"
-   version="1.0"
-   sodipodi:docbase="C:\Documents and Settings\Make\Desktop"
-   sodipodi:docname="Elbow.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   inkscape:export-filename="C:\Documents and Settings\Make\Desktop\Elbow.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4"
-   sodipodi:modified="true">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient8030">
-      <stop
-         id="stop8032"
-         offset="0"
-         style="stop-color:#6c6c6c;stop-opacity:1;" />
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="0.25"
-         id="stop8038" />
-      <stop
-         style="stop-color:#c8c8c8;stop-opacity:1;"
-         offset="0.5"
-         id="stop8034" />
-      <stop
-         id="stop8040"
-         offset="0.75"
-         style="stop-color:#4c4c4c;stop-opacity:1;" />
-      <stop
-         id="stop8036"
-         offset="1"
-         style="stop-color:#6c6c6c;stop-opacity:1;" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3133">
-      <stop
-         style="stop-color:#6c6c6c;stop-opacity:1;"
-         offset="0"
-         id="stop3135" />
-      <stop
-         id="stop3141"
-         offset="0.5"
-         style="stop-color:#ffffff;stop-opacity:1;" />
-      <stop
-         style="stop-color:#6c6c6c;stop-opacity:1;"
-         offset="1"
-         id="stop3137" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3133"
-       id="linearGradient5083"
-       x1="45.114037"
-       y1="34.211781"
-       x2="45.236843"
-       y2="63.532585"
-       gradientUnits="userSpaceOnUse" />
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient8030"
-       id="radialGradient6090"
-       cx="96.962318"
-       cy="96.001694"
-       fx="96.962318"
-       fy="96.001694"
-       r="50.5"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(2.2964837,5.7024121e-8,-5.8341962e-8,2.3753605,-132.4242,-138.9854)" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="6.0477091"
-     inkscape:cx="115.16906"
-     inkscape:cy="57.595569"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1680"
-     inkscape:window-height="994"
-     inkscape:window-x="1280"
-     inkscape:window-y="22" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       style="fill:url(#radialGradient6090);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-start:none"
-       d="M 89.854773,9.8471149 C 46.494023,9.8471149 11.30269,45.155211 11.30269,88.65983 L 50.578732,88.65983 C 50.577409,88.527292 50.578732,88.398616 50.578732,88.265766 C 50.578732,66.73098 67.998442,49.253473 89.462013,49.253473 C 89.594423,49.253473 89.722674,49.252145 89.854773,49.253473 L 89.854773,9.8471149 z "
-       id="path5107" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/Nozzle.png b/dev/org.simantics.proconf.processeditor/icons/Nozzle.png
deleted file mode 100644 (file)
index 48cf03e..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/Nozzle.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/Nozzle.svg b/dev/org.simantics.proconf.processeditor/icons/Nozzle.svg
deleted file mode 100644 (file)
index 0dd815c..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   sodipodi:docname="Nozzle.svg"
-   sodipodi:docbase="D:\dev\icons"
-   inkscape:export-filename="C:\Documents and Settings\Make\Desktop\Straight.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient3133">
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="0"
-         id="stop3135" />
-      <stop
-         id="stop3141"
-         offset="0.5"
-         style="stop-color:#cbcbcb;stop-opacity:1;" />
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="1"
-         id="stop3137" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3133"
-       id="linearGradient5083"
-       x1="45.114037"
-       y1="32.711548"
-       x2="45.114037"
-       y2="66.681152"
-       gradientUnits="userSpaceOnUse" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3133"
-       id="linearGradient2772"
-       x1="81.077698"
-       y1="12.912281"
-       x2="81.077698"
-       y2="84.456146"
-       gradientUnits="userSpaceOnUse" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.98"
-     inkscape:cx="50"
-     inkscape:cy="50"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:url(#linearGradient5083);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect2160"
-       width="77.318306"
-       height="29.949863"
-       x="11.403508"
-       y="34.711781" />
-    <rect
-       style="fill:url(#linearGradient2772);fill-opacity:1.0;stroke:black;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1875"
-       width="15.789474"
-       height="67.543861"
-       x="73.182961"
-       y="14.912281" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/Straight.png b/dev/org.simantics.proconf.processeditor/icons/Straight.png
deleted file mode 100644 (file)
index 459919e..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/Straight.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/Straight.svg b/dev/org.simantics.proconf.processeditor/icons/Straight.svg
deleted file mode 100644 (file)
index 117e6ec..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44+devel"
-   version="1.0"
-   sodipodi:docname="Straight.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   sodipodi:docbase="C:\Documents and Settings\Make\Desktop"
-   inkscape:export-filename="C:\Documents and Settings\Make\Desktop\Straight.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4"
-   sodipodi:modified="true">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient3133">
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="0"
-         id="stop3135" />
-      <stop
-         id="stop3141"
-         offset="0.5"
-         style="stop-color:#cbcbcb;stop-opacity:1;" />
-      <stop
-         style="stop-color:#4c4c4c;stop-opacity:1;"
-         offset="1"
-         id="stop3137" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3133"
-       id="linearGradient5083"
-       x1="45.114037"
-       y1="32.711548"
-       x2="45.114037"
-       y2="66.681152"
-       gradientUnits="userSpaceOnUse" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.98"
-     inkscape:cx="50"
-     inkscape:cy="44.987469"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1680"
-     inkscape:window-height="994"
-     inkscape:window-x="1276"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:url(#linearGradient5083);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect2160"
-       width="77.318306"
-       height="29.949863"
-       x="11.403508"
-       y="34.711781" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/bubble.png b/dev/org.simantics.proconf.processeditor/icons/bubble.png
deleted file mode 100644 (file)
index 410e268..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/bubble.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/bubble.svg b/dev/org.simantics.proconf.processeditor/icons/bubble.svg
deleted file mode 100644 (file)
index f52235f..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="32"
-   height="32"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   inkscape:export-filename="C:\Documents and Settings\tuoxmao\Desktop\bubble.png"
-   inkscape:export-xdpi="90"
-   inkscape:export-ydpi="90"
-   sodipodi:docbase="C:\Documents and Settings\tuoxmao\Desktop"
-   sodipodi:docname="bubble.svg">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient3835">
-      <stop
-         style="stop-color:black;stop-opacity:1;"
-         offset="0"
-         id="stop3837" />
-      <stop
-         style="stop-color:black;stop-opacity:0;"
-         offset="1"
-         id="stop3839" />
-    </linearGradient>
-    <marker
-       inkscape:stockid="Arrow1Lstart"
-       orient="auto"
-       refY="0.0"
-       refX="0.0"
-       id="Arrow1Lstart"
-       style="overflow:visible">
-      <path
-         id="path3828"
-         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
-         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
-         transform="scale(0.8) translate(12.5,0)" />
-    </marker>
-    <linearGradient
-       id="linearGradient2762">
-      <stop
-         style="stop-color:white;stop-opacity:0;"
-         offset="0"
-         id="stop2764" />
-      <stop
-         id="stop5615"
-         offset="0.25"
-         style="stop-color:white;stop-opacity:0.20392157;" />
-      <stop
-         id="stop5613"
-         offset="0.5"
-         style="stop-color:white;stop-opacity:1;" />
-      <stop
-         style="stop-color:white;stop-opacity:1;"
-         offset="1"
-         id="stop2766" />
-    </linearGradient>
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient2762"
-       id="radialGradient2768"
-       cx="9.7167473"
-       cy="9.0794983"
-       fx="9.7167473"
-       fy="9.0794983"
-       r="16"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(1.470992,1.073004,-1.001683,1.373218,6.378253,-11.49047)" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="10"
-     inkscape:cx="16"
-     inkscape:cy="16"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="32px"
-     height="32px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       sodipodi:type="arc"
-       style="fill:url(#radialGradient2768);fill-opacity:1;stroke:white;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker-start:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:10;stroke-opacity:1"
-       id="path1874"
-       sodipodi:cx="16"
-       sodipodi:cy="16"
-       sodipodi:rx="16"
-       sodipodi:ry="16"
-       d="M 32 16 A 16 16 0 1 1  0,16 A 16 16 0 1 1  32 16 z"
-       transform="matrix(0.935294,0,0,0.935294,1.035294,1.035294)" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/crosshair.png b/dev/org.simantics.proconf.processeditor/icons/crosshair.png
deleted file mode 100644 (file)
index 379424e..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/crosshair.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/crosshair.svg b/dev/org.simantics.proconf.processeditor/icons/crosshair.svg
deleted file mode 100644 (file)
index 8c73e69..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="32"
-   height="32"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   inkscape:export-filename="C:\Documents and Settings\tuoxmao\Desktop\crosshair.png"
-   inkscape:export-xdpi="90"
-   inkscape:export-ydpi="90"
-   sodipodi:docbase="C:\Documents and Settings\tuoxmao\Desktop"
-   sodipodi:docname="crosshair.svg">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="10"
-     inkscape:cx="16"
-     inkscape:cy="16"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="32px"
-     height="32px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       sodipodi:type="arc"
-       style="fill:none;fill-opacity:1;stroke:white;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:10;stroke-opacity:0.4973262"
-       id="path1872"
-       sodipodi:cx="16"
-       sodipodi:cy="16"
-       sodipodi:rx="12"
-       sodipodi:ry="12"
-       d="M 28 16 A 12 12 0 1 1  4,16 A 12 12 0 1 1  28 16 z" />
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:white;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.4973262;stroke-miterlimit:4;stroke-dasharray:none"
-       d="M 16,7.1054274e-015 L 16,32"
-       id="path2760" />
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:white;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.4973262;stroke-miterlimit:4;stroke-dasharray:none"
-       d="M 0,16 L 32,16"
-       id="path2762" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/factory.png b/dev/org.simantics.proconf.processeditor/icons/factory.png
deleted file mode 100644 (file)
index aad23e3..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/factory.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/factory.svg b/dev/org.simantics.proconf.processeditor/icons/factory.svg
deleted file mode 100644 (file)
index e05205c..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   inkscape:export-filename="D:\dev\icons\factory.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4"
-   sodipodi:docbase="D:\dev\icons"
-   sodipodi:docname="factory.svg"
-   version="1.0">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient10747">
-      <stop
-         style="stop-color:blue;stop-opacity:1;"
-         offset="0"
-         id="stop10749" />
-      <stop
-         style="stop-color:aqua;stop-opacity:1;"
-         offset="1"
-         id="stop10751" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient10753"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606"
-       gradientUnits="userSpaceOnUse" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient11642"
-       gradientUnits="userSpaceOnUse"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606"
-       gradientTransform="translate(11.59326,6.479275e-2)" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient11646"
-       gradientUnits="userSpaceOnUse"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606"
-       gradientTransform="translate(23.6399,6.479232e-2)" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient12543"
-       gradientUnits="userSpaceOnUse"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient12545"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(11.59326,6.479275e-2)"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient12547"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(23.6399,6.479232e-2)"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient1943"
-       gradientUnits="userSpaceOnUse"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient1945"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(11.59326,6.479275e-2)"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient10747"
-       id="linearGradient1947"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(23.6399,6.479232e-2)"
-       x1="20.142487"
-       y1="1011.8181"
-       x2="20.142487"
-       y2="1019.4606" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.72"
-     inkscape:cx="50"
-     inkscape:cy="53.887018"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4"
-     width="100px"
-     height="100px" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <g
-       id="g1923"
-       transform="translate(0,-952.3316)">
-      <rect
-         y="952.36218"
-         x="0"
-         height="100"
-         width="100"
-         id="rect1874"
-         style="fill:#00fd00;fill-opacity:0;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
-      <g
-         id="g1905">
-        <rect
-           style="fill:#d30000;fill-opacity:1;stroke:black;stroke-width:0.99912792;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-           id="rect2768"
-           width="9.0682287"
-           height="69.819527"
-           x="9.9736586"
-           y="974.77106" />
-        <g
-           id="g12537"
-           transform="matrix(1.681297,0,0,1,1.435511,0.129534)">
-          <rect
-             ry="0"
-             y="1005.8278"
-             x="10.411273"
-             height="38.664726"
-             width="42.032604"
-             id="rect2766"
-             style="fill:#d30000;fill-opacity:1;stroke:black;stroke-width:0.93630695;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
-          <rect
-             y="1011.8181"
-             x="15.803109"
-             height="7.642487"
-             width="8.6787567"
-             id="rect9860"
-             style="fill:url(#linearGradient1943);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111" />
-          <rect
-             y="1011.8829"
-             x="27.396372"
-             height="7.642487"
-             width="8.6787567"
-             id="rect11640"
-             style="fill:url(#linearGradient1945);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111" />
-          <rect
-             y="1011.883"
-             x="39.443005"
-             height="7.642487"
-             width="8.6787567"
-             id="rect11644"
-             style="fill:url(#linearGradient1947);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111" />
-        </g>
-        <g
-           id="g1894">
-          <path
-             transform="translate(-36.39896,5.829015)"
-             d="M 74.222796 966.48132 A 7.2538862 5.8290157 0 1 1  59.715024,966.48132 A 7.2538862 5.8290157 0 1 1  74.222796 966.48132 z"
-             sodipodi:ry="5.8290157"
-             sodipodi:rx="7.2538862"
-             sodipodi:cy="966.48132"
-             sodipodi:cx="66.96891"
-             id="path2770"
-             style="fill:black;fill-opacity:0.28877007;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-             sodipodi:type="arc" />
-          <path
-             transform="translate(-57.12436,-10.23316)"
-             d="M 85.621764 974.12384 A 7.5129533 8.4196892 0 1 1  70.595857,974.12384 A 7.5129533 8.4196892 0 1 1  85.621764 974.12384 z"
-             sodipodi:ry="8.4196892"
-             sodipodi:rx="7.5129533"
-             sodipodi:cy="974.12384"
-             sodipodi:cx="78.10881"
-             id="path2772"
-             style="fill:black;fill-opacity:0.44117647;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-             sodipodi:type="arc" />
-          <path
-             transform="translate(-46.76166,-0.259068)"
-             d="M 98.834197 969.13678 A 8.6139898 7.9663215 0 1 1  81.606217,969.13678 A 8.6139898 7.9663215 0 1 1  98.834197 969.13678 z"
-             sodipodi:ry="7.9663215"
-             sodipodi:rx="8.6139898"
-             sodipodi:cy="969.13678"
-             sodipodi:cx="90.220207"
-             id="path2774"
-             style="fill:black;fill-opacity:0.33422463;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111"
-             sodipodi:type="arc" />
-          <path
-             transform="matrix(0.932331,0,0,0.869919,-40.39746,117.1935)"
-             d="M 98.834197 969.13678 A 8.6139898 7.9663215 0 1 1  81.606217,969.13678 A 8.6139898 7.9663215 0 1 1  98.834197 969.13678 z"
-             sodipodi:ry="7.9663215"
-             sodipodi:rx="8.6139898"
-             sodipodi:cy="969.13678"
-             sodipodi:cx="90.220207"
-             id="path9856"
-             style="fill:black;fill-opacity:0.33422463;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111"
-             sodipodi:type="arc" />
-          <path
-             transform="translate(-32.44819,-6.411903)"
-             d="M 98.834197 969.13678 A 8.6139898 7.9663215 0 1 1  81.606217,969.13678 A 8.6139898 7.9663215 0 1 1  98.834197 969.13678 z"
-             sodipodi:ry="7.9663215"
-             sodipodi:rx="8.6139898"
-             sodipodi:cy="969.13678"
-             sodipodi:cx="90.220207"
-             id="path9858"
-             style="fill:black;fill-opacity:0.33422463;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111"
-             sodipodi:type="arc" />
-          <path
-             transform="translate(-47.21503,8.484471)"
-             d="M 98.834197 969.13678 A 8.6139898 7.9663215 0 1 1  81.606217,969.13678 A 8.6139898 7.9663215 0 1 1  98.834197 969.13678 z"
-             sodipodi:ry="7.9663215"
-             sodipodi:rx="8.6139898"
-             sodipodi:cy="969.13678"
-             sodipodi:cx="90.220207"
-             id="path12533"
-             style="fill:black;fill-opacity:0.33422463;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111"
-             sodipodi:type="arc" />
-          <path
-             transform="matrix(0.691729,0,0,0.699187,-30.08931,285.3113)"
-             d="M 98.834197 969.13678 A 8.6139898 7.9663215 0 1 1  81.606217,969.13678 A 8.6139898 7.9663215 0 1 1  98.834197 969.13678 z"
-             sodipodi:ry="7.9663215"
-             sodipodi:rx="8.6139898"
-             sodipodi:cy="969.13678"
-             sodipodi:cx="90.220207"
-             id="path12535"
-             style="fill:black;fill-opacity:0.33422463;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111"
-             sodipodi:type="arc" />
-          <path
-             transform="translate(-32.57772,4.59846)"
-             d="M 98.834197 969.13678 A 8.6139898 7.9663215 0 1 1  81.606217,969.13678 A 8.6139898 7.9663215 0 1 1  98.834197 969.13678 z"
-             sodipodi:ry="7.9663215"
-             sodipodi:rx="8.6139898"
-             sodipodi:cy="969.13678"
-             sodipodi:cx="90.220207"
-             id="path12549"
-             style="fill:black;fill-opacity:0.33422463;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111"
-             sodipodi:type="arc" />
-          <path
-             transform="translate(-19.75388,-0.453354)"
-             d="M 98.834197 969.13678 A 8.6139898 7.9663215 0 1 1  81.606217,969.13678 A 8.6139898 7.9663215 0 1 1  98.834197 969.13678 z"
-             sodipodi:ry="7.9663215"
-             sodipodi:rx="8.6139898"
-             sodipodi:cy="969.13678"
-             sodipodi:cx="90.220207"
-             id="path12551"
-             style="fill:black;fill-opacity:0.33422463;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.06417111"
-             sodipodi:type="arc" />
-        </g>
-      </g>
-    </g>
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/middle.png b/dev/org.simantics.proconf.processeditor/icons/middle.png
deleted file mode 100644 (file)
index 4e3d03e..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/middle.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/middle.svg b/dev/org.simantics.proconf.processeditor/icons/middle.svg
deleted file mode 100644 (file)
index 670c3b4..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="64px"
-   height="64px"
-   id="svg2157"
-   sodipodi:version="0.32"
-   inkscape:version="0.45+0.46pre2+devel"
-   sodipodi:docbase="C:\Documents and Settings\Make\Desktop"
-   sodipodi:docname="middle.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   inkscape:export-filename="D:\dev\icons\New Folder\middle.png"
-   inkscape:export-xdpi="90"
-   inkscape:export-ydpi="90">
-  <defs
-     id="defs2159">
-    <inkscape:perspective
-       sodipodi:type="inkscape:persp3d"
-       inkscape:vp_x="-50 : 600 : 1"
-       inkscape:vp_y="0 : 1000 : 0"
-       inkscape:vp_z="700 : 600 : 1"
-       inkscape:persp3d-origin="300 : 400 : 1"
-       id="perspective31" />
-    <linearGradient
-       id="linearGradient3149">
-      <stop
-         id="stop3151"
-         offset="0"
-         style="stop-color:#c0c03f;stop-opacity:1;" />
-      <stop
-         id="stop3153"
-         offset="1"
-         style="stop-color:#c0a63f;stop-opacity:1;" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient7046">
-      <stop
-         style="stop-color:#ffff00;stop-opacity:1;"
-         offset="0"
-         id="stop7048" />
-      <stop
-         style="stop-color:#ffcd00;stop-opacity:1;"
-         offset="1"
-         id="stop7050" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       id="linearGradient5088">
-      <stop
-         style="stop-color:#ffffff;stop-opacity:1;"
-         offset="0"
-         id="stop5090" />
-      <stop
-         style="stop-color:#ffffff;stop-opacity:0;"
-         offset="1"
-         id="stop5092" />
-    </linearGradient>
-    <filter
-       inkscape:collect="always"
-       id="filter11994">
-      <feGaussianBlur
-         inkscape:collect="always"
-         stdDeviation="1.375"
-         id="feGaussianBlur11996" />
-    </filter>
-    <filter
-       inkscape:collect="always"
-       id="filter12983">
-      <feGaussianBlur
-         inkscape:collect="always"
-         stdDeviation="0.915"
-         id="feGaussianBlur12985" />
-    </filter>
-    <filter
-       inkscape:collect="always"
-       x="-0.14285714"
-       width="1.2857143"
-       y="-0.10344828"
-       height="1.2068966"
-       id="filter5187">
-      <feGaussianBlur
-         inkscape:collect="always"
-         stdDeviation="1.25"
-         id="feGaussianBlur5189" />
-    </filter>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient5088"
-       id="linearGradient5094"
-       x1="20.198912"
-       y1="-9.0645924"
-       x2="35.243752"
-       y2="39.135406"
-       gradientUnits="userSpaceOnUse" />
-    <filter
-       inkscape:collect="always"
-       id="filter6073">
-      <feGaussianBlur
-         inkscape:collect="always"
-         stdDeviation="0.62861738"
-         id="feGaussianBlur6075" />
-    </filter>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient7046"
-       id="linearGradient7052"
-       x1="32"
-       y1="59.5"
-       x2="32"
-       y2="4.5"
-       gradientUnits="userSpaceOnUse" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="1"
-     inkscape:cx="32"
-     inkscape:cy="28.07"
-     inkscape:current-layer="layer1"
-     showgrid="true"
-     inkscape:document-units="px"
-     inkscape:grid-bbox="true"
-     inkscape:window-width="739"
-     inkscape:window-height="573"
-     inkscape:window-x="367"
-     inkscape:window-y="140" />
-  <metadata
-     id="metadata2162">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     id="layer1"
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer">
-    <path
-       sodipodi:type="arc"
-       style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter12983);fill-opacity:1"
-       id="path2169"
-       sodipodi:cx="32"
-       sodipodi:cy="32"
-       sodipodi:rx="30"
-       sodipodi:ry="30"
-       d="M 62 32 A 30 30 0 1 1  2,32 A 30 30 0 1 1  62 32 z" />
-    <path
-       sodipodi:type="arc"
-       style="fill:url(#linearGradient7052);fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1.0;filter:url(#filter11994)"
-       id="path2167"
-       sodipodi:cx="32"
-       sodipodi:cy="32"
-       sodipodi:rx="27"
-       sodipodi:ry="27"
-       d="M 59 32 A 27 27 0 1 1  5,32 A 27 27 0 1 1  59 32 z" />
-    <path
-       style="fill:#000000;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;filter:url(#filter5187)"
-       d="M 32,32 L 47,17 L 53,23 L 44,32 L 53,41 L 47,47 L 32,32 z "
-       id="path2168"
-       sodipodi:nodetypes="ccccccc" />
-    <use
-       x="0"
-       y="0"
-       xlink:href="#path2168"
-       id="use5195"
-       transform="matrix(-1,0,0,-1,64,64)"
-       width="64"
-       height="64" />
-    <path
-       style="fill:url(#linearGradient5094);fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1.0;filter:url(#filter6073)"
-       d="M 32 2 C 15.44 2 2 15.44 2 32 C 2 32.158352 1.9975512 32.310977 2 32.46875 C 8.1463048 32.486214 16.553215 32.403245 20.3125 31.8125 C 27.274155 30.718527 40.93099 29.497975 55.34375 13.15625 C 49.842663 6.3498757 41.426528 2 32 2 z "
-       id="path2170" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/plus.png b/dev/org.simantics.proconf.processeditor/icons/plus.png
deleted file mode 100644 (file)
index 1d6b816..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/plus.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/plus.svg b/dev/org.simantics.proconf.processeditor/icons/plus.svg
deleted file mode 100644 (file)
index 7338a01..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="64px"
-   height="64px"
-   id="svg2157"
-   sodipodi:version="0.32"
-   inkscape:version="0.45+0.46pre2+devel"
-   sodipodi:docbase="C:\Documents and Settings\Make\Desktop"
-   sodipodi:docname="plus.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   inkscape:export-filename="D:\dev\icons\New Folder\plus.png"
-   inkscape:export-xdpi="45"
-   inkscape:export-ydpi="45">
-  <defs
-     id="defs2159">
-    <inkscape:perspective
-       sodipodi:type="inkscape:persp3d"
-       inkscape:vp_x="-50 : 600 : 1"
-       inkscape:vp_y="0 : 1000 : 0"
-       inkscape:vp_z="700 : 600 : 1"
-       inkscape:persp3d-origin="300 : 400 : 1"
-       id="perspective31" />
-    <inkscape:perspective
-       sodipodi:type="inkscape:persp3d"
-       inkscape:vp_x="-50 : 600 : 1"
-       inkscape:vp_y="0 : 1000 : 0"
-       inkscape:vp_z="700 : 600 : 1"
-       inkscape:persp3d-origin="300 : 400 : 1"
-       id="perspective30" />
-    <linearGradient
-       id="linearGradient3149">
-      <stop
-         id="stop3151"
-         offset="0"
-         style="stop-color:#c0c03f;stop-opacity:1;" />
-      <stop
-         id="stop3153"
-         offset="1"
-         style="stop-color:#c0a63f;stop-opacity:1;" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient7046">
-      <stop
-         style="stop-color:#ffff00;stop-opacity:1;"
-         offset="0"
-         id="stop7048" />
-      <stop
-         style="stop-color:#ffcd00;stop-opacity:1;"
-         offset="1"
-         id="stop7050" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       id="linearGradient5088">
-      <stop
-         style="stop-color:#ffffff;stop-opacity:1;"
-         offset="0"
-         id="stop5090" />
-      <stop
-         style="stop-color:#ffffff;stop-opacity:0;"
-         offset="1"
-         id="stop5092" />
-    </linearGradient>
-    <filter
-       inkscape:collect="always"
-       id="filter11994">
-      <feGaussianBlur
-         inkscape:collect="always"
-         stdDeviation="1.375"
-         id="feGaussianBlur11996" />
-    </filter>
-    <filter
-       inkscape:collect="always"
-       id="filter12983">
-      <feGaussianBlur
-         inkscape:collect="always"
-         stdDeviation="0.915"
-         id="feGaussianBlur12985" />
-    </filter>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient5088"
-       id="linearGradient5094"
-       x1="20.198912"
-       y1="-9.0645924"
-       x2="35.243752"
-       y2="39.135406"
-       gradientUnits="userSpaceOnUse" />
-    <filter
-       inkscape:collect="always"
-       id="filter6073">
-      <feGaussianBlur
-         inkscape:collect="always"
-         stdDeviation="0.62861738"
-         id="feGaussianBlur6075" />
-    </filter>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient7046"
-       id="linearGradient7052"
-       x1="32"
-       y1="59.5"
-       x2="32"
-       y2="4.5"
-       gradientUnits="userSpaceOnUse" />
-    <filter
-       inkscape:collect="always"
-       id="filter3153">
-      <feGaussianBlur
-         inkscape:collect="always"
-         stdDeviation="1.0725"
-         id="feGaussianBlur3155" />
-    </filter>
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="5"
-     inkscape:cx="32"
-     inkscape:cy="32"
-     inkscape:current-layer="layer1"
-     showgrid="true"
-     inkscape:document-units="px"
-     inkscape:grid-bbox="true"
-     inkscape:window-width="857"
-     inkscape:window-height="644"
-     inkscape:window-x="594"
-     inkscape:window-y="111" />
-  <metadata
-     id="metadata2162">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     id="layer1"
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer">
-    <path
-       sodipodi:type="arc"
-       style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter12983);fill-opacity:1"
-       id="path2169"
-       sodipodi:cx="32"
-       sodipodi:cy="32"
-       sodipodi:rx="30"
-       sodipodi:ry="30"
-       d="M 62 32 A 30 30 0 1 1  2,32 A 30 30 0 1 1  62 32 z" />
-    <path
-       sodipodi:type="arc"
-       style="fill:url(#linearGradient7052);fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1.0;filter:url(#filter11994)"
-       id="path2167"
-       sodipodi:cx="32"
-       sodipodi:cy="32"
-       sodipodi:rx="27"
-       sodipodi:ry="27"
-       d="M 59 32 A 27 27 0 1 1  5,32 A 27 27 0 1 1  59 32 z" />
-    <path
-       style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;filter:url(#filter3153);stroke-miterlimit:4;stroke-dasharray:none"
-       d="M 15,34 L 15,30 L 30,30 L 30,15 L 34,15 L 34,30 L 49,30 L 49,34 L 34,34 L 34,49 L 30,49 L 30,34 L 15,34 z "
-       id="path2178" />
-    <path
-       style="fill:url(#linearGradient5094);fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1.0;filter:url(#filter6073)"
-       d="M 32 2 C 15.44 2 2 15.44 2 32 C 2 32.158352 1.9975512 32.310977 2 32.46875 C 8.1463048 32.486214 16.553215 32.403245 20.3125 31.8125 C 27.274155 30.718527 40.93099 29.497975 55.34375 13.15625 C 49.842663 6.3498757 41.426528 2 32 2 z "
-       id="path2170" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/tank.png b/dev/org.simantics.proconf.processeditor/icons/tank.png
deleted file mode 100644 (file)
index 44015a3..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/tank.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/tank.svg b/dev/org.simantics.proconf.processeditor/icons/tank.svg
deleted file mode 100644 (file)
index 8e8784f..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="16"
-   height="16"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.45+0.46pre2+devel"
-   version="1.0"
-   sodipodi:docname="tank.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   inkscape:export-filename="D:\dev\icons\tank.png"
-   inkscape:export-xdpi="90"
-   inkscape:export-ydpi="90">
-  <defs
-     id="defs4">
-    <inkscape:perspective
-       sodipodi:type="inkscape:persp3d"
-       inkscape:vp_x="-50 : 600 : 1"
-       inkscape:vp_y="0 : 1000 : 0"
-       inkscape:vp_z="700 : 600 : 1"
-       inkscape:persp3d-origin="300 : 400 : 1"
-       id="perspective24" />
-    <linearGradient
-       id="linearGradient3186">
-      <stop
-         style="stop-color:#ff0000;stop-opacity:1;"
-         offset="0"
-         id="stop3188" />
-      <stop
-         id="stop3194"
-         offset="0.5"
-         style="stop-color:#ffffff;stop-opacity:1;" />
-      <stop
-         style="stop-color:#ff0000;stop-opacity:1;"
-         offset="1"
-         id="stop3190" />
-    </linearGradient>
-    <inkscape:perspective
-       sodipodi:type="inkscape:persp3d"
-       inkscape:vp_x="-50 : 600 : 1"
-       inkscape:vp_y="0 : 1000 : 0"
-       inkscape:vp_z="700 : 600 : 1"
-       inkscape:persp3d-origin="300 : 400 : 1"
-       id="perspective10" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3186"
-       id="linearGradient3192"
-       x1="5.3350925"
-       y1="6.0993748"
-       x2="7.3876858"
-       y2="12.259375"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(-10e-2,-1.8)" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3186"
-       id="linearGradient3196"
-       x1="11.69074"
-       y1="4.8200002"
-       x2="13.4933"
-       y2="9.000001"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(-10e-2,-1.8)" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3186"
-       id="linearGradient3198"
-       x1="8.4300299"
-       y1="7.3143148"
-       x2="8.8612204"
-       y2="10.414315"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(-10e-2,-1.8)" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3186"
-       id="linearGradient3200"
-       x1="2.3299999"
-       y1="6.6100001"
-       x2="4.7900004"
-       y2="6.5100002"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(-10e-2,-1.8)" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3186"
-       id="linearGradient3257"
-       x1="8"
-       y1="4"
-       x2="8"
-       y2="10"
-       gradientUnits="userSpaceOnUse" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3186"
-       id="linearGradient3286"
-       x1="8"
-       y1="3.96875"
-       x2="8"
-       y2="9.96875"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="translate(0,-0.96875)" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="50"
-     inkscape:cx="7.9134759"
-     inkscape:cy="8.287091"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showgrid="true"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="0"
-     inkscape:window-y="22"
-     showguides="true"
-     inkscape:guide-bbox="true">
-    <sodipodi:guide
-       orientation="0,1"
-       position="1.66,13.02"
-       id="guide3236" />
-    <sodipodi:guide
-       orientation="0,1"
-       position="1.26,5"
-       id="guide3238" />
-    <inkscape:grid
-       type="xygrid"
-       id="grid3259"
-       visible="true"
-       enabled="true" />
-  </sodipodi:namedview>
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:#ff0000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       id="rect3261"
-       width="2"
-       height="4"
-       x="4"
-       y="10.03125" />
-    <rect
-       style="fill:#ff0000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       id="rect3263"
-       width="2"
-       height="4"
-       x="10"
-       y="10.03125" />
-    <path
-       style="fill:url(#linearGradient3286);fill-opacity:1;stroke:#000000;stroke-width:0.50000000000000000;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 3,2 C 1.896,2 1,3.8177299 1,6.03125 C 1,8.2447701 1.896,10.03125 3,10.03125 L 13,10.03125 C 14.104,10.03125 15,8.2447701 15,6.03125 C 15,3.8177299 14.104,2 13,2 L 3,2 z"
-       id="path3269" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/translate_d.png b/dev/org.simantics.proconf.processeditor/icons/translate_d.png
deleted file mode 100644 (file)
index f4b3b60..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/translate_d.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/translate_d.svg b/dev/org.simantics.proconf.processeditor/icons/translate_d.svg
deleted file mode 100644 (file)
index 1666929..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="100"
-   height="100"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   version="1.0"
-   inkscape:export-filename="D:\dev\icons\translate_d.png"
-   inkscape:export-xdpi="14"
-   inkscape:export-ydpi="14"
-   sodipodi:docname="translate_d.svg"
-   sodipodi:docbase="D:\dev\icons">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient2184">
-      <stop
-         style="stop-color:#2aae3a;stop-opacity:1;"
-         offset="0"
-         id="stop2186" />
-      <stop
-         style="stop-color:#2aae3a;stop-opacity:0;"
-         offset="1"
-         id="stop2188" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient3146">
-      <stop
-         style="stop-color:#0000ff;stop-opacity:1;"
-         offset="0"
-         id="stop3148" />
-      <stop
-         id="stop3156"
-         offset="0.5"
-         style="stop-color:#006eff;stop-opacity:1;" />
-      <stop
-         style="stop-color:#00ffff;stop-opacity:1;"
-         offset="0.75"
-         id="stop3158" />
-      <stop
-         style="stop-color:#0079ff;stop-opacity:1;"
-         offset="1"
-         id="stop3150" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient2184"
-       id="linearGradient2190"
-       x1="8.00577"
-       y1="50.15"
-       x2="92.29423"
-       y2="50.15"
-       gradientUnits="userSpaceOnUse" />
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient2184"
-       id="radialGradient4579"
-       cx="50"
-       cy="50"
-       fx="50"
-       fy="50"
-       r="52"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(0.809436,0,0,0.809436,9.463433,9.592966)" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.72"
-     inkscape:cx="50"
-     inkscape:cy="55.181347"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     width="100px"
-     height="100px"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       style="fill:url(#radialGradient4579);fill-opacity:1;fill-rule:evenodd;stroke:#009c00;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 25.652153,41.970406 L 25.652153,33.876046 L 9.4634316,50.064767 L 25.652153,66.253488 L 25.652153,58.159127 L 74.218314,58.159127 L 74.218314,66.253488 L 90.407036,50.064767 L 74.218314,33.876046 L 74.218314,41.970406 L 25.652153,41.970406 z "
-       id="path1879"
-       sodipodi:nodetypes="ccccccccccc" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/x-axis.png b/dev/org.simantics.proconf.processeditor/icons/x-axis.png
deleted file mode 100644 (file)
index 8eb8a0d..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/x-axis.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/x-axis.svg b/dev/org.simantics.proconf.processeditor/icons/x-axis.svg
deleted file mode 100644 (file)
index e5c2293..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="D:\dev\icons"
-   sodipodi:docname="x-axis.svg"
-   inkscape:export-filename="D:\dev\icons\x-axis.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.7183778"
-     inkscape:cx="50"
-     inkscape:cy="49.989491"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showguides="true"
-     inkscape:guide-bbox="true"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:#00fd00;fill-opacity:0;stroke:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1958"
-       width="100"
-       height="100"
-       x="0"
-       y="952.36218" />
-    <text
-       xml:space="preserve"
-       style="font-size:79.64511871px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
-       x="22.170273"
-       y="1016.5383"
-       id="text2846"><tspan
-         sodipodi:role="line"
-         id="tspan2848"
-         x="22.170273"
-         y="1016.5383">X</tspan></text>
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 89.651844,1031.0133 L 4.4186832,1031.0133 M 77.083149,1048.3832 L 94.286422,1031.1799 L 77.551265,1014.4447"
-       id="path2850"
-       sodipodi:nodetypes="cc" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/x-plane.png b/dev/org.simantics.proconf.processeditor/icons/x-plane.png
deleted file mode 100644 (file)
index 6b57f1e..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/x-plane.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/x-plane.svg b/dev/org.simantics.proconf.processeditor/icons/x-plane.svg
deleted file mode 100644 (file)
index 316d3ce..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="D:\dev\icons"
-   sodipodi:docname="x-plane.svg"
-   inkscape:export-filename="D:\dev\icons\x-plane.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.7183778"
-     inkscape:cx="50"
-     inkscape:cy="63.68827"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showguides="true"
-     inkscape:guide-bbox="true"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:#00fd00;fill-opacity:0;stroke:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1958"
-       width="100"
-       height="100"
-       x="0"
-       y="952.36218" />
-    <text
-       xml:space="preserve"
-       style="font-size:90.08292227;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
-       x="28.756321"
-       y="1082.9758"
-       id="text2846"
-       sodipodi:linespacing="125%"
-       transform="scale(1.065357,0.938653)"><tspan
-         sodipodi:role="line"
-         id="tspan4650"
-         x="28.756321"
-         y="1082.9758">X</tspan></text>
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 89.651844,1031.0133 L 16.726969,1031.0133 M 77.083149,1048.3832 L 94.286422,1031.1799 L 77.551265,1031.0285"
-       id="path2850"
-       sodipodi:nodetypes="ccccc" />
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 20.588217,963.08889 L 20.588217,1034.8478 M 20.596956,975.65763 L 20.754816,958.45431 L 4.0196163,975.18943"
-       id="path4646"
-       sodipodi:nodetypes="ccccc" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/y-axis.png b/dev/org.simantics.proconf.processeditor/icons/y-axis.png
deleted file mode 100644 (file)
index ca60724..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/y-axis.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/y-axis.svg b/dev/org.simantics.proconf.processeditor/icons/y-axis.svg
deleted file mode 100644 (file)
index 65eddcf..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="D:\dev\icons"
-   sodipodi:docname="y-axis.svg"
-   inkscape:export-filename="D:\dev\icons\y-axis.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.7183778"
-     inkscape:cx="50"
-     inkscape:cy="49.989491"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showguides="true"
-     inkscape:guide-bbox="true"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:#00fd00;fill-opacity:0;stroke:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1958"
-       width="100"
-       height="100"
-       x="0"
-       y="952.36218" />
-    <text
-       xml:space="preserve"
-       style="font-size:79.64511871;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"
-       x="22.170273"
-       y="1016.5383"
-       id="text2846"
-       sodipodi:linespacing="125%"><tspan
-         sodipodi:role="line"
-         id="tspan4642"
-         x="22.170273"
-         y="1016.5383">Y</tspan></text>
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 89.651844,1031.0133 L 4.4186832,1031.0133 M 77.083149,1048.3832 L 94.286422,1031.1799 L 77.551265,1014.4447"
-       id="path2850"
-       sodipodi:nodetypes="cc" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/y-plane.png b/dev/org.simantics.proconf.processeditor/icons/y-plane.png
deleted file mode 100644 (file)
index 59c3a2b..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/y-plane.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/y-plane.svg b/dev/org.simantics.proconf.processeditor/icons/y-plane.svg
deleted file mode 100644 (file)
index 69d3814..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="D:\dev\icons"
-   sodipodi:docname="y-plane.svg"
-   inkscape:export-filename="D:\dev\icons\y-plane.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.7183778"
-     inkscape:cx="50"
-     inkscape:cy="63.68827"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showguides="true"
-     inkscape:guide-bbox="true"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:#00fd00;fill-opacity:0;stroke:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1958"
-       width="100"
-       height="100"
-       x="0"
-       y="952.36218" />
-    <text
-       xml:space="preserve"
-       style="font-size:90.08292227;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
-       x="28.756321"
-       y="1082.9758"
-       id="text2846"
-       sodipodi:linespacing="125%"
-       transform="scale(1.065357,0.938653)"><tspan
-         sodipodi:role="line"
-         id="tspan4648"
-         x="28.756321"
-         y="1082.9758">Y</tspan></text>
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 89.651844,1031.0133 L 16.726969,1031.0133 M 77.083149,1048.3832 L 94.286422,1031.1799 L 77.551265,1031.0285"
-       id="path2850"
-       sodipodi:nodetypes="ccccc" />
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 20.588217,963.08889 L 20.588217,1034.8478 M 20.596956,975.65763 L 20.754816,958.45431 L 4.0196163,975.18943"
-       id="path4646"
-       sodipodi:nodetypes="ccccc" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/z-axis.png b/dev/org.simantics.proconf.processeditor/icons/z-axis.png
deleted file mode 100644 (file)
index 11a5741..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/z-axis.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/z-axis.svg b/dev/org.simantics.proconf.processeditor/icons/z-axis.svg
deleted file mode 100644 (file)
index 02e200d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="D:\dev\icons"
-   sodipodi:docname="z-axis.svg"
-   inkscape:export-filename="D:\dev\icons\z-axis.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.7183778"
-     inkscape:cx="50"
-     inkscape:cy="49.989491"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showguides="true"
-     inkscape:guide-bbox="true"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:#00fd00;fill-opacity:0;stroke:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1958"
-       width="100"
-       height="100"
-       x="0"
-       y="952.36218" />
-    <text
-       xml:space="preserve"
-       style="font-size:79.64511871px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
-       x="20.097298"
-       y="1016.5383"
-       id="text2846"
-       sodipodi:linespacing="125%"><tspan
-         sodipodi:role="line"
-         id="tspan4644"
-         x="20.097298"
-         y="1016.5383">Z</tspan></text>
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 89.651844,1031.0133 L 4.4186832,1031.0133 M 77.083149,1048.3832 L 94.286422,1031.1799 L 77.551265,1014.4447"
-       id="path2850"
-       sodipodi:nodetypes="cc" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/icons/z-plane.png b/dev/org.simantics.proconf.processeditor/icons/z-plane.png
deleted file mode 100644 (file)
index d6e9f70..0000000
Binary files a/dev/org.simantics.proconf.processeditor/icons/z-plane.png and /dev/null differ
diff --git a/dev/org.simantics.proconf.processeditor/icons/z-plane.svg b/dev/org.simantics.proconf.processeditor/icons/z-plane.svg
deleted file mode 100644 (file)
index d1a654c..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="D:\dev\icons"
-   sodipodi:docname="z-plane.svg"
-   inkscape:export-filename="D:\dev\icons\z-plane.png"
-   inkscape:export-xdpi="14.4"
-   inkscape:export-ydpi="14.4">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.7183778"
-     inkscape:cx="50"
-     inkscape:cy="63.68827"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showguides="true"
-     inkscape:guide-bbox="true"
-     inkscape:window-width="1280"
-     inkscape:window-height="968"
-     inkscape:window-x="-4"
-     inkscape:window-y="-4" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="fill:#00fd00;fill-opacity:0;stroke:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1958"
-       width="100"
-       height="100"
-       x="0"
-       y="952.36218" />
-    <text
-       xml:space="preserve"
-       style="font-size:90.08292389px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
-       x="28.756321"
-       y="1082.9758"
-       id="text2846"
-       sodipodi:linespacing="125%"
-       transform="scale(1.065357,0.938653)"><tspan
-         sodipodi:role="line"
-         id="tspan4644"
-         x="28.756321"
-         y="1082.9758">Z</tspan></text>
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 89.651844,1031.0133 L 16.726969,1031.0133 M 77.083149,1048.3832 L 94.286422,1031.1799 L 77.551265,1031.0285"
-       id="path2850"
-       sodipodi:nodetypes="ccccc" />
-    <path
-       style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 20.588217,963.08889 L 20.588217,1034.8478 M 20.596956,975.65763 L 20.754816,958.45431 L 4.0196163,975.18943"
-       id="path4646"
-       sodipodi:nodetypes="ccccc" />
-  </g>
-</svg>
diff --git a/dev/org.simantics.proconf.processeditor/plugin.xml b/dev/org.simantics.proconf.processeditor/plugin.xml
deleted file mode 100644 (file)
index 3350141..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<?eclipse version="3.2"?>\r
-<plugin>\r
-   <extension\r
-         point="org.simantics.db.resourceAdapter">\r
-      <resource_adapter\r
-            adapter_class="fi.vtt.simantics.processeditor.handlers.Plant3DProjectAdapter"\r
-            operation="http://www.vtt.fi/Simantics/Layer0/1.0/Relations#HasProjectTypeAdapter"\r
-            type_uri="http://www.vtt.fi/Simantics/Plant3D/1.0/Types#Plant3DProjectType">\r
-      </resource_adapter>\r
-      <resource_adapter\r
-            adapter_class="fi.vtt.simantics.processeditor.adapters.NozzleConstraintAdapter"\r
-            operation="http://www.vtt.fi/Simantics/G3D/1.0/Relations#HasConstraints"\r
-            type_uri="http://www.vtt.fi/Simantics/Plant3D/1.0/Types#Nozzle">\r
-      </resource_adapter>\r
-      <resource_adapter\r
-            adapter_class="fi.vtt.simantics.processeditor.adapters.InlineComponentConstraintAdapter"\r
-            operation="http://www.vtt.fi/Simantics/G3D/1.0/Relations#HasConstraints"\r
-            type_uri="http://www.vtt.fi/Simantics/Plant3D/1.0/Types#InlineComponent">\r
-      </resource_adapter>\r
-      <resource_adapter\r
-            adapter_class="fi.vtt.simantics.processeditor.adapters.TurnComponentConstraintAdapter"\r
-            operation="http://www.vtt.fi/Simantics/G3D/1.0/Relations#HasConstraints"\r
-            type_uri="http://www.vtt.fi/Simantics/Plant3D/1.0/Types#TurnComponent">\r
-      </resource_adapter>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.editors">\r
-      <editor\r
-            class="fi.vtt.simantics.processeditor.views.ProcessEditorPart"\r
-            icon="icons/factory.png"\r
-            id="org.simantics.proconf.processeditor.planteditor"\r
-            name="Plant Editor">\r
-      </editor>\r
-      <editor\r
-            class="fi.vtt.simantics.processeditor.views.PipelineComponentEditorPart"\r
-            icon="icons/Component.png"\r
-            id="org.simantics.proconf.processeditor.componenteditor"\r
-            name="Component Editor">\r
-      </editor>\r
-      <editor\r
-            class="fi.vtt.simantics.processeditor.views.EquipmentEditorPart"\r
-            icon="icons/tank.png"\r
-            id="org.simantics.proconf.processeditor.equipmenteditor"\r
-            name="Equipment Editor">\r
-      </editor>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.views">\r
-      <view\r
-            class="fi.vtt.simantics.processeditor.views.PlantStructureView"\r
-            icon="icons/factory.png"\r
-            id="org.simantics.proconf.processeditor.plantstructure"\r
-            name="Plant Structure">\r
-      </view>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.commands">\r
-      <command\r
-            categoryId="org.simantics.proconf.processeditor.commands"\r
-            description="New Pipeline Component"\r
-            id="org.simantics.proconf.processeditor.commands.newComponent"\r
-            name="New Pipeline Component">\r
-      </command>\r
-      <command\r
-            categoryId="org.simantics.proconf.processeditor.commands"\r
-            description="New Equipment"\r
-            id="org.simantics.proconf.processeditor.commands.newEquipment"\r
-            name="New Equipment">\r
-      </command>\r
-      <command\r
-            categoryId="org.simantics.proconf.processeditor.commands"\r
-            description="New Plant"\r
-            id="org.simantics.proconf.processeditor.commands.newPlant"\r
-            name="New Plant">\r
-      </command>\r
-      <category\r
-            id="org.simantics.proconf.processeditor.commands"\r
-            name="Plant3D Commands">\r
-      </category>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.handlers">\r
-      <handler\r
-            class="fi.vtt.simantics.processeditor.handlers.NewPlantHandler"\r
-            commandId="org.simantics.proconf.processeditor.commands.newPlant">\r
-      </handler>\r
-      <handler\r
-            class="fi.vtt.simantics.processeditor.handlers.NewEquipmentHandler"\r
-            commandId="org.simantics.proconf.processeditor.commands.newEquipment">\r
-      </handler>\r
-      <handler\r
-            class="fi.vtt.simantics.processeditor.handlers.NewComponentHandler"\r
-            commandId="org.simantics.proconf.processeditor.commands.newComponent">\r
-      </handler>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.menus">\r
-      <menuContribution\r
-            locationURI="popup:#OEPopup?after=additions">\r
-         <command\r
-               commandId="org.simantics.proconf.processeditor.commands.newPlant"\r
-               icon="icons/factory.png"\r
-               id="org.simantics.proconf.processeditor.popups.newPlant"\r
-               label="New Plant"\r
-               style="push">\r
-            <visibleWhen>\r
-               <and>\r
-                  <with\r
-                        variable="activeContexts">\r
-                     <iterate\r
-                           ifEmpty="false"\r
-                           operator="or">\r
-                        <equals\r
-                              value="org.simantics.proconf.processeditor.plantmodelling">\r
-                        </equals>\r
-                     </iterate>\r
-                  </with>\r
-                  <with\r
-                        variable="selection">\r
-                     <and>\r
-                        <test\r
-                              args="http://www.vtt.fi/Simantics/Layer0/1.0/Types#Library"\r
-                              property="org.simantics.graph.resourceType">\r
-                        </test>\r
-                     </and>\r
-                  </with>\r
-               </and>\r
-            </visibleWhen>\r
-         </command>\r
-         <command\r
-               commandId="org.simantics.proconf.processeditor.commands.newEquipment"\r
-               icon="icons/tank.png"\r
-               id="org.simantics.proconf.processeditor.popups.newEquipment"\r
-               label="New Equipment"\r
-               style="push">\r
-            <visibleWhen>\r
-               <and>\r
-                  <with\r
-                        variable="activeContexts">\r
-                     <iterate\r
-                           ifEmpty="false"\r
-                           operator="or">\r
-                        <equals\r
-                              value="org.simantics.proconf.processeditor.plantmodelling">\r
-                        </equals>\r
-                     </iterate>\r
-                  </with>\r
-                  <with\r
-                        variable="selection">\r
-                     <and>\r
-                        <test\r
-                              args="http://www.vtt.fi/Simantics/Layer0/1.0/Types#Library"\r
-                              property="org.simantics.graph.resourceType">\r
-                        </test>\r
-                     </and>\r
-                  </with>\r
-               </and>\r
-            </visibleWhen>\r
-         </command>\r
-         <command\r
-               commandId="org.simantics.proconf.processeditor.commands.newComponent"\r
-               icon="icons/Component.png"\r
-               id="org.simantics.proconf.processeditor.popups.newComponent"\r
-               label="New  Component"\r
-               style="push">\r
-            <visibleWhen>\r
-               <and>\r
-                  <with\r
-                        variable="activeContexts">\r
-                     <iterate\r
-                           ifEmpty="false"\r
-                           operator="or">\r
-                        <equals\r
-                              value="org.simantics.proconf.processeditor.plantmodelling">\r
-                        </equals>\r
-                     </iterate>\r
-                  </with>\r
-                  <with\r
-                        variable="selection">\r
-                     <and>\r
-                        <test\r
-                              args="http://www.vtt.fi/Simantics/Layer0/1.0/Types#Library"\r
-                              property="org.simantics.graph.resourceType">\r
-                        </test>\r
-                     </and>\r
-                  </with>\r
-               </and>\r
-            </visibleWhen>\r
-         </command>\r
-      </menuContribution>\r
-   </extension>\r
-   <extension\r
-         point="org.simantics.proconf.ui.resourceEditorAdapter">\r
-      <adapterClass\r
-            class="fi.vtt.simantics.processeditor.handlers.Plant3DEditorAdapter"\r
-            id="org.simantics.proconf.processeditor.ResourceEditorDescription1">\r
-      </adapterClass>\r
-      <adapterClass\r
-            class="fi.vtt.simantics.processeditor.handlers.PipelineComponentEditorAdapter"\r
-            id="org.simantics.proconf.processeditor.ResourceEditorDescription2">\r
-      </adapterClass>\r
-      <adapterClass\r
-            class="fi.vtt.simantics.processeditor.handlers.EquipmentEditorAdapter"\r
-            id="org.simantics.proconf.processeditor.ResourceEditorDescription3">\r
-      </adapterClass>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.perspectives">\r
-      <perspective\r
-            class="fi.vtt.simantics.processeditor.perspectives.Plant3DModellingPerspective"\r
-            icon="icons/factory.png"\r
-            id="org.simantics.proconf.processeditor.plantmodelling"\r
-            name="3D Plant Modelling">\r
-      </perspective>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.perspectiveExtensions">\r
-      <perspectiveExtension\r
-            targetID="org.simantics.proconf.processeditor.plantmodelling">\r
-         <view\r
-               id="org.simantics.proconf.processeditor.plantstructure"\r
-               ratio="0.3"\r
-               relationship="left"\r
-               relative="org.eclipse.ui.editorss"\r
-               visible="true">\r
-         </view>\r
-         <view\r
-               id="org.simantics.proconf.browsing.views.property"\r
-               ratio="0.7"\r
-               relationship="bottom"\r
-               relative="org.simantics.proconf.processeditor.plantstructure"\r
-               visible="true">\r
-         </view>\r
-         <view\r
-               id="org.eclipse.pde.runtime.LogView"\r
-               relationship="fast"\r
-               relative="fi.vtt.proconf.ui.views.property"\r
-               visible="false">\r
-         </view>\r
-      </perspectiveExtension>\r
-   </extension>\r
-   <extension\r
-         point="org.simantics.proconf.g3d.geometry">\r
-      <Geometry\r
-            class="fi.vtt.simantics.processeditor.common.PipeComponentProvider"\r
-            id="org.simantics.proconf.processeditor.Geometry1">\r
-      </Geometry>\r
-   </extension>\r
-   <extension\r
-         point="org.simantics.proconf.ui.perspectiveContextBinding">\r
-      <binding\r
-            contextIds="org.simantics.proconf.processeditor.plantmodelling"\r
-            perspectiveId="org.simantics.proconf.processeditor.plantmodelling">\r
-      </binding>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.contexts">\r
-      <context\r
-            id="org.simantics.proconf.processeditor.plantmodelling"\r
-            name="Plant Modelling"\r
-            parentId="org.eclipse.ui.contexts.window">\r
-      </context>\r
-   </extension>\r
-\r
-</plugin>\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/Activator.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/Activator.java
deleted file mode 100644 (file)
index 9f2ad49..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor;\r
-\r
-import org.eclipse.ui.plugin.AbstractUIPlugin;\r
-import org.osgi.framework.BundleContext;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.db.management.ISessionContextChangedListener;\r
-import org.simantics.db.management.SessionContextChangedEvent;\r
-import org.simantics.proconf.ui.ProConfUI;\r
-\r
-\r
-\r
-\r
-/**\r
- * The activator class controls the plug-in life cycle\r
- */\r
-public class Activator extends AbstractUIPlugin {\r
-\r
-       // The plug-in ID\r
-       public static final String PLUGIN_ID = "fi.vtt.simantics.processeditor";\r
-\r
-       // The shared instance\r
-       private static Activator plugin;\r
-       \r
-       /**\r
-        * The constructor\r
-        */\r
-       public Activator() {\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)\r
-        */\r
-       public void start(BundleContext context) throws Exception {\r
-               super.start(context);\r
-               plugin = this;\r
-               ProConfUI.getSessionContextProvider().addContextChangedListener(new ISessionContextChangedListener() {\r
-                       @Override\r
-                       public void sessionContextChanged(SessionContextChangedEvent event) {\r
-                               ISessionContext ctx = event.getNewValue();\r
-                               if (ctx != null) {\r
-                                       ctx.getSession().asyncRead(new GraphRequestAdapter() {\r
-                                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                                       ProcessResource.initialize(g);\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               };\r
-                                       });\r
-                               } else {\r
-                                       ProcessResource.deinitialize();\r
-                               }\r
-                       }\r
-               });\r
-               try {\r
-                       ProConfUI.getSession().asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       ProcessResource.initialize(g);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-               } catch (Exception e) {\r
-                       \r
-               }\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)\r
-        */\r
-       public void stop(BundleContext context) throws Exception {\r
-               plugin = null;\r
-               super.stop(context);\r
-       }\r
-\r
-       /**\r
-        * Returns the shared instance\r
-        *\r
-        * @return the shared instance\r
-        */\r
-       public static Activator getDefault() {\r
-               return plugin;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/ProcessResource.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/ProcessResource.java
deleted file mode 100644 (file)
index a7df93c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor;\r
-\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.Graph;\r
-import org.simantics.proconf.g3d.stubs.G3DResource;\r
-\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.stubs.Plant3DResource;\r
-\r
-public class ProcessResource {\r
-       public static Builtins builtins;\r
-       public static G3DResource g3dResource;\r
-       public static Plant3DResource plant3Dresource;\r
-       \r
-       \r
-       public static void initialize(Graph g) {\r
-               ProcessResource.builtins = Builtins.getInstance(g);\r
-               ProcessResource.g3dResource = G3DResource.getInstance(g);\r
-               ProcessResource.plant3Dresource = Plant3DResource.getInstance(g);\r
-               ControlPointTools.initialize();\r
-       }\r
-       \r
-       public static void deinitialize() {\r
-               builtins = null;\r
-               g3dResource = null;\r
-               plant3Dresource = null;\r
-               ControlPointTools.deinitialize();\r
-       }\r
-       \r
-       public static boolean isInitialized() {\r
-               return builtins != null;\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertComponentAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertComponentAction.java
deleted file mode 100644 (file)
index 50f8fed..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.awt.event.KeyEvent;\r
-import java.awt.event.MouseEvent;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.vecmath.Point3d;\r
-\r
-import org.eclipse.swt.widgets.Display;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.GraphRequestWithResult;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.InteractiveAction;\r
-import org.simantics.proconf.g3d.base.G3DAPI;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.dnd.DropListener;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.utils.datastructures.Pair;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2.Direction;\r
-import fi.vtt.simantics.processeditor.dialogs.PipelineComponentDialog;\r
-import fi.vtt.simantics.processeditor.gizmo.PositionSelectionGizmo;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipelineComponent;\r
-\r
-\r
-\r
-/**\r
- * Action that inserts new components into pipe run.\r
- * - VariableLengthInlineComponents cannot be inserted with this action\r
- * - Assumes that SizeChangeComponent is dual connected\r
- * \r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class InsertComponentAction extends InteractiveAction implements DropListener, SplitPointListener {\r
-\r
-    Resource typeResource;                               // type of inserted component\r
-    Resource targetResource;                             // component where we are inserting new one\r
-    Resource selectedPosition;                           // selected control point for insertion\r
-    PositionType selectedType;                           // selected position type\r
-    List<Pair<Resource, PositionType>> insertPositions;\r
-    List<Pair<Point3d, PositionType>> insertPoints;\r
-    PositionSelectionGizmo gizmo = null;\r
-        \r
-    boolean activated = false;\r
-    \r
-    private SelectSplitPointAction splitPointAction;\r
-    \r
-    public InsertComponentAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        splitPointAction = new SelectSplitPointAction(parent,this);\r
-    }\r
-    \r
-    @Override\r
-    public void init() {\r
-        this.setText("Insert Component");\r
-        this.setToolTipText("Inserts a Component into Pipeline");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/Component.png"));\r
-    }\r
-    \r
-    @Override\r
-    public boolean usable(Graph graph, List<Resource> resources) {\r
-        if (!(resources.size() == 1)) {\r
-               return false;\r
-        }\r
-        IEntity target = EntityFactory.create(graph,resources.get(0));\r
-        \r
-        if (!target.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent)) {\r
-               return false;\r
-        }\r
-        PipelineComponent ic = new PipelineComponent(target);\r
-        PipeControlPoint pcp = ic.getControlPoint();\r
-        // one possibility: adding new component to unconnected position\r
-        // TODO : how about inserting new components between existing ones.\r
-        // TODO : can there be fixed length components that can be split (for example fixed length pipe)\r
-        if (pcp.getNext() == null && pcp.getPrevious() == null)\r
-               return true;\r
-        if (ic.isInstanceOf(ProcessResource.plant3Dresource.InlineComponent) && (pcp.getNext() == null || pcp.getPrevious() == null))\r
-                       return true;\r
-        for (PipeControlPoint p : pcp.getSubPoint())\r
-               // SubPoint's other connection is always null\r
-               // Exception: size change components offset point (that is subpoint)\r
-               //            does have one or both ends connected, but it won't matter\r
-               //            here because previous test fould return true, if insertion\r
-               //            is possible:\r
-               // TODO : here we assume that Size Change Component is dual connected\r
-               if (p.getNext() == null && p.getPrevious() == null) \r
-                       return true;\r
-        \r
-        if (target.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-               // last option to insert component is split variable length component.\r
-               // If user chooses to split the component, inserted component must be\r
-               // inline component, but not size change component\r
-               return true;\r
-               } \r
-        return false;\r
-    }\r
-    \r
-    @Override\r
-    public void activate() {\r
-       insertPositions = null;\r
-       if (targetResource == null) {\r
-               List<IGraphicsNode> mos = parent.getSelectionAdapter().getSelectedObjects();\r
-               if (mos.size() != 1) {\r
-                               end();\r
-                               return;\r
-                       }\r
-               IGraphicsNode startNode = mos.get(0);\r
-               targetResource = startNode.getResource();\r
-       }\r
-       if (selectedPosition == null) {\r
-               updateInsertPositions();\r
-        }\r
-        if (typeResource == null) {\r
-                       \r
-                       List<Resource> filter = new ArrayList<Resource>();\r
-                       filter.add(ProcessResource.plant3Dresource.VariableLengthInlineComponent);\r
-                       \r
-                       boolean containsEnd = false;\r
-                       for (Pair<Point3d, PositionType> p : insertPoints) {\r
-                               if (p.second == PositionType.NEXT || p.second == PositionType.PREVIOUS) {\r
-                                       containsEnd = true;\r
-                                       break;\r
-                               }\r
-                                       \r
-                       }\r
-                       if(!containsEnd)\r
-                               filter.add(ProcessResource.plant3Dresource.EndComponent);\r
-                       \r
-                       PipelineComponentDialog dialog = new PipelineComponentDialog(Display.getCurrent().getActiveShell(),null, filter , parent.getSession());\r
-                       if (dialog.open() == PipelineComponentDialog.CANCEL) {\r
-                               end();\r
-                               return;\r
-                       }\r
-                       typeResource = dialog.getComboValue();\r
-                       updateInsertPositions();\r
-        }\r
-        \r
-        activated = true;\r
-    }\r
-    \r
-    private void updateInsertPositions() {\r
-       parent.getSession().syncRead(new GraphRequestAdapter() {\r
-                       \r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               insertPositions = getInsertPositions(g,targetResource,typeResource);\r
-                               insertPoints = new ArrayList<Pair<Point3d,PositionType>>();\r
-                               for (Pair<Resource, PositionType> p : insertPositions) {\r
-                                       IEntity entity = EntityFactory.create(g,p.first);\r
-                                       Point3d pos = ControlPointTools.getRealPosition(entity, p.second);\r
-                                       insertPoints.add(new Pair<Point3d, PositionType>(pos,p.second));\r
-                               }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-    }\r
-    \r
-    /**\r
-     * Finds possible locations of inserted component\r
-     * \r
-     * TODO (s): currently allows only inline, non size change components to split variable length component\r
-     *           assumes that size change component is DualConnected component\r
-     * \r
-     * @param g\r
-     * @param target \r
-     * @param acceptSplit\r
-     * @return\r
-     */\r
-    private List<Pair<Resource, PositionType>> getInsertPositions(Graph g, Resource target, Resource typeResource) {\r
-       \r
-       boolean acceptSplit = true;\r
-       boolean checkSubPoints = !g.isInstanceOf(target, ProcessResource.plant3Dresource.DualInlineControlPoint);\r
-       if (typeResource != null)\r
-               acceptSplit = g.isInstanceOf(typeResource, ProcessResource.plant3Dresource.InlineComponent) &&\r
-                                        !g.isInstanceOf(typeResource, ProcessResource.plant3Dresource.SizeChangeComponent);\r
-\r
-       \r
-       List<Pair<Resource, PositionType>> insertPositions = new ArrayList<Pair<Resource,PositionType>>();\r
-               PipelineComponent ic = new PipelineComponent(g,target);\r
-           PipeControlPoint pcp = ic.getControlPoint();\r
-           if (pcp.getNext() == null) {\r
-               insertPositions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.NEXT));\r
-           }\r
-           if (pcp.getPrevious() == null) {\r
-               insertPositions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.PREVIOUS));\r
-           }\r
-           if (checkSubPoints) {\r
-               for (PipeControlPoint p : pcp.getSubPoint()) {\r
-                       if (p.getNext() == null && p.getPrevious() == null) {\r
-                               insertPositions.add(new Pair<Resource, PositionType>(p.getResource(),PositionType.PORT));\r
-                       }\r
-               }\r
-           }\r
-           if (acceptSplit && ic.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-               insertPositions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.SPLIT));\r
-           }\r
-           return insertPositions;\r
-    }\r
-    \r
-    @Override\r
-    public void update() {\r
-       if (splitPointAction.active()) {\r
-               splitPointAction.update();\r
-               return;\r
-        }\r
-        if (!activated) {\r
-            return;\r
-        }\r
-        if (insertPositions == null)\r
-               return;\r
-        if (insertPositions.size() == 0) {\r
-               end();\r
-               return;\r
-        }\r
-        if (insertPositions.size() == 1) {\r
-               activated = false;\r
-               insertComponent(insertPositions.get(0));\r
-               return;\r
-        }\r
-        \r
-        if (gizmo == null) {\r
-               gizmo = new PositionSelectionGizmo(parent,insertPoints);\r
-               parent.setGizmo(gizmo);\r
-               parent.getRenderingComponent().getNoShadowRoot().attachChild(gizmo.getNode());\r
-        }\r
-        gizmo.update();\r
-        if (gizmo.getSelected() >= 0 && input.mouseClicked() && input.clickButton() == MouseEvent.BUTTON1) {\r
-               activated = false;\r
-               insertComponent(insertPositions.get(gizmo.getSelected()));\r
-        }\r
-        if (input.keyPressed(KeyEvent.VK_ESCAPE)) {\r
-               end();\r
-        }\r
-    }\r
-    \r
-    private void insertComponent(Pair<Resource, PositionType> position) {\r
-       selectedPosition = position.first;\r
-       selectedType = position.second;\r
-       switch (selectedType) {\r
-       case NEXT:\r
-       case PREVIOUS:\r
-       case PORT:\r
-               parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               IEntity pcp = EntityFactory.create(g,selectedPosition);\r
-                               Point3d point = ControlPointTools.getRealPosition(pcp, selectedType);\r
-                               IEntity component = instantiateComponent(g,point);\r
-                               PipingTools2.insertComponent(component, EntityFactory.create(g, targetResource), pcp , Direction.NEXT);                                 \r
-                               endThreaded();\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-                       \r
-               });\r
-               break;\r
-       case SPLIT:\r
-               parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               PipeControlPoint pcp = new PipeControlPoint(g,selectedPosition);\r
-                               Point3d p1 = new Point3d();\r
-                               Point3d p2 = new Point3d();\r
-                               ControlPointTools.getInlineControlPointEnds(pcp, p1, p2);\r
-                               splitPointAction.setSplit(p1, p2);\r
-                       splitPointAction.activate();\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });             \r
-               break;\r
-       }\r
-    }\r
-    \r
-    private void endThreaded() {\r
-       parent.getRenderingComposite().getDisplay().asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               end();\r
-                       }\r
-               });\r
-    }\r
-    \r
-    @Override\r
-    public void setSplitPoint(final Point3d point) {\r
-       splitPointAction.deactivate();\r
-       if (point == null) {\r
-               end();\r
-               return;\r
-       }\r
-       parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               IEntity component = instantiateComponent(g,point);\r
-                               PipingTools2.splitVariableLengthComponent(component, EntityFactory.create(g,targetResource));\r
-                               \r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void requestCompleted(GraphRequestStatus status) {\r
-                               parent.getRenderingComposite().getDisplay().asyncExec(new Runnable(){\r
-                                       @Override\r
-                                       public void run() {\r
-                                               end();\r
-                                               \r
-                                       }\r
-                               });\r
-                       }\r
-               });\r
-    }\r
-    \r
-    /**\r
-     * instantiates selected component\r
-     * @param worldPosition position of the new component\r
-     */\r
-    private PipelineComponent instantiateComponent(Graph g,Point3d worldPosition) {\r
-       PipelineComponent target = new PipelineComponent(g,targetResource);\r
-       IEntity piperun = target.getParent();\r
-       PipelineComponent instance = PipingTools2.instantiatePipelineComponent(g,piperun.getResource(), typeResource);\r
-       G3DTools.resetTransformation(instance);\r
-       //G3DAPI.addNodeWorld(piperun, instance);\r
-       G3DAPI.setWorldPosition(instance, worldPosition);\r
-       return instance;\r
-    }\r
-    \r
-    @Override\r
-    public void deactivate() {\r
-        typeResource = null;\r
-        targetResource = null;\r
-        selectedPosition = null;\r
-        selectedType = null;\r
-        insertPoints = null;\r
-        insertPositions = null;\r
-        if (gizmo != null) {\r
-               parent.setGizmo(null);\r
-               gizmo = null;\r
-        }\r
-    }\r
-\r
-    public boolean acceptDrop(StructuredResourceSelection s, Resource[] ids) {\r
-               if(s.size() != 1)\r
-                       return false;\r
-               if (ids == null)\r
-                       return false;\r
-               if (ids.length != 1)\r
-                       return false;\r
-               \r
-               final Resource type = ids[0];\r
-               final Resource target = s.getSelectionList().get(0);\r
-               GraphRequestWithResult<Boolean> query = new GraphRequestWithResult<Boolean>() {\r
-                       @Override\r
-                       public Boolean performWithResult(Graph g) throws Exception {\r
-                               IEntity entity = EntityFactory.create(g, type);\r
-                               // dropped type must be pipeline component\r
-                               if (!entity.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent))\r
-                                       return false;\r
-                               // but not variable length inline component\r
-                               if (entity.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent))\r
-                                       return false;\r
-                               if (entity.getRelatedObjects(ProcessResource.plant3Dresource.HasGraphics).size() != 1)\r
-                                       return false;\r
-                       \r
-                               List<Pair<Resource, PositionType>> insertPositions = getInsertPositions(g,target,type);\r
-                               return insertPositions.size() > 0;      \r
-                       }\r
-               };\r
-               \r
-               parent.getSession().syncRead(query);\r
-               \r
-               return query.getResult();\r
-       }    \r
-    \r
-    public void doDrop(StructuredResourceSelection s, Resource[] ids) {\r
-               typeResource = ids[0];\r
-               targetResource = s.getSelectionList().get(0);\r
-               parent.setCurrentAction(this);\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertEquipmentAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertEquipmentAction.java
deleted file mode 100644 (file)
index 26556b8..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.GraphRequestWithResult;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.base.G3DAPI;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.dnd.DropListener;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-import fi.vtt.simantics.processeditor.dialogs.EquipmentDialog;\r
-import fi.vtt.simantics.processeditor.stubs.Equipment;\r
-\r
-public class InsertEquipmentAction extends ContextAction implements DropListener{\r
-\r
-       \r
-    public InsertEquipmentAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        this.setText("Insert Equipment");\r
-    }\r
-    \r
-    @Override\r
-    public void run() {\r
-       EquipmentDialog dialog = new EquipmentDialog(parent.getRenderingComposite().getShell(),"Insert Equipment",parent.getSession());\r
-       if (dialog.open() == EquipmentDialog.CANCEL)\r
-               return;\r
-       final Resource typeResource = dialog.getComboValue();\r
-       parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       createEquipment(g,typeResource);\r
-                   return GraphRequestStatus.transactionComplete();\r
-               }\r
-       });\r
-    }\r
-    \r
-  \r
-\r
-    \r
-    private void createEquipment(Graph graph,Resource typeResource) {\r
-       \r
-       //G3DNode instanceNode = new G3DNode(graph, instance);\r
-       Equipment instanceNode = PipingTools2.instantiateEquipment(graph, typeResource);\r
-       G3DNode plant = parent.getScenegraphAdapter().getRootNode().getG3DNode(graph); \r
-       \r
-       G3DAPI.addNodeWorld(plant, instanceNode);\r
-\r
-        //parent.getSelectionAdapter().updateSelection(new StructuredResourceSelection(instance)));\r
-    }\r
-    \r
-    public boolean usable(Graph graph,List<Resource> resources) {\r
-        return (resources.size() == 0);\r
-    }\r
-    \r
-\r
-    \r
-    public boolean acceptDrop(StructuredResourceSelection s, Resource[] ids) {\r
-               if(!s.isEmpty())\r
-                       return false;\r
-               if (ids == null)\r
-                       return false;\r
-               if (ids.length != 1)\r
-                       return false;\r
-               final Resource r = ids[0];\r
-               GraphRequestWithResult<Boolean> query = new GraphRequestWithResult<Boolean>() {\r
-                       @Override\r
-                       public Boolean performWithResult(Graph g) throws Exception {\r
-                               IEntity t = EntityFactory.create(g, r);\r
-                               if(!t.isInheritedFrom(ProcessResource.plant3Dresource.Equipment))\r
-                                       return false;\r
-                               if (t.getRelatedObjects(ProcessResource.plant3Dresource.HasGraphics).size() == 1)\r
-                                       return true;\r
-                               return false;\r
-                       }\r
-               };\r
-\r
-               parent.getSession().syncRead(query);\r
-               return query.getResult();\r
-       }\r
-    \r
-    public void doDrop(StructuredResourceSelection s, Resource[] ids) {\r
-               final Resource typeResource = ids[0];\r
-               parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               createEquipment(g,typeResource);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-               \r
-               \r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertNozzleAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/InsertNozzleAction.java
deleted file mode 100644 (file)
index 91733ab..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.GraphRequestWithResult;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.instantiation.Instance;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import org.simantics.proconf.g3d.actions.WriteAction;\r
-import org.simantics.proconf.g3d.base.G3DAPI;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.dnd.DropListener;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-import fi.vtt.simantics.processeditor.dialogs.NozzleDialog;\r
-import fi.vtt.simantics.processeditor.stubs.Equipment;\r
-import fi.vtt.simantics.processeditor.stubs.Nozzle;\r
-\r
-\r
-\r
-public class InsertNozzleAction extends WriteAction implements DropListener {\r
-\r
-    Resource equipmentResource = null;\r
-    Resource nozzleType = null;\r
-    \r
-    public InsertNozzleAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent,false);\r
-    }\r
-\r
-    @Override\r
-    public boolean canActivate() {\r
-       NozzleDialog dialog = new NozzleDialog(parent.getRenderingComposite().getShell(),"Select a nozzle", parent.getSession());\r
-       if (dialog.open() == NozzleDialog.CANCEL) {\r
-             equipmentResource = null;\r
-             return false;\r
-        }\r
-       Resource type = dialog.getComboValue();\r
-       if (type == null) {\r
-               equipmentResource = null;\r
-               return false;\r
-       }\r
-       nozzleType = type;      \r
-        return true;\r
-    }\r
-    \r
-    @Override\r
-    public GraphRequestStatus doChanges(Graph graph) throws Exception {\r
-       createNozzle(graph);\r
-       return GraphRequestStatus.transactionComplete();\r
-    }\r
-    \r
-    private void createNozzle(Graph graph) {\r
-       assert(nozzleType != null);\r
-       assert(equipmentResource != null);\r
-\r
-       Nozzle n = PipingTools2.instantiateNozzle(graph, nozzleType);\r
-       \r
-       Equipment equipment = new Equipment(graph, equipmentResource);\r
-       \r
-       G3DAPI.addNodeLocal(equipment,ProcessResource.plant3Dresource.HasNozzle, n);\r
-        //parent.getSelectionAdapter().updateSelection(new StructuredResourceSelection(n.getResource()));        \r
-        equipment = null;\r
-    }\r
-    \r
-    public boolean usable(Graph graph, List<Resource> resources) {\r
-        if (resources.size() != 1) {\r
-            return false;\r
-        }\r
-        Resource r = resources.iterator().next();\r
-        IEntity t = EntityFactory.create(graph,r);\r
-        if (t.isInstanceOf(ProcessResource.plant3Dresource.Equipment)) {\r
-            equipmentResource = r;\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-    \r
-    @Override\r
-    public void init() {\r
-        setText("Insert Nozzle");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/Nozzle.png"));\r
-    }\r
-    \r
-    public boolean acceptDrop(StructuredResourceSelection s, Resource[] ids) {\r
-               if(s.size() != 1)\r
-                       return false;\r
-               if (ids == null)\r
-                       return false;\r
-               if (ids.length != 1)\r
-                       return false;\r
-               final Resource r = ids[0];\r
-               final Resource selectedResource = s.iterator().next();\r
-               GraphRequestWithResult<Boolean> query = new GraphRequestWithResult<Boolean>() {\r
-                       @Override\r
-                       public Boolean performWithResult(Graph g) throws Exception {\r
-                               IEntity t = EntityFactory.create(g,r);\r
-                               if (!t.isInheritedFrom(ProcessResource.plant3Dresource.Nozzle))\r
-                                       return false;\r
-                               t = EntityFactory.create(g,selectedResource);\r
-                               if (t.isInstanceOf(ProcessResource.plant3Dresource.Equipment)) {\r
-                                       return true;\r
-                               }\r
-                               return false;\r
-                       }\r
-               };\r
-               parent.getSession().syncRead(query);\r
-               return query.getResult();\r
-       }\r
-    \r
-    public void doDrop(StructuredResourceSelection s, Resource[] ids) {\r
-       equipmentResource = s.iterator().next();\r
-       parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       createNozzle(g);\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-       });\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/PositionType.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/PositionType.java
deleted file mode 100644 (file)
index 0ab3a5b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-\r
-/**\r
- * Position types for inserting new components and routing new pipe\r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public enum PositionType {\r
-       SPLIT,\r
-       NEXT,\r
-       PREVIOUS,\r
-       PORT\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/ReversePipelineAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/ReversePipelineAction.java
deleted file mode 100644 (file)
index a75d7e0..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.WriteAction;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-import fi.vtt.simantics.processeditor.stubs.PipelineComponent;\r
-\r
-public class ReversePipelineAction extends WriteAction {\r
-       \r
-       public ReversePipelineAction(ThreeDimensionalEditorBase parent) {\r
-               super(parent,false);\r
-       }\r
-\r
-       @Override\r
-       public boolean usable(Graph graph, List<Resource> resources) {\r
-               if (resources.size() != 1)\r
-                       return false;\r
-               IEntity t = EntityFactory.create(graph, resources.get(0));\r
-               return (t.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent));\r
-       }\r
-       \r
-       @Override\r
-       public GraphRequestStatus doChanges(Graph graph) throws Exception {\r
-               Resource r = parent.getSelectionAdapter().getSelectedResources().get(0);\r
-               PipelineComponent comp = new PipelineComponent(graph, r);\r
-               PipingTools2.reversePipeRun(PipingTools2.getPipeRun(comp));\r
-\r
-               return GraphRequestStatus.transactionComplete();\r
-       }\r
-\r
-       \r
-       @Override\r
-       public void init() {\r
-               this.setText("Reverse pipeline");\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/RoutePipeAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/RoutePipeAction.java
deleted file mode 100644 (file)
index 00d7ac3..0000000
+++ /dev/null
@@ -1,1342 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.awt.event.KeyEvent;\r
-import java.awt.event.MouseEvent;\r
-import java.math.BigDecimal;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.GraphRequestWithResult;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.InteractiveAction;\r
-import org.simantics.proconf.g3d.base.ConstraintDetector;\r
-import org.simantics.proconf.g3d.base.G3DAPI;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.dnd.DropListener;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.utils.datastructures.Pair;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Line;\r
-import com.jme.scene.state.MaterialState;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.common.PipeComponentProvider;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2.Direction;\r
-import fi.vtt.simantics.processeditor.dialogs.PipelineDialog;\r
-import fi.vtt.simantics.processeditor.gizmo.PositionSelectionGizmo;\r
-import fi.vtt.simantics.processeditor.stubs.BranchEndControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-import fi.vtt.simantics.processeditor.stubs.PipelineComponent;\r
-import fi.vtt.simantics.processeditor.stubs.VariableLengthInlineComponent;\r
-import fi.vtt.simantics.processeditor.views.ProcessEditor;\r
-\r
-/**\r
- * Action for Routing Pipes\r
- * \r
- * FIXME : does several thing that should be done by PipingTools.\r
- * TODO : instead of using lines to show route of pipe, generate pipe and change it real-time\r
- * \r
- * @author MLMARKO\r
- *\r
- */\r
-public class RoutePipeAction extends InteractiveAction implements DropListener, SplitPointListener {\r
-       \r
-       \r
-       private static final ImageDescriptor X_AXIS_ICON = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/x-axis.png");\r
-       private static final ImageDescriptor Y_AXIS_ICON = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/y-axis.png");\r
-       private static final ImageDescriptor Z_AXIS_ICON = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/z-axis.png");\r
-       private static final ImageDescriptor X_PLANE_ICON = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/x-plane.png");\r
-       private static final ImageDescriptor Y_PLANE_ICON = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/y-plane.png");\r
-       private static final ImageDescriptor Z_PLANE_ICON = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/z-plane.png");\r
-    \r
-       private static final ImageDescriptor CAMERA_ICON = Activator.imageDescriptorFromPlugin("org.simantics.proconf.g3d", "icons/eye.png");\r
-    \r
-       \r
-       private Action xAxisAction;\r
-       private Action yAxisAction;\r
-       private Action zAxisAction;\r
-       private Action xPlaneAction;\r
-       private Action yPlaneAction;\r
-       private Action zPlaneAction;\r
-       \r
-       private Action cameraAction;\r
-       \r
-    ConstraintDetector detector = null;\r
-    \r
-    public RoutePipeAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        detector = new ConstraintDetector(parent);\r
-        xAxisAction = new Action("X",Action.AS_RADIO_BUTTON) {\r
-               public void run() {\r
-                       if (lock == LockType.X)\r
-                               setLockType(LockType.NONE,false);\r
-                       else\r
-                               setLockType(LockType.X,false);\r
-               }\r
-        };\r
-        xAxisAction.setImageDescriptor(X_AXIS_ICON);\r
-        xAxisAction.setToolTipText("Lock X-Axis");\r
-        yAxisAction = new Action("Y",Action.AS_RADIO_BUTTON) {\r
-               public void run() {\r
-                       if (lock == LockType.Y)\r
-                               setLockType(LockType.NONE,false);\r
-                       else\r
-                               setLockType(LockType.Y,false);\r
-               }\r
-        };\r
-        yAxisAction.setImageDescriptor(Y_AXIS_ICON);\r
-        yAxisAction.setToolTipText("Lock Y-Axis");\r
-        zAxisAction = new Action("Z",Action.AS_RADIO_BUTTON) {\r
-               public void run() {\r
-                       if (lock == LockType.Z)\r
-                               setLockType(LockType.NONE,false);\r
-                       else\r
-                               setLockType(LockType.Z,false);\r
-               }\r
-        };\r
-        zAxisAction.setImageDescriptor(Z_AXIS_ICON);\r
-        zAxisAction.setToolTipText("Lock Z-Axis");\r
-        xPlaneAction = new Action("X",Action.AS_RADIO_BUTTON) {\r
-               public void run() {\r
-                       if (lock == LockType.YZ)\r
-                               setLockType(LockType.NONE,false);\r
-                       else\r
-                               setLockType(LockType.YZ,false);\r
-               }\r
-        };\r
-        xPlaneAction.setImageDescriptor(X_PLANE_ICON);\r
-        xPlaneAction.setToolTipText("Lock X-Plane");\r
-        yPlaneAction = new Action("Y",Action.AS_RADIO_BUTTON) {\r
-               public void run() {\r
-                       if (lock == LockType.XZ)\r
-                               setLockType(LockType.NONE,false);\r
-                       else\r
-                               setLockType(LockType.XZ,false);\r
-               }\r
-        };\r
-        yPlaneAction.setImageDescriptor(Y_PLANE_ICON);\r
-        yPlaneAction.setToolTipText("Lock Y-Plane");\r
-        zPlaneAction = new Action("Z",Action.AS_RADIO_BUTTON) {\r
-               public void run() {\r
-                       if (lock == LockType.XY)\r
-                               setLockType(LockType.NONE,false);\r
-                       else\r
-                               setLockType(LockType.XY,false);\r
-               }\r
-        };\r
-        zPlaneAction.setImageDescriptor(Z_PLANE_ICON);\r
-        zPlaneAction.setToolTipText("Lock Z-Plane");\r
-        cameraAction = new Action("C", Action.AS_CHECK_BOX) {\r
-               public void run() {\r
-                       useCamera = this.isChecked();\r
-               }\r
-        };\r
-        cameraAction.setImageDescriptor(CAMERA_ICON);\r
-        cameraAction.setToolTipText("Use camera");\r
-        splitPointAction = new SelectSplitPointAction(parent,this);\r
-        \r
-    }\r
-    \r
-    public void fillToolBar(IToolBarManager manager) {\r
-        \r
-        manager.add(cameraAction);\r
-        cameraAction.setChecked(useCamera);\r
-       manager.add(xAxisAction);\r
-        manager.add(yAxisAction);\r
-        manager.add(zAxisAction);\r
-        manager.add(xPlaneAction);\r
-        manager.add(yPlaneAction);\r
-        manager.add(zPlaneAction);  \r
-        \r
-    }\r
-\r
-    enum LockType {NONE,X,Y,Z,XY,YZ,XZ,CUSTOM};\r
-    LockType lock = LockType.NONE;\r
-    \r
-    private void setLockType(LockType type, boolean force) {\r
-       if (force || lock != LockType.CUSTOM) {\r
-               lock = type;\r
-       }\r
-       xAxisAction.setChecked(false);\r
-       yAxisAction.setChecked(false);\r
-       zAxisAction.setChecked(false);\r
-       xPlaneAction.setChecked(false);\r
-       yPlaneAction.setChecked(false);\r
-       zPlaneAction.setChecked(false);\r
-       xAxisAction.setEnabled(true);\r
-       yAxisAction.setEnabled(true);\r
-       zAxisAction.setEnabled(true);\r
-       xPlaneAction.setEnabled(true);\r
-       yPlaneAction.setEnabled(true);\r
-       zPlaneAction.setEnabled(true);\r
-       switch (lock) {\r
-       case X:\r
-               xAxisAction.setChecked(true);\r
-               break;\r
-       case Y:\r
-               yAxisAction.setChecked(true);\r
-               break;\r
-       case Z:\r
-               zAxisAction.setChecked(true);\r
-               break;  \r
-       case XY:\r
-               zPlaneAction.setChecked(true);\r
-               break;  \r
-       case XZ:\r
-               yPlaneAction.setChecked(true);\r
-               break;  \r
-       case YZ:\r
-               xPlaneAction.setChecked(true);\r
-               break;  \r
-       case CUSTOM:\r
-               xAxisAction.setEnabled(false);\r
-               yAxisAction.setEnabled(false);\r
-               zAxisAction.setEnabled(false);\r
-               xPlaneAction.setEnabled(false);\r
-               yPlaneAction.setEnabled(false);\r
-               zPlaneAction.setEnabled(false);\r
-               break;\r
-       }\r
-    }\r
-    \r
-    private double BRANCH_SNAP_DISTANCE = 0.05;\r
-    private double NOZZLE_SNAP_DISTANCE = 0.05;\r
-    \r
-    private double istep = 10.0;\r
-    private int decimals = 2;\r
-    \r
-    private double pipeDiameter = 0.2;\r
-    private double elbowRadius = 0.5;\r
-    private double eps = 0.001;\r
-    \r
-    private ArrayList<Point3d> controlPoints = new ArrayList<Point3d>();\r
-\r
-    private Point3d currentPoint = new Point3d();\r
-    private Point3d lastPoint = new Point3d();\r
-    \r
-    private Vector3d customLockDir = null;\r
-    \r
-    private Line selectionLine;\r
-    private List<Line> pipeShapes = new ArrayList<Line>();\r
-    private MaterialState ms;\r
-    \r
-    \r
-    private Resource selectedPort = null;\r
-    private PositionType selectedType = null;\r
-    private Resource beginComponentResource = null;\r
-    \r
-    private Resource endComponentResource = null;\r
-    private Resource endComponentPort = null;\r
-    private PositionType endPortType = null;\r
-    \r
-    private Resource highlightedResource = null;\r
-    \r
-    private boolean useCamera = false;\r
-    \r
-    private List<Pair<Resource, PositionType>> positions = null;\r
-    \r
-    private SelectSplitPointAction splitPointAction;\r
-    private PositionSelectionGizmo gizmo = null;\r
-    \r
-    \r
-    \r
-    private enum ToolState{NOT_ACTIVE, INITIALIZING, SELECTING_POSITION, SELECTING_SPLIT, ROUTING};\r
-    private ToolState state = ToolState.NOT_ACTIVE;\r
-    \r
-    @Override\r
-    public void activate() {\r
-       state = ToolState.INITIALIZING;\r
-        controlPoints.clear();\r
-        if (beginComponentResource == null) {\r
-               List<IGraphicsNode> mos = parent.getSelectionAdapter().getSelectedObjects();\r
-            if (mos.size() != 1) {\r
-               end();\r
-                return;\r
-            }\r
-            beginComponentResource = mos.get(0).getResource();\r
-        }\r
-        parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       positions = checkStartNode(g,beginComponentResource);\r
-                       if (positions.size() == 0) {\r
-                               positions = null;\r
-                               end();\r
-                       } else {\r
-                               state = ToolState.SELECTING_POSITION;\r
-                       }\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-        });\r
-        \r
-        if (ms == null) {\r
-               ms = parent.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-            ms.setEmissive(new ColorRGBA(1.f,1.f,1.f,1.f));\r
-        }\r
-\r
-    }\r
-    \r
-    \r
-\r
-    @Override\r
-    public void deactivate() {\r
-        for (Line l : pipeShapes)\r
-               l.removeFromParent();\r
-         pipeShapes.clear();\r
-         if (selectionLine != null)\r
-               selectionLine.removeFromParent();\r
-         selectionLine = null;\r
-         customLockDir = null;\r
-         \r
-         setLockType(LockType.NONE,true);\r
-         beginComponentResource = null;\r
-         endComponentResource = null;\r
-         detector.clearConstraintHighlights(); \r
-         state = ToolState.NOT_ACTIVE;\r
-         selectedPort = null;\r
-         selectedType = null;\r
-        \r
-    }\r
-    \r
-    private List<Pair<Resource, PositionType>> checkStartNode(Graph g, Resource resource) {\r
-        List<Pair<Resource, PositionType>> positions = new ArrayList<Pair<Resource,PositionType>>();\r
-       \r
-       IEntity beginComponent = EntityFactory.create(g, resource);\r
-        \r
-        if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.Nozzle)) {\r
-               if (PipingTools2.isFreeNozzle(beginComponent)) {\r
-\r
-                               positions.add(new Pair<Resource, PositionType>(beginComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint).getResource(),PositionType.NEXT));\r
-               } \r
-        } else if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-               // variable length inline component is exception from other pipeline components,\r
-               // since a new pipe can branch it\r
-               VariableLengthInlineComponent vlic = new VariableLengthInlineComponent(beginComponent);\r
-            PipeControlPoint pcp = vlic.getControlPoint();\r
-            if (pcp.getNext() == null) {\r
-\r
-               positions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.NEXT));    \r
-            } else if (pcp.getPrevious() == null) {\r
-\r
-                positions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.PREVIOUS));\r
-            }\r
-            positions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.SPLIT));\r
-        } else if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.EndComponent)) {\r
-               PipelineComponent component = new PipelineComponent(beginComponent);            \r
-               PipeControlPoint pcp = component.getControlPoint();\r
-               if (pcp.getNext() == null && pcp.getPrevious() == null) { \r
-                       throw new RuntimeException("End component " + beginComponent.getResource() + " is not connected to anything.");\r
-                       //positions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.NEXT));\r
-               }\r
-               for (PipeControlPoint p : pcp.getSubPoint()) {\r
-                       if (p.getNext() == null && p.getPrevious() == null) {\r
-                               positions.add(new Pair<Resource, PositionType>(p.getResource(),PositionType.NEXT));\r
-                       }\r
-               }\r
-        } else if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent)) {\r
-               \r
-               PipelineComponent component = new PipelineComponent(beginComponent);\r
-               \r
-               PipeControlPoint pcp = component.getControlPoint();\r
-               if (pcp.getNext() == null) {\r
-                       positions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.NEXT));\r
-               } else if (pcp.getPrevious() == null) {\r
-                       positions.add(new Pair<Resource, PositionType>(pcp.getResource(),PositionType.PREVIOUS));\r
-               }\r
-               if (!beginComponent.isInstanceOf(ProcessResource.plant3Dresource.SizeChangeComponent)||\r
-                       !beginComponent.isInstanceOf(ProcessResource.plant3Dresource.OffsetComponent)) {\r
-                       for (PipeControlPoint p : pcp.getSubPoint()) {\r
-                               if (p.getNext() == null && p.getPrevious() == null) {\r
-                                       positions.add(new Pair<Resource, PositionType>(p.getResource(),PositionType.NEXT));\r
-                               }\r
-                       }\r
-               }       \r
-        } else {\r
-            return positions;\r
-        }\r
-        return positions;\r
-    }\r
-\r
-    @Override\r
-    public void update() {\r
-       \r
-       switch (state) {\r
-       case NOT_ACTIVE:\r
-               return; // TODO : throw Exception?\r
-       case INITIALIZING:\r
-               return;\r
-       case SELECTING_POSITION:\r
-               updateSelectPosition();\r
-               break;\r
-       case SELECTING_SPLIT:\r
-               updateSelectSplit();\r
-               break;\r
-       case ROUTING:\r
-               updateRouting();\r
-               break;\r
-       }\r
-       return;\r
-    }\r
-\r
-    private void updateSelectPosition() {\r
-       \r
-       if (positions == null) {\r
-               throw new RuntimeException("positions must be loaded before select position can be activated");\r
-        }\r
-        if (selectedPort != null) {\r
-               throw new RuntimeException("position is already selected");\r
-        }\r
-        if (positions.size() == 1) {\r
-                       selectedPort = positions.get(0).first;\r
-                       selectedType = positions.get(0).second;\r
-                       state = ToolState.INITIALIZING;\r
-                       \r
-                       \r
-                       \r
-                       if (requiresNewPipeRun()){\r
-                               if(!getNewPipeRunSpecs()) {\r
-                                       end();\r
-                                       return;\r
-                               }\r
-                       }\r
-                       if (selectedType == PositionType.SPLIT) {\r
-                               startSplitting();\r
-                       } else {\r
-                               startRouting();\r
-                       }\r
-\r
-               } else if (gizmo == null) {\r
-                       state = ToolState.INITIALIZING; // asyncRead!\r
-                       parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       List<Pair<Point3d, PositionType>> pos = new ArrayList<Pair<Point3d,PositionType>>();\r
-                                       for (Pair<Resource, PositionType> p : positions) {\r
-                                               IEntity entity = EntityFactory.create(g,p.first);\r
-                                               Point3d position = ControlPointTools.getRealPosition(entity, p.second);\r
-                                               pos.add(new Pair<Point3d, PositionType>(position,p.second));\r
-                                       }\r
-                                       gizmo = new PositionSelectionGizmo(parent, pos);\r
-                                       parent.setGizmo(gizmo);\r
-                                       parent.getRenderingComponent().getNoShadowRoot().attachChild(gizmo.getNode());\r
-                                       state = ToolState.SELECTING_POSITION;\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-                       \r
-               } else {\r
-                       gizmo.update();\r
-                       \r
-                       if (input.keyPressed(KeyEvent.VK_ESCAPE)) {\r
-                       state = ToolState.INITIALIZING;\r
-                       parent.setGizmo(null);\r
-                       gizmo = null;\r
-                       end();\r
-                       return;\r
-               }\r
-\r
-               if (gizmo.getSelected() >= 0 && input.mouseClicked() && input.clickButton() == MouseEvent.BUTTON1) {\r
-                       state = ToolState.INITIALIZING; // asyncRead!\r
-                       parent.setGizmo(null);\r
-                       selectedPort = positions.get(gizmo.getSelected()).first;\r
-                       selectedType = positions.get(gizmo.getSelected()).second;\r
-                       gizmo = null;\r
-                       \r
-                       if (selectedType == PositionType.SPLIT) {\r
-                               startSplitting();       \r
-                       return;\r
-                       } else {\r
-                               startRouting();\r
-                       }\r
-               } \r
-               \r
-               if (useCamera) {\r
-                       parent.getDefaultAction().update();\r
-                       return;\r
-               }\r
-               }\r
-        \r
-    }\r
-    \r
-    private boolean requiresNewPipeRun() {\r
-       GraphRequestWithResult<Boolean> createsNewPipeline = new GraphRequestWithResult<Boolean>() {\r
-                       @Override\r
-                       public Boolean performWithResult(Graph g) throws Exception {\r
-                               if(g.isInstanceOf(selectedPort, ProcessResource.plant3Dresource.NozzleControlPoint))\r
-                                       return true;\r
-                               if (selectedType == PositionType.SPLIT)\r
-                                       return true;\r
-                               return false;\r
-                               \r
-                       }\r
-               };\r
-               parent.getSession().syncRead(createsNewPipeline);\r
-               return createsNewPipeline.getResult();\r
-    }\r
-    \r
-    private boolean getNewPipeRunSpecs() {\r
-       PipelineDialog dialog;\r
-               dialog = new PipelineDialog(parent.getRenderingComposite().getShell(),pipeDiameter,elbowRadius);\r
-               if (dialog.open() == PipelineDialog.CANCEL) {\r
-                       end();\r
-                       return false;\r
-               }\r
-               pipeDiameter = dialog.getPipeDiameter();\r
-               elbowRadius = dialog.getTurnRadius();\r
-               return true;\r
-    }\r
-    \r
-    private void startRouting() {\r
-       state = ToolState.INITIALIZING;\r
-       parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               PipeControlPoint pcp = new PipeControlPoint(g,selectedPort);\r
-                               lastPoint = ControlPointTools.getRealPosition(pcp, selectedType);//G3DTools.getPoint(pcp.getWorldPosition());\r
-                               if (pcp.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)) {\r
-                                       lock = LockType.CUSTOM;\r
-                                       customLockDir = ControlPointTools.getDirectedControlPointDirection(pcp);\r
-                               } else if (pcp.isInstanceOf(ProcessResource.plant3Dresource.FixedLengthControlPoint)||\r
-                                                  pcp.isInstanceOf(ProcessResource.plant3Dresource.TurnControlPoint)) {\r
-                                       lock = LockType.CUSTOM;\r
-                                       if (selectedType == PositionType.NEXT)\r
-                                               customLockDir = ControlPointTools.getPathLegDirection(pcp, Direction.NEXT);\r
-                                       else\r
-                                               customLockDir = ControlPointTools.getPathLegDirection(pcp, Direction.PREVIOUS);\r
-                               } else {\r
-                                       lock = LockType.NONE;\r
-                               }\r
-                               IEntity pipeRun = ControlPointTools.getPipeRun(pcp);\r
-                               if (pipeRun != null) {\r
-                                       pipeDiameter = pipeRun.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasPipeDiameter);\r
-                                       elbowRadius = pipeRun.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasTurnRadius);\r
-                               }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void requestCompleted(GraphRequestStatus status) {\r
-                               createLine();\r
-                               state = ToolState.ROUTING;\r
-                       }\r
-               });\r
-    }\r
-    \r
-    private void startSplitting() {\r
-       parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               PipeControlPoint pcp = new PipeControlPoint(g,selectedPort);\r
-                               Point3d p1 = new Point3d();\r
-                               Point3d p2 = new Point3d();\r
-                               ControlPointTools.getInlineControlPointEnds(pcp, p1, p2);\r
-                               splitPointAction.setSplit(p1, p2);\r
-                       splitPointAction.activate();\r
-                       state = ToolState.SELECTING_SPLIT;\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               }); \r
-    }\r
-    \r
-   \r
-    private void updateSelectSplit() {\r
-       if (splitPointAction.active()) {\r
-               splitPointAction.update();\r
-               return;\r
-       } else {\r
-               throw new RuntimeException("SplitPointAction should be active");\r
-       }\r
-    }\r
-    \r
-    @Override\r
-    public void setSplitPoint(Point3d point) {\r
-       splitPointAction.deactivate();\r
-       if (point == null) {\r
-               end();\r
-               return;\r
-       } else {\r
-               \r
-                       \r
-               lastPoint = point;\r
-               createLine();\r
-               state = ToolState.ROUTING;\r
-       }\r
-    }\r
-    \r
-    private void updateRouting() {\r
-       if(input.keyPressed(KeyEvent.VK_ESCAPE)) {\r
-            controlPoints.clear();\r
-            end();\r
-            return;\r
-        }\r
-       if (input.keyPressed(KeyEvent.VK_C)) {\r
-               useCamera = !useCamera;\r
-               cameraAction.setChecked(useCamera);\r
-        }\r
-        if (useCamera) {\r
-               parent.getDefaultAction().update();\r
-               return;\r
-        }\r
-        \r
-        parent.getSession().syncRead(new GraphRequestAdapter() {\r
-                @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-        \r
-        Vector3d o = new Vector3d();\r
-        Vector3d d = new Vector3d();\r
-        parent.createPickRay(o, d);\r
-        if (!updateCurrentPoint(o, d))\r
-            return GraphRequestStatus.transactionComplete();\r
-        //Point3d startPoint = new Point3d();\r
-        double mu[] = new double[2];\r
-        \r
-        IEntity endTo = null;\r
-        PositionType endType = null;\r
-        IEntity endPort = null;\r
-        \r
-        if (parent.getSelectionAdapter().getHighlightSelection().size() > 0) {\r
-               highlightedResource = parent.getSelectionAdapter().getHighlightSelection().getSelectionList().get(0);\r
-        } else {\r
-               highlightedResource = null;\r
-        }\r
-\r
-          if (highlightedResource != null) {\r
-                 IEntity highlightNode = EntityFactory.create(g,highlightedResource);\r
-                    \r
-                 if (lock == LockType.NONE) {\r
-                         if (highlightNode.isInstanceOf(ProcessResource.plant3Dresource.Nozzle) && endingToNozzle(highlightNode,o,d)) {\r
-                                 endTo = highlightNode;\r
-                         } else if (highlightNode.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-                                 endTo = highlightNode;\r
-                                 endType = endingToStraight(new VariableLengthInlineComponent(highlightNode),mu,o,d);     \r
-                         } else if (highlightNode.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent) && (endPort = endingToComponent(highlightNode,o,d)) != null) {\r
-                                 endTo = highlightNode;\r
-                         } else {\r
-                                 updateRoute(o,d); \r
-                         }\r
-                 } else {  \r
-                         if (highlightNode.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)  && (endType = endingLockToStraight(new VariableLengthInlineComponent(highlightNode),mu)) != null) {\r
-                                 endTo = highlightNode;\r
-                         } else if (highlightNode.isInstanceOf(ProcessResource.plant3Dresource.Nozzle) && endingLockToNozzle(highlightNode)) {\r
-                                 endTo = highlightNode;\r
-                         } else if (highlightNode.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent) && (endPort = endingLockToComponent(highlightNode)) != null) {\r
-                                 endTo = highlightNode;\r
-                         } else {\r
-                                 updateRoute(o,d);\r
-                         }\r
-                 }\r
-                               \r
-              \r
-        } else {\r
-            updateRoute(o,d);\r
-        }\r
-        \r
-        parent.setViewChanged(true);\r
-        if (input.mouseClicked()) {\r
-            if (input.clickButton() == MouseEvent.BUTTON1) {\r
-                if (controlPoints.size() > 0) {\r
-                    addPoint();\r
-                    setLockType(LockType.NONE,true);\r
-                    if (endTo != null) {\r
-                        endComponentResource = endTo.getResource();\r
-                        if (endPort != null)\r
-                               endComponentPort = endPort.getResource();\r
-                        endPortType = endType;\r
-                        \r
-                        endPiping();\r
-                    }\r
-                } else {\r
-                       throw new RuntimeException("kjf");\r
-//                     // user was selecting position of branch\r
-//                    lastPoint.set(startPoint);\r
-//                    controlPoints.add(new Point3d(startPoint));\r
-//                    if (selectionLine != null)\r
-//                     selectionLine.removeFromParent();\r
-//                    selectionLine = null;\r
-                }\r
-            } else if (input.clickButton() == MouseEvent.BUTTON2){\r
-                detector.updateConstraintReference();\r
-            } else if (input.clickButton() == MouseEvent.BUTTON3){      \r
-                endPiping();\r
-            }\r
-        }\r
-        \r
-        return GraphRequestStatus.transactionComplete();\r
-               } \r
-         });\r
-       \r
-    }\r
-    \r
-    private void createLine() {\r
-       controlPoints.add(new Point3d(lastPoint));\r
-       Line line = new Line();\r
-       line.setRenderState(ms);\r
-      \r
-       PipeComponentProvider.createStraightEdges(line, currentPoint, currentPoint, pipeDiameter*0.5);\r
-       pipeShapes.add(line);\r
-       parent.getRenderingComponent().getNoShadowRoot().attachChild(line);    \r
-       line.setCullMode(Geometry.CULL_NEVER);\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Adds current point to pipeline\r
-     *\r
-     */\r
-    private void addPoint() {\r
-       \r
-       controlPoints.add(new Point3d(currentPoint));\r
-        Line line = new Line();\r
-        line.setRenderState(ms);\r
-        PipeComponentProvider.createStraightEdges(line, controlPoints.get(controlPoints.size() - 1), currentPoint, pipeDiameter*0.5);\r
-       pipeShapes.add(line);\r
-       parent.getRenderingComponent().getNoShadowRoot().attachChild(line);   \r
-       line.setCullMode(Geometry.CULL_NEVER);\r
-        lastPoint.set(currentPoint);\r
-    }\r
-    \r
-    /**\r
-     * Updates tool graphics for current point \r
-     */\r
-    private void updateCurrentPoint() {\r
-       PipeComponentProvider.createStraightEdges(pipeShapes.get(pipeShapes.size() - 1), controlPoints.get(controlPoints.size() - 1), currentPoint, pipeDiameter*0.5);\r
-    }\r
-    \r
-    /**\r
-     * Removes last point from pipeline\r
-     */\r
-    public void removePoint() {\r
-       if (controlPoints.size() < 2)\r
-               return;\r
-       controlPoints.remove(controlPoints.size() - 1);\r
-\r
-        pipeShapes.get(pipeShapes.size() - 1).removeFromParent();\r
-        pipeShapes.remove(pipeShapes.size() - 1);\r
-        PipeComponentProvider.createStraightEdges(pipeShapes.get(pipeShapes.size() - 1), controlPoints.get(controlPoints.size() - 1), currentPoint, pipeDiameter*0.5);\r
-       \r
-        lastPoint.set(controlPoints.get(controlPoints.size()-1));\r
-        if (controlPoints.size() < 2 && customLockDir != null) {\r
-               setLockType(LockType.CUSTOM, true);\r
-        }\r
-    }\r
-    \r
-   \r
-    \r
-    private boolean endingToNozzle(IEntity nozzle,Vector3d o, Vector3d d) { \r
-        IEntity pcp = nozzle.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint);\r
-        if (pcp != null && (pcp.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasNext) != null ||\r
-                                   pcp.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasPrevious) != null))\r
-               return false; // nozzle is already connected to pipe\r
-        currentPoint = G3DTools.getPoint(nozzle.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-        Point3d previousPipePoint = controlPoints.get(controlPoints.size() - 1);\r
-        Point3d p = detector.getSnappedPoint(o, d, new Vector3d(previousPipePoint));\r
-        if (p != null) {\r
-            if (p.distance(currentPoint) > NOZZLE_SNAP_DISTANCE) {\r
-                return false;\r
-            }\r
-        } \r
-        \r
-        updateCurrentPoint();\r
-        \r
-        setInfoText("Connect to nozzle " + currentPoint);\r
-        return true;\r
-    \r
-    }\r
-    \r
-    private PositionType endingToStraight(VariableLengthInlineComponent s, double mu[], Vector3d o, Vector3d d) {\r
-        String info = "";\r
-        Point3d sStart = new Point3d();\r
-        Point3d sEnd = new Point3d();\r
-        //detector.clearConstraintHighlights();\r
-        \r
-        Point3d previousPipePoint = controlPoints.get(controlPoints.size() - 1);\r
-        //String st = "";\r
-        if (lock == LockType.NONE) {\r
-            Point3d p = detector.getSnappedPoint(o, d, new Vector3d(previousPipePoint));\r
-            if (p != null) {\r
-                currentPoint = p;\r
-                // snapping is detected, check if snapped point can create branch with straight\r
-                PositionType t = endingLockToStraight(s, mu);\r
-                if (t != null)\r
-                    return t;\r
-                // if not, we'll have to remove highlight that was added when snapped point was detected\r
-                detector.clearConstraintHighlights();\r
-            } \r
-                \r
-            PipingTools2.getInlineComponentEnds(s, sStart, sEnd);\r
-            Vector3d sDir = new Vector3d(sEnd);\r
-            sDir.sub(sStart);\r
-            MathTools.intersectStraightStraight(sStart, sDir, o, d, currentPoint, new Point3d(), mu);\r
-            \r
-\r
-        } else {\r
-            throw new RuntimeException("Lock shouldn't be on");\r
-\r
-        }\r
-        \r
-        updateCurrentPoint();\r
-        \r
-        // branch point must lie between straight's ends. If connection point is exactly\r
-        // on straight end user may want to connect pipes to each other\r
-        // TODO : take account sizes of inline components)\r
-        // TODO : actually make connection if its detected\r
-        boolean connectPrev = false;\r
-        boolean connectNext = false;\r
-        \r
-        if (mu[0] < 0.0) {\r
-            currentPoint.set(sStart);\r
-            connectPrev = true;\r
-        }\r
-        else if (mu[0] > 1.0) {\r
-            currentPoint.set(sEnd);\r
-            connectNext = true;\r
-        }\r
-        boolean connect = false;\r
-        if (connectPrev) {\r
-            PipeControlPoint pcp = s.getControlPoint();\r
-            if (pcp.getPrevious() == null)\r
-                connect = true;\r
-        } else if (connectNext) {\r
-               PipeControlPoint pcp = s.getControlPoint();\r
-            if (pcp.getNext() == null)\r
-                connect = true;\r
-        }\r
-        \r
-        updateCurrentPoint();\r
-        \r
-        if (connect)\r
-            info += "Connect pipes :";\r
-        else\r
-            info += "Make Branch :";\r
-        \r
-        setInfoText(info + currentPoint + " " + Math.max(0.0, Math.min(mu[0], 1.0)));\r
-        if (connect) {\r
-               if (connectNext) {\r
-                       return PositionType.NEXT;\r
-               } else {\r
-                       return PositionType.PREVIOUS;\r
-               }\r
-                       \r
-        }\r
-        return PositionType.SPLIT;\r
-               \r
-    }\r
-    \r
-    private IEntity endingToComponent(IEntity component, Vector3d o, Vector3d d) {\r
-       // TODO : scan all empty pcps of the component and select closest one.\r
-       return null;\r
-    }\r
-    \r
-    private PositionType endingLockToStraight(VariableLengthInlineComponent s, double mu[]) {\r
-        \r
-        Point3d sStart = new Point3d();//G3DTools.getPoint(s.getHasControlPoint().getPreviousPoint().getLocalPosition());\r
-        Point3d sEnd = new Point3d(); //G3DTools.getPoint(s.getHasControlPoint().getNextPoint().getLocalPosition());\r
-        PipingTools2.getInlineComponentEnds(s, sStart, sEnd);\r
-        Vector3d sDir = new Vector3d(sEnd);\r
-        sDir.sub(sStart);\r
-        Vector3d dir = new Vector3d(currentPoint);\r
-        Point3d prev = controlPoints.get(controlPoints.size() - 1);\r
-        dir.sub(prev);\r
-        // intersection point in pipe where branch would be inserted to\r
-        Vector3d branchPoint = new Vector3d();\r
-        // intersection point in straight pipe that is currently routed\r
-        Vector3d routePoint = new Vector3d();\r
-        MathTools.intersectStraightStraight(sStart, sDir, new Vector3d(prev), dir, branchPoint, routePoint, mu);\r
-        routePoint.sub(branchPoint);\r
-        // startPoint of branch must be between pipe ends\r
-        // TODO : take account sizes of elbows (or other components)\r
-        // branch point must be between pipe ends and intersection points must be quite close to each othert\r
-        if (mu[0] > 0.0 && mu[0] < 1.0 && routePoint.lengthSquared() < BRANCH_SNAP_DISTANCE) {\r
-            currentPoint.set(branchPoint);\r
-            \r
-            updateCurrentPoint();\r
-            \r
-            setInfoText("Make branch (l) :" + currentPoint + " " + Math.max(0.0, Math.min(mu[0], 1.0)) + " " + routePoint.lengthSquared());\r
-            return PositionType.SPLIT;\r
-        }\r
-        return null;\r
-    }\r
-    \r
-    private boolean endingLockToNozzle(IEntity nozzle) {\r
-        Vector3d dir = new Vector3d(currentPoint);\r
-         Point3d prev = controlPoints.get(controlPoints.size() - 1);\r
-         dir.sub(prev);\r
-         Point3d nozzleLoc = G3DTools.getPoint(nozzle.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-         double u[] = new double[1];\r
-         Vector3d closest = MathTools.closestPointOnStraight(new Point3d(nozzleLoc), new Point3d(prev), new Vector3d(dir), u);\r
-         double dist = nozzleLoc.distanceSquared(new Point3d(closest));\r
-         if (dist < BRANCH_SNAP_DISTANCE) {\r
-                // FIXME : directions should be checked (insert an elbow)\r
-                currentPoint.set(nozzleLoc);\r
-                updateCurrentPoint();\r
-                setInfoText("Connect to nozzle (l) :" + currentPoint);\r
-                return true;\r
-         } \r
-         //System.out.println(u[0]);\r
-       return false;\r
-    }\r
-    \r
-    private IEntity endingLockToComponent(IEntity component) {\r
-       // we'll must scan all free pcp's and their direction to accept the connection.\r
-       return null;\r
-    }\r
-    \r
-    private void updateRoute(Vector3d o, Vector3d d) {\r
-        detector.clearConstraintHighlights();\r
-        Point3d previousPipePoint = controlPoints.get(controlPoints.size() - 1);\r
-        String s = "";\r
-        if (lock == LockType.NONE) {\r
-            Point3d p = detector.getSnappedPoint(o, d, new Vector3d(previousPipePoint));\r
-            if (p != null)\r
-                currentPoint = p;\r
-            s += detector.getSnapString();\r
-\r
-        } else {\r
-            Vector3d dir = new Vector3d(currentPoint);\r
-            dir.sub(previousPipePoint);\r
-            Point3d p = detector.getPointSnap(new Vector3d(previousPipePoint), dir);\r
-            if (p != null)\r
-                currentPoint = p;\r
-            s += detector.getSnapString();\r
-\r
-        }\r
-        \r
-        updateCurrentPoint();\r
-        s += currentPoint.toString();\r
-        setInfoText(s);\r
-    }\r
-    \r
-    private boolean updateCurrentPoint(Vector3d o, Vector3d d) {\r
-       if (lock != LockType.CUSTOM) {\r
-               if (input.keyPressed(KeyEvent.VK_X)) {\r
-                               if (lock == LockType.X)\r
-                                       setLockType(LockType.YZ,false);\r
-                               else\r
-                                       setLockType(LockType.X,false);\r
-                       }\r
-                       if (input.keyPressed(KeyEvent.VK_Y)) {\r
-                               if (lock == LockType.Y)\r
-                                       setLockType(LockType.XZ,false);\r
-                               else\r
-                                       setLockType(LockType.Y,false);\r
-                       }\r
-                       if (input.keyPressed(KeyEvent.VK_Z)) {\r
-                               if (lock == LockType.Z)\r
-                                       setLockType(LockType.XY,false);\r
-                               else\r
-                                       setLockType(LockType.Z,false);\r
-                       }\r
-                       if (input.keyPressed(KeyEvent.VK_N)) {\r
-                               setLockType(LockType.NONE,false);\r
-                       }\r
-                       if (input.keyPressed(KeyEvent.VK_BACK_SPACE)) {\r
-                               removePoint();\r
-                       }\r
-       }\r
-        Vector3d point = new Vector3d(lastPoint);\r
-        boolean step = ((input.moveModifiers() & MouseEvent.CTRL_DOWN_MASK) > 0);\r
-        switch(lock) {\r
-        case X:\r
-            MathTools.intersectStraightStraight(point, new Vector3d(1.0,0.0,0.0), o,d, currentPoint, new Vector3d());\r
-            if (step) {\r
-                currentPoint.x = Math.round(istep * currentPoint.x) / istep;\r
-                BigDecimal bx = new BigDecimal(currentPoint.x);\r
-                bx.setScale(decimals, BigDecimal.ROUND_HALF_UP);\r
-                currentPoint.x = bx.doubleValue();\r
-            }\r
-            break;\r
-        case Y:\r
-            MathTools.intersectStraightStraight(point, new Vector3d(0.0,1.0,0.0), o,d, currentPoint, new Vector3d());\r
-            if (step) {\r
-                currentPoint.y = Math.round(istep * currentPoint.y) / istep;\r
-                BigDecimal bx = new BigDecimal(currentPoint.y);\r
-                bx.setScale(decimals, BigDecimal.ROUND_HALF_UP);\r
-                currentPoint.y = bx.doubleValue();\r
-            }\r
-            break;\r
-        case Z:\r
-            MathTools.intersectStraightStraight(point, new Vector3d(0.0,0.0,1.0), o,d, currentPoint, new Vector3d());\r
-            if (step) {\r
-                currentPoint.z = Math.round(istep * currentPoint.z) / istep;\r
-                BigDecimal bx = new BigDecimal(currentPoint.z);\r
-                bx.setScale(decimals, BigDecimal.ROUND_HALF_UP);\r
-                currentPoint.z = bx.doubleValue();\r
-            }break;\r
-        case XY:\r
-            MathTools.intersectStraightPlane(o, d, point, new Vector3d(0.0,0.0,1.0), currentPoint);\r
-            break;\r
-        case XZ:\r
-            MathTools.intersectStraightPlane(o, d, point, new Vector3d(0.0,1.0,0.0), currentPoint);\r
-            break;\r
-        case YZ:\r
-            MathTools.intersectStraightPlane(o, d, point, new Vector3d(1.0,0.0,0.0), currentPoint);\r
-            break;\r
-        case NONE:\r
-            Vector3d normal = parent.getCamera().getUnNormalizedHeading();\r
-            normal.normalize();\r
-            \r
-            MathTools.intersectStraightPlane(o, d, point, normal, currentPoint);\r
-            break;\r
-        case CUSTOM:\r
-               MathTools.intersectStraightStraight(point, new Vector3d(customLockDir), o,d, currentPoint, new Vector3d());\r
-            double dist = MathTools.distanceFromPlane(new Vector3d(currentPoint), customLockDir, lastPoint);\r
-               if (dist < 0.0)\r
-                       currentPoint.set(lastPoint);\r
-            break;\r
-        default:\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-    \r
-   \r
-    private ArrayList<Point3d> filterPoints() {\r
-        ArrayList<Point3d> filteredControlPoints = new ArrayList<Point3d>();\r
-        \r
-        //  this loop filters control points that are not needed\r
-        for (int i = 0; i < controlPoints.size() - 2; i++) {\r
-            Point3d start = controlPoints.get(i);\r
-            if (i == 0)\r
-                filteredControlPoints.add(start);\r
-            \r
-            Point3d middle = controlPoints.get(i+1);\r
-            Point3d end = controlPoints.get(i+2);\r
-            \r
-            Vector3d dir1 = new Vector3d(middle);\r
-            dir1.sub(start);\r
-            Vector3d dir2 = new Vector3d(end);\r
-            dir2.sub(middle);\r
-            double angle = dir1.angle(dir2);\r
-            if (angle > eps && angle < (Math.PI - eps))\r
-                filteredControlPoints.add(middle);\r
-            // if angle is near PI pipe turns back to where it started\r
-            // if angle is near zero, pipe is straight and there's no need for control point\r
-            \r
-            if (i == controlPoints.size() - 3)\r
-                filteredControlPoints.add(end);\r
-            \r
-        } \r
-        return filteredControlPoints;\r
-    }\r
-    \r
-    private PipeControlPoint connectPipeStart(Graph graph, PipeRun pipeRun, boolean reversed) {\r
-       PipeControlPoint pcp = new PipeControlPoint(graph,selectedPort);\r
-        IEntity beginComponent = EntityFactory.create(graph,beginComponentResource);\r
-        if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.Nozzle)) {\r
-               PipingTools2.linkNozzleAndPipeRun(beginComponent, pipeRun);\r
-               // TODO : set diameters same\r
-               //reversed = false;\r
-               \r
-        } else if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-               switch (selectedType) {\r
-               case NEXT:\r
-                       {\r
-                               PipeControlPoint tcp = createTurn(graph, pipeRun, 0);\r
-                               connectControlPoints(pcp, tcp, reversed);\r
-                               return tcp;\r
-                       }\r
-               case PREVIOUS:\r
-                       {\r
-                               PipeControlPoint tcp = createTurn(graph, pipeRun, 0);\r
-                               connectControlPoints(pcp, tcp, reversed);\r
-                               return tcp;\r
-                       }\r
-               case SPLIT:\r
-                       //reversed = false;\r
-                       // 1. create (non visible) splitting component.\r
-                       PipelineComponent newComponent = PipingTools2.instantiatePipelineComponent(graph, PipingTools2.getPipeRun(beginComponent).getResource(), ProcessResource.plant3Dresource.BranchSplitComponent);                 \r
-                       PipeControlPoint mainCP = newComponent.getControlPoint();\r
-                       // 2. create control point for the branch\r
-                       BranchEndControlPoint becp = BranchEndControlPoint.createDefault(graph);\r
-                       mainCP.addSubPoint(becp);\r
-                       pipeRun.addControlPoints(becp);\r
-                       pcp = becp.toPipeControlPoint();\r
-                       ControlPointTools.setWorldPosition(mainCP, controlPoints.get(0));\r
-                       \r
-                       PipingTools2.splitVariableLengthComponent(newComponent, beginComponent);\r
-               }\r
-        } else if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent)) {\r
-               //if (selectedType == PositionType.PREVIOUS)\r
-                       //reversed = true;\r
-               //else\r
-                       //reversed = false;\r
-        } else {\r
-               throw new RuntimeException("unknown starting component");\r
-        }\r
-        \r
-        return pcp;\r
-    }\r
-    \r
-    private PipeControlPoint connectPipeEnd(Graph graph, PipeRun pipeline, boolean reversed) {\r
-        PipeControlPoint pcp = null;\r
-        IEntity endComponent = null;\r
-        if (endComponentResource != null)\r
-               endComponent = EntityFactory.create(graph, endComponentResource);\r
-        if (endComponent == null) {\r
-               return null;\r
-        } else if (endComponent.isInstanceOf(ProcessResource.plant3Dresource.Nozzle)){\r
-               pcp = new PipeControlPoint(endComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint));\r
-               PipingTools2.linkNozzleAndPipeRun(endComponent, pipeline);\r
-        } else if (endComponent.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-           assert(endPortType != null);\r
-           if (endPortType == PositionType.SPLIT) {\r
-                  //System.out.println(lastPoint + " " + currentPoint + " " + positions.get(positions.size() - 1));\r
-                  Point3d pos = lastPoint;\r
-                  // 1. create (non visible) splitting component.\r
-                  PipelineComponent newComponent = PipingTools2.instantiatePipelineComponent(graph, PipingTools2.getPipeRun(endComponent).getResource(), ProcessResource.plant3Dresource.BranchSplitComponent);\r
-                         \r
-                          PipeControlPoint mainCP = newComponent.getControlPoint();\r
-                          // 2. create control point for the branch\r
-                          BranchEndControlPoint becp = BranchEndControlPoint.createDefault(graph);\r
-                          mainCP.addSubPoint(becp);\r
-                          pipeline.addControlPoints(becp);\r
-                          pcp = becp.toPipeControlPoint();\r
-                          ControlPointTools.setWorldPosition(mainCP, pos);\r
-                          \r
-                          PipingTools2.splitVariableLengthComponent(newComponent, endComponent);\r
-           } else {\r
-                  \r
-           }      \r
-        } else if (endComponent.isInstanceOf(ProcessResource.plant3Dresource.FixedLengthInlineComponent)) {\r
-               // attach to selected port, reverse the piperun if needed\r
-               pcp = new PipeControlPoint(graph,endComponentPort);\r
-               if (!reversed && pcp.getPrevious() != null || reversed && pcp.getNext() != null) {\r
-                       PipingTools2.reversePipeRun(ControlPointTools.getPipeRun(pcp));\r
-               }\r
-        }\r
-        return pcp;\r
-    }\r
-    \r
-    private PipeControlPoint createTurn(Graph coreTC,PipeRun pipeRun, int i) {\r
-       PipelineComponent elbow = PipingTools2.instantiatePipelineComponent(coreTC,pipeRun.getResource(), ProcessResource.plant3Dresource.Elbow);\r
-        G3DAPI.setWorldPosition(elbow, controlPoints.get(i));\r
-        return elbow.getControlPoint();\r
-    }\r
-    \r
-    private PipeControlPoint createInline(Graph graph, PipeRun pipeRun, int i) {\r
-       Point3d p1 = controlPoints.get(i-1);\r
-       Point3d p2 = controlPoints.get(i);\r
-       Vector3d v = new Vector3d(p2);\r
-       v.sub(p1);\r
-       double length = v.length();\r
-       v.scale(0.5);\r
-       v.add(p1);\r
-       PipelineComponent straight = PipingTools2.instantiatePipelineComponent(graph,pipeRun.getResource(), ProcessResource.plant3Dresource.Straight);\r
-       G3DAPI.setWorldPosition(straight, v);\r
-       straight.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, length);\r
-        return straight.getControlPoint();\r
-       \r
-    }\r
-    \r
-    private void connectControlPoints(PipeControlPoint previous, PipeControlPoint pcp, boolean reversed) {\r
-        if (previous != null) {\r
-               PipeControlPoint sccp;\r
-               PipeControlPoint ocp;\r
-               if (previous.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                       sccp = previous;\r
-                       ocp = sccp.getSubPoint().iterator().next();\r
-               } else if (previous.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                       ocp = previous;\r
-                       sccp = ocp.getSubPointOf();\r
-               } else {\r
-                       if (!reversed) {\r
-                                       previous.setNext(pcp);\r
-                                       pcp.setPrevious(previous);\r
-                               } else {\r
-                                       previous.setPrevious(pcp);\r
-                                       pcp.setNext(previous);\r
-                               }\r
-                       return;\r
-               }\r
-               if (!reversed) {\r
-                               sccp.setNext(pcp);\r
-                               ocp.setNext(pcp);\r
-                               pcp.setPrevious(ocp);\r
-                       } else {\r
-                               sccp.setPrevious(pcp);\r
-                               ocp.setPrevious(pcp);\r
-                               pcp.setNext(sccp);\r
-                       }\r
-               \r
-        }\r
-    }\r
-    \r
-    private void endPiping() {\r
-        state = ToolState.NOT_ACTIVE;\r
-         \r
-        if (controlPoints.size() > 2)   // if there's only two control points, filtering does nothing\r
-            controlPoints = filterPoints();\r
-        \r
-        if (controlPoints.size() > 1) {\r
-            parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph graph) throws Exception {\r
-                       PipeRun pipeline = null;\r
-                    boolean reversed;\r
-                    PipelineComponent beginComponent = new PipelineComponent(graph,beginComponentResource);\r
-                    if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.Nozzle) ||\r
-                               selectedType == PositionType.SPLIT) {\r
-\r
-                       \r
-//                      \r
-                        pipeline = PipeRun.createDefault(graph);\r
-                        ((ProcessEditor) parent).getPlant(graph).addChild(pipeline);\r
-                        pipeline.setPipeDiameter(pipeDiameter);\r
-                        pipeline.setTurnRadius(elbowRadius);\r
-                        reversed = false;\r
-                    } else if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.SizeChangeComponent)||\r
-                               beginComponent.isInstanceOf(ProcessResource.plant3Dresource.OffsetComponent)){\r
-                       PipeControlPoint pcp = new PipeControlPoint(graph,selectedPort);\r
-                       if (selectedType == PositionType.NEXT) {\r
-                               // get the piperun from offsetpoint\r
-                               reversed = false;\r
-                               pipeline = pcp.getSubPoint().iterator().next().getControlPointOfPipeRun();\r
-                       } else if (selectedType == PositionType.PREVIOUS) {\r
-                               reversed = true;\r
-                               pipeline = pcp.getControlPointOfPipeRun();\r
-                       } else {\r
-                               throw new RuntimeException("Wrong PsoitionType " + selectedType + " for a SizeChangeComponent");\r
-                       }\r
-                       \r
-                    } else if (beginComponent.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent)) {\r
-                       \r
-                        pipeline = new PipeRun(beginComponent.getParent());\r
-                        if (selectedType == PositionType.PREVIOUS) {\r
-                               reversed = true;\r
-                        } else {\r
-                               reversed = false;\r
-                        }\r
-                    } else {\r
-                        throw new RuntimeException("Cannot start routing pipe : object not supported!");\r
-                    }\r
-\r
-                    PipeControlPoint previous = null;\r
-                    for (int i = 0; i < controlPoints.size(); i++) {\r
-                        PipeControlPoint pcp = null;\r
-                        if (i == 0) {\r
-                            pcp = connectPipeStart(graph, pipeline,reversed);\r
-\r
-                        } else {\r
-                               pcp = createInline(graph, pipeline, i);\r
-                               connectControlPoints(previous, pcp, reversed);\r
-                               previous = pcp;\r
-                               if (i == controlPoints.size() - 1) {\r
-                                        pcp = connectPipeEnd(graph, pipeline, reversed);\r
-                               } else {\r
-                               \r
-                                pcp = createTurn(graph,pipeline,i);\r
-                            }\r
-                        }\r
-                           \r
-                        if (pcp != null) {\r
-                               connectControlPoints(previous, pcp, reversed);\r
-                               //pipeline.addSgetHasControlPointSet().add(pcp);\r
-                               previous = pcp;\r
-                        }\r
-                    }\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-               \r
-               @Override\r
-               public void requestCompleted(GraphRequestStatus status) {\r
-                       endThreaded();\r
-               }\r
-            });\r
-\r
-                \r
-            \r
-        } else {\r
-            endThreaded();     \r
-        }\r
-    }\r
-    \r
-    private void endThreaded() {\r
-       parent.getRenderingComposite().getDisplay().asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               end();\r
-                       }\r
-               });\r
-    }\r
-\r
-    @Override\r
-    public void init() {\r
-        this.setText("Route pipe");\r
-        this.setToolTipText("Starts routing a new pipeline");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/Straight.png"));\r
-    }\r
-\r
-    @Override\r
-    public boolean usable(Graph g, List<Resource> resources) {\r
-        if (resources.size() != 1) {\r
-               return false;\r
-        }\r
-        return checkStartNode(g,resources.get(0)).size() > 0;\r
-    }\r
-    \r
-   \r
-    \r
-  public boolean acceptDrop(StructuredResourceSelection s, Resource[] ids) {\r
-       if (s.size() != 1)\r
-               return false;\r
-       if (ids == null)\r
-               return false;\r
-       if (ids.length != 1)\r
-               return false;\r
-       final Resource dropped = ids[0];\r
-       final Resource target = s.iterator().next();\r
-       GraphRequestWithResult<Boolean> query = new GraphRequestWithResult<Boolean>() {\r
-               @Override\r
-               public Boolean performWithResult(Graph g) throws Exception {\r
-                       if(!g.isInstanceOf(dropped, ProcessResource.plant3Dresource.VariableLengthInlineComponent))\r
-                               return false;\r
-                       // TODO : check that type is not abstract\r
-                       List<Resource> list = new ArrayList<Resource>();\r
-                       list.add(target);\r
-                       return usable(g, list);\r
-               }\r
-       };\r
-       parent.getSession().syncRead(query);\r
-       return query.getResult();\r
-  }\r
-  \r
-   public void doDrop(StructuredResourceSelection s, Resource[] ids) {\r
-          beginComponentResource = s.iterator().next(); \r
-          parent.setCurrentAction(this);\r
-   }\r
-   \r
-   public void setInfoText(String text) {\r
-          \r
-   }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/SelectSplitPointAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/SelectSplitPointAction.java
deleted file mode 100644 (file)
index 1b004e9..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.awt.event.MouseEvent;\r
-import java.util.List;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.actions.InteractiveAction;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-\r
-import com.jme.math.Vector3f;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.Line;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-public class SelectSplitPointAction extends InteractiveAction {\r
-       \r
-       Point3d start;\r
-       Point3d end;\r
-       Vector3d dir;\r
-       \r
-    Line line;\r
-    \r
-    boolean activated;\r
-    \r
-    SplitPointListener listener;\r
-    \r
-    public SelectSplitPointAction(ThreeDimensionalEditorBase parent, SplitPointListener listener) {\r
-               super(parent);\r
-               this.listener = listener;\r
-       }\r
-    \r
-    \r
-    public void setSplit(Point3d start, Point3d end) {\r
-       this.start = start;\r
-       this.end = end;\r
-       dir = new Vector3d(end);\r
-               dir.sub(start);\r
-    }\r
-       \r
-       \r
-       @Override\r
-       public void activate() {\r
-               if (start == null) throw new RuntimeException("Starting split action without information about range");\r
-               \r
-//             start = new Point3d();\r
-//             end = new Point3d();\r
-//             PipingTools.getStraightPipeEnds(PipingTools.getPipeline(straight),\r
-//                             straight, startStart, startEnd);\r
-    \r
-        line = new Line();\r
-        MaterialState ms = parent.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-        ms.setEmissive(new ColorRGBA(1.f,1.f,1.f,1.f));\r
-        line.setRenderState(ms);\r
-        parent.getRenderingComponent().getNoShadowRoot().attachChild(line);\r
-        activated = true;\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public boolean usable(Graph graph, List<Resource> resources) {\r
-//             if (resources.size() != 1)\r
-//                     return false;\r
-//             IEntity entity = EntityFactory.create(graph, resources.get(0));\r
-//             if (entity.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-//                     return true;\r
-//             }\r
-               // This is not a standalone action\r
-               return false;\r
-       }\r
-       \r
-       @Override\r
-       public void deactivate() {\r
-               line.removeFromParent();\r
-               activated = false;\r
-               start = null;\r
-               end = null;\r
-               dir = null;\r
-               \r
-       }\r
-       \r
-       public boolean active() {\r
-               return activated;\r
-       }\r
-       \r
-       @Override\r
-       public void update() {\r
-               if (!activated) {\r
-                       return;\r
-               }\r
-               if (input.mouseClicked() && input.clickButton() == MouseEvent.BUTTON3) {\r
-                       listener.setSplitPoint(null);\r
-                       activated = false;\r
-                       return;\r
-               }\r
-               Vector3d o = new Vector3d();\r
-               Vector3d d = new Vector3d();\r
-               parent.createPickRay(o, d);\r
-\r
-               Vector3d normal = parent.getCamera().getUnNormalizedHeading();\r
-               normal.normalize();\r
-               normal.negate();\r
-               // reference point for selection line\r
-               Vector3d point = new Vector3d(start);\r
-               Vector3d currentPoint = new Vector3d();\r
-               MathTools.intersectStraightPlane(o, d, point, normal, currentPoint);\r
-               Point3d startPoint = new Point3d();\r
-               double mu[] = new double[2];\r
-               MathTools.intersectStraightStraight(start, dir, o, d, startPoint,\r
-                               new Point3d(), mu);\r
-               // startPoint of branch must be between pipe ends\r
-               // TODO : take account sizes of elbows (or other components)\r
-               if (mu[0] < 0.0)\r
-                       startPoint.set(start);\r
-               else if (mu[0] > 1.0)\r
-                       startPoint.set(end);\r
-\r
-               Vector3f verts[] = new Vector3f[2];\r
-               verts[0] = VecmathJmeTools.get(startPoint);\r
-               verts[1] = VecmathJmeTools.get(currentPoint);\r
-               line.reconstruct(BufferUtils.createFloatBuffer(verts), null, null, null);\r
-\r
-               parent.setViewChanged(true);\r
-               if (input.mouseClicked() && input.clickButton() == MouseEvent.BUTTON1) {\r
-                       listener.setSplitPoint(new Point3d(startPoint));\r
-               }\r
-               \r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/SplitPointListener.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/SplitPointListener.java
deleted file mode 100644 (file)
index d766ad3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import javax.vecmath.Point3d;\r
-\r
-/**\r
- * SplitPointListener is used by SplitPointAction to pass the selected split point.\r
- * Implementing class must set itself as active action into editor (SplitPointAction won't close automatically). \r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public interface SplitPointListener {\r
-\r
-       /**\r
-        * Sets selected split point, or null if user cancelled the action.\r
-        * @param point\r
-        */\r
-       public void setSplitPoint(Point3d point);\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateElbowAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateElbowAction.java
deleted file mode 100644 (file)
index b500e0c..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.util.List;\r
-\r
-import javax.vecmath.AxisAngle4f;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.ConstrainedTransformAction;\r
-import org.simantics.proconf.g3d.actions.TranslateActionConstraints;\r
-import org.simantics.proconf.g3d.base.G3DAPI;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.gizmo.TransformInlineGizmo;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.stubs.DirectedControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.VariableAngleTurnComponent;\r
-\r
-public class TranslateElbowAction extends ConstrainedTransformAction {\r
-\r
-    TransformInlineGizmo gizmo;\r
-    List<IGraphicsNode> mos;\r
-    Vector3d dir;\r
-    Vector3d orgPos;\r
-    double istep = 10.0;\r
-    int decimals = 2;\r
-    \r
-    private Resource pcpResource;\r
-    \r
-    public TranslateElbowAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        gizmo = new TransformInlineGizmo(component.getDisplaySystem().getRenderer());\r
-    \r
-        \r
-    }\r
-    \r
-    public void init() {\r
-        this.setText("Translate directed");\r
-        this.setToolTipText("Translate the elbow in connections direction");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/translate_d.png"));\r
-    }\r
-    \r
-    \r
-    \r
-    @Override\r
-    public boolean usable(Graph graph, List<Resource> resources) {\r
-       // TODO : it should be possible to move multiple components on the same straight\r
-       // TODO : checking against elbow and dcp; these are not correct!\r
-        if (resources.size() != 1)\r
-            return false;\r
-        IEntity r = EntityFactory.create(graph,resources.get(0));\r
-        if (r.isInstanceOf(ProcessResource.plant3Dresource.VariableAngleTurnComponent)) {\r
-               VariableAngleTurnComponent e = new VariableAngleTurnComponent(r);\r
-               PipeControlPoint pcp = e.getControlPoint();\r
-               PipeControlPoint prev = ControlPointTools.findPreviousEnd(pcp);\r
-               PipeControlPoint next = ControlPointTools.findNextEnd(pcp);\r
-               DirectedControlPoint dcp = null;\r
-               int directedCount = 0;\r
-               if (prev != null && prev.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)) {\r
-                       directedCount++;\r
-                       dcp = new DirectedControlPoint(prev);\r
-               }\r
-               if (next != null && next.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)) {\r
-                       directedCount++;\r
-                       dcp = new DirectedControlPoint(next);\r
-               }\r
-               if (directedCount == 1) {\r
-                       orgPos = G3DTools.getVector(dcp.getWorldPosition());\r
-                       dir = ControlPointTools.getDirectedControlPointDirection(dcp);\r
-                       pcpResource = pcp.getResource();\r
-                       return true;\r
-               }\r
-               } \r
-               return false;\r
-\r
-    }\r
-    \r
-    @Override\r
-    public void deactivate() {\r
-        parent.setGizmo(null);\r
-        super.deactivate();\r
-    }\r
-\r
-    @Override\r
-    public void activate() {\r
-        parent.setGizmo(gizmo);\r
-\r
-        String text = "";\r
-        mos = parent.getSelectionAdapter().getSelectedObjects();\r
-//        for (IGraphicsNode mo : mos) {\r
-//            text += GraphicsNodeTools.getWorldTranslation(mo.getGraphicsNode());//mo.getWorldPosition() + " ";\r
-//        }\r
-\r
-        mos.iterator().next().getGroup().attachChild(gizmo.getNode());\r
-        setInfoText(text);    \r
-           \r
-        Vector3d front = new Vector3d(1.0,0.0,0.0);\r
-        Vector3d current = new Vector3d(dir);\r
-        float angle = (float)current.angle(front);\r
-        AxisAngle4f aa;\r
-        if (angle < 0.01 || (Math.PI - angle) < 0.01) {\r
-            aa = new AxisAngle4f();\r
-        } else {\r
-            current.normalize();\r
-            Vector3d right = new Vector3d();\r
-            right.cross(front, current);\r
-\r
-            right.normalize();\r
-            if (right.lengthSquared() < 0.01) {\r
-                aa = new AxisAngle4f();\r
-            } else {\r
-                aa = new AxisAngle4f((float) right.x, (float) right.y, (float) right.z, angle);\r
-            }\r
-        }\r
-        gizmo.setRotation(aa);\r
-        \r
-        updateGizmo();\r
-        TranslateActionConstraints.addConstraints(new Resource[]{pcpResource}, detector);\r
-        parent.setViewChanged(true);\r
-    }\r
-    \r
-    \r
-    \r
-    Vector3d getTranslate() {\r
-        Vector3d translate = new Vector3d();\r
-        Vector3d o = new Vector3d();\r
-        Vector3d d = new Vector3d();\r
-        parent.createPickRay(o, d);\r
-        //Vector3d p = gizmo.getPosition();\r
-        if (gizmo.isSelected()) {\r
-            double s[] = new double[1];\r
-           \r
-            Vector3d i1 = new Vector3d();\r
-            Vector3d i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight(orgPos, dir,o, d, i2, i1,s);\r
-            translate.set(dir);\r
-            if (s[0] < 0.0)\r
-                s[0] = 0.0;\r
-            \r
-            translate.scale(s[0]);\r
-            translate.add(orgPos);\r
-            \r
-            if (useConstraints) {\r
-                Vector3d t = new Vector3d(translate);\r
-//              FIXME : snapped point may be outside of proper range\r
-                Point3d snap = detector.getPointSnap2(t, dir);\r
-                if (snap != null) {\r
-                    translate = new Vector3d(snap);\r
-                }\r
-            }\r
-        \r
-            return translate;\r
-        }\r
-        return null;\r
-    }\r
-    \r
-    Vector3d prevTranslate = new Vector3d();\r
-    \r
-    @Override\r
-    public void doChanges(Graph g) throws Exception {\r
-        if (input.mousePressed()) {\r
-            //prevTranslate = getTranslate();\r
-            \r
-        }\r
-        if (input.mouseClicked()) {\r
-            end();\r
-            return;\r
-        }\r
-        if (!input.mouseDragged()) {\r
-            parent.getDefaultAction().update();\r
-            return;\r
-        }   \r
-        parent.setViewChanged(true);\r
-        \r
-        \r
-        List<IGraphicsNode> mos = parent.getSelectionAdapter().getSelectedObjects();\r
-        Vector3d translate = getTranslate();\r
-       \r
-        if (translate == null) {\r
-            //cameraRotateAction.update();\r
-            parent.getDefaultAction().update();\r
-            updateGizmo();\r
-            return;\r
-        }\r
-\r
-        String text = "";\r
-               for (IGraphicsNode mo : mos) {\r
-                       G3DNode node = mo.getG3DNode(g);\r
-                       G3DAPI.setWorldPosition(node, translate);\r
-                       //G3DTools.setTuple3(node.getW, translation)\r
-                       //G3DTools.setLocalTranslation(node,translate);\r
-                       // mo.setLocalTranslation(translate);\r
-                       text += G3DTools.getVector(node.getWorldPosition()) + " " + translate;// mo.getWorldPosition() + " " +\r
-                                                                       \r
-               }\r
-               setInfoText(text);\r
-\r
-        updateGizmo();\r
-\r
-    }\r
-    \r
-    protected void updateGizmo() {\r
-       gizmo.update(camera.getCameraPos(),component);\r
-    }\r
-    \r
-    public void setInfoText(String text) {\r
-       \r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateInlineComponentAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateInlineComponentAction.java
deleted file mode 100644 (file)
index ebb6649..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.util.List;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.ConstrainedTransformAction;\r
-import org.simantics.proconf.g3d.base.G3DAPI;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.gizmo.TransformInlineGizmo;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-import fi.vtt.simantics.processeditor.stubs.InlineComponent;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-\r
-\r
-public class TranslateInlineComponentAction extends ConstrainedTransformAction {\r
-       \r
-    TransformInlineGizmo gizmo;\r
-    List<IGraphicsNode> mos;\r
-    Point3d start;\r
-    Point3d end;\r
-    Vector3d dir;\r
-    double istep = 10.0;\r
-    int decimals = 2;\r
-    \r
-    public TranslateInlineComponentAction(ThreeDimensionalEditorBase parent) {\r
-        super(parent);\r
-        gizmo = new TransformInlineGizmo(component.getDisplaySystem().getRenderer());\r
-\r
-    }\r
-    \r
-    public void init() {\r
-        this.setText("Translate");\r
-        this.setToolTipText("Translate the object");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/translate_d.png"));\r
-    }\r
-    \r
-   \r
-    \r
-    @Override\r
-    public boolean usable(Graph graph, List<Resource> resources) {\r
-       // TODO : it should be possible to move multiple components on the same straight\r
-        if (resources.size() != 1)\r
-            return false;\r
-        IEntity r = EntityFactory.create(graph,resources.get(0));\r
-        PipeControlPoint pcp = null;\r
-        if (r.isInstanceOf(ProcessResource.plant3Dresource.FixedLengthInlineComponent)) {\r
-               InlineComponent component = new InlineComponent(r);\r
-               pcp = component.getControlPoint();\r
-               } else {\r
-                       return false;\r
-               }\r
-        if (pcp.getNext() == null || pcp.getPrevious() == null)\r
-               return false;\r
-        return true;\r
-    }\r
-    \r
-    @Override\r
-    public void deactivate() {\r
-        parent.setGizmo(null);\r
-        super.deactivate();\r
-    }\r
-\r
-    @Override\r
-    public void activate() {\r
-        parent.setGizmo(gizmo);\r
-\r
-        String text = "";\r
-        mos = parent.getSelectionAdapter().getSelectedObjects();\r
-//        for (IGraphicsNode mo : mos) {\r
-//            text += GraphicsNodeTools.getWorldTranslation(mo.getGraphicsNode());//mo.getWorldPosition() + " ";\r
-//        }\r
-\r
-        mos.iterator().next().getGroup().attachChild(gizmo.getNode());\r
-        setInfoText(text);    \r
-           \r
-        \r
-        start = new Point3d();\r
-        end = new Point3d();\r
-        dir = new Vector3d();\r
-        parent.getSession().syncRead(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       \r
-                       InlineComponent ic = new InlineComponent(mos.iterator().next().getG3DNode(g));\r
-                       PipingTools2.getInlineMovement(ic, start, end);\r
-                       \r
-                       //PipingTools2.getInlineComponentEnds(ic, start, end);\r
-                dir.set(end);\r
-                dir.sub(start);\r
-\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-        });\r
-        \r
-        updateGizmo();\r
-        parent.setViewChanged(true);\r
-    }\r
-    \r
-    \r
-    \r
-    Vector3d getTranslate() {\r
-        Vector3d translate = new Vector3d();\r
-        Vector3d o = new Vector3d();\r
-        Vector3d d = new Vector3d();\r
-        parent.createPickRay(o, d);\r
-        //Vector3d p = gizmo.getPosition();\r
-        if (gizmo.isSelected()) {\r
-            double s[] = new double[1];\r
-           \r
-            Vector3d i1 = new Vector3d();\r
-            Vector3d i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight( start, dir,o, d, i2, i1,s);\r
-            translate.set(dir);\r
-            if (s[0] < 0.0)\r
-                s[0] = 0.0;\r
-            else if (s[0] > 1.0)\r
-                s[0] = 1.0;\r
-            translate.scale(s[0]);\r
-            translate.add(start);\r
-            \r
-            if (useConstraints) {\r
-                Vector3d t = new Vector3d(translate);\r
-//              FIXME : snapped point may be outside of proper range\r
-                Point3d snap = detector.getPointSnap2(t, dir);\r
-                if (snap != null) {\r
-                    translate = new Vector3d(snap);\r
-                }\r
-            }\r
-        \r
-            return translate;\r
-        }\r
-        return null;\r
-    }\r
-    \r
-    Vector3d prevTranslate = new Vector3d();\r
-    \r
-    @Override\r
-    public void doChanges(Graph graph) throws Exception {\r
-        if (input.mousePressed()) {\r
-            //prevTranslate = getTranslate();\r
-            \r
-        }\r
-        if (input.mouseClicked()) {\r
-            end();\r
-            return;\r
-        }\r
-        if (!input.mouseDragged()) {\r
-            parent.getDefaultAction().update();\r
-            return;\r
-        }   \r
-        parent.setViewChanged(true);\r
-        \r
-        \r
-        List<IGraphicsNode> mos = parent.getSelectionAdapter().getSelectedObjects();\r
-        Vector3d translate = getTranslate();\r
-       \r
-        if (translate == null) {\r
-            //cameraRotateAction.update();\r
-            parent.getDefaultAction().update();\r
-            updateGizmo();\r
-            return;\r
-        }\r
-        //translate.sub(prevTranslate);\r
-       \r
-//        if ((input.dragModifiers() & MouseEvent.CTRL_MASK) > 0) {\r
-//            String text = "";\r
-//            for (IGraphicsNode mo : mos) {\r
-//                \r
-//                Point3d p = mo.getWorldPosition();\r
-//                p.add(translate);\r
-//                p.x = Math.round(istep * p.x) / istep;\r
-//                BigDecimal bx = new BigDecimal(p.x);\r
-//                bx.setScale(decimals, BigDecimal.ROUND_HALF_UP);\r
-//                p.x = bx.doubleValue();\r
-//\r
-//                \r
-//                 text += p + " ";\r
-//                mo.setWorldTranslation(p);\r
-//                \r
-//            }\r
-//            this.parent.setInfoText(text);\r
-//            \r
-//        } else {\r
-            String text = "";\r
-            for (IGraphicsNode mo : mos) {\r
-               G3DNode node = mo.getG3DNode(graph);\r
-                G3DAPI.setWorldPosition(node, translate);\r
-               //G3DTools.setLocalTranslation(node, translate);\r
-                //mo.setLocalTranslation(translate);\r
-                text += G3DTools.getVector(node.getWorldPosition()) +" " + translate;//mo.getWorldPosition() + " " + translate;\r
-            }\r
-            setInfoText(text);\r
-//        }\r
-        updateGizmo();\r
-\r
-    }\r
-    \r
-    protected void updateGizmo() {\r
-       gizmo.update(camera.getCameraPos(),component);\r
-    }\r
-    \r
-    public void setInfoText(String text) {\r
-       \r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateStraightAction.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/actions/TranslateStraightAction.java
deleted file mode 100644 (file)
index 84d3a64..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.actions;\r
-\r
-import java.util.List;\r
-\r
-import javax.vecmath.AxisAngle4f;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.ConstrainedTransformAction;\r
-import org.simantics.proconf.g3d.actions.TranslateActionConstraints;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.gizmo.AbstractGizmo;\r
-import org.simantics.proconf.g3d.gizmo.TransformGizmo;\r
-import org.simantics.proconf.g3d.gizmo.TransformInlineGizmo;\r
-\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-import fi.vtt.simantics.processeditor.stubs.FixedLengthInlineComponent;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-\r
-/**\r
- * Action that allows translating VariableLengthInlineComontolPoints.\r
- * \r
- * TODO : Action won't show two gizmos when both ends can be moved\r
- * TODO : With loose ends, gizmo is in the middle of component, when it should be positioned on the end of the component\r
- * \r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class TranslateStraightAction extends ConstrainedTransformAction {\r
-       \r
-       private static final int CONNECTED = 0;\r
-    private static final int LOOSE = 1;\r
-    \r
-    private AbstractGizmo gizmo; \r
-    private TransformGizmo transformGizmo;\r
-    private TransformInlineGizmo transformInlineGizmo;\r
-    \r
-    \r
-    //private Straight straight;\r
-    //private PipeControlPoint pcp;\r
-    \r
-    private Resource pcpResource;\r
-    \r
-    private int type;\r
-\r
-    Vector3d prevTranslate = new Vector3d();\r
-    \r
-    Point3d start;\r
-    Point3d end;\r
-    Vector3d dir;\r
-    double istep = 10.0;\r
-    int decimals = 2;\r
-    public TranslateStraightAction(ThreeDimensionalEditorBase parent) {\r
-       super(parent);\r
-        transformGizmo = new TransformGizmo(component.getDisplaySystem().getRenderer());\r
-        transformInlineGizmo = new TransformInlineGizmo(component.getDisplaySystem().getRenderer());\r
-    }\r
-    \r
-    public void init() {\r
-        this.setText("Translate");\r
-        this.setToolTipText("Translate one end of a straight");\r
-        this.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/translate_d.png"));\r
-    }\r
-    \r
-    @Override\r
-    public boolean usable(Graph graph, List<Resource> resources) {\r
-        if (resources.size() != 1)\r
-            return false;\r
-       \r
-        IEntity r = EntityFactory.create(graph,resources.get(0));\r
-        if (!r.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-                       return false;\r
-               }\r
-        FixedLengthInlineComponent flic = new FixedLengthInlineComponent(r);\r
-        PipeControlPoint scp = flic.getControlPoint();\r
-        PipeControlPoint start = scp.getPrevious();\r
-        PipeControlPoint end = scp.getNext(); \r
-        \r
-        if (start == null) {\r
-               pcpResource = scp.getResource();\r
-               type = LOOSE;\r
-               return true;\r
-        }\r
-        if (end == null) {\r
-               pcpResource = scp.getResource();\r
-               type = LOOSE;\r
-               return true;\r
-        }\r
-        if (start.isInstanceOf(ProcessResource.plant3Dresource.BranchEndControlPoint)) {\r
-               pcpResource = graph.getObjects(start.getResource(), ProcessResource.plant3Dresource.SubPointOf).iterator().next();\r
-               type = CONNECTED;\r
-               return true;\r
-        }\r
-        if (end.isInstanceOf(ProcessResource.plant3Dresource.BranchEndControlPoint)) {\r
-               pcpResource = graph.getObjects(end.getResource(), ProcessResource.plant3Dresource.SubPointOf).iterator().next();\r
-               type = CONNECTED;\r
-               return true;\r
-        }\r
-       \r
-\r
-        return false;\r
-        \r
-    }\r
-    \r
-    @Override\r
-    public void deactivate() {\r
-       super.deactivate();\r
-        parent.setGizmo(null);\r
-\r
-    }\r
-\r
-    @Override\r
-    public void activate() {\r
-       parent.getSession().syncRead(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       PipeControlPoint pcp = new PipeControlPoint(g,pcpResource);\r
-                       if (type == CONNECTED) {\r
-                   gizmo = transformInlineGizmo;\r
-                   \r
-                   start = new Point3d();\r
-                   end = new Point3d();\r
-                   dir = new Vector3d();\r
-                   //ControlPointTools.getInlineControlPointEnds(pcp, start, end, dir);\r
-                   ControlPointTools.getInlineMovement(pcp, start, end);\r
-                       \r
-                       //PipingTools2.getInlineComponentEnds(ic, start, end);\r
-                    dir.set(end);\r
-                    dir.sub(start);\r
-                    \r
-                   //System.out.println(start + " " + end + " " + dir);\r
-                   Vector3d front = new Vector3d(1.0,0.0,0.0);\r
-                   Vector3d current = new Vector3d(dir);\r
-                   float angle = (float)current.angle(front);\r
-                   AxisAngle4f aa;\r
-                   if (angle < 0.01 || (Math.PI - angle) < 0.01) {\r
-                       aa = new AxisAngle4f();\r
-                   } else {\r
-                       current.normalize();\r
-                       Vector3d right = new Vector3d();\r
-                       right.cross(front, current);\r
-\r
-                       right.normalize();\r
-                       if (right.lengthSquared() < 0.01) {\r
-                           aa = new AxisAngle4f();\r
-                       } else {\r
-                           aa = new AxisAngle4f((float) right.x, (float) right.y, (float) right.z, angle);\r
-                       }\r
-                   }\r
-                   transformInlineGizmo.setRotation(aa);\r
-                   \r
-               } else {\r
-                   gizmo = transformGizmo;\r
-               }\r
-               parent.setGizmo(gizmo);\r
-\r
-               component.getNoShadowRoot().attachChild(gizmo.getNode());\r
-\r
-               updateGizmo(pcp);\r
-               TranslateActionConstraints.addConstraints(new Resource[]{pcpResource}, detector);\r
-               parent.setViewChanged(true);\r
-               \r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-       });\r
-        \r
-    }\r
-    \r
-    \r
-    // FIXME : copy-paste from TranslateInlineAction.getTranslate()\r
-    Vector3d getTranslate() {\r
-        Vector3d translate = new Vector3d();\r
-        Vector3d o = new Vector3d();\r
-        Vector3d d = new Vector3d();\r
-        parent.createPickRay(o, d);\r
-        // Vector3d p = gizmo.getPosition();\r
-        if (((TransformInlineGizmo) gizmo).isSelected()) {\r
-            double s[] = new double[1];\r
-\r
-            Vector3d i1 = new Vector3d();\r
-            Vector3d i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight(start, dir, o, d, i2, i1, s);\r
-            translate.set(dir);\r
-            if (s[0] < 0.0)\r
-                s[0] = 0.0;\r
-            else if (s[0] > 1.0)\r
-                s[0] = 1.0;\r
-            translate.scale(s[0]);\r
-            translate.add(start);\r
-            \r
-            if (useConstraints) {\r
-                Vector3d t = new Vector3d(translate);\r
-                // FIXME : snapped point may be outside of proper range\r
-                Point3d snap = detector.getPointSnap2(t, dir);\r
-                if (snap != null) {\r
-                    translate = new Vector3d(snap);\r
-                }\r
-            }\r
-\r
-            return translate;\r
-        }\r
-        return null;\r
-    }\r
-    // FIXME : copy-paste from TranslateAction.getTranslate(Vector3d v)\r
-    Vector3d getTranslate(PipeControlPoint pcp, Vector3d offset) {\r
-        Vector3d translate = new Vector3d();\r
-        Vector3d o = new Vector3d();\r
-        Vector3d d = new Vector3d();\r
-        parent.createPickRay(o, d);\r
-        Vector3d p = ((TransformGizmo)gizmo).getPosition();\r
-        Vector3d dir = null;\r
-        switch (((TransformGizmo)gizmo).getSelected()) {\r
-        case TransformGizmo.XYZ :\r
-            Vector3d normal = camera.getUnNormalizedHeading();\r
-            normal.normalize();\r
-            double s[] = new double[1];\r
-            Vector3d r = new Vector3d();\r
-            if (MathTools.intersectStraightPlane(o, d, p, normal, r)) {\r
-                r.sub(p);\r
-                translate.x = r.x;\r
-                translate.y = r.y;\r
-                translate.z = r.z;\r
-            }\r
-            break;\r
-        case TransformGizmo.X :\r
-            dir = new Vector3d(1.0,0.0,0.0);\r
-            Vector3d i1 = new Vector3d();\r
-            Vector3d i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight( p, dir,o, d, i2, i1,s);\r
-            translate.x = s[0];\r
-            \r
-            break;\r
-        case TransformGizmo.Y :\r
-            dir = new Vector3d(0.0,1.0,0.0);\r
-            i1 = new Vector3d();\r
-            i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight( p, dir,o, d, i2, i1,s);\r
-            translate.y = s[0];\r
-            break;\r
-        case TransformGizmo.Z :\r
-            dir = new Vector3d(0.0,0.0,1.0);\r
-            i1 = new Vector3d();\r
-            i2 = new Vector3d();\r
-            s = new double[2];\r
-            MathTools.intersectStraightStraight( p, dir,o, d, i2, i1,s);\r
-            translate.z = s[0];\r
-            break;\r
-        case TransformGizmo.XY :\r
-            normal = new Vector3d(0.0,0.0,1.0);\r
-            s = new double[1];\r
-            r = new Vector3d();\r
-            if (MathTools.intersectStraightPlane(o, d, p, normal, r)) {\r
-                r.sub(p);\r
-                translate.x = r.x;\r
-                translate.y = r.y;\r
-            }\r
-            break;\r
-        case TransformGizmo.XZ :\r
-            normal = new Vector3d(0.0,1.0,0.0);\r
-            s = new double[1];\r
-            r = new Vector3d();\r
-            if (MathTools.intersectStraightPlane(o, d, p, normal, r)) {\r
-                r.sub(p);\r
-                translate.x = r.x;\r
-                translate.z = r.z;\r
-            }\r
-            break;\r
-        case TransformGizmo.YZ :\r
-            normal = new Vector3d(1.0,0.0,0.0);\r
-            s = new double[1];\r
-            r = new Vector3d();\r
-            if (MathTools.intersectStraightPlane(o, d, p, normal, r)) {\r
-                r.sub(p);\r
-                translate.y = r.y;\r
-                translate.z = r.z;\r
-            }\r
-            break;\r
-        default :\r
-            \r
-            return null;\r
-        }\r
-        //System.out.println(translate + " " + offset);\r
-        translate.sub(offset);\r
-        \r
-        if (useConstraints) {\r
-            switch (((TransformGizmo)gizmo).getSelected()) {\r
-            case TransformGizmo.X:\r
-            case TransformGizmo.Y:\r
-            case TransformGizmo.Z:\r
-                Vector3d t = new Vector3d(translate);\r
-                // TODO : to the test against all translated objects and snap to closest one\r
-                Point3d pos = G3DTools.getPoint(pcp.getLocalPosition());\r
-                t.add(pos);\r
-                Point3d snap = detector.getPointSnap2(t, dir);\r
-                if (snap != null) {\r
-                   // System.out.print("t: " + translate);\r
-                    translate = new Vector3d(snap);\r
-                    translate.sub(pos);\r
-                   // System.out.println(" " + translate);\r
-                }\r
-                break;\r
-                \r
-            }\r
-        }\r
-        //System.out.println(translate);\r
-        return translate;\r
-    }\r
-    \r
-    \r
-    \r
-    @Override\r
-    public void doChanges(Graph graph) throws Exception {\r
-       PipeControlPoint pcp = new PipeControlPoint(graph, pcpResource); \r
-        if (input.mousePressed()) {\r
-            if (type == LOOSE)\r
-                prevTranslate = getTranslate(pcp,new Vector3d());\r
-            \r
-        }\r
-        if (input.mouseClicked()) {\r
-            //System.out.println("end");\r
-            end();\r
-            return;\r
-        }\r
-        if (!input.mouseDragged()) {\r
-            parent.getDefaultAction().update();\r
-            return;\r
-        } \r
-        detector.clearConstraintHighlights();\r
-        parent.setViewChanged(true);\r
-        \r
-        \r
-        Vector3d translate;\r
-        if (type == CONNECTED)\r
-            translate = getTranslate();\r
-        else\r
-            translate = getTranslate(pcp,prevTranslate);\r
-       \r
-        if (translate == null) {\r
-            //cameraRotateAction.update();\r
-            parent.getDefaultAction().update();\r
-            updateGizmo(pcp);\r
-            return;\r
-        }\r
-\r
-        String text = "";\r
-        \r
-        if (type == CONNECTED) {\r
-                G3DTools.setTuple3(pcp.getWorldPosition(), translate);\r
-                // mo.setLocalTranslation(translate);\r
-                //text += GraphicsNodeTools.getWorldTranslation(mo.getGraphicsNode()) + " " + translate;// mo.getWorldPosition()\r
-                if (useConstraints)\r
-                    text+=detector.getSnapString();\r
-\r
-        } else {\r
-                G3DTools.addTuple3(pcp.getWorldPosition(), translate);\r
-               // mo.modifyWorldTranslation(translate);\r
-                //text += GraphicsNodeTools.getWorldTranslation(mo.getGraphicsNode()) + " ";//mo.getWorldPosition() + " ";\r
-            if (useConstraints)\r
-                text+=detector.getSnapString();\r
-            \r
-        }\r
-        \r
-        setInfoText(text);\r
-        updateGizmo(pcp);\r
-\r
-    }\r
-    \r
-    protected void updateGizmo(PipeControlPoint pcp) {\r
-               gizmo.update(G3DTools.getVector(pcp.getWorldPosition()), camera.getCameraPos(), component);\r
-    }\r
-    \r
-    public void setInfoText(String text) {\r
-       \r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/InlineComponentConstraintAdapter.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/InlineComponentConstraintAdapter.java
deleted file mode 100644 (file)
index e21bda7..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-package fi.vtt.simantics.processeditor.adapters;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.adaption.AdaptionException;\r
-import org.simantics.db.adaption.ResourceAdapter;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.base.Constraint;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-\r
-public class InlineComponentConstraintAdapter implements ResourceAdapter {\r
-       @SuppressWarnings("unchecked")\r
-       @Override\r
-       public <T> T adapt(Graph graph, Resource resource, Resource mia) throws AdaptionException {\r
-               Constraint c = new Constraint();\r
-               assert(graph.isInstanceOf(resource, ProcessResource.plant3Dresource.InlineComponent));\r
-               IEntity ent = EntityFactory.create(graph,resource);\r
-               Point3d center = new Point3d();\r
-               Point3d p1 = new Point3d();\r
-               Point3d p2 = new Point3d();\r
-               Vector3d dir = new Vector3d();\r
-               PipingTools2.getInlineComponentEnds(ent, center, p1, p2, dir);\r
-               c.points.add(center);\r
-               c.points.add(p1);\r
-               c.points.add(p2);\r
-               c.dirs.add(dir);\r
-               return (T) c;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/NozzleConstraintAdapter.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/NozzleConstraintAdapter.java
deleted file mode 100644 (file)
index 33b8075..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package fi.vtt.simantics.processeditor.adapters;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.adaption.AdaptionException;\r
-import org.simantics.db.adaption.ResourceAdapter;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.base.Constraint;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-\r
-public class NozzleConstraintAdapter implements ResourceAdapter {\r
-       @SuppressWarnings("unchecked")\r
-       @Override\r
-       public <T> T adapt(Graph graph, Resource resource, Resource mia) throws AdaptionException {\r
-               Constraint c = new Constraint();\r
-               assert(graph.isInstanceOf(resource, ProcessResource.plant3Dresource.Nozzle));\r
-               IEntity ent = EntityFactory.create(graph,resource);\r
-               Vector3d dir = PipingTools2.getNozzleDirection(ent);\r
-               Point3d center = G3DTools.getPoint(ent.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-               c.points.add(center);\r
-               c.dirs.add(dir);\r
-               return (T) c;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/TurnComponentConstraintAdapter.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/adapters/TurnComponentConstraintAdapter.java
deleted file mode 100644 (file)
index 4df00b5..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-package fi.vtt.simantics.processeditor.adapters;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.adaption.AdaptionException;\r
-import org.simantics.db.adaption.ResourceAdapter;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.base.Constraint;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.actions.PositionType;\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2.Direction;\r
-\r
-public class TurnComponentConstraintAdapter implements ResourceAdapter {\r
-       @SuppressWarnings("unchecked")\r
-       @Override\r
-       public <T> T adapt(Graph graph, Resource resource, Resource mia) throws AdaptionException {\r
-               Constraint c = new Constraint();\r
-               assert(graph.isInstanceOf(resource, ProcessResource.plant3Dresource.TurnComponent));\r
-               IEntity ent = EntityFactory.create(graph,resource);\r
-               IEntity pcp = ent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint);\r
-               \r
-               Point3d center = G3DTools.getPoint(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-               Point3d p1 = ControlPointTools.getRealPosition(pcp, PositionType.NEXT);\r
-               Point3d p2 = ControlPointTools.getRealPosition(pcp, PositionType.PREVIOUS);\r
-               Vector3d dir1 = ControlPointTools.getPathLegDirection(pcp, Direction.NEXT);\r
-               Vector3d dir2 = ControlPointTools.getPathLegDirection(pcp, Direction.PREVIOUS);\r
-               c.points.add(center);\r
-               c.points.add(p1);\r
-               c.points.add(p2);\r
-               c.dirs.add(dir1);\r
-               c.dirs.add(dir2);\r
-               return (T) c;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/PipeAnimationController.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/PipeAnimationController.java
deleted file mode 100644 (file)
index 0524171..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.animations;\r
-\r
-import java.net.URL;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.eclipse.core.runtime.FileLocator;\r
-import org.eclipse.core.runtime.Path;\r
-import org.simantics.db.Graph;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.animation.Animatable;\r
-import org.simantics.proconf.g3d.animation.AnimationController;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-\r
-import com.jme.bounding.BoundingBox;\r
-import com.jme.image.Texture;\r
-import com.jme.intersection.PickResults;\r
-import com.jme.math.Ray;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.TextureState;\r
-import com.jme.scene.state.ZBufferState;\r
-import com.jme.util.TextureManager;\r
-import com.jmex.effects.particles.ParticleGeometry;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-import fi.vtt.simantics.processeditor.stubs.VariableLengthInlineComponent;\r
-\r
-\r
-public class PipeAnimationController implements AnimationController {\r
-       private List<ParticleGeometry> pipeAnimations = new ArrayList<ParticleGeometry>();\r
-       \r
-       List<PipeFlowAnimation> animatables = new ArrayList<PipeFlowAnimation>();\r
-       \r
-       private double d = Math.random();\r
-    private double delta = 0.01;\r
-    \r
-    AlphaState as1;\r
-       TextureState ts;\r
-       Node particleNode = new Node() {\r
-               private static final long serialVersionUID = 7477121374264124684L;\r
-\r
-               // Without this picking code tries to pick particles which doesn't work (Causes class cast exception)\r
-               public void findPick(Ray toTest, PickResults results) {\r
-                       return;\r
-               }\r
-       };\r
-    \r
-    public PipeAnimationController(JmeRenderingComponent component, PipeRun pipeline) {\r
-       as1 = component.getDisplaySystem().getRenderer().createAlphaState();\r
-        as1.setBlendEnabled(true);\r
-        as1.setSrcFunction(AlphaState.SB_SRC_ALPHA);\r
-        as1.setDstFunction(AlphaState.DB_ONE);\r
-        //as1.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as1.setTestEnabled(true);\r
-        as1.setTestFunction(AlphaState.TF_GREATER);\r
-        as1.setEnabled(true);\r
-\r
-        TextureState ts = component.getDisplaySystem().getRenderer().createTextureState();\r
-        //URL url = FileLocator.find(com.jme.eclipse.Activator.getDefault().getBundle(),new Path("data/textures/flaresmall.jpg"),null);\r
-        URL url = FileLocator.find(Activator.getDefault().getBundle(),new Path("icons/bubble.png"),null);\r
-        \r
-        ts.setTexture(\r
-            TextureManager.loadTexture(url,\r
-            Texture.MM_LINEAR_LINEAR,\r
-            Texture.FM_LINEAR));\r
-        ts.setEnabled(true);\r
-        \r
-        ZBufferState zs = component.getDisplaySystem().getRenderer().createZBufferState();\r
-        zs.setFunction(ZBufferState.CF_LEQUAL);\r
-        zs.setWritable(false);\r
-        //zs.setFunction(ZBufferState.CF_ALWAYS);\r
-        particleNode.setRenderState(as1);\r
-        particleNode.setRenderState(ts);\r
-        particleNode.setRenderState(zs);\r
-        particleNode.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-        component.getShadowRoot().attachChild(particleNode);\r
-       createAnimations(pipeline);\r
-    }\r
-       \r
-    public void addAnimatable(Animatable animatable) {\r
-               animatables.add((PipeFlowAnimation)animatable);\r
-               \r
-       }\r
-       \r
-       public void setAnimatable(Animatable animatable) {\r
-               animatables.clear();\r
-               animatables.add((PipeFlowAnimation)animatable);\r
-               \r
-       }\r
-       \r
-       \r
-       public void updateAnimation(Graph g, double frameTime) {\r
-               d += delta;\r
-        if (d > 1.0) {\r
-            d = 1.0;\r
-            delta = -delta;\r
-        } else if (d < 0.0) {\r
-            delta = -delta;\r
-            d = 0.0;\r
-        }\r
-        for (Animatable a : animatables)\r
-            a.animate(d,frameTime);    \r
-       }\r
-       \r
-       public void dispose() {\r
-               for (ParticleGeometry p : pipeAnimations)\r
-                       p.removeFromParent();\r
-               pipeAnimations.clear();\r
-               \r
-       }\r
-       \r
-       private void createAnimations(PipeRun pipeline) {\r
-               List<IEntity> straights = new ArrayList<IEntity>();\r
-               for (IEntity t : pipeline.getChild()) {\r
-                       if (t.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent))\r
-                               straights.add(t);\r
-               }\r
-               \r
-               for (IEntity r : straights) {\r
-               animatables.add(new PipeFlowAnimation(pipeAnimations, particleNode, new VariableLengthInlineComponent(r),false));\r
-        }\r
-        particleNode.setModelBound(new BoundingBox());\r
-        particleNode.updateModelBound();\r
-        particleNode.updateRenderState();\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/PipeFlowAnimation.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/PipeFlowAnimation.java
deleted file mode 100644 (file)
index d86358d..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.animations;\r
-\r
-import java.util.List;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.animation.Animatable;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.Node;\r
-import com.jmex.effects.particles.ParticleFactory;\r
-import com.jmex.effects.particles.ParticleGeometry;\r
-\r
-\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.VariableLengthInlineComponent;\r
-\r
-\r
-public class PipeFlowAnimation implements Animatable{ \r
-       \r
-       ParticleGeometry particle;\r
-       float length;\r
-       int numParticles;\r
-       \r
-       public PipeFlowAnimation(List<ParticleGeometry> pipeAnimations, Node particleNode, VariableLengthInlineComponent s, boolean reversed) {\r
-       PipeControlPoint pcp = s.getControlPoint();\r
-       \r
-       Point3d p1 = new Point3d();\r
-       Point3d p2 = new Point3d();\r
-       \r
-       ControlPointTools.getInlineControlPointEnds(pcp, p2, p1);\r
-\r
-       if (reversed) {\r
-               Point3d t = p1;\r
-               p1 = p2;\r
-               p2 = t;\r
-       }\r
-       \r
-       \r
-       Vector3d dir = new Vector3d(p2);\r
-       dir.sub(p1);\r
-       length = (float)dir.length();\r
-       //if (length < 0.1f)\r
-       //      return;\r
-               //continue;\r
-       // with longer pipes particles will travel too far so the length of the pipe must be scaled\r
-       length *= 0.83f;\r
-       float vel = 0.1f;\r
-       //float size = (float)s.getPipeRadiusValue() + 0.1f;\r
-       //size *= 2.f;\r
-       float size = (float)s.getPipeDiameter()[0];\r
-       //size *= 1.2f;\r
-       float life = length/vel;\r
-       \r
-       //int releaseRate = 40;\r
-       //int numParticles = (int)(releaseRate * life / 100.f);//(int)(releaseRate * life / 500.f);\r
-       \r
-       numParticles = (int)(length * 2.0);\r
-       int releaseRate = (int)((numParticles * 500.0) / life);\r
-       \r
-       if (numParticles < 2)\r
-               numParticles = 2;\r
-       \r
-       particle = ParticleFactory.buildParticles("Animation of " + s.getResource().getResourceId(),numParticles, ParticleGeometry.PT_QUAD);//new ParticleMesh("Animation of " + r.getId(),40);\r
-       particle.setEmissionDirection(VecmathJmeTools.get(dir).normalize());\r
-       particle.setLocalTranslation(VecmathJmeTools.get(p1));\r
-       particle.setEmitType(ParticleGeometry.ET_POINT);\r
-       particle.setInitialVelocity(vel);\r
-       particle.setMinimumAngle(0.f);\r
-       particle.setMaximumAngle(0.f);\r
-       particle.setReleaseRate(releaseRate);\r
-       particle.getParticleController().setReleaseVariance(0.f);\r
-       particle.getParticleController().setControlFlow(true);\r
-       particle.setStartColor(new ColorRGBA(1.f,1.f,0.f,1.f));\r
-       particle.setEndColor(new ColorRGBA(1.f,1.f,0.f,1.f));\r
-       particle.setStartSize(size);\r
-       particle.setEndSize(size);\r
-       setFlow(vel);\r
-       particle.getParticleController().setSpeed(vel);\r
-       particle.warmUp(60);\r
-       pipeAnimations.add(particle);\r
-       particleNode.attachChild(particle);\r
-       }\r
-       \r
-       ParticleGeometry getParticleGeometry() {\r
-               return particle;\r
-       }\r
-       \r
-       private void setFlow(float vel) {\r
-               float life;\r
-               if (vel > 0.f)\r
-                       life = length/vel;\r
-               else\r
-                       life = 0.f;\r
-               particle.setInitialVelocity(vel);\r
-       particle.setMaximumLifeTime(life);\r
-       particle.setMinimumLifeTime(life);\r
-       particle.getParticleController().setSpeed(vel);\r
-\r
-       }\r
-       \r
-       private void setReleaserate(float vel) {\r
-               float life;\r
-               if (vel > 0.f)\r
-                       life = length/vel;\r
-               else\r
-                       life = 0.f;\r
-               particle.setInitialVelocity(vel);\r
-       particle.setMaximumLifeTime(life);\r
-       particle.setMinimumLifeTime(life);\r
-       particle.setReleaseRate((int)((numParticles * 500.0) / life));\r
-       }\r
-       \r
-       public void animate(double delta,double frameRate) {\r
-               //setFlow(0.1f*(float)delta);\r
-               setReleaserate(0.05f*(float)delta);\r
-       }\r
-       \r
-       public boolean setAnimation(Graph graph, Resource animation) {\r
-               return false;\r
-       }\r
-       \r
-       public boolean setRandomAnimation(Graph graph) {\r
-               return false;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/ResourcePipeAnimationController.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/animations/ResourcePipeAnimationController.java
deleted file mode 100644 (file)
index 4350500..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.animations;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-\r
-// TODO : this class won't work with valueSets\r
-public class ResourcePipeAnimationController extends PipeAnimationController {\r
-       Resource color;\r
-       Resource velocity;\r
-       \r
-       ColorRGBA minColor = new ColorRGBA(0.f,0.f,1.f,1.f);\r
-       ColorRGBA maxColor = new ColorRGBA(1.f,0.f,0.f,1.f);\r
-       ColorRGBA currentColor = new ColorRGBA(1.f,1.f,1.f,1.f);\r
-       \r
-       double colorMin;\r
-       double colorMax;\r
-       double iColorRange;\r
-       \r
-       double velMin;\r
-       double velMax;\r
-       double iVelRange;\r
-       public ResourcePipeAnimationController(JmeRenderingComponent component, PipeRun pipeline, Resource color,double colorMin, double colorMax, Resource velocity, double velMin, double velMax) {\r
-               super(component, pipeline);\r
-               this.color = color;\r
-               this.velocity = velocity;\r
-               \r
-               this.colorMin = colorMin;\r
-               this.colorMax = colorMax;\r
-               this.iColorRange = 1.0/(colorMax-colorMin);\r
-               this.velMin = velMin;\r
-               this.velMax = velMax;\r
-               this.iVelRange = 1.0/(velMax-velMin);\r
-       }\r
-       \r
-       private double getVelocity(Graph graph) {\r
-               return graph.getScalarDouble(velocity);\r
-               //velocity.getDoubleScalarValue();\r
-       }\r
-       \r
-       private double getColor(Graph graph) {\r
-               return graph.getScalarDouble(color);\r
-       }\r
-       public void updateAnimation(Graph g,double frameTime) {\r
-               double d = (getVelocity(g)-velMin)*iVelRange;\r
-               float f = (float)((getColor(g)-colorMin)*iColorRange);\r
-        currentColor.interpolate(minColor, maxColor, f);\r
-               for (PipeFlowAnimation a : animatables) {\r
-            a.animate(d,frameTime);    \r
-            //a.getParticleGeometry().setDefaultColor(currentColor);\r
-            a.getParticleGeometry().setStartColor(currentColor);\r
-            a.getParticleGeometry().setEndColor(currentColor);\r
-        }\r
-       }\r
-       \r
-       \r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/ControlPointTools.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/ControlPointTools.java
deleted file mode 100644 (file)
index 077ea70..0000000
+++ /dev/null
@@ -1,1198 +0,0 @@
-package fi.vtt.simantics.processeditor.common;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.Stack;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Matrix3d;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Tuple3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.TransformationTools;\r
-import org.simantics.utils.ErrorLogger;\r
-import org.simantics.utils.datastructures.Pair;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.actions.PositionType;\r
-import fi.vtt.simantics.processeditor.common.PipingTools2.Direction;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-\r
-public class ControlPointTools {\r
-       \r
-       private static boolean DEBUG = false;\r
-       \r
-       private static TransformationTools tt;\r
-       \r
-       public static void initialize() {\r
-               tt = new TransformationTools(ProcessResource.plant3Dresource.HasSubPoint,ProcessResource.plant3Dresource.SubPointOf) {\r
-                       @Override\r
-                       public IEntity getParent(IEntity node) {\r
-                               IEntity parent =  super.getParent(node);\r
-                               if (parent == null) {\r
-                                       parent = node.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.ControlPointOf);\r
-                                       if (parent != null)\r
-                                               parent = parent.getAtMostOneRelatedObject(ProcessResource.g3dResource.HasParent);\r
-                                       else\r
-                                               parent = node.getAtMostOneRelatedObject(ProcessResource.g3dResource.HasParent);\r
-                                               \r
-                               }\r
-                               return parent;\r
-                       }\r
-               };\r
-       }\r
-       \r
-       public static void deinitialize() {\r
-               tt = null;\r
-       }\r
-       \r
-       /**\r
-        * Adds new control point between given control points.\r
-        * New pcp must be already part of the same piperun as previous CP and nextCP\r
-        * \r
-        * SizeChangeControlPoints cannot be inserted with this method, since it does link two different piperuns to each other\r
-        * \r
-        * @param newCP\r
-        * @param previousCP\r
-        * @param nextCP\r
-        */\r
-       public static void insertControlPoint(IEntity newCP, IEntity previousCP, IEntity nextCP) {\r
-               // inserting an offsetpoint is error, \r
-               assert(!newCP.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint));\r
-               // size change control point cannot be inserted this way, because it ends PipeRun\r
-               assert(!newCP.isInstanceOf(ProcessResource.plant3Dresource.SizeChangeControlPoint));\r
-               \r
-               IEntity piperun = previousCP.getSingleRelatedObject(ProcessResource.plant3Dresource.ControlPointOfPipeRun);\r
-               // and just to make sure that control point structure is not corrupted\r
-               assert(piperun.equals(nextCP.getSingleRelatedObject(ProcessResource.plant3Dresource.ControlPointOfPipeRun)));\r
-               assert(piperun.equals(newCP.getSingleRelatedObject(ProcessResource.plant3Dresource.ControlPointOfPipeRun)));\r
-               \r
-               // insert new BranchControlPoint between straight's control points\r
-       IEntity previousNext = previousCP.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasNext);\r
-       IEntity previousPrevious = previousCP.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasPrevious);\r
-       \r
-       IEntity offsetCP = null;\r
-       \r
-       if (newCP.isInstanceOf(ProcessResource.plant3Dresource.OffsettingPoint)) {\r
-               offsetCP = newCP.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-       }\r
-       \r
-               if (previousNext != null && previousNext.equals(nextCP)) {\r
-                       assert(!previousCP.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint));\r
-                       assert(!nextCP.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint));\r
-                       \r
-                       setStatement(previousCP, ProcessResource.plant3Dresource.HasNext, newCP);\r
-            setStatement(newCP, ProcessResource.plant3Dresource.HasPrevious, previousCP);\r
-            \r
-            if (previousCP.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {                \r
-               IEntity sccp = previousCP.getSingleRelatedObject(ProcessResource.plant3Dresource.SubPointOf);\r
-               setStatement(sccp, ProcessResource.plant3Dresource.HasNext, newCP);\r
-            }\r
-            \r
-            setStatement(newCP, ProcessResource.plant3Dresource.HasNext, nextCP);\r
-            \r
-            if (offsetCP == null) {\r
-               setStatement(nextCP, ProcessResource.plant3Dresource.HasPrevious, newCP);\r
-            } else {\r
-               setStatement(nextCP, ProcessResource.plant3Dresource.HasPrevious, offsetCP);\r
-               setStatement(offsetCP, ProcessResource.plant3Dresource.HasNext, nextCP);\r
-               setStatement(offsetCP, ProcessResource.plant3Dresource.HasPrevious, previousCP);\r
-            }\r
-            \r
-            if (nextCP.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-               IEntity ocp = nextCP.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-               setStatement(ocp, ProcessResource.plant3Dresource.HasPrevious, newCP);\r
-            }\r
-            \r
-         } else if (previousPrevious != null && previousPrevious.equals(nextCP)) {\r
-                // control point were given in reverse order \r
-                assert(!nextCP.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint));\r
-                        assert(!previousCP.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint));\r
-                        \r
-                        setStatement(newCP, ProcessResource.plant3Dresource.HasNext, previousCP);\r
-                        if (offsetCP == null) {\r
-               setStatement(previousCP, ProcessResource.plant3Dresource.HasPrevious, newCP);\r
-             } else {\r
-               setStatement(previousCP, ProcessResource.plant3Dresource.HasPrevious, offsetCP);\r
-               setStatement(offsetCP, ProcessResource.plant3Dresource.HasNext, previousCP);\r
-               setStatement(offsetCP, ProcessResource.plant3Dresource.HasPrevious, nextCP);\r
-             }\r
-                        \r
-                if (previousCP.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                        IEntity ocp = previousCP.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-                        setStatement(ocp, ProcessResource.plant3Dresource.HasPrevious, newCP);\r
-             }\r
-                \r
-                setStatement(newCP, ProcessResource.plant3Dresource.HasPrevious, nextCP);\r
-                setStatement(nextCP, ProcessResource.plant3Dresource.HasNext, newCP);\r
-             if (nextCP.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                IEntity sccp = nextCP.getSingleRelatedObject(ProcessResource.plant3Dresource.SubPointOf);\r
-                setStatement(sccp, ProcessResource.plant3Dresource.HasNext, newCP);\r
-             }\r
-        } else {\r
-            ErrorLogger.defaultLogError(\r
-                    "Route pipe : could not find connection between straight pipe's control points", null);\r
-        }\r
-\r
-       }\r
-       \r
-       /**\r
-        * Adds new control point attaching it to given control point.\r
-        * If the new control point is SizeChangeControlPoint, it must have its offset point set.\r
-        * \r
-        * @param newCP\r
-        * @param pcp\r
-        * @param direction\r
-        */\r
-       public static void insertControlPoint(IEntity newCP, IEntity pcp, Direction direction) {\r
-               assert(!newCP.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint));\r
-               if (direction == Direction.NEXT) {\r
-                       // if direction is next, user must have given OffsetPoint\r
-                       assert(!pcp.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint));\r
-                       // basic next/prev links\r
-                       pcp.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                       pcp.addStatement(ProcessResource.plant3Dresource.HasNext, newCP);\r
-                       newCP.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                       newCP.addStatement(ProcessResource.plant3Dresource.HasPrevious, pcp);\r
-                       // and last take care of sizechange / offset points\r
-                       if (pcp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                               IEntity sccp = pcp.getSingleRelatedObject(ProcessResource.plant3Dresource.SubPointOf);\r
-                               sccp.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                               sccp.addStatement(ProcessResource.plant3Dresource.HasNext, newCP);\r
-                       }\r
-                       if (newCP.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                               IEntity ocp = newCP.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-                               ocp.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                               ocp.addStatement(ProcessResource.plant3Dresource.HasPrevious, pcp);\r
-                       }\r
-               } else {\r
-                       // if direction is previous, user must have given sizechange\r
-                       assert(!pcp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint));\r
-                       // previous direction is more complicated, since if newCP is SizeChangeControlPoint,\r
-                       // we must link pcp to newCP's OffsetPoint\r
-                       IEntity nocp = null;\r
-                       if (newCP.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                               nocp = newCP.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-                               nocp.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                               nocp.addStatement(ProcessResource.plant3Dresource.HasNext, pcp);\r
-                       }\r
-                       pcp.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                       if (nocp == null)\r
-                               pcp.addStatement(ProcessResource.plant3Dresource.HasPrevious, newCP);\r
-                       else\r
-                               pcp.addStatement(ProcessResource.plant3Dresource.HasPrevious, nocp);\r
-                       \r
-                       newCP.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                       newCP.addStatement(ProcessResource.plant3Dresource.HasNext, pcp);\r
-                       if (pcp.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                               IEntity ocp = pcp.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-                               ocp.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                               if (nocp == null)\r
-                                       ocp.addStatement(ProcessResource.plant3Dresource.HasPrevious, newCP);\r
-                               else\r
-                                       ocp.addStatement(ProcessResource.plant3Dresource.HasPrevious, nocp);\r
-                       }\r
-                       \r
-               }\r
-       }\r
-       \r
-       /**\r
-        * Returns path legs direction\r
-        * @param pcp\r
-        * @param direction\r
-        * @return\r
-        */\r
-       public static Vector3d getPathLegDirection(IEntity pcp,Direction direction) {\r
-               IEntity previous = pcp.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasPrevious);\r
-               IEntity next = pcp.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasNext);\r
-               if (direction == Direction.NEXT) {\r
-                       if (next != null) {\r
-                               if (pcp.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint))\r
-                                       pcp = pcp.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-                               Point3d p1 = G3DTools.getPoint(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-                               Point3d p2 = G3DTools.getPoint(next.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-                               Vector3d v = new Vector3d();\r
-                               v.sub(p2, p1);\r
-                               return v;\r
-                       } else {\r
-                               if (pcp.isInstanceOf(ProcessResource.plant3Dresource.VariableAngleTurnControlPoint))\r
-                                       throw new RuntimeException("Cannot calculate path leg direction for unconnected variable angle control point " + pcp.getResource());\r
-                               if (previous == null) {\r
-                                       if (!pcp.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint))\r
-                                               throw new RuntimeException("Cannot calculate path leg direction for unconnected control point " + pcp.getResource());\r
-                                       else\r
-                                               return getDirectedControlPointDirection(pcp);\r
-                               } else {\r
-                                       if (pcp.isInstanceOf(ProcessResource.plant3Dresource.InlineControlPoint)) {\r
-                                               Point3d p1 = G3DTools.getPoint(previous.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-                                               Point3d p2 = G3DTools.getPoint(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-                                               Vector3d v = new Vector3d();\r
-                                               v.sub(p2, p1);\r
-                                               return v;\r
-                                       }\r
-                                       throw new RuntimeException("Missing implementation");\r
-                               }\r
-                       }\r
-               } else {\r
-                       if (previous != null) {\r
-                               if (pcp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint))\r
-                                       pcp = pcp.getSingleRelatedObject(ProcessResource.plant3Dresource.SubPointOf);\r
-                               Point3d p1 = G3DTools.getPoint(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-                               Point3d p2 = G3DTools.getPoint(previous.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-                               Vector3d v = new Vector3d();\r
-                               v.sub(p2, p1);\r
-                               return v;\r
-                       } else {\r
-                               if (pcp.isInstanceOf(ProcessResource.plant3Dresource.VariableAngleTurnControlPoint))\r
-                                       throw new RuntimeException("Cannot calculate path leg direction for unconnected variable angle control point " + pcp.getResource());\r
-                               if (next == null) {\r
-                                       if (!pcp.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint))\r
-                                               throw new RuntimeException("Cannot calculate path leg direction for unconnected control point " + pcp.getResource());\r
-                                       else {\r
-                                               Vector3d v = getDirectedControlPointDirection(pcp);\r
-                                               v.negate();\r
-                                               return v;\r
-                                       }\r
-                               } else {\r
-                                       if (pcp.isInstanceOf(ProcessResource.plant3Dresource.InlineControlPoint)) {\r
-                                               Point3d p1 = G3DTools.getPoint(next.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-                                               Point3d p2 = G3DTools.getPoint(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-                                               Vector3d v = new Vector3d();\r
-                                               v.sub(p2, p1);\r
-                                               return v;\r
-                                       }\r
-                                       throw new RuntimeException("Missing implementation");\r
-                               }\r
-                       }\r
-               }\r
-               \r
-       }\r
-       \r
-       /**\r
-        * Return positions (world) of an InlineComponents ends\r
-        * @param pcp\r
-        * @param p1\r
-        * @param p2\r
-        */\r
-       public static void getInlineControlPointEnds(IEntity pcp, Point3d p1, Point3d p2) {\r
-               assert (pcp.isInstanceOf(ProcessResource.plant3Dresource.InlineControlPoint));\r
-               \r
-               Point3d pos = G3DTools.getPoint(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-               Vector3d dir = ControlPointTools.getPathLegDirection(pcp, Direction.NEXT);\r
-               dir.normalize();\r
-               double length = pcp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-               dir.scale(length * 0.5);\r
-               p1.set(pos);\r
-               p2.set(pos);\r
-               p1.add(dir);\r
-               p2.sub(dir);\r
-       }\r
-       \r
-       /**\r
-        * Return positions (world) of an InlineComponents ends\r
-        * @param pcp\r
-        * @param p1\r
-        * @param p2\r
-        */\r
-       public static void getInlineControlPointEnds(IEntity pcp, Point3d p1, Point3d p2, Vector3d dir) {\r
-               assert (pcp.isInstanceOf(ProcessResource.plant3Dresource.InlineControlPoint));\r
-               \r
-               Point3d pos = G3DTools.getPoint(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-               dir.set(ControlPointTools.getPathLegDirection(pcp, Direction.NEXT));\r
-               double length = pcp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-               Vector3d d = new Vector3d(dir);\r
-               d.scale(length * 0.5);\r
-               p1.set(pos);\r
-               p2.set(pos);\r
-               p1.add(d);\r
-               p2.sub(d);\r
-       }\r
-       \r
-       /**\r
-        * Return positions (world) of an InlineComponents ends\r
-        * @param pcp\r
-        * @param p1\r
-        * @param p2\r
-        */\r
-       public static void getInlineControlPointEnds(IEntity pcp, Point3d center, Point3d p1, Point3d p2, Vector3d dir) {\r
-               assert (pcp.isInstanceOf(ProcessResource.plant3Dresource.InlineControlPoint));\r
-               \r
-               Point3d pos = G3DTools.getPoint(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-               center.set(pos);\r
-               dir.set(ControlPointTools.getPathLegDirection(pcp, Direction.NEXT));\r
-               double length = pcp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-               Vector3d d = new Vector3d(dir);\r
-               d.scale(length * 0.5);\r
-               p1.set(pos);\r
-               p2.set(pos);\r
-               p1.add(d);\r
-               p2.sub(d);\r
-       }\r
-       \r
-       public static double getInlineLength(IEntity pcp) {\r
-       double l2 = 0.0;\r
-       if (pcp.isInstanceOf(ProcessResource.plant3Dresource.TurnControlPoint)) {\r
-               l2 += pcp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-       } else if (pcp.isInstanceOf(ProcessResource.plant3Dresource.InlineControlPoint)) {\r
-               l2 += pcp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength) * 0.5;\r
-       }\r
-       return l2;\r
-    }\r
-       \r
-       /**\r
-        * Returns position (world) of a single port\r
-        * @param pcp\r
-        * @param type\r
-        * @return\r
-        */\r
-       public static Point3d getRealPosition(IEntity pcp, PositionType type) {\r
-               PipeControlPoint p= new PipeControlPoint(pcp);\r
-               Point3d pos = G3DTools.getPoint(p.getWorldPosition());\r
-               switch (type) {\r
-               case NEXT: {\r
-                       Vector3d dir = ControlPointTools.getPathLegDirection(pcp,Direction.NEXT);\r
-                       double length = getInlineLength(pcp);\r
-                       dir.normalize();\r
-                       dir.scale(length);\r
-                       pos.add(dir);\r
-                       break;\r
-               }\r
-               case PREVIOUS: {\r
-                       Vector3d dir = ControlPointTools.getPathLegDirection(pcp,Direction.PREVIOUS);\r
-                       double length = getInlineLength(pcp);\r
-                       dir.normalize();\r
-                       dir.scale(length);\r
-                       pos.add(dir);\r
-                       break;\r
-               }\r
-               case PORT:\r
-                       // IEntity portDir = pcp.getSingleRelatedObject(ProcessResource.plant3Dresource.HasDirection);\r
-                       // TODO : how we calculated needed space for a port; does it has an offset from control point's position or not?\r
-                       break;\r
-               case SPLIT:\r
-                       // do nothing\r
-                       break;\r
-                       \r
-               }\r
-               return pos;\r
-       }\r
-       \r
-       public static void getInlineMovement(PipeControlPoint pcp, Point3d start, Point3d end) {\r
-               // FIXME : check type of neighbor components and allow movement on top of variable length components,\r
-               //         ffind proper range for movement (pcp's position is not)\r
-               PipeControlPoint prev = pcp.getPrevious().getPrevious();\r
-               PipeControlPoint next = pcp.getNext().getNext();\r
-               start.set(G3DTools.getPoint(prev.getWorldPosition()));\r
-               end.set(G3DTools.getPoint(next.getWorldPosition()));\r
-       }\r
-       \r
-       public static AxisAngle4d getControlPointLocalRotation(IEntity pcp, double angle) {\r
-               Quat4d q1 = getControlPointLocalOrientationQuat(pcp, angle);\r
-        AxisAngle4d aa= new AxisAngle4d();\r
-               aa.set(q1);\r
-               return aa;\r
-       }\r
-       \r
-       public static AxisAngle4d getControlPointWorldRotation(IEntity pcp, double angle) {\r
-               Quat4d q1 = getControlPointWorldOrientationQuat(pcp, angle);\r
-        AxisAngle4d aa= new AxisAngle4d();\r
-               aa.set(q1);\r
-               return aa;\r
-       }\r
-       \r
-\r
-    public static Quat4d getControlPointLocalOrientationQuat(IEntity pcp, double angle) {\r
-       return getControlPointLocalOrientationQuat(pcp, angle, false);\r
-    }\r
-    \r
-    public static Quat4d getControlPointWorldOrientationQuat(IEntity pcp, double angle) {\r
-       return getControlPointWorldOrientationQuat(pcp, angle, false);\r
-    }\r
-    \r
-    public static Quat4d getControlPointLocalOrientationQuat(IEntity cp, double angle, boolean offset) {\r
-       PipeControlPoint pcp = new PipeControlPoint(cp);\r
-       PipeControlPoint next;\r
-       // if pcp is size change control point with offset, next control point is not in line with previous and pcp control point (it's offsetted)\r
-       // else it's more numerically stable to use next control point\r
-       if (offset)\r
-               next = pcp;\r
-       else\r
-               next = pcp.getNext();\r
-       \r
-       PipeControlPoint prev = pcp.getPrevious();\r
-        assert (next != null || prev != null);\r
-        if (prev == null)\r
-               prev = pcp;\r
-        else if (next == null)\r
-               next = pcp;\r
-        // TODO : check correct type\r
-        if (pcp.isInstanceOf(ProcessResource.plant3Dresource.PathLegEndControlPoint) && pcp.getPrevious() == null) {\r
-               PipeControlPoint temp = next;\r
-               next = prev;\r
-               prev = temp;\r
-        }\r
-        Vector3d current = new Vector3d(G3DTools.getPoint(next.getLocalPosition()));\r
-        current.sub(G3DTools.getPoint(prev.getLocalPosition()));\r
-        current.normalize();\r
-        return getControlPointOrientationQuat(current, angle);\r
-    }\r
-    \r
-    public static Quat4d getControlPointWorldOrientationQuat(IEntity cp, double angle, boolean offset) {\r
-       PipeControlPoint pcp = new PipeControlPoint(cp);\r
-       PipeControlPoint next;\r
-       // if pcp is size change control point with offset, next control point is not in line with previous and pcp control point (it's offsetted)\r
-       // else it's more numerically stable to use next control point\r
-       if (offset)\r
-               next = pcp;\r
-       else\r
-               next = pcp.getNext();\r
-       \r
-       PipeControlPoint prev = pcp.getPrevious();\r
-        assert (next != null || prev != null);\r
-        if (prev == null)\r
-               prev = pcp;\r
-        else if (next == null)\r
-               next = pcp;\r
-        // TODO : check correct type\r
-        if (pcp.isInstanceOf(ProcessResource.plant3Dresource.PathLegEndControlPoint) && pcp.getPrevious() == null) {\r
-               PipeControlPoint temp = next;\r
-               next = prev;\r
-               prev = temp;\r
-        }\r
-        Vector3d current = new Vector3d(G3DTools.getPoint(next.getWorldPosition()));\r
-        current.sub(G3DTools.getPoint(prev.getWorldPosition()));\r
-        current.normalize();\r
-        return getControlPointOrientationQuat(current, angle);\r
-    }\r
-    \r
-    public static Quat4d getControlPointOrientationQuat(Vector3d dir, double angle) {\r
-\r
-        \r
-        final Vector3d front = new Vector3d(1.0,0.0,0.0);\r
-        \r
-        Quat4d q1 = new Quat4d();\r
-\r
-               Vector3d up = new Vector3d(0.0, 1.0, 0.0);\r
-               double a = up.angle(dir);\r
-               if (a < 0.1 || (Math.PI - a) < 0.1) {\r
-                       up.set(1.0, 0.0, 0.0);\r
-               }\r
-\r
-               Vector3d right = new Vector3d();\r
-\r
-               right.cross(dir, up);\r
-               up.cross(right, dir);\r
-               right.normalize();\r
-               up.normalize();\r
-\r
-               Matrix3d m = new Matrix3d();\r
-               m.m00 = dir.x;\r
-               m.m10 = dir.y;\r
-               m.m20 = dir.z;\r
-               m.m01 = up.x;\r
-               m.m11 = up.y;\r
-               m.m21 = up.z;\r
-               m.m02 = right.x;\r
-               m.m12 = right.y;\r
-               m.m22 = right.z;\r
-\r
-               //q1.set(m); MathTools contains more stable conversion\r
-               MathTools.getQuat(m, q1);\r
-\r
-               if (DEBUG) System.out.println("PipingTools.getPipeComponentOrientationQuat() " + dir+ " " + up + " " + right);\r
-\r
-               Quat4d q2 = new Quat4d();\r
-               q2.set(new AxisAngle4d(front, angle));\r
-               q1.mul(q2);\r
-               return q1;\r
-    }\r
-    \r
-    public static PipeControlPoint findPreviousEnd(PipeControlPoint tcp) {\r
-       // TODO : optimize (we do not need the list here)\r
-       ArrayList<PipeControlPoint> t = new ArrayList<PipeControlPoint>();\r
-        return findPreviousEnd(tcp, t);\r
-    }\r
-    \r
-    public static PipeControlPoint findNextEnd(PipeControlPoint tcp) {\r
-        // TODO : optimize (we do not need the list here)\r
-       ArrayList<PipeControlPoint> t = new ArrayList<PipeControlPoint>();\r
-        return findNextEnd(tcp, t);\r
-    }\r
-    \r
-    /**\r
-     * Returns pipe leg's end using "nextControlPoint" relation and collects control point in the given list. \r
-     * @param tcp\r
-     * @param nextList\r
-     * @return\r
-     */\r
-    public static PipeControlPoint findNextEnd(PipeControlPoint tcp, ArrayList<PipeControlPoint> nextList) {\r
-       if (DEBUG) System.out.print("PipingTools.findNextEnd " + tcp.getResource());\r
-        while (true) {\r
-            PipeControlPoint pcp = null;\r
-            PipeControlPoint p = null;\r
-            if (nextList.size() == 0)\r
-                p = tcp;\r
-                \r
-            else\r
-                p = nextList.get(nextList.size() - 1);\r
-\r
-            pcp = p.getNext();\r
-            if (pcp == null) {\r
-               pcp = p;\r
-               if (nextList.size() > 0)\r
-                       nextList.remove(nextList.size() - 1);\r
-               if (DEBUG) System.out.println(" " + pcp.getResource() + " not full");\r
-               return pcp;\r
-               //break;\r
-            }\r
-            if (pcp.isInstanceOf(ProcessResource.plant3Dresource.PathLegEndControlPoint)) {\r
-               if (DEBUG) System.out.println(" " + pcp.getResource());\r
-                return pcp;\r
-            } else {\r
-                nextList.add(pcp);\r
-                if (DEBUG) System.out.print(" " + pcp.getResource());\r
-            }\r
-        }\r
-    }\r
-    \r
-   \r
-    \r
-    /**\r
-     * Returns pipe leg's end using "previousControlPoint" relation and collects control point in the given list.\r
-     * @param tcp\r
-     * @param prevList\r
-     * @return\r
-     */\r
-    public static PipeControlPoint findPreviousEnd(PipeControlPoint tcp, ArrayList<PipeControlPoint> prevList) {\r
-       if (DEBUG) System.out.print("PipingTools.findPreviousEnd " + tcp.getResource());\r
-        while (true) {\r
-            PipeControlPoint pcp = null;\r
-            PipeControlPoint p = null;\r
-            if (prevList.size() == 0)\r
-                p = tcp;\r
-                \r
-            else\r
-                p = prevList.get(prevList.size() - 1);\r
-\r
-            pcp = p.getPrevious();\r
-            if (pcp == null) {\r
-               pcp = p;\r
-               if (prevList.size() > 0)\r
-                       prevList.remove(prevList.size() - 1);\r
-               if (DEBUG) System.out.println(" " + pcp.getResource() + " not full");\r
-               return pcp;\r
-            }\r
-            if (pcp.isInstanceOf(ProcessResource.plant3Dresource.PathLegEndControlPoint)) {\r
-               if (DEBUG) System.out.println(" " + pcp.getResource());\r
-                return pcp;\r
-            } else {\r
-               prevList.add(pcp);\r
-                if (DEBUG) System.out.print(" " + pcp.getResource());\r
-            }\r
-        }\r
-    }\r
-    \r
-    public static PipeRun getPipeRun(PipeControlPoint pcp) {\r
-       return pcp.getControlPointOfPipeRun();\r
-    }\r
-    \r
-    @Deprecated\r
-    public static Vector3d getSizeChangeOffsetVector(PipeControlPoint sccp) {\r
-       Quat4d q = getControlPointWorldOrientationQuat(sccp, sccp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasRotationAngle),true);\r
-       return getSizeChangeOffsetVector(sccp,q);\r
-    }\r
-    \r
-    public static Vector3d getSizeChangeOffsetVector(PipeControlPoint sccp, Vector3d dir) {\r
-       Quat4d q = getControlPointOrientationQuat(dir, sccp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasRotationAngle));\r
-       return getSizeChangeOffsetVector(sccp,q);\r
-    }\r
-    \r
-    public static Vector3d getSizeChangeOffsetVector(PipeControlPoint sccp, Quat4d q) {\r
-       Vector3d v = new Vector3d(0.0,0.0,sccp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasOffset));\r
-       Vector3d offset = new Vector3d();\r
-       MathTools.rotate(q, v, offset);\r
-       return offset;\r
-    }\r
-    \r
-    public static Vector3d getDirectedControlPointDirection(IEntity dcp) {\r
-       assert(dcp.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint));\r
-       AxisAngle4d worldR = G3DTools.getOrientation(dcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldOrientation));\r
-       Quat4d q = new Quat4d();\r
-               q.set(worldR);\r
-               Vector3d dir = new Vector3d();\r
-               MathTools.rotate(q, new Vector3d(1.0, 0.0, 0.0), dir);\r
-               dir.normalize();\r
-               return dir;\r
-    }\r
-    \r
-    public static Vector3d getNozzleDirection(IEntity rotation) {\r
-       AxisAngle4d worldR = G3DTools.getOrientation(rotation);\r
-        Quat4d q = new Quat4d();\r
-               q.set(worldR);\r
-               Vector3d dir = new Vector3d();\r
-               MathTools.rotate(q, new Vector3d(1.0, 0.0, 0.0), dir);\r
-               return dir;\r
-    }\r
-    \r
-    public static Vector3d getNozzleDirection(PipeControlPoint dcp) {\r
-       return getNozzleDirection(dcp.getWorldOrientation());\r
-    }\r
-\r
-    public static void removeControlPoint(PipeControlPoint removed) {\r
-       if (DEBUG) System.out.println("PipingTools.removeControlPoint() controlpoint " + removed.getResource());//FIXME : offset + size change control points !\r
-       \r
-       // this code is not valid anymore.\r
-       \r
-       // different removing cases:\r
-       //\r
-       // 1. Point is SizeChangeControlPoint  (this is currently ok)\r
-       //    * remove offset point and component \r
-       //    * do NOT link components together\r
-       //\r
-       // 2. Point is VariableLength\r
-       //    * check if its a branch (TODO : ontology support?)\r
-       //      * if so, also branch point in the other piperun may have to be removed\r
-       //        (we cannot move other components next to branch)\r
-       //      * if not, components next to removed one are moved next to each other\r
-       // 3. Other\r
-       //    * check if there is VariableLength on both sides,\r
-       //              * if so, those must be unified to a single Variable Length component.\r
-       //      * if not, components must be moved next to each other\r
-       //\r
-       // a) If removed Control Point is next to Nozzle and after the point is removed nozzle is not connected to anything\r
-       //    * nozzle's link to piperun's specs must be removed\r
-       //    \r
-       \r
-       \r
-       if (removed.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)||\r
-               removed.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-               // sccp & ocp connect two pipeRuns to each other; when thoes are remove, pipeRuns are not connected to each other anymore.\r
-               removeDualPoint(removed);\r
-               return;\r
-       } else {\r
-               PipeControlPoint prev = removed.getPrevious();\r
-            PipeControlPoint next = removed.getNext();\r
-               PipeRun pipeRun = getPipeRun(removed);\r
-               if (pipeRun == null)\r
-                       return;\r
-               if (next == null && prev == null) {\r
-                               if (removed.isInstanceOf(ProcessResource.plant3Dresource.NozzleControlPoint)) {\r
-                                       // Nozzle's control point does not need to be removed, only unlinked\r
-                                       // TODO : what about component ports?\r
-                                       PipingTools2.unlinkNozzleAndPiperun(removed.getSingleRelatedObject(ProcessResource.plant3Dresource.ControlPointOf), ControlPointTools.getPipeRun(removed));\r
-                                       return;\r
-                               }\r
-                       } else {\r
-\r
-                               if (next != null && prev != null) {\r
-                                       boolean link = true;\r
-                                       if (next.isInstanceOf(ProcessResource.plant3Dresource.BranchEndControlPoint)){\r
-                                               link = false;\r
-                                               next.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                               removed.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                               removeControlPoint(next);\r
-                                       }\r
-                                       if (prev.isInstanceOf(ProcessResource.plant3Dresource.BranchEndControlPoint)) {\r
-                                               link = false;\r
-                                               prev.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                               removed.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                               removeControlPoint(prev);\r
-                                       }\r
-                                       if (link && prev.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)&&\r
-                                                               next.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)) {\r
-                                               link = false;\r
-                                       }\r
-                                       if (next.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                                               PipeControlPoint sccp = next;\r
-                                               PipeControlPoint ocp = sccp.getSubPoint().iterator().next();\r
-                                               if (ocp == null) {\r
-                                                       ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource()+ " structure damaged, no offset control point",null);\r
-                                                       return;\r
-                                               }\r
-                                               if (link) {\r
-                                                       sccp.setPrevious(prev);\r
-                                                       ocp.setPrevious(prev);\r
-                                               } else {\r
-                                                       sccp.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                                       ocp.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                                       \r
-                                               }\r
-                                               removed.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                       } else if (next.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                                               ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource()+ " structure damaged, next control point is offset control point",null);\r
-                                               return;\r
-                                       } else if (next.getPrevious().getResource().equals(removed.getResource())) {\r
-                                               if (link) {\r
-                                                       next.setPrevious(prev);\r
-                                               } else {\r
-                                                       next.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                               }\r
-                                               removed.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                       } else {\r
-                                               ErrorLogger.defaultLogError("Removing PipeControlPoint "+ removed.getResource()+ " structure damaged", null);\r
-                                               return;\r
-                                       }\r
-                                       if (prev.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                                               ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource() + " structure damaged, previous control point is size change control point", null);\r
-                                               return;\r
-                                       } else if (prev.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                                               PipeControlPoint ocp = prev;\r
-                                               PipeControlPoint sccp = ocp.getSubPointOf();\r
-                                               if (sccp == null) {\r
-                                                       ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource() + " structure damaged, no size change control point",null);\r
-                                                       return;\r
-                                               }\r
-                                               if (link) {\r
-                                                       ocp.setNext(next);\r
-                                                       sccp.setNext(next);\r
-                                               } else {\r
-                                                       ocp.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                                       sccp.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                               }\r
-                                               removed.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                       } else if (prev.getNext().getResource().equals(removed.getResource())) {\r
-                                               if (link)\r
-                                                       prev.setNext(next);\r
-                                               else\r
-                                                       prev.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                               removed.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                       } else {\r
-                                               ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource() + " structure damaged", null);\r
-                                               return;\r
-                                       }\r
-                                       if (link) {\r
-                                               if (next.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthControlPoint) &&\r
-                                                       prev.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthControlPoint)) {\r
-                                                       // we have to join them into single variable length component.\r
-                                                       removeControlPoint(prev);\r
-                                               }\r
-                                       }\r
-\r
-                                       \r
-                               } else if (next != null) {\r
-                                       if (next.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                                               PipeControlPoint sccp = next;\r
-                                               PipeControlPoint ocp = sccp.getSubPoint().iterator().next();\r
-                                               if (ocp == null) {\r
-                                                       ErrorLogger.defaultLogError("Removing PipeControlPoint "+ removed.getResource()+ " structure damaged, no offset control point",null);\r
-                                                       return;\r
-                                               }\r
-                                               next.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                               ocp.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                       } else if (next.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                                               ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource() + " structure damaged, next control point is offset control point", null);\r
-                                               return;\r
-                                       } else if (next.getPrevious().getResource().equals(removed.getResource())) {\r
-                                               next.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                                       } else {\r
-                                               ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource() + " structure damaged", null);\r
-                                               return;\r
-                                       }\r
-                                       removed.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                               } else { //(prev != null)\r
-                                       if (prev.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                                               ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource() + " structure damaged, previous control point is size change control point", null);\r
-                                               return;\r
-                                       } else if (prev.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                                               PipeControlPoint ocp = prev;\r
-                                               PipeControlPoint sccp = ocp.getSubPointOf();\r
-                                               if (sccp == null) {\r
-                                                       ErrorLogger.defaultLogError("Removing PipeControlPoint " + removed.getResource() + " structure damaged, no size change control point", null);\r
-                                                       return;\r
-                                               }\r
-                                               prev.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                               sccp.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                       } else if (prev.getNext().getResource().equals(removed.getResource())) {\r
-                                               prev.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-                                       } else {\r
-                                               ErrorLogger.defaultLogError("Removing PipeControlPoint "+ removed.getResource() + " structure damaged", null);\r
-                                               return;\r
-                                       }\r
-                                       removed.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-                               }\r
-\r
-                       }\r
-                       if (removed.getSubPoint().size() > 0 ) {\r
-                               removeSubPoints(removed);\r
-                       } else if (removed.getSubPointOf() != null) {\r
-                               removeParentPoint(removed);\r
-                       }\r
-                               \r
-                       removeComponents(removed);\r
-                       \r
-                       pipeRun.removeStatement(ProcessResource.plant3Dresource.HasControlPoints, removed);\r
-                       if (pipeRun.getChild().size() == 0) {\r
-                               PipingTools2.removePipeRun(pipeRun);\r
-                       } \r
-                       else if (pipeRun.getControlPoints().size() == 1) {\r
-               removeControlPoint(pipeRun.getControlPoints().iterator().next());\r
-            }\r
-               }\r
-        \r
-    }\r
-    \r
-    private static void removeDualPoint(PipeControlPoint removed) {\r
-       PipeControlPoint prev = removed.getPrevious();\r
-        PipeControlPoint next = removed.getNext();\r
-       if (prev != null) {\r
-               prev.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-               }\r
-               if (next != null)\r
-                       next.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-               PipeControlPoint ocp;\r
-               PipeControlPoint sccp;\r
-               // get sccp / ocp pair\r
-               if (removed.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                       sccp = removed;\r
-               ocp = sccp.getSubPoint().iterator().next();\r
-               \r
-               } else {\r
-                       ocp = removed;\r
-               sccp = ocp.getSubPointOf();\r
-               }\r
-               PipeRun p1 = getPipeRun(ocp);\r
-               PipeRun p2 = getPipeRun(sccp);\r
-               \r
-               //  removes all components connected to control point\r
-        \r
-        removeComponents(ocp);\r
-        \r
-        removeComponents(sccp); \r
-        \r
-        // remove control points from pipeRuns\r
-        p1.removeStatement(ProcessResource.plant3Dresource.HasControlPoints, ocp);\r
-        p2.removeStatement(ProcessResource.plant3Dresource.HasControlPoints, sccp);\r
-\r
-        // remove links to other control points\r
-        ocp.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);\r
-        sccp.removeRelatedStatements(ProcessResource.plant3Dresource.HasNext);            \r
-        ocp.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);\r
-        sccp.removeRelatedStatements(ProcessResource.plant3Dresource.HasPrevious);            \r
-        \r
-        // if pipeRuns contains no other components(control points), they can be removed too.\r
-        if (p1.getControlPoints().size() == 0) {\r
-               PipingTools2.removePipeRun(p1);\r
-        } else if (p1.getControlPoints().size() == 1) {\r
-               removeControlPoint(p1.getControlPoints().iterator().next());\r
-        }\r
-        if (p2.getControlPoints().size() == 0) {\r
-               PipingTools2.removePipeRun(p2);\r
-        } else if (p2.getControlPoints().size() == 1) {\r
-               removeControlPoint(p2.getControlPoints().iterator().next());\r
-        }\r
-    }\r
-    \r
-    /**\r
-     * Removes sub points of a point\r
-     * @param removed\r
-     * @throws TransactionException\r
-     */\r
-    private static void removeSubPoints(PipeControlPoint removed) {\r
-       // if control point is branch control point, all branch of points must be removed too\r
-               Collection<PipeControlPoint> points = removed.getSubPoint();\r
-               \r
-               for (PipeControlPoint p : points) {\r
-                       removed.removeStatement(ProcessResource.plant3Dresource.HasSubPoint, p);\r
-                       removeControlPoint(p);\r
-               }\r
-    }\r
-    \r
-    /**\r
-     * Removed point is a subpoint of something, \r
-     * @param removed\r
-     */\r
-    private static void removeParentPoint(PipeControlPoint removed)  {\r
-       throw new RuntimeException("Subpoints cannot be removed");\r
-       \r
-       // if control point is branch it has to be removed from branch control point\r
-//             BranchEndControlPoint ecp = BranchEndControlPointFactory.create(removed);\r
-//             BranchControlPoint bcp = null;\r
-//             if (ecp.getBranchOfPointSet().size() == 1) {\r
-//                     bcp = ecp.getBranchOfPointSet().iterator().next();\r
-//             }\r
-//             if (bcp != null) {\r
-//                     bcp.getBranchPointSet().remove(ecp);\r
-//                     if (bcp.getBranchPointSet().size() == 0) {\r
-//                             // branch control point is not used and can be removed\r
-//                             removeControlPoint(bcp);\r
-//                     }\r
-//             }\r
-    }\r
\r
-    \r
-    private static void removeComponents(PipeControlPoint pcp) {\r
-       IEntity component = pcp.getControlPointOf();\r
-       if (component != null) {\r
-               PipeRun p1 = getPipeRun(pcp);\r
-               p1.removeStatement(ProcessResource.g3dResource.HasChild, component);\r
-               component.removeRelatedStatements(ProcessResource.plant3Dresource.HasControlPoint);\r
-       }\r
-    }\r
-    \r
-    private static void setStatement(IEntity subject, Resource relation, IEntity object) {\r
-       subject.removeRelatedStatements(relation);\r
-       subject.addStatement(relation, object);\r
-    }\r
-    \r
-    \r
-    public static void setWorldPosition(IEntity pcp, Tuple3d position) {\r
-       IEntity wp = pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition);\r
-       G3DTools.setTuple3(wp, position);\r
-       tt.propagateWorldTransformChange(tt.getParent(pcp), pcp);\r
-       \r
-    }\r
-    \r
-    public static void setLocalPosition(IEntity pcp, Tuple3d position) {\r
-       G3DTools.setTuple3(pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasLocalPosition), position);\r
-       tt.propagateLocalTransformChange(tt.getParent(pcp), pcp);\r
-    }\r
-    \r
-    public static void setWorldOrientation(IEntity node, AxisAngle4d orientation) {\r
-               G3DTools.setOrientation(node.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldOrientation), orientation);\r
-               tt.propagateWorldTransformChange(tt.getParent(node), node);\r
-               \r
-       }\r
-       \r
-       public static void setLocalOrientation(IEntity node, AxisAngle4d orientation) {\r
-               G3DTools.setOrientation(node.getSingleRelatedObject(ProcessResource.g3dResource.HasLocalOrientation), orientation);\r
-               tt.propagateLocalTransformChange(tt.getParent(node), node);\r
-       }\r
-    \r
-    private static boolean updatePosition(IEntity pcp) {\r
-       return tt.transformationUpdate(pcp);\r
-       \r
-       \r
-       // TODO : orientation is also needed, current code handles only position\r
-       // TODO : reuse the code in G3DTools!\r
-       /*\r
-       IEntity worldPosition = pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition);\r
-       IEntity localPosition = pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasLocalPosition);\r
-       \r
-       \r
-       Tuple3d worldP = G3DTools.getPoint(worldPosition);\r
-        Tuple3d localP = G3DTools.getPoint(localPosition);\r
-\r
-        if (localP == null || worldP == null)\r
-            return false;\r
-        if (!isValid(worldP) && !isValid(localP))\r
-               return false;\r
-\r
-        Tuple3d cachedWorldP = (Tuple3d) getProperty(worldPosition.getResource());\r
-        Tuple3d cachedLocalP = (Tuple3d) getProperty(localPosition.getResource());\r
-\r
-        if (DEBUG) System.out.println("PipeControlPoint changed " + worldP + " " + cachedWorldP + " " + localP + " " + cachedLocalP);\r
-        boolean changed = false;\r
-\r
-        IEntity parent = pcp.getSingleRelatedObject(ProcessResource.plant3Dresource.ControlPointOf);\r
-        \r
-        if (parent == null) {\r
-               if (DEBUG) System.out.println("PipeControlPoint changed, no parent node");\r
-            return false;\r
-        }\r
-\r
-        if (cachedLocalP == null) {\r
-            storeProperty(localPosition.getResource(), localP);\r
-            Tuple3d p = G3DTools.getWorldFromLocal(parent, new Point3d(localP)); \r
-            storeProperty(worldPosition.getResource(), p);\r
-            G3DTools.setTuple3(worldPosition, p);\r
-            if (DEBUG) System.out.println("PipeControlPoint changed local " + worldP + " " + p);\r
-            changed = true;\r
-        } else {\r
-            if (TransformationTools.changed(cachedLocalP, localP)) {\r
-                storeProperty(localPosition.getResource(), localP);\r
-                Tuple3d p = G3DTools.getWorldFromLocal(parent, new Point3d(localP));\r
-                storeProperty(worldPosition.getResource(), p);\r
-                G3DTools.setTuple3(worldPosition, p);\r
-                if (DEBUG) System.out.println("PipeControlPoint changed local " + worldP + " " + localP);\r
-                changed = true;\r
-            }\r
-            if (cachedWorldP == null) {\r
-                storeProperty(worldPosition.getResource(), worldP);\r
-                Tuple3d p = G3DTools.getLocalFromWorld(parent, new Point3d(worldP));\r
-                G3DTools.setTuple3(localPosition, p);\r
-                storeProperty(localPosition.getResource(), p);\r
-                if (DEBUG) System.out.println("PipeControlPoint changed world " + worldP + " " + p);\r
-                changed = true;\r
-            } else {\r
-                if (TransformationTools.changed(cachedWorldP, worldP)) {\r
-                    storeProperty(worldPosition.getResource(), worldP);\r
-                    Tuple3d p = G3DTools.getLocalFromWorld(parent, new Point3d(worldP));\r
-                    G3DTools.setTuple3(localPosition, p);\r
-                    storeProperty(localPosition.getResource(), p);\r
-                    if (DEBUG) System.out.println("PipeControlPoint changed world " + worldP + " " + p);\r
-                    changed = true;\r
-                }\r
-            }\r
-        }\r
-        return changed;\r
-        //*/\r
-    }\r
-    \r
-    static boolean isControlPointChanged(PipeControlPoint node) {\r
-       long id = node.getResource().getResourceId();\r
-       boolean changed = updatePosition(node);\r
-        //if (!changed) {\r
-               if (node.isInstanceOf(ProcessResource.plant3Dresource.PathLegEndControlPoint)) {\r
-                       if (node.isInstanceOf(ProcessResource.plant3Dresource.TurnControlPoint)) {\r
-                               Pair<Long,Long> connected = (Pair<Long,Long>)getProperty(node.getResource().getResourceId());\r
-                    PipeControlPoint next = node.getNext();\r
-                    PipeControlPoint prev = node.getPrevious();\r
-                    if ((next != null && prev != null) && (\r
-                        connected == null || \r
-                       (connected.first == null && prev != null) ||\r
-                       (connected.second == null && next != null) ||\r
-                        !connected.first.equals(prev.getResource().getResourceId()) ||\r
-                        !connected.second.equals(next.getResource().getResourceId()))) {\r
-                       storeProperty(id, new Pair<Long,Long>(prev.getResource().getResourceId(),next.getResource().getResourceId()));\r
-                        changed = true;  \r
-                    }\r
-                    if (node.isInstanceOf(ProcessResource.plant3Dresource.VariableAngleTurnControlPoint)) {\r
-                       double r = node.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasTurnRadius);\r
-                       Double d = (Double)getProperty(id + ":turnradius");\r
-                       if (d == null || TransformationTools.changed(r, d)) {\r
-                               storeProperty(id + ":turnradius", r);\r
-                               changed = true;\r
-                       }\r
-                    }\r
-                       }\r
-                       else if (node.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)) {\r
-                               Vector3d dir = ControlPointTools.getDirectedControlPointDirection(node);\r
-                               Vector3d old = (Vector3d)getProperty(id + ":direction");\r
-                               if (old == null || TransformationTools.changed(dir, old)) {\r
-                                       storeProperty(id + ":direction", dir);\r
-                                       changed = true;\r
-                               }\r
-                       }\r
-               } else { // InlineControlPoint\r
-                       if (node.isInstanceOf(ProcessResource.plant3Dresource.FixedLengthControlPoint)) {\r
-                               double length = node.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-                               Double d = (Double)getProperty(id + ":length");\r
-                               if (d == null)\r
-                                       changed = true;\r
-                               else\r
-                                       changed = changed || TransformationTools.changed(length, d);\r
-                               \r
-                               if (changed) {\r
-                                       storeProperty(id + ":length", length);\r
-                                       return true;\r
-                               }\r
-                       } else \r
-                       if (node.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                               \r
-                               double angle = node.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasRotationAngle);\r
-                               Double d = (Double)getProperty(id + ":rotationangle");\r
-                               if (d == null)\r
-                                       changed = true;\r
-                               else\r
-                                       changed = changed || TransformationTools.changed(angle, d);\r
-                               if (changed) {\r
-                                       storeProperty(id + ":rotationangle", angle);\r
-                                       return true;\r
-                               }\r
-                               Collection<PipeControlPoint> subpoints = node.getSubPoint();\r
-                               if (subpoints.size() != 1)\r
-                                       throw new RuntimeException("Current implementation assumes that size change components are dual conmnected");\r
-                               PipeControlPoint ocp = subpoints.iterator().next();\r
-                               if (node.isInstanceOf(ProcessResource.plant3Dresource.OffsettingPoint)) {\r
-                                       double offset = ocp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasOffset);\r
-                                       d = (Double)getProperty(id +":offset");\r
-                                       if (d == null)\r
-                                               changed = true;\r
-                                       else\r
-                                               changed = TransformationTools.changed(offset, d);\r
-                                       if (changed) {\r
-                                               storeProperty(id+":offset", offset);\r
-                                               return true;\r
-                                       }\r
-                               }\r
-//                     } else if (node instanceof OffsetControlPoint) {\r
-//                             OffsetControlPoint ocp = (OffsetControlPoint)node;\r
-//                             //ocp.\r
-//                     } else if (node instanceof BranchControlPoint) {\r
-//                             BranchControlPoint bcp = (BranchControlPoint)node;\r
-//                             int size = bcp.getBranchPointSet().size();\r
-//                             Integer i = (Integer)getProperty(bcp.getResource().getId());\r
-//                             if (i == null)\r
-//                                     changed =true;\r
-//                             else\r
-//                                     changed = changed || i != size;\r
-//                             if (changed) {\r
-//                                     storeProperty(bcp.getResource().getId(), size);\r
-//                                     return true;\r
-//                             }\r
-                       }\r
-               }\r
-        //}\r
-        \r
-        return changed;\r
-    }\r
-    \r
-    private static boolean isValid(Tuple3d v) {\r
-        if (Double.isInfinite(v.x) || \r
-                 Double.isNaN(v.x) ||\r
-            Double.isInfinite(v.y) || \r
-                 Double.isNaN(v.y) ||\r
-            Double.isInfinite(v.z) || \r
-                 Double.isNaN(v.z))\r
-            return false;\r
-        return true;\r
-    }\r
-    \r
-    private static HashMap<Object, Object> properties = new HashMap<Object, Object>();\r
-    \r
-    public static Object getProperty(Object key) {\r
-        return properties.get(key);\r
-    }\r
-    \r
-    public static void storeProperty(Object key, Object value) {\r
-        properties.put(key, value);\r
-    }\r
-    \r
-    /**\r
-     * Loads positions of controlpoint to rule cache\r
-     * \r
-     * TODO : this caches only transformation information : other info must be cached too\r
-     * \r
-     * @param root resource of the modeled plant\r
-     */\r
-    public static void reloadCache(Graph graph, Resource root) {\r
-        \r
-        Stack<IEntity> stack = new Stack<IEntity>();\r
-        stack.add(EntityFactory.create(graph,root));\r
-        while (!stack.isEmpty()) {\r
-               IEntity current = stack.pop();\r
-               IEntity pcp = current.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasControlPoint);\r
-               if (pcp == null) {\r
-                       stack.addAll(current.getRelatedObjects(ProcessResource.g3dResource.HasChild));\r
-               } else {\r
-                       if (DEBUG) System.out.println("Cached pcp " + pcp.getResource());\r
-                       IEntity localPos = pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasLocalPosition);\r
-                       IEntity worldPos = pcp.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition);\r
-                       \r
-                tt.storeProperty(localPos.getResource(),G3DTools.getPoint(localPos));\r
-                tt.storeProperty(worldPos.getResource(),G3DTools.getPoint(worldPos));\r
-                \r
-                IEntity localOr = pcp.getAtMostOneRelatedObject(ProcessResource.g3dResource.HasLocalOrientation);\r
-                       IEntity worldOr = pcp.getAtMostOneRelatedObject(ProcessResource.g3dResource.HasWorldOrientation);\r
-                       \r
-                       if (worldOr != null) {\r
-                               tt.storeProperty(localOr.getResource(),G3DTools.getOrientation(localOr));\r
-                    tt.storeProperty(worldOr.getResource(),G3DTools.getOrientation(worldOr));\r
-                       }\r
-                       \r
-                stack.addAll(pcp.getRelatedObjects(ProcessResource.plant3Dresource.HasSubPoint));\r
-               }\r
-        }\r
-\r
-    }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PathUtils.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PathUtils.java
deleted file mode 100644 (file)
index 9ddaf04..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.common;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.viewpoints.TraversalPath;\r
-import org.simantics.proconf.browsing.GraphExplorer;\r
-import org.simantics.utils.datastructures.Pair;\r
-\r
-\r
-\r
-\r
-\r
-public class PathUtils {\r
-\r
-       public static void createPath(java.util.List<Resource> samplePath, TraversalPath path, Resource sampleInstance, Resource sampleSource, GraphExplorer oe) {\r
-//             while (tNode != null) {\r
-//                     long[] path = tNode.getPath();\r
-//                     for (int i = 0; i < path.length; i++) {\r
-//                             samplePath.add(i, path[i]);\r
-//                     }\r
-//                     samplePath.add(path.length,tNode.getCoreId());\r
-//                     tNode = oe.getTreeParent(tNode);\r
-//             }\r
-               while (path != null) {\r
-                       Resource predicate = path.getPredicate();\r
-                       Resource obj = path.getResource();\r
-                       if (predicate != null) {\r
-                               samplePath.add(0,predicate);\r
-                               path = path.getTail();\r
-                       } else {\r
-                               // there is no relation and so this has to be root\r
-                               path = null; \r
-                       }\r
-                       samplePath.add(1,obj);\r
-                       \r
-               }\r
-               \r
-               if (!sampleInstance.equals(samplePath.get(0)) || !sampleSource.equals(samplePath.get(samplePath.size()-1))) {\r
-                       String s = "";\r
-                       for (int i = 0; i < samplePath.size(); i++) {\r
-                               s += samplePath.get(i) + " ";\r
-                       }\r
-                       throw new RuntimeException("Path from " + sampleInstance + " to "\r
-                                       + sampleSource + " is broken: " + s);\r
-               }\r
-\r
-//             String s = "";\r
-//             for (int i = 0; i < samplePath.size(); i++) {\r
-//                     s += samplePath.get(i) + " ";\r
-//             }\r
-//             System.out.println("Path from " + sampleInstance + " to " + sampleSource + " is: " + s);\r
-               samplePath.remove(0);\r
-       }\r
-       \r
-       \r
-       \r
-       /**\r
-        * Finds similar path in cloned resource\r
-        * TODO : this isn't correct way to do this;\r
-        * Rigth way would be finding mapping between two clones\r
-        * and then find the similar resource \r
-        * (Viewpoint used to create clone is required)\r
-        * \r
-        * @param path\r
-        * @param begin\r
-        * @return\r
-        */\r
-       public static IEntity findSimilar(java.util.List<Resource> path,  IEntity begin) {\r
-               if (path.size() == 0)\r
-                       return begin;\r
-               if (path.size() == 1)\r
-                       return null;\r
-               Graph g = begin.getGraph();\r
-               java.util.List<Resource> tPath = new ArrayList<Resource>();\r
-               tPath.addAll(path);\r
-               \r
-               Resource p = tPath.get(0); // predicate (relation)\r
-               Resource o = tPath.get(1); // object \r
-               tPath.remove(0);\r
-               tPath.remove(0);\r
-               \r
-               IEntity predicate = EntityFactory.create(g, p);\r
-\r
-               \r
-               Collection<IEntity> possibleObjects = begin.getRelatedObjects(predicate);\r
-               if (possibleObjects.size() == 0)\r
-                       return null;\r
-               if (possibleObjects.size() == 1) \r
-                       return findSimilar(tPath, possibleObjects.iterator().next());\r
-               else {\r
-                       IEntity object = EntityFactory.create(g, o);\r
-                       Collection<IEntity> objectTypes = object.getTypes();\r
-                       java.util.List<Pair<IEntity,IEntity>> list = new ArrayList<Pair<IEntity,IEntity>>();\r
-                       for (IEntity possible : possibleObjects) {\r
-                               boolean matchTypes = true;\r
-                               for (IEntity type : objectTypes) {\r
-                                       if(!possible.isInstanceOf(type)) {\r
-                                               matchTypes = false;\r
-                                               break;\r
-                                       }\r
-                                               \r
-                               }\r
-                               if (matchTypes) {\r
-                                       IEntity r = findSimilar(tPath,possible);\r
-                                       if (r != null)\r
-                                               list.add(new Pair<IEntity,IEntity>(possible,r));\r
-                                               //return r;\r
-                               }\r
-                       }\r
-                       if (list.size() == 0)\r
-                               return null;\r
-                       if (list.size() == 1)\r
-                               return list.get(0).second;\r
-                       else {\r
-                               // uses names of objects to detect similarities\r
-                               String name = object.getName();\r
-                               if (name != null) {\r
-                                       for (Pair<IEntity,IEntity> possible : list) {\r
-                                               String otherName = possible.first.getName();\r
-                                               //System.out.println(name + " : " + otherName);\r
-                                               if (otherName != null && name.compareTo(otherName) == 0)\r
-                                                       return possible.second;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-               \r
-               return null;\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipeComponentProvider.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipeComponentProvider.java
deleted file mode 100644 (file)
index a59e0f8..0000000
+++ /dev/null
@@ -1,531 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.common;\r
-\r
-import java.nio.FloatBuffer;\r
-import java.nio.IntBuffer;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.GeometryProvider;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Line;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.util.geom.BufferUtils;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipelineComponent;\r
-import fi.vtt.simantics.processeditor.stubs.TurnControlPoint;\r
-\r
-\r
-/**\r
- * Geometry provider for pipe components.\r
- * TODO : split into three providers (one for each type) to faster access (ShapeNodes can cache geometry provider)\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class PipeComponentProvider implements GeometryProvider {\r
-       \r
-       \r
-       //private static double ELBOW_RING_ANGLE = 12.0/ Math.PI;\r
-       //private static int RING_SEGMENTS = 8;\r
-       \r
-       private static double ELBOW_RING_ANGLE = 24.0/ Math.PI;\r
-       private static int RING_SEGMENTS = 16;\r
-       \r
-       public boolean canHandle(IEntity instance) {\r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Elbow))\r
-                       return true;\r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Straight))\r
-                       return true;\r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Reducer))\r
-                       return true;    \r
-               return false;\r
-       }\r
-\r
-       \r
-       public Geometry[] getGeometryFromResource(IEntity instance, boolean transform) {\r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Elbow)) {\r
-                       Geometry[] g = new Geometry[]{new TriMesh(),new Line()};\r
-                       if( getElbowGeometry(instance,g)) {\r
-                               return g;\r
-                       }\r
-                       return null;\r
-               }\r
-                       \r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Straight)) {\r
-                       Geometry[] g = new Geometry[]{new TriMesh(),new Line()};\r
-                       if( getStraightGeometry(instance,g)) {\r
-                               return g;\r
-                       }\r
-                       return null;\r
-               }\r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Reducer)) {\r
-                       Geometry[] g = new Geometry[]{new TriMesh(),new Line()};\r
-                       if (getReducerGeometry(instance,g)) {\r
-                               return g;\r
-                       }\r
-                       return null;\r
-               }\r
-               return null;\r
-       }\r
-       \r
-       public boolean reconstructGeometry(IEntity instance, boolean transform, Geometry[] geometry) {\r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Elbow))\r
-                       return getElbowGeometry(instance,geometry);\r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Straight))\r
-                       return getStraightGeometry(instance,geometry);\r
-               if (instance.isInstanceOf(ProcessResource.plant3Dresource.Reducer))\r
-                       return getReducerGeometry(instance,geometry);\r
-               \r
-               return false;\r
-       }\r
-\r
-       public boolean getElbowGeometry(IEntity instance, Geometry[] geometry) {\r
-               PipelineComponent elbow = new PipelineComponent(instance);\r
-               PipeControlPoint pcp = elbow.getControlPoint();\r
-               if (pcp == null) {\r
-                       ErrorLogger.defaultLogError("Elbow " + instance + " has no control point", null);\r
-                       return false;\r
-               }\r
-        TurnControlPoint tcp = new TurnControlPoint(pcp);\r
-        // double turnAngleValue = tcp.getTurnAngleValue();\r
-         \r
-        double pipeRadius = elbow.getPipeDiameter()[0]*0.5;\r
-        double elbowRadius = elbow.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasTurnRadius);\r
-        double R = tcp.getLength()[0]; //getComponentOffset();\r
-        double turnAngle = tcp.getTurnAngle()[0];\r
-\r
-        PipeControlPoint startControlPoint = tcp.getPrevious();\r
-        PipeControlPoint endControlPoint = tcp.getNext();\r
-        if (startControlPoint == null || endControlPoint == null)\r
-            return false;\r
-        \r
-        //Point3d start = getLocalPoint(pipeline,startControlPoint);\r
-        //Point3d middle = getLocalPoint(pipeline,tcp);\r
-        //Point3d end = getLocalPoint(pipeline,endControlPoint);     \r
-        \r
-        Point3d start = G3DTools.getPoint(startControlPoint.getWorldPosition());\r
-        Point3d middle = G3DTools.getPoint(tcp.getWorldPosition());\r
-        Point3d end = G3DTools.getPoint(endControlPoint.getWorldPosition());\r
-        \r
-        Vector3d dir1 = new Vector3d(middle);\r
-        dir1.sub(start);\r
-        Vector3d dir2 = new Vector3d(end);\r
-        dir2.sub(middle);\r
-        \r
-        Vector3d n = new Vector3d(dir1);\r
-        n.normalize();\r
-        Vector3d offset = new Vector3d(n);\r
-\r
-        offset.scale(R);\r
-        Vector3d startPipe = new Vector3d(middle);\r
-        startPipe.sub(offset);\r
-        // normal of the plane\r
-        Vector3d normal = new Vector3d();\r
-        normal.cross(dir1, dir2);\r
-        Vector3d elbowCenter = new Vector3d();\r
-        elbowCenter.cross(normal, dir1);\r
-        elbowCenter.normalize();\r
-        elbowCenter.scale(elbowRadius);\r
-        elbowCenter.add(startPipe);\r
-\r
-        elbowCenter.sub(middle);\r
-            \r
-        // creates sweep shape by rotating a circle\r
-        // several values must be checked if they are infinite (OCC crashes if they are)\r
-        if (turnAngle > 0.001 && normal.lengthSquared() > 0.0 && !(Double.isInfinite(turnAngle)) && isValid(n) && isValid(startPipe)) {\r
-//            System.out.println(startPipe + " " + middle + " " + n + " " +  elbowCenter + " " + normal + " " + turnAngle);\r
-//            gp_Circ circ = new gp_Circ(new double[] { startPipe.x - middle.x, startPipe.y - middle.y,\r
-//                    startPipe.z - middle.z, n.x, n.y, n.z }, pipeRadius);\r
-//            TopoDS_Edge ed = (TopoDS_Edge) new BRepBuilderAPI_MakeEdge(circ).shape();\r
-//            TopoDS_Wire w = (TopoDS_Wire) new BRepBuilderAPI_MakeWire(ed).shape();\r
-//            TopoDS_Face F = (TopoDS_Face) new BRepBuilderAPI_MakeFace(w).shape();\r
-//            TopoDS_Shape S4 = new BRepPrimAPI_MakeRevol(F, new double[] { elbowCenter.x, elbowCenter.y, elbowCenter.z,\r
-//                    normal.x, normal.y, normal.z }, turnAngle).shape();\r
-//\r
-//            try {\r
-//                return OccTriangulator.getGeometry(S4, true);\r
-//\r
-//            } catch (Exception e) {\r
-//                e.printStackTrace();\r
-//                return null;\r
-//            }\r
-               elbow(pipeRadius,elbowRadius,n,normal,turnAngle,elbowCenter,geometry);\r
-               return true;\r
-        }\r
-        return false;\r
-\r
-       }\r
-       \r
-       public void elbow(double radius, double turnRadius, Vector3d sn, Vector3d rn, double angle, Vector3d p, Geometry[] geometry) {\r
-               Vector3d t = new Vector3d();\r
-               t.cross(sn,rn);\r
-               t.normalize();\r
-               t.scale(turnRadius);\r
-               Vector3d vs[][] = calcCirc(RING_SEGMENTS, 0.0, 0.0, 0.0, sn.x, sn.y, sn.z, radius);\r
-               int rings = (int)Math.ceil(angle * ELBOW_RING_ANGLE * Math.sqrt(turnRadius));\r
-               if (rings < 2)\r
-                       rings = 2;\r
-               FloatBuffer v = BufferUtils.createFloatBuffer(vs[0].length * rings * 3);\r
-               FloatBuffer n = BufferUtils.createFloatBuffer(vs[0].length * rings * 3);\r
-               Quat4d q = new Quat4d();\r
-               AxisAngle4d aa = new AxisAngle4d();\r
-               Vector3d pos = new Vector3d();\r
-               Vector3d t2 = new Vector3d();\r
-               \r
-               aa.x = rn.x;\r
-               aa.y = rn.y;\r
-               aa.z = rn.z;\r
-               for (int i = 0; i < rings; i++) {\r
-                       double a = (double)i/(double)(rings-1) * angle;\r
-                       aa.angle = a;\r
-                       q.set(aa);\r
-                       MathTools.rotate(q, t, pos);\r
-                       for (int j = 0; j < vs[0].length; j++) {\r
-                               MathTools.rotate(q, vs[0][j], t2);\r
-                               t2.add(pos);\r
-                               t2.add(p);\r
-                               v.put((float)t2.x);\r
-                               v.put((float)t2.y);\r
-                               v.put((float)t2.z);\r
-                               MathTools.rotate(q, vs[1][j], t2);\r
-                               n.put((float)t2.x);\r
-                               n.put((float)t2.y);\r
-                               n.put((float)t2.z);\r
-                       }\r
-               }\r
-               int indexCount  = indexCount(RING_SEGMENTS, rings);\r
-               int edgeIndexCount = edgeIndexCount(RING_SEGMENTS, rings);\r
-               IntBuffer i = BufferUtils.createIntBuffer(indexCount);\r
-               IntBuffer ei = BufferUtils.createIntBuffer(edgeIndexCount);\r
-               createIndices(i, RING_SEGMENTS, rings);\r
-               createEdgeIndices(ei, RING_SEGMENTS, rings);\r
-               TriMesh m = (TriMesh)geometry[0];//new TriMesh();\r
-               Line l = (Line)geometry[1];//new Line();\r
-       m.reconstruct(v, n, null, null,i);\r
-               l.reconstruct(v, null, null, null,ei);\r
-       //return new Geometry[]{m,l};\r
-       }\r
-\r
-       public boolean  getStraightGeometry(IEntity instance, Geometry[] geometry) {\r
-               //Straight straight = new Straight(instance);\r
-               PipelineComponent straight = new PipelineComponent(instance);\r
-               double pipeRadius = straight.getPipeDiameter()[0] * 0.5;\r
-               //PipeRun pipeline = (PipeRun)PipingTools2.getPipeRun(straight.toPipelineComponent());//parent.getGraphicsNode();\r
-        //double pipeRadius = pipeline.getPipeDiameter()[0] * 0.5;\r
-        \r
-        \r
-//        PipeControlPoint startControlPoint = (PipeControlPoint)StubFactory.getStubForResource(this.getClass().getClassLoader(),straight.getHasPreviousControlPoint().getResource());\r
-//        PipeControlPoint endControlPoint = (PipeControlPoint)StubFactory.getStubForResource(this.getClass().getClassLoader(),straight.getHasNextControlPoint().getResource());\r
-        \r
-        // start and end position of the pipe\r
-        // positions may be linked to other components, like nozzles\r
-        // and then their coordinates are in component's local coordinates\r
-        // which must be transformed into pipeline's local coordinates\r
-        \r
-        Point3d startPipe = new Point3d();//getLocalPoint(pipeline,startControlPoint);\r
-\r
-        \r
-        Point3d endPipe = new Point3d(); //getLocalPoint(pipeline, endControlPoint);\r
-\r
-        \r
-        \r
-        \r
-        PipingTools2.getInlineComponentEnds(straight, startPipe, endPipe);\r
-        boolean b = createStraightGeometry(startPipe, endPipe, pipeRadius, geometry);\r
-        if (!b)\r
-               ErrorLogger.getDefault().logWarning("Straight pipe " + instance + " is too short", null);\r
-        return b;\r
-       }\r
-       \r
-       public static boolean createStraightGeometry(Point3d startPipe, Point3d endPipe, double pipeRadius, Geometry geometry[]) {\r
-               Vector3d dir = new Vector3d(endPipe);\r
-        dir.sub(startPipe);\r
-        \r
-        double h = dir.length();\r
-//      several values must be checked if they are infinite (OCC crashes if they are)\r
-        if (h > 0.001 && h < 10000.0 && pipeRadius > 0.01) {\r
-\r
-            dir.normalize();\r
-\r
-            Vector3d[][] v1 = calcCirc(RING_SEGMENTS, startPipe.x, startPipe.y, startPipe.z, dir.x, dir.y, dir.z, pipeRadius);\r
-               Vector3d[][] v2 = calcCirc(RING_SEGMENTS, endPipe.x, endPipe.y, endPipe.z, dir.x, dir.y, dir.z, pipeRadius);\r
-               TriMesh m = (TriMesh)geometry[0];//new TriMesh();\r
-               Line l = null;\r
-               if (geometry.length>1)\r
-                       l = (Line)geometry[1];//new Line();\r
-               FloatBuffer v = BufferUtils.createFloatBuffer(v1[0].length * 2 * 3);\r
-               FloatBuffer n = BufferUtils.createFloatBuffer(v1[0].length * 2 * 3 );\r
-               for (int i = 0; i < v1[0].length; i++) {\r
-                       v.put((float)v1[0][i].x);\r
-                       v.put((float)v1[0][i].y);\r
-                       v.put((float)v1[0][i].z);\r
-                       n.put((float)v1[1][i].x);\r
-                       n.put((float)v1[1][i].y);\r
-                       n.put((float)v1[1][i].z);\r
-             }\r
-               for (int i = 0; i < v2[0].length; i++) {\r
-                       v.put((float)v2[0][i].x);\r
-                       v.put((float)v2[0][i].y);\r
-                       v.put((float)v2[0][i].z);\r
-                       n.put((float)v2[1][i].x);\r
-                       n.put((float)v2[1][i].y);\r
-                       n.put((float)v2[1][i].z);\r
-             }\r
-               \r
-               IntBuffer i = BufferUtils.createIntBuffer(indexCount(RING_SEGMENTS, 2));\r
-               createIndices(i, RING_SEGMENTS, 2);\r
-               m.reconstruct(v, n, null, null,i);\r
-               if (l != null) {\r
-                       IntBuffer ei = BufferUtils.createIntBuffer(edgeIndexCount(RING_SEGMENTS, 2));\r
-               createEdgeIndices(ei, RING_SEGMENTS, 2);\r
-               l.reconstruct(v, null, null, null,ei);\r
-               }\r
-               return true;\r
-        } \r
-        return false;\r
-       }\r
-       \r
-       public static void createStraightEdges(Line l, Point3d startPipe, Point3d endPipe, double pipeRadius) {\r
-               Vector3d dir = new Vector3d(endPipe);\r
-               dir.sub(startPipe);\r
-               dir.normalize();\r
-                Vector3d[][] v1 = calcCirc(8, startPipe.x, startPipe.y, startPipe.z, dir.x, dir.y, dir.z, pipeRadius);\r
-       Vector3d[][] v2 = calcCirc(8, endPipe.x, endPipe.y, endPipe.z, dir.x, dir.y, dir.z, pipeRadius);\r
-       FloatBuffer v = BufferUtils.createFloatBuffer(v1[0].length * 2 * 3);\r
-       FloatBuffer n = BufferUtils.createFloatBuffer(v1[0].length * 2 * 3 );\r
-       for (int i = 0; i < v1[0].length; i++) {\r
-               v.put((float)v1[0][i].x);\r
-               v.put((float)v1[0][i].y);\r
-               v.put((float)v1[0][i].z);\r
-               n.put((float)v1[1][i].x);\r
-               n.put((float)v1[1][i].y);\r
-               n.put((float)v1[1][i].z);\r
-         }\r
-       for (int i = 0; i < v2[0].length; i++) {\r
-               v.put((float)v2[0][i].x);\r
-               v.put((float)v2[0][i].y);\r
-               v.put((float)v2[0][i].z);\r
-               n.put((float)v2[1][i].x);\r
-               n.put((float)v2[1][i].y);\r
-               n.put((float)v2[1][i].z);\r
-         }\r
-       \r
-\r
-       IntBuffer ei = BufferUtils.createIntBuffer(edgeIndexCount(8, 2));\r
-       createEdgeIndices(ei, 8, 2);\r
-       l.reconstruct(v, null, null, null,ei);\r
-       }\r
-\r
-       public boolean getReducerGeometry(IEntity instance,Geometry[] geometry) {\r
-        //Reducer reducer = new Reducer(instance);\r
-               PipelineComponent reducer = new PipelineComponent(instance);\r
-        PipeControlPoint pcp = reducer.getControlPoint();\r
-        PipeControlPoint pcp2 = pcp.getSubPoint().iterator().next();\r
-        //PipeControlPoint pcp = reducer.getHasControlPoint();\r
-        //PipeControlPoint prev = pcp.getPreviousPoint();\r
-        //assert (prev != null);\r
-        //Point3d prevPoint = GraphicsNodeTools.getPoint(prev.getLocalPosition());\r
-        //Point3d point = GraphicsNodeTools.getPoint(pcp.getLocalPosition());\r
-        //Vector3d dir = new Vector3d(point);\r
-        //dir.sub(prevPoint);\r
-        //dir.normalize();\r
-        double h = reducer.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-        double r1 = pcp.getPipeDiameter()[0] * 0.5;//reducer.getBottomRadius();\r
-        double r2 = pcp2.getPipeDiameter()[0] * 0.5;//reducer.getTopRadiusValue();\r
-            \r
-        if (h > 0.001 && r1 > 0.001 && r2 > 0.001 ) {\r
-//            TopoDS_Shape S4 = getShape(h,r1,r2, instance.isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.ECCENTRIC_REDUCER)));\r
-//             \r
-//             \r
-//            try {\r
-//                return OccTriangulator.getGeometry(S4, true);\r
-//\r
-//            } catch (Exception e) {\r
-//                e.printStackTrace();\r
-//                return null;\r
-//            }\r
-               Vector3d[][] v1 = calcCirc(RING_SEGMENTS, -h * 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, r1);\r
-               Vector3d[][] v2 = calcCirc(RING_SEGMENTS,  h * 0.5, 0.0, instance.isInstanceOf(ProcessResource.plant3Dresource.EccentricReducer) ? (r1 - r2) : 0.0, 1.0, 0.0, 0.0, r2);\r
-               TriMesh m = (TriMesh)geometry[0];//new TriMesh();\r
-               Line l = (Line)geometry[1];//new Line();\r
-               FloatBuffer v = BufferUtils.createFloatBuffer(v1[0].length * 2 * 3);\r
-               FloatBuffer n = BufferUtils.createFloatBuffer(v1[0].length * 2 * 3 );\r
-               for (int i = 0; i < v1[0].length; i++) {\r
-                       v.put((float)v1[0][i].x);\r
-                       v.put((float)v1[0][i].y);\r
-                       v.put((float)v1[0][i].z);\r
-                       n.put((float)v1[1][i].x);\r
-                       n.put((float)v1[1][i].y);\r
-                       n.put((float)v1[1][i].z);\r
-            }\r
-               for (int i = 0; i < v2[0].length; i++) {\r
-                       v.put((float)v2[0][i].x);\r
-                       v.put((float)v2[0][i].y);\r
-                       v.put((float)v2[0][i].z);\r
-                       n.put((float)v2[1][i].x);\r
-                       n.put((float)v2[1][i].y);\r
-                       n.put((float)v2[1][i].z);\r
-            }\r
-               \r
-               IntBuffer i = BufferUtils.createIntBuffer(indexCount(RING_SEGMENTS, 2));\r
-               IntBuffer ei = BufferUtils.createIntBuffer(edgeIndexCount(RING_SEGMENTS, 2));\r
-               createIndices(i, RING_SEGMENTS, 2);\r
-               createEdgeIndices(ei, RING_SEGMENTS, 2);\r
-               m.reconstruct(v, n, null, null,i);\r
-               l.reconstruct(v, null, null, null,ei);\r
-               //return new Geometry[]{m,l};\r
-               return true;\r
-               \r
-        }\r
-        return false;\r
-\r
-       }\r
-       \r
-//     protected TopoDS_Shape getShape(double h, double r1, double r2, boolean eccentric) {\r
-//             TopoDS_Shape S4 = null;\r
-//\r
-//             gp_Circ circ1 = new gp_Circ(new double[] { -h * 0.5, 0.0,  0.0, 1.0, 0.0, 0.0 }, r1);\r
-//             TopoDS_Edge ed1 = (TopoDS_Edge) new BRepBuilderAPI_MakeEdge(circ1)\r
-//                             .shape();\r
-//             TopoDS_Wire w1 = (TopoDS_Wire) new BRepBuilderAPI_MakeWire(ed1).shape();\r
-//             gp_Circ circ2 = new gp_Circ(new double[] { h * 0.5, 0.0, eccentric ? r1 - r2 : 0.0, 1.0, 0.0, 0.0 }, r2);\r
-//             TopoDS_Edge ed2 = (TopoDS_Edge) new BRepBuilderAPI_MakeEdge(circ2)\r
-//                             .shape();\r
-//             TopoDS_Wire w2 = (TopoDS_Wire) new BRepBuilderAPI_MakeWire(ed2).shape();\r
-////           BRepOffsetAPI_ThruSections generatorb = new BRepOffsetAPI_ThruSections(\r
-////                           true, false);\r
-//             BRepOffsetAPI_ThruSections generatorb = new BRepOffsetAPI_ThruSections(true, true);\r
-//             generatorb.addWire(w1);\r
-//             generatorb.addWire(w2);\r
-//             generatorb.build();\r
-//             S4 = generatorb.shape();\r
-//        return S4;\r
-//     }\r
-       \r
-       private boolean isValid(Vector3d v) {\r
-        if (Double.isInfinite(v.x) || \r
-                 Double.isNaN(v.x) ||\r
-                 Double.isInfinite(v.y) || \r
-                 Double.isNaN(v.y) ||\r
-                 Double.isInfinite(v.z) || \r
-                 Double.isNaN(v.z))\r
-            return false;\r
-        return true;\r
-    }\r
-       \r
-       private static Vector3d[][] calcCirc(int segmentCount,double x, double y, double z, double dx, double dy, double dz, double r) {\r
-               Vector3d res[][] = new Vector3d[2][segmentCount + 1];\r
-               Vector3d t = new Vector3d();\r
-               if (Math.abs(dy) + Math.abs(dz) < 0.001) {\r
-                       t.y = 1.0;\r
-               } else {\r
-                       t.x = 1.0;\r
-               }\r
-               Vector3d d = new Vector3d(dx,dy,dz);\r
-               Vector3d a = new Vector3d();\r
-               a.cross(t, d);\r
-               a.normalize();\r
-               a.scale(r);\r
-               Quat4d q = new Quat4d();\r
-               AxisAngle4d aa = new AxisAngle4d();\r
-               aa.x = dx;\r
-               aa.y = dy;\r
-               aa.z = dz;\r
-               for (int i = 0; i <= segmentCount; i++) {\r
-                       aa.angle = (double)i / (double) segmentCount * Math.PI * 2.0;\r
-                       q.set(aa);\r
-                       res[0][i] = new Vector3d();\r
-                       res[1][i] = new Vector3d();\r
-                       MathTools.rotate(q, a, res[0][i]);\r
-                       res[1][i].normalize(res[0][i]);\r
-                       //res[1][i].negate();\r
-                       res[0][i].x += x;\r
-                       res[0][i].y += y;\r
-                       res[0][i].z += z;       \r
-               }\r
-               return res;\r
-               \r
-       }\r
-       \r
-       private static int indexCount(int segmentCount, int ringCount) {\r
-               return 6 * segmentCount * (ringCount - 1);\r
-       }\r
-       \r
-       private static void createIndices(IntBuffer buf, int segmentCount, int ringCount) {\r
-               int s = segmentCount + 1;\r
-               for (int ring = 0; ring < ringCount - 1; ring++) {\r
-                       for (int segment = 0; segment < segmentCount; segment++) {\r
-                               int index = ring * s + segment;\r
-                               buf.put(index);\r
-                               buf.put(index + 1);\r
-                               buf.put(index + s);\r
-                               buf.put(index + s + 1);\r
-                               buf.put(index + s);\r
-                               buf.put(index + 1);\r
-                       }\r
-               }\r
-       }\r
-       \r
-       private static int edgeIndexCount(int segmentCount, int ringCount) {\r
-               if (ringCount > 1) {\r
-                       return segmentCount * 4 + ringCount * 4 * (segmentCount / 4);\r
-               } else {\r
-                       return ringCount * segmentCount * 2;\r
-               }\r
-       }\r
-       \r
-       private static void createEdgeIndices(IntBuffer buf, int segmentCount, int ringCount) {\r
-               int s = segmentCount + 1;\r
-               if (ringCount > 1) {\r
-                       int ring = 0;\r
-                       for (int segment = 0; segment < segmentCount; segment++) {\r
-                               int index = ring * s + segment;\r
-                               buf.put(index);\r
-                               buf.put(index + 1);\r
-                       }\r
-                       ring = ringCount - 1;\r
-                       for (int segment = 0; segment < segmentCount; segment++) {\r
-                               int index = ring * s + segment;\r
-                               buf.put(index);\r
-                               buf.put(index + 1);\r
-                       }\r
-                       int space = segmentCount / 4;\r
-                       for (ring = 0; ring < ringCount - 1; ring++) {\r
-                               for (int segment = 0; segment < segmentCount; segment+=space) {\r
-                                       int index = ring * s + segment;\r
-                                       buf.put(index);\r
-                                       buf.put(index + s);\r
-                               }\r
-                       }\r
-               } else {\r
-                       int ring = 0;\r
-                       for (int segment = 0; segment < segmentCount; segment++) {\r
-                               int index = ring * s + segment;\r
-                               buf.put(index);\r
-                               buf.put(index + 1);\r
-                       }\r
-               }\r
-               buf.limit(buf.position());\r
-               \r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingRules.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingRules.java
deleted file mode 100644 (file)
index d7e1619..0000000
+++ /dev/null
@@ -1,1134 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.common;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-import fi.vtt.simantics.processeditor.stubs.PipelineComponent;\r
-\r
-/**\r
- * Rules that update pipeline.\r
- * TODO : optimize, remove stubs\r
- * \r
- * FIXME : transformations\r
- * \r
- * TODO : FixedAngleTurnComponents are handled like VariableAngleTurnComponents\r
- * \r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class PipingRules {\r
-       \r
-       private static final boolean DEBUG = false;\r
-       private static final boolean DUMMY = false;\r
-       \r
-       private static final double MIN_TURN_ANGLE = 0.01;\r
-       \r
-       private static final int REMOVE_NONE = 0;\r
-       private static final int REMOVE_START = 1;\r
-       private static final int REMOVE_END = 2;\r
-       private static final int REMOVE_BOTH = 3;\r
-       \r
-       private enum PathLegUpdateType {NONE,PREV,NEXT,PREV_S,NEXT_S};\r
-       \r
-       /**\r
-     * Rule\r
-     * \r
-     * @param resources\r
-     * @param pp\r
-     * @throws TransactionException\r
-     */\r
-    public static void pipeControlPointPositionUpdate(Graph g, Resource pp) {\r
-       \r
-       PipeControlPoint pcp = new PipeControlPoint(g,pp);\r
-        if (DEBUG) System.out.println("PipeControlPoint changed " + pp);\r
-        \r
-        boolean changed = ControlPointTools.isControlPointChanged(pcp);\r
-\r
-        \r
-        if (changed) {\r
-               if (pcp.isInstanceOf(ProcessResource.plant3Dresource.PathLegEndControlPoint)) {\r
-                       updatePathLegEndControlPoint(pcp);\r
-               } else {\r
-                       updateInlineControlPoint(pcp);\r
-               }\r
-        } \r
-        \r
-    }\r
-    \r
-  \r
-    \r
-    public static class ExpandIterInfo {\r
-       // these two are turn control points\r
-       private PipeControlPoint start; \r
-       private PipeControlPoint end;\r
-       private int type;\r
-       \r
-       public ExpandIterInfo() {\r
-               \r
-       }\r
-       \r
-       public ExpandIterInfo(PipeControlPoint tcp, int type) {\r
-               if (type == REMOVE_START)\r
-                       start = tcp;\r
-               else \r
-                       end = tcp;\r
-               this.type = type;\r
-       }\r
-       \r
-       public ExpandIterInfo(PipeControlPoint start, PipeControlPoint end) {\r
-               this.start = start;\r
-               this.end = end;\r
-               this.type = REMOVE_BOTH;\r
-       }\r
-       \r
-               public PipeControlPoint getEnd() {\r
-                       return end;\r
-               }\r
-               public void setEnd(PipeControlPoint end) {\r
-                       this.end = end;\r
-               }\r
-               public PipeControlPoint getStart() {\r
-                       return start;\r
-               }\r
-               public void setStart(PipeControlPoint start) {\r
-                       this.start = start;\r
-               }\r
-               public int getType() {\r
-                       return type;\r
-               }\r
-               public void setType(int type) {\r
-                       this.type = type;\r
-               }\r
-       \r
-       \r
-    }\r
-    \r
-    private static void updatePathLegEndControlPoint(PipeControlPoint pcp) {\r
-       if (DEBUG) System.out.println("PipingTools.updateRunEndControlPoint() " + pcp.getResource());\r
-       if (pcp.getNext() != null) {\r
-               updatePathLegNext(pcp,pcp,PathLegUpdateType.NEXT_S);\r
-       }\r
-       if (pcp.getPrevious() != null) {\r
-               updatePathLegPrev(pcp,pcp,PathLegUpdateType.PREV_S);\r
-       }\r
-       \r
-    }\r
-    \r
-    private static void updateInlineControlPoint(PipeControlPoint pcp)  {\r
-       if (DEBUG) System.out.println("PipingTools.updateInlineControlPoint() " + pcp.getResource());\r
-       PipeControlPoint start = ControlPointTools.findPreviousEnd(pcp);\r
-        updatePathLegNext(start,pcp,PathLegUpdateType.NONE);\r
-    }\r
-    \r
-    private static PipeControlPoint insertElbow(PipeControlPoint pcp1 , PipeControlPoint pcp2, Point3d pos)  {\r
-       if (DEBUG) System.out.println("PipingRules.insertElbow() " + pcp1.getResource() + " " + pcp2.getResource()+ " " + pos);\r
-       PipelineComponent elbow = PipingTools2.instantiatePipelineComponent(pcp1.getGraph(), ControlPointTools.getPipeRun(pcp1).getResource(), ProcessResource.plant3Dresource.Elbow);\r
-       PipeControlPoint pcp = elbow.getControlPoint();\r
\r
-               ControlPointTools.insertControlPoint(pcp, pcp1,pcp2);\r
-               \r
-               ControlPointTools.setWorldPosition(pcp, pos);\r
-\r
-        return pcp;\r
-    }\r
-    \r
-    private static void updatePathLegNext(PipeControlPoint start, PipeControlPoint updated, PathLegUpdateType lengthChange){\r
-       ArrayList<PipeControlPoint> list = new ArrayList<PipeControlPoint>();\r
-       PipeControlPoint end = ControlPointTools.findNextEnd(start,list);\r
-       // this is for inline cp that is also path leg end\r
-       if (start.equals(updated))\r
-               lengthChange = PathLegUpdateType.NEXT;\r
-       else if (end.equals(updated))\r
-               lengthChange = PathLegUpdateType.PREV;                  \r
-       updatePathLegNext(start, list, end, updated, lengthChange);\r
-    }\r
-    \r
-    private static void updatePathLegNext(PipeControlPoint start, ArrayList<PipeControlPoint> list, PipeControlPoint end, PipeControlPoint updated, PathLegUpdateType lengthChange) {\r
-        updatePathLeg(start,list,end,false,0,new ArrayList<ExpandIterInfo>(),updated, lengthChange);\r
-    }\r
-    \r
-    private static class UpdateStruct2 {\r
-       public PipeControlPoint start;\r
-               public Point3d startPoint;\r
-               public ArrayList<PipeControlPoint> list;\r
-               public PipeControlPoint end;\r
-               public Point3d endPoint;\r
-               public Vector3d dir;\r
-               public Vector3d offset;\r
-               public boolean hasOffsets;\r
-               public int iter;\r
-               public boolean reversed;\r
-               public ArrayList<ExpandIterInfo> toRemove;\r
-               public PipeControlPoint updated;\r
-               public UpdateStruct2(PipeControlPoint start, Point3d startPoint, ArrayList<PipeControlPoint> list, PipeControlPoint end, Point3d endPoint, Vector3d dir, Vector3d offset, boolean hasOffsets, int iter, boolean reversed, ArrayList<ExpandIterInfo> toRemove, PipeControlPoint updated) {\r
-                       super();\r
-                       this.start = start;\r
-                       this.startPoint = startPoint;\r
-                       this.list = list;\r
-                       this.end = end;\r
-                       this.endPoint = endPoint;\r
-                       this.dir = dir;\r
-                       this.offset = offset;\r
-                       this.hasOffsets = hasOffsets;\r
-                       this.iter = iter;\r
-                       this.reversed = reversed;\r
-                       this.toRemove = toRemove;\r
-                       this.updated = updated;\r
-               }\r
-               \r
-               public String toString() {\r
-                       return start.getResource() + " " + end.getResource() + " " + dir + " " + hasOffsets + " " + offset + " " + iter + " " + toRemove.size();\r
-               }\r
-               \r
-    }\r
-    \r
-    private static boolean calculateOffset(Point3d startPoint, Point3d endPoint, ArrayList<PipeControlPoint> list, Vector3d dir, Vector3d offset) {\r
-       boolean hasOffsets = false;\r
-       dir.set(startPoint);\r
-       dir.sub(endPoint);\r
-       dir.normalize();\r
-       offset.set(0.0,0.0,0.0);\r
-        for (PipeControlPoint icp : list) {\r
-               if (icp.isInstanceOf(ProcessResource.plant3Dresource.OffsettingPoint)) {\r
-                       hasOffsets = true;\r
-                       offset.add(ControlPointTools.getSizeChangeOffsetVector(icp,dir));\r
-               }\r
-               else if (icp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) \r
-                       ErrorLogger.defaultLogError("Updating pipe run, found offset controlpoint " + icp.getResource(), new Exception("ASSERT!"));\r
-        }\r
-        return hasOffsets;\r
-    }\r
-    \r
-    /**\r
-     * @param start starting point of the pipe run\r
-     * @param list list of inline control points in the pipe run\r
-     * @param end ending point of the pipe run\r
-     * @param reversed boolean flag indicating wether start or end control point was modified (if true then end point was modified)\r
-     * @throws TransactionException\r
-     */\r
-    private static void updatePathLeg(PipeControlPoint start, ArrayList<PipeControlPoint> list, PipeControlPoint end, boolean reversed, int iter, ArrayList<ExpandIterInfo> toRemove, PipeControlPoint updated, PathLegUpdateType lengthChange) {\r
-        // FIXME: direction is calculated wrong way!\r
-       boolean hasOffsets = false;\r
-        Vector3d offset = new Vector3d();\r
-        Point3d startPoint = G3DTools.getPoint(start.getWorldPosition());\r
-       Point3d endPoint = G3DTools.getPoint(end.getWorldPosition());\r
-       Vector3d dir = new Vector3d ();\r
-       hasOffsets = calculateOffset(startPoint, endPoint, list, dir, offset);\r
-        updatePathLeg(new UpdateStruct2(start, startPoint, list, end, endPoint, dir, offset, hasOffsets, iter, reversed, toRemove, updated), lengthChange);\r
-        \r
-    }\r
-    \r
-    private static void updatePathLeg(UpdateStruct2 u, PathLegUpdateType lengthChange){\r
-       int directed = 0;\r
-        if (u.start.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint))\r
-               directed ++;\r
-        if (u.end.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint))\r
-               directed++;\r
-        switch (directed) {\r
-        case 0:\r
-               updateFreePathLeg(u,lengthChange);\r
-               break;\r
-        case 1:\r
-               updateDirectedPathLeg(u,lengthChange);\r
-               break;\r
-        case 2:\r
-               updateDualDirectedPathLeg(u,lengthChange);\r
-               break;\r
-        }\r
-       \r
-       }\r
-    \r
-    private static void updateFreePathLeg(UpdateStruct2 u, PathLegUpdateType lengthChange) {\r
-       if (DEBUG) System.out.println("PipingRules.updateFreePipeRun " + u + " " + lengthChange);\r
-       checkExpandPathLeg(u, lengthChange);\r
-       }\r
-    \r
-    private static void updateInlineControlPoints(UpdateStruct2 u, boolean checkSizes) {\r
-       if (DEBUG) System.out.println("PipingTools.updateInlineControlPoints() " + u);\r
-       \r
-       if (!u.hasOffsets) {\r
-               // FIXME : cache positions\r
-               if (!checkSizes) {\r
-                       for (PipeControlPoint icp : u.list) {\r
-                               updateInlineControlPoint(icp, u.startPoint, u.endPoint,u.dir);\r
-                       }\r
-                       return;\r
-               }\r
-               \r
-               ArrayList<PipeControlPoint> pathLegPoints = new ArrayList<PipeControlPoint>();\r
-               pathLegPoints.add(u.start);\r
-                       for (PipeControlPoint icp : u.list) {\r
-                               //updateInlineControlPoint(icp, u.startPoint, u.endPoint,u.dir);\r
-                               updateBranchControlPointBranches(icp);\r
-                               pathLegPoints.add(icp);\r
-                       }\r
-                       pathLegPoints.add(u.end);\r
-                       \r
-                       // TODO : values can be cached in the loop\r
-                       for (int i = 1; i < pathLegPoints.size(); i++) {\r
-                               PipeControlPoint icp = pathLegPoints.get(i);\r
-\r
-                               PipeControlPoint prev;\r
-                               Point3d prevPos;\r
-                               prev = pathLegPoints.get(i-1);\r
-                               prevPos = G3DTools.getPoint(prev.getWorldPosition());\r
-                               Point3d currentPos = G3DTools.getPoint(icp.getWorldPosition());\r
-                               \r
-                               if (icp.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthControlPoint)) {     \r
-                                       if (i != pathLegPoints.size() - 1) {\r
-                                               PipeControlPoint next;\r
-                                               Point3d nextPos;\r
-                                               next = pathLegPoints.get(i + 1);\r
-                                               nextPos = G3DTools.getPoint(next.getWorldPosition());\r
-                                               Vector3d dir = new Vector3d(nextPos);\r
-                                               dir.sub(prevPos);\r
-                                               double l = dir.lengthSquared();          // distance between control points (square)\r
-                                               double l2prev = ControlPointTools.getInlineLength(prev);          // distance taken by components\r
-                                               double l2next = ControlPointTools.getInlineLength(next); \r
-                                               double l2 = l2prev + l2next;\r
-                                               double l2s = MathTools.square(l2);\r
-                                               if (l2s < l) {                         // check if there is enough space for variable length component.\r
-                                                       // components fit\r
-                                                       dir.normalize();\r
-                                                       double length = Math.sqrt(l) - l2; // true length of the variable length component \r
-                                                       dir.scale(length*0.5 + l2prev);      // calculate center position of the component\r
-                                                       dir.add(prevPos);\r
-                                                       ControlPointTools.setWorldPosition(icp,dir);\r
-                                                       icp.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, length);\r
-                                               } else {\r
-                                                       //components leave no space to the component and it must be removed\r
-                                                       ControlPointTools.removeControlPoint(icp);\r
-                                               }\r
-\r
-                                       } else {\r
-                                               // this is variable length component at the end of the piperun.\r
-                                               // the problem is that we want to keep unconnected end of the component in the same\r
-                                               // place, but center of the component must be moved.\r
-                                               double currentLength = icp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-                                               Vector3d dir = new Vector3d();\r
-                                               dir.sub(currentPos,prevPos);\r
-                                               dir.normalize();\r
-                                               Point3d endPos = new Point3d(dir);\r
-                                               endPos.scale(currentLength * 0.5);\r
-                                               endPos.add(currentPos);             //this is the free end of the component\r
-                                               \r
-                                               double offset = ControlPointTools.getInlineLength(prev);\r
-                                               Point3d beginPos = new Point3d(dir);\r
-                                               beginPos.scale(offset);\r
-                                               beginPos.add(prevPos);              //this is the connected end of the component\r
-                                               \r
-                                               double l = beginPos.distance(endPos);\r
-                                               \r
-                                               dir.scale(l*0.5);\r
-                                               beginPos.add(dir);                  //center position\r
-                                               \r
-                                               if (DEBUG) System.out.println("PipingRules.updateInlineControlPoints() setting variable length to " + l);\r
-                                               icp.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, l);\r
-                                               \r
-                                               ControlPointTools.setWorldPosition(icp, beginPos);\r
-                                       }\r
-                                       i++;\r
-                                       \r
-                               } else if (!prev.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthControlPoint)){\r
-                                       // If this and previous control point are not variable length pcps, we'll have to check if there is no empty space between them.\r
-                                       // I there is, we'll have to create new variable length component between them.\r
-                                       Vector3d dir = new Vector3d(currentPos);\r
-                                       dir.sub(prevPos);\r
-                                       double l = dir.lengthSquared();\r
-                                       double l2prev = ControlPointTools.getInlineLength(prev);\r
-                                       double l2next = ControlPointTools.getInlineLength(icp);\r
-                                       double l2 = l2prev + l2next;\r
-                                       double l2s = l2 * l2;\r
-                                       if (l > l2s) {\r
-                                               PipelineComponent component = PipingTools2.instantiatePipelineComponent(prev.getGraph(), ControlPointTools.getPipeRun(prev).getResource(), ProcessResource.plant3Dresource.Straight);\r
-                                               PipeControlPoint scp = component.getControlPoint();\r
-                                               ControlPointTools.insertControlPoint(scp, prev, icp);\r
-                                               \r
-                                               dir.normalize();\r
-                                               double length = Math.sqrt(l) - l2; // true length of the variable length component \r
-                                               dir.scale(length*0.5 + l2prev);      // calculate center position of the component\r
-                                               dir.add(prevPos);\r
-                                               ControlPointTools.setWorldPosition(scp, dir);\r
-                                               scp.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, length);\r
-                                       }\r
-                               }\r
-                       }\r
-               } else {\r
-                       u.endPoint.sub(u.offset);\r
-                       // FIXME : straights\r
-                       for (PipeControlPoint icp : u.list) {\r
-                               updateInlineControlPoint(icp, u.startPoint, u.endPoint,u.dir);\r
-                               updateBranchControlPointBranches(icp);\r
-                               if (icp.isInstanceOf(ProcessResource.plant3Dresource.OffsettingPoint)) {\r
-                                       // TODO : offset vector is already calculated and should be\r
-                                       // cached\r
-                                       u.offset = ControlPointTools.getSizeChangeOffsetVector(icp, u.dir);\r
-                                       updateOffsetPoint( icp, u.offset);\r
-                                       u.startPoint.add(u.offset);\r
-                                       u.endPoint.add(u.offset);\r
-                               }\r
-                       }\r
-               }\r
-    }\r
-    \r
-    \r
-    \r
-    private static void ppNoOffset(UpdateStruct2 u) {\r
-       if (DEBUG)System.out.println("PipingRules.ppNoOffset() " + u);\r
-       Vector3d offset = new Vector3d();\r
-               if (u.hasOffsets) {\r
-               u.dir.normalize();\r
-               for (PipeControlPoint icp : u.list) {\r
-                       if (icp.isInstanceOf(ProcessResource.plant3Dresource.OffsettingPoint)) {\r
-                               offset.add(ControlPointTools.getSizeChangeOffsetVector(icp,u.dir));\r
-                       }\r
-                       else if (icp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) \r
-                               ErrorLogger.defaultLogError("Updating pipe run, found offset controlpoint " + icp.getResource(), new Exception("ASSERT!"));\r
-               }\r
-               }\r
-               u.offset = offset;\r
-               checkExpandPathLeg(u,PathLegUpdateType.NONE);\r
-    }\r
-    \r
-    private static void ppNoDir(PipeControlPoint start, Point3d startPoint,ArrayList<PipeControlPoint> list, PipeControlPoint end,Point3d endPoint, boolean hasOffsets,int iter,boolean reversed, ArrayList<ExpandIterInfo> toRemove, PipeControlPoint updated)  {\r
-       if (DEBUG)System.out.println("PipingRules.ppNoDir() " + start.getResource() + " " + end.getResource() + " " + iter + " " + toRemove.size());\r
-       // FIXME : extra loop (dir should be calculated here)\r
-       Vector3d dir = new Vector3d();\r
-       Vector3d offset = new Vector3d();\r
-       hasOffsets = calculateOffset(startPoint, endPoint, list, dir, offset);\r
-       ppNoOffset(new UpdateStruct2(start, startPoint, list, end, endPoint, dir, null, hasOffsets, iter, reversed, toRemove,updated));\r
-    }\r
-    \r
-    private static void checkExpandPathLeg(UpdateStruct2 u, PathLegUpdateType lengthChange)  {\r
-       if (DEBUG)System.out.println("PipingRules.checkExpandPathLeg() " + u + " " + lengthChange);\r
-       if (lengthChange != PathLegUpdateType.NONE) {\r
-               // FIXME : turns cannot be checked before inline cps are updated, since their position affects calculation of turns \r
-               processPathLeg(u,false,false);\r
-               int type = checkTurns(u,lengthChange);\r
-               if (type == REMOVE_NONE) {\r
-                               processPathLeg(u,false,true);\r
-                       } else {\r
-                               expandPathLeg(u, type);\r
-                       }\r
-       } else {\r
-               processPathLeg(u,false,true);\r
-       }\r
-    }\r
-    \r
-    private static void updateDirectedPathLeg(UpdateStruct2 u, PathLegUpdateType lengthChange) {\r
-               if (DEBUG)System.out.println("PipingRules.updateDirectedPipeRun() " + u + " " + lengthChange);\r
-               PipeControlPoint dcp;\r
-               PipeControlPoint other;\r
-               boolean canMoveOther = false;\r
-               boolean dcpStart = false;\r
-               Point3d position;\r
-               if (u.start.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)) {\r
-                       dcp = u.start;\r
-                       other = u.end;\r
-                       position = u.startPoint;\r
-                       dcpStart = true;\r
-                       if (!u.reversed)\r
-                               canMoveOther = true;\r
-               } else {\r
-                       dcp = u.end;\r
-                       other = u.start;\r
-                       position = u.endPoint;\r
-                       if (u.reversed)\r
-                               canMoveOther = true;\r
-               }\r
-\r
-               Vector3d directedDirection = ControlPointTools.getDirectedControlPointDirection(dcp);\r
-               Point3d directedEndPoint = new Point3d(u.endPoint);\r
-               if (u.hasOffsets)\r
-                       directedEndPoint.add(u.offset);\r
-\r
-               double mu[] = new double[2];\r
-\r
-               Vector3d closest;\r
-               Vector3d t = new Vector3d();\r
-      \r
-               if (dcpStart) {\r
-                       closest = MathTools.closestPointOnStraight(directedEndPoint, u.startPoint, directedDirection, mu);\r
-                       t.sub(closest, directedEndPoint);\r
-               } else {\r
-                       closest = MathTools.closestPointOnStraight(u.startPoint, directedEndPoint, directedDirection, mu);\r
-                       t.sub(closest, u.startPoint);\r
-               }\r
-\r
-      \r
-      double distance = t.lengthSquared();\r
-      boolean aligned = (distance < 0.001);\r
-      if (aligned) {\r
-         checkExpandPathLeg(u,lengthChange);\r
-      } else {\r
-         if (u.iter > 0) {\r
-                  backIter(u);\r
-         } else {\r
-                       PipeControlPoint nextToMoved;\r
-                       \r
-                               if (u.list.size() > 0)\r
-                                       if (dcpStart)\r
-                                               nextToMoved = u.list.get(0);\r
-                                       else\r
-                                               nextToMoved = u.list.get(u.list.size() - 1);\r
-                               else if (dcpStart)\r
-                                       nextToMoved = u.end;\r
-                               else\r
-                                       nextToMoved = u.start;\r
-                               if (other.isInstanceOf(ProcessResource.plant3Dresource.VariableAngleTurnControlPoint)) {\r
-                                       \r
-                                       // TODO calculate needed space from next run end.\r
-                                       if (mu[0] < 1.0) {\r
-                                               if (dcpStart) {\r
-                                                       closest.set(u.startPoint);      \r
-                                               } else {\r
-                                                       closest.set(u.endPoint);\r
-                                               }\r
-                                               closest.add(directedDirection);\r
-                                       }\r
-\r
-                                       if (canMoveOther) {\r
-                                               if (DEBUG)System.out.println("PipingRules.updateDirectedPipeRun() moved end " + other.getResource() + " to " + closest);\r
-                                               ControlPointTools.setWorldPosition(other, closest);\r
-                                               if (dcpStart) {\r
-                                                       ppNoOffset(new UpdateStruct2(u.start, u.startPoint, u.list, u.end, new Point3d(closest), directedDirection,null, u.hasOffsets, u.iter, u.reversed, u.toRemove,u.updated));\r
-                                                       if (u.end.getNext() != null)\r
-                                                               updatePathLegNext(u.end,u.updated,PathLegUpdateType.NEXT);\r
-                                               } else {\r
-                                                       ppNoOffset(new UpdateStruct2(u.start, new Point3d(closest), u.list, u.end, u.endPoint, directedDirection,null, u.hasOffsets, u.iter, u.reversed, u.toRemove,u.updated));        \r
-                                                       if (u.start.getPrevious() != null)\r
-                                                               updatePathLegPrev(u.start,u.updated,PathLegUpdateType.PREV);\r
-                                               }\r
-                                       } else {\r
-                                               // TODO : calculate needed space from next run end.\r
-                                               insertElbowUpdate(u, dcp, nextToMoved, dcpStart, position, directedDirection);\r
-                                       }\r
-                               } else if (other.isInstanceOf(ProcessResource.plant3Dresource.UndirectedControlPoint) &&\r
-                                                  other.getSubPointOf() != null) {\r
-                                       // FIXME : this code was for updating branches\r
-                                       Vector3d bintersect = new Vector3d();\r
-                                       PipeControlPoint bcp = other.getSubPointOf();\r
-                                       if (bcp != null && canMoveOther) {\r
-                                               Point3d bstart = new Point3d();\r
-                                               Point3d bend = new Point3d();\r
-                                               Vector3d bdir = new Vector3d();\r
-                                               ControlPointTools.getInlineControlPointEnds(bcp, bstart, bend, bdir);\r
-                                               Vector3d nintersect = new Vector3d();\r
-                                               \r
-                                               MathTools.intersectStraightStraight(position, directedDirection, bstart,\r
-                                                       bdir, nintersect, bintersect, mu);\r
-                                               Vector3d dist = new Vector3d(nintersect);\r
-                                               dist.sub(bintersect);\r
-                                               canMoveOther = mu[1] > 0.0 && mu[1] < 1.0 && dist.lengthSquared() < 0.01;\r
-                                       } else {\r
-                                               // TODO : endControlPoints are undirected: calculcate correct position for it\r
-                                               throw new UnsupportedOperationException("not implemented");\r
-                                       }\r
-                                       if (canMoveOther) { \r
-                                               if (DEBUG) System.out.println("PipingRules.updateDirectedPipeRun() moved end " + other.getResource() + " to " + bintersect);\r
-                                               // is required branch position is in possible range\r
-                                               ControlPointTools.setWorldPosition(bcp, bintersect);\r
-                                               if (dcpStart) {\r
-                                                       checkExpandPathLeg(new UpdateStruct2(u.start, u.startPoint, u.list, u.end, new Point3d(bintersect),directedDirection, u.offset, u.hasOffsets, u.iter, u.reversed, u.toRemove,u.updated),lengthChange);\r
-                                               } else {\r
-                                                       checkExpandPathLeg(new UpdateStruct2(u.start, new Point3d(bintersect), u.list, u.end, u.endPoint,directedDirection, u.offset, u.hasOffsets, u.iter, u.reversed, u.toRemove,u.updated),lengthChange);    \r
-                                               }\r
-                                       } else {\r
-                                               // branch cannot be moved into right position, new turn\r
-                                               // / elbow must be inserted\r
-                                               insertElbowUpdate(u , dcp, nextToMoved, dcpStart, position, directedDirection);\r
-                                       }\r
-\r
-                               } else { // assume that control point cannot be moved, but can be rotated\r
-                                       insertElbowUpdate(u, dcp, nextToMoved, dcpStart, position, directedDirection);\r
-                               }\r
-         }\r
-      }\r
-       }\r
-    \r
-    \r
-    \r
-    private static void updateDualDirectedPathLeg(UpdateStruct2 u, PathLegUpdateType lengthChange) {\r
-               if (DEBUG) System.out.println("PipingRules.updateDualDirectedPipeRun() " + u + " " + lengthChange);\r
-\r
-               PipeControlPoint dcp1 = u.start;\r
-               PipeControlPoint dcp2 = u.end;\r
-               Point3d position1 = u.startPoint;\r
-               Point3d position2 = u.endPoint;\r
-               Point3d position1offset = new Point3d(position1);\r
-               position1offset.sub(u.offset);\r
-               Point3d position2offset = new Point3d(position2);\r
-               position2offset.add(u.offset);\r
-               Vector3d dir1 = ControlPointTools.getDirectedControlPointDirection(dcp1);\r
-               Vector3d dir2 = ControlPointTools.getDirectedControlPointDirection(dcp2);\r
-               Vector3d p1 = MathTools.closestPointOnStraight(position1offset, position2, dir2);\r
-               Vector3d p2 = MathTools.closestPointOnStraight(position2offset, position1, dir1);\r
-               double d1 = position1.distance(new Point3d(p1));\r
-               double d2 = position2.distance(new Point3d(p2));\r
-\r
-               boolean aligned = (d1 < 0.01 && d2 < 0.01);\r
-               if (aligned) {\r
-                       processPathLeg(u);\r
-               } else {\r
-                       if (u.iter > 0) {\r
-                               backIter(u);\r
-                       } else {\r
-                               PipeControlPoint dcp;\r
-                               PipeControlPoint next;\r
-                               if (!u.reversed) {\r
-                                       dcp = dcp1;\r
-                                       if (u.list.size() > 0)\r
-                                               next = u.list.get(0);\r
-                                       else\r
-                                               next = dcp2;\r
-                               } else {\r
-                                       dcp = dcp2;\r
-                                       if (u.list.size() > 0)\r
-                                               next = u.list.get(u.list.size() - 1);\r
-                                       else\r
-                                               next = dcp1;\r
-                               }\r
-\r
-                               PipeRun pipeline = ControlPointTools.getPipeRun(dcp1);\r
-                               PipelineComponent elbow1 = PipingTools2.instantiatePipelineComponent(u.start.getGraph(), pipeline.getResource(), ProcessResource.plant3Dresource.Elbow);\r
-                               PipelineComponent elbow2 = PipingTools2.instantiatePipelineComponent(u.start.getGraph(), pipeline.getResource(), ProcessResource.plant3Dresource.Elbow);\r
-                               \r
-                               PipeControlPoint tcp1 = elbow1.getControlPoint();\r
-                               PipeControlPoint tcp2 = elbow2.getControlPoint();\r
-                               \r
-                               // Straight s1 = getStraight(dcp, next);\r
-                               ControlPointTools.insertControlPoint(tcp1, dcp, next);\r
-                               // s1 = getStraight(tcp1, next);\r
-                               ControlPointTools.insertControlPoint(tcp2, tcp1, next);\r
-                               p1 = G3DTools.getVector(dcp.getLocalPosition());\r
-                               if (!u.reversed)\r
-                                       p1.add(dir1);\r
-                               else\r
-                                       p1.add(dir2);\r
-                               \r
-                               if (!u.reversed)\r
-                                       p2 = MathTools.closestPointOnStraight(new Point3d(p1), position2, dir2);\r
-                               else\r
-                                       p2 = MathTools.closestPointOnStraight(new Point3d(p1), position1, dir1);\r
-                               \r
-                               ControlPointTools.setWorldPosition(tcp1, p1);\r
-                               ControlPointTools.setWorldPosition(tcp2, p2);\r
-                               \r
-                               if (DEBUG) System.out.println("PipingRules.updateDualDirectedPipeRun() created two turns " + tcp1.getResource() + " " + tcp2.getResource());\r
-\r
-                               if (!u.reversed) {\r
-                                       Vector3d dd = new Vector3d(p2);\r
-                                       dd.sub(p1);\r
-                                       dir2.negate();\r
-                                       processPathLeg(new UpdateStruct2(u.start, u.startPoint,new ArrayList<PipeControlPoint>(), tcp1, new Point3d(p1),dir1, new Vector3d(), false, 0, false,new ArrayList<ExpandIterInfo>(), u.updated));\r
-                                       processPathLeg(new UpdateStruct2(tcp1,new Point3d(p1), new ArrayList<PipeControlPoint>(),tcp2, new Point3d(p2), dd,new Vector3d(), false, 0, false,new ArrayList<ExpandIterInfo>(), u.updated));\r
-                                       // offset is recalculated\r
-                                       processPathLegNoOffset(new UpdateStruct2(tcp2, new Point3d(p2), u.list,u.end, u.endPoint, dir2, null, u.hasOffsets,u.iter, u.reversed, u.toRemove, u.updated));\r
-                               } else {\r
-                                       Vector3d dd = new Vector3d(p1);\r
-                                       dd.sub(p2);\r
-                                       dir2.negate();\r
-                                       processPathLeg(new UpdateStruct2(tcp1,new Point3d(p1), new ArrayList<PipeControlPoint>(),u.end, u.endPoint, dir2, new Vector3d(), false, 0,false, new ArrayList<ExpandIterInfo>(), u.updated));\r
-                                       processPathLeg(new UpdateStruct2(tcp2,new Point3d(p2), new ArrayList<PipeControlPoint>(),tcp1, new Point3d(p1), dd,new Vector3d(), false, 0, false,new ArrayList<ExpandIterInfo>(), u.updated));\r
-                                       // offset is recalculated\r
-                                       processPathLegNoOffset(new UpdateStruct2(u.start, u.startPoint,u.list, tcp2, new Point3d(p2),dir1, null, u.hasOffsets, u.iter, u.reversed,u.toRemove, u.updated));\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-    \r
-    private static void insertElbowUpdate(UpdateStruct2 u, PipeControlPoint dcp, PipeControlPoint next, boolean dcpStart, Point3d position, Vector3d directedDirection) {\r
-        \r
-       Vector3d closest = new Vector3d(position);\r
-               closest.add(directedDirection);\r
-               PipeControlPoint tcp = insertElbow(dcp, next, new Point3d(closest));\r
-\r
-               if (DEBUG) System.out.println("PipingRules.updateDirectedPipeRun() inserted " + tcp.getResource());\r
-               \r
-               if (dcpStart) {\r
-                       // update pipe run from new turn to other end\r
-                       ppNoDir(tcp, new Point3d(closest), u.list, u.end, u.endPoint, u.hasOffsets, u.iter, u.reversed, u.toRemove, u.updated);\r
-                       // update pipe run from directed to new turn\r
-                       processPathLeg(new UpdateStruct2(u.start, u.startPoint, new ArrayList<PipeControlPoint>(), tcp, new Point3d(closest), directedDirection, new Vector3d(), false, 0, false, new ArrayList<ExpandIterInfo>(),u.updated));                  \r
-               } else {\r
-                       // update pipe run from other end to new turn\r
-                       ppNoDir(u.start, u.startPoint, u.list, tcp, new Point3d(closest),  u.hasOffsets, u.iter, u.reversed, u.toRemove,u.updated);\r
-                       // update pipe run from new turn to directed\r
-                       processPathLeg(new UpdateStruct2(tcp, new Point3d(closest), new ArrayList<PipeControlPoint>(), u.end, u.endPoint, directedDirection, new Vector3d(), false, 0, false, new ArrayList<ExpandIterInfo>(),u.updated));\r
-               }\r
-    }\r
-    \r
-    /**\r
-     * Checks if turns can be removed (turn angle near zero)\r
-     */\r
-    private static int checkTurns(UpdateStruct2 u, PathLegUpdateType lengthChange) {\r
-               if (DEBUG)\r
-                       System.out.println("PipingRules.checkTurns() " + u.start.getResource()\r
-                                       + " " + u.end.getResource());\r
-               boolean startRemoved = false;\r
-               boolean endRemoved = false;\r
-               if (u.start.isInstanceOf(ProcessResource.plant3Dresource.VariableAngleTurnControlPoint)) {\r
-                       // this won't work properly if inline control points are not updated\r
-                       PipeControlPoint startPrev = u.start.getPrevious();\r
-                       if (startPrev != null) {\r
-                               double a;\r
-                               if (!u.hasOffsets) {\r
-                                       a = updateTurnControlPointTurn( u.start, startPrev, u.end);\r
-                               } else {\r
-                                       Point3d ep = new Point3d(u.endPoint);\r
-                                       ep.add(u.offset);\r
-                                       a = updateTurnControlPointTurn( u.start,u.startPoint, G3DTools.getPoint(startPrev.getLocalPosition()), ep);\r
-\r
-                               }\r
-                               if (a < MIN_TURN_ANGLE)\r
-                                       startRemoved = true;\r
-                               else if (lengthChange == PathLegUpdateType.PREV || lengthChange == PathLegUpdateType.PREV_S){\r
-                                       PathLegUpdateType type;\r
-                                       if (lengthChange == PathLegUpdateType.PREV_S)\r
-                                               type = PathLegUpdateType.PREV;\r
-                                       else\r
-                                               type = PathLegUpdateType.NONE;\r
-                                       updatePathLegPrev(u.start, u.start, type);\r
-                               }\r
-                       }\r
-               }\r
-               if (u.end.isInstanceOf(ProcessResource.plant3Dresource.VariableAngleTurnControlPoint)) {\r
-\r
-                       PipeControlPoint endNext = u.end.getNext();\r
-                       if (endNext != null) {\r
-                               double a;\r
-                               if (!u.hasOffsets) {\r
-                                       a = updateTurnControlPointTurn(u.end,u.start, endNext);\r
-                               } else {\r
-                                       Point3d sp = new Point3d(u.startPoint);\r
-                                       sp.sub(u.offset);\r
-                                       a = updateTurnControlPointTurn(u.end, u.endPoint, sp, G3DTools.getPoint(endNext.getLocalPosition()));\r
-                               }\r
-                               if (a < MIN_TURN_ANGLE)\r
-                                       endRemoved = true;\r
-                               else if (lengthChange == PathLegUpdateType.NEXT || lengthChange == PathLegUpdateType.NEXT_S){\r
-                                       PathLegUpdateType type;\r
-                                       if (lengthChange == PathLegUpdateType.NEXT_S)\r
-                                               type = PathLegUpdateType.NEXT;\r
-                                       else\r
-                                               type = PathLegUpdateType.NONE;\r
-                                       updatePathLegNext(u.end, u.end,type);\r
-                               }\r
-                       }\r
-               }\r
-               if (DEBUG)\r
-                       System.out.println("PipingRules.checkTurns() res " + startRemoved + " " + endRemoved);\r
-               if (!startRemoved && !endRemoved)\r
-                       return REMOVE_NONE;\r
-               if (startRemoved && endRemoved)\r
-                       return REMOVE_BOTH;\r
-               if (startRemoved)\r
-                       return REMOVE_START;\r
-               return REMOVE_END;\r
-       }\r
-    \r
-    /**\r
-        * Expands piperun search over turns that are going to be removed\r
-        * \r
-        */\r
-    private static void expandPathLeg(UpdateStruct2 u, int type) {\r
-       if (DEBUG) System.out.println("PipingRules.expandPipeline " + u.start.getResource() + " " + u.end.getResource());\r
-       ArrayList<PipeControlPoint> newList = new ArrayList<PipeControlPoint> ();\r
-       switch (type) {\r
-       case REMOVE_NONE :\r
-               throw new RuntimeException("Error in piping rules");\r
-       case REMOVE_START :\r
-               u.toRemove.add(new ExpandIterInfo(u.start,REMOVE_START));\r
-               u.start = ControlPointTools.findPreviousEnd(u.start);\r
-               u.startPoint = G3DTools.getPoint(u.start.getLocalPosition());\r
-               ControlPointTools.findNextEnd(u.start,newList);\r
-               newList.addAll(u.list);\r
-               u.list = newList;\r
-               break;\r
-       case REMOVE_END :\r
-               u.toRemove.add(new ExpandIterInfo(u.end,REMOVE_END));\r
-               u.end = ControlPointTools.findNextEnd(u.end,newList);\r
-               u.endPoint = G3DTools.getPoint(u.end.getLocalPosition());\r
-               u.list.addAll(newList);\r
-               break;\r
-       case REMOVE_BOTH :\r
-               u.toRemove.add(new ExpandIterInfo(u.start,u.end));\r
-               u.start = ControlPointTools.findPreviousEnd(u.start);\r
-               u.startPoint = G3DTools.getPoint(u.start.getLocalPosition());\r
-               ControlPointTools.findNextEnd(u.start,newList);\r
-               newList.addAll(u.list);\r
-               u.list = newList;\r
-               newList = new ArrayList<PipeControlPoint> ();\r
-               u.end = ControlPointTools.findNextEnd(u.end,newList);\r
-               u.endPoint = G3DTools.getPoint(u.end.getLocalPosition());\r
-               u.list.addAll(newList);\r
-               break;\r
-       default:\r
-               throw new RuntimeException("Error in piping rules");\r
-                       \r
-       }\r
-       u.offset = new Vector3d();\r
-       if (u.hasOffsets) {\r
-               u.dir.normalize();\r
-               for (PipeControlPoint icp : u.list) {\r
-                       if (icp.isInstanceOf(ProcessResource.plant3Dresource.OffsettingPoint)) {\r
-                               u.offset.add(ControlPointTools.getSizeChangeOffsetVector(icp,u.dir));\r
-                       }\r
-                       else if (icp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) \r
-                               ErrorLogger.defaultLogError("Updating pipe run, found offset controlpoint " + icp.getResource(), new Exception("ASSERT!"));\r
-               }\r
-               }\r
-       if (DEBUG) System.out.println("PipingRules.expandPipeline expanded " + u.start.getResource() + " " + u.end.getResource());\r
-       u.iter++;\r
-       updatePathLeg(u,PathLegUpdateType.NONE);\r
-    }\r
-    \r
-    /**\r
-        * reverts one iteration of turn removing back)\r
-     */\r
-    private static void backIter(UpdateStruct2 u) {\r
-               \r
-               if (DEBUG) System.out.println("PipingRules.backIter" + u.start.getResource() + " " + u.end.getResource());      \r
-               if (u.iter == 0)\r
-                       throw new RuntimeException("Error in piping rules");\r
-               ExpandIterInfo info = u.toRemove.get(u.toRemove.size()-1);\r
-               u.toRemove.remove(u.toRemove.size()-1);\r
-               if (info.getType() == REMOVE_START || info.getType() == REMOVE_BOTH) {\r
-                       while (u.list.size() > 0) {\r
-                               PipeControlPoint icp = u.list.get(0);\r
-                               if (icp.getPrevious().getResource().equals(info.getStart().getResource()))  \r
-                                       break;\r
-                               u.list.remove(icp);\r
-                       }\r
-                       u.start = info.getStart();      \r
-               } \r
-               if (info.getType() == REMOVE_END || info.getType() == REMOVE_BOTH) {\r
-                       while (u.list.size() > 0) {\r
-                               PipeControlPoint icp = u.list.get(u.list.size() - 1);\r
-                               if (icp.getNext().getResource().equals(info.getEnd().getResource())) \r
-                                       break;\r
-                               u.list.remove(icp);\r
-                       }\r
-                       u.end = info.getEnd();\r
-               }\r
-               u.offset = new Vector3d();\r
-               if (u.hasOffsets) {\r
-               u.dir.normalize();\r
-               for (PipeControlPoint icp : u.list) {\r
-                       if (icp.isInstanceOf(ProcessResource.plant3Dresource.OffsettingPoint)) {\r
-                               u.offset.add(ControlPointTools.getSizeChangeOffsetVector(icp,u.dir));\r
-                       }\r
-                       else if (icp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) \r
-                               ErrorLogger.defaultLogError("Updating pipe run, found offset controlpoint " + icp.getResource(), new Exception("ASSERT!"));\r
-               }\r
-               }\r
-               processPathLeg(u);\r
-       \r
-    }\r
-    \r
-    /**\r
-     * Processes pipe run (removes necessary turns and updates run ends)\r
-     */\r
-   // private static void processPathLeg(PipeControlPoint start, Point3d startPoint,ArrayList<InlineControlPoint> list, PipeControlPoint end,Point3d endPoint, Vector3d dir,Vector3d offset, boolean hasOffsets,int iter, boolean reversed, ArrayList<ExpandIterInfo> toRemove) throws TransactionException {\r
-         \r
-    private static void processPathLeg(UpdateStruct2 u) {\r
-       if (DEBUG) System.out.println("PipingRules.processPathLeg " + u.start.getResource() + " " + u.end.getResource());\r
-       processPathLeg(u, true, true);\r
-    }\r
-    \r
-    \r
-    private static void processPathLeg(UpdateStruct2 u, boolean updateEnds, boolean updateInline) {\r
-       if (DEBUG) System.out.println("PipingRules.processPathLeg " + u.start.getResource() + " " + u.end.getResource());\r
-       if (u.toRemove.size() > 0) {\r
-               for (ExpandIterInfo info : u.toRemove) {\r
-                       if (info.getStart() != null) {\r
-                               ControlPointTools.removeControlPoint(info.getStart());\r
-                       }\r
-                       if (info.getEnd() != null) {\r
-                               ControlPointTools.removeControlPoint(info.getEnd());\r
-                       }\r
-               }\r
-               // ControlPointTools.removeControlPoint may remove mo0re than one CP;\r
-               // we must populate inline CP list again.\r
-               u.list.clear();\r
-               ControlPointTools.findNextEnd(u.start, u.list);\r
-               }\r
-       // FIXME : inline CPs are update twice because their positions must be updated before and after ends.      \r
-       updateInlineControlPoints(u,false);\r
-               if (updateEnds) {\r
-                       if (u.start.isInstanceOf(ProcessResource.plant3Dresource.TurnControlPoint)) {\r
-                               updateTurnControlPointTurn(u.start, u.start.getPrevious(), u.start.getNext());\r
-                               updatePathLegPrev(u.start, u.start, PathLegUpdateType.NONE);\r
-                       } else if (u.start.isInstanceOf(ProcessResource.plant3Dresource.EndComponentControlPoint)) {\r
-                               updateEndComponentControlPoint(u.start, u.startPoint, u.endPoint);\r
-                       }\r
-                       if (u.end.isInstanceOf(ProcessResource.plant3Dresource.TurnControlPoint)) {\r
-                               updateTurnControlPointTurn( u.end, u.end.getPrevious(), u.end.getNext());\r
-                               updatePathLegNext(u.end, u.end, PathLegUpdateType.NONE);\r
-                       } else if (u.end.isInstanceOf(ProcessResource.plant3Dresource.EndComponentControlPoint)) {\r
-                               updateEndComponentControlPoint(u.end, u.startPoint, u.endPoint);\r
-                       }\r
-                       \r
-               } else {\r
-                       if (u.start.isInstanceOf(ProcessResource.plant3Dresource.EndComponentControlPoint)) {\r
-                               updateEndComponentControlPoint(u.start, u.startPoint, u.endPoint);\r
-                       }\r
-                       if (u.end.isInstanceOf(ProcessResource.plant3Dresource.EndComponentControlPoint)) {\r
-                               updateEndComponentControlPoint( u.end, u.startPoint, u.endPoint);\r
-                       }\r
-               }\r
-               if(updateInline)\r
-                       updateInlineControlPoints(u,true);\r
-       \r
-    }\r
-    \r
-    /**\r
-        * Processes pipe run and recalculates offset\r
-     */\r
-    //private static void processPathLeg(PipeControlPoint start, Point3d startPoint,ArrayList<InlineControlPoint> list, PipeControlPoint end,Point3d endPoint, Vector3d dir, boolean hasOffsets,int iter, boolean reversed, ArrayList<ExpandIterInfo> toRemove) throws TransactionException {\r
-    private static void processPathLegNoOffset(UpdateStruct2 u) {\r
-       if (DEBUG) System.out.println("PipingRules.processPathLeg " + u.start.getResource() + " " + u.end.getResource());\r
-       Vector3d offset = new Vector3d();\r
-       if (u.hasOffsets) {\r
-               u.dir.normalize();\r
-           for (PipeControlPoint icp : u.list) {\r
-               if (icp.isInstanceOf(ProcessResource.plant3Dresource.OffsetComponent)) {\r
-                       offset.add(ControlPointTools.getSizeChangeOffsetVector(icp,u.dir));\r
-               } else if (icp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                       ErrorLogger.defaultLogError("Updating pipe run, found offset controlpoint " + icp.getResource(), new Exception("ASSERT!"));\r
-               }\r
-           }\r
-       }       \r
-       processPathLeg(u);\r
-    }\r
-    \r
-    private static void updateOffsetPoint(PipeControlPoint sccp, Vector3d offset) {\r
-               Point3d world = G3DTools.getPoint(sccp.getWorldPosition());\r
-               world.add(offset);\r
-               PipeControlPoint ocp = sccp.getSubPoint().iterator().next();\r
-               ControlPointTools.setWorldPosition(ocp, world);\r
-    }\r
-    \r
-    private static void updatePathLegPrev(PipeControlPoint start, PipeControlPoint updated, PathLegUpdateType lengthChange) {\r
-       ArrayList<PipeControlPoint> list = new ArrayList<PipeControlPoint>();\r
-       PipeControlPoint end = ControlPointTools.findPreviousEnd(start,list);\r
-       updatePathLegPrev(start, list, end,updated,lengthChange);\r
-    }\r
-    \r
-    private static void updatePathLegPrev(PipeControlPoint start, ArrayList<PipeControlPoint> list, PipeControlPoint end, PipeControlPoint updated, PathLegUpdateType lengthChange) {\r
-       // reverses the list\r
-       ArrayList<PipeControlPoint> nextList = new ArrayList<PipeControlPoint>();\r
-       for (PipeControlPoint icp : list) {\r
-               if (icp.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint)) {\r
-                       nextList.add(0, icp.getSubPointOf());\r
-               } else {\r
-                       nextList.add(0,icp);\r
-               }\r
-               \r
-       }\r
-       updatePathLeg(end, nextList, start, true,0,new ArrayList<ExpandIterInfo>(),updated,lengthChange);\r
-        \r
-    }\r
-\r
-    \r
-    /**\r
-     * Updates InlineControlPoints position when straight pipe's end(s) have\r
-     * been changed)\r
-     * \r
-     * @param pipeline\r
-     * @param icp\r
-     * @param nextPoint\r
-     * @param prevPoint\r
-     */\r
-    private static void updateInlineControlPoint( PipeControlPoint icp, Point3d nextPoint, Point3d prevPoint, Vector3d dir) {\r
-       if (DEBUG) System.out.println("PipingRules.updateInlineControlPoint() " + icp.getResource());\r
-        \r
-       Point3d inlinePoint = G3DTools.getPoint(icp.getLocalPosition());\r
-        if (DEBUG) System.out.print("InlineControlPoint update "+icp.getResource() + " " + inlinePoint + " " + prevPoint + " " + nextPoint);\r
-        Vector3d newInlinePoint = null;\r
-        boolean branchUpdate = false;\r
-        PipeControlPoint becp = null;\r
-        for (PipeControlPoint pcp : icp.getSubPoint())\r
-               if (pcp.isInstanceOf(ProcessResource.plant3Dresource.UndirectedControlPoint)) {\r
-                       branchUpdate = true;\r
-                       becp = pcp;\r
-                       break;\r
-               }\r
-                       \r
-       if (DUMMY || !branchUpdate) {\r
-               newInlinePoint = MathTools.closestPointOnEdge(new Vector3d(inlinePoint), new Vector3d(nextPoint), new Vector3d(prevPoint));\r
-       } else {\r
-               \r
-               // FIXME : can only handle one branch\r
-               PipeControlPoint p = null;\r
-               if (becp.getNext() != null) {\r
-                       p = ControlPointTools.findNextEnd(becp);\r
-               } else if (becp.getPrevious() != null) {\r
-                       p = ControlPointTools.findPreviousEnd(becp);\r
-               } \r
-               if (p == null) {\r
-                       newInlinePoint = MathTools.closestPointOnEdge(new Vector3d(inlinePoint), new Vector3d(nextPoint), new Vector3d(prevPoint));\r
-               } else {\r
-                       Point3d branchLegEnd = G3DTools.getPoint(p.getLocalPosition());\r
-                       Vector3d dir2 = new Vector3d(inlinePoint);\r
-                       dir2.sub(branchLegEnd);\r
-                       Vector3d dir1 = new Vector3d(nextPoint);\r
-                       dir1.sub(prevPoint);\r
-                       newInlinePoint = new Vector3d();\r
-                       double mu[] = new double[2];\r
-                       MathTools.intersectStraightStraight(new Vector3d(prevPoint), dir1, new Vector3d(branchLegEnd), dir2, newInlinePoint, new Vector3d(),mu);\r
-                       if (DEBUG) System.out.println(mu[0]);\r
-                       // FIXME : reserve space \r
-                       if (mu[0] < 0.0) {\r
-                               newInlinePoint = new Vector3d(prevPoint);\r
-                       } else if (mu[0] > 1.0) {\r
-                               newInlinePoint = new Vector3d(nextPoint);\r
-                       }\r
-               }\r
-       }\r
-       if (DEBUG) System.out.println(" " + newInlinePoint);\r
-        \r
-       ControlPointTools.setWorldPosition(icp, newInlinePoint);\r
-       updateControlPointOrientation(icp);\r
-    }\r
-    \r
-    /**\r
-     * Updates InlineControlPoints position when straight pipe's end(s) have\r
-     * been changed)\r
-     * \r
-     * @param pipeline\r
-     * @param icp\r
-     * @param nextPoint\r
-     * @param prevPoint\r
-     */\r
-    private static void updateEndComponentControlPoint( PipeControlPoint ecp, Point3d start, Point3d end) {\r
-       if (DEBUG) System.out.println("PipingRules.updateEndComponentControlPoint() " + ecp.getResource());\r
-//        PipeControlPoint next = ecp.getNext();\r
-//        PipeControlPoint prev = ecp.getPrevious();\r
-//        if (next != null) {\r
-//             end = G3DTools.getPoint(next.getLocalPosition());\r
-//             start = G3DTools.getPoint(ecp.getLocalPosition());\r
-//        } else if (prev != null) {\r
-//             end = G3DTools.getPoint(ecp.getLocalPosition());\r
-//             start = G3DTools.getPoint(prev.getLocalPosition());\r
-//        } else {\r
-//             // TODO : warning?\r
-//             return;\r
-//        }\r
-       //Vector3d dir = new Vector3d (end);\r
-        //dir.sub(start);\r
-        //dir.normalize();\r
-       //G3DTools.setTuple(ecp.getDirection(), dir);\r
-       \r
-       updateControlPointOrientation(ecp);\r
-       \r
-       for (PipeControlPoint pcp : ecp.getSubPoint()) {\r
-               // TODO update position\r
-               updatePathLegEndControlPoint(pcp);\r
-       }\r
-    }\r
-    \r
-    private static void updateControlPointOrientation(PipeControlPoint pcp) {\r
-       // FIXME : hack to bypass variable length components orientation\r
-       if (pcp.getAtMostOneRelatedObject(ProcessResource.g3dResource.HasWorldOrientation) == null)\r
-               return;\r
-       Double angleO = pcp.getAtMostOneRelatedScalarDouble(ProcessResource.plant3Dresource.HasRotationAngle);\r
-       double angle = 0.0;\r
-       if (angleO != null)\r
-               angle = angleO;\r
-       \r
-       AxisAngle4d aa = ControlPointTools.getControlPointWorldRotation(pcp, angle);\r
-       ControlPointTools.setWorldOrientation(pcp,aa);\r
-       \r
-    }\r
-\r
-    /**\r
-     * Updates all branches when branch's position has been changed\r
-     * @param bcp\r
-     */\r
-    private static void updateBranchControlPointBranches(PipeControlPoint bcp) {\r
-       if (DEBUG) System.out.println("PipingRules.updateBranchControlPointBranches() " + bcp.getResource());\r
-        Collection<PipeControlPoint> branches = bcp.getSubPoint();\r
-        if (branches.size() == 0) {\r
-            if (DEBUG) System.out.println("No Branches found");\r
-            return;\r
-        }\r
-        for (PipeControlPoint pcp : branches) {\r
-               updatePathLegEndControlPoint(pcp);\r
-        }\r
-    }\r
-    \r
-    /**\r
-     * Recalculates turn control point's internal data (turn angle and offset)\r
-     * @param tcp\r
-     * @param prev\r
-     * @param next\r
-     */\r
-    private static double updateTurnControlPointTurn( PipeControlPoint tcp, PipeControlPoint prev, PipeControlPoint next) {\r
-       if (DEBUG) System.out.println("PipingTools.updateTurnControlPointTurn()" + tcp.getResource());\r
-        if (next == null || prev == null)\r
-            return Math.PI; // FIXME : argh\r
-        Point3d middlePoint = G3DTools.getPoint(tcp.getWorldPosition());\r
-        Point3d nextPoint = G3DTools.getPoint(next.getWorldPosition());    \r
-        Point3d prevPoint = G3DTools.getPoint(prev.getWorldPosition());     \r
-        return updateTurnControlPointTurn(tcp, middlePoint, prevPoint, nextPoint);\r
-    }\r
-    \r
-    /**\r
-     * Recalculates turn control point's internal data (turn angle and offset)\r
-     * @param tcp\r
-     * @param middlePoint\r
-     * @param nextPoint\r
-     * @param prevPoint\r
-     */\r
-    private static double updateTurnControlPointTurn( PipeControlPoint tcp, Point3d middlePoint, Point3d prevPoint, Point3d nextPoint) {\r
-       \r
-       Vector3d dir1 = new Vector3d(middlePoint);\r
-        dir1.sub(prevPoint);\r
-        Vector3d dir2 = new Vector3d(nextPoint);\r
-        dir2.sub(middlePoint);\r
-        if (DEBUG) System.out.println("PipingTools.updateTurnControlPointTurn " + tcp.getResource() + " " + prevPoint + " " + middlePoint + " " + nextPoint);\r
-        return updateTurnControlPointTurn(tcp, dir1, dir2);\r
-    }\r
-    \r
-    private static double updateTurnControlPointTurn(PipeControlPoint tcp, Vector3d dir1, Vector3d dir2) {\r
-        double turnAngle = dir1.angle(dir2);\r
-         double angle = Math.PI - turnAngle;\r
-         \r
-         double elbowRadius = tcp.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasTurnRadius);\r
-         double R = elbowRadius / Math.tan(angle * 0.5);\r
-         Vector3d turnAxis = new Vector3d();\r
-         turnAxis.cross(dir1, dir2);\r
-         turnAxis.normalize();\r
-         tcp.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasTurnAngle,turnAngle);\r
-         tcp.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, R);//setComponentOffsetValue(R);\r
-         G3DTools.setTuple3(tcp.getSingleRelatedObject(ProcessResource.plant3Dresource.HasTurnAxis), turnAxis);\r
-         if (DEBUG) System.out.println("PipingTools.updateTurnControlPointTurn " + dir1 + " " + dir2 + " " + turnAngle + " " + turnAxis);\r
-         return turnAngle;\r
-    }\r
-    \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingTools.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingTools.java
deleted file mode 100644 (file)
index 7ae038d..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.common;\r
-\r
-\r
-public class PipingTools {\r
-//     private static final boolean DEBUG = true;\r
-//     \r
-//\r
-//    \r
-//    /**\r
-//     * Splits straigth by inserting new controlpoint between straight ends.\r
-//     * @param straight\r
-//     * @param newPcp\r
-//     * @throws TransactionException\r
-//     */\r
-////    public static void insertControlPoint(Straight straight, PipeControlPoint newPcp) throws TransactionException {\r
-////        if (straight == null || newPcp == null) {\r
-////            ErrorLogger.defaultLogError("Routing pipe, cannot make branch: straight or control point is null", null);\r
-////            return;\r
-////        }\r
-////        PipeControlPoint scp = straight.getHasControlPoint();\r
-////        PipeControlPoint straightStart = (PipeControlPoint)StubFactory.getStubForResource(straight.getClass().getClassLoader(),scp.getPreviousPoint().getResource());\r
-////        PipeControlPoint straightEnd = (PipeControlPoint)StubFactory.getStubForResource(straight.getClass().getClassLoader(),scp.getNext().getResource());\r
-////        if (DEBUG) System.out.println("PipingTools inserting control point between " + straightStart.getResource() + " " + straightEnd.getResource() + " straight " + straight.getResource());\r
-////        \r
-////        // remove the straight pipe  \r
-////        PipeControlPoint temp = PipeControlPointFactory.instantiate(newPcp.getGraph());\r
-////        //straight.setHasNextControlPoint(temp);\r
-////        //straight.setHasPreviousControlPoint(temp);  \r
-////        straight.setHasControlPoint(temp);\r
-////        \r
-////        PipeRun pipeRun = getPipeRun(straight);\r
-////        if (pipeRun != null) {\r
-////            pipeRun.getHasSubnodesSet().remove(straight.getResource());\r
-////        }\r
-////        insertControlPoint(pipeRun, newPcp, straightStart, straightEnd);\r
-////        \r
-////    }\r
-//    \r
-//\r
-//\r
-//    \r
-//    \r
-//   \r
-//    \r
-//    \r
-//    public static void getStraightPipeEnds(Straight straight, Point3d end1, Point3d end2) {\r
-//        getStraightPipeEnds(getPipeRun(straight), straight, end1, end2);\r
-//    }\r
-//    \r
-//    public static void getStraightPipeEnds(PipeRun pipeRun,Straight straight, Point3d end1, Point3d end2) {\r
-//     if (DEBUG) System.out.println("PipingTools.getStraightPipeEnds() " + straight.getResource());\r
-//     PipeControlPoint scp = straight.getHasControlPoint();\r
-//        PipeControlPoint startControlPoint = (PipeControlPoint)StubFactory.getStubForResource(straight.getClass().getClassLoader(),scp.getPrevious().getResource());\r
-//        PipeControlPoint endControlPoint = (PipeControlPoint)StubFactory.getStubForResource(straight.getClass().getClassLoader(),scp.getNext().getResource());\r
-//        if (startControlPoint == null || endControlPoint == null) {\r
-//            ErrorLogger.defaultLogError("Pipe ends null", new NullPointerException());\r
-//        }\r
-//        // start and end position of the pipe\r
-//        // positions may be linked to other components, like nozzles\r
-//        // and then their coordinates are in component's local coordinates\r
-//        // which must be transformed into pipeRun's local coordinates\r
-//        \r
-//        //Point3d startPipe = getLocalPoint(pipeRun,startControlPoint);\r
-//\r
-//        \r
-//        //Point3d endPipe = getLocalPoint(pipeRun, endControlPoint);\r
-//        Point3d startPipe = G3DTools.getPoint(startControlPoint.getLocalPosition());\r
-//        Point3d endPipe = G3DTools.getPoint(endControlPoint.getLocalPosition());\r
-//        if (startPipe == null || endPipe == null) {\r
-//            end1.x = Double.NaN;\r
-//            end1.y = Double.NaN;\r
-//            end1.z = Double.NaN;\r
-//            end2.x = Double.NaN;\r
-//            end2.y = Double.NaN;\r
-//            end2.z = Double.NaN;\r
-//            if (DEBUG) System.out.println("no positions");\r
-//            return;\r
-//        }\r
-//        \r
-//        Vector3d dir = new Vector3d(endPipe);\r
-//        dir.sub(startPipe);\r
-//        \r
-//\r
-//        if (startControlPoint instanceof TurnControlPoint) {\r
-//            TurnControlPoint t = (TurnControlPoint)startControlPoint;\r
-//            double R = t.getComponentOffsetValue();\r
-//            Vector3d n = new Vector3d(dir);\r
-//            n.normalize();\r
-//            n.scale(R);\r
-//            startPipe.add(n);\r
-//        } else if (startControlPoint instanceof InlineControlPoint && !(startControlPoint instanceof BranchControlPoint)) {\r
-//            InlineControlPoint t = (InlineControlPoint)startControlPoint;\r
-//            double R = t.getNextComponentOffsetValue();\r
-//            Vector3d n = new Vector3d(dir);\r
-//            n.normalize();\r
-//            n.scale(R);\r
-//            startPipe.add(n);\r
-//        }\r
-//\r
-//        if (endControlPoint instanceof TurnControlPoint) {\r
-//            TurnControlPoint t = (TurnControlPoint)endControlPoint;\r
-//            double R = t.getComponentOffsetValue();\r
-//            Vector3d n = new Vector3d(dir);\r
-//            n.normalize();\r
-//            n.scale(R);\r
-//            endPipe.sub(n);\r
-//        } else if (endControlPoint instanceof InlineControlPoint && !(endControlPoint instanceof BranchControlPoint)) {\r
-//            InlineControlPoint t = (InlineControlPoint)endControlPoint;\r
-//            double R = t.getPreviousComponentOffsetValue();\r
-//            Vector3d n = new Vector3d(dir);\r
-//            n.normalize();\r
-//            n.scale(R);\r
-//            endPipe.sub(n);\r
-//        }\r
-//        \r
-//        end1.x = startPipe.x;\r
-//        end1.y = startPipe.y;\r
-//        end1.z = startPipe.z;\r
-//        \r
-//        end2.x = endPipe.x;\r
-//        end2.y = endPipe.y;\r
-//        end2.z = endPipe.z;\r
-//        \r
-//    }\r
-//    \r
-//    /**\r
-//     * Finds direction and ends where inline component, reducer or branch can be moved.\r
-//     * @param icp\r
-//     * @param s\r
-//     * @param e\r
-//     * @param d\r
-//     */\r
-//    public static void getInlineEnds(InlineControlPoint icp, Vector3d s, Vector3d e, Vector3d d) {\r
-//        \r
-//        PipeControlPoint next = (PipeControlPoint)StubFactory.getStubForResource(icp.getClass().getClassLoader(), icp.getNext().getResource());\r
-//        PipeControlPoint prev = (PipeControlPoint)StubFactory.getStubForResource(icp.getClass().getClassLoader(), icp.getPrevious().getResource());\r
-//        Vector3d start = G3DTools.getVector(prev.getLocalPosition());\r
-//        Vector3d end = G3DTools.getVector(next.getLocalPosition());\r
-//        if (icp.getResource().isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.SIZE_CHANGE_CONTROL_POINT))) {\r
-//            SizeChangeControlPoint sccp = SizeChangeControlPointFactory.create(icp.getResource());\r
-//            Vector3d tDir = new Vector3d(G3DTools.getVector(sccp.getLocalPosition()));\r
-//            Vector3d offset = getSizeChangeOffsetVector(sccp, tDir);\r
-//            end.sub(offset);\r
-//        }\r
-//        Vector3d dir = new Vector3d(end);\r
-//        dir.sub(start);\r
-//        Vector3d n = new Vector3d(dir);\r
-//        n.normalize();\r
-//        \r
-//        double offset = icp.getNextComponentOffsetValue();\r
-//        if (next instanceof InlineControlPoint) {\r
-//            InlineControlPoint ip = (InlineControlPoint) next;\r
-//            offset += ip.getPreviousComponentOffsetValue();      \r
-//        }\r
-//        else if (next instanceof TurnControlPoint) {\r
-//            TurnControlPoint tcp = (TurnControlPoint)next;\r
-//            offset += tcp.getComponentOffsetValue();\r
-//        }\r
-//        Vector3d t = new Vector3d(n);\r
-//        t.scale(offset);\r
-//        end.sub(t);\r
-//        \r
-//        offset = icp.getPreviousComponentOffsetValue();\r
-//        if (prev instanceof InlineControlPoint) {\r
-//            InlineControlPoint ip = (InlineControlPoint) prev;\r
-//            offset += ip.getPreviousComponentOffsetValue();\r
-//        }\r
-//        else if (prev instanceof TurnControlPoint) {\r
-//            TurnControlPoint tcp = (TurnControlPoint)prev;\r
-//            offset += tcp.getComponentOffsetValue();\r
-//        }\r
-//        t = new Vector3d(n);\r
-//        t.scale(offset);\r
-//        start.add(t);\r
-//        \r
-//        dir= new Vector3d(end);\r
-//        dir.sub(start);\r
-//        \r
-//        s.x = start.x;\r
-//        s.y = start.y;\r
-//        s.z = start.z;\r
-//        \r
-//        e.x = end.x;\r
-//        e.y = end.y;\r
-//        e.z = end.z;\r
-//        \r
-//        d.x = dir.x;\r
-//        d.y = dir.y;\r
-//        d.z = dir.z;\r
-//        \r
-//        System.out.println("PipingTools.getInlineEnds() " + s + " " + e + " " + d);\r
-//    }\r
-//    \r
-//    \r
-//    public static void setSame(fi.vtt.simantics.layer0.stubs.Double d1, fi.vtt.simantics.layer0.stubs.Double d2) {\r
-//     d1.getResource().createRelation(d2.getResource(), GlobalIdMap.get(PSK3DModelingOntologyMapping.IS_SAME_VALUE));\r
-//    }\r
-//    \r
-//    public static void setHalf(fi.vtt.simantics.layer0.stubs.Double d1, fi.vtt.simantics.layer0.stubs.Double d2) {\r
-//     d1.getResource().createRelation(d2.getResource(), GlobalIdMap.get(PSK3DModelingOntologyMapping.IS_HALF_OF_THE_VALUE));\r
-//    }\r
-//    \r
-//    \r
-//    \r
-\r
-//    \r
-//\r
-//    \r
-//    \r
-//    \r
-//    \r
-//    \r
-//    \r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingTools2.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/common/PipingTools2.java
deleted file mode 100644 (file)
index 4baf308..0000000
+++ /dev/null
@@ -1,668 +0,0 @@
-package fi.vtt.simantics.processeditor.common;\r
-\r
-import java.util.Collection;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.Statement;\r
-import org.simantics.layer0.utils.instantiation.Instance;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.actions.PositionType;\r
-import fi.vtt.simantics.processeditor.stubs.Equipment;\r
-import fi.vtt.simantics.processeditor.stubs.InlineComponent;\r
-import fi.vtt.simantics.processeditor.stubs.Nozzle;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-import fi.vtt.simantics.processeditor.stubs.PipelineComponent;\r
-\r
-public class PipingTools2 {\r
-       private static final boolean DEBUG = false;\r
-       public enum Direction{NEXT,PREVIOUS};\r
-       \r
-\r
-       \r
-       /**\r
-        * Reverses a piperun by swapping all previous/next connections\r
-        * @param pipeRun\r
-        */\r
-       public static void reversePipeRun(IEntity pipeRun) {\r
-//             //FIXME : reducers / size-change / offset-control points\r
-//     RelationTypeSet<PipeControlPoint> cps = pipeRun.getHasControlPointSet();\r
-//     if (cps.size() == 0)\r
-//             return;\r
-//     List<PipeControlPoint> list = new ArrayList<PipeControlPoint>();\r
-//     PipeControlPoint pcp = cps.iterator().next();\r
-//     list.add(pcp);\r
-//     PipeControlPoint temp = pcp.getPrevious();\r
-//     while (temp != null) {\r
-//             list.add(0,temp);\r
-//             temp = temp.getPrevious();\r
-//     }\r
-//     temp = pcp.getNext();\r
-//     while (temp != null) {\r
-//             list.add(temp);\r
-//             temp = temp.getNext();\r
-//     }\r
-//     // now list contains control points in sorted order.\r
-//     // switch order\r
-//     for (int i = 0; i < list.size() - 1; i++) {\r
-//             PipeControlPoint pcp1 = list.get(i);\r
-//             PipeControlPoint pcp2 = list.get(i+1);\r
-//             pcp1.setPrevious(pcp2);\r
-//             pcp2.setNext(pcp1);\r
-//\r
-//     }\r
-//     // fix ends\r
-//     list.get(0).setNext(null);\r
-//     list.get(list.size() - 1).setPrevious(null);\r
-\r
-       }\r
-\r
-       public static IEntity getPipeRun(IEntity component) {\r
-               assert(component.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent));\r
-               return component.getSingleRelatedObject(ProcessResource.g3dResource.HasParent);\r
-       }\r
-       \r
-        /**\r
-     * Returns Nozzle of a directed control point\r
-     * @param dcp\r
-     * @return\r
-     */\r
-    public static Nozzle getNozzle(PipeControlPoint dcp) {\r
-       assert (dcp.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint));\r
-       IEntity e = dcp.getControlPointOf();\r
-       if (e == null)\r
-               return null;\r
-       assert (e.isInstanceOf(ProcessResource.plant3Dresource.Nozzle));\r
-       return new Nozzle(e);\r
-    }\r
-       \r
-       /**\r
-        * Instantiates new pipeline component and all necessary control points for it.\r
-        * @param graph\r
-        * @param typeResource\r
-        * @return\r
-        */\r
-       public static PipelineComponent instantiatePipelineComponent(Graph graph, Resource pipeRunResource, Resource typeResource) {\r
-               IEntity pipeRun = EntityFactory.create(graph,pipeRunResource);\r
-               Instance ins = InstanceFactory.getInstanceOfType(graph, typeResource);\r
-       Resource instance = ins.instantiate(graph);\r
-       PipelineComponent component = new PipelineComponent(graph,instance);\r
-       G3DTools.resetTransformation(component);\r
-       // copy control point\r
-       Collection<Resource> pcps = graph.getObjects(typeResource, ProcessResource.plant3Dresource.HasControlPoint);\r
-       assert(pcps.size() == 1);\r
-       Collection<Resource> types = graph.getObjects(pcps.iterator().next(), ProcessResource.builtins.InstanceOf);\r
-       PipeControlPoint componentPCP = new PipeControlPoint(graph,InstanceFactory.instantiate(graph, types));\r
-       component.addStatement(ProcessResource.plant3Dresource.HasControlPoint, componentPCP);\r
-       pipeRun.addStatement(ProcessResource.g3dResource.HasChild, component);\r
-       pipeRun.addStatement(ProcessResource.plant3Dresource.HasControlPoints, componentPCP);\r
-       component.setPipeDiameter(pipeRun.getSingleRelatedObject(ProcessResource.plant3Dresource.HasPipeDiameter));\r
-       if (component.isInstanceOf(ProcessResource.plant3Dresource.VariableAngleTurnComponent)) {\r
-               setStatement(component, ProcessResource.plant3Dresource.HasTurnRadius, pipeRun.getSingleRelatedObject(ProcessResource.plant3Dresource.HasTurnRadius));\r
-               setStatement(componentPCP, ProcessResource.plant3Dresource.HasTurnRadius, pipeRun.getSingleRelatedObject(ProcessResource.plant3Dresource.HasTurnRadius));\r
-               setStatement(component, ProcessResource.plant3Dresource.HasTurnAngle, componentPCP.getSingleRelatedObject(ProcessResource.plant3Dresource.HasTurnAngle));\r
-               setStatement(component, ProcessResource.plant3Dresource.HasTurnAxis, componentPCP.getSingleRelatedObject(ProcessResource.plant3Dresource.HasTurnAxis));                 \r
-       }\r
-       if (component.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasLength) != null) {\r
-               setStatement(componentPCP, ProcessResource.plant3Dresource.HasLength, component.getSingleRelatedObject(ProcessResource.plant3Dresource.HasLength));\r
-       }\r
-       componentPCP.setLocalOrientation(component.getLocalOrientation());\r
-       componentPCP.setWorldOrientation(component.getWorldOrientation());\r
-       \r
-       componentPCP.setLocalPosition(component.getLocalPosition());\r
-       componentPCP.setWorldPosition(component.getWorldPosition());\r
-       \r
-       setStatement(componentPCP, ProcessResource.plant3Dresource.HasPipeDiameter, pipeRun.getSingleRelatedObject(ProcessResource.plant3Dresource.HasPipeDiameter));\r
-       setStatement(component, ProcessResource.plant3Dresource.HasPipeDiameter, pipeRun.getSingleRelatedObject(ProcessResource.plant3Dresource.HasPipeDiameter));\r
-       \r
-       // TODO : instantiate subpoints\r
-       \r
-       \r
-       return component;\r
-       }\r
-       \r
-       public static Nozzle instantiateNozzle(Graph graph, Resource typeResource) {\r
-               Instance ins = InstanceFactory.getInstanceOfType(graph, typeResource);\r
-       Resource instance = ins.instantiate(graph);\r
-       Nozzle n = new Nozzle(graph,instance);\r
-       G3DTools.resetTransformation(n);\r
-       \r
-       // copy control point\r
-       Collection<Resource> pcps = graph.getObjects(typeResource, ProcessResource.plant3Dresource.HasControlPoint);\r
-       assert(pcps.size() == 1);\r
-       Collection<Resource> types = graph.getObjects(pcps.iterator().next(), ProcessResource.builtins.InstanceOf);\r
-       PipeControlPoint nozzlePCP = new PipeControlPoint(graph,InstanceFactory.instantiate(graph, types));\r
-       n.addStatement(ProcessResource.plant3Dresource.HasControlPoint, nozzlePCP);\r
-       nozzlePCP.setLocalOrientation(n.getLocalOrientation());\r
-       nozzlePCP.setWorldOrientation(n.getWorldOrientation());\r
-       nozzlePCP.setLocalPosition(n.getLocalPosition());\r
-       nozzlePCP.setWorldPosition(n.getWorldPosition());\r
-       setStatement(nozzlePCP, ProcessResource.plant3Dresource.HasPipeDiameter, n.getSingleRelatedObject(ProcessResource.plant3Dresource.HasPipeDiameter));\r
-       nozzlePCP.setPipeDiameter(0.2);\r
-       return n;\r
-       }\r
-       \r
-       public static Equipment instantiateEquipment(Graph graph, Resource typeResource) {\r
-               Instance ins = InstanceFactory.getInstanceOfType(graph, typeResource);\r
-       Resource instance = ins.instantiate(graph);\r
-       Equipment equipment = new Equipment(graph, instance);\r
-       G3DTools.resetTransformation(equipment);\r
-       \r
-       IEntity type = EntityFactory.create(graph, typeResource);\r
-       IEntity geometricModel = type.getSingleRelatedObject(ProcessResource.plant3Dresource.HasGraphics);\r
-       \r
-       Collection<IEntity> sizingProperties = geometricModel.getRelatedObjects(ProcessResource.g3dResource.HasSizingParameter);\r
-       Collection<Statement> equipmentProperties = equipment.getRelatedStatements(ProcessResource.builtins.HasProperty);\r
-               \r
-       for (IEntity e : sizingProperties) {\r
-               String name = e.getName();\r
-               String pName = "Has " + name;\r
-               boolean found = false;\r
-               for (Statement s : equipmentProperties) {\r
-                       IEntity predicate = s.getPredicate();\r
-                       String predicateName = predicate.getName();\r
-                       if (predicateName.equals(pName)) {\r
-                               found = true;\r
-                               break;\r
-                       }\r
-               }\r
-               if(!found) {\r
-                       IEntity rel = getOrCreateRel(graph,name);\r
-                       equipment.setRelatedScalarDouble(rel, 1.0);\r
-               }\r
-       }\r
-       \r
-       // TODO : create nozzles if needed\r
-       \r
-       return equipment;\r
-       }\r
-       \r
-       private static IEntity getOrCreateRel(Graph graph, String name) {\r
-               IEntity rel = null;\r
-               try {\r
-                       Resource relr = graph.getResourceByURI("http://www.vtt.fi/Simantics/Plant3D/1.0/Relations#Has" + name);\r
-                       rel = EntityFactory.create(graph,relr);\r
-               } catch (Exception e) {\r
-                       Resource relLib = null;\r
-                       try {\r
-                               relLib = graph.getResourceByURI("http://www.vtt.fi/Simantics/Plant3D/1.0#Relations");\r
-                       } catch (Exception e2) {\r
-                               \r
-                       }\r
-                       Resource relr = graph.newResource();\r
-                       rel = EntityFactory.create(graph, relr);\r
-                       rel.addStatement(ProcessResource.builtins.SubrelationOf, ProcessResource.g3dResource.HasNonTransformation);\r
-                       rel.setName("Has " + name);\r
-                       Resource irelr = graph.newResource();\r
-                       graph.addStatement(relr,ProcessResource.builtins.InverseOf,irelr);\r
-                       graph.addStatement(relLib, ProcessResource.builtins.ConsistsOf, relr);\r
-               }\r
-               return rel;\r
-       }\r
-       \r
-       public static IEntity getLibraryComponentType(IEntity component) {\r
-               assert(component.isInstanceOf(ProcessResource.plant3Dresource.LibraryComponent));\r
-               // IEntity.getTypes() returns all types, but we want the closest type.\r
-               Collection<IEntity> types = component.getRelatedObjects(ProcessResource.builtins.InstanceOf);//component.getTypes();\r
-               IEntity type = null;\r
-               for (IEntity t : types) {\r
-                       if (t.isInheritedFrom(ProcessResource.plant3Dresource.LibraryComponent)) {\r
-                               if (type == null)\r
-                                       type = t;\r
-                               else\r
-                                       throw new RuntimeException("Cannot find proper type for library component " + component.getResource() );\r
-                       }\r
-               }\r
-               return type;\r
-       }\r
-       \r
-       /**\r
-        * Splits existing VariableLengthComponent with another component.\r
-        * Result is two VariableLengthComponents and inserted component between them.\r
-        * \r
-        * Note : world position of newComponent must be set before this method may be called.\r
-        * \r
-        * @param newComponent\r
-        * @param splittingComponent\r
-        */\r
-       public static void splitVariableLengthComponent(IEntity newComponent, IEntity splittingComponent) {\r
-               assert(splittingComponent.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent));\r
-               assert(newComponent.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent));\r
-               assert(!newComponent.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent));\r
-               IEntity newCP = newComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint);\r
-               IEntity splittingCP = splittingComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint);\r
-               IEntity nextCP = splittingCP.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasNext);\r
-               IEntity prevCP = splittingCP.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasPrevious);\r
-               \r
-               /* there are many different cases to insert new component when\r
-                  it splits existing VariableLengthinlineComponent.\r
-           \r
-              1. VariableLengthComponet is connected from both sides:\r
-                 - insert new component between VariableLength component and component connected to it\r
-                 - insert new VariableLengthComponent between inserted component and component selected in previous step\r
-               \r
-                  2. VariableLengthComponent is connected from one side\r
-                    - Use previous case or:\r
-                    - Insert new component to empty end\r
-                    - Insert new VariableLength component to inserted components empty end\r
-                    \r
-                  3. VariableLength is not connected to any component.\r
-                    - Should not be possible, at least in current implementation.\r
-                    - Could be done using second case\r
-\r
-               */\r
-               \r
-               if (nextCP == null && prevCP == null) {\r
-                       // this should not be possible\r
-                       throw new RuntimeException("VariableLengthComponent " + splittingComponent.getResource() + " is not connected to anything.");\r
-               }\r
-               \r
-               Point3d next = ControlPointTools.getRealPosition(splittingCP, PositionType.NEXT);\r
-               Point3d prev = ControlPointTools.getRealPosition(splittingCP, PositionType.PREVIOUS);\r
-               Point3d comp = G3DTools.getPoint(newComponent.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldPosition));\r
-               double length = newComponent.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-               Vector3d dir = new Vector3d(next);\r
-               dir.sub(prev);\r
-               dir.normalize();\r
-               dir.scale(length * 0.5);\r
-               Point3d vn = new Point3d(comp);\r
-               Point3d vp = new Point3d(comp);\r
-               vn.add(dir);\r
-               vp.sub(dir);\r
-               double ln = vn.distance(next);\r
-               double lp = vp.distance(prev);\r
-               vp.interpolate(prev, 0.5);\r
-               vn.interpolate(next, 0.5);\r
-               \r
-               IEntity type = getLibraryComponentType(splittingComponent);\r
-               \r
-               IEntity newVariableLengthComponent = instantiatePipelineComponent(splittingComponent.getGraph(), getPipeRun(splittingComponent).getResource(), type.getResource());\r
-               IEntity newVariableLengthCP = newVariableLengthComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint);\r
-               if (nextCP == null) {\r
-                       ControlPointTools.insertControlPoint(newCP, splittingCP,Direction.NEXT);\r
-                       ControlPointTools.insertControlPoint(newVariableLengthCP, newCP,Direction.NEXT);\r
-                       ControlPointTools.setWorldPosition(splittingCP, vp);\r
-                       splittingCP.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, lp);\r
-                       ControlPointTools.setWorldPosition(newVariableLengthCP, vn);    \r
-                       newVariableLengthComponent.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, ln);\r
-               } else if (prevCP == null) {\r
-                       ControlPointTools.insertControlPoint(newCP, splittingCP,Direction.PREVIOUS);\r
-                       ControlPointTools.insertControlPoint(newVariableLengthCP, newCP,Direction.PREVIOUS);\r
-                       ControlPointTools.setWorldPosition(splittingCP, vn);\r
-                       splittingCP.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, ln);\r
-                       ControlPointTools.setWorldPosition(newVariableLengthCP, vp);\r
-                       newVariableLengthComponent.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, lp);\r
-               } else {\r
-                       ControlPointTools.insertControlPoint(newCP,splittingCP,nextCP);\r
-                       ControlPointTools.insertControlPoint(newVariableLengthCP, newCP,nextCP);\r
-                       ControlPointTools.setWorldPosition(splittingCP, vp);\r
-                       splittingCP.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, lp);\r
-                       ControlPointTools.setWorldPosition(newVariableLengthCP, vn);\r
-                       newVariableLengthComponent.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, ln);\r
-               }\r
-\r
-       }\r
-       \r
-       /**\r
-        * Attaches newComponent into connectedComponent's connectedControlPoint\r
-        * @param newComponent\r
-        * @param connectedComponent\r
-        * @param connectedControlPoint\r
-        */\r
-       public static void insertComponent(IEntity newComponent, IEntity connectedComponent, IEntity connectedControlPoint, Direction direction) {\r
-           assert (newComponent.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent));\r
-           assert (connectedComponent.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent));\r
-           // TODO : piperun check is more complicated, since newComponent and connectedComponent may be SizeChangeComponents \r
-           //assert (getPipeRun(connectedComponent).equals(getPipeRun(newComponent)));\r
-           \r
-           // new control point and its subpoint\r
-           IEntity newControlPoint = newComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint);\r
-           ControlPointTools.insertControlPoint(newControlPoint, connectedControlPoint, direction);\r
-//         IEntity newSubPoint = null;\r
-//         if (newControlPoint.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint))\r
-//             newSubPoint = newControlPoint.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-//         \r
-//         // connected components parent or subpoint \r
-//         IEntity connectedSubPoint = null;\r
-//         IEntity connectedParentPoint = null;\r
-//         if (connectedControlPoint.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint))\r
-//             connectedSubPoint = connectedControlPoint.getSingleRelatedObject(ProcessResource.plant3Dresource.HasSubPoint);\r
-//         else if (connectedControlPoint.isInstanceOf(ProcessResource.plant3Dresource.DualSubControlPoint))\r
-//             connectedParentPoint = connectedControlPoint.getSingleRelatedObject(ProcessResource.plant3Dresource.SubPointOf);\r
-//         \r
-//         if (direction == Direction.NEXT) {\r
-//             assert (connectedSubPoint == null); // if direction is next, connection done to subpoint\r
-//             setStatement(connectedControlPoint, ProcessResource.plant3Dresource.HasNext, newControlPoint);\r
-//             if (connectedParentPoint != null)\r
-//                     setStatement(connectedParentPoint, ProcessResource.plant3Dresource.HasNext, newControlPoint);\r
-//             setStatement(newControlPoint, ProcessResource.plant3Dresource.HasPrevious, connectedControlPoint);\r
-//             if (newSubPoint != null)\r
-//                     setStatement(newSubPoint, ProcessResource.plant3Dresource.HasPrevious, connectedControlPoint);\r
-//             \r
-//         } else {\r
-//             assert (connectedParentPoint == null); // if direction is prev, connection done to parentpoint\r
-//             if (newSubPoint != null) {\r
-//                     \r
-//             }\r
-//         }\r
-               \r
-               /*\r
-           private void insertEndComponent() {\r
-               activated = false;\r
-               Graph coreTC = parent.getGraph();\r
-               \r
-               if (replace == null)\r
-                       checkForEndInsertion();\r
-               if (replace == null) {\r
-                       ErrorLogger.defaultLogError("Cannot insert end component",null);\r
-                       end();\r
-                       return;\r
-               }\r
-               G3DNode p = straight.getHasParent();\r
-               if (p == null) {\r
-                   ErrorLogger.defaultLogError("Straight pipe has no parent", new Exception("ASSERT!"));\r
-\r
-               } else {\r
-                   Pipeline pipeline = PipelineFactory.create(p);\r
-                   coreTC.startTransaction(this);\r
-                   try {\r
-                       Vector3d startPoint = GraphicsNodeTools.getVector(replace.getLocalPosition());\r
-                       EndComponentControlPoint ecp = EndComponentControlPointFactory.instantiate(coreTC);\r
-                       coreTC.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-                       pipeline.getHasControlPointSet().remove(replace);\r
-                       // create dummy node\r
-                       //PipeControlPoint pcp = PipeControlPointFactory.instantiate(coreTC);\r
-                       replace.setNextPoint(null);\r
-                       replace.setPreviousPoint(null);\r
-                       pipeline.getHasControlPointSet().add(ecp);\r
-                       if (next) {\r
-                               straight.getHasControlPoint().getPreviousPoint().setNextPoint(ecp);\r
-                               straight.getHasControlPoint().setNextPoint(ecp);\r
-                               ecp.setPreviousPoint(straight.getHasControlPoint().getPreviousPoint());\r
-                               //ecp.setNextPoint(null);\r
-                       } else {\r
-                               straight.getHasControlPoint().getNextPoint().setPreviousPoint(ecp);\r
-                               straight.getHasControlPoint().setPreviousPoint(ecp);\r
-                               ecp.setNextPoint(straight.getHasControlPoint().getNextPoint());\r
-                               //ecp.setPreviousPoint(null);\r
-                       }\r
-                       G3DTools.setTranslation(ecp.getLocalPosition(), startPoint);\r
-                       // FIXME : component should specify how much space it needs\r
-                       createAndLink(coreTC, pipeline, ecp);\r
-                       coreTC.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-                       coreTC.commitTransaction(CommitMessage.TRANSACTION_MESSAGE);\r
-                   } catch (TransactionException e) {\r
-                       ErrorLogger.defaultLogError("Cannot insert component", e);\r
-                       coreTC.cancelTransaction();\r
-                   }\r
-               }\r
-               \r
-               end();\r
-           }\r
-           \r
-           private void insertComponent(Point3d startPoint) {\r
-               activated = false;\r
-               Graph coreTC = parent.getGraph();\r
-               G3DNode p = straight.getHasParent();\r
-               if (p == null) {\r
-                   ErrorLogger.defaultLogError("Straight pipe has no parent", new Exception("ASSERT!"));\r
-\r
-               } else {\r
-                   Pipeline pipeline = PipelineFactory.create(p);\r
-                   coreTC.startTransaction(this);\r
-                   try {\r
-                       InlineComponentControlPoint icp = InlineComponentControlPointFactory.instantiate(coreTC);\r
-                       coreTC.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-                       PipeControlPoint scp = straight.getHasControlPoint();\r
-                       // it shouldn't matter whitch control point to use, next or previous.\r
-                       PipingTools.insertControlPoint(pipeline, icp, scp, scp.getNextPoint());\r
-                       //PipingTools.insertControlPoint(straight, icp);\r
-                       pipeline.getHasControlPointSet().add(icp);\r
-                       G3DTools.setTranslation(icp.getLocalPosition(), startPoint);\r
-                       // FIXME : component should specify how much space it needs\r
-                       icp.setNextComponentOffsetValue(pipeline.getPipeRadiusValue());\r
-                       icp.setPreviousComponentOffsetValue(pipeline.getPipeRadiusValue());\r
-                       PipingTools.setSame(pipeline.getPipeRadius(), icp.getNextComponentOffset());\r
-                       PipingTools.setSame(pipeline.getPipeRadius(), icp.getPreviousComponentOffset());\r
-                       createAndLink(coreTC, pipeline, icp);\r
-                       coreTC.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-                       coreTC.commitTransaction(CommitMessage.TRANSACTION_MESSAGE);\r
-                   } catch (TransactionException e) {\r
-                       ErrorLogger.defaultLogError("Cannot insert component", e);\r
-                       coreTC.cancelTransaction();\r
-                   }\r
-               }\r
-\r
-               line.removeFromParent();\r
-               \r
-               end();\r
-               \r
-           }\r
-          \r
-           \r
-           private void createAndLink(Graph coreTC, Pipeline pipeline, PipeControlPoint icp) throws TransactionException {\r
-               PipelineComponent component = PipelineComponentFactory.create(OntologyUtils.instantiate(typeResource));\r
-               coreTC.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-               component.setHasControlPoint(icp);\r
-               component.setLocalPosition(icp.getLocalPosition());\r
-               pipeline.getHasSubnodesSet().add(component);\r
-               component.setPipeRadius(pipeline.getPipeRadius());\r
-               component.setHasGraphics(GraphicsModelFactory.create(modelResource));\r
-               \r
-           }\r
-            */\r
-               \r
-               /*\r
-                       old insert reducer code\r
-                       \r
-                                       Pipeline pipeline = PipingTools.getPipeline(straight);\r
-                       // pcp is Turn Control Point and we'll have to change it's type to Size Change Control Point\r
-                       // First we'll remove its unnecessary properties and elbow connected to it,\r
-                       RelationTypeSet<Entity> pipeComponents = pcp.getControlPointOfSet();\r
-                       Resource elbowResource = null;\r
-                       for (Entity e : pipeComponents) {\r
-                               if (e.getResource().isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.ELBOW))) {\r
-                                       elbowResource = e.getResource();\r
-                               }\r
-                       }\r
-                       if (elbowResource != null) {\r
-                               pipeComponents.remove(elbowResource);\r
-                               pipeline.getHasSubnodesSet().remove(elbowResource);\r
-                       }\r
-                       RelationSet rs = pcp.getResource().getRelatedResourcesWithRelationIds(GlobalIdMap.get(PSK3DModelingOntologyMapping.HAS_TURN_ANGLE));\r
-                       RelationReference rr = rs.getRelations()[0];\r
-                       pcp.getResource().removeRelationById(rr.getObjectId(),rr.getRelationId());\r
-                       rs = pcp.getResource().getRelatedResourcesWithRelationIds(GlobalIdMap.get(PSK3DModelingOntologyMapping.HAS_COMPONENT_OFFSET));\r
-                       rr = rs.getRelations()[0];\r
-                       pcp.getResource().removeRelationById(rr.getObjectId(),rr.getRelationId());\r
-                       rs = pcp.getResource().getRelatedResourcesWithRelationIds(GlobalIdMap.get(Builtins.InstanceOf));\r
-                       rr = rs.getRelations()[0];\r
-                       //pcp.getResource().removeRelationById(type[0], GlobalIdMap.get(Builtins.InstanceOf));\r
-                       pcp.getResource().removeRelationById(rr.getObjectId(),rr.getRelationId());\r
-                       Resource sccpType = graph.getResource(PSK3DModelingOntologyMapping.SIZE_CHANGE_CONTROL_POINT);\r
-                       pcp.createRelation(sccpType, graph.getResource(Builtins.InstanceOf));\r
-                       \r
-                       graph.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-                       \r
-                       Reducer reducer = null;\r
-                       Pipeline newPipeline = PipelineFactory.instantiate(graph);\r
-                       OffsetControlPoint offsetControlPoint = OffsetControlPointFactory.instantiate(graph);\r
-                       if (i == 0) {\r
-                               reducer = ConcentricReducerFactory.instantiate(graph);\r
-                       } else {\r
-                               reducer = EccentricReducerFactory.instantiate(graph);\r
-                       }       \r
-                       graph.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-                       SizeChangeControlPoint sccp = SizeChangeControlPointFactory.create(pcp.getResource());\r
-                       \r
-                       \r
-                       // FIXME : lenght, pipe radius and turn angle from specs + let the user choose spec for new pipeline\r
-                       double reducerLength = 0.3;\r
-                       reducer.setLengthValue(reducerLength);\r
-                       double newPipeRadius = pipelineDialog.getPipeRadius();\r
-                       double newPipeTurnRadius = pipelineDialog.getTurnRadius();\r
-\r
-                       reducer.setLocalPosition(sccp.getLocalPosition());\r
-                       reducer.setWorldPosition(sccp.getWorldPosition());\r
-                       \r
-                       reducer.setBottomRadiusValue(pipeline.getPipeRadiusValue());\r
-                       \r
-                       reducer.setPipeRadius(pipeline.getPipeRadius());\r
-                       reducer.setTopRadiusValue(newPipeRadius);\r
-                       newPipeline.setPipeRadiusValue(newPipeRadius);\r
-                       newPipeline.setTurnRadiusValue(newPipeTurnRadius);\r
-                       \r
-                       // reducer is adjuste by pipelines' radiis\r
-                       PipingTools.setSame(pipeline.getPipeRadius(), reducer.getBottomRadius());\r
-                       PipingTools.setSame(newPipeline.getPipeRadius(), reducer.getTopRadius());\r
-                       \r
-                       //newPipeline.getHasControlPointSet().add(pcp);\r
-                       sccp.setHasOffsetPoint(offsetControlPoint);\r
-                       offsetControlPoint.setOffsetPointOf(sccp);\r
-                       \r
-                       reducer.setHasControlPoint(sccp);\r
-                       graph.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-                       \r
-                       sccp.setNextComponentOffsetValue(reducerLength*0.5);\r
-                       sccp.setPreviousComponentOffsetValue(reducerLength*0.5);\r
-                       \r
-                       // offsets are calculated from reducers length\r
-                       PipingTools.setHalf(reducer.getLength(), sccp.getNextComponentOffset());\r
-                       PipingTools.setHalf(reducer.getLength(), sccp.getPreviousComponentOffset());\r
-                       \r
-                       // linking sccp and ocp offsets\r
-                       offsetControlPoint.setNextComponentOffset(sccp.getNextComponentOffset());\r
-                       offsetControlPoint.setPreviousComponentOffset(sccp.getPreviousComponentOffset());\r
-                       \r
-                       \r
-                       offsetControlPoint.setPreviousPoint(sccp.getPreviousPoint());\r
-                       offsetControlPoint.setNextPoint(sccp.getNextPoint());\r
-                       if (i == 1) {\r
-                               // FIXME : link offset value\r
-                               sccp.setOffsetValue(reducer.getBottomRadiusValue() - reducer.getTopRadiusValue());              \r
-                               sccp.setAngle(((EccentricReducer)reducer).getAngle());\r
-                               Vector3d v = PipingTools.getSizeChangeOffsetVector(sccp);\r
-                               Point3d local = GraphicsNodeTools.getTranslation(sccp.getLocalPosition());\r
-                               local.add(v);\r
-                               //Point3d World = GraphicsNodeTools.getTranslation(sccp.getLocalPosition());\r
-                               GraphicsNodeTools.setTranslation(offsetControlPoint.getLocalPosition(), local);\r
-                       } else {\r
-                               // FIXME : is it possible that pipelines are in different coordinate systems \r
-                               offsetControlPoint.setLocalPosition(sccp.getLocalPosition());\r
-                               offsetControlPoint.setWorldPosition(sccp.getWorldPosition());\r
-                       }\r
-                       ((TestProcessEditor)parent).getPlant().getHasSubnodesSet().add(newPipeline);\r
-                       pipeline.getHasSubnodesSet().add(reducer);\r
-                       newPipeline.getHasControlPointSet().add(offsetControlPoint);\r
-                       graph.commitChanges(CommitMessage.CHANGE_MESSAGE);\r
-                       \r
-                       graph.commitTransaction(CommitMessage.TRANSACTION_MESSAGE);\r
-                       \r
-                       */\r
-               \r
-               \r
-                \r
-       }\r
-       \r
-       /**\r
-        * Returns direction of a nozzle\r
-        * @param nozzle\r
-        * @return\r
-        */\r
-       public static Vector3d getNozzleDirection(IEntity nozzle) {\r
-               return ControlPointTools.getNozzleDirection(nozzle.getSingleRelatedObject(ProcessResource.g3dResource.HasWorldOrientation));\r
-       }\r
-       \r
-       /**\r
-        * Returns true if a nozzle is not connected to a pipe\r
-        * @param nozzle\r
-        * @return\r
-        */\r
-       public static boolean isFreeNozzle(IEntity nozzle) {\r
-               assert (nozzle.isInstanceOf(ProcessResource.plant3Dresource.Nozzle));\r
-               IEntity pcp = nozzle.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint);\r
-               IEntity next = pcp.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasNext);\r
-               IEntity previous = pcp.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.HasPrevious);\r
-               if (next == null && previous == null) {\r
-                       assert (pcp.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.ControlPointOfPipeRun) == null);\r
-                       return true;\r
-               }\r
-               assert (pcp.getAtMostOneRelatedObject(ProcessResource.plant3Dresource.ControlPointOfPipeRun) != null);\r
-               return false;\r
-       }\r
-       \r
-       public static void getInlineComponentEnds(IEntity inlineComponent, Point3d p1, Point3d p2) {\r
-               assert(inlineComponent.isInstanceOf(ProcessResource.plant3Dresource.InlineComponent));\r
-               ControlPointTools.getInlineControlPointEnds(inlineComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint), p1, p2);\r
-       }\r
-       \r
-       public static void getInlineComponentEnds(IEntity inlineComponent, Point3d p1, Point3d p2, Vector3d dir) {\r
-               assert(inlineComponent.isInstanceOf(ProcessResource.plant3Dresource.InlineComponent));\r
-               ControlPointTools.getInlineControlPointEnds(inlineComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint), p1, p2,dir);\r
-       }\r
-       \r
-       public static void getInlineComponentEnds(IEntity inlineComponent, Point3d center, Point3d p1, Point3d p2, Vector3d dir) {\r
-               assert(inlineComponent.isInstanceOf(ProcessResource.plant3Dresource.InlineComponent));\r
-               ControlPointTools.getInlineControlPointEnds(inlineComponent.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint), center, p1, p2,dir);\r
-       }\r
-       \r
-       public static void removePipeRun(PipeRun pipeRun) {\r
-       if (DEBUG) System.out.println("PipingTools.removePipeRun() " + pipeRun.getResource());\r
-       G3DNode parent = pipeRun.getParent();\r
-       if (parent != null)\r
-               parent.getChild().remove(pipeRun);\r
-\r
-    }\r
-       /**\r
-        * Liks piperun's specs to nozzle's specs\r
-        * @param nozzle\r
-        * @param piperun\r
-        */\r
-       public static void linkNozzleAndPipeRun(IEntity nozzle, IEntity piperun) {\r
-               assert(nozzle.isInstanceOf(ProcessResource.plant3Dresource.Nozzle));\r
-               assert(piperun.isInstanceOf(ProcessResource.plant3Dresource.PipeRun));\r
-               IEntity diam = piperun.getSingleRelatedObject(ProcessResource.plant3Dresource.HasPipeDiameter); \r
-       \r
-       piperun.addStatement(ProcessResource.plant3Dresource.HasControlPoints, nozzle.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint));\r
-       setStatement(nozzle, ProcessResource.plant3Dresource.HasPipeDiameter, diam);\r
-       }\r
-       \r
-       /**\r
-        * Unlinks piperun's specs from nozzle's specs.\r
-        * @param nozzle\r
-        * @param piperun\r
-        */\r
-       public static void unlinkNozzleAndPiperun(IEntity nozzle, IEntity piperun) {\r
-               assert(nozzle.isInstanceOf(ProcessResource.plant3Dresource.Nozzle));\r
-               assert(piperun.isInstanceOf(ProcessResource.plant3Dresource.PipeRun));\r
-               \r
-               piperun.removeStatement(ProcessResource.plant3Dresource.HasControlPoints, nozzle.getSingleRelatedObject(ProcessResource.plant3Dresource.HasControlPoint));      \r
-               // get current diameter\r
-               double diam = nozzle.getSingleRelatedScalarDouble(ProcessResource.plant3Dresource.HasPipeDiameter);\r
-               // remove link to shared diameter resource\r
-               nozzle.removeRelatedStatements(ProcessResource.plant3Dresource.HasPipeDiameter);\r
-               // create new reource for diameter\r
-               nozzle.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasPipeDiameter, diam);\r
-       }\r
-       \r
-       private static void setStatement(IEntity subject, Resource relation, IEntity object) {\r
-       subject.removeRelatedStatements(relation);\r
-       subject.addStatement(relation, object);\r
-    }\r
-       \r
-       public static void getInlineMovement(InlineComponent ic, Point3d start, Point3d end) {\r
-               PipeControlPoint pcp = ic.getControlPoint();\r
-               ControlPointTools.getInlineMovement(pcp, start, end);\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigureAnimationDialog.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigureAnimationDialog.java
deleted file mode 100644 (file)
index de5e5aa..0000000
+++ /dev/null
@@ -1,478 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.dialogs;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
-import java.util.Map;\r
-import java.util.Set;\r
-import java.util.TreeMap;\r
-import java.util.Map.Entry;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.events.SelectionListener;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.List;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.g2d.stubs.anim.Animation;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.viewpoints.TraversalPath;\r
-import org.simantics.proconf.browsing.GraphExplorer;\r
-import org.simantics.proconf.g3d.animation.Animatable;\r
-import org.simantics.proconf.g3d.animation.AnimationSystem;\r
-import org.simantics.proconf.g3d.animation.ResourceAnimationController;\r
-import org.simantics.proconf.g3d.animation.ScaledResourceAnimationController;\r
-import org.simantics.proconf.g3d.base.ScenegraphAdapter;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DModel;\r
-import org.simantics.proconf.g3d.tools.OEPathSelectionListener;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PathUtils;\r
-\r
-public class ConfigureAnimationDialog extends Dialog {\r
-       Session session;\r
-       List typeList;\r
-       List animationList;\r
-       java.util.List<Resource> nodes;\r
-       Set<Resource> models;\r
-       \r
-       private Composite oeLabelComposite;\r
-       //private Control viewpointControl;\r
-       private Composite oeComposite;\r
-       private GraphExplorer oe;\r
-       private Map<Resource,Resource> instanceModelMap = new HashMap<Resource, Resource>();\r
-       private ScenegraphAdapter adapter;\r
-       \r
-       private Button applyAnimationButton;\r
-       \r
-       Resource selectedType;\r
-       Resource sampleInstance;\r
-       Resource sampleSource;\r
-       java.util.List<Resource> samplePath;\r
-       AnimationSystem animationSystem;\r
-       \r
-       Button scaleButton;\r
-       Text minText;\r
-       Text maxText;\r
-       \r
-       public ConfigureAnimationDialog(Shell parentShell, Session session, java.util.List<Resource> nodes, ScenegraphAdapter adapter, AnimationSystem animationSystem) {\r
-               super(parentShell);\r
-               this.session = session;\r
-               this.nodes = nodes;\r
-               models = new HashSet<Resource>();\r
-               session.syncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               for (Resource n : ConfigureAnimationDialog.this.nodes) {\r
-                                       IEntity t = EntityFactory.create(g,n);\r
-                                       Collection<IEntity> r = t.getRelatedObjects(ProcessResource.plant3Dresource.HasGraphics);\r
-                                       if (r.size() == 1) {\r
-                                               IEntity model = r.iterator().next();\r
-                                               if (model.isInstanceOf(ProcessResource.g3dResource.G3DModel)) {\r
-                                                       models.add(model.getResource());\r
-                                                       instanceModelMap.put(n, model.getResource());\r
-                                               } else {\r
-                                                       throw new RuntimeException("Expected G3DModel, got something else " + model);\r
-                                               }\r
-                                       } else {\r
-                                               ErrorLogger.getDefault().logWarning("Got node without a model", null);\r
-                                       }\r
-                               }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-               \r
-               this.adapter = adapter;\r
-               this.animationSystem = animationSystem;\r
-               int shellStyle = getShellStyle();\r
-               setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);\r
-       }\r
-       \r
-       @Override\r
-    protected void configureShell(Shell newShell) {  \r
-        super.configureShell(newShell);\r
-        newShell.setText("Configure animations");\r
-        \r
-    }\r
-       \r
-       protected Control createDialogArea(Composite parent) {\r
-        Composite composite = (Composite) super.createDialogArea(parent);\r
-        GridLayout layout = new GridLayout(4,true);\r
-               layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);\r
-               layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);\r
-               layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);\r
-               layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);\r
-               composite.setLayout(layout);\r
-               \r
-               Label label = new Label(composite, SWT.WRAP);\r
-        label.setText("Types");\r
-//        GridData data = new GridData(GridData.GRAB_HORIZONTAL\r
-//                | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
-//                | GridData.VERTICAL_ALIGN_BEGINNING);\r
-        GridData data = new GridData(GridData.CENTER,GridData.FILL,true,false,1,1);\r
-        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        label = new Label(composite, SWT.WRAP);\r
-        label.setText("Models");\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        label = new Label(composite, SWT.WRAP);\r
-        label.setText("Animations");\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        oeLabelComposite = new Composite(composite,SWT.NONE);\r
-        data = new GridData(GridData.CENTER,GridData.FILL,true,false,1,1);\r
-        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-        \r
-        oeLabelComposite.setLayoutData(data);\r
-        oeLabelComposite.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-        //label = new Label(composite, SWT.WRAP);\r
-        label = new Label(oeLabelComposite, SWT.WRAP);\r
-        label.setText("Animation source");\r
-//        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        typeList = new List(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY | SWT.V_SCROLL);\r
-        typeList.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));\r
-//        modelList = new List(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY | SWT.V_SCROLL);\r
-//        modelList.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));\r
-        animationList = new List(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY | SWT.V_SCROLL);\r
-        animationList.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));\r
-        oeComposite = new Composite(composite,SWT.BORDER);\r
-        oeComposite.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));\r
-        layout = new GridLayout();\r
-        layout.marginWidth = 0;\r
-        layout.marginHeight = 0;\r
-        oeComposite.setLayout(layout);\r
-        \r
-        session.asyncRead(new GraphRequestAdapter() {\r
-               TreeMap<String, Resource> sorter;\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       Collection<Resource> types = getTypes(g,nodes);\r
-                       \r
-                        sorter = new TreeMap<String, Resource>();\r
-                       for (Resource type : types) {\r
-                               IEntity t = EntityFactory.create(g,type);\r
-                               if (t.getRelatedObjects(ProcessResource.plant3Dresource.HasGraphics).size() > 0) {\r
-                                       String key = t.getName();\r
-                               if (key.equals("")) key = "ERROR (" + type.getResourceId() + ")";\r
-                               sorter.put(key, type);\r
-                               }\r
-                       }\r
-                       \r
-                       \r
-                       \r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-               \r
-               @Override\r
-               public void requestCompleted(GraphRequestStatus status) {\r
-                       getShell().getDisplay().asyncExec(new Runnable(){\r
-                               @Override\r
-                               public void run() {\r
-                                       for (Entry<String, Resource> e : sorter.entrySet()) {\r
-                           typeList.add(e.getKey());\r
-                           typeList.setData(e.getKey(), e.getValue());\r
-                       }\r
-                               }\r
-                       });\r
-               }\r
-        });\r
-       \r
-        typeList.addSelectionListener(new SelectionListener() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-               session.asyncRead(new GraphRequestAdapter(){\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               String key = typeList.getItem(typeList.getSelectionIndex());\r
-                        selectType(EntityFactory.create(g,(Resource) typeList.getData(key)));\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-                \r
-            }\r
-            public void widgetDefaultSelected(SelectionEvent e) {\r
-            }\r
-        });\r
-        \r
-//        modelList.addSelectionListener(new SelectionListener() {\r
-//            public void widgetSelected(SelectionEvent e) {\r
-//             if (modelList.getSelectionIndex() < 0 || modelList.getSelectionIndex() >= modelList.getItemCount())\r
-//                     return;\r
-//                String key = modelList.getItem(modelList.getSelectionIndex());\r
-//                selectModel((GraphicsModel) modelList.getData(key));\r
-//            }\r
-//            public void widgetDefaultSelected(SelectionEvent e) {\r
-//            }\r
-//        });\r
-        \r
-        Composite buttonComposite = new Composite(composite,SWT.NONE);\r
-        buttonComposite.setLayoutData(new GridData(GridData.END,GridData.FILL,true,false,4,1));\r
-        buttonComposite.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-        scaleButton = new Button(buttonComposite,SWT.CHECK);\r
-        scaleButton.setText("Scaling");\r
-        scaleButton.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       if (scaleButton.getSelection()) {\r
-                               minText.setEnabled(true);\r
-                               maxText.setEnabled(true);\r
-                       } else {\r
-                               minText.setEnabled(false);\r
-                               maxText.setEnabled(false);\r
-                       }\r
-               }\r
-        });\r
-        minText = new Text(buttonComposite,SWT.SINGLE|SWT.BORDER);\r
-        minText.setText("0.0");\r
-        \r
-        maxText = new Text(buttonComposite,SWT.SINGLE|SWT.BORDER);\r
-        maxText.setText("1.0");\r
-        \r
-        minText.setEnabled(false);\r
-               maxText.setEnabled(false);\r
-        \r
-        applyAnimationButton = new Button(buttonComposite,SWT.PUSH);\r
-        applyAnimationButton.setText("Apply animation");\r
-        applyAnimationButton.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       session.asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       applyAnimation(g);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-                       \r
-               }\r
-        });\r
-        return composite;\r
-       }\r
-       \r
-       /**\r
-        * Updates type selection:\r
-        * Finds all GraphicsModels that are connected to instances of selected type with HasGraphics-relation\r
-        * and lists them in modelList.\r
-        *\r
-        * @param resource\r
-        */\r
-       private void selectType(IEntity resource) {\r
-               Graph g = resource.getGraph();\r
-               selectedType = resource.getResource();\r
-               //modelList.removeAll();\r
-               animationList.removeAll();\r
-               \r
-               Collection<IEntity> model = resource.getRelatedObjects(ProcessResource.plant3Dresource.HasGraphics);\r
-               if (model.size() != 1)\r
-                       throw new RuntimeException("Type " + resource + " does not have a model");\r
-        \r
-        if (oe != null) {\r
-               oe.dispose();   \r
-        }\r
-        sampleInstance = null;\r
-        sampleSource = null;\r
-        for (Resource n : nodes) {\r
-               IEntity t = EntityFactory.create(g,n);\r
-               if (t.isInstanceOf(resource.getResource())) {\r
-                       sampleInstance = n;\r
-                       break;\r
-               }\r
-        }\r
-        if (sampleInstance != null) {\r
-//             oe = new OntologyExplorer("Animation Source",this.getShell(), new OntologyEditorInput(sampleInstance.getId()));\r
-//             if(viewpointControl != null && !viewpointControl.isDisposed()) {\r
-//                     viewpointControl.dispose();\r
-//             }\r
-//             viewpointControl = oe.getControl(oeLabelComposite, 1, OntologyExplorer.ViewpointSelector, SWT.NONE);\r
-//             Control c = oe.getControl(oeComposite, 1, OntologyExplorer.OntologyTree, SWT.SINGLE);\r
-//             c.setLayoutData(new GridData(GridData.FILL_BOTH));\r
-//             oe.init(null, ViewpointUtils.getModelledHandler(oe.getGraph(), Builtins.DefaultViewpointId), null, ViewLabelProviderDecorationSettings.DEFAULT, new MenuAboutToShowAction(), new NullAdditionAction(), false);\r
-//             //oeComposite.layout(true, true);\r
-//             oe.setSelectionScheme(new SourceSelectionScheme(oe));\r
-//             //oeLabelComposite.layout(true, true);\r
-//             oeComposite.getParent().getParent().layout(true,true);\r
-        \r
-               oe = new GraphExplorer(oeComposite,SWT.SINGLE);\r
-               oe.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));\r
-               oe.getViewer().addPostSelectionChangedListener(new OEPathSelectionListener(){\r
-                       @Override\r
-                       protected void pathSelectionUpdated(java.util.List<TraversalPath> paths) {\r
-                               if (paths.size() == 0) {\r
-                       //selectSource(null);\r
-                   } else {\r
-                       final TraversalPath path = paths.iterator().next();\r
-                       session.asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       selectSource(g,path);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-                       \r
-                   }   \r
-                       }\r
-               });\r
-        }\r
-               \r
-//        modelList.redraw();\r
-//        animationList.redraw();\r
-        selectModel(new G3DModel(model.iterator().next()));\r
-       }\r
-       \r
-       /**\r
-        * Selects model and shows model's animations in animationList\r
-        * @param model\r
-        */\r
-       private void selectModel(G3DModel model) {\r
-               animationList.removeAll();\r
-               \r
-               TreeMap<String, Animation> sorter = new TreeMap<String, Animation>();\r
-        \r
-               Collection<Animation> animations = model.getAnimation();\r
-               for (Animation a : animations) {\r
-                       String key = a.getName();\r
-               if (key.equals("")) key = "ERROR (" + a.getResource().getResourceId() + ")";\r
-               sorter.put(key, a);\r
-               }\r
-               \r
-               final TreeMap<String, Animation> fa = sorter;\r
-               \r
-               getShell().getDisplay().asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               for (Entry<String, Animation> e : fa.entrySet()) {\r
-                           animationList.add(e.getKey());\r
-                           animationList.setData(e.getKey(), e.getValue());\r
-                       }\r
-                               animationList.redraw();\r
-                               \r
-                       }\r
-               });\r
-               \r
-       }\r
-       \r
-       private void selectSource(Graph graph,TraversalPath path) {\r
-               //System.out.println(sampleInstance + " " + resource);\r
-               \r
-               if (path == null) {\r
-                       sampleSource = null;\r
-                       return;\r
-               } \r
-               IEntity t = EntityFactory.create(graph,path.getResource());\r
-               if (!t.isInstanceOf(ProcessResource.builtins.Double)) {\r
-                       sampleSource = null;\r
-               } else {\r
-                       sampleSource = path.getResource();\r
-                       samplePath = new ArrayList<Resource>();\r
-                       PathUtils.createPath(samplePath, path ,sampleInstance,sampleSource,oe);\r
-               }\r
-       }\r
-       \r
-       \r
-       \r
-       private void applyAnimation(Graph graph) {\r
-               int animationIndex = animationList.getSelectionIndex();\r
-               if (sampleInstance == null || sampleSource == null || samplePath == null || animationIndex == -1) {\r
-                       throw new RuntimeException("Missing required selections");\r
-                       //return;\r
-               }\r
-               \r
-               java.util.List<Resource> instances = new ArrayList<Resource>();\r
-               java.util.List<Resource> sources = new ArrayList<Resource>();\r
-               browseOthers(graph,instances, sources);\r
-               instances.add(sampleInstance);\r
-               sources.add(sampleSource);\r
-               \r
-               for (int i = 0; i < instances.size(); i++) {\r
-                       IGraphicsNode n = adapter.getNode(instances.get(i));\r
-                       if (!(n instanceof Animatable)) {\r
-                               //throw new RuntimeException("Node is not animatable");\r
-                               continue;\r
-                       }\r
-\r
-                       Animatable animatable = (Animatable) n;\r
-                       Animation a = (Animation) animationList.getData(animationList.getItem(animationIndex));\r
-                       if (!animatable.setAnimation(graph,a.getResource())) {\r
-                               //throw new RuntimeException("Cannot set animation");\r
-                               continue;\r
-                       }\r
-                       ResourceAnimationController c;\r
-                       if (scaleButton.getSelection()) {\r
-                               c = new ScaledResourceAnimationController(sources.get(i),Double.parseDouble(minText.getText()),Double.parseDouble(maxText.getText()));\r
-                       } else {\r
-                               c = new ResourceAnimationController(sources.get(i));\r
-                       }\r
-                       c.addAnimatable(animatable);\r
-                       animationSystem.add(c);\r
-               }\r
-               \r
-       }\r
-       \r
-       private void browseOthers(Graph g, java.util.List<Resource> instances,java.util.List<Resource> sources) {\r
-               java.util.List<Resource> possibleInstances = new ArrayList<Resource>();\r
-               for (Resource n : nodes) {\r
-                       IEntity t = EntityFactory.create(g,n);\r
-                       if (t.isInstanceOf(selectedType) && !n.equals(sampleInstance)) {\r
-                               possibleInstances.add(n.getResource());\r
-                       }\r
-               }\r
-               \r
-               for (Resource instance : possibleInstances) {\r
-                       IEntity source = PathUtils.findSimilar(samplePath,EntityFactory.create(g,instance));\r
-                       if (source != null) {\r
-                               instances.add(instance);\r
-                               sources.add(source.getResource());\r
-                       } else {\r
-                               ErrorLogger.getDefault().logWarning("Cannot find animation source for " + instance, null);\r
-                       }\r
-               }\r
-       }\r
-       \r
-       \r
-       private Collection<Resource> getTypes(Graph g, java.util.List<Resource> instances) {\r
-               Set<Resource> types = new HashSet<Resource>();\r
-               for (Resource r : instances) {\r
-                       IEntity t = EntityFactory.create(g,r);\r
-                       Collection<IEntity> tTypes = t.getTypes();\r
-                       for (IEntity type : tTypes)\r
-                               types.add(type.getResource());\r
-               }\r
-               return types;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigureMonitorDialog.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigureMonitorDialog.java
deleted file mode 100644 (file)
index a771976..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.dialogs;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-import java.util.TreeMap;\r
-import java.util.Map.Entry;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.events.SelectionListener;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.List;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.viewpoints.TraversalPath;\r
-import org.simantics.proconf.browsing.GraphExplorer;\r
-import org.simantics.proconf.g3d.stubs.G3DModel;\r
-import org.simantics.proconf.g3d.tools.OEPathSelectionListener;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PathUtils;\r
-import fi.vtt.simantics.processeditor.monitors.PathContainer;\r
-\r
-public class ConfigureMonitorDialog extends Dialog {\r
-       Session session;\r
-       List typeList;\r
-       java.util.List<Resource> nodes;\r
-\r
-       \r
-       private Composite oeLabelComposite;\r
-       //private Control viewpointControl;\r
-       private Composite oeComposite;\r
-       private GraphExplorer oe;\r
-       \r
-       private Button applyAnimationButton;\r
-       \r
-       Resource selectedType;\r
-       Resource sampleInstance;\r
-       java.util.List<Resource> sampleSource;\r
-       java.util.List<java.util.List<Resource>> samplePath;\r
-\r
-       \r
-       public ConfigureMonitorDialog(Shell parentShell, Session session, java.util.List<Resource> nodes) {\r
-               super(parentShell);\r
-               this.nodes = nodes;\r
-               this.session = session;\r
-               int shellStyle = getShellStyle();\r
-               setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);\r
-       }\r
-       \r
-       @Override\r
-    protected void configureShell(Shell newShell) {  \r
-        super.configureShell(newShell);\r
-        newShell.setText("Configure monitors");\r
-        \r
-    }\r
-       \r
-       protected Control createDialogArea(Composite parent) {\r
-        Composite composite = (Composite) super.createDialogArea(parent);\r
-        GridLayout layout = new GridLayout(2,true);\r
-               layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);\r
-               layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);\r
-               layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);\r
-               layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);\r
-               composite.setLayout(layout);\r
-               \r
-               Label label = new Label(composite, SWT.WRAP);\r
-        label.setText("Types");\r
-        GridData data = new GridData(GridData.CENTER,GridData.FILL,true,false,1,1);\r
-        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        oeLabelComposite = new Composite(composite,SWT.NONE);\r
-        oeLabelComposite.setLayoutData(data);\r
-        oeLabelComposite.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-        //label = new Label(composite, SWT.WRAP);\r
-        label = new Label(oeLabelComposite, SWT.WRAP);\r
-        label.setText("Monitor source");\r
-//        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        typeList = new List(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY | SWT.V_SCROLL);\r
-        typeList.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));\r
-        \r
-        oeComposite = new Composite(composite,SWT.BORDER);\r
-        oeComposite.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));\r
-        layout = new GridLayout();\r
-        layout.marginWidth = 0;\r
-        layout.marginHeight = 0;\r
-        oeComposite.setLayout(layout);\r
-        session.asyncRead(new GraphRequestAdapter() {\r
-               TreeMap<String, Resource> sorter;\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       Collection<Resource> types = getTypes(g,nodes);\r
-                \r
-                sorter = new TreeMap<String, Resource>();\r
-                for (Resource type : types) {\r
-                       IEntity t = EntityFactory.create(g, type);\r
-                    String key = t.getName();\r
-                    if (key.equals("")) key = "ERROR (" + type.getResourceId() + ")";\r
-                    sorter.put(key, type);\r
-                }\r
-                \r
-               \r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-               \r
-               @Override\r
-               public void requestCompleted(GraphRequestStatus status) {\r
-                       getShell().getDisplay().asyncExec(new Runnable() {\r
-                               @Override\r
-                               public void run() {\r
-                                        for (Entry<String, Resource> e : sorter.entrySet()) {    \r
-                               typeList.add(e.getKey());\r
-                               typeList.setData(e.getKey(), e.getValue());\r
-                                        }\r
-                               }\r
-                       });\r
-               }\r
-        });\r
-        \r
-        typeList.addSelectionListener(new SelectionListener() {\r
-            public void widgetSelected(SelectionEvent e) {\r
-               session.asyncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                String key = typeList.getItem(typeList.getSelectionIndex());\r
-                         selectType(EntityFactory.create(g,(Resource) typeList.getData(key)));\r
-                                return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-               \r
-            }\r
-            public void widgetDefaultSelected(SelectionEvent e) {\r
-            }\r
-        });\r
-        \r
-     \r
-        \r
-        Composite buttonComposite = new Composite(composite,SWT.NONE);\r
-        buttonComposite.setLayoutData(new GridData(GridData.END,GridData.FILL,true,false,4,1));\r
-        buttonComposite.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-        \r
-        \r
-        applyAnimationButton = new Button(buttonComposite,SWT.PUSH);\r
-        applyAnimationButton.setText("Apply monitor configuration");\r
-        applyAnimationButton.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       applyAnimation();\r
-               }\r
-        });\r
-        return composite;\r
-       }\r
-       \r
-       /**\r
-        * Updates type selection:\r
-        * Finds all GraphicsModels that are connected to instances of selected type with HasGraphics-relation\r
-        * and lists them in modelList.\r
-        *\r
-        * @param resource\r
-        */\r
-       private void selectType(IEntity resource) {\r
-               selectedType = resource.getResource();\r
-               \r
-               TreeMap<String, G3DModel> sorter = new TreeMap<String, G3DModel>();\r
-               \r
-               Collection<IEntity> models = resource.getRelatedObjects(ProcessResource.plant3Dresource.HasGraphics);\r
-        for (IEntity model : models) {\r
-               \r
-                       String key = model.getName();\r
-               if (key.equals("")) key = "ERROR (" + model.getResource().getResourceId() + ")";\r
-               sorter.put(key, new G3DModel(model));\r
-        }\r
-        \r
-        if (oe != null) {\r
-               oe.dispose();   \r
-        }\r
-        sampleInstance = null;\r
-        sampleSource = null;\r
-        for (Resource n : nodes) {\r
-               IEntity t = EntityFactory.create(resource.getGraph(),n);\r
-               if (t.isInstanceOf(resource.getResource())) {\r
-                       sampleInstance = n;\r
-                       break;\r
-               }\r
-        }\r
-        if (sampleInstance != null) {\r
-//             oe = new OntologyExplorer("Animation Source",this.getShell(), new OntologyEditorInput(sampleInstance.getId()));\r
-//             if(viewpointControl != null && !viewpointControl.isDisposed()) {\r
-//                     viewpointControl.dispose();\r
-//             }\r
-//             viewpointControl = oe.getControl(oeLabelComposite, 1, OntologyExplorer.ViewpointSelector, SWT.NONE);\r
-//             Control c = oe.getControl(oeComposite, 1, OntologyExplorer.OntologyTree, SWT.MULTI);\r
-//             c.setLayoutData(new GridData(GridData.FILL_BOTH));\r
-//             oe.init(null, ViewpointUtils.getModelledHandler(oe.getGraph(), Builtins.DefaultViewpointId), null, ViewLabelProviderDecorationSettings.DEFAULT, new MenuAboutToShowAction(), new NullAdditionAction(), false);\r
-//             oe.setSelectionScheme(new SourceSelectionScheme(oe));\r
-//             oeComposite.getParent().layout(true,true);\r
-               oe = new GraphExplorer(oeComposite,SWT.MULTI);\r
-               oe.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));\r
-               oe.getViewer().addPostSelectionChangedListener(new OEPathSelectionListener(){\r
-                       @Override\r
-                       protected void pathSelectionUpdated(java.util.List<TraversalPath> paths) {\r
-                               if (paths.size() == 0) {\r
-                       //selectSource(null);\r
-                   } else {\r
-                       final java.util.List<TraversalPath> ps = paths;\r
-                       session.asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       selectSource(g,ps);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-                       \r
-                   }\r
-                               \r
-                       }\r
-               });\r
-        }\r
-               \r
-       }\r
-       \r
-       \r
-       \r
-       private void selectSource(Graph graph, java.util.List<TraversalPath> resources) {\r
-               if (resources == null) {\r
-                       sampleSource = null;\r
-               }\r
-               for (TraversalPath p : resources) {\r
-                       IEntity t = EntityFactory.create(graph, p.getResource());\r
-                       if (!t.isInstanceOf(ProcessResource.builtins.Double)) {\r
-                               sampleSource = null;\r
-                               return;\r
-                       }\r
-               }\r
-               sampleSource = new ArrayList<Resource>();\r
-               for (TraversalPath p : resources)\r
-                       sampleSource.add(p.getResource());\r
-               \r
-               samplePath = new ArrayList<java.util.List<Resource>>();\r
-               for (int i = 0; i < sampleSource.size(); i++) {\r
-                       TraversalPath tpath = resources.get(i);\r
-                       java.util.List<Resource> path = new ArrayList<Resource>();\r
-                       PathUtils.createPath(path, tpath,sampleInstance,sampleSource.get(i),oe);\r
-                       samplePath.add(path);\r
-               }       \r
-               \r
-       }\r
-       \r
-       private void applyAnimation() {\r
-               \r
-               if (sampleInstance == null || sampleSource == null || samplePath == null ) {\r
-                       throw new RuntimeException("Missing required selections");\r
-                       //return;\r
-               }\r
-\r
-               PathContainer.getInstance().clearPaths(selectedType);\r
-               for (java.util.List<Resource> s : samplePath) {\r
-                       PathContainer.getInstance().addPath(selectedType, s);\r
-               }\r
-       }\r
-       \r
-\r
-       \r
-\r
-\r
-       private Collection<Resource> getTypes(Graph g, java.util.List<Resource> instances) {\r
-               Set<Resource> types = new HashSet<Resource>();\r
-               for (Resource r : instances) {\r
-                       IEntity t = EntityFactory.create(g,r);\r
-                       Collection<IEntity> tTypes = t.getTypes();\r
-                       for (IEntity type : tTypes)\r
-                               types.add(type.getResource());\r
-               }\r
-               return types;\r
-       }\r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigurePipelineAnimationDialog.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/ConfigurePipelineAnimationDialog.java
deleted file mode 100644 (file)
index 2735a69..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.dialogs;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.viewpoints.TraversalPath;\r
-import org.simantics.proconf.browsing.GraphExplorer;\r
-import org.simantics.proconf.g3d.animation.AnimationSystem;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.tools.OEPathSelectionListener;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.animations.ResourcePipeAnimationController;\r
-import fi.vtt.simantics.processeditor.common.PathUtils;\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-\r
-\r
-public class ConfigurePipelineAnimationDialog extends Dialog {\r
-       Session session;\r
-       java.util.List<Resource> nodes;\r
-       \r
-       //private Control viewpointControl1;\r
-       private GraphExplorer oe1;\r
-       \r
-       \r
-       //private Control viewpointControl2;\r
-       private GraphExplorer oe2;\r
-       \r
-       JmeRenderingComponent component;\r
-       \r
-       private Button applyAnimationButton;\r
-       \r
-       Resource sampleInstance;\r
-       Resource sampleSource1;\r
-       Resource sampleSource2;\r
-       java.util.List<Resource> samplePath1;\r
-       java.util.List<Resource> samplePath2;\r
-       AnimationSystem animationSystem;\r
-       \r
-       Button scaleButton1;\r
-       Text minText1;\r
-       Text maxText1;\r
-       \r
-       Button scaleButton2;\r
-       Text minText2;\r
-       Text maxText2;\r
-       \r
-       public ConfigurePipelineAnimationDialog(Shell parentShell, Session session,java.util.List<Resource> nodes, JmeRenderingComponent component, AnimationSystem animationSystem) {\r
-               super(parentShell);\r
-               this.session = session;\r
-               this.nodes = nodes;\r
-               this.component = component;\r
-               this.animationSystem = animationSystem;\r
-               int shellStyle = getShellStyle();\r
-               setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);\r
-       }\r
-       \r
-       @Override\r
-    protected void configureShell(Shell newShell) {  \r
-        super.configureShell(newShell);\r
-        newShell.setText("Configure pipeline animations");\r
-        \r
-    }\r
-       \r
-       protected Control createDialogArea(Composite parent) {\r
-        Composite composite = (Composite) super.createDialogArea(parent);\r
-        GridLayout layout = new GridLayout(2,true);\r
-               layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);\r
-               layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);\r
-               layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);\r
-               layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);\r
-               composite.setLayout(layout);\r
-               \r
-               Label label = new Label(composite, SWT.WRAP);\r
-        label.setText("Color Change");\r
-        GridData data = new GridData(GridData.CENTER,GridData.FILL,true,false,1,1);\r
-        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        label = new Label(composite, SWT.WRAP);\r
-        label.setText("Particle velocity");\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        \r
-        sampleInstance = nodes.get(0).getResource();\r
-        \r
-//      oe1 = new OntologyExplorer("Animation Source",this.getShell(), new OntologyEditorInput(sampleInstance.getId()));\r
-//     viewpointControl1 = oe1.getControl(composite, 1, OntologyExplorer.ViewpointSelector, SWT.NONE);\r
-//     \r
-//     oe2 = new OntologyExplorer("Animation Source",this.getShell(), new OntologyEditorInput(sampleInstance.getId()));\r
-//     viewpointControl2 = oe2.getControl(composite, 1, OntologyExplorer.ViewpointSelector, SWT.NONE);\r
-//     \r
-//      Control c = oe1.getControl(composite, 1, OntologyExplorer.OntologyTree, SWT.SINGLE|SWT.BORDER);\r
-//     c.setLayoutData(new GridData(GridData.FILL_BOTH));\r
-//     \r
-//     c = oe2.getControl(composite, 1, OntologyExplorer.OntologyTree, SWT.SINGLE|SWT.BORDER);\r
-//     c.setLayoutData(new GridData(GridData.FILL_BOTH));\r
-//     \r
-//      oe1.init(null, ViewpointUtils.getModelledHandler(oe1.getGraph(), Builtins.DefaultViewpointId), null, ViewLabelProviderDecorationSettings.DEFAULT, new MenuAboutToShowAction(), new NullAdditionAction(), false);\r
-//     oe1.setSelectionScheme(new SourceSelectionScheme(oe1));\r
-//     \r
-//     oe2.init(null, ViewpointUtils.getModelledHandler(oe1.getGraph(), Builtins.DefaultViewpointId), null, ViewLabelProviderDecorationSettings.DEFAULT, new MenuAboutToShowAction(), new NullAdditionAction(), false);\r
-//     oe2.setSelectionScheme(new SourceSelectionScheme(oe2));\r
-       \r
-        oe1 = new GraphExplorer(composite,SWT.SINGLE);\r
-        oe1.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));\r
-        \r
-        oe2 = new GraphExplorer(composite,SWT.SINGLE);\r
-        oe2.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));\r
-        \r
-       oe1.getViewer().addPostSelectionChangedListener(new OEPathListener(oe1));\r
-       oe2.getViewer().addPostSelectionChangedListener(new OEPathListener(oe2));\r
-       \r
-       \r
-       Composite buttonComposite = new Composite(composite,SWT.NONE);\r
-        buttonComposite.setLayoutData(new GridData(GridData.END,GridData.FILL,true,false,1,1));\r
-        buttonComposite.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-        \r
-        scaleButton1 = new Button(buttonComposite,SWT.CHECK);\r
-        scaleButton1.setText("Scaling");\r
-        scaleButton1.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       if (scaleButton1.getSelection()) {\r
-                               minText1.setEnabled(true);\r
-                               maxText1.setEnabled(true);\r
-                       } else {\r
-                               minText1.setEnabled(false);\r
-                               maxText1.setEnabled(false);\r
-                       }\r
-               }\r
-        });\r
-        minText1 = new Text(buttonComposite,SWT.SINGLE|SWT.BORDER);\r
-        minText1.setText("0.0");\r
-        \r
-        maxText1 = new Text(buttonComposite,SWT.SINGLE|SWT.BORDER);\r
-        maxText1.setText("1.0");\r
-        \r
-        minText1.setEnabled(false);\r
-               maxText1.setEnabled(false);\r
-               \r
-               buttonComposite = new Composite(composite,SWT.NONE);\r
-        buttonComposite.setLayoutData(new GridData(GridData.END,GridData.FILL,true,false,1,1));\r
-        buttonComposite.setLayout(new FillLayout(SWT.HORIZONTAL));\r
-        \r
-               scaleButton2 = new Button(buttonComposite,SWT.CHECK);\r
-        scaleButton2.setText("Scaling");\r
-        scaleButton2.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       if (scaleButton2.getSelection()) {\r
-                               minText2.setEnabled(true);\r
-                               maxText2.setEnabled(true);\r
-                       } else {\r
-                               minText2.setEnabled(false);\r
-                               maxText2.setEnabled(false);\r
-                       }\r
-               }\r
-        });\r
-        minText2 = new Text(buttonComposite,SWT.SINGLE|SWT.BORDER);\r
-        minText2.setText("0.0");\r
-        \r
-        maxText2 = new Text(buttonComposite,SWT.SINGLE|SWT.BORDER);\r
-        maxText2.setText("1.0");\r
-        \r
-        minText2.setEnabled(false);\r
-               maxText2.setEnabled(false);\r
-       \r
-               \r
-               applyAnimationButton = new Button(composite,SWT.PUSH);\r
-        applyAnimationButton.setText("Apply animation");\r
-        applyAnimationButton.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       session.syncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       applyAnimation(g);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-                       \r
-               }\r
-        });\r
-        applyAnimationButton.setLayoutData(new GridData(GridData.END,GridData.FILL,true,false,2,1));\r
-        return composite;\r
-       }\r
-       \r
-       private class OEPathListener extends OEPathSelectionListener {\r
-               GraphExplorer oe;\r
-               \r
-               public OEPathListener(GraphExplorer oe) {\r
-                       this.oe = oe;\r
-               }\r
-\r
-        protected void pathSelectionUpdated(List<TraversalPath> paths) {\r
-            if (paths.size() == 0) {\r
-                //selectSource(null);\r
-            } else {\r
-                selectSource(oe,paths.get(0));\r
-            }\r
-        }\r
-       }\r
-       \r
-       private void selectSource(GraphExplorer oe,TraversalPath path) {\r
-               Graph graph = null;\r
-               IEntity t = EntityFactory.create(graph,path.getResource());\r
-               if (!t.isInstanceOf(ProcessResource.builtins.Double)) \r
-                       return;\r
-               if (oe == oe1) {\r
-                       sampleSource1 = path.getResource();\r
-                       samplePath1 = new ArrayList<Resource>();\r
-                       PathUtils.createPath(samplePath1, path,sampleInstance,sampleSource1,oe);\r
-               } else if (oe == oe2) {\r
-                       sampleSource2 = path.getResource();\r
-                       samplePath2 = new ArrayList<Resource>();\r
-                       PathUtils.createPath(samplePath2, path,sampleInstance,sampleSource2,oe);\r
-               }\r
-       }\r
-       \r
-       \r
-       \r
-       \r
-       private void applyAnimation(Graph graph) {\r
-               if (sampleInstance == null || sampleSource1 == null || sampleSource2 == null || samplePath1 == null|| samplePath2 == null) {\r
-                       throw new RuntimeException("Missing required selections");\r
-                       //return;\r
-               }\r
-               java.util.List<Resource> instances1 = new ArrayList<Resource>();\r
-               java.util.List<Resource> instances2 = new ArrayList<Resource>();\r
-               java.util.List<Resource> sources1 = new ArrayList<Resource>();\r
-               java.util.List<Resource> sources2 = new ArrayList<Resource>();\r
-               browseOthers(instances1, sources1,samplePath1);\r
-               browseOthers(instances2, sources2,samplePath2);\r
-               instances1.add(sampleInstance);\r
-               instances2.add(sampleInstance); // instances1 == instances2\r
-               sources1.add(sampleSource1);\r
-               sources2.add(sampleSource2);\r
-               \r
-               for (int i = 0; i < instances1.size(); i++) {\r
-                       \r
-                       double cMin = 0.0;\r
-                       double cMax = 1.0;\r
-                       double vMin = 0.0;\r
-                       double vMax = 0.0;\r
-                       \r
-                       if (scaleButton1.getSelection()) {\r
-                               cMin = Double.parseDouble(minText1.getText());\r
-                               cMax = Double.parseDouble(maxText1.getText());\r
-                       }\r
-                       if (scaleButton2.getSelection()) {\r
-                               vMin = Double.parseDouble(minText2.getText());\r
-                               vMax = Double.parseDouble(maxText2.getText());\r
-                       }\r
-                       ResourcePipeAnimationController c = new ResourcePipeAnimationController(component, new PipeRun(graph,instances1.get(i)),sources1.get(i),cMin,cMax,sources2.get(i),vMin,vMax);\r
-                       \r
-                       animationSystem.add(c);\r
-               }\r
-               \r
-       }\r
-       \r
-       private void browseOthers(java.util.List<Resource> instances,java.util.List<Resource> sources,java.util.List<Resource> samplePath) {\r
-               Graph graph = null;\r
-               java.util.List<Resource> possibleInstances = new ArrayList<Resource>();\r
-               for (Resource n : nodes) {\r
-                       possibleInstances.add(n);\r
-               }\r
-               \r
-               for (Resource instance : possibleInstances) {\r
-                       IEntity source = PathUtils.findSimilar(samplePath,EntityFactory.create(graph,instance));\r
-                       if (source != null) {\r
-                               instances.add(instance);\r
-                               sources.add(source.getResource());\r
-                       } else {\r
-                               ErrorLogger.getDefault().logWarning("Cannot find animation source for " + instance, null);\r
-                       }\r
-               }\r
-       }\r
-       \r
-       \r
-        \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/EquipmentDialog.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/EquipmentDialog.java
deleted file mode 100644 (file)
index cf19430..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.dialogs;\r
-\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.simantics.db.Session;\r
-\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class EquipmentDialog extends LibraryComponentDialog {\r
-\r
-\r
-       public EquipmentDialog(Shell parentShell, String dialogTitle, Session session) {\r
-               super(parentShell,session,ProcessResource.plant3Dresource.Equipment,dialogTitle);\r
-       \r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/LibraryComponentDialog.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/LibraryComponentDialog.java
deleted file mode 100644 (file)
index 6909fb6..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-package fi.vtt.simantics.processeditor.dialogs;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Stack;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.events.SelectionListener;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.List;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.ui.ProConfUI;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class LibraryComponentDialog extends Dialog{ \r
-       \r
-        private List typeList;\r
-     private Resource selectedType = null;\r
-     private Session session;\r
-     private String title;\r
-     \r
-     private Resource primaryType;\r
-     private Collection<Resource> requiredTypes = new ArrayList<Resource>();\r
-     private Collection<Resource> filteredTypes = new ArrayList<Resource>();\r
-     \r
-     public LibraryComponentDialog(Shell shell, Session session, Resource primaryType, String title) {\r
-        super(shell);\r
-        assert(title != null);\r
-        this.session = session;\r
-        this.title = title;\r
-        this.primaryType = primaryType;\r
-     }\r
-     \r
-     \r
-     protected void setFilter(Collection<Resource> filter) {\r
-        this.filteredTypes = filter;\r
-     }\r
-     \r
-     protected void setRequired(Collection<Resource> required) {\r
-        this.requiredTypes = required;\r
-     }\r
-     \r
-     \r
-     @Override\r
-     protected void configureShell(Shell newShell) {\r
-         \r
-         super.configureShell(newShell);\r
-         newShell.setText(title);\r
-     }\r
-\r
-     public Resource getComboValue() {\r
-         return selectedType;\r
-     }\r
-     \r
-     protected Control createDialogArea(Composite parent) {\r
-         Composite composite = (Composite) super.createDialogArea(parent);\r
-         \r
-         Label label = new Label(composite, SWT.WRAP);\r
-         label.setText("Select Component");\r
-         GridData data = new GridData(GridData.GRAB_HORIZONTAL\r
-                 | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
-                 | GridData.VERTICAL_ALIGN_CENTER);\r
-         data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-         label.setLayoutData(data);\r
-         label.setFont(parent.getFont());\r
-         // TODO : list populating is done in random order; change to alphabetic\r
-         typeList = new List(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY | SWT.V_SCROLL);\r
-         typeList.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));\r
-         \r
-         typeList.addSelectionListener(new SelectionListener() {\r
-             public void widgetSelected(SelectionEvent e) {\r
-                 String key = typeList.getItem(typeList.getSelectionIndex());\r
-                 selectedType = (Resource) typeList.getData(key);\r
-             }\r
-             public void widgetDefaultSelected(SelectionEvent e) {\r
-             }\r
-         });\r
-         getShell().setText(title + " loading...");\r
-         session.asyncRead(new GraphRequestAdapter() {\r
-               @Override\r
-               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                       loadComponents(g);\r
-                       return GraphRequestStatus.transactionComplete();\r
-               }\r
-               \r
-               @Override\r
-               public void requestCompleted(GraphRequestStatus status) {\r
-                       getDialogArea().getDisplay().asyncExec(new Runnable() {\r
-                               @Override\r
-                               public void run() {\r
-                                       getShell().setText(title);\r
-                                       if (selectedType == null) {\r
-                               typeList.select(0);\r
-                               selectedType = (Resource)typeList.getData(typeList.getItem(0));\r
-                           }\r
-                               }\r
-                               \r
-                       });\r
-               }\r
-         });\r
-\r
-         GridData data2 = new GridData(GridData.GRAB_HORIZONTAL\r
-                 | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
-                 | GridData.VERTICAL_ALIGN_FILL);\r
-         data2.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-         data2.heightHint = 200;\r
-         typeList.setLayoutData(data2);\r
-         typeList.setFont(parent.getFont());\r
-         \r
-         typeList.showSelection();\r
-         \r
-         applyDialogFont(composite);\r
-         return composite;\r
-     }\r
-     \r
-     private void loadComponents(Graph g) {\r
-               Resource projectResource = ProConfUI.getProject().getResource();\r
-               Stack<Resource> handling = new Stack<Resource>();\r
-               handling.push(projectResource);\r
-               while (!handling.isEmpty()) {\r
-                       final Resource node = handling.pop();\r
-                       if (g.isInstanceOf(node,primaryType)) {\r
-                               IEntity equipment = EntityFactory.create(g, node);\r
-                               Collection<IEntity> graphics = equipment\r
-                                               .getRelatedObjects(ProcessResource.plant3Dresource.HasGraphics);\r
-                               if (graphics.size() != 1) {\r
-                                       ErrorLogger.defaultLogError("Equipment "\r
-                                                       + equipment.getName() + " has " + graphics.size()\r
-                                                       + " + graphical representation!", null);\r
-                               } else {\r
-                                       boolean add = true;\r
-                                       for (Resource r : requiredTypes) {\r
-                                               if (!equipment.isInstanceOf(r)) {\r
-                                                       add = false;\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-                                       if (add) {\r
-                                               for (Resource r : filteredTypes) {\r
-                                                       if (equipment.isInstanceOf(r)) {\r
-                                                               add = false;\r
-                                                               break;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                                       if (add) {\r
-                                               final String name = equipment.getName();\r
-                                               getDialogArea().getDisplay().asyncExec(new Runnable() {\r
-                                                       public void run() {\r
-                                                               // List won't work with two ore more same names.\r
-                                                               if (typeList.getData(name)!= null) {\r
-                                                                       String n = new String(name);\r
-                                                                       int i = 1;\r
-                                                                       while (true) {\r
-                                                                               n = name +"("+i+")";\r
-                                                                               if (typeList.getData(n)== null) {\r
-                                                                                       typeList.add(n);\r
-                                                                                       typeList.setData(n, node);\r
-                                                                                       break;\r
-                                                                               }\r
-                                                                       }\r
-                                                               } else {\r
-                                                                       typeList.add(name);\r
-                                                                       typeList.setData(name, node);\r
-                                                               }\r
-                                                       }\r
-                                               });\r
-                                       }\r
-                               }\r
-                       } else {\r
-                               handling.addAll(g.getObjects(node,\r
-                                               ProcessResource.builtins.ConsistsOf));\r
-                       }\r
-\r
-               }\r
-               \r
-       }\r
-       \r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/NozzleDialog.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/NozzleDialog.java
deleted file mode 100644 (file)
index 282c9ce..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.dialogs;\r
-\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.simantics.db.Session;\r
-\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class NozzleDialog extends LibraryComponentDialog {\r
-\r
-\r
-       public NozzleDialog(Shell parentShell, String dialogTitle, Session session) {\r
-               super(parentShell,session,ProcessResource.plant3Dresource.Nozzle,dialogTitle);\r
-       \r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/PipelineComponentDialog.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/PipelineComponentDialog.java
deleted file mode 100644 (file)
index a7510b4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.dialogs;\r
-\r
-import java.util.Collection;\r
-\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-\r
-\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class PipelineComponentDialog extends LibraryComponentDialog{\r
-\r
\r
-        public PipelineComponentDialog(Shell parentShell, Collection<Resource> requiredTypes, Collection<Resource> filteredTypes, Session session) {\r
-            super(parentShell,session,ProcessResource.plant3Dresource.PipelineComponent,"Select Component");\r
-            if (requiredTypes != null)\r
-               setRequired(requiredTypes);\r
-            if (filteredTypes != null)\r
-               setFilter(filteredTypes);\r
-        }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/PipelineDialog.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/dialogs/PipelineDialog.java
deleted file mode 100644 (file)
index 5cf1ea4..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.dialogs;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.KeyEvent;\r
-import org.eclipse.swt.events.KeyListener;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Text;\r
-\r
-public class PipelineDialog extends Dialog implements KeyListener{\r
-       Text pipeRadiusText;\r
-       Text turnRadiusText;\r
-       \r
-       double pipeDiameter = 0.0;\r
-       double turnRadius = 0.0;\r
-       \r
-       public PipelineDialog(Shell parentShell) {\r
-               super(parentShell);\r
-       }\r
-       \r
-       public PipelineDialog(Shell parentShell, double pipeRadius, double turnRadius) {\r
-               super(parentShell);\r
-               this.pipeDiameter = pipeRadius;\r
-               this.turnRadius = turnRadius;\r
-       }\r
-\r
-       \r
-       @Override\r
-       protected void configureShell(Shell newShell) {\r
-               super.configureShell(newShell);\r
-               newShell.setText("Configure new pipeline");\r
-       }\r
-       \r
-       @Override\r
-       protected Control createDialogArea(Composite parent) {\r
-               Composite composite = (Composite) super.createDialogArea(parent);\r
-               Label label = new Label(composite, SWT.WRAP);\r
-        label.setText("Input pipeline specifications");\r
-        GridData data = new GridData(GridData.GRAB_HORIZONTAL\r
-                | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
-                | GridData.VERTICAL_ALIGN_CENTER);\r
-               \r
-        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        label = new Label(composite, SWT.WRAP);\r
-        label.setText("Pipe diameter");\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        pipeRadiusText = new Text(composite,SWT.BORDER);\r
-        pipeRadiusText.setLayoutData(data);\r
-        label = new Label(composite, SWT.WRAP);\r
-        label.setText("Pipe elbow/turn radius");\r
-        label.setLayoutData(data);\r
-        label.setFont(parent.getFont());\r
-        turnRadiusText = new Text(composite,SWT.BORDER);\r
-               turnRadiusText.setLayoutData(data);\r
-               \r
-               pipeRadiusText.addKeyListener(this);\r
-               turnRadiusText.addKeyListener(this);\r
-               if (pipeDiameter > 0.0 && turnRadius > 0.0) {\r
-                       pipeRadiusText.setText(Double.toString(pipeDiameter));\r
-                       turnRadiusText.setText(Double.toString(turnRadius));\r
-               }\r
-                       \r
-               \r
-               return composite;\r
-       }\r
-       \r
-       @Override\r
-       public int open() {\r
-               return super.open();\r
-       }\r
-       \r
-       \r
-       \r
-       \r
-       public void keyPressed(KeyEvent e) {\r
-               \r
-               \r
-       }\r
-       \r
-       public void keyReleased(KeyEvent e) {\r
-               boolean ok = true;\r
-               try {\r
-                       pipeDiameter = Double.parseDouble(pipeRadiusText.getText());\r
-                       turnRadius = Double.parseDouble(turnRadiusText.getText());\r
-                       if (pipeDiameter <= 0.0)\r
-                               ok = false;\r
-                       if (turnRadius <= 0.0)\r
-                               ok = false;\r
-                       \r
-               } catch (NumberFormatException err) {\r
-                       ok = false;\r
-               }\r
-               if (ok) {\r
-                       this.getButton(IDialogConstants.OK_ID).setEnabled(true);\r
-               } else {\r
-                       this.getButton(IDialogConstants.OK_ID).setEnabled(false);\r
-               }\r
-       }\r
-\r
-\r
-       public double getPipeDiameter() {\r
-               return pipeDiameter;\r
-       }\r
-\r
-\r
-       public double getTurnRadius() {\r
-               return turnRadius;\r
-       }\r
-\r
-\r
-       \r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/gizmo/PositionSelectionGizmo.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/gizmo/PositionSelectionGizmo.java
deleted file mode 100644 (file)
index 62d3685..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-package fi.vtt.simantics.processeditor.gizmo;\r
-\r
-import java.net.URL;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.vecmath.Point3d;\r
-\r
-import org.eclipse.core.runtime.FileLocator;\r
-import org.eclipse.core.runtime.Path;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-import org.simantics.proconf.g3d.gizmo.Gizmo;\r
-import org.simantics.utils.datastructures.Pair;\r
-\r
-import com.jme.bounding.BoundingSphere;\r
-import com.jme.image.Image;\r
-import com.jme.image.Texture;\r
-import com.jme.math.Vector3f;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.BillboardNode;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.shape.Quad;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.LightState;\r
-import com.jme.scene.state.TextureState;\r
-import com.jme.scene.state.ZBufferState;\r
-import com.jme.util.TextureManager;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.actions.PositionType;\r
-\r
-/**\r
- * Gizmo that allows user to selected insertion point of a component\r
- * TODO : for splits we want use line between component ends to\r
- *        position the button, instead of its center point.   \r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class PositionSelectionGizmo implements Gizmo {\r
-\r
-       private static String PICK_PREFIX = "insert";\r
-       private static String SPLIT_TEXTURE = "icons/middle.png";\r
-       private static String END_TEXTURE = "icons/plus.png";\r
-       private static String PORT_TEXTURE = END_TEXTURE;\r
-\r
-       private ThreeDimensionalEditorBase parent;\r
-       \r
-       private boolean changed = false;\r
-       private int selected = -1;\r
-       private boolean useDistanceResize = true;\r
-       \r
-       private List<BillboardNode> nodes;\r
-       private List<AlphaState> alphaStates;\r
-       private Node rootNode;\r
-       \r
-       public PositionSelectionGizmo(ThreeDimensionalEditorBase parent, List<Pair<Point3d, PositionType>> positions) {\r
-               this.parent = parent;\r
-               rootNode = new Node();\r
-               rootNode.setCullMode(Node.CULL_NEVER);\r
-               rootNode.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-               rootNode.setLightCombineMode(LightState.OFF);\r
-               int i = 0;\r
-               nodes = new ArrayList<BillboardNode>();\r
-               alphaStates = new ArrayList<AlphaState>();\r
-               // create a button (billboard) for each insertion position\r
-\r
-               ZBufferState zs = parent.getRenderingComponent().getDisplaySystem().getRenderer().createZBufferState();\r
-               zs.setFunction(ZBufferState.CF_ALWAYS);\r
-               \r
-               for (Pair<Point3d, PositionType> p : positions) {\r
-                       BillboardNode node = new BillboardNode("");\r
-                       nodes.add(node);\r
-                       Quad quad = new Quad(PICK_PREFIX + i,1.f,1.f);\r
-                       \r
-                       TextureState ts = parent.getRenderingComponent().getDisplaySystem().getRenderer().createTextureState();\r
-                       String filename = "";\r
-                       switch (p.second) {\r
-                       case NEXT:\r
-                       case PREVIOUS:\r
-                               filename = END_TEXTURE;\r
-                               break;\r
-                       case SPLIT:\r
-                               filename = SPLIT_TEXTURE;\r
-                               break;\r
-                       case PORT:\r
-                               filename = PORT_TEXTURE;\r
-                       }\r
-                       URL url = FileLocator.find(Activator.getDefault().getBundle(), new Path(filename),null);\r
-                       Image image = TextureManager.loadImage(url, true);\r
-                       Texture texture = new Texture();\r
-                       texture.setImage(image);\r
-                       texture.setFilter(Texture.FM_LINEAR);\r
-                       ts.setTexture(texture);\r
-                       quad.setRenderState(ts);\r
-                       \r
-                       AlphaState as = parent.getRenderingComponent().getDisplaySystem().getRenderer().createAlphaState();\r
-                       as.setSrcFunction(AlphaState.SB_SRC_ALPHA);\r
-                       as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-                       as.setBlendEnabled(true);\r
-                       alphaStates.add(as);\r
-                       quad.setRenderState(as);\r
-                       quad.setRenderState(zs);\r
-                       \r
-                       node.attachChild(quad);\r
-                       node.setLocalTranslation(VecmathJmeTools.get(p.first));\r
-                       quad.setModelBound(new BoundingSphere(0.5f,new Vector3f()));\r
-                       quad.updateModelBound();\r
-                       rootNode.attachChild(node);\r
-                       \r
-                       i++;\r
-               }\r
-       }\r
-       \r
-       \r
-       @Override\r
-       public Node getNode() {\r
-               return rootNode;\r
-       }\r
-       \r
-       @Override\r
-       public String getPickPrefix() {\r
-               return PICK_PREFIX;\r
-       }\r
-       \r
-       @Override\r
-       public boolean isChanged() {\r
-               return changed;\r
-       }\r
-       \r
-       @Override\r
-       public void setChanged(boolean b) {\r
-               changed = b;\r
-       }\r
-       \r
-       @Override\r
-       public void setSelected(String name) {\r
-               if (name == null) {\r
-                       setSelected(-1);\r
-                       return;\r
-               }\r
-               assert(name.startsWith(PICK_PREFIX));\r
-               setSelected(Integer.parseInt(name.substring(PICK_PREFIX.length())));\r
-       }\r
-       \r
-       private void setSelected(int i) {\r
-               if (selected == i)\r
-                       return;\r
-               if (selected != -1) {\r
-                       alphaStates.get(selected).setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-                       nodes.get(selected).getChild(0).setRenderState(alphaStates.get(selected));\r
-               }\r
-               selected = i;\r
-               if (selected != -1) {\r
-                       alphaStates.get(selected).setDstFunction(AlphaState.DB_ONE);\r
-                       nodes.get(selected).getChild(0).setRenderState(alphaStates.get(selected));\r
-               }\r
-               parent.setViewChanged(true);\r
-       }\r
-       \r
-       public int getSelected() {\r
-               return selected;\r
-       }\r
-       \r
-       public void update() {\r
-               if (useDistanceResize) {\r
-                       Vector3f v = VecmathJmeTools.get(parent.getCamera().getCameraPos());\r
-                       for (BillboardNode n : nodes) {\r
-                               float length = v.subtract(n.getWorldTranslation()).length();\r
-                               n.setLocalScale(length * 0.06f);\r
-                       }\r
-               }\r
-       }\r
-\r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/EquipmentEditorAdapter.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/EquipmentEditorAdapter.java
deleted file mode 100644 (file)
index 6339ca4..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-package fi.vtt.simantics.processeditor.handlers;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.ui.workbench.ResourceEditorInput;\r
-import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;\r
-import org.simantics.utils.ui.BundleUtils;\r
-import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-/**\r
- * EditorAdapter for EquipmentEditor\r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class EquipmentEditorAdapter extends SimpleEditorAdapter {\r
-       public EquipmentEditorAdapter() {\r
-               super("Equipment Editor",\r
-                       BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/tank.png"),\r
-                       null,null,null);\r
-       }\r
-\r
-       @Override\r
-       public boolean canHandle(Graph g, Resource r) {\r
-               if(ProcessResource.plant3Dresource == null) return false; \r
-               if(ProcessResource.plant3Dresource.Plant == null) return false; \r
-               if(!g.isInstanceOf(r, ProcessResource.plant3Dresource.Equipment)) return false;\r
-               return true;\r
-       }\r
-\r
-\r
-       @Override\r
-       public void openEditor(Resource r) throws Exception {\r
-               WorkbenchUtils.openEditor("org.simantics.proconf.processeditor.equipmenteditor", new ResourceEditorInput("org.simantics.proconf.processeditor.equipmenteditor",r));\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewComponentHandler.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewComponentHandler.java
deleted file mode 100644 (file)
index 7cb2be9..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-package fi.vtt.simantics.processeditor.handlers;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.ModifyEvent;\r
-import org.eclipse.swt.events.ModifyListener;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.stubs.Library;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import org.simantics.proconf.ui.ProConfUI;\r
-import org.simantics.proconf.ui.utils.ResourceAdaptionUtils;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-\r
-/**\r
- * Handler that creates new pipeline components.\r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class NewComponentHandler extends AbstractHandler {\r
-       \r
-       private Map<Resource, String> nameMap;\r
-       \r
-       @Override\r
-       public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               ISelection s = HandlerUtil.getCurrentSelectionChecked(event);\r
-        IStructuredSelection ss = (IStructuredSelection) s;\r
-        if (ss.size() != 1)\r
-            return null;\r
-        final Resource lib = ResourceAdaptionUtils.toSingleResource(ss);\r
-        \r
-        \r
-        \r
-        if (nameMap == null) {\r
-               ProConfUI.getSession().syncRead(new GraphRequestAdapter(){\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               nameMap = new HashMap<Resource, String>();\r
-                               for (Resource r : getComponentTypes()) {\r
-                                       IEntity e = EntityFactory.create(g,r);\r
-                                       nameMap.put(r, e.getName());\r
-                                       for (Resource r2 : getComponentOptions(r)) {\r
-                                               IEntity e2 = EntityFactory.create(g,r2);\r
-                                       nameMap.put(r2, e2.getName());\r
-                                       }\r
-                               }\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-        }\r
-        \r
-        ComponentTypeDialog dialog = new ComponentTypeDialog(Display.getDefault().getActiveShell());\r
-        if (dialog.open() == ComponentTypeDialog.CANCEL)\r
-               return null;\r
-        final List<Resource> types = dialog.getSelection();\r
-        final String name = dialog.getName();\r
-               \r
-        if (types.size() == 0 || name == null || name.length() == 0)\r
-               return null;\r
-        \r
-        ProConfUI.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               // instantiate component\r
-                               IEntity instance = EntityFactory.create(g, InstanceFactory.instantiate(g, types));\r
-                               Library l = new Library(g, lib);\r
-                               l.addStatement(g.getBuiltins().ConsistsOf, instance);\r
-                               instance.setName(name);\r
-                               \r
-                               // TODO : is this correct (instance & inherits)\r
-                               for (Resource type : types) {\r
-                                       instance.addStatement(ProcessResource.builtins.Inherits, type);\r
-                               }\r
-                               \r
-                               // instantiate control point(s)\r
-                               List<Resource> cpTypes = getControlPointTypes(types);\r
-                               boolean isDual = (cpTypes.contains(ProcessResource.plant3Dresource.SizeChangeControlPoint) || \r
-                                                                 cpTypes.contains(ProcessResource.plant3Dresource.OffsettingPoint));\r
-                               IEntity cp = EntityFactory.create(g, InstanceFactory.instantiate(g, cpTypes));\r
-                               instance.addStatement(ProcessResource.plant3Dresource.HasControlPoint, cp);\r
-                               if (isDual) {\r
-                                       IEntity subCP = EntityFactory.create(g, InstanceFactory.instantiate(g, ProcessResource.plant3Dresource.DualSubControlPoint));\r
-                                       cp.addStatement(ProcessResource.plant3Dresource.HasSubPoint, subCP);\r
-                               }\r
-                               // instantiate model\r
-                               Resource modelType = g.getResourceByURI("http://www.vtt.fi/Simantics/CSG/1.0/Types#CSGModel");\r
-                               IEntity model = EntityFactory.create(g, InstanceFactory.instantiate(g, modelType));\r
-                               instance.addStatement(ProcessResource.plant3Dresource.HasGraphics, model);\r
-                               \r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-               \r
-               \r
-               return null;\r
-       }\r
-       \r
-       /**\r
-        * Returns all possible types for a pipeline component\r
-        * @return\r
-        */\r
-       private List<Resource> getComponentTypes() {\r
-               List<Resource> list = new ArrayList<Resource>();\r
-               list.add(ProcessResource.plant3Dresource.FixedLengthInlineComponent);\r
-               list.add(ProcessResource.plant3Dresource.VariableLengthInlineComponent);\r
-               list.add(ProcessResource.plant3Dresource.VariableAngleTurnComponent);\r
-               list.add(ProcessResource.plant3Dresource.FixedAngleTurnComponent);\r
-               list.add(ProcessResource.plant3Dresource.EndComponent);\r
-               list.add(ProcessResource.plant3Dresource.Nozzle);\r
-               \r
-               return list;\r
-       }\r
-       \r
-       /**\r
-        * Returns optional types for a component type\r
-        * @param type\r
-        * @return\r
-        */\r
-       private List<Resource> getComponentOptions(Resource type) {\r
-               List<Resource> list = new ArrayList<Resource>();\r
-               if (type.equals(ProcessResource.plant3Dresource.FixedLengthInlineComponent)) {\r
-                       list.add(ProcessResource.plant3Dresource.SizeChangeComponent);\r
-                       list.add(ProcessResource.plant3Dresource.OffsetComponent);\r
-               }\r
-               return list;\r
-       }\r
-       \r
-       /**\r
-        * Returns control point type(s) for given control point type. \r
-        * \r
-        * @param types\r
-        * @return\r
-        */\r
-       private List<Resource> getControlPointTypes(List<Resource> types) {\r
-               Resource primaryType = types.get(0);\r
-               List<Resource> cpTypes = new ArrayList<Resource>();\r
-               if (primaryType == ProcessResource.plant3Dresource.FixedLengthInlineComponent) {\r
-                       if (types.size() == 1) {\r
-                               cpTypes.add(ProcessResource.plant3Dresource.FixedLengthControlPoint);\r
-                       } else {\r
-                               if (types.contains(ProcessResource.plant3Dresource.SizeChangeComponent)) {\r
-                                       cpTypes.add(ProcessResource.plant3Dresource.SizeChangeControlPoint);\r
-                               }\r
-                               if (types.contains(ProcessResource.plant3Dresource.OffsetComponent)) {\r
-                                       cpTypes.add(ProcessResource.plant3Dresource.OffsettingPoint);\r
-                               }\r
-                               if (cpTypes.size() == 0) {\r
-                                       throw new RuntimeException("Cannot find control point type for " + primaryType);\r
-                               }\r
-                       }\r
-                       \r
-               } else if (primaryType == ProcessResource.plant3Dresource.VariableLengthInlineComponent) {\r
-                       cpTypes.add(ProcessResource.plant3Dresource.VariableLengthControlPoint);\r
-               } else if (primaryType == ProcessResource.plant3Dresource.FixedAngleTurnComponent) {\r
-                       cpTypes.add(ProcessResource.plant3Dresource.FixedAngleTurnControlPoint);\r
-               } else if (primaryType == ProcessResource.plant3Dresource.VariableAngleTurnComponent) {\r
-                       cpTypes.add(ProcessResource.plant3Dresource.VariableAngleTurnControlPoint);\r
-               } else if (primaryType == ProcessResource.plant3Dresource.EndComponent) {\r
-                       cpTypes.add(ProcessResource.plant3Dresource.EndComponentControlPoint);\r
-               } else if (primaryType == ProcessResource.plant3Dresource.Nozzle) {\r
-                       cpTypes.add(ProcessResource.plant3Dresource.NozzleControlPoint);\r
-               } else {\r
-                       throw new RuntimeException("Cannot find control point type for " + primaryType);\r
-               }\r
-                       \r
-               return cpTypes;\r
-       }\r
-       \r
-       \r
-       private class ComponentTypeDialog extends Dialog {\r
-               \r
-               List<Resource> selected = new ArrayList<Resource>();\r
-               String name;\r
-               \r
-               public ComponentTypeDialog(Shell shell) {\r
-                       super(shell);\r
-               }\r
-               \r
-               @Override\r
-               protected Control createDialogArea(Composite parent) {\r
-                       Composite composite = (Composite) super.createDialogArea(parent);\r
-                       Label label = new Label(composite,SWT.NONE);\r
-                       label.setText("Name:");\r
-                       Text text = new Text(composite,SWT.SINGLE|SWT.BORDER);\r
-                       text.addModifyListener(new ModifyListener() {\r
-                               @Override\r
-                               public void modifyText(ModifyEvent e) {\r
-                                       name = ((Text)e.widget).getText();\r
-                               }\r
-                       });\r
-                       GridData data = new GridData();\r
-                       data.grabExcessHorizontalSpace = true;\r
-                       data.horizontalAlignment = SWT.FILL;\r
-                       text.setLayoutData(data);\r
-                       label = new Label(composite,SWT.NONE);\r
-                       label.setText("Type:");\r
-                       for (Resource r : getComponentTypes()) {\r
-                               final Button b = new Button(composite,SWT.RADIO);\r
-                               b.setText(nameMap.get(r));\r
-                               b.setData(r);\r
-                               b.addSelectionListener(new SelectionAdapter() {\r
-                                       @Override\r
-                                       public void widgetSelected(SelectionEvent e) {\r
-                                               Button button = (Button)e.widget;\r
-                                               Resource res = (Resource)button.getData();\r
-                                               if (button.getSelection()) {\r
-                                                       selected.add(0,res);\r
-                                               } else {\r
-                                                       selected.remove(res);\r
-                                               }\r
-                                       }\r
-                               });\r
-                               data = new GridData();\r
-                               b.setLayoutData(data);\r
-                               for (Resource r2 : getComponentOptions(r)) {\r
-                                       final Button b2 = new Button(composite,SWT.CHECK);\r
-                                       b2.setText(nameMap.get(r2));\r
-                                       b2.setData(r2);\r
-                                       b.addSelectionListener(new SelectionAdapter() {\r
-                                               @Override\r
-                                               public void widgetSelected(SelectionEvent e) {\r
-                                                       b2.setEnabled(b.getSelection());\r
-                                                       Resource res = (Resource)b2.getData();\r
-                                                       if (!b.getSelection()) {\r
-                                                               selected.remove(res);\r
-                                                       } else if (b2.getSelection()) {\r
-                                                               selected.add(res);\r
-                                                       }\r
-                                               }\r
-                                       });\r
-                                       b2.addSelectionListener(new SelectionAdapter() {\r
-                                               @Override\r
-                                               public void widgetSelected(SelectionEvent e) {\r
-                                                       Button button = (Button)e.widget;\r
-                                                       Resource res = (Resource)button.getData();\r
-                                                       if (button.getSelection()) {\r
-                                                               selected.add(res);\r
-                                                       } else {\r
-                                                               selected.remove(res);\r
-                                                       }\r
-                                               }\r
-                                       });\r
-                                       b2.setEnabled(false);\r
-                                       data = new GridData();\r
-                                       data.horizontalIndent = convertWidthInCharsToPixels(2);\r
-                                       b2.setLayoutData(data);\r
-                               }\r
-                       }\r
-                       \r
-                       return composite;\r
-               }\r
-               \r
-               List<Resource> getSelection() {\r
-                       return selected;\r
-               }\r
-               \r
-               public String getName() {\r
-                       return name;\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewEquipmentHandler.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewEquipmentHandler.java
deleted file mode 100644 (file)
index 49eb77e..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-package fi.vtt.simantics.processeditor.handlers;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.ModifyEvent;\r
-import org.eclipse.swt.events.ModifyListener;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.stubs.Library;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.instantiation.InstanceFactory;\r
-import org.simantics.proconf.ui.ProConfUI;\r
-import org.simantics.proconf.ui.utils.ResourceAdaptionUtils;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.stubs.Equipment;\r
-\r
-/**\r
- * Creates new equipment\r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class NewEquipmentHandler extends AbstractHandler {\r
-       \r
-       @Override\r
-       public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               ISelection s = HandlerUtil.getCurrentSelectionChecked(event);\r
-        IStructuredSelection ss = (IStructuredSelection) s;\r
-        if (ss.size() != 1)\r
-            return null;\r
-        final Resource lib = ResourceAdaptionUtils.toSingleResource(ss);\r
-        \r
-        EquipmentDialog dialog = new EquipmentDialog(Display.getDefault().getActiveShell());\r
-        if (dialog.open() == EquipmentDialog.CANCEL)\r
-               return null;\r
-        final String name = dialog.getName();\r
-        if (name == null || name.length() == 0)\r
-               return null;\r
-               ProConfUI.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               Equipment equipment = Equipment.createDefault(g);\r
-                               Library l = new Library(g, lib);\r
-                               l.addStatement(g.getBuiltins().ConsistsOf, equipment);\r
-                               \r
-                               // TODO : is this correct (instance & inherits)\r
-                               equipment.addStatement(ProcessResource.builtins.Inherits, ProcessResource.plant3Dresource.Equipment);\r
-\r
-                               Resource modelType = g.getResourceByURI("http://www.vtt.fi/Simantics/CSG/1.0/Types#CSGModel");\r
-                               IEntity model = EntityFactory.create(g, InstanceFactory.instantiate(g, modelType));\r
-                               equipment.addStatement(ProcessResource.plant3Dresource.HasGraphics, model);\r
-                               equipment.setName(name);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-               \r
-               \r
-               return null;\r
-       }\r
-       \r
-       private class EquipmentDialog extends Dialog {\r
-               \r
-               private String name;\r
-               \r
-               public EquipmentDialog(Shell shell) {\r
-                       super(shell);\r
-               }\r
-               \r
-               @Override\r
-               protected Control createDialogArea(Composite parent) {\r
-                       Composite composite = (Composite) super.createDialogArea(parent);\r
-                       Label label = new Label(composite,SWT.NONE);\r
-                       label.setText("Name:");\r
-                       Text text = new Text(composite,SWT.SINGLE|SWT.BORDER);\r
-                       text.addModifyListener(new ModifyListener() {\r
-                               @Override\r
-                               public void modifyText(ModifyEvent e) {\r
-                                       name = ((Text)e.widget).getText();\r
-                               }\r
-                       });\r
-                       GridData data = new GridData();\r
-                       data.grabExcessHorizontalSpace = true;\r
-                       data.horizontalAlignment = SWT.FILL;\r
-                       text.setLayoutData(data);\r
-                       return composite;\r
-               }\r
-               \r
-               public String getName() {\r
-                       return name;\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewPlantHandler.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/NewPlantHandler.java
deleted file mode 100644 (file)
index 45f54cf..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-package fi.vtt.simantics.processeditor.handlers;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.ModifyEvent;\r
-import org.eclipse.swt.events.ModifyListener;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.stubs.Library;\r
-import org.simantics.proconf.ui.ProConfUI;\r
-import org.simantics.proconf.ui.utils.ResourceAdaptionUtils;\r
-\r
-import fi.vtt.simantics.processeditor.stubs.Plant;\r
-\r
-public class NewPlantHandler extends AbstractHandler {\r
-       \r
-       @Override\r
-       public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               ISelection s = HandlerUtil.getCurrentSelectionChecked(event);\r
-        IStructuredSelection ss = (IStructuredSelection) s;\r
-        if (ss.size() != 1)\r
-            return null;\r
-        final Resource lib = ResourceAdaptionUtils.toSingleResource(ss);\r
-        \r
-        PlantDialog dialog = new PlantDialog(Display.getDefault().getActiveShell());\r
-        if (dialog.open() == PlantDialog.CANCEL)\r
-               return null;\r
-        final String name = dialog.getName();\r
-        if (name == null || name.length() == 0)\r
-               return null;\r
-        \r
-               ProConfUI.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               Plant model = Plant.createDefault(g);\r
-                               model.setName(name);\r
-                               Library l = new Library(g, lib);\r
-                               l.addStatement(g.getBuiltins().ConsistsOf, model);\r
-                               \r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-               \r
-               \r
-               return null;\r
-       }\r
-       \r
-       private class PlantDialog extends Dialog {\r
-               \r
-               private String name;\r
-               \r
-               public PlantDialog(Shell shell) {\r
-                       super(shell);\r
-               }\r
-               \r
-               @Override\r
-               protected Control createDialogArea(Composite parent) {\r
-                       Composite composite = (Composite) super.createDialogArea(parent);\r
-                       Label label = new Label(composite,SWT.NONE);\r
-                       label.setText("Name:");\r
-                       Text text = new Text(composite,SWT.SINGLE|SWT.BORDER);\r
-                       text.addModifyListener(new ModifyListener() {\r
-                               @Override\r
-                               public void modifyText(ModifyEvent e) {\r
-                                       name = ((Text)e.widget).getText();\r
-                               }\r
-                       });\r
-                       GridData data = new GridData();\r
-                       data.grabExcessHorizontalSpace = true;\r
-                       data.horizontalAlignment = SWT.FILL;\r
-                       text.setLayoutData(data);\r
-                       return composite;\r
-               }\r
-               \r
-               public String getName() {\r
-                       return name;\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/PipelineComponentEditorAdapter.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/PipelineComponentEditorAdapter.java
deleted file mode 100644 (file)
index 2523fa1..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package fi.vtt.simantics.processeditor.handlers;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.ui.workbench.ResourceEditorInput;\r
-import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;\r
-import org.simantics.utils.ui.BundleUtils;\r
-import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-/**\r
- * EditorAdapter for PipeLineComponentEditor\r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class PipelineComponentEditorAdapter extends SimpleEditorAdapter {\r
-       public PipelineComponentEditorAdapter() {\r
-               super("Component Editor",\r
-                       BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/Component.png"),\r
-                       null,null,null);\r
-       }\r
-\r
-       @Override\r
-       public boolean canHandle(Graph g, Resource r) {\r
-               if(ProcessResource.plant3Dresource == null) return false; \r
-               if(ProcessResource.plant3Dresource.Plant == null) return false; \r
-               if(!g.isInstanceOf(r, ProcessResource.plant3Dresource.PipelineComponent)) {\r
-                       if (g.isInstanceOf(r, ProcessResource.plant3Dresource.Nozzle))\r
-                               return true;\r
-                       return false;\r
-               }\r
-               if(g.isInstanceOf(r, ProcessResource.plant3Dresource.CodedComponent)) return false;\r
-               return true;\r
-       }\r
-\r
-\r
-       @Override\r
-       public void openEditor(Resource r) throws Exception {\r
-               WorkbenchUtils.openEditor("org.simantics.proconf.processeditor.componenteditor", new ResourceEditorInput("org.simantics.proconf.processeditor.componenteditor",r));\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DEditorAdapter.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DEditorAdapter.java
deleted file mode 100644 (file)
index 93edd94..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-package fi.vtt.simantics.processeditor.handlers;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.ui.workbench.ResourceEditorInput;\r
-import org.simantics.proconf.ui.workbench.editor.SimpleEditorAdapter;\r
-import org.simantics.utils.ui.BundleUtils;\r
-import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class Plant3DEditorAdapter extends SimpleEditorAdapter {\r
-       public Plant3DEditorAdapter() {\r
-               super("PlantEditor",\r
-                       BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/factory.png"),\r
-                       null,null,null);\r
-       }\r
-\r
-       @Override\r
-       public boolean canHandle(Graph g, Resource r) {\r
-               if(ProcessResource.plant3Dresource == null) return false; \r
-               if(ProcessResource.plant3Dresource.Plant == null) return false; \r
-               return g.isInstanceOf(r, ProcessResource.plant3Dresource.Plant);\r
-       }\r
-\r
-\r
-       @Override\r
-       public void openEditor(Resource r) throws Exception {\r
-               WorkbenchUtils.openEditor("org.simantics.proconf.processeditor.planteditor", new ResourceEditorInput("org.simantics.proconf.processeditor.planteditor",r));\r
-\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DProjectAdapter.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DProjectAdapter.java
deleted file mode 100644 (file)
index 305b636..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package fi.vtt.simantics.processeditor.handlers;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.adaption.AdaptionException;\r
-import org.simantics.db.adaption.ResourceAdapter;\r
-\r
-public class Plant3DProjectAdapter implements ResourceAdapter {\r
-       @SuppressWarnings("unchecked")\r
-       @Override\r
-       public <T> T adapt(Graph graph, Resource resource, Resource mia) throws AdaptionException {\r
-               return (T) new Plant3DProjectType(graph,resource);\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DProjectType.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/handlers/Plant3DProjectType.java
deleted file mode 100644 (file)
index f112117..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package fi.vtt.simantics.processeditor.handlers;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.Builtins;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.direct.GraphUtils;\r
-import org.simantics.proconf.ui.projects.IProject;\r
-import org.simantics.proconf.ui.projects.ProjectType;\r
-\r
-public class Plant3DProjectType extends ProjectType{\r
-\r
-       public Plant3DProjectType(Graph graph, Resource projectTypeResource) {\r
-               super(graph, projectTypeResource);\r
-       }\r
-\r
-       @Override\r
-       public Resource createProject(Graph g, String name) throws Exception {\r
-               Resource project = super.createProject(g, name);\r
-               Builtins b = g.getBuiltins();\r
-               {   // Plants\r
-                       Resource modelLibrary = g.newResource();                \r
-               g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);\r
-               GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Plants");\r
-               g.addStatement(project, b.ConsistsOf, modelLibrary);        \r
-               }\r
-               {   // Equipment\r
-                       Resource modelLibrary = g.newResource();                \r
-               g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);\r
-               GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Equipment");\r
-               g.addStatement(project, b.ConsistsOf, modelLibrary);        \r
-               }\r
-               return project;\r
-       \r
-       }\r
-       \r
-       @Override\r
-       public IProject loadProject(Graph g, Resource r) {\r
-               \r
-               IProject project = super.loadProject(g, r);\r
-               project.set(DefaultPerspective, "org.simantics.proconf.processeditor.plantmodelling");\r
-               Collection<String> perspectives = new ArrayList<String>();\r
-               perspectives.add("org.simantics.proconf.processeditor.plantmodelling");\r
-               project.set(Perspectives, perspectives);\r
-               \r
-               return project;\r
-       }\r
-       \r
-\r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/BillboardMonitor.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/BillboardMonitor.java
deleted file mode 100644 (file)
index d35d62c..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.monitors;\r
-\r
-import java.awt.Color;\r
-import java.util.ArrayList;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import com.jme.image.Texture;\r
-import com.jme.math.Vector3f;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.BillboardNode;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.shape.Quad;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.RenderState;\r
-import com.jme.scene.state.TextureState;\r
-import com.jme.scene.state.ZBufferState;\r
-import com.jmex.awt.swingui.ImageGraphics;\r
-\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.stubs.InlineComponent;\r
-\r
-\r
-\r
-/**\r
- * A monitor that uses billboard to show it's information. \r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-//TODO : should it be variable length / fixed length inline component instead of Straight\r
-\r
-public class BillboardMonitor implements Monitor{\r
-       private enum Type{POSITION,PIPE};\r
-       private Type type;\r
-       private ThreeDimensionalEditorBase editor; \r
-       private BillboardNode monitorNode = null;\r
-       private int monitorSize = 128;\r
-    private ImageGraphics graphics = ImageGraphics.createInstance(monitorSize, monitorSize, 0);\r
-    private Node currentParent = null;\r
-    private IGraphicsNode node = null;\r
-    private boolean useDistanceResize = true;\r
-    \r
-    Point3d start;\r
-    Point3d end;\r
-    Point3d middle;\r
-    \r
-    private MonitorTextProvider provider = new ObjectPropertyProvider();\r
-       \r
-    \r
-       public BillboardMonitor(ThreeDimensionalEditorBase editor) {\r
-               this.editor = editor;\r
-               monitorNode = new BillboardNode("");\r
-               monitorNode.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);\r
-               ZBufferState zs = editor.getRenderingComponent()\r
-                               .getDisplaySystem().getRenderer().createZBufferState();\r
-               zs.setEnabled(true);\r
-               zs.setFunction(ZBufferState.CF_ALWAYS);\r
-               monitorNode.setRenderState(zs);\r
-               Quad quad = new Quad("");\r
-               quad.initialize(3.f, 3.f);\r
-               monitorNode.attachChild(quad);\r
-               // SWTImageGraphics graphics =\r
-               // SWTImageGraphics.createInstance(64,64, 0);\r
-\r
-               graphics.clearRect(0, 0, monitorSize, monitorSize);\r
-\r
-               // graphics.setFont(new Font("Arial",Font.PLAIN,30));\r
-               // graphics.setColor(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));\r
-               graphics.setColor(new Color(0, 255, 0, 255));\r
-               graphics.drawString("Monitor", 0, 32);\r
-               \r
-               TextureState ts = editor.getRenderingComponent().getDisplaySystem().getRenderer().createTextureState();\r
-               Texture texture = new Texture();\r
-               texture.setApply(Texture.AM_MODULATE);\r
-               // texture.setBlendColor(new ColorRGBA(1, 1, 1, 1));\r
-               texture.setFilter(Texture.MM_LINEAR);\r
-               texture.setMipmapState(Texture.FM_LINEAR);\r
-               texture.setImage(graphics.getImage());\r
-               graphics.update();\r
-               AlphaState as = editor.getRenderingComponent().getDisplaySystem()\r
-                               .getRenderer().createAlphaState();\r
-               as.setBlendEnabled(true);\r
-               as.setSrcFunction(AlphaState.SB_SRC_ALPHA);\r
-               as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as.setTestEnabled(true);\r
-        as.setTestFunction(AlphaState.TF_GREATER);\r
-               ts.setTexture(texture);\r
-               MaterialState ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-               ms.setEmissive(new ColorRGBA(1.f, 1.f, 1.f, 0.f));\r
-               monitorNode.setRenderState(ts);\r
-               monitorNode.setRenderState(as);\r
-               monitorNode.setRenderState(ms);\r
-               graphics.drawLine(0, 33, monitorSize-1, 33);\r
-               graphics.update();\r
-       }\r
-       \r
-       public boolean acceptNode(Graph graph, IGraphicsNode node) {\r
-               Node selectedParent = node.getGroup();\r
-               if (currentParent == null || !selectedParent.equals(currentParent)) {\r
-                       if (node.getG3DNode(graph).getLocalPosition() != null) {\r
-                               return true;\r
-                       } else if (node.getG3DNode(graph).isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-                               \r
-                               return true;\r
-                       }\r
-               }\r
-\r
-               return false;\r
-       }\r
-       \r
-       public void setNode(Graph graph, IGraphicsNode node) {\r
-               G3DNode n = node.getG3DNode(graph);\r
-               if (n.getLocalPosition() != null) {\r
-                       type = Type.POSITION;\r
-                       monitorNode.setLocalTranslation(new Vector3f(0.f,0.f,0.f));\r
-               } else if (n.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-                       type = Type.PIPE;\r
-                       InlineComponent ic = new InlineComponent(n);\r
-                       start = G3DTools.getPoint(ic.getControlPoint().getPrevious().getLocalPosition());\r
-                       end = G3DTools.getPoint(ic.getControlPoint().getNext().getLocalPosition());\r
-                       Vector3d dir = new Vector3d(end);\r
-                       dir.sub(start);\r
-                       dir.scale(0.5);\r
-                       middle = new Point3d(start);\r
-                       middle.add(dir);\r
-                       monitorNode.setLocalTranslation(VecmathJmeTools.get(middle));\r
-               } else {\r
-                       return;\r
-               }\r
-               Node selectedParent = node.getGroup();\r
-               this.node = node;\r
-               currentParent = selectedParent;\r
-               monitorNode.removeFromParent();\r
-               currentParent.attachChild(monitorNode);\r
-\r
-               provider.setSource(n);\r
-               update(graph);\r
-       }\r
-       \r
-       public IGraphicsNode getNode() {\r
-               return node;\r
-       }\r
-       \r
-       public void update() {\r
-               if (useDistanceResize) {\r
-                       Vector3f v = VecmathJmeTools.get(editor.getCamera().getCameraPos());\r
-                       v.subtractLocal(monitorNode.getWorldTranslation());\r
-                       float length = v.length();\r
-                       monitorNode.setLocalScale(length * 0.06f);\r
-               }\r
-       }\r
-       \r
-       \r
-       public void update(Graph graph) {\r
-               ArrayList<String> titles = provider.getTexts(graph);\r
-               graphics.clearRect(0, 0, monitorSize, monitorSize);\r
-               int y = 16;\r
-               for (String s : titles) {\r
-                       graphics.drawString(s, 0, y);\r
-                       y += 16;\r
-               }\r
-\r
-               TextureState ts = (TextureState) monitorNode\r
-                               .getRenderState(RenderState.RS_TEXTURE);\r
-               ts.deleteAll(); // FIXME : texture won't be updated without this\r
-               graphics.update();\r
-               update();\r
-       }\r
-       \r
-       public void remove() {\r
-               monitorNode.removeFromParent();\r
-               node = null;\r
-       }\r
-\r
-       /**\r
-        * if true, monitors size is independent of distance to camera. Else monitor's size changes when camera is moved.\r
-        * @return\r
-        */\r
-       public boolean isUseDistanceResize() {\r
-               return useDistanceResize;\r
-       }\r
-\r
-       public void setUseDistanceResize(boolean useDistanceResize) {\r
-               this.useDistanceResize = useDistanceResize;\r
-               if (!useDistanceResize) {\r
-                       monitorNode.setLocalScale(1.f);\r
-               }\r
-       }\r
-       \r
-       public void setTextProvider(MonitorTextProvider provider) {\r
-               this.provider = provider;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/Monitor.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/Monitor.java
deleted file mode 100644 (file)
index d748b17..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.monitors;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-\r
-\r
-\r
-\r
-/**\r
- * Interface for monitors (Textual display of objects properties)\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public interface Monitor {\r
-       \r
-       /**\r
-        * Returns true if monitor can be attached to node\r
-        * @param node\r
-        * @return\r
-        */\r
-       public boolean acceptNode(Graph graph,IGraphicsNode node);\r
-       \r
-       /**\r
-        * Returns the scene-graph node where monitor is attached\r
-        * @return\r
-        */\r
-       public IGraphicsNode getNode();\r
-\r
-       /**\r
-        * Sets monitored node\r
-        * @param node\r
-        */\r
-       public void setNode(Graph graph,IGraphicsNode node);\r
-       \r
-       /**\r
-        * Updates monitor's texts\r
-        *\r
-        */\r
-       public void update();\r
-       \r
-       public void update(Graph graph);\r
-       \r
-       /**\r
-        * Removes the monitor. \r
-        */\r
-       public void remove();   \r
-       \r
-       \r
-       public void setTextProvider(MonitorTextProvider provider);\r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/MonitorTextProvider.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/MonitorTextProvider.java
deleted file mode 100644 (file)
index 08b3b02..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.monitors;\r
-\r
-import java.util.ArrayList;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.layer0.utils.IEntity;\r
-\r
-\r
-\r
-public interface MonitorTextProvider {\r
-       public void setSource(IEntity instance);\r
-       public ArrayList<String> getTexts(Graph graph);\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/ObjectPropertyProvider.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/ObjectPropertyProvider.java
deleted file mode 100644 (file)
index f094560..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.monitors;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.ResourceDebugUtils;\r
-\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-\r
-public class ObjectPropertyProvider implements MonitorTextProvider {\r
-       \r
-       private Resource instance;\r
-       private Resource properties[];\r
-       String name;\r
-       \r
-       public void setSource(IEntity instance) {\r
-               this.instance = instance.getResource();\r
-               Collection<IEntity> props = instance.getRelatedObjects(ProcessResource.builtins.HasProperty);\r
-               List<Resource> res = new ArrayList<Resource>();\r
-               for (IEntity t : props)\r
-                       res.add(t.getResource());\r
-               properties = new Resource[res.size()];\r
-               properties = res.toArray(properties);\r
-               name = ResourceDebugUtils.getReadableNameForEntity(instance);\r
-       }\r
-       \r
-       public ArrayList<String> getTexts(Graph graph) {\r
-               ArrayList<String> titles = new ArrayList<String>();\r
-               if (instance == null)\r
-                       return titles;\r
-               IEntity thing = EntityFactory.create(graph,instance);\r
-               name = ResourceDebugUtils.getReadableNameForEntity(thing);\r
-               titles.add(name);\r
-\r
-               for (Resource p : properties) {\r
-                       thing = EntityFactory.create(graph,p);\r
-                       //if (p.isInstanceOf(Builtins.Double)) {\r
-                               //typeResources = p.getRelatedResources(Builtins.InstanceOf);\r
-                               //name = PropertyUtils.getScalarStringProperty(typeResources[0],Builtins.HasName);\r
-                               name = ResourceDebugUtils.getReadableNameForEntity(thing);\r
-                               titles.add(name);\r
-                       //}\r
-               }\r
-               return titles;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/PathContainer.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/PathContainer.java
deleted file mode 100644 (file)
index 4c2aab7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.monitors;\r
-\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.utils.datastructures.MapList;\r
-\r
-\r
-/**\r
- * Container for Paths\r
- * FIXME : singleton\r
- * TODO : removing paths\r
- * TODO : prevent adding same path multiple times\r
- * \r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class PathContainer {\r
-       \r
-       private static PathContainer instance = new PathContainer();\r
-       \r
-       MapList<Resource, List<Resource>> paths;\r
-       \r
-       private PathContainer() {\r
-               paths = new MapList<Resource, List<Resource>>();\r
-       }\r
-       \r
-       public List<List<Resource>> getPaths(IEntity instance) {\r
-               Collection<IEntity> types = instance.getTypes();\r
-               if (types.size() != 1)\r
-                       throw new UnsupportedOperationException("Multi-instances not supported!");\r
-               Resource type = types.iterator().next().getResource();\r
-               return paths.getValues(type);\r
-       }\r
-       \r
-       public void addPath(Resource type, List<Resource> path) {\r
-               paths.add(type, path);\r
-       }\r
-       \r
-       public void clearPaths(Resource type) {\r
-               paths.remove(type);\r
-       }\r
-       \r
-       public static PathContainer getInstance() {\r
-               return instance;\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/ResourcePathPropertyProvider.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/ResourcePathPropertyProvider.java
deleted file mode 100644 (file)
index 7581233..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.monitors;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.ResourceDebugUtils;\r
-\r
-import fi.vtt.simantics.processeditor.common.PathUtils;\r
-\r
-\r
-public class ResourcePathPropertyProvider implements MonitorTextProvider {\r
-       \r
-       private Resource instance;\r
-       private List<Resource> properties = new ArrayList<Resource>();\r
-       private List<String> names = new ArrayList<String>();\r
-       private List<String> units = new ArrayList<String>();\r
-       String name;\r
-       \r
-       private MonitorTextProvider provider = new ObjectPropertyProvider();\r
-       \r
-       public void setSource(IEntity instance) {\r
-               this.instance = instance.getResource();\r
-               properties.clear();\r
-               names.clear();\r
-               //units.clear();\r
-               List<List<Resource>> paths = PathContainer.getInstance().getPaths(instance);\r
-               if (paths != null) {\r
-                       for (List<Resource> path : paths) {\r
-                               IEntity source = PathUtils.findSimilar(path, instance);\r
-                               if (source != null)\r
-                                       properties.add(source.getResource());\r
-                       }\r
-               }\r
-               Collection<IEntity> types = instance.getTypes();\r
-               name = ResourceDebugUtils.getReadableNameForEntity(types.iterator().next());\r
-               for (Resource p : properties) {\r
-                       names.add(ResourceDebugUtils.getReadableNameForEntity(EntityFactory.create(instance.getGraph(),p)));\r
-//                     if (p.isInstanceOf(Builtins.Double)) {\r
-//                             typeResources = p.getRelatedResources(Builtins.InstanceOf);\r
-//                             String name = PropertyUtils.getScalarStringProperty(typeResources[0],Builtins.HasName);\r
-//                             Property property = new Property(p);\r
-//                             String abbr = property.getUnitAbbreviation();\r
-//                             names.add(name);\r
-//                             if (abbr != null)\r
-//                                     units.add(abbr);\r
-//                             else\r
-//                                     units.add("");\r
-//                             //titles.add(name + " " + PropertyUtils.getDoubleValue(p)[0] + " " + abbr);\r
-//                     }\r
-               }\r
-               provider.setSource(instance);\r
-       }\r
-       \r
-       public ArrayList<String> getTexts(Graph graph) {\r
-               if (properties.size() == 0)\r
-                       return provider.getTexts(graph);\r
-               ArrayList<String> titles = new ArrayList<String>();\r
-               if (instance == null)\r
-                       return titles;\r
-               \r
-               titles.add(name);\r
-               for (int i = 0; i < properties.size(); i++) {\r
-                       //titles.add(names.get(i) + " " + Double.toString(PropertyUtils.getDoubleValue(properties.get(i))[0]) + " " + units.get(i));\r
-                       // FIXME : check value\r
-                       titles.add(names.get(i) + " " + EntityFactory.create(graph,properties.get(i)).toProperty().getValue());\r
-               }\r
-\r
-               return titles;\r
-       }\r
-       \r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/TextMonitor.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/monitors/TextMonitor.java
deleted file mode 100644 (file)
index 41c60a6..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.monitors;\r
-\r
-import java.net.URL;\r
-import java.util.ArrayList;\r
-\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.eclipse.core.runtime.FileLocator;\r
-import org.eclipse.core.runtime.Path;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.simantics.db.Graph;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-\r
-import com.jme.image.Texture;\r
-import com.jme.math.Vector2f;\r
-import com.jme.math.Vector3f;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.Text;\r
-import com.jme.scene.shape.Quad;\r
-import com.jme.scene.state.AlphaState;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.RenderState;\r
-import com.jme.scene.state.TextureState;\r
-import com.jme.util.TextureManager;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.stubs.InlineComponent;\r
-\r
-/**\r
- * A monitor implemetation that uses JME's text component to show it's information. \r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class TextMonitor implements Monitor {\r
-       private enum Type{POSITION,PIPE};\r
-       private Type type;\r
-       \r
-       public static String fontLocation = "data/textures/tahoma512.png";\r
-    \r
-       \r
-       private ThreeDimensionalEditorBase editor;\r
-       private ArrayList<Text> texts = new ArrayList<Text>();\r
-       private Node monitorNode = new Node("");\r
-       Node textNode;\r
-       private IGraphicsNode node = null;\r
-       \r
-    Point3d start;\r
-    Point3d end;\r
-    Point3d middle;\r
-    \r
-    float width = 0.f;\r
-    float height = 0.f;\r
-    float textHeight = 0.f;\r
-    \r
-    Quad background;\r
-    \r
-    private MonitorTextProvider provider = new ObjectPropertyProvider();\r
-       \r
-       public TextMonitor(ThreeDimensionalEditorBase editor) {\r
-               this.editor = editor;\r
-               textNode = new Node("");\r
-               \r
-               \r
-               \r
-               AlphaState as1 = editor.getRenderingComponent().getDisplaySystem().getRenderer().createAlphaState();\r
-        as1.setBlendEnabled(true);\r
-        as1.setSrcFunction(AlphaState.SB_SRC_ALPHA);\r
-        as1.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as1.setTestEnabled(true);\r
-        as1.setTestFunction(AlphaState.TF_GREATER);\r
-        as1.setEnabled(true);\r
-        \r
-        MaterialState ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-        ms.setEmissive(new ColorRGBA(0.f,1.f,0.f,0.f));\r
-        \r
-        TextureState font = editor.getRenderingComponent().getDisplaySystem().getRenderer().createTextureState();\r
-        /** The texture is loaded from fontLocation */\r
-        font.setTexture(loadFontTexture());\r
-        font.setEnabled(true);\r
-        textNode.setRenderState(font);\r
-        textNode.setRenderState(as1);\r
-        textNode.setRenderState(ms);\r
-        background = new Quad("",100.f,100.f);\r
-        \r
-        MaterialState ms2 = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-        ms2.setEmissive(new ColorRGBA(0.f,0.f,0.f,0.8f));\r
-        ms2.setDiffuse(new ColorRGBA(0.f,0.f,0.f,0.8f));\r
-\r
-        AlphaState as2 = editor.getRenderingComponent().getDisplaySystem().getRenderer().createAlphaState();\r
-        as2.setBlendEnabled(true);\r
-        as2.setSrcFunction(AlphaState.SB_SRC_ALPHA);\r
-        as2.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);\r
-        as2.setTestEnabled(true);\r
-        as2.setTestFunction(AlphaState.TF_GREATER);\r
-        as2.setEnabled(true);\r
-        monitorNode.setRenderState(ms2);\r
-        monitorNode.setRenderState(as2);\r
-        \r
-        background.setRenderQueueMode(Renderer.QUEUE_ORTHO);\r
-        textNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);\r
-        \r
-        monitorNode.attachChild(background);\r
-        monitorNode.attachChild(textNode);\r
-       // editor.getRenderingComponent().getOrthoNode().attachChild(monitorNode);\r
-        \r
-               \r
-       }\r
-       \r
-       public boolean acceptNode(Graph graph,IGraphicsNode node) {\r
-               G3DNode n = node.getG3DNode(graph);\r
-               if (this.node == null || !node.equals(this.node)) {\r
-                       if (n.getLocalPosition() != null) {\r
-                               return true;\r
-                       } else if (n.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-                               return true;\r
-                       }\r
-               }\r
-\r
-               return false;\r
-\r
-       }\r
-       \r
-       public void setNode(Graph graph, IGraphicsNode node) {\r
-               G3DNode n = node.getG3DNode(graph);\r
-               if (n.getLocalPosition() != null) {\r
-                       type = Type.POSITION;\r
-               } else if (n.isInstanceOf(ProcessResource.plant3Dresource.VariableLengthInlineComponent)) {\r
-                       type = Type.PIPE;\r
-                       InlineComponent ic = new InlineComponent(n);\r
-                       start = G3DTools.getPoint(ic.getControlPoint().getPrevious().getWorldPosition());\r
-                       end = G3DTools.getPoint(ic.getControlPoint().getNext().getWorldPosition());\r
-                       Vector3d dir = new Vector3d(end);\r
-                       dir.sub(start);\r
-                       dir.scale(0.5);\r
-                       middle = new Point3d(start);\r
-                       middle.add(dir);\r
-               } else {\r
-                       return;\r
-               }\r
-               \r
-               this.node = node;\r
-               provider.setSource(n);\r
-               ArrayList<String> titles = provider.getTexts(graph);\r
-               \r
-               for (int i = titles.size() - 1; i < texts.size(); i++) {\r
-                       texts.get(i).removeFromParent();\r
-               }\r
-               while (texts.size() < titles.size()) {\r
-                       Text text = new Text("", "");\r
-                       texts.add(text);\r
-                       textNode.attachChild(text);\r
-               }\r
-               width = 0.f;\r
-               height = 0.f;\r
-               for (int i = 0; i < titles.size(); i++) {\r
-                       Text text = texts.get(i);\r
-                       text.print(titles.get(i));\r
-                       width = Math.max(width,text.getWidth());\r
-                       textHeight = text.getHeight();\r
-                       height += textHeight;\r
-                       textNode.attachChild(text);\r
-               }\r
-               background.resize(width+20.f, height+10.f);\r
-               if (monitorNode.getParent() == null)\r
-                       editor.getScenegraphAdapter().getRoot().attachChild(monitorNode);\r
-               \r
-       }\r
-       \r
-       private void updateText(Graph graph) {\r
-               ArrayList<String> titles = provider.getTexts(graph);\r
-               float newWidth = 0.f;\r
-               for (int i = 0; i < titles.size(); i++) {\r
-                       Text text = texts.get(i);\r
-                       text.print(titles.get(i));\r
-                       newWidth = Math.max(newWidth,text.getWidth());\r
-               }\r
-               if (newWidth != width) {\r
-                       width = newWidth;\r
-                       background.resize(width+20.f, height+10.f);\r
-               }\r
-                       \r
-       }\r
-       \r
-       public void update() {\r
-               if (node == null)\r
-                       return;\r
-               Vector2f v;\r
-                       \r
-               if (type == Type.POSITION) {\r
-                       v = editor.getScreenCoord(VecmathJmeTools.getD(node.getGroup().getWorldTranslation()));\r
-               } else {\r
-                       float mx = editor.getRenderingComponent().getDisplaySystem().getWidth();\r
-                       float my = editor.getRenderingComponent().getDisplaySystem().getHeight();\r
-                       Vector2f s = editor.getScreenCoord(start);\r
-                       Vector2f e = editor.getScreenCoord(end);\r
-                       Vector2f rs = new Vector2f();\r
-                       Vector2f re = new Vector2f();\r
-                       boolean in = MathTools.clipLineRectangle(s, e, new Vector2f(0.f,0.f), new Vector2f(mx,my), rs, re);\r
-                       if (in) {\r
-                               re.subtractLocal(rs);\r
-                               re.multLocal(0.5f);\r
-                               rs.addLocal(re);\r
-                               v = rs;\r
-                       } else {\r
-                               // just a hack to move monitor out of the view\r
-                               v = new Vector2f (mx+width,my+height);\r
-                       }\r
-                       \r
-                       \r
-               }\r
-               background.setLocalTranslation(new Vector3f(v.x,v.y,0.f));\r
-               float y = v.y + (height * 0.5f) - textHeight;\r
-               v.x -= width * 0.5f;\r
-               \r
-               for (Text text : texts) {\r
-                       text.setLocalTranslation(new Vector3f(v.x,y,0.f));\r
-                       y -= textHeight;\r
-               }\r
-               \r
-               \r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void update(Graph graph) {\r
-               updateText(graph);\r
-               update();\r
-       }\r
-       \r
-       public IGraphicsNode getNode() {\r
-               return node;\r
-       }\r
-       \r
-       public void remove() {\r
-               monitorNode.removeFromParent();\r
-               node = null;\r
-       }\r
-       \r
-       protected Texture loadFontTexture() {\r
-               URL url = FileLocator.find(com.jme.eclipse.Activator.getDefault().getBundle(),new Path(fontLocation),null);\r
-        return TextureManager.loadTexture(url, Texture.MM_LINEAR,\r
-                Texture.FM_LINEAR);\r
-       }\r
-       \r
-       public void setTextProvider(MonitorTextProvider provider) {\r
-               this.provider = provider;\r
-       }\r
-       \r
-       \r
-\r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/perspectives/Plant3DModellingPerspective.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/perspectives/Plant3DModellingPerspective.java
deleted file mode 100644 (file)
index f7cceaa..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-package fi.vtt.simantics.processeditor.perspectives;\r
-\r
-import org.eclipse.ui.IPageLayout;\r
-import org.eclipse.ui.IPerspectiveFactory;\r
-\r
-public class Plant3DModellingPerspective implements IPerspectiveFactory{\r
-       \r
-       @Override\r
-       public void createInitialLayout(IPageLayout layout) {\r
-               \r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/perspectives/ViewpointGenerator.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/perspectives/ViewpointGenerator.java
deleted file mode 100644 (file)
index 03c7a5c..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-package fi.vtt.simantics.processeditor.perspectives;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.Builtins;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.Statement;\r
-import org.simantics.layer0.utils.viewpoints.AcceptDecision;\r
-import org.simantics.layer0.utils.viewpoints.AcceptRule;\r
-import org.simantics.layer0.utils.viewpoints.PlainStateFactory;\r
-import org.simantics.layer0.utils.viewpoints.ResourceViewpoint;\r
-import org.simantics.layer0.utils.viewpoints.State;\r
-import org.simantics.layer0.utils.viewpoints.StateFactory;\r
-import org.simantics.layer0.utils.viewpoints.TraversalDecision;\r
-import org.simantics.layer0.utils.viewpoints.TraversalRule;\r
-import org.simantics.layer0.utils.viewpoints.rules.AcceptAllResourceAcceptRule;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class ViewpointGenerator {\r
-       public static ResourceViewpoint createViewpoint() {\r
-               StateFactory f = new PlainStateFactory();\r
-               final State rootState = f.newState();\r
-               final State projectState = f.newState();\r
-               final State libraryState = f.newState();\r
-               \r
-               return new ResourceViewpoint(new TraversalRule() {\r
-                       @Override\r
-                       public TraversalDecision makeTraversalDecision(State state, Statement statement) {\r
-                               Builtins b = statement.getGraph().getBuiltins();\r
-                               if (state.equals(rootState)) {\r
-                                       if (statement.getObject().isInstanceOf(b.Ontology))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       if(!statement.getPredicate().equals(b.ConsistsOf))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(projectState);\r
-                               } else if (state.equals(projectState)) {\r
-                                       if(!statement.getPredicate().equals(b.ConsistsOf))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(libraryState);\r
-                               } else if (state.equals(libraryState)) {\r
-                                       if(!statement.getPredicate().equals(b.ConsistsOf))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(libraryState);\r
-                               }\r
-                               return TraversalDecision.stopTraversal;\r
-                       }\r
-                       \r
-                       @Override\r
-                       public boolean areAllStatesRelevant() {\r
-                               return true;\r
-                       }\r
-                       \r
-                       @Override\r
-                       public Collection<State> relevantStates() {\r
-                               return null;\r
-                       }\r
-               }, new AcceptRule<IEntity>() {\r
-               @Override\r
-                       public AcceptDecision makeAcceptDecision(State state, IEntity obj) {\r
-                               Builtins b = obj.getGraph().getBuiltins();\r
-                               //NOSEResource nr = NOSEResource.getInstance(obj.getGraph());\r
-                               if(obj.isInstanceOf(b.Project)) return AcceptDecision.REJECT;\r
-                               else if (obj.isInstanceOf(b.Ontology)) return AcceptDecision.REJECT;\r
-                               else return AcceptDecision.ACCEPT;\r
-                       }\r
-               \r
-                       @Override\r
-                       public boolean areAllStatesRelevant() {\r
-                               return true;\r
-                       }\r
-                       \r
-                       @Override\r
-                       public Collection<State> relevantStates() {\r
-                               return null;\r
-                       }\r
-               }, rootState);\r
-       }\r
-       \r
-       public static ResourceViewpoint createObjectStructureViewpoint() {\r
-               StateFactory f = new PlainStateFactory();\r
-               final State rootState = f.newState();\r
-\r
-               return new ResourceViewpoint(new TraversalRule() {\r
-                       @Override\r
-                       public TraversalDecision makeTraversalDecision(State state,\r
-                                       Statement statement) {\r
-                               if (state.equals(rootState)) {\r
-                                       if (!statement.getPredicate().isSubrelationOf(\r
-                                                       ProcessResource.g3dResource.HasChild))\r
-                                               return TraversalDecision.stopTraversal;\r
-                                       return TraversalDecision.continueTraversal(rootState);\r
-                               }\r
-                               return TraversalDecision.stopTraversal;\r
-                       }\r
-\r
-                       @Override\r
-                       public boolean areAllStatesRelevant() {\r
-                               return true;\r
-                       }\r
-\r
-                       @Override\r
-                       public Collection<State> relevantStates() {\r
-                               return null;\r
-                       }\r
-               }, new AcceptAllResourceAcceptRule(), rootState);\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/NonVisibleNode.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/NonVisibleNode.java
deleted file mode 100644 (file)
index 240dd86..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.scenegraph;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.NonTransformableNode;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class NonVisibleNode extends NonTransformableNode {\r
-\r
-    public NonVisibleNode(IGraphicsNode parent, Graph graph, Resource resource) {\r
-        super(parent,resource);\r
-        if (!getG3DNode(graph).isInstanceOf(ProcessResource.plant3Dresource.NonVisibleComponent))\r
-                throw new RuntimeException("Resource must be instance of NonVisibleComponent");\r
-        \r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeComponentNode.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeComponentNode.java
deleted file mode 100644 (file)
index 2c204a2..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-package fi.vtt.simantics.processeditor.scenegraph;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Quat4d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.ShapeNode;\r
-\r
-import com.jme.math.Quaternion;\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.scene.state.RenderState;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.common.PipingTools;\r
-import fi.vtt.simantics.processeditor.stubs.CodedComponent;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.Plant3DResource;\r
-import fi.vtt.simantics.processeditor.stubs.SizeChangeControlPoint;\r
-\r
-\r
-/**\r
- * This is for hard-coded geometries\r
- * TODO : we need an extension point for geometries,\r
- *        so that other code-based geometries can be supported\r
- * \r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- *\r
- */\r
-public class PipeComponentNode extends ShapeNode {\r
-       \r
-       enum Type{ELBOW,STRAIGHT,REDUCER};\r
-       \r
-       Type type;\r
-       Resource controlPoint;\r
-\r
-       \r
-       public PipeComponentNode(ThreeDimensionalEditorBase editor, IGraphicsNode parent, Graph graph, Resource resource) {\r
-               super(editor, parent, graph, resource);\r
-               CodedComponent component = new CodedComponent(graph,resource);\r
-               PipeControlPoint cp = component.getControlPoint();\r
-               Plant3DResource p3r = ProcessResource.plant3Dresource;\r
-               controlPoint = cp.getResource();\r
-               \r
-               if (component.isInstanceOf(p3r.Elbow)) {\r
-                       type = Type.ELBOW;      \r
-               } else if (component.isInstanceOf(p3r.Straight)) {\r
-                       type = Type.STRAIGHT;\r
-               } else if (component.isInstanceOf(p3r.Elbow)) {\r
-                       type = Type.REDUCER;\r
-               }\r
-       \r
-       \r
-       }\r
-       \r
-       @Override\r
-       public Collection<RenderState> getMaterial() {\r
-               MaterialState ms = null;\r
-               ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-               ms.setEmissive(new ColorRGBA(0.f,0.f,0.f,0.f));\r
-       ms.setSpecular(new ColorRGBA(1.f,1.f,1.f,1.f));\r
-       ms.setEnabled(true);\r
-       ms.setShininess(128.f);\r
-       if (type == Type.ELBOW) {\r
-               ms.setDiffuse(new ColorRGBA(0.5f,0.5f,0.5f,0.f));\r
-               ms.setAmbient(new ColorRGBA(0.5f,0.5f,0.5f,0.f));\r
-       } else if (type == Type.STRAIGHT) {\r
-               ms.setDiffuse(new ColorRGBA(0.75f,0.75f,0.75f,0.f));\r
-               ms.setAmbient(new ColorRGBA(0.75f,0.75f,0.75f,0.f));\r
-       } else {\r
-               ms.setDiffuse(new ColorRGBA(0.6f,0.6f,0.6f,0.f));\r
-               ms.setAmbient(new ColorRGBA(0.6f,0.6f,0.6f,0.f));\r
-       } \r
-               List<RenderState> states = new ArrayList<RenderState>();\r
-               states.add(ms);\r
-               return states;\r
-       }\r
-       \r
-       \r
-       @Override\r
-       public void updateTransform(Graph graph) {\r
-               if (type == Type.REDUCER) {\r
-                       SizeChangeControlPoint sccp = new SizeChangeControlPoint(graph, controlPoint);\r
-                       Quat4d q = ControlPointTools.getControlPointLocalOrientationQuat(sccp, sccp.getRotationAngle()[0], true);\r
-                       update(q);\r
-               } \r
-               if (type != Type.STRAIGHT) {\r
-                       super.updateTransform(graph);\r
-               } else {\r
-                       transform.setLocalTranslation(0.f,0.f,0.f);\r
-                       transform.setLocalRotation(new Quaternion());\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeRunNode.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeRunNode.java
deleted file mode 100644 (file)
index b03a36f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.scenegraph;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.NonTransformableNode;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class PipeRunNode extends NonTransformableNode {\r
-\r
-    public PipeRunNode(IGraphicsNode parent, Graph graph, Resource resource) {\r
-        super(parent,resource);\r
-        if (!getG3DNode(graph).isInstanceOf(ProcessResource.plant3Dresource.PipeRun))\r
-                throw new RuntimeException("Resource must be instance of Pipeline");\r
-        \r
-    }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipelineComponentNode.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipelineComponentNode.java
deleted file mode 100644 (file)
index 07f20eb..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.scenegraph;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.ParameterizedModelNode;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipelineComponent;\r
-\r
-\r
-\r
-public class PipelineComponentNode extends ParameterizedModelNode {\r
-\r
-    boolean updating = false;\r
-    \r
-    public PipelineComponentNode(ThreeDimensionalEditorBase editor, IGraphicsNode parent, Graph graph, Resource resource) {\r
-        super(editor,parent,graph, resource, ProcessResource.plant3Dresource.HasGraphics);\r
-        PipelineComponent component = new PipelineComponent(graph, resource);\r
-        if(!component.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent))\r
-            throw new RuntimeException("Resource must be instance of Inline Component " + resource);\r
-        if (!(parent instanceof PipeRunNode))\r
-            throw new RuntimeException("Parent must be instance of PipelineNode " + parent.getResource() + " " + resource);\r
-\r
-        //PipeControlPoint pcp = component.getControlPoint();\r
-//        monitor = new StructuralChangeMonitor(\r
-//                new StructuralChangeListener[] { this }, pcp.getResource(), GlobalIdMap\r
-//                 .get(Layer0Mapping.HAS_PROPERTY));\r
-       updateTransform(graph);\r
-    }\r
-    \r
-//    public void handleUpdate(StructuralChangeMonitor monitor, GraphChangeEvent event) {\r
-//        if (updating)\r
-//            return;\r
-//        if (event.getParameter() instanceof InlineComponentNode)\r
-//            return;\r
-//        if (event.getTransactionId() == null)\r
-//            return;\r
-//        if (event.getParameter() instanceof AbstractGraphicsNode)\r
-//            return;\r
-//\r
-//        updating = true;\r
-//        updateTransform();\r
-//        updating = false;\r
-//    }\r
-    \r
-    public void updateTransform(Graph graph) {\r
-        super.updateTransform(graph);\r
-        /*\r
-        PipelineComponent component = new PipelineComponent(graph,shapeResource);\r
-    \r
-        PipeControlPoint pcp = component.getControlPoint();\r
-        Double angle = component.getAtMostOneRelatedScalarDouble(ProcessResource.plant3Dresource.HasRotationAngle);\r
-               double componentAngle = 0.0;\r
-               if (angle != null)\r
-                       componentAngle = angle;\r
-\r
-               AxisAngle4d aa = ControlPointTools.getControlPointRotation(pcp, componentAngle);\r
-               update(aa);\r
-               */\r
-       }\r
-    \r
-    \r
-    public void dispose() {\r
-        //monitor.dispose();\r
-        super.dispose();\r
-    }\r
-    \r
-\r
-    \r
-\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/ControlPointContribution.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/ControlPointContribution.java
deleted file mode 100644 (file)
index 2f3dba8..0000000
+++ /dev/null
@@ -1,431 +0,0 @@
-package fi.vtt.simantics.processeditor.tools;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.ByteArrayOutputStream;\r
-import java.net.URL;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import javax.vecmath.AxisAngle4d;\r
-import javax.vecmath.Point3d;\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Vector3d;\r
-\r
-import org.eclipse.core.runtime.FileLocator;\r
-import org.eclipse.core.runtime.Path;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.layout.FormAttachment;\r
-import org.eclipse.swt.layout.FormData;\r
-import org.eclipse.swt.layout.FormLayout;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.base.EditorContribution;\r
-import org.simantics.proconf.g3d.base.G3DTools;\r
-import org.simantics.proconf.g3d.base.MathTools;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.utils.ErrorLogger;\r
-\r
-import com.jme.renderer.ColorRGBA;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.Spatial;\r
-import com.jme.scene.TriMesh;\r
-import com.jme.scene.shape.Sphere;\r
-import com.jme.scene.state.MaterialState;\r
-import com.jme.util.export.Savable;\r
-import com.jme.util.export.binary.BinaryImporter;\r
-import com.jmex.model.converters.ObjToJme;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.common.PipeComponentProvider;\r
-import fi.vtt.simantics.processeditor.stubs.DirectedControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-\r
-public class ControlPointContribution implements EditorContribution {\r
-       private List<ContextAction> actions = new ArrayList<ContextAction>();\r
-       private ThreeDimensionalEditorBase parent;\r
-       private Resource componentResource;\r
-       private Resource controlPointResource;\r
-       \r
-       private Composite sideComposite;\r
-       \r
-       private double radius = 0.2;\r
-       private double radius2 = 0.1;\r
-       private double angle = Math.PI / 4.0;\r
-       \r
-       public ControlPointContribution(ThreeDimensionalEditorBase parent) {\r
-               this.parent = parent;\r
-       }\r
-       \r
-       @Override\r
-       public void createControl(Composite parent) {\r
-               FormLayout flayout = new FormLayout();\r
-               parent.setLayout(flayout);\r
-               sideComposite = new Composite(parent,SWT.BORDER);\r
-               FormData data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(sideComposite, 0, SWT.LEFT);\r
-               data.bottom = new FormAttachment(100,0);\r
-               this.parent.getRenderingComposite().setLayoutData(data);\r
-               GridLayout layout = new GridLayout(1,false);\r
-               layout.marginHeight = 1;\r
-               layout.marginWidth = 1;\r
-               sideComposite.setLayout(layout);\r
-               data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.bottom = new FormAttachment(100,0);\r
-               data.right = new FormAttachment(100,0);\r
-               sideComposite.setLayoutData(data);\r
-               \r
-               Button showCPButton = new Button(sideComposite,SWT.TOGGLE);\r
-               showCPButton.setText("Show CtrlPts");\r
-               showCPButton.addSelectionListener(new SelectionAdapter() {\r
-                       @Override\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               Button b = (Button)e.widget;\r
-                               showControlPoints(b.getSelection());\r
-                       }\r
-               });\r
-               \r
-               Button addCPButton = new Button(sideComposite,SWT.PUSH);\r
-               addCPButton.setText("Add CtrlPt");\r
-               addCPButton.addSelectionListener(new SelectionAdapter() {\r
-                       @Override\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               addControlPoint();\r
-                       }\r
-               });\r
-               \r
-               Button removeCPButton = new Button(sideComposite,SWT.PUSH);\r
-               removeCPButton.setText("Remove CtrlPt");\r
-               removeCPButton.addSelectionListener(new SelectionAdapter() {\r
-                       @Override\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               \r
-                       }\r
-               });\r
-               \r
-               Button showPipesButton = new Button(sideComposite,SWT.TOGGLE);\r
-               showPipesButton.setText("Pipes");\r
-               showPipesButton.addSelectionListener(new SelectionAdapter() {\r
-                       @Override\r
-                       public void widgetSelected(SelectionEvent e) {\r
-                               Button b = (Button)e.widget;\r
-                               showPipes(b.getSelection());\r
-                       }\r
-               });\r
-               \r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void disposeControl() {\r
-               sideComposite.dispose();        \r
-       }\r
-       \r
-       @Override\r
-       public void fillContextMenu(Graph graph, IMenuManager manager,\r
-                       StructuredResourceSelection selection) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalPullDown(IMenuManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalToolBar(IToolBarManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public Collection<ContextAction> getActions() {\r
-               return actions;\r
-       }\r
-       \r
-       @Override\r
-       public String getName() {\r
-               return "Control Points";\r
-       }\r
-       \r
-       List<Node> pipes = new ArrayList<Node>();\r
-       List<Node> controlPoints = new ArrayList<Node>();\r
-       \r
-       private void showPipes(boolean show) {\r
-               if (show) {\r
-                       if (!pipes.isEmpty()) {\r
-                               for (Node n : pipes) {\r
-                                       n.removeFromParent();\r
-                                       n.dispose();\r
-                               }\r
-                               pipes.clear();\r
-                       }\r
-                       parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       PipeControlPoint pcp = new PipeControlPoint(g,controlPointResource);\r
-                                       if (pcp.isInstanceOf(ProcessResource.plant3Dresource.EndComponentControlPoint)) {\r
-                                               Node n = new Node();\r
-                                               TriMesh mesh = new TriMesh();\r
-                                               Point3d p1 = new Point3d(-10.0,0.0,0.0);\r
-                                               Point3d p2 = new Point3d( 0.0,0.0,0.0);\r
-                                               PipeComponentProvider.createStraightGeometry(p1, p2, radius, new Geometry[]{mesh});\r
-                                               n.attachChild(mesh);\r
-                                               parent.getRenderingComponent().getShadowRoot().attachChild(n);\r
-                                               pipes.add(n);\r
-                                               \r
-                                       } else if (pcp.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                                               \r
-                                               double length = 0.5;\r
-                                               Double d = pcp.getAtMostOneRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-                                               if (d != null)\r
-                                                       length = d;\r
-                                               \r
-                                               double offset = 0.0;\r
-                                               d = pcp.getAtMostOneRelatedScalarDouble(ProcessResource.plant3Dresource.HasOffset);\r
-                                               if (d != null)\r
-                                                       offset = d;\r
-                                               \r
-                                               double r = radius;\r
-                                               if (pcp.isInstanceOf(ProcessResource.plant3Dresource.SizeChangeControlPoint)) {\r
-                                                       r = radius2;\r
-                                               }\r
-                                               \r
-                                               Node n = new Node();\r
-                                               TriMesh mesh = new TriMesh();\r
-                                               Point3d p1 = new Point3d(-10.0,0.0,0.0);\r
-                                               Point3d p2 = new Point3d( -length*0.5,0.0,0.0);\r
-                                               \r
-                                               PipeComponentProvider.createStraightGeometry(p1, p2, radius, new Geometry[]{mesh});\r
-                                               n.attachChild(mesh);\r
-                                               parent.getRenderingComponent().getShadowRoot().attachChild(n);\r
-                                               pipes.add(n);\r
-                                               \r
-                                               n = new Node();\r
-                                               mesh = new TriMesh();\r
-                                               p1 = new Point3d(10.0,offset,0.0);\r
-                                               p2 = new Point3d(length*0.5,offset,0.0);\r
-                                               \r
-                                               PipeComponentProvider.createStraightGeometry(p1, p2, r, new Geometry[]{mesh});\r
-                                               n.attachChild(mesh);\r
-                                               parent.getRenderingComponent().getShadowRoot().attachChild(n);\r
-                                               pipes.add(n);   \r
-                                               \r
-                                       } else if (pcp.isInstanceOf(ProcessResource.plant3Dresource.InlineControlPoint)) {\r
-                                               double length = 0.5;\r
-                                               Double d = pcp.getAtMostOneRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-                                               if (d != null)\r
-                                                       length = d;\r
-                                               \r
-                                               Node n = new Node();\r
-                                               TriMesh mesh = new TriMesh();\r
-                                               Point3d p1 = new Point3d(-10.0,0.0,0.0);\r
-                                               Point3d p2 = new Point3d( -length*0.5,0.0,0.0);\r
-                                               \r
-                                               PipeComponentProvider.createStraightGeometry(p1, p2, radius, new Geometry[]{mesh});\r
-                                               n.attachChild(mesh);\r
-                                               parent.getRenderingComponent().getShadowRoot().attachChild(n);\r
-                                               pipes.add(n);\r
-                                               \r
-                                               n = new Node();\r
-                                               mesh = new TriMesh();\r
-                                               p1 = new Point3d(10.0,0.0,0.0);\r
-                                               p2 = new Point3d(length*0.5,0.0,0.0);\r
-                                               \r
-                                               PipeComponentProvider.createStraightGeometry(p1, p2, radius, new Geometry[]{mesh});\r
-                                               n.attachChild(mesh);\r
-                                               parent.getRenderingComponent().getShadowRoot().attachChild(n);\r
-                                               pipes.add(n);\r
-                                       } else if (pcp.isInstanceOf(ProcessResource.plant3Dresource.TurnControlPoint)) {\r
-                                               double length = 0.5;\r
-                                               Double d = pcp.getAtMostOneRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength);\r
-                                               if (d != null)\r
-                                                       length = d;\r
-                                               \r
-                                               Node n = new Node();\r
-                                               TriMesh mesh = new TriMesh();\r
-                                               Point3d p1 = new Point3d(-10.0,0.0,0.0);\r
-                                               Point3d p2 = new Point3d( -length*0.5,0.0,0.0);\r
-                                               \r
-                                               PipeComponentProvider.createStraightGeometry(p1, p2, radius, new Geometry[]{mesh});\r
-                                               n.attachChild(mesh);\r
-                                               parent.getRenderingComponent().getShadowRoot().attachChild(n);\r
-                                               pipes.add(n);\r
-                                               \r
-                                               n = new Node();\r
-                                               mesh = new TriMesh();\r
-                                               p1 = new Point3d(10.0,0.0,0.0);\r
-                                               p2 = new Point3d(length*0.5,0.0,0.0);\r
-                                               Quat4d q = new Quat4d();\r
-                                               q.set(new AxisAngle4d(0.0,1.0,0.0,angle));\r
-                                               MathTools.rotate(q, p1, p1);\r
-                                               MathTools.rotate(q, p2, p2);\r
-\r
-                                               PipeComponentProvider.createStraightGeometry(p1, p2, radius, new Geometry[]{mesh});\r
-                                               n.attachChild(mesh);\r
-                                               parent.getRenderingComponent().getShadowRoot().attachChild(n);\r
-                                               pipes.add(n);\r
-                                       } else if (pcp.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)) {\r
-                                               Node n = new Node();\r
-                                               TriMesh mesh = new TriMesh();\r
-                                               Point3d p1 = new Point3d(10.0,0.0,0.0);\r
-                                               Point3d p2 = new Point3d( 0.0,0.0,0.0);\r
-                                               PipeComponentProvider.createStraightGeometry(p1, p2, radius, new Geometry[]{mesh});\r
-                                               n.attachChild(mesh);\r
-                                               parent.getRenderingComponent().getShadowRoot().attachChild(n);\r
-                                               pipes.add(n);\r
-                                       }\r
-                                       \r
-                                       if(!pcp.isInstanceOf(ProcessResource.plant3Dresource.DualInlineControlPoint)) {\r
-                                               Collection<PipeControlPoint> subPoints = pcp.getSubPoint();\r
-                                               \r
-                                       }\r
-                                       \r
-                                       parent.setViewChanged(true);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-               } else {\r
-                       if (!pipes.isEmpty()) {\r
-                               for (Node n : pipes) {\r
-                                       n.removeFromParent();\r
-                                       n.dispose();\r
-                               }\r
-                               pipes.clear();\r
-                               parent.setViewChanged(true);\r
-                       }\r
-               }\r
-       }\r
-       \r
-       private void showControlPoints(boolean show) {\r
-               if (show) {\r
-                       if (!controlPoints.isEmpty()) {\r
-                               for (Node n : controlPoints) {\r
-                                       n.removeFromParent();\r
-                                       n.dispose();\r
-                               }\r
-                                       \r
-                       }\r
-                       parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                               @Override\r
-                               public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                       \r
-                                       PipeControlPoint pcp = new PipeControlPoint(g,controlPointResource);\r
-                                       Vector3d p = G3DTools.getVector(pcp.getWorldPosition());\r
-                                       Node n = new Node();\r
-                                       Spatial sphere = new Sphere("",5,8,0.1f);\r
-                                       n.attachChild(sphere);\r
-                                       n.setLocalTranslation(VecmathJmeTools.get(p));\r
-                                       MaterialState ms = parent.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-                                       ms.setDiffuse(new ColorRGBA(1.f,0.f,0.f,0.f));\r
-                                       sphere.setRenderState(ms);\r
-                                       sphere.setName(Long.toString(pcp.getResource().getResourceId()));\r
-                                       parent.getRenderingComponent().getNoShadowRoot().attachChild(n);\r
-                                       controlPoints.add(n);\r
-                                       Collection<PipeControlPoint> subPoints = pcp.getSubPoint();\r
-                                       ms = parent.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState();\r
-                                       ms.setDiffuse(new ColorRGBA(0.f,1.f,0.f,0.f));\r
-                                       for (PipeControlPoint cp : subPoints) {\r
-                                               p = G3DTools.getVector(cp.getWorldPosition());\r
-                                               n = new Node();\r
-                                               if (cp.isInstanceOf(ProcessResource.plant3Dresource.DirectedControlPoint)) {\r
-                                                       sphere = getDCPMesh();\r
-                                                       if (sphere == null)\r
-                                                               sphere = new Sphere("",5,8,0.1f);\r
-                                               } else {\r
-                                                       sphere = new Sphere("",5,8,0.1f);\r
-                                               }\r
-                                               sphere.setName(Long.toString(cp.getResource().getResourceId()));\r
-                                               n.attachChild(sphere);\r
-                                               n.setLocalTranslation(VecmathJmeTools.get(p));\r
-                                               sphere.setRenderState(ms);\r
-                                               parent.getRenderingComponent().getNoShadowRoot().attachChild(n);\r
-                                               controlPoints.add(n);\r
-                                       }\r
-                                       parent.setViewChanged(true);\r
-                                       return GraphRequestStatus.transactionComplete();\r
-                               }\r
-                       });\r
-               } else {\r
-                       if (!controlPoints.isEmpty()) {\r
-                               for (Node n : controlPoints) {\r
-                                       n.removeFromParent();\r
-                                       n.dispose();\r
-                               }\r
-                               parent.setViewChanged(true);\r
-                       }\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public void initialize(Graph graph) {\r
-               Resource modelResource = parent.getInputResource();\r
-               Resource inverse = graph.getInverse(ProcessResource.plant3Dresource.HasGraphics);\r
-               Collection<Resource> equipment = graph.getObjects(modelResource, inverse);\r
-               if (equipment.size() != 1)\r
-                       throw new RuntimeException("Cannot find component for model " + modelResource);\r
-               componentResource = equipment.iterator().next();\r
-               Collection<Resource> pcp = graph.getObjects(componentResource, ProcessResource.plant3Dresource.HasControlPoint);\r
-               if (pcp.size() != 1)\r
-                       throw new RuntimeException("Cannot find control point for component " + componentResource);\r
-               controlPointResource = pcp.iterator().next();\r
-       }\r
-       \r
-       @Override\r
-       public void dispose() {\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void run() {\r
-\r
-       }\r
-       \r
-       private void addControlPoint() {\r
-               parent.getSession().asyncWrite(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               DirectedControlPoint dcp = DirectedControlPoint.createDefault(g);\r
-                               PipeControlPoint pcp = new PipeControlPoint(g,controlPointResource);\r
-                               pcp.addStatement(ProcessResource.plant3Dresource.HasSubPoint, dcp);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-       }\r
-       \r
-       private Spatial getDCPMesh() {\r
-               try {\r
-                       ObjToJme converter=new ObjToJme();\r
-                       String file = "data/dcp.obj";\r
-                       URL objFile=FileLocator.find(Activator.getDefault().getBundle(),new Path(file),null);\r
-                       converter.setProperty("mtllib",objFile);\r
-                       ByteArrayOutputStream BO=new ByteArrayOutputStream();\r
-                       //System.out.println("Starting to convert .obj to .jme");\r
-                       converter.convert(objFile.openStream(),BO);\r
-        \r
-                       Savable s = BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));\r
-                       return (Spatial)s;\r
-               } catch (Exception e) {\r
-                       ErrorLogger.defaultLogError(e);\r
-                       return null;\r
-               }\r
-       }\r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/NozzleContribution.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/NozzleContribution.java
deleted file mode 100644 (file)
index 91f65ba..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-package fi.vtt.simantics.processeditor.tools;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IContributionItem;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.layout.FormAttachment;\r
-import org.eclipse.swt.layout.FormData;\r
-import org.eclipse.swt.layout.FormLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.base.EditorContribution;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-\r
-public class NozzleContribution implements EditorContribution {\r
-       private List<ContextAction> actions = new ArrayList<ContextAction>();\r
-       private ThreeDimensionalEditorBase parent;\r
-       private Resource equipmentResource;\r
-       private Composite sideComposite;\r
-       \r
-       public NozzleContribution(ThreeDimensionalEditorBase parent) {\r
-               this.parent = parent;\r
-       }\r
-       \r
-       @Override\r
-       public void createControl(Composite parent) {\r
-               FormLayout flayout = new FormLayout();\r
-               parent.setLayout(flayout);\r
-               sideComposite = new Composite(parent,SWT.BORDER);\r
-               FormData data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(sideComposite, 0, SWT.LEFT);\r
-               data.bottom = new FormAttachment(100,0);\r
-               this.parent.getRenderingComposite().setLayoutData(data);\r
-               sideComposite.setLayout(new FillLayout(SWT.VERTICAL));\r
-               data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.bottom = new FormAttachment(100,0);\r
-               data.right = new FormAttachment(100,0);\r
-               sideComposite.setLayoutData(data);\r
-               showNozzles(true);\r
-               \r
-               Button addButton = new Button(sideComposite,SWT.PUSH);\r
-               addButton.setText("Add Nozzle");\r
-               Label label = new Label(sideComposite,SWT.NONE);\r
-               label.setText("Restrictions:");\r
-               Button minButton = new Button(sideComposite,SWT.CHECK);\r
-               minButton.setText("Min");\r
-               Text minText = new Text(sideComposite,SWT.SINGLE | SWT.BORDER);\r
-               Button maxButton = new Button(sideComposite,SWT.CHECK);\r
-               maxButton.setText("Max");\r
-               Text maxText = new Text(sideComposite,SWT.SINGLE | SWT.BORDER);\r
-               minText.setToolTipText("Enter minimum number of nozzles");\r
-               maxText.setToolTipText("Enter maximum number of nozzles");\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void disposeControl() {\r
-               sideComposite.dispose();\r
-               \r
-       }\r
-       @Override\r
-       public void fillContextMenu(Graph graph, IMenuManager manager,\r
-                       StructuredResourceSelection selection) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalPullDown(IMenuManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalToolBar(IToolBarManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public Collection<ContextAction> getActions() {\r
-               return actions;\r
-       }\r
-       \r
-       @Override\r
-       public String getName() {\r
-               return "Nozzles";\r
-       }\r
-       \r
-       private void showNozzles(boolean show) {\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void initialize(Graph graph) {\r
-               Resource modelResource = parent.getInputResource();\r
-               Resource inverse = graph.getInverse(ProcessResource.plant3Dresource.HasGraphics);\r
-               Collection<Resource> equipment = graph.getObjects(modelResource, inverse);\r
-               if (equipment.size() != 1)\r
-                       throw new RuntimeException("Cannot find equipment");\r
-               equipmentResource = equipment.iterator().next();\r
-       }\r
-       \r
-       @Override\r
-       public void dispose() {\r
-               showNozzles(false);\r
-       }\r
-       \r
-       @Override\r
-       public void run() {\r
-\r
-       }\r
-       \r
-       \r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/PlantEditContribution.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/PlantEditContribution.java
deleted file mode 100644 (file)
index e411131..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-package fi.vtt.simantics.processeditor.tools;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.layout.FormAttachment;\r
-import org.eclipse.swt.layout.FormData;\r
-import org.eclipse.swt.layout.FormLayout;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.actions.FocusAction;\r
-import org.simantics.proconf.g3d.actions.RemoveAction;\r
-import org.simantics.proconf.g3d.actions.RotateAction;\r
-import org.simantics.proconf.g3d.actions.TranslateAction;\r
-import org.simantics.proconf.g3d.base.EditorContribution;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.utils.ui.jface.MenuTools;\r
-\r
-import com.jme.intersection.CollisionData;\r
-import com.jme.intersection.CollisionResults;\r
-import com.jme.intersection.TriangleCollisionResults;\r
-import com.jme.scene.Geometry;\r
-import com.jme.scene.Node;\r
-import com.jme.scene.Spatial;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.actions.InsertComponentAction;\r
-import fi.vtt.simantics.processeditor.actions.InsertEquipmentAction;\r
-import fi.vtt.simantics.processeditor.actions.InsertNozzleAction;\r
-import fi.vtt.simantics.processeditor.actions.ReversePipelineAction;\r
-import fi.vtt.simantics.processeditor.actions.RoutePipeAction;\r
-import fi.vtt.simantics.processeditor.actions.TranslateElbowAction;\r
-import fi.vtt.simantics.processeditor.actions.TranslateInlineComponentAction;\r
-import fi.vtt.simantics.processeditor.actions.TranslateStraightAction;\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.stubs.InlineComponent;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.views.ProcessEditor;\r
-\r
-public class PlantEditContribution implements EditorContribution {\r
-       private List<ContextAction> actions = new ArrayList<ContextAction>();\r
-       private ProcessEditor parent;\r
-       private Composite infoComposite;\r
-       private Text infoText;\r
-       \r
-       private Action checkInterferencesAction = null;\r
-       \r
-       public PlantEditContribution(ProcessEditor parent) {\r
-               this.parent = parent;\r
-       }\r
-       \r
-       @Override\r
-       public void createControl(Composite parent) {\r
-               FormLayout flayout = new FormLayout();\r
-               parent.setLayout(flayout);\r
-               infoComposite = new Composite(parent, SWT.BORDER);\r
-               FormData data = new FormData();\r
-               data.top = new FormAttachment(0, 0);\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(100, 0);\r
-               data.bottom = new FormAttachment(infoComposite, 0, SWT.TOP);\r
-               this.parent.getRenderingComposite().setLayoutData(data);\r
-               data = new FormData();\r
-               data.left = new FormAttachment(0, 0);\r
-               data.right = new FormAttachment(100, 0);\r
-               data.bottom = new FormAttachment(100, 0);\r
-               data.height = 18;\r
-               infoComposite.setLayoutData(data);\r
-               GridLayout layout = new GridLayout(1,false);\r
-               layout.marginWidth = 1;\r
-               layout.marginHeight = 1;\r
-               infoComposite.setLayout(layout);\r
-               infoText = new Text(infoComposite, SWT.NONE);\r
-               GridData gdata = new GridData();\r
-               gdata.grabExcessHorizontalSpace = true;\r
-               gdata.horizontalAlignment = SWT.FILL;\r
-               infoText.setLayoutData(gdata);\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void disposeControl() {\r
-               infoComposite.dispose();\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void dispose() {\r
-\r
-       }\r
-       \r
-       \r
-       \r
-       @Override\r
-       public void fillContextMenu(Graph graph, IMenuManager manager,\r
-                       StructuredResourceSelection selection) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalPullDown(IMenuManager manager) {\r
-               MenuTools.getOrCreate(parent.getMenuID(),"Advanced", manager).add(checkInterferencesAction);\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalToolBar(IToolBarManager manager) {\r
-\r
-       }\r
-       \r
-       @Override\r
-       public Collection<ContextAction> getActions() {\r
-               return actions;\r
-       }\r
-       \r
-       @Override\r
-       public String getName() {\r
-               return "Plant Editing";\r
-       }\r
-       \r
-       @Override\r
-       public void initialize(Graph graph) {\r
-               actions.add(new TranslateAction(parent){\r
-            @Override\r
-            public boolean usable(Graph graph,List<Resource> resources) {\r
-                if (super.usable(graph, resources)) {\r
-                    for (Resource r : resources) {\r
-                       // FIXME : use new ontology :\r
-                       // 1. lose ends works like end components (just what this code does, but type checks are not correct)\r
-                       // 2. connected components are moved inline. (TranslateInlineAction)\r
-                       IEntity t = EntityFactory.create(graph, r);\r
-                        if (t.isInstanceOf(ProcessResource.plant3Dresource.InlineComponent)) {\r
-                            InlineComponent component = new InlineComponent(t);\r
-                               PipeControlPoint pcp = component.getControlPoint();\r
-                               if (pcp.getNext() != null && pcp.getPrevious() != null)\r
-                                       return false;\r
-                        }\r
-                    }\r
-                    return true;\r
-                }\r
-                return false;\r
-            }\r
-            \r
-            @Override\r
-            public void setInfoText(String text) {\r
-               infoText.setText(text);\r
-            }\r
-        });\r
-        actions.add(new TranslateInlineComponentAction(parent) {\r
-               @Override\r
-               public void setInfoText(String text) {\r
-                       infoText.setText(text);\r
-               }\r
-        });\r
-        actions.add(new TranslateStraightAction(parent) {\r
-               @Override\r
-               public void setInfoText(String text) {\r
-                       infoText.setText(text);\r
-               }\r
-        });\r
-        actions.add(new TranslateElbowAction(parent) {\r
-               @Override\r
-               public void setInfoText(String text) {\r
-                       infoText.setText(text);\r
-               }\r
-        });\r
-        actions.add(new RotateAction(parent){\r
-            @Override\r
-            public boolean usable(Graph graph,List<Resource> resources) {\r
-                if (super.usable(graph,resources)) {\r
-                    for (Resource r : resources) {\r
-                       IEntity t = EntityFactory.create(graph,r);\r
-                       // FIXME : use new ontology\r
-                       // TODO : create rotate action that can rotate inline components\r
-                       // TODO : ontology change: pipes and similar components cannot be rotated, since there is no point to do that.\r
-                       if (t.isInstanceOf(ProcessResource.plant3Dresource.InlineComponent)) {\r
-                               return false;\r
-                       }\r
-                    }\r
-                    return true;\r
-                }\r
-                \r
-                return false;\r
-            }\r
-            \r
-            @Override\r
-            public void setInfoText(String text) {\r
-               infoText.setText(text);\r
-            }\r
-        });\r
-        actions.add(new RemoveAction(parent) {\r
-               @Override\r
-                       public GraphRequestStatus doChanges(Graph graph) {\r
-                               Iterator<Resource> i = parent.getSelectionAdapter().getCurrentSelection().iterator();\r
-                               while (i.hasNext()) {\r
-                                               Resource s = i.next();\r
-                                               IEntity r = EntityFactory.create(graph, s);\r
-                                               if (r.isInstanceOf(ProcessResource.g3dResource.G3DNode)) {\r
-                                                       Collection<IEntity> parentNode= r.getRelatedObjects(ProcessResource.g3dResource.HasParent);\r
-                                                       if (parentNode.size() == 1) {\r
-                                                               Collection<IEntity> rs = r.getRelatedObjects(ProcessResource.plant3Dresource.HasControlPoint);\r
-                                                               for (IEntity cp  : rs) {\r
-                                                                       ControlPointTools.removeControlPoint(new PipeControlPoint(cp));\r
-                                                               }\r
-                                                               r.removeRelatedStatements(ProcessResource.g3dResource.HasParent);\r
-                                                       } else {\r
-                                                               if (parentNode.size() == 0) {\r
-                                                                       parent.showMessage("Object has no parent, don't know what to do!");\r
-                                                               } else {\r
-                                                                       parent.showMessage("Object has more than one parent, don't know what to do!");\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-\r
-                                       }\r
-                                       //parent.getSelectionAdapter().setSelection(new StructuredResourceSelection());\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-        actions.add(new FocusAction(parent));\r
-        actions.add(new RoutePipeAction(parent){\r
-               @Override\r
-               public void setInfoText(String text) {\r
-                       infoText.setText(text);\r
-               }\r
-        });   \r
-        actions.add(new InsertComponentAction(parent));\r
-        actions.add(new InsertEquipmentAction(parent));\r
-        actions.add(new InsertNozzleAction(parent));\r
-        actions.add(new ReversePipelineAction(parent));\r
-        \r
-        checkInterferencesAction = new Action() {\r
-               public void run() {\r
-                       CollisionResults results = new TriangleCollisionResults();\r
-                       //getRenderingComponent().getNormalRoot().calculateCollisions(getRenderingComponent().getNormalRoot(), results);\r
-                       collide(parent.getRenderingComponent().getShadowRoot(),parent.getRenderingComponent().getShadowRoot(),results);\r
-                       results = filterResults(results);\r
-                       for (int i = 0; i < results.getNumber(); i++) {\r
-                               CollisionData data = results.getCollisionData(i);\r
-                               Geometry s =  data.getSourceMesh();\r
-                               Geometry t = data.getTargetMesh();\r
-                               MessageDialog dialog = new MessageDialog(parent.getRenderingComposite().getShell(),"Interference " + i + " / " + results.getNumber(), null, "Interference between " + s + " and " + t,MessageDialog.WARNING,new String[]{"Next","Cancel"},0);\r
-                               try {\r
-                                       Resource sid = parent.getScenegraphAdapter().getNodeResource(s.getName());\r
-                                       Resource tid = parent.getScenegraphAdapter().getNodeResource(t.getName());\r
-\r
-                                       StructuredResourceSelection sel = new StructuredResourceSelection();\r
-                                       if (sid == tid) {\r
-                                               sel.add(sid);\r
-                                       } else {\r
-                                               sel.add(sid);\r
-                                               sel.add(tid);\r
-                                       }\r
-                                       parent.getSelectionAdapter().setSelection(sel);\r
-                               } catch(NumberFormatException e) {\r
-                                       \r
-                               }\r
-                               if (dialog.open() == 1)\r
-                                       break;\r
-                       }\r
-               }\r
-               \r
-               private void collide(Spatial s, Spatial p, CollisionResults r) {\r
-                       s.calculateCollisions(p, r);\r
-                       if (s instanceof Node) {\r
-                               Node n = (Node)s;\r
-                               for (Spatial t : n.getChildren())\r
-                                       collide(t,p,r);\r
-                       }\r
-               }\r
-               \r
-               private CollisionResults filterResults(CollisionResults results) {\r
-                       CollisionResults r = new TriangleCollisionResults();\r
-                       for (int i = 0; i < results.getNumber(); i++) {\r
-                               CollisionData d = results.getCollisionData(i);\r
-                               if (d.getSourceMesh() == d.getTargetMesh())\r
-                                       continue;\r
-                               boolean found = false;\r
-                               for (int j = 0; j < r.getNumber(); j++) {\r
-                                       CollisionData d2 = r.getCollisionData(j);\r
-                                       if (d2.getSourceMesh() == d.getSourceMesh() &&\r
-                                               d2.getTargetMesh() == d.getTargetMesh()) {\r
-                                               found = true;\r
-                                               break;\r
-                                       }\r
-                                       if (d2.getSourceMesh() == d.getTargetMesh() &&\r
-                                       d2.getTargetMesh() == d.getSourceMesh()) {\r
-                                       found = true;\r
-                                       break;\r
-                               }               \r
-                               }\r
-                               if (!found) {\r
-                                       if (d.getSourceTris().size() == 0)\r
-                                               continue;\r
-                                       if (d.getTargetTris().size() == 0)\r
-                                               continue;\r
-                                       r.addCollisionData(d);\r
-                               }\r
-                       }\r
-                       return r;\r
-               }\r
-\r
-        };\r
-        checkInterferencesAction.setText("Interferences");\r
-        checkInterferencesAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/delete.png"));\r
-        \r
-       }\r
-       \r
-       @Override\r
-       public void run() {\r
-               \r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/PlantVisualizationContribution.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/tools/PlantVisualizationContribution.java
deleted file mode 100644 (file)
index 42b93f0..0000000
+++ /dev/null
@@ -1,376 +0,0 @@
-package fi.vtt.simantics.processeditor.tools;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-import java.util.Stack;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.GraphRequestAdapter;\r
-import org.simantics.db.GraphRequestStatus;\r
-import org.simantics.db.Resource;\r
-import org.simantics.proconf.g3d.actions.ContextAction;\r
-import org.simantics.proconf.g3d.actions.FocusAction;\r
-import org.simantics.proconf.g3d.animation.Animatable;\r
-import org.simantics.proconf.g3d.animation.AnimationController;\r
-import org.simantics.proconf.g3d.animation.AnimationSystem;\r
-import org.simantics.proconf.g3d.animation.TestAnimationController;\r
-import org.simantics.proconf.g3d.animation.ui.AnimationControlCreator;\r
-import org.simantics.proconf.g3d.base.EditorContribution;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.utils.ui.jface.MenuTools;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.animations.PipeAnimationController;\r
-import fi.vtt.simantics.processeditor.dialogs.ConfigureAnimationDialog;\r
-import fi.vtt.simantics.processeditor.dialogs.ConfigureMonitorDialog;\r
-import fi.vtt.simantics.processeditor.dialogs.ConfigurePipelineAnimationDialog;\r
-import fi.vtt.simantics.processeditor.monitors.Monitor;\r
-import fi.vtt.simantics.processeditor.monitors.ResourcePathPropertyProvider;\r
-import fi.vtt.simantics.processeditor.monitors.TextMonitor;\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-import fi.vtt.simantics.processeditor.views.ProcessEditor;\r
-\r
-public class PlantVisualizationContribution implements EditorContribution {\r
-       private List<ContextAction> actions = new ArrayList<ContextAction>();\r
-       private ProcessEditor parent;\r
-       \r
-    private AnimationSystem animationSystem = null;\r
-    private Action animatePipesAction = null;\r
-    private Action animateAction = null;\r
-    private Action showMonitorsAction = null;\r
-    private Action configureAnimationAction = null;\r
-    private Action configurePipelineAnimationAction = null;\r
-    private Action configureMonitorAction = null;\r
-    \r
-    private Monitor monitor;\r
-       \r
-       public PlantVisualizationContribution(ProcessEditor parent) {\r
-               this.parent = parent;\r
-       }\r
-       \r
-       @Override\r
-       public void createControl(Composite parent) {\r
-               parent.setLayout(new FillLayout());\r
-               this.parent.getRenderingComposite().setLayoutData(null);\r
-       }\r
-       \r
-       @Override\r
-       public void disposeControl() {\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void dispose() {\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void fillContextMenu(Graph graph, IMenuManager manager,\r
-                       StructuredResourceSelection selection) {\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void fillLocalPullDown(IMenuManager menuManager) {\r
-               MenuTools.getOrCreate(parent.getMenuID(),"Monitors", menuManager).add(showMonitorsAction);\r
-       MenuTools.getOrCreate(parent.getMenuID(),"Monitors", menuManager).add(configureMonitorAction);\r
-       IMenuManager animationMenu = MenuTools.getOrCreate(parent.getMenuID(),"Animations",menuManager);\r
-       animationMenu.add(configureAnimationAction);\r
-       animationMenu.add(configurePipelineAnimationAction);\r
-       MenuTools.getOrCreate(parent.getMenuID(),"Test", animationMenu).add(animateAction);\r
-       MenuTools.getOrCreate(parent.getMenuID(),"Test", animationMenu).add(animatePipesAction);\r
-               \r
-       }\r
-       \r
-//     @Override\r
-//     public void fillMainMenu(List<IContributionItem> list) {\r
-//             MenuTools.getOrCreate("Monitors", list).add(showMonitorsAction);\r
-//     MenuTools.getOrCreate("Monitors", list).add(configureMonitorAction);\r
-//     IMenuManager animationMenu = MenuTools.getOrCreate("Animations",list);\r
-//     animationMenu.add(configureAnimationAction);\r
-//     animationMenu.add(configurePipelineAnimationAction);\r
-//     MenuTools.getOrCreate("Test", animationMenu).add(animateAction);\r
-//     MenuTools.getOrCreate("Test", animationMenu).add(animatePipesAction);\r
-//             \r
-//     }\r
-       \r
-       @Override\r
-       public void fillLocalToolBar(IToolBarManager manager) {\r
-               AnimationControlCreator c = new AnimationControlCreator(getAnimationSystem());\r
-        manager.add(c.createStopAction());\r
-        manager.add(c.createPauseAction());\r
-        manager.add(c.createPlayAction());\r
-               manager.add(showMonitorsAction);\r
-       }\r
-       \r
-       @Override\r
-       public Collection<ContextAction> getActions() {\r
-               return actions;\r
-       }\r
-       \r
-       @Override\r
-       public String getName() {\r
-               return "Plant Visualization";\r
-       }\r
-       \r
-       @Override\r
-       public void run() {\r
-               parent.getSession().syncRead(new GraphRequestAdapter() {\r
-                       @Override\r
-                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                               getAnimationSystem().run(g,0.01);\r
-                               updateMonitor(g);\r
-                               return GraphRequestStatus.transactionComplete();\r
-                       }\r
-               });\r
-               \r
-               \r
-       }\r
-       \r
-       @Override\r
-       public void initialize(Graph graph) {\r
-                animateAction = new Action("", Action.AS_CHECK_BOX) {\r
-                   public void run() {\r
-                       if (this.isChecked()) {\r
-                               parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                                       @Override\r
-                                       public GraphRequestStatus perform(Graph g)\r
-                                                       throws Exception {\r
-                                               AnimationController c = new TestAnimationController();\r
-                                                       Collection<IGraphicsNode> nodes = parent.getScenegraphAdapter().getNodes();\r
-                                                       for (IGraphicsNode node : nodes) {\r
-                                                               if (node instanceof Animatable) {\r
-                                                                       Animatable a = (Animatable) node;\r
-                                                                       if (a.setRandomAnimation(g))\r
-                                                                               c.addAnimatable(a);\r
-                                                               }\r
-                                                       }\r
-                                                       animationSystem.add(c);\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                       }\r
-                               });\r
-                               \r
-//                                             showMessage("Activated " + animatables.size()\r
-//                                                             + " animations");\r
-                                       } else {\r
-                                               animationSystem.stop();\r
-                                       }\r
-                   }\r
-               };\r
-               \r
-               animateAction.setText("Random animations");\r
-               \r
-               animatePipesAction = new AnimatePipesAction("Pipe animations");\r
-               \r
-               showMonitorsAction = new Action("Interactive Monitor", Action.AS_CHECK_BOX) {\r
-                       public void run() {\r
-                               showMonitors(this.isChecked());\r
-                       }\r
-               };\r
-               showMonitorsAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/monitor.png"));\r
-               \r
-               \r
-               \r
-               configureAnimationAction = new Action() {\r
-                       \r
-                       public void run() {\r
-                               parent.getSession().syncRead(new GraphRequestAdapter(){\r
-                                       List <Resource> list = new ArrayList<Resource>();\r
-                                       @Override\r
-                                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                               Stack<G3DNode> stack = new Stack<G3DNode>();\r
-                                               stack.add(parent.getPlant(g).toG3DNode());\r
-                                               while (!stack.isEmpty()) {\r
-                                                       G3DNode n = stack.pop();\r
-                                                       list.add(n.getResource());\r
-                                                       for (G3DNode no : n.getChild())\r
-                                                               stack.push(no);\r
-                                               }\r
-                                               \r
-                                               if (list.size() == 0)\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               \r
-                                               ConfigureAnimationDialog dialog = new ConfigureAnimationDialog(parent.getRenderingComposite().getShell(),parent.getSession(),list,parent.getScenegraphAdapter(),getAnimationSystem());\r
-                                               dialog.open();\r
-                                               return GraphRequestStatus.transactionComplete();\r
-                                       }\r
-                                       \r
-                               });\r
-\r
-                       }\r
-                       \r
-                       \r
-               };\r
-               configureAnimationAction.setText("Configure animations");\r
-               configureAnimationAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/film_edit.png"));\r
-               \r
-               configurePipelineAnimationAction = new Action() {\r
-                       \r
-                       public void run() {\r
-                               parent.getSession().syncRead(new GraphRequestAdapter(){\r
-                                       List <Resource> list = new ArrayList<Resource>();\r
-                                       @Override\r
-                                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                               Stack<G3DNode> stack = new Stack<G3DNode>();\r
-                                               stack.add(parent.getPlant(g).toG3DNode());\r
-                                               while (!stack.isEmpty()) {\r
-                                                       G3DNode n = stack.pop();\r
-                                                       if (n.isInstanceOf(ProcessResource.plant3Dresource.PipeRun))\r
-                                                               list.add(n.getResource());\r
-                                                       else //piperun will not contain other piperuns\r
-                                                               for (G3DNode no : n.getChild())\r
-                                                                       stack.push(no);\r
-                                               }\r
-                                               \r
-                                               if (list.size() == 0)\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               \r
-                                               ConfigurePipelineAnimationDialog dialog = new ConfigurePipelineAnimationDialog(parent.getRenderingComposite().getShell(),parent.getSession(),list,parent.getRenderingComponent(),getAnimationSystem());\r
-                                               dialog.open();\r
-                                               return GraphRequestStatus.transactionComplete();\r
-                                       }\r
-                                       \r
-                               });\r
-                               \r
-                       }\r
-                       \r
-                       \r
-               };\r
-               configurePipelineAnimationAction.setText("Configure pipeline animations");\r
-               configurePipelineAnimationAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/film_edit.png"));\r
-               configureMonitorAction = new Action() {\r
-                       \r
-                       public void run() {\r
-                               parent.getSession().syncRead(new GraphRequestAdapter(){\r
-                                       List <Resource> list = new ArrayList<Resource>();\r
-                                       @Override\r
-                                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                               Stack<G3DNode> stack = new Stack<G3DNode>();\r
-                                               stack.add(parent.getPlant(g).toG3DNode());\r
-                                               while (!stack.isEmpty()) {\r
-                                                       G3DNode n = stack.pop();\r
-                                                       list.add(n.getResource());\r
-                                                       for (G3DNode no : n.getChild())\r
-                                                               stack.push(no);\r
-                                               }\r
-                                               \r
-                                               if (list.size() == 0)\r
-                                                       return GraphRequestStatus.transactionComplete();\r
-                                               \r
-                                               ConfigureMonitorDialog dialog = new ConfigureMonitorDialog(parent.getRenderingComposite().getShell(),parent.getSession(),list);\r
-                                               dialog.open();\r
-                                               return GraphRequestStatus.transactionComplete();\r
-                                       }\r
-                                       \r
-                               });\r
-                               \r
-                       }\r
-               };\r
-               configureMonitorAction.setText("Configure monitor");\r
-               configureMonitorAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/monitor_edit.png"));\r
-               \r
-               actions.add(new FocusAction(parent));\r
-       }\r
-       \r
-        private AnimationSystem getAnimationSystem() {\r
-               if (animationSystem == null) {\r
-                       animationSystem = new AnimationSystem(parent.getScenegraphAdapter());\r
-               }\r
-               return animationSystem;\r
-        }\r
-        \r
-        protected void updateMonitor(Graph graph) {\r
-               if (showMonitorsAction.isChecked()) {\r
-               \r
-                       List<IGraphicsNode> nodes = parent.getSelectionAdapter().getInteractiveSelectedObjects();\r
-                               if (nodes.size() > 0) {\r
-                                       IGraphicsNode selected = nodes.get(0);\r
-                                       if (monitor.acceptNode(graph,selected))\r
-                                               monitor.setNode(graph,selected);\r
-                               }\r
-                               monitor.update();\r
-               }\r
-           }\r
-           \r
-           protected Monitor createMonitor() {\r
-               Monitor m = new TextMonitor(parent);\r
-               m.setTextProvider(new ResourcePathPropertyProvider());\r
-               return m;\r
-           }\r
-           \r
-           private  void showMonitors(boolean show) {\r
-               if (show) {\r
-                       if (monitor == null) {\r
-                               monitor = createMonitor();\r
-                       }\r
-                       final List <IGraphicsNode> nodes = parent.getSelectionAdapter().getInteractiveSelectedObjects();\r
-                       if (nodes.size() > 0) {\r
-                               parent.getSession().asyncRead(new GraphRequestAdapter() {\r
-                                       @Override\r
-                                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                               monitor.setNode(g,nodes.get(0));\r
-                                               return GraphRequestStatus.transactionComplete();\r
-                                       }\r
-                               });\r
-                               \r
-                       }\r
-                       \r
-               } else if (!show && monitor != null) {\r
-                       monitor.remove();\r
-                       parent.setViewChanged(true);\r
-               }\r
-           }\r
-        \r
-        private class AnimatePipesAction extends Action {\r
-\r
-               public AnimatePipesAction(String text) {\r
-                       super(text, Action.AS_CHECK_BOX);\r
-\r
-               }\r
-\r
-               public void run() {\r
-                       if (this.isChecked()) {\r
-                               parent.getSession().syncRead(new GraphRequestAdapter() {\r
-                                       List<PipeRun> list = new ArrayList<PipeRun>();\r
-\r
-                                       @Override\r
-                                       public GraphRequestStatus perform(Graph g) throws Exception {\r
-                                               Stack<G3DNode> stack = new Stack<G3DNode>();\r
-                                               stack.add(parent.getPlant(g).toG3DNode());\r
-                                               while (!stack.isEmpty()) {\r
-                                                       G3DNode n = stack.pop();\r
-                                                       if (n.isInstanceOf(ProcessResource.plant3Dresource.PipeRun))\r
-                                                               list.add(new PipeRun(n));\r
-                                                       else\r
-                                                               //piperun will not contain other piperuns\r
-                                                               for (G3DNode no : n.getChild())\r
-                                                                       stack.push(no);\r
-                                               }\r
-\r
-                                               for (PipeRun n : list) {\r
-                                                       PipeAnimationController c = new PipeAnimationController(parent.getRenderingComponent(), n);\r
-                                                       //animationSystem.add(c);\r
-                                                       getAnimationSystem().add(c);\r
-                                               }\r
-                                               return GraphRequestStatus.transactionComplete();\r
-                                       }\r
-\r
-                               });\r
-\r
-                       } else {\r
-                               //stopAnimations();\r
-                               getAnimationSystem().stop();\r
-                       }\r
-               }\r
-\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/EquipmentEditorPart.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/EquipmentEditorPart.java
deleted file mode 100644 (file)
index 07283da..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package fi.vtt.simantics.processeditor.views;\r
-\r
-import java.util.Collection;\r
-\r
-import org.eclipse.swt.widgets.Display;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorPart;\r
-import org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorBase;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.tools.NozzleContribution;\r
-\r
-public class EquipmentEditorPart extends ThreeDimensionalEditorPart {\r
-       \r
-       @Override\r
-       protected ThreeDimensionalEditorBase createEditor(ISessionContext session) {\r
-               ShapeEditorBase base = new ShapeEditorBase(session);\r
-               base.addEditorContribution(new NozzleContribution(base));\r
-               return base;\r
-       }\r
-       \r
-       @Override\r
-       public void reload(Graph g) {\r
-               Resource inputResource = getInputResource();\r
-               Collection<Resource> model = g.getObjects(inputResource, ProcessResource.plant3Dresource.HasGraphics);\r
-               if (model.size() != 1)\r
-                       throw new RuntimeException("Cannot find model for equipment " + inputResource);\r
-               Resource modelResource = model.iterator().next();\r
-               if (modelResource != null) {\r
-                       editor.reload(g,modelResource);\r
-               } else {\r
-                       \r
-                        Display d = getSite().getShell().getDisplay();\r
-                   d.asyncExec(new Runnable() {\r
-                       public void run() {\r
-                               editor.showMessage("Failed to load model.");\r
-                           getSite().getPage().closeEditor(EquipmentEditorPart.this,false);\r
-                       }\r
-                   });\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PipelineComponentEditorPart.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PipelineComponentEditorPart.java
deleted file mode 100644 (file)
index e94d7d5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package fi.vtt.simantics.processeditor.views;\r
-\r
-import java.util.Collection;\r
-\r
-import org.eclipse.swt.widgets.Display;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorPart;\r
-import org.simantics.proconf.g3d.shapeeditor.views.ShapeEditorBase;\r
-\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.tools.ControlPointContribution;\r
-\r
-public class PipelineComponentEditorPart extends ThreeDimensionalEditorPart {\r
-       \r
-       @Override\r
-       protected ThreeDimensionalEditorBase createEditor(ISessionContext session) {\r
-               ShapeEditorBase base = new ShapeEditorBase(session);\r
-               base.addEditorContribution(new ControlPointContribution(base));\r
-               return base;\r
-       }\r
-       \r
-       @Override\r
-       public void reload(Graph g) {\r
-               Resource inputResource = getInputResource();\r
-               Collection<Resource> model = g.getObjects(inputResource, ProcessResource.plant3Dresource.HasGraphics);\r
-               if (model.size() != 1)\r
-                       throw new RuntimeException("Cannot find model for pipeline component " + inputResource);\r
-               Resource modelResource = model.iterator().next();\r
-               if (modelResource != null) {\r
-                       editor.reload(g,modelResource);\r
-               } else {\r
-                       \r
-                        Display d = getSite().getShell().getDisplay();\r
-                   d.asyncExec(new Runnable() {\r
-                       public void run() {\r
-                               editor.showMessage("Failed to load model.");\r
-                           getSite().getPage().closeEditor(PipelineComponentEditorPart.this,false);\r
-                       }\r
-                   });\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PlantStructureOutlinePage.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PlantStructureOutlinePage.java
deleted file mode 100644 (file)
index 0c7a356..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package fi.vtt.simantics.processeditor.views;\r
-\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.layer0.utils.viewpoints.ResourceViewpoint;\r
-import org.simantics.proconf.browsing.views.GraphExplorerOutlinePage;\r
-\r
-import fi.vtt.simantics.processeditor.perspectives.ViewpointGenerator;\r
-\r
-public class PlantStructureOutlinePage extends GraphExplorerOutlinePage {\r
-\r
-       \r
-       public PlantStructureOutlinePage(ISessionContext sessionContext, Resource inputResource) {\r
-               super(sessionContext, inputResource);\r
-       }\r
-       \r
-       @Override\r
-       public void createControl(Composite parent) {\r
-               super.createControl(parent);\r
-       }\r
-\r
-       @Override\r
-       public ResourceViewpoint getViewPoint(ISessionContext sessionContext) {\r
-               return ViewpointGenerator.createObjectStructureViewpoint();\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PlantStructureView.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/PlantStructureView.java
deleted file mode 100644 (file)
index 6685e36..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package fi.vtt.simantics.processeditor.views;\r
-\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.layer0.utils.viewpoints.ResourceViewpoint;\r
-import org.simantics.proconf.browsing.GraphExplorer;\r
-import org.simantics.proconf.browsing.views.GraphExplorerView;\r
-\r
-import fi.vtt.simantics.processeditor.perspectives.ViewpointGenerator;\r
-\r
-public class PlantStructureView extends GraphExplorerView {\r
-\r
-       @Override\r
-       protected GraphExplorer createExplorer(Composite parent) {\r
-               return super.createExplorer(parent);\r
-       }\r
-       \r
-       @Override\r
-       protected ResourceViewpoint getViewpoint(ISessionContext context) {\r
-               return ViewpointGenerator.createViewpoint();\r
-       }\r
-}\r
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/ProcessEditor.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/ProcessEditor.java
deleted file mode 100644 (file)
index 5aae588..0000000
+++ /dev/null
@@ -1,704 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.views;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.ISelectionChangedListener;\r
-import org.eclipse.jface.viewers.SelectionChangedEvent;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.KeyEvent;\r
-import org.eclipse.swt.events.KeyListener;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.events.SelectionListener;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Text;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;\r
-import org.simantics.db.Graph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.layer0.utils.EntityFactory;\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.layer0.utils.Property;\r
-import org.simantics.proconf.g3d.base.JmeRenderingComponent;\r
-import org.simantics.proconf.g3d.base.ScenegraphAdapter;\r
-import org.simantics.proconf.g3d.base.ScenegraphAdapterImpl;\r
-import org.simantics.proconf.g3d.base.SelectionAdapter;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.common.StructuredResourceSelection;\r
-import org.simantics.proconf.g3d.scenegraph.IGeometryNode;\r
-import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
-import org.simantics.proconf.g3d.scenegraph.ISelectableNode;\r
-import org.simantics.proconf.g3d.scenegraph.ParameterizedModelNode;\r
-import org.simantics.proconf.g3d.shapes.FloorShape;\r
-import org.simantics.proconf.g3d.stubs.G3DNode;\r
-import org.simantics.utils.ErrorLogger;\r
-import org.simantics.utils.ui.jface.MenuTools;\r
-\r
-import com.jme.math.Vector3f;\r
-import com.jme.scene.Geometry;\r
-\r
-import fi.vtt.simantics.processeditor.Activator;\r
-import fi.vtt.simantics.processeditor.ProcessResource;\r
-import fi.vtt.simantics.processeditor.actions.InsertComponentAction;\r
-import fi.vtt.simantics.processeditor.actions.InsertEquipmentAction;\r
-import fi.vtt.simantics.processeditor.actions.InsertNozzleAction;\r
-import fi.vtt.simantics.processeditor.actions.RoutePipeAction;\r
-import fi.vtt.simantics.processeditor.common.ControlPointTools;\r
-import fi.vtt.simantics.processeditor.common.PipingRules;\r
-import fi.vtt.simantics.processeditor.scenegraph.NonVisibleNode;\r
-import fi.vtt.simantics.processeditor.scenegraph.PipelineComponentNode;\r
-import fi.vtt.simantics.processeditor.scenegraph.PipeComponentNode;\r
-import fi.vtt.simantics.processeditor.scenegraph.PipeRunNode;\r
-import fi.vtt.simantics.processeditor.stubs.PipeControlPoint;\r
-import fi.vtt.simantics.processeditor.stubs.PipeRun;\r
-import fi.vtt.simantics.processeditor.stubs.Plant;\r
-import fi.vtt.simantics.processeditor.stubs.Plant3DResource;\r
-import fi.vtt.simantics.processeditor.tools.PlantEditContribution;\r
-import fi.vtt.simantics.processeditor.tools.PlantVisualizationContribution;\r
-\r
-public class ProcessEditor extends ThreeDimensionalEditorBase {\r
-    \r
-    private Resource plantResource = null;\r
-    \r
-    //private List<AnimationController> animationControllers = new ArrayList<AnimationController>();\r
-\r
-    private Action configureFloorAction = null;\r
-\r
-    private Geometry floorShape = null;\r
-\r
-    public ProcessEditor(ISessionContext session) {\r
-        super(session);\r
-        addEditorContribution(new PlantEditContribution(this));\r
-        addEditorContribution(new PlantVisualizationContribution(this));\r
-    }\r
-    \r
-    public ProcessEditor(ISessionContext session,JmeRenderingComponent component) {\r
-        super(session,component);\r
-        addEditorContribution(new PlantEditContribution(this));\r
-        addEditorContribution(new PlantVisualizationContribution(this));\r
-    }\r
-    \r
-    @Override\r
-    protected ScenegraphAdapter createScenegraphAdapter() {\r
-       return new ProcessEditorAdapter(session,getRenderingComponent());\r
-    }\r
-    \r
-    @Override\r
-    public void createControl(Graph graph,Composite parent) {\r
-       super.createControl(graph,parent);\r
-\r
-       floorShape = FloorShape.getShape(getRenderingComponent().getDisplaySystem().getRenderer(), 100.f,0.2f);\r
-       getRenderingComponent().getNoCastRoot().attachChild(floorShape);\r
-       floorShape.setLocalTranslation(new Vector3f(0.f,-0.01f,0.f));\r
-    }\r
-\r
-    @Override\r
-    protected void makeActions(Graph graph) {\r
-        super.makeActions(graph);\r
-\r
-        //actions.add(new ShowTrendsAction(this));\r
-\r
-        configureFloorAction = new Action() {\r
-               public void run() {\r
-                       FloorConfigureDialog dialog = new FloorConfigureDialog(ProcessEditor.this.parent.getShell());\r
-                       if (dialog.open() == FloorConfigureDialog.CANCEL)\r
-                               return;\r
-                       if (dialog.isFloorEnabled()) {\r
-                               if (floorShape.getParent() == null)\r
-                                       getRenderingComponent().getNoCastRoot().attachChild(floorShape);\r
-                       } else {\r
-                               floorShape.removeFromParent();\r
-                       }\r
-                       floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f));\r
-                       \r
-               }\r
-        };\r
-        configureFloorAction.setText("Configure floor");\r
-        configureFloorAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/shape_align_bottom.png"));\r
-\r
-//        ContextActionFactory extended[] = ContextActionRegistry.getActions("fi.vtt.proconf.shapeeditor.processeditorview");\r
-//        for (ContextActionFactory c : extended) {\r
-//             actions.add(c.createAction(this));\r
-//        }\r
-    }\r
-    \r
-//    protected void stopAnimations() {\r
-//     animationSystem.stop();\r
-//    }\r
-    \r
-    protected void fillLocalPullDown() {\r
-       super.fillLocalPullDown();\r
-       MenuTools.getOrCreate(getMenuID(),"Advanced", menuManager).add(configureFloorAction);\r
-    }\r
-    \r
-    protected class ProcessEditorAdapter extends ScenegraphAdapterImpl {\r
-       \r
-        public ProcessEditorAdapter(Session session, JmeRenderingComponent component) {\r
-                       super(session, component);\r
-        }\r
-        \r
-        private class NormalScengraphQuery extends ScenegraphQuery {\r
-               \r
-               public NormalScengraphQuery(Resource node) {\r
-                               super(node);\r
-                       } \r
-                \r
-                \r
-                @Override\r
-               public void shapeAdded(Graph graph, IGraphicsNode node) {\r
-                        // FIXME : this won't work like in previous ProConf\r
-               }\r
-        }\r
-        \r
-        private Map<Resource,PipeRunControlPointQuery> pipeRunQueries = new HashMap<Resource, PipeRunControlPointQuery>();\r
-\r
-               protected ScenegraphQuery newSubnodeListener(G3DNode node) {\r
-               if (node.isInstanceOf(ProcessResource.plant3Dresource.PipeRun)) {\r
-                   PipeRunControlPointQuery query = new PipeRunControlPointQuery(node.getResource());\r
-                   pipeRunQueries.put(node.getResource(), query);\r
-                   node.getGraph().performQuery(query);\r
-//                 return new SubnodeListener(node) {\r
-//                     @Override\r
-//                     public void shapeAdded(IGraphicsNode node) {\r
-//                         if (node instanceof IGeometryNode) {\r
-//                             updateGeometry((IGeometryNode)node);\r
-//                             \r
-//                         }\r
-//                         node.setVisible(true);\r
-//                     }\r
-//                 };\r
-               }\r
-               return new NormalScengraphQuery(node.getResource());\r
-                \r
-           }\r
-               \r
-               @Override\r
-               protected NodePropertyQuery newRootPropertyListener(G3DNode root) {\r
-                       // currently Plant does not have any properties.\r
-                       return null;\r
-               }\r
-               \r
-               private class TransformationQuery extends NodeTransformationQuery {\r
-                       \r
-                       public TransformationQuery(Resource res) {\r
-                               super(res);\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void shapeUpdated(Graph graph, IGraphicsNode shape) {\r
-                               //if (shape instanceof IGeometryNode) {\r
-                //    updateGeometry((IGeometryNode)shape);\r
-                //} else {\r
-                       shape.updateTransform(graph);\r
-                //}\r
-                       }\r
-               }\r
-               \r
-               @Override\r
-               protected NodeTransformationQuery newTransformationListener(G3DNode root) {\r
-                       return new TransformationQuery(root.getResource());\r
-               }\r
-               \r
-               private class NormalNodePropertyQuery extends org.simantics.proconf.g3d.base.ScenegraphAdapterImpl.NodePropertyQuery {\r
-                       \r
-                       public NormalNodePropertyQuery(Resource resource) {\r
-                               super(resource);\r
-                       }\r
-\r
-                       @Override\r
-                       public void shapeUpdated(Graph graph,IGraphicsNode shape) {\r
-                               if (shape instanceof IGeometryNode) {\r
-                    updateGeometry((IGeometryNode)shape);\r
-                } else {\r
-                       shape.updateTransform(graph);\r
-                }\r
-                       }\r
-               }\r
-        @Override\r
-       protected NodePropertyQuery newPropertyListener(G3DNode node) {\r
-               return new NormalNodePropertyQuery(node.getResource());\r
-       }\r
-   \r
-        @Override\r
-               protected IGraphicsNode instantiateNode(IGraphicsNode parent,\r
-                               G3DNode node) {\r
-                       Plant3DResource p3r = ProcessResource.plant3Dresource;\r
-                       IGraphicsNode newNode = null;\r
-                       try {\r
-                               if (node.isInstanceOf(p3r.Equipment)) {\r
-                                       newNode = new ParameterizedModelNode(\r
-                                                       ProcessEditor.this, parent, node.getGraph(),\r
-                                                       node.getResource(), p3r.HasGraphics);\r
-                               } else if (node.isInstanceOf(p3r.PipeRun)) {\r
-                                       newNode = new PipeRunNode(parent, node.getGraph(), node.getResource());\r
-                               } else if (node.isInstanceOf(p3r.Nozzle)) {\r
-                                       newNode = new ParameterizedModelNode(\r
-                                                       ProcessEditor.this, parent, node.getGraph(),\r
-                                                       node.getResource(), p3r.HasGraphics);\r
-                                       // CodedComponent must be handled first since it uses\r
-                                       // hard-coded geometries\r
-                                       // TODO : is this really necessary, or could we unify\r
-                                       // PipeComponentNode, InlineComponentNode,...\r
-                               } else if (node.isInstanceOf(p3r.CodedComponent)) {\r
-                                       newNode = new PipeComponentNode(ProcessEditor.this,\r
-                                                       parent, node.getGraph(), node.getResource());\r
-                               } else if (node.isInstanceOf(p3r.NonVisibleComponent)) {\r
-                                       newNode = new NonVisibleNode(parent, node.getGraph(), node.getResource());\r
-                               } else if (node.isInstanceOf(p3r.PipelineComponent)) {\r
-                                       newNode = new PipelineComponentNode(ProcessEditor.this,\r
-                                                       parent, node.getGraph(), node.getResource());\r
-                               } \r
-\r
-                               // } else if (node instanceof Shape) // Markers (ar/mobile)\r
-                               // needed this\r
-                               // newNode = new ShapeNode(TestProcessEditor.this,parent,node);\r
-                               if (newNode != null) {\r
-                                       if (newNode instanceof ISelectableNode)\r
-                                               ((ISelectableNode) newNode).setVisible(true);\r
-                                       if (newNode instanceof IGeometryNode) {\r
-                                               updateGeometry((IGeometryNode) newNode);\r
-                                       }\r
-                                       return newNode;\r
-                               }\r
-                       } catch (Exception e) {\r
-                               ErrorLogger.defaultLogError("Cannot handle node " + node.getResource(), e);\r
-                               return null;\r
-                       }\r
-                       ErrorLogger.defaultLogError("Cannot handle node " + node.getResource(), null);\r
-                       return null;\r
-\r
-               }\r
-\r
-               /**\r
-                * This is used to create elbows and straight pipes to pipeline TODO :\r
-                * this should be done with rule-engine!\r
-                * \r
-                * \r
-                * @author Marko Luukkainen\r
-                * \r
-                */\r
-               protected class PipeRunControlPointQuery extends NodeQuery {\r
-                       private List<Resource> removed = new ArrayList<Resource>();\r
-                       private List<Resource> added = new ArrayList<Resource>();\r
-\r
-                       public PipeRunControlPointQuery(Resource r) {\r
-                               super(r);\r
-                               if (DEBUG) System.out.println("Created PipeRunControlPointQuery for " + r);\r
-\r
-                       }\r
-\r
-                       @Override\r
-                       protected Object compute2(Graph graph) {\r
-                               PipeRun run = new PipeRun(graph, nodeResource);\r
-                               Collection<IEntity> cps = run\r
-                                               .getRelatedObjects(ProcessResource.plant3Dresource.HasControlPoints);\r
-                               List<Resource> res = new ArrayList<Resource>();\r
-                               for (IEntity t : cps)\r
-                                       res.add(t.getResource());\r
-                               return res;\r
-                       }\r
-\r
-                       @Override\r
-                       public boolean updated(Graph graph, Object oldResult,\r
-                                       Object newResult) {\r
-                               \r
-                               removed.clear();\r
-                               added.clear();\r
-\r
-                               List<Resource> oldCps = (List<Resource>) oldResult;\r
-                               List<Resource> newCps = (List<Resource>) newResult;\r
-                               if (oldCps == null)\r
-                                       oldCps = new ArrayList<Resource>();\r
-\r
-                               for (Resource r : oldCps) {\r
-                                       if (!newCps.contains(r))\r
-                                               removed.add(r);\r
-                               }\r
-\r
-                               for (Resource r : newCps) {\r
-                                       if (!oldCps.contains(r))\r
-                                               added.add(r);\r
-                               }\r
-                               for (Resource r : removed)\r
-                                       removeControlPoint(graph, r);\r
-                               for (Resource r : added) {\r
-                                       addControlPoint(graph, r);\r
-                                       // ControlPointTools.addControlPoint(new\r
-                                       // PipeRun(graph,pipeRun), new PipeControlPoint(graph, r));\r
-                               }\r
-\r
-                               return (added.size() > 0 || removed.size() > 0);\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void dispose() {\r
-                               super.dispose();\r
-                               for (ControlPointPropertyQuery q : controlPointPropertyQueries.values())\r
-                                       q.dispose();\r
-                               controlPointPropertyQueries.clear();\r
-                       }\r
-                       \r
-                       private Map<Resource,ControlPointPropertyQuery> controlPointPropertyQueries = new HashMap<Resource, ControlPointPropertyQuery>();\r
-                       \r
-                       private void addControlPoint(Graph graph, Resource resource) {\r
-                               ControlPointPropertyQuery query = new ControlPointPropertyQuery(resource);\r
-                               graph.performQuery(query);\r
-                               controlPointPropertyQueries.put(resource,query);\r
-                       }\r
-                       \r
-                       private void removeControlPoint(Graph graph, Resource resource) {\r
-                               ControlPointPropertyQuery query = controlPointPropertyQueries.remove(resource);\r
-                               query.dispose();\r
-                               ControlPointTools.removeControlPoint(new PipeControlPoint(\r
-                                               graph, resource));\r
-                       }\r
-\r
-               }\r
-\r
-               protected class ControlPointPropertyQuery extends NodeQuery {\r
-                       boolean initialized = false;\r
-                       \r
-                       public ControlPointPropertyQuery(Resource r) {\r
-                               super(r);\r
-                               if (DEBUG) System.out.println("Created ControlPointPropertyQuery for " + r);\r
-                       }\r
-                       \r
-                       @Override\r
-               public List<Object> compute2(Graph g) {\r
-                       IEntity t = EntityFactory.create(g,nodeResource);\r
-                       \r
-                       Collection<Property> properties = t.getRelatedProperties(ProcessResource.builtins.HasProperty);\r
-                       List<Object> propertyValues = new ArrayList<Object>();\r
-                       p(properties,propertyValues);\r
-\r
-                       return propertyValues;\r
-               }\r
-               \r
-               private void p(Collection<Property> properties, List<Object> propertyValues) {\r
-                       for (Property p : properties) {\r
-                               Collection<Property> subProperties = p.getRelatedProperties(p.getGraph().getBuiltins().HasProperty);\r
-                               if (subProperties.size() != 0) {\r
-                                       p(subProperties,propertyValues);\r
-                               } \r
-                               if (p.hasValue()){\r
-                                       propertyValues.add(p.getValue());\r
-                               }\r
-                       }\r
-               }\r
-                       \r
-                       @Override\r
-                       public boolean updated(Graph graph, Object oldResult, Object newResult) {\r
-                               PipingRules.pipeControlPointPositionUpdate(graph, this.nodeResource);\r
-                               if (initialized) {\r
-                                       //PipingRules.pipeControlPointPositionUpdate(graph, this.nodeResource);\r
-                               } else {\r
-                                       initialized = true;\r
-                               }\r
-                               return true;\r
-                       }\r
-               }\r
-               \r
-               @Override\r
-               protected void removeNode(Resource parent, Resource r) {\r
-                       super.removeNode(parent, r);\r
-                       PipeRunControlPointQuery q = pipeRunQueries.get(r);\r
-                       if (q != null)\r
-                               q.dispose();\r
-               }\r
-               \r
-               @Override\r
-               public void dispose() {\r
-                       super.dispose();\r
-               }\r
-       }\r
-    \r
-    @Override\r
-    protected void pageSelectionChanged(IWorkbenchPart part, ISelection selection) {\r
-        if (!(selection instanceof StructuredResourceSelection)) {\r
-            return;\r
-        }\r
-        \r
-        StructuredResourceSelection s = (StructuredResourceSelection) selection;\r
-        selectionAdapter.setCurrentSelection(s);\r
-        viewChanged = true;\r
-        \r
-        //if (s.getRootSelection() == null) {\r
-        if (!(part instanceof ProcessEditor)) {\r
-            //System.out.println("ShapeEditorView.pageSelectionChanged() no root selection");\r
-               ((ProcessEditorSelectionAdapter)selectionAdapter).setEditorSelection(true);\r
-            return;\r
-        } \r
-        //if (!s.getRootSelection().getResource().getId().equals(plant.getResource().getId())) {\r
-        ProcessEditor sender = (ProcessEditor)part;\r
-        if (!sender.getPlantResource().equals(plantResource)) {\r
-//          System.out.println("ShapeEditorView.pageSelectionChanged() not right group "\r
-//                  + s.getRootSelection().getResource().getId() + " != " + model.getResource().getId());\r
-               selectionAdapter.setCurrentSelection(new StructuredResourceSelection());\r
-               ((ProcessEditorSelectionAdapter)selectionAdapter).setEditorSelection(false);\r
-          return;\r
-      }\r
-        selectionAdapter.setEditorSelection();\r
-        \r
-    }\r
-\r
-    @Override\r
-    protected void reloadFrom(IEntity thing) {\r
-        if (plantResource != null) {\r
-            throw new UnsupportedOperationException("Reloading instantiated viewer not supported");\r
-        }\r
-        if (thing.isInstanceOf(ProcessResource.plant3Dresource.Plant)) {\r
-            plantResource = thing.getResource();\r
-            G3DNode plant = new G3DNode(thing);\r
-            adapter.setRootNode(plant);\r
-            //adapter.addOutbound(plant);\r
-            ControlPointTools.reloadCache(thing.getGraph(),plant.getResource());\r
-        } else {\r
-            throw new IllegalArgumentException("Resource is not a plant");\r
-        } \r
-    }\r
-\r
-    public Resource getPlantResource() {\r
-        return plantResource;\r
-    }\r
-    \r
-    public Plant getPlant(Graph g) {\r
-       return new Plant(g, plantResource);\r
-    }\r
-    \r
-    @Override\r
-    protected SelectionAdapter createSelectionAdapter() {\r
-       return new ProcessEditorSelectionAdapter(adapter);\r
-    }\r
-    \r
-    protected class ProcessEditorSelectionAdapter extends SelectionAdapter {\r
-       \r
-       \r
-        public ProcessEditorSelectionAdapter(ScenegraphAdapter adapter) {\r
-                       super(adapter);\r
-                       // TODO Auto-generated constructor stub\r
-               }\r
-\r
-               @Override\r
-           protected StructuredResourceSelection filterSelection(ISelection s) {\r
-               if (!(s instanceof StructuredResourceSelection))\r
-                   return new StructuredResourceSelection();\r
-               return (StructuredResourceSelection)s;\r
-           }\r
-\r
-           @Override\r
-           public void setEditorSelection() {\r
-               List<IGraphicsNode> sel = getSelectedObjects();\r
-               for (IGraphicsNode o : adapter.getNodes())\r
-                       if (o instanceof ISelectableNode) {\r
-                               if (sel.contains(o)) {\r
-                               ((ISelectableNode)o).setSelected(true);\r
-                       } else {\r
-                               ((ISelectableNode)o).setSelected(false);\r
-                       }\r
-                       }\r
-               List<Resource> selected = getSelectedResources();\r
-            // TODO : don't know why this code is here, but it seems unnecessary\r
-//             for (Resource r : selected) {\r
-//                 if (!adapter.hasNode(r)) {\r
-//                     // instantiating a new resource : usin this editor's tc\r
-//                     Resource resource = graph.getResource(r.getId());\r
-//                     adapter.addInbound(resource).setSelected(true);\r
-//\r
-//                 }\r
-//             }\r
-               \r
-           }\r
-           \r
-           public void setEditorSelection(boolean addShapes) {\r
-\r
-               List<IGraphicsNode> sel = getSelectedObjects();\r
-               for (IGraphicsNode o : adapter.getNodes())\r
-                       if (o instanceof ISelectableNode) {\r
-                               if (sel.contains(o)) {\r
-                               ((ISelectableNode)o).setSelected(true);\r
-                       } else {\r
-                               ((ISelectableNode)o).setSelected(false);\r
-                       }\r
-                       }\r
-               if (addShapes) {\r
-                       // TODO : don't know why this code is here, but it seems unnecessary\r
-//                 List<Resource> selected = getSelectedResources();\r
-//                 for (Resource r : selected) {\r
-//                     if (!adapter.hasNode(r)) {\r
-//                         if (r.isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.EQUIPMENT))) {\r
-//                             Resource group = GraphicsNodeTools.getModelFromResource(r);\r
-//                             if (group != null && group.getId() == plant.getResource().getId()) {\r
-////                                     instantiating a new resource : usin this editor's tc\r
-//                                 Resource resource = graph.getResource(r.getId());\r
-//                                 adapter.addInbound(resource).setSelected(true);\r
-//                             }\r
-//                                 \r
-//                         }\r
-//                     }\r
-//                 }\r
-               }\r
-           }\r
-\r
-           @Override\r
-           protected void setEditorHighlightSelection() {\r
-               List<IGraphicsNode> sel = getInteractiveSelectedObjects();\r
-               for (IGraphicsNode o : adapter.getNodes())\r
-                       if (o instanceof ISelectableNode) {\r
-                               if (sel.contains(o)) {\r
-                               ((ISelectableNode)o).setHighlighted(true);\r
-                       } else {\r
-                               ((ISelectableNode)o).setHighlighted(false);\r
-                       }\r
-                       }\r
-           }\r
-    }\r
-    \r
-    private class FloorConfigureDialog extends Dialog implements KeyListener,SelectionListener {\r
-       \r
-       private boolean floorEnabled = true;\r
-       private double floorHeight = 0.0;\r
-       \r
-       private Text floorHeightText = null;\r
-       private Button floorEnabledButton = null;\r
-       \r
-       public FloorConfigureDialog(Shell shell) {\r
-               super(shell);\r
-       }\r
-       \r
-       @Override\r
-       protected Control createDialogArea(Composite parent) {\r
-               Composite composite = (Composite) super.createDialogArea(parent);\r
-               Label label = new Label(composite, SWT.WRAP);\r
-            label.setText("Configure floor");\r
-            GridData data = new GridData(GridData.GRAB_HORIZONTAL\r
-                    | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL\r
-                    | GridData.VERTICAL_ALIGN_CENTER);\r
-               \r
-            data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);\r
-            label.setLayoutData(data);\r
-            label.setFont(parent.getFont());\r
-            floorEnabledButton = new Button(composite,SWT.CHECK);\r
-            floorEnabledButton.setText("Enabled");\r
-            label = new Label(composite, SWT.WRAP);\r
-            label.setText("Height");\r
-            label.setLayoutData(data);\r
-            label.setFont(parent.getFont());\r
-            floorHeightText = new Text(composite,SWT.NONE);\r
-               \r
-               \r
-            floorHeightText.addKeyListener(this);\r
-               floorEnabledButton.addSelectionListener(this);\r
-               floorEnabledButton.setSelection(floorEnabled);\r
-               floorHeightText.setText(Double.toString(floorHeight));\r
-               \r
-               return composite;\r
-       }\r
-       \r
-       @Override\r
-       protected void configureShell(Shell newShell) {\r
-               super.configureShell(newShell);\r
-               newShell.setText("Configure floor");\r
-       }\r
-       \r
-       public void keyPressed(KeyEvent e) {\r
-               \r
-       }\r
-       \r
-       public void keyReleased(KeyEvent e) {\r
-               boolean ok = true;\r
-               try {\r
-                       floorHeight = Double.parseDouble(floorHeightText.getText());    \r
-               } catch (NumberFormatException err) {\r
-                       ok = false;\r
-               }\r
-               if (ok) {\r
-                       this.getButton(IDialogConstants.OK_ID).setEnabled(true);\r
-               } else {\r
-                       this.getButton(IDialogConstants.OK_ID).setEnabled(false);\r
-               }\r
-       }\r
-       \r
-       public void widgetDefaultSelected(SelectionEvent e) {\r
-               \r
-       }\r
-       \r
-       public void widgetSelected(SelectionEvent e) {\r
-               floorEnabled = floorEnabledButton.getSelection();\r
-       }\r
-\r
-               public boolean isFloorEnabled() {\r
-                       return floorEnabled;\r
-               }\r
-\r
-               public double getFloorHeight() {\r
-                       return floorHeight;\r
-               }\r
-\r
-    }\r
-    \r
-    @Override\r
-    protected void hookDragAndDrop() {\r
-       super.hookDragAndDrop();\r
-       dropTarget.addDropListener(new InsertEquipmentAction(this));\r
-       dropTarget.addDropListener(new InsertNozzleAction(this));\r
-       dropTarget.addDropListener(new InsertComponentAction(this));\r
-       dropTarget.addDropListener(new RoutePipeAction(this));\r
-    }\r
-    \r
-    @Override\r
-       public Object getAdapter(Class adapter) {\r
-               if (adapter == IContentOutlinePage.class) {\r
-                       if (getPlantResource() == null)\r
-                               return null;\r
-                       final PlantStructureOutlinePage page = new PlantStructureOutlinePage(sessionContext,getPlantResource());\r
-                       \r
-                       getSelectionAdapter().addSelectionChangedListener(new ISelectionChangedListener() {\r
-                               @Override\r
-                               public void selectionChanged(SelectionChangedEvent event) {\r
-                                       page.setSelection(event.getSelection());\r
-                                       \r
-                               }\r
-                       });\r
-                       parent.getDisplay().asyncExec(new Runnable() {\r
-                               @Override\r
-                               public void run() {\r
-                                       page.addSelectionChangedListener(new ISelectionChangedListener() {\r
-                                               @Override\r
-                                               public void selectionChanged(SelectionChangedEvent event) {\r
-                                                       selectionAdapter.setSelection(SelectionAdapter.transformSelection(event.getSelection()));\r
-                                               }\r
-                                       });\r
-                               }\r
-                       });\r
-                       \r
-                       \r
-                       \r
-                       return page;\r
-               }\r
-               return null;\r
-       }\r
-}
\ No newline at end of file
diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/ProcessEditorPart.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/views/ProcessEditorPart.java
deleted file mode 100644 (file)
index a83f40b..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package fi.vtt.simantics.processeditor.views;\r
-\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
-import org.simantics.proconf.g3d.base.ThreeDimensionalEditorPart;\r
-\r
-\r
-public class ProcessEditorPart extends ThreeDimensionalEditorPart {\r
-       \r
-       @Override\r
-       protected ThreeDimensionalEditorBase createEditor(ISessionContext session) {\r
-               return new ProcessEditor(session);\r
-       }\r
-\r
-}\r