private void OnGetPositionSetToGetConvexHull(IPositionSet positionSet)
 {
     lock (layers)
     {
         Layer_PositionSet_Point layer = new Layer_PositionSet_Point(new PositionSet_Cloned(positionSet));
         layer.MainColor         = Settings.Default.PositionSetToGetConvexHullColor;
         layer.Point.PointRadius = 1;
         layers.Add(layer);
     }
     flowControlerForm.BeginInvoke(Update);
     flowControlerForm.SuspendAndRecordWorkerThread();
 }
        private void OnGetPositionSetOfComparedPoint(IPositionSet positionSet)
        {
            lock (layers)
            {
                Layer_PositionSet_Point layer = new Layer_PositionSet_Point(new PositionSet_Cloned(positionSet));
                layer.Point.PointRadius       = 2;
                layer.Point.IsDrawPointBorder = true;
                layer.MainColor = Color.FromArgb(0, 255, 0);
                layer.Name      = "PositionSetOfComparedPoint";
                layers.Add(layer);
            }

            flowControlerForm.BeginInvoke(Update);
            flowControlerForm.SuspendAndRecordWorkerThread();
        }
Exemple #3
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();
        }