public AlgorithmDemo_M2M_NN(M2M_NN m2m_NN, Layers layers, FlowControlerForm flowControlerForm, dUpdate update)
        {
            this.m2m_NN            = m2m_NN;
            this.layers            = layers;
            this.flowControlerForm = flowControlerForm;
            this.Update            = update;

            m2m_NN.GetQueryPosition += delegate
            {
                SearchPartSetLayer       = null;
                ComparedPointLayer       = null;
                shrinkBoundPointSetLayer = null;
                searchBoundLayer         = null;
            };

            m2m_NN.GetPositionSetOfComparedPoint += OnGetPositionSetOfComparedPoint;
            m2m_NN.GetM2MStructure            += OnGetM2MStructure;
            m2m_NN.GetQueryPosition           += OnGetQueryPosition;
            m2m_NN.GetQueryPart               += OnGetQueryPart;
            m2m_NN.GetSearchPart              += OnGetSearchPart;
            m2m_NN.GetComparedPoint           += OnGetComparedPoint;
            m2m_NN.SearchBoundChanged         += OnSearchBoundChanged;
            m2m_NN.CurrentNearestPointChanged += OnCurrentNearestPointChanged;

            flowControlerForm.SelectConfiguratoinObject(this);
        }
Exemple #2
0
        public AlgorithmDemo_M2M_CH(M2M_CH m2m_CH, Layers layers, FlowControlerForm flowControlerForm, dUpdate update)
        {
            this.m2m_CH            = m2m_CH;
            this.layers            = layers;
            this.flowControlerForm = flowControlerForm;
            this.Update            = update;

            m2m_CH.GetM2MStructure += delegate(IM2MStructure m2mStructure)
            {
                this.m2mStructure = m2mStructure;
            };

            m2m_CH.GetChildPositionSetInSpecificLevelOfConvexHull += delegate
            {
                if (representativeHullLayer != null)
                {
                    representativeHullLayer.Visible = false;
                }
                if (convexHullLayer != null)
                {
                    lock (layers)
                    {
                        convexHullLayer.Visible = false;
                    }
                    flowControlerForm.BeginInvoke(Update);
                    flowControlerForm.SuspendAndRecordWorkerThread();
                }
            };

            m2m_CH.GetConvexHullPositionSetInSpecificLevel += delegate
            {
                if (linePartSetLayer != null)
                {
                    lock (layers)
                    {
                        linePartSetLayer.Visible            = false;
                        BottonLevelPositionSetLayer.Visible = false;
                    }
                    flowControlerForm.BeginInvoke(Update);
                    flowControlerForm.SuspendAndRecordWorkerThread();
                }
            };

            m2m_CH.GetRealConvexHull += delegate
            {
                if (representativeHullLayer != null)
                {
                    lock (layers)
                    {
                        representativeHullLayer.Visible = false;
                    }
                }
                if (convexHullLayer != null)
                {
                    lock (layers)
                    {
                        convexHullLayer.Visible = false;
                    }
                    flowControlerForm.BeginInvoke(Update);
                    flowControlerForm.SuspendAndRecordWorkerThread();
                }
            };

            IsGetM2MStructure = true;
            IsGetPositionSetToGetConvexHull                  = true;
            IsGetConvexHullPositionSetInSpecificLevel        = true;
            IsGetRepresentativeHullInSpecificLevel           = true;
            IsGetLinePositionSetInSpecificLevel              = true;
            IsGetChildPositionSetInSpecificLevelOfConvexHull = true;
            IsGetRealConvexHull = true;

            m2m_CH.GetConvexHullPositionSetInSpecificLevel += delegate
            {
                if (childPositionSetOfConvexHullLayer != null)
                {
                    lock (layers)
                    {
                        childPositionSetOfConvexHullLayer.Visible = false;
                    }
                    flowControlerForm.BeginInvoke(Update);
                    flowControlerForm.SuspendAndRecordWorkerThread();
                }
            };

            m2m_CH.GetConvexHullPositionSetInSpecificLevel += delegate
            {
                if (convexHullLayer != null)
                {
                    lock (layers)
                    {
                        convexHullLayer.ConvexHull.Visible = false;
                    }
                    flowControlerForm.BeginInvoke(Update);
                    flowControlerForm.SuspendAndRecordWorkerThread();
                }
            };

            m2m_CH.GetRealConvexHull += delegate
            {
                if (linePartSetLayer != null)
                {
                    lock (layers)
                    {
                        linePartSetLayer.Visible            = false;
                        BottonLevelPositionSetLayer.Visible = false;
                    }
                    flowControlerForm.BeginInvoke(Update);
                    flowControlerForm.SuspendAndRecordWorkerThread();
                }
            };

            flowControlerForm.SelectConfiguratoinObject(this);
            flowControlerForm.SuspendAndRecordWorkerThread();
        }
        public AlgorithmDemo_M2M_CD(M2M_CD M2M_CD, Layers layers, FlowControlerForm flowControlerForm, dUpdate update)
        {
            this.M2M_CD            = M2M_CD;
            this.layers            = layers;
            this.flowControlerForm = flowControlerForm;
            this.Update            = update;


            M2M_CD.GetCollision += delegate(IPositionSet positionSet)
            {
                System.Diagnostics.Debug.WriteLine("Collision!");

                if (objLayer != null)
                {
                    layers.Remove(objLayer);
                }
                {
                    objLayer = new Layer_PositionSet_Polygon(new PositionSet_Cloned(positionSet));
                    objLayer.PolygonLine.LineColor = Color.Red;
                    objLayer.PolygonLine.LineWidth = 1;
                    layers.Add(objLayer);
                }

                flowControlerForm.BeginInvoke(Update);
                flowControlerForm.SuspendAndRecordWorkerThread();
            };

            M2M_CD.GetNoCollision += delegate(IPositionSet positionSet)
            {
                System.Diagnostics.Debug.WriteLine("NoCollision!");
                if (objLayer != null)
                {
                    layers.Remove(objLayer);
                }
                {
                    objLayer = new Layer_PositionSet_Polygon(new PositionSet_Cloned(positionSet));
                    objLayer.PolygonLine.LineColor = Color.Green;
                    objLayer.PolygonLine.LineWidth = 1;
                    layers.Add(objLayer);
                }
                flowControlerForm.BeginInvoke(Update);
                flowControlerForm.SuspendAndRecordWorkerThread();
            };

            M2M_CD.GetIntersectPart += delegate(ILevel level, IPositionSet positionSet)
            {
                if (linePartSetLayer == null)
                {
                    linePartSetLayer           = new Layer_M2MPartSetInSpecificLevel(level, positionSet);
                    linePartSetLayer.MainColor = Settings.Default.LinePositionSetInSpecificLevelColor;
                    linePartSetLayer.Alpha     = 50;
                    //linePartSetLayer.LineColor = Color.Red;
                    linePartSetLayer.Active = true;
                    layers.Add(linePartSetLayer);
                }
                else
                {
                    linePartSetLayer.SpringLayerRepresentationChangedEvent(linePartSetLayer);
                }
            };

            M2M_CD.GetM2MStructure += delegate(IM2MStructure m2mStructure)
            {
                this.m2mStructure = m2mStructure;
            };

            IsGetM2MStructure = true;
            IsGetPositionSetToGetConvexHull = true;

            flowControlerForm.SelectConfiguratoinObject(this);
            flowControlerForm.SuspendAndRecordWorkerThread();
        }