private void comunicateModeSwitch(ModificationMode mode)
        {
            String audio = getAudioFeedback(mode);
            String detail = getDetailRegionFeedback(mode);

            AudioRenderer.Instance.PlaySoundImmediately(audio);
            sentTextFeedback(detail);
        }
        public void Update(List<DummyObject> selectedObjects, Viewport viewport)
        {
            if (mControls.LeftPressed.Active)
            {
                Rectangle mousePixelRectangle = new Rectangle(mControls.MouseState.X, mControls.MouseState.Y, 1, 1);
                List<uint> objectIDs = GraphicsManager.GetPickingScreenObjects(mousePixelRectangle);
                uint mousePixel = objectIDs.Count > 0 ? objectIDs[0] : 0;
                if (mousePixel == mXPickingID || mousePixel == mYPickingID || mousePixel == mZPickingID)
                {
                    mDragMode = Mode;
                    IsDragging = true;
                }
                else
                {
                    IsDragging = false;
                }
                switch (mousePixel)
                {
                    case mXPickingID:
                        mDragDirection = ModificationDirection.X;
                        break;
                    case mYPickingID:
                        mDragDirection = ModificationDirection.Y;
                        break;
                    case mZPickingID:
                        mDragDirection = ModificationDirection.Z;
                        break;
                }
                mStartDragPoint = GetMouseWorldPosition(viewport);
                mPreviousDragPoint = mStartDragPoint;
            }
            else if (mControls.LeftReleased.Active)
            {
                IsDragging = false;
            }

            if (IsDragging)
            {
                Vector3 newDragPoint = GetMouseWorldPosition(viewport);
                switch (mDragMode)
                {
                    case ModificationMode.TRANSLATE:
                        foreach (DummyObject dummyObject in selectedObjects)
                        {
                            dummyObject.Position += (newDragPoint - mPreviousDragPoint) * GetDragDirection();
                        }
                        break;
                    case ModificationMode.SCALE:
                        float scaleMultiplier = (newDragPoint - Position).Length() / (mPreviousDragPoint - Position).Length();
                        foreach (DummyObject dummyObject in selectedObjects)
                        {
                            Vector3 scale = scaleMultiplier * GetDragDirection() + (Vector3.One - GetDragDirection());
                            dummyObject.ApplyScale(scale);
                        }
                        break;
                    case ModificationMode.ROTATE:
                        Vector3 axis = GetDragDirection();
                        Vector3 newDirection = Vector3.Normalize(newDragPoint - Position);
                        Vector3 previousDirection = Vector3.Normalize(mPreviousDragPoint - Position);

                        float dot = Math.Min(1.0f, Math.Max(-1.0f, Vector3.Dot(newDirection, previousDirection)));
                        float angle = (float)Math.Acos(dot);
                        angle *= Vector3.Dot(Vector3.Cross(newDirection, previousDirection), axis) < 0.0f ? 1.0f : -1.0f;

                        foreach (DummyObject dummyObject in selectedObjects)
                        {
                            Vector3 deltaYawPitchRoll = axis * angle;
                            dummyObject.ApplyRotation(deltaYawPitchRoll, Position);
                        }
                        break;
                }
                mPreviousDragPoint = newDragPoint;
            }

            Position = Vector3.Zero;
            foreach (DummyObject dummyObject in selectedObjects)
            {
                Position += dummyObject.Position;
            }
            if (selectedObjects.Count > 0)
            {
                mDrawable = true;
                Position /= selectedObjects.Count;
            }
            else
            {
                mDrawable = false;
            }
        }
        private void modifyToolsInToolgroup(CogToolGroup toolGroup, ModificationMode mode)
        {
            Trace.WriteLine("ModifyToolsInToolGroup: Mode=" + mode);
            foreach (ICogTool tool in toolGroup.Tools)
            {
                //CogInputImageTool (Nicht beachten, da Kamera)

                //CogToolGroup
                if ((tmpToolGroup = (tool as CogToolGroup)) != null)
                {
                    tmpProcessingString = "Processing Group: " + tool.Name;
                    //recursively check all ToolBlocks/ToolGroups
                    modifyToolsInToolgroup(tmpToolGroup, mode);
                }
                else
                {
                    tmpProcessingString = "-> Processing: " + tool.Name;

                    //CogBlobTool
                    if (tool as Cognex.VisionPro.Blob.CogBlobTool != null)
                    {
                        Cognex.VisionPro.Blob.CogBlobTool Blob = tool as Cognex.VisionPro.Blob.CogBlobTool;

                        switch (mode)
                        {
                        case ModificationMode.disable:
                            Blob.CurrentRecordEnable     = Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.None;
                            Blob.LastRunRecordDiagEnable = Cognex.VisionPro.Blob.CogBlobLastRunRecordDiagConstants.None;
                            Blob.LastRunRecordEnable     = Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.None;
                            break;

                        case ModificationMode.enableALL:
                            Blob.CurrentRecordEnable     = Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.All;
                            Blob.LastRunRecordDiagEnable = Cognex.VisionPro.Blob.CogBlobLastRunRecordDiagConstants.All;
                            Blob.LastRunRecordEnable     = Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.All;
                            break;

                        case ModificationMode.standard:
                            //Blob.CurrentRecordEnable = Region | InputImageMask | Histogram | InputImage
                            Blob.CurrentRecordEnable
                                = Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.Region
                                  | Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.InputImageMask
                                  | Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.Histogram
                                  | Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.InputImage
                                ;

                            //Blob.LastRunRecordDiagEnable = InputImageByReference
                            Blob.LastRunRecordDiagEnable
                                = Cognex.VisionPro.Blob.CogBlobLastRunRecordDiagConstants.InputImageByReference
                                ;

                            //Blob.LastRunRecordEnable = ResultsBoundary | BlobImageUnfiltered | BlobImage
                            Blob.LastRunRecordEnable
                                = Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.ResultsBoundary
                                  | Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.BlobImageUnfiltered
                                  | Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.BlobImage
                                ;
                            break;
                        }
                    }

                    //CogPMAlignTool
                    else if (tool as Cognex.VisionPro.PMAlign.CogPMAlignTool != null)
                    {
                        Cognex.VisionPro.PMAlign.CogPMAlignTool PMAlign = tool as Cognex.VisionPro.PMAlign.CogPMAlignTool;

                        switch (mode)
                        {
                        case ModificationMode.disable:
                            PMAlign.CurrentRecordEnable     = Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.None;
                            PMAlign.LastRunRecordDiagEnable = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordDiagConstants.None;
                            PMAlign.LastRunRecordEnable     = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordConstants.None;
                            break;

                        case ModificationMode.enableALL:
                            PMAlign.CurrentRecordEnable     = Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.All;
                            PMAlign.LastRunRecordDiagEnable = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordDiagConstants.All;
                            PMAlign.LastRunRecordEnable     = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordConstants.All;
                            break;

                        case ModificationMode.standard:
                            //PMAlign.CurrentRecordEnable = InputImage | PatternOrigin | SearchImageMask | SearchRegion | TrainShapeModels | TrainImageMask | TrainRegion | TrainImage
                            PMAlign.CurrentRecordEnable
                                = Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.InputImage
                                  | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.PatternOrigin
                                  | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.SearchImageMask
                                  | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.SearchRegion
                                  | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.TrainShapeModels
                                  | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.TrainImageMask
                                  | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.TrainRegion
                                  | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.TrainImage
                                ;

                            //PMAlign.LastRunRecordDiagEnable = InputImageByReference
                            PMAlign.LastRunRecordDiagEnable
                                = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordDiagConstants.InputImageByReference
                                ;

                            //PMAlign.LastRunRecordEnable = ResultsMatchRegion | ResultsOrigin
                            PMAlign.LastRunRecordEnable
                                = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordConstants.ResultsMatchRegion
                                  | Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordConstants.ResultsOrigin
                                ;
                            break;
                        }
                    }

                    //CogSearchMaxTool
                    else if (tool as Cognex.VisionPro.SearchMax.CogSearchMaxTool != null)
                    {
                        Cognex.VisionPro.SearchMax.CogSearchMaxTool SearchMax = tool as Cognex.VisionPro.SearchMax.CogSearchMaxTool;

                        switch (mode)
                        {
                        case ModificationMode.disable:
                            SearchMax.CurrentRecordEnable     = Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.None;
                            SearchMax.LastRunRecordDiagEnable = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordDiagConstants.None;
                            SearchMax.LastRunRecordEnable     = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordConstants.None;
                            break;

                        case ModificationMode.enableALL:
                            SearchMax.CurrentRecordEnable     = Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.All;
                            SearchMax.LastRunRecordDiagEnable = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordDiagConstants.All;
                            SearchMax.LastRunRecordEnable     = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordConstants.All;
                            break;

                        case ModificationMode.standard:
                            //SearchMax.CurrentRecordEnable = PatternOrigin | TrainRegion | TrainImageMask | TrainImage | SearchImageMask | SearchRegion | InputImage
                            SearchMax.CurrentRecordEnable
                                = Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.PatternOrigin
                                  | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.TrainRegion
                                  | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.TrainImageMask
                                  | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.TrainImage
                                  | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.SearchImageMask
                                  | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.SearchRegion
                                  | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.InputImage
                                ;

                            //SearchMax.LastRunRecordDiagEnable = InputImageByReference
                            SearchMax.LastRunRecordDiagEnable
                                = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordDiagConstants.InputImageByReference
                                ;

                            //SearchMax.LastRunRecordEnable = ResultsOrigin | ResultsMatchRegion
                            SearchMax.LastRunRecordEnable
                                = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordConstants.ResultsOrigin
                                  | Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordConstants.ResultsMatchRegion
                                ;
                            break;
                        }
                    }

                    //CogFixtureTool
                    else if (tool as Cognex.VisionPro.CalibFix.CogFixtureTool != null)
                    {
                        Cognex.VisionPro.CalibFix.CogFixtureTool FixtureTool = tool as Cognex.VisionPro.CalibFix.CogFixtureTool;

                        switch (mode)
                        {
                        case ModificationMode.disable:
                            FixtureTool.CurrentRecordEnable     = Cognex.VisionPro.CalibFix.CogFixtureCurrentRecordConstants.None;
                            FixtureTool.LastRunRecordDiagEnable = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordDiagConstants.None;
                            FixtureTool.LastRunRecordEnable     = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordConstants.None;
                            break;

                        case ModificationMode.enableALL:
                            FixtureTool.CurrentRecordEnable     = Cognex.VisionPro.CalibFix.CogFixtureCurrentRecordConstants.All;
                            FixtureTool.LastRunRecordDiagEnable = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordDiagConstants.All;
                            FixtureTool.LastRunRecordEnable     = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordConstants.All;
                            break;

                        case ModificationMode.standard:
                            //FixtureTool.CurrentRecordEnable = InputImage | FixturedAxes
                            FixtureTool.CurrentRecordEnable
                                = Cognex.VisionPro.CalibFix.CogFixtureCurrentRecordConstants.InputImage
                                  | Cognex.VisionPro.CalibFix.CogFixtureCurrentRecordConstants.FixturedAxes
                                ;

                            //FixtureTool.LastRunRecordDiagEnable = FixturedAxes
                            FixtureTool.LastRunRecordDiagEnable
                                = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordDiagConstants.FixturedAxes
                                ;

                            //FixtureTool.LastRunRecordEnable = OutputImage
                            FixtureTool.LastRunRecordEnable
                                = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordConstants.OutputImage
                                ;
                            break;
                        }
                    }

                    //CogHistogramTool
                    else if (tool as Cognex.VisionPro.ImageProcessing.CogHistogramTool != null)
                    {
                        Cognex.VisionPro.ImageProcessing.CogHistogramTool Histogram = tool as Cognex.VisionPro.ImageProcessing.CogHistogramTool;

                        switch (mode)
                        {
                        case ModificationMode.disable:
                            Histogram.CurrentRecordEnable     = Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.None;
                            Histogram.LastRunRecordDiagEnable = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordDiagConstants.None;
                            Histogram.LastRunRecordEnable     = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordConstants.None;
                            break;

                        case ModificationMode.enableALL:
                            Histogram.CurrentRecordEnable     = Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.All;
                            Histogram.LastRunRecordDiagEnable = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordDiagConstants.All;
                            Histogram.LastRunRecordEnable     = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordConstants.All;
                            break;

                        case ModificationMode.standard:
                            //Histogram.CurrentRecordEnable = Region | InputImageMask | InputImage
                            Histogram.CurrentRecordEnable
                                = Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.Region
                                  | Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.InputImageMask
                                  | Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.InputImage
                                ;

                            //Histogram.LastRunRecordDiagEnable = InputImageByReference
                            Histogram.LastRunRecordDiagEnable
                                = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordDiagConstants.InputImageByReference
                                ;

                            //Histogram.LastRunRecordEnable = Mean | Histogram
                            Histogram.LastRunRecordEnable
                                = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordConstants.Mean
                                  | Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordConstants.Histogram
                                ;
                            break;
                        }
                    }

                    //CogFindLineTool
                    else if (tool as Cognex.VisionPro.Caliper.CogFindLineTool != null)
                    {
                        Cognex.VisionPro.Caliper.CogFindLineTool FindLine = tool as Cognex.VisionPro.Caliper.CogFindLineTool;

                        switch (mode)
                        {
                        case ModificationMode.disable:
                            FindLine.CurrentRecordEnable     = Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.None;
                            FindLine.LastRunRecordDiagEnable = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordDiagConstants.None;
                            FindLine.LastRunRecordEnable     = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.None;
                            break;

                        case ModificationMode.enableALL:
                            FindLine.CurrentRecordEnable     = Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.All;
                            FindLine.LastRunRecordDiagEnable = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordDiagConstants.All;
                            FindLine.LastRunRecordEnable     = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.All;
                            break;

                        case ModificationMode.standard:
                            //FindLine.CurrentRecordEnable = ExpectedLineSegment | InteractiveCaliperSearchDirection | InteractiveCaliperSize | CaliperRegions | InputImage
                            FindLine.CurrentRecordEnable
                                = Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.ExpectedLineSegment
                                  | Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.InteractiveCaliperSearchDirection
                                  | Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.InteractiveCaliperSize
                                  | Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.CaliperRegions
                                  | Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.InputImage
                                ;

                            //FindLine.LastRunRecordDiagEnable = InputImageByReference
                            FindLine.LastRunRecordDiagEnable
                                = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordDiagConstants.InputImageByReference
                                ;

                            //FindLine.LastRunRecordEnable = ResultsIgnoredPoints | ResultsUsedPoints | BestFitLineSegment
                            FindLine.LastRunRecordEnable
                                = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.ResultsIgnoredPoints
                                  | Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.ResultsUsedPoints
                                  | Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.BestFitLineSegment
                                ;
                            break;
                        }
                    }

                    //CogIPOneImageTool
                    else if (tool as Cognex.VisionPro.ImageProcessing.CogIPOneImageTool != null)
                    {
                        Cognex.VisionPro.ImageProcessing.CogIPOneImageTool oneImageTool = tool as Cognex.VisionPro.ImageProcessing.CogIPOneImageTool;

                        switch (mode)
                        {
                        case ModificationMode.disable:
                            oneImageTool.CurrentRecordEnable     = Cognex.VisionPro.ImageProcessing.CogIPOneImageCurrentRecordConstants.None;
                            oneImageTool.LastRunRecordDiagEnable = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordDiagConstants.None;
                            oneImageTool.LastRunRecordEnable     = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordConstants.None;
                            break;

                        case ModificationMode.enableALL:
                            oneImageTool.CurrentRecordEnable     = Cognex.VisionPro.ImageProcessing.CogIPOneImageCurrentRecordConstants.All;
                            oneImageTool.LastRunRecordDiagEnable = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordDiagConstants.All;
                            oneImageTool.LastRunRecordEnable     = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordConstants.All;
                            break;

                        case ModificationMode.standard:
                            //oneImageTool.CurrentRecordEnable = Region | InputImage
                            oneImageTool.CurrentRecordEnable
                                = Cognex.VisionPro.ImageProcessing.CogIPOneImageCurrentRecordConstants.Region
                                  | Cognex.VisionPro.ImageProcessing.CogIPOneImageCurrentRecordConstants.InputImage
                                ;

                            //oneImageTool.LastRunRecordDiagEnable = InputImageByReference
                            oneImageTool.LastRunRecordDiagEnable
                                = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordDiagConstants.InputImageByReference
                                ;

                            //oneImageTool.LastRunRecordEnable = OutputImage
                            oneImageTool.LastRunRecordEnable
                                = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordConstants.OutputImage
                                ;
                            break;
                        }
                    }

                    ////Handle further tools here
                    //CogPixelMapTool
                    //CogImageConvertTool


                    ////Cases for modes
                    //switch (mode)
                    //{
                    //    case ModificationMode.disable:

                    //        break;

                    //    case ModificationMode.enableALL:

                    //        break;

                    //    case ModificationMode.standard:

                    //        break;
                    //}

                    else
                    {
                        tmpProcessingString = String.Format("   Skipping: {0}({1})", tool.Name, tool.GetType().ToString());
                        //    //Breakpoint for unused tools :)
                        //    Trace.Write("Skip..." );
                    }
                }
                Trace.WriteLine(tmpProcessingString);
            }
        }
 public GitIntegratedBuilder(ModificationMode modificationMode)
 {
     _modificationMode = modificationMode;
 }
        private String getDetailRegionFeedback(ModificationMode mode)
        {
            String detail = "";//Bearbeitung: ";

            switch (mode)
            {
                case ModificationMode.Unknown:
                    break;
                case ModificationMode.Move:

                    if (LastSelectedShapePolygonPoints != null) { return GetPointText(LastSelectedShapePolygonPoints); }

                    detail += LL.GetTrans("tangram.oomanipulation.manipulation.move");
                    if (LastSelectedShape != null && LastSelectedShape.Position != null)
                    {
                        detail += " - " + LL.GetTrans("tangram.oomanipulation.manipulation.move.status"
                            , ((float)((float)LastSelectedShape.Position.X / 1000)).ToString("0.#")
                            , ((float)((float)LastSelectedShape.Position.Y / 1000)).ToString("0.#"));
                    }
                    break;
                case ModificationMode.Scale:
                    detail += LL.GetTrans("tangram.oomanipulation.manipulation.scale");
                    if (LastSelectedShape != null && LastSelectedShape.Size != null)
                    {
                        detail += " - " + LL.GetTrans("tangram.oomanipulation.manipulation.scale.status"
                            , ((float)((float)LastSelectedShape.Size.Height / 1000)).ToString("0.#")
                            , ((float)((float)LastSelectedShape.Size.Width / 1000)).ToString("0.#"));
                    }
                    break;
                case ModificationMode.Rotate:
                    detail += LL.GetTrans("tangram.oomanipulation.manipulation.rotate");
                    if (LastSelectedShape != null)
                    {
                        detail += " - " + LL.GetTrans("tangram.oomanipulation.degrees", (LastSelectedShape.Rotation / 100).ToString("0."));
                    }
                    break;
                case ModificationMode.Fill:
                    detail += LL.GetTrans("tangram.oomanipulation.manipulation.filling");
                    if (LastSelectedShape != null)
                    {
                        if (LastSelectedShape.GetProperty("FillBitmap") != null)
                        {
                            detail += " - " + LastSelectedShape.GetBackgroundBitmapName(); // TODO: incorrect name of bitmap after changing it the first time (only returns "Bitmape 1" ect.)
                        }
                    }
                    break;
                case ModificationMode.Line:
                    detail += LL.GetTrans("tangram.oomanipulation.manipulation.line");
                    if (LastSelectedShape != null)
                    {
                        detail += " - " + LL.GetTrans("tangram.oomanipulation.manipulation.line.status"
                            , ((float)((float)LastSelectedShape.LineWidth / 100)).ToString("0.#")
                            , getCurrentLineStyle());
                    }
                    break;
                default:
                    break;
            }
            return detail;
        }
        private String getAudioFeedback(ModificationMode mode)
        {
            String audio = "";//"Element ";

            switch (mode)
            {
                case ModificationMode.Unknown:
                    break;
                case ModificationMode.Move:
                    audio += LL.GetTrans("tangram.oomanipulation.manipulation.move");
                    if (LastSelectedShape != null && LastSelectedShape.Position != null)
                    {
                        audio += ", " + LL.GetTrans("tangram.oomanipulation.current") + ": "
                            + LL.GetTrans("tangram.oomanipulation.manipulation.move.status.audio"
                            , ((float)((float)LastSelectedShape.Position.X / 1000)).ToString("0.#")
                            , ((float)((float)LastSelectedShape.Position.Y / 1000)).ToString("0.#"));
                    }
                    break;
                case ModificationMode.Scale:
                    audio += LL.GetTrans("tangram.oomanipulation.manipulation.scale");
                    if (LastSelectedShape != null && LastSelectedShape.Size != null)
                    {
                        audio += ", " + LL.GetTrans("tangram.oomanipulation.current") + ": "
                            + LL.GetTrans("tangram.oomanipulation.manipulation.scale.status.audio"
                            , ((float)((float)LastSelectedShape.Size.Height / 1000)).ToString("0.#")
                            , ((float)((float)LastSelectedShape.Size.Width / 1000)).ToString("0.#"));
                    }
                    break;
                case ModificationMode.Rotate:
                    audio += LL.GetTrans("tangram.oomanipulation.manipulation.rotate");
                    if (LastSelectedShape != null)
                    {
                        audio += ", " + LL.GetTrans("tangram.oomanipulation.current") + ": "
                            + LL.GetTrans("tangram.oomanipulation.manipulation.rotate.status.audio"
                            , (LastSelectedShape.Rotation / 100).ToString("0."));
                    }
                    break;
                case ModificationMode.Fill:
                    audio += LL.GetTrans("tangram.oomanipulation.manipulation.filling.audio");
                    if (LastSelectedShape != null)
                    {
                        if (LastSelectedShape.GetProperty("FillBitmap") == null) audio += ", " + LL.GetTrans("tangram.oomanipulation.manipulation.filling.status.none");
                        else
                        {
                            audio += ", " + LL.GetTrans("tangram.oomanipulation.current") + ": "
                                + LL.GetTrans("tangram.oomanipulation.manipulation.filling.status"
                                , LastSelectedShape.GetBackgroundBitmapName());
                        }
                    }
                    break;
                case ModificationMode.Line:
                    audio += LL.GetTrans("tangram.oomanipulation.manipulation.line.audio");
                    if (LastSelectedShape != null)
                    {
                        audio += ", " + LL.GetTrans("tangram.oomanipulation.current") + ": "
                            + LL.GetTrans("tangram.oomanipulation.manipulation.line.status.audio"
                            , ((float)((float)LastSelectedShape.LineWidth / 100)).ToString("0.#")
                            , getCurrentLineStyle());
                    }
                    break;
                default:
                    break;
            }
            return audio;
        }
示例#7
0
        private void modifyToolsInToolgroup(CogToolGroup toolGroup, ModificationMode mode)
        {
            Trace.WriteLine("ModifyToolsInToolGroup: Mode="+ mode);
            foreach (ICogTool tool in toolGroup.Tools)
            {
                //CogInputImageTool (Nicht beachten, da Kamera)

                //CogToolGroup
                if ((tmpToolGroup = (tool as CogToolGroup)) != null)
                {
                    tmpProcessingString = "Processing Group: " + tool.Name;
                    //recursively check all ToolBlocks/ToolGroups
                    modifyToolsInToolgroup(tmpToolGroup, mode);
                }
                else
                {
                    tmpProcessingString = "-> Processing: " + tool.Name;

                    //CogBlobTool
                    if (tool as Cognex.VisionPro.Blob.CogBlobTool != null)
                    {
                        Cognex.VisionPro.Blob.CogBlobTool Blob = tool as Cognex.VisionPro.Blob.CogBlobTool;

                        switch (mode)
                        {
                            case ModificationMode.disable:
                                Blob.CurrentRecordEnable = Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.None;
                                Blob.LastRunRecordDiagEnable = Cognex.VisionPro.Blob.CogBlobLastRunRecordDiagConstants.None;
                                Blob.LastRunRecordEnable = Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.None;
                                break;
                            
                            case ModificationMode.enableALL:
                                Blob.CurrentRecordEnable = Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.All;
                                Blob.LastRunRecordDiagEnable = Cognex.VisionPro.Blob.CogBlobLastRunRecordDiagConstants.All;
                                Blob.LastRunRecordEnable = Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.All;
                                break;
                            
                            case ModificationMode.standard:
                                //Blob.CurrentRecordEnable = Region | InputImageMask | Histogram | InputImage
                                Blob.CurrentRecordEnable
                                    = Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.Region
                                    | Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.InputImageMask
                                    | Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.Histogram
                                    | Cognex.VisionPro.Blob.CogBlobCurrentRecordConstants.InputImage
                                    ;

                                //Blob.LastRunRecordDiagEnable = InputImageByReference
                                Blob.LastRunRecordDiagEnable
                                    = Cognex.VisionPro.Blob.CogBlobLastRunRecordDiagConstants.InputImageByReference
                                    ;

                                //Blob.LastRunRecordEnable = ResultsBoundary | BlobImageUnfiltered | BlobImage
                                Blob.LastRunRecordEnable
                                    = Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.ResultsBoundary
                                    | Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.BlobImageUnfiltered
                                    | Cognex.VisionPro.Blob.CogBlobLastRunRecordConstants.BlobImage
                                    ;
                                break;
                        }
                        
                    }

                    //CogPMAlignTool
                    else if (tool as Cognex.VisionPro.PMAlign.CogPMAlignTool != null)
                    {
                        Cognex.VisionPro.PMAlign.CogPMAlignTool PMAlign = tool as Cognex.VisionPro.PMAlign.CogPMAlignTool;

                        switch (mode)
                        {
                            case ModificationMode.disable:
                                PMAlign.CurrentRecordEnable = Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.None;
                                PMAlign.LastRunRecordDiagEnable = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordDiagConstants.None;
                                PMAlign.LastRunRecordEnable = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordConstants.None;
                                break;

                            case ModificationMode.enableALL:
                                PMAlign.CurrentRecordEnable = Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.All;
                                PMAlign.LastRunRecordDiagEnable = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordDiagConstants.All;
                                PMAlign.LastRunRecordEnable = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordConstants.All;
                                break;

                            case ModificationMode.standard:
                                //PMAlign.CurrentRecordEnable = InputImage | PatternOrigin | SearchImageMask | SearchRegion | TrainShapeModels | TrainImageMask | TrainRegion | TrainImage
                                PMAlign.CurrentRecordEnable
                                    = Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.InputImage
                                    | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.PatternOrigin
                                    | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.SearchImageMask
                                    | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.SearchRegion
                                    | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.TrainShapeModels
                                    | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.TrainImageMask
                                    | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.TrainRegion
                                    | Cognex.VisionPro.PMAlign.CogPMAlignCurrentRecordConstants.TrainImage
                                    ;

                                //PMAlign.LastRunRecordDiagEnable = InputImageByReference
                                PMAlign.LastRunRecordDiagEnable
                                    = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordDiagConstants.InputImageByReference
                                    ;

                                //PMAlign.LastRunRecordEnable = ResultsMatchRegion | ResultsOrigin
                                PMAlign.LastRunRecordEnable
                                    = Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordConstants.ResultsMatchRegion
                                    | Cognex.VisionPro.PMAlign.CogPMAlignLastRunRecordConstants.ResultsOrigin
                                    ;
                                break;
                        }

                    }

                    //CogSearchMaxTool
                    else if (tool as Cognex.VisionPro.SearchMax.CogSearchMaxTool != null)
                    {
                        Cognex.VisionPro.SearchMax.CogSearchMaxTool SearchMax = tool as Cognex.VisionPro.SearchMax.CogSearchMaxTool;

                        switch (mode)
                        {
                            case ModificationMode.disable:
                                SearchMax.CurrentRecordEnable = Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.None;
                                SearchMax.LastRunRecordDiagEnable = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordDiagConstants.None;
                                SearchMax.LastRunRecordEnable = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordConstants.None;
                                break;

                            case ModificationMode.enableALL:
                                SearchMax.CurrentRecordEnable = Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.All;
                                SearchMax.LastRunRecordDiagEnable = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordDiagConstants.All;
                                SearchMax.LastRunRecordEnable = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordConstants.All;
                                break;

                            case ModificationMode.standard:
                                //SearchMax.CurrentRecordEnable = PatternOrigin | TrainRegion | TrainImageMask | TrainImage | SearchImageMask | SearchRegion | InputImage
                                SearchMax.CurrentRecordEnable
                                    = Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.PatternOrigin
                                    | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.TrainRegion
                                    | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.TrainImageMask
                                    | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.TrainImage
                                    | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.SearchImageMask
                                    | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.SearchRegion
                                    | Cognex.VisionPro.SearchMax.CogSearchMaxCurrentRecordConstants.InputImage
                                    ;

                                //SearchMax.LastRunRecordDiagEnable = InputImageByReference
                                SearchMax.LastRunRecordDiagEnable
                                    = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordDiagConstants.InputImageByReference
                                    ;

                                //SearchMax.LastRunRecordEnable = ResultsOrigin | ResultsMatchRegion
                                SearchMax.LastRunRecordEnable
                                    = Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordConstants.ResultsOrigin
                                    | Cognex.VisionPro.SearchMax.CogSearchMaxLastRunRecordConstants.ResultsMatchRegion
                                    ;
                                break;
                        }
                        
                    }

                    //CogFixtureTool
                    else if (tool as Cognex.VisionPro.CalibFix.CogFixtureTool != null)
                    {
                        Cognex.VisionPro.CalibFix.CogFixtureTool FixtureTool = tool as Cognex.VisionPro.CalibFix.CogFixtureTool;

                        switch (mode)
                        {
                            case ModificationMode.disable:
                                FixtureTool.CurrentRecordEnable = Cognex.VisionPro.CalibFix.CogFixtureCurrentRecordConstants.None;
                                FixtureTool.LastRunRecordDiagEnable = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordDiagConstants.None;
                                FixtureTool.LastRunRecordEnable = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordConstants.None;
                                break;

                            case ModificationMode.enableALL:
                                FixtureTool.CurrentRecordEnable = Cognex.VisionPro.CalibFix.CogFixtureCurrentRecordConstants.All;
                                FixtureTool.LastRunRecordDiagEnable = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordDiagConstants.All;
                                FixtureTool.LastRunRecordEnable = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordConstants.All;
                                break;

                            case ModificationMode.standard:
                                //FixtureTool.CurrentRecordEnable = InputImage | FixturedAxes
                                FixtureTool.CurrentRecordEnable
                                    = Cognex.VisionPro.CalibFix.CogFixtureCurrentRecordConstants.InputImage
                                    | Cognex.VisionPro.CalibFix.CogFixtureCurrentRecordConstants.FixturedAxes
                                    ;

                                //FixtureTool.LastRunRecordDiagEnable = FixturedAxes
                                FixtureTool.LastRunRecordDiagEnable
                                    = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordDiagConstants.FixturedAxes
                                    ;

                                //FixtureTool.LastRunRecordEnable = OutputImage
                                FixtureTool.LastRunRecordEnable
                                    = Cognex.VisionPro.CalibFix.CogFixtureLastRunRecordConstants.OutputImage
                                    ;
                                break;
                        }
                        
                    }

                    //CogHistogramTool
                    else if (tool as Cognex.VisionPro.ImageProcessing.CogHistogramTool != null)
                    {
                        Cognex.VisionPro.ImageProcessing.CogHistogramTool Histogram = tool as Cognex.VisionPro.ImageProcessing.CogHistogramTool;

                        switch (mode)
                        {
                            case ModificationMode.disable:
                                Histogram.CurrentRecordEnable = Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.None;
                                Histogram.LastRunRecordDiagEnable = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordDiagConstants.None;
                                Histogram.LastRunRecordEnable = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordConstants.None;
                                break;

                            case ModificationMode.enableALL:
                                Histogram.CurrentRecordEnable = Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.All;
                                Histogram.LastRunRecordDiagEnable = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordDiagConstants.All;
                                Histogram.LastRunRecordEnable = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordConstants.All;
                                break;

                            case ModificationMode.standard:
                                //Histogram.CurrentRecordEnable = Region | InputImageMask | InputImage
                                Histogram.CurrentRecordEnable
                                    = Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.Region
                                    | Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.InputImageMask
                                    | Cognex.VisionPro.ImageProcessing.CogHistogramCurrentRecordConstants.InputImage
                                    ;

                                //Histogram.LastRunRecordDiagEnable = InputImageByReference
                                Histogram.LastRunRecordDiagEnable
                                    = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordDiagConstants.InputImageByReference
                                    ;

                                //Histogram.LastRunRecordEnable = Mean | Histogram
                                Histogram.LastRunRecordEnable
                                    = Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordConstants.Mean
                                    | Cognex.VisionPro.ImageProcessing.CogHistogramLastRunRecordConstants.Histogram
                                    ;
                                break;
                        }
                        
                    }

                    //CogFindLineTool
                    else if (tool as Cognex.VisionPro.Caliper.CogFindLineTool != null)
                    {
                        Cognex.VisionPro.Caliper.CogFindLineTool FindLine = tool as Cognex.VisionPro.Caliper.CogFindLineTool;

                        switch (mode)
                        {
                            case ModificationMode.disable:
                                FindLine.CurrentRecordEnable = Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.None;
                                FindLine.LastRunRecordDiagEnable = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordDiagConstants.None;
                                FindLine.LastRunRecordEnable = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.None;
                                break;

                            case ModificationMode.enableALL:
                                FindLine.CurrentRecordEnable = Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.All;
                                FindLine.LastRunRecordDiagEnable = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordDiagConstants.All;
                                FindLine.LastRunRecordEnable = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.All;
                                break;

                            case ModificationMode.standard:
                                //FindLine.CurrentRecordEnable = ExpectedLineSegment | InteractiveCaliperSearchDirection | InteractiveCaliperSize | CaliperRegions | InputImage
                                FindLine.CurrentRecordEnable
                                    = Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.ExpectedLineSegment
                                    | Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.InteractiveCaliperSearchDirection
                                    | Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.InteractiveCaliperSize
                                    | Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.CaliperRegions
                                    | Cognex.VisionPro.Caliper.CogFindLineCurrentRecordConstants.InputImage
                                    ;

                                //FindLine.LastRunRecordDiagEnable = InputImageByReference
                                FindLine.LastRunRecordDiagEnable
                                    = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordDiagConstants.InputImageByReference
                                    ;

                                //FindLine.LastRunRecordEnable = ResultsIgnoredPoints | ResultsUsedPoints | BestFitLineSegment
                                FindLine.LastRunRecordEnable
                                    = Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.ResultsIgnoredPoints
                                    | Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.ResultsUsedPoints
                                    | Cognex.VisionPro.Caliper.CogFindLineLastRunRecordConstants.BestFitLineSegment
                                    ;
                                break;
                        }
                        
                    }

                    //CogIPOneImageTool
                    else if (tool as Cognex.VisionPro.ImageProcessing.CogIPOneImageTool != null)
                    {
                        Cognex.VisionPro.ImageProcessing.CogIPOneImageTool oneImageTool = tool as Cognex.VisionPro.ImageProcessing.CogIPOneImageTool;

                        switch (mode)
                        {
                            case ModificationMode.disable:
                                oneImageTool.CurrentRecordEnable = Cognex.VisionPro.ImageProcessing.CogIPOneImageCurrentRecordConstants.None;
                                oneImageTool.LastRunRecordDiagEnable = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordDiagConstants.None;
                                oneImageTool.LastRunRecordEnable = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordConstants.None;
                                break;

                            case ModificationMode.enableALL:
                                oneImageTool.CurrentRecordEnable = Cognex.VisionPro.ImageProcessing.CogIPOneImageCurrentRecordConstants.All;
                                oneImageTool.LastRunRecordDiagEnable = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordDiagConstants.All;
                                oneImageTool.LastRunRecordEnable = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordConstants.All;
                                break;

                            case ModificationMode.standard:
                                //oneImageTool.CurrentRecordEnable = Region | InputImage
                                oneImageTool.CurrentRecordEnable
                                    = Cognex.VisionPro.ImageProcessing.CogIPOneImageCurrentRecordConstants.Region
                                    | Cognex.VisionPro.ImageProcessing.CogIPOneImageCurrentRecordConstants.InputImage
                                    ;

                                //oneImageTool.LastRunRecordDiagEnable = InputImageByReference
                                oneImageTool.LastRunRecordDiagEnable
                                    = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordDiagConstants.InputImageByReference
                                    ;

                                //oneImageTool.LastRunRecordEnable = OutputImage
                                oneImageTool.LastRunRecordEnable
                                    = Cognex.VisionPro.ImageProcessing.CogIPOneImageLastRunRecordConstants.OutputImage
                                    ;
                                break;
                        }
                    }

                    ////Handle further tools here
                    //CogPixelMapTool
                    //CogImageConvertTool


                    ////Cases for modes
                    //switch (mode)
                    //{
                    //    case ModificationMode.disable:

                    //        break;
                        
                    //    case ModificationMode.enableALL:

                    //        break;

                    //    case ModificationMode.standard:

                    //        break;
                    //}
                    
                    else
                    {
                        tmpProcessingString = String.Format("   Skipping: {0}({1})", tool.Name, tool.GetType().ToString());
                        //    //Breakpoint for unused tools :)
                        //    Trace.Write("Skip..." );
                    }
                }
                Trace.WriteLine(tmpProcessingString);
            }
        }