//----------------------- Methods ------------------
        public static ClRender getInstance()
        {
            if (m_instance == null)
                m_instance = new ClRender();

            return m_instance;
        }
Beispiel #2
0
        //----------------------- Methods ------------------
        static public ClRender getInstance()
        {
            if (m_instance == null)
            {
                m_instance = new ClRender();
            }

            return(m_instance);
        }
Beispiel #3
0
 private void PanelDirectX_MouseLeave(object sender, EventArgs e)
 {
     #if RENDER_1
     if (!ClFasadaPreprocessing.IsPreProcessing())
     {
         ClRender.getInstance().StopRendering();
     }
     #endif
 }
Beispiel #4
0
        public DxForm(string ApplicationName, string ApplicationVersion)
        {
            APPLICATION_NAME    = ApplicationName;
            APPLICATION_VERSION = ApplicationVersion;
#if RENDER_0
            APPLICATION_VERSION += " [version without 3D models rendering]";
#endif

            InitializeComponent();
#if RENDER_1
            Application.AddMessageFilter(new CScrollPanelMessageFilter(this.PanelDirectX)); // neaded to get event about scroll wheal in the panel
            this.PanelDirectX.MouseMove  += new System.Windows.Forms.MouseEventHandler(ClEventSender.getInstance().BroadcastMouseMoveEvent);
            this.PanelDirectX.MouseDown  += new System.Windows.Forms.MouseEventHandler(ClEventSender.getInstance().BroadcastMouseButtonDownEvent);
            this.PanelDirectX.MouseUp    += new System.Windows.Forms.MouseEventHandler(ClEventSender.getInstance().BroadcastMouseButtonUpEvent);
            this.PanelDirectX.MouseWheel += new System.Windows.Forms.MouseEventHandler(ClEventSender.getInstance().BroadcastMouseWheelEvent);
#endif
            ClInformationReciver viewer = new ClInformationReciver(this);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eDebugText);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eError);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eProgress);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eTextInternal);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eTextExternal);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eStartProcessing);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eStopProcessing);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eColorMapChanged);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eNextRecognitionScore);
            ClInformationSender.RegisterReceiver(viewer, ClInformationSender.eInformationType.eWindowInfo);

            this.Text = APPLICATION_NAME + " ver. " + APPLICATION_VERSION;

#if RENDER_1
            ClRender Render = ClRender.getInstance();
            Render.CreateDevice(this.PanelDirectX);

            ClCamera Camera = new ClCamera();   // Create camera object
            Camera.RegisterForEvent(ClEventSender.eEvents.e_MouseMove);
            Camera.RegisterForEvent(ClEventSender.eEvents.e_MouseButtonDown);
            Camera.RegisterForEvent(ClEventSender.eEvents.e_MouseButtonUp);
            Camera.RegisterForEvent(ClEventSender.eEvents.e_MouseWheel);
            Render.SetCamera(Camera);   // Register camera as a render object

            //  Render.AddRenderObj(new ClCoordinateSystem());
#endif
            List <string> fileTypes = Cl3DModel.sm_ListManagedFilesExtensions;
            string        filter    = "";
            string        AllNames  = "All supported types";
            string        AllExt    = "";
            foreach (string type in fileTypes)
            {
                AllExt += "*." + type + ";";
                filter += type.ToUpper() + "|*." + type + "|";
            }
            filter = filter.Remove(filter.Length - 1);
            AllExt = AllExt.Remove(AllExt.Length - 1);
            openFileDialog.Filter = AllNames + "|" + AllExt + "|" + filter;
        }
Beispiel #5
0
        public virtual void NewInformation(string p_sInformation, ClInformationSender.eInformationType p_eType)
        {
            if (p_eType == ClInformationSender.eInformationType.eStartProcessing)
            {
#if RENDER_1
                ClRender.getInstance().StopRendering();
#endif
            }
            else if (p_eType == ClInformationSender.eInformationType.eStopProcessing)
            {
#if RENDER_1
                //   ClRender.getInstance().StartRendering();
#endif
            }

            m_form.Invoke(d, new object[] { p_sInformation, p_eType });
        }
Beispiel #6
0
 private void changeBackgroundColorToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (colorDialog.ShowDialog() == DialogResult.OK)
         {
             #if RENDER_1
             ClRender.getInstance().SetBackgroundColor(colorDialog.Color);
             #endif
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\n\n Call Stack:\n\n" + ex.StackTrace, "Exception !", MessageBoxButtons.OK, MessageBoxIcon.Error);
         ClInformationSender.SendInformation("EXCEPTION\n" + ex.Message + "\n\n Call Stack:\n\n" + ex.StackTrace, ClInformationSender.eInformationType.eDebugText);
     }
 }
Beispiel #7
0
        private void DxForm_Deactivate(object sender, EventArgs e)
        {
            try
            {
#if RENDER_1
                if (!ClFasadaPreprocessing.IsPreProcessing())
                {
                    ClRender.getInstance().StopRendering();
                }
#endif
            }
            catch (Exception ex)
            {
                //Cursor.Current = Cursors.Arrow;
                MessageBox.Show(ex.Message, "Exception !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ClInformationSender.SendInformation("EXCEPTION\n" + ex.Message + "\n\n Call Stack:\n\n" + ex.StackTrace, ClInformationSender.eInformationType.eDebugText);
            }
        }
Beispiel #8
0
        private void toolStripButtonReset_Click(object sender, EventArgs e)
        {
            try
            {
                ClFasadaPreprocessing.ResetFasade();
#if RENDER_1
                ClRender.getInstance().DeleteAllRenderObj();
#endif
                if (m_Model3D != null)
                {
                    m_Model3D.ResetModel();
                    m_Model3D = null;
                }
                m_sTestDirectory = "";
                this.Text        = APPLICATION_NAME + " ver. " + APPLICATION_VERSION;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n Call Stack:\n\n" + ex.StackTrace, "Exception !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ClInformationSender.SendInformation("EXCEPTION\n" + ex.Message + "\n\n Call Stack:\n\n" + ex.StackTrace, ClInformationSender.eInformationType.eDebugText);
            }
        }
Beispiel #9
0
        private void toolStripButtonOpen_Click(object sender, EventArgs e)
        {
            try
            {
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    folderBrowserDialog.SelectedPath = "";
                    this.Text = APPLICATION_NAME + " <" + openFileDialog.FileName + ">";

                    m_Model3D = new Cl3DModel();
                    m_Model3D.LoadModel(openFileDialog.FileName);
                    #if RENDER_1
                    ClRender.getInstance().AddRenderObj(new Cl3DRenderModel(m_Model3D));
                    #endif
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n Call Stack:\n\n" + ex.StackTrace, "Exception !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ClInformationSender.SendInformation("EXCEPTION\n" + ex.Message + "\n\n Call Stack:\n\n" + ex.StackTrace, ClInformationSender.eInformationType.eDebugText);
            }
        }
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                // register all file formats
                Cl3DModel.RegisterReader(new ClAbsModelReader());
                Cl3DModel.RegisterReader(new ClWrmlModelReader());
                Cl3DModel.RegisterReader(new ClXYZModelReader());
                Cl3DModel.RegisterReader(new ClModelModelReader());
                Cl3DModel.RegisterReader(new ClBntModelReader());
                Cl3DModel.RegisterReader(new ClRifModelReader());
                Cl3DModel.RegisterReader(new ClMfileModelReader());
                Cl3DModel.RegisterReader(new ClOFFModelReader());
                Cl3DModel.RegisterReader(new ClOBJModelReader());
                Cl3DModel.RegisterReader(new ClPlyModelReader());
                Cl3DModel.RegisterReader(new ClDATModelReader());

                DxForm MainForm = new DxForm("3D Face Models Preprocessing Tool", "2.9");

                ClInformationSender.RegisterReceiver(new ClNewAlgorithmViewer(MainForm.TreeView), ClInformationSender.eInformationType.eNewAlgorithm); // add new algorithm watcher to add algoritms on form

                // register all algorithms to Algorithm Builder
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLockModel.CrateAlgorithm, ClLockModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCheckIfCurvatureHasBeenCalculated.CrateAlgorithm, ClCheckIfCurvatureHasBeenCalculated.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCheckPointsPrecision.CrateAlgorithm, ClCheckPointsPrecision.ALGORITHM_NAME);

                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCalculateConformalParameterization.CrateAlgorithm, ClCalculateConformalParameterization.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClNormalizeConformalMaps.CrateAlgorithm, ClNormalizeConformalMaps.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCalculateConformalFactor.CrateAlgorithm, ClCalculateConformalFactor.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClConvertToUVParametrization.CrateAlgorithm, ClConvertToUVParametrization.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClMobiusMapping.CrateAlgorithm, ClMobiusMapping.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRotateToPlaneCut.CrateAlgorithm, ClRotateToPlaneCut.ALGORITHM_NAME);


                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveOneVertex.CrateAlgorithm, ClRemoveOneVertex.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveSingleConnections.CrateAlgorithm, ClRemoveSingleConnections.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveSmallUnconnectedParts.CrateAlgorithm, ClRemoveSmallUnconnectedParts.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRotatieModel.CrateAlgorithm, ClRotatieModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClScaleModel.CrateAlgorithm, ClScaleModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClMoveModel.CrateAlgorithm, ClMoveModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCorrectFacePose.CrateAlgorithm, ClCorrectFacePose.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveRandomPartOfFace.CrateAlgorithm, ClRemoveRandomPartOfFace.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveHalfOfTheFace.CrateAlgorithm, ClRemoveHalfOfTheFace.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemovePathBetweenPoints.CrateAlgorithm, ClRemovePathBetweenPoints.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSetUnspecifiedPointTo.CrateAlgorithm, ClSetUnspecifiedPointTo.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveAllLandmarks.CrateAlgorithm, ClRemoveAllLandmarks.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemeshModel.CrateAlgorithm, ClRemeshModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRoundAllxyValuesSimplifyModel.CrateAlgorithm, ClRoundAllxyValuesSimplifyModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRoundUVvalues.CrateAlgorithm, ClRoundUVvalues.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCreateRegularGrid.CrateAlgorithm, ClCreateRegularGrid.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClAddExpressionFRGC.CrateAlgorithm, ClAddExpressionFRGC.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCurvatureSubstractionFromTheSamePoints.CrateAlgorithm, ClCurvatureSubstractionFromTheSamePoints.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveSpikesMedianFilter.CrateAlgorithm, ClRemoveSpikesMedianFilter.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveSpikesGaussianFilter.CrateAlgorithm, ClRemoveSpikesGaussianFilter.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveHoles.CrateAlgorithm, ClRemoveHoles.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRemoveHolesRangeImage.CrateAlgorithm, ClRemoveHolesRangeImage.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCurvaturesAndShapeIndexComputation.CrateAlgorithm, ClCurvaturesAndShapeIndexComputation.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCalculateCurvednessIndex.CrateAlgorithm, ClCalculateCurvednessIndex.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCalculateDistanceOnUVFrom3Points.CrateAlgorithm, ClCalculateDistanceOnUVFrom3Points.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCalculateDistanceOnXYZFrom3Points.CrateAlgorithm, ClCalculateDistanceOnXYZFrom3Points.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCalculateNormalVectors.CrateAlgorithm, ClCalculateNormalVectors.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCalculateUVExternalApp.CrateAlgorithm, ClCalculateUVExternalApp.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClFindNoseTipAndEyesHKClassification.CrateAlgorithm, ClFindNoseTipAndEyesHKClassification.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClFindNoseTipMaxVal.CrateAlgorithm, ClFindNoseTipMaxVal.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClAddGenericModel.CrateAlgorithm, ClAddGenericModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClAdjustAntropometryPoints.CrateAlgorithm, ClAdjustAntropometryPoints.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCropFaceBySphere.CrateAlgorithm, ClCropFaceBySphere.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCropFaceByGeodesicDistance.CrateAlgorithm, ClCropFaceByGeodesicDistance.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCropFaceEdge.CrateAlgorithm, ClCropFaceEdge.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCropFaceFrequencyFromTheNoseTip.CrateAlgorithm, ClCropFaceFrequencyFromTheNoseTip.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClFaceMouth.CrateAlgorithm, ClFaceMouth.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCropByPlane.CrateAlgorithm, ClCropByPlane.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCropFaceGeodesicDistAndClosedLips.CrateAlgorithm, ClCropFaceGeodesicDistAndClosedLips.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCropEyesPart.CrateAlgorithm, ClCropEyesPart.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClCropFaceSpecificValueLessThanThreshold.CrateAlgorithm, ClCropFaceSpecificValueLessThanThreshold.ALGORITHM_NAME);

                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadManualSpecificPoints.CrateAlgorithm, ClLoadManualSpecificPoints.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadAutomaticSpecificPoints.CrateAlgorithm, ClLoadAutomaticSpecificPoints.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadModelCurvaturesValues.CrateAlgorithm, ClLoadModelCurvaturesValues.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadPtsWithId.CrateAlgorithm, ClLoadPtsWithId.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadModelTextureFRGC.CrateAlgorithm, ClLoadModelTextureFRGC.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadLandmarksBosphourus.CrateAlgorithm, ClLoadLandmarksBosphourus.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadModelTextureBosphorus.CrateAlgorithm, ClLoadModelTextureBosphorus.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadXiangManual.CrateAlgorithm, ClLoadXiangManual.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClLoadGavabManual.CrateAlgorithm, ClLoadGavabManual.ALGORITHM_NAME);

                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveModel.CrateAlgorithm, ClSaveModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveModelToObj.CrateAlgorithm, ClSaveModelToObj.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveModelToMFile.CrateAlgorithm, ClSaveModelToMFile.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveToMFileNew.CrateAlgorithm, ClSaveToMFileNew.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveSpecificPointsCoordinates.CrateAlgorithm, ClSaveSpecificPointsCoordinates.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveManualLandmarks.CrateAlgorithm, ClSaveManualLandmarks.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveSpecificPointsWithIDs.CrateAlgorithm, ClSaveSpecificPointsWithIDs.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveModelCurvaturesValues.CrateAlgorithm, ClSaveModelCurvaturesValues.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveObjectBitmap.CrateAlgorithm, ClSaveObjectBitmap.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClRasterizeModel.CrateAlgorithm, ClRasterizeModel.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveNoseTipXYandEyesAngle.CrateAlgorithm, ClSaveNoseTipXYandEyesAngle.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClSaveRotationAndTranslationToGenModel.CrateAlgorithm, ClSaveRotationAndTranslationToGenModel.ALGORITHM_NAME);

                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClShowHKClassification.CrateAlgorithm, ClShowHKClassification.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClShowNoseRegions.CrateAlgorithm, ClShowNoseRegions.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClShowEyesRegions.CrateAlgorithm, ClShowEyesRegions.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClColorModelSpecificValue.CrateAlgorithm, ClColorModelSpecificValue.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClColorMainPointsNeighborhood.CrateAlgorithm, ClColorMainPointsNeighborhood.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClColorNoseTipNeighborhood.CrateAlgorithm, ClColorNoseTipNeighborhood.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClColorGeometryImage.CrateAlgorithm, ClColorGeometryImage.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClColorModelNormalVectors.CrateAlgorithm, ClColorModelNormalVectors.ALGORITHM_NAME);

                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClDoSomething.CrateAlgorithm, ClDoSomething.ALGORITHM_NAME);

                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClOrganizeFolders.CrateAlgorithm, ClOrganizeFolders.ALGORITHM_NAME);
                ClMapObjectAlgorithmBuilder.RegisterNewAlgorithm(ClOrganizeFoldersByExpression.CrateAlgorithm, ClOrganizeFoldersByExpression.ALGORITHM_NAME);
                //-----------------------------------------------------

                Application.Run(MainForm);
#if RENDER_1
                ClRender.getInstance().StopRendering();
#endif
                ClFasadaPreprocessing.ResetFasade();
            }
            catch (Exception e)
            {
#if RENDER_1
                ClRender.getInstance().StopRendering();
#endif
                if (MessageBox.Show("Unexpected error: " + e.Message + "\nRestart the application?", "Exception", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    Application.Restart();
                }
                else
                {
                    Application.Exit();
                }
            }
        }
Beispiel #11
0
        public override void Render(Device p_dDevice, Control p_cRenderWindow)
        {
            if (m_Base3DModel.IsModelChanged)
            {
                //ClInformationSender.SendInformation("Creating render object ("+m_Base3DModel.ModelPointsCount+" points)...", ClInformationSender.eInformationType.eTextExternal);
                m_lRenderModelVertex.Clear();
                m_lRenderLines.Clear();
                m_Base3DModel.ResetVisitedPoints();
                Cl3DModel.Cl3DModelPointIterator iterator = m_Base3DModel.GetIterator();
                List <KeyValuePair <string, Cl3DModel.Cl3DModelPointIterator> > specificPoints = m_Base3DModel.GetAllSpecificPoints();
                float meanX = 0;
                float meanY = 0;
                float meanZ = 0;
                if (iterator.IsValid())
                {
                    do
                    {
                        meanX += -iterator.X;
                        meanY += iterator.Y;
                        meanZ += iterator.Z;
                        Color pointColor      = new Color();
                        bool  isSpecificPoint = false;
                        foreach (KeyValuePair <string, Cl3DModel.Cl3DModelPointIterator> specificPoint in specificPoints)
                        {
                            if (iterator.PointID == specificPoint.Value.PointID)
                            {
                                isSpecificPoint = true;
                                break;
                            }
                        }
                        if (!isSpecificPoint)
                        {
                            pointColor = iterator.Color;
                        }
                        else
                        {
                            pointColor = Color.Red;
                        }

                        m_lRenderModelVertex.Add(new CustomVertex.PositionColored(-iterator.X, iterator.Y, iterator.Z, pointColor.ToArgb()));

                        List <Cl3DModel.Cl3DModelPointIterator> neighbors = iterator.GetListOfNeighbors();
                        foreach (Cl3DModel.Cl3DModelPointIterator neighbor in neighbors)
                        {
                            if (!neighbor.AlreadyVisited)
                            {
                                m_lRenderLines.Add(new CustomVertex.PositionColored(-iterator.X, iterator.Y, iterator.Z, pointColor.ToArgb()));
                                m_lRenderLines.Add(new CustomVertex.PositionColored(-neighbor.X, neighbor.Y, neighbor.Z, neighbor.Color.ToArgb()));
                            }
                        }
                        iterator.AlreadyVisited = true;
                    }while (iterator.MoveToNext());
                }

                m_Base3DModel.IsModelChanged = false;
                m_Base3DModel.ResetVisitedPoints();
                #if RENDER_1
                ClCamera camera = ClRender.getInstance().getCamera();
                if (camera != null)
                {
                    meanX /= m_lRenderModelVertex.Count;
                    meanY /= m_lRenderModelVertex.Count;
                    meanZ /= m_lRenderModelVertex.Count;
                    camera.MoveCameraLookAt(meanX, meanY, meanZ);
                    //    ClRender.getInstance().AddRenderObj(new ClCoordinateSystem(meanX,meanY,meanZ));
                }
                #endif
            }

            if (m_lRenderModelVertex.Count != 0)
            {
                p_dDevice.VertexFormat = CustomVertex.PositionColored.Format;
                if (m_lRenderLines.Count != 0)
                {
                    p_dDevice.DrawUserPrimitives(PrimitiveType.LineList, m_lRenderLines.Count / 2, m_lRenderLines.ToArray());
                }

                p_dDevice.DrawUserPrimitives(PrimitiveType.PointList, m_lRenderModelVertex.Count, m_lRenderModelVertex.ToArray());
            }
        }