Ejemplo n.º 1
0
        public bool wasRotated()
        {
            float[] rotation  = _textureControl.getCurrentRotation();
            float[] translate = _textureControl.getCurrentTranslation();

            if (rotation[0] != currRotation[0] || rotation[1] != currRotation[1] || rotation[2] != currRotation[2])
            {
                currRotation[0]    = rotation[0];
                currRotation[1]    = rotation[1];
                currRotation[2]    = rotation[2];
                currTranslation[0] = translate[0];
                currTranslation[1] = translate[1];
                currTranslation[2] = translate[2];
                return(true);
            }
            currRotation[0]    = rotation[0];
            currRotation[1]    = rotation[1];
            currRotation[2]    = rotation[2];
            currTranslation[0] = translate[0];
            currTranslation[1] = translate[1];
            currTranslation[2] = translate[2];

            return(false);
        }
Ejemplo n.º 2
0
        CT mri;//for getting the texture info

        public TextureController(Separator root, Separator[] bones, TransformParser parser, Boolean IsVolumeRenderEnabled)
        {
            isVolumeRenderEnabled = IsVolumeRenderEnabled;
            _root   = root;
            _bones  = bones;
            _parser = parser;

            currTranslation = new float[3];
            currRotation    = new float[3];


            currTranslation[0] = 0; currRotation[0] = 0;
            currTranslation[1] = 0; currRotation[1] = 0;
            currTranslation[2] = 0; currRotation[2] = 0;

            if (parser == null)
            {
                _textureControl = null;
                return;
            }

            _transformHashtables = parser.getArrayOfTransformHashtables();
            _textureControl      = new TextureControl(parser.getArrayOfAllignmentSteps());
            if (!isVolumeRenderEnabled)
            {
                _textureControl.disableVolumeItems();
            }
            _fullWristControl = new FullWristControl();
            _fullWristControl.setupControl(WristFilesystem.LongBoneNames, false);
            _mainControlPanel = new WristPanelLayoutControl();
            _mainControlPanel.addControl(_textureControl);
            _mainControlPanel.addControl(_fullWristControl);

            _editableTransforms = parser.getArrayOfOptimizedBothTransforms();
            setupListeners();

            //set the current editable transform
            _textureControl_SelectedTransformChanged();


            /////////////////////////////////////


            float[] center    = _textureControl.getCurrentCenterOfRotation();
            float[] translate = _textureControl.getCurrentTranslation();
            float[] rotation  = _textureControl.getCurrentRotation();

            currTranslation[0] = translate[0]; currRotation[0] = rotation[0];
            currTranslation[1] = translate[1]; currRotation[1] = rotation[1];
            currTranslation[2] = translate[2]; currRotation[2] = rotation[2];

            _rootSeparator = new Separator();
            _rootSeparator.reference();
            root.addChild(_rootSeparator);
            _centerballVisible = true;
            Scale myScale = new Scale();

            _centerballDragger = new CenterballDragger();
            //get the center of rotation from the form elements
            center[0] += translate[0];
            center[1] += translate[1];
            center[2] += translate[2];



            _rootSeparator.addNode(myScale);
            scaleValues    = new float[3];
            scaleValues[0] = scaleValues[1] = scaleValues[2] = 10;
            myScale.setScaleFactor(scaleValues[0], scaleValues[1], scaleValues[2]);

            _centerballDragger.setRotation(rotation[0], rotation[1], rotation[2]);
            _centerballDragger.setTranslation(center[0] / scaleValues[0], center[1] / scaleValues[1], center[2] / scaleValues[2]);


            _rootSeparator.addChild(_centerballDragger);
            beginningTranslation = _textureControl.getCurrentTranslation();

            CenterballDragger.delFunc d = new CenterballDragger.delFunc(_textureControl_EditableTransformChangedFromCenterball);
            _centerballDragger.addCB(d);

            wasRotated();
        }