Пример #1
0
        private void TestForViewer(object sender, EventArgs e)
        {
            painterDialog.Show();

            painterDialog.Reset();
            painterDialog.HoldOnMode();

            RandomPositionSet_InFixedDistribution randomPositionSet1 = new RandomPositionSet_InFixedDistribution
                                                                           (10000, distributionStyle.GaussianDistribution);

            new ConfiguratedByForm(randomPositionSet1);
            randomPositionSet1.Produce();

            RandomPositionSet_InFixedDistribution randomPositionSet2 = new RandomPositionSet_InFixedDistribution
                                                                           (10000, distributionStyle.LaplaceDistribution);

            new ConfiguratedByForm(randomPositionSet2);
            randomPositionSet2.Produce();

            M2MSCreater_ForGeneralM2MStruture m2m_Creater_ForGeneralM2MStruture = new M2MSCreater_ForGeneralM2MStruture();
            IM2MStructure m2mStructure = m2m_Creater_ForGeneralM2MStruture.CreateAutomatically(randomPositionSet2);

            m2mStructure.Preprocessing(randomPositionSet2);

            painterDialog.Clear();
            painterDialog.DrawPositionSet(randomPositionSet1);
            painterDialog.DrawPositionSet(randomPositionSet2);
            painterDialog.DrawM2MLevel(m2mStructure.GetLevel(m2mStructure.GetLevelNum() - 1));
            painterDialog.DrawM2MStructure(m2mStructure);
            Layer_PositionSet layer = new Layer_PositionSet_Point(GetRamSet2());

            layer.SetPositionSetTransformByM2MLevel(m2mStructure.GetLevel(m2mStructure.GetLevelNum() - 1));
            //painterDialog.Painter.Layers.Add(layer);
            painterDialog.Show();

            painterDialog.Clear();
            painterDialog.DrawPath(GetRamSet(1000, 800));
            painterDialog.DrawPositionSet(GetRamSet(500, 400));
            painterDialog.DrawConvexHull(GetRamSet2());
            painterDialog.DrawSquareFrame(GetRamSet(500, 400));
            painterDialog.Show();

            painterDialog.Reset();
        }
        private void preProcessForPositionSetConnectedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IPositionSet_Connected pSet = (IPositionSet_Connected)positionSetContainer.GetPositionSet();

            LayersExOptDlg       layers               = new LayersExOptDlg();
            LayersPainterForm    layersPainterForm    = new LayersPainterForm(layers);
            LayersPaintedControl layersPaintedControl = layersPainterForm.LayersPaintedControl;
            LayersEditedControl  layersEditedControl  = new LayersEditedControl();

            layersEditedControl.Dock = DockStyle.Top;
            layersEditedControl.LayersPaintedControl = layersPaintedControl;
            layersPainterForm.Controls.Add(layersEditedControl);

            Layer_PositionSet_Connected layer_PositionSet_Connected = new Layer_PositionSet_Connected(pSet);

            layer_PositionSet_Connected.Point.PointColor     = Color.Yellow;
            layer_PositionSet_Connected.Connection.LineColor = Color.Blue;
            layer_PositionSet_Connected.Connection.LineWidth = 0.6f;
            layer_PositionSet_Connected.Point.PointRadius    = 1.2f;
            layers.Add(layer_PositionSet_Connected);
            layer_PositionSet_Connected.SpringLayerRepresentationChangedEvent(layer_PositionSet_Connected);


            M2MSCreater_ForGeneralM2MStruture m2m_Creater_ForGeneralM2MStruture = new M2MSCreater_ForGeneralM2MStruture();

            m2m_Creater_ForGeneralM2MStruture.PartType = typeof(Part_Multi);
            m2m_Creater_ForGeneralM2MStruture.SetPointInPartFactor(50);
            m2m_Creater_ForGeneralM2MStruture.SetUnitNumInGridLength(3);

            IM2MStructure m2mStructure = m2m_Creater_ForGeneralM2MStruture.CreateAutomatically(pSet);

            m2mStructure.Preprocessing(pSet);

            BuildPartSetConnectionForM2MStructure buildPartSetConnectionForM2MStructure = new BuildPartSetConnectionForM2MStructure();

            buildPartSetConnectionForM2MStructure.TraversalEveryLevelAndBuild(m2mStructure);

            layers.Add(new Layer_M2MStructure(m2mStructure));

            for (int levelSequence = 1; levelSequence < m2mStructure.GetLevelNum(); levelSequence++)
            {
                //ILevel level = m2mStructure.GetLevel(levelSequence);
                //IPart rootPart = m2mStructure.GetLevel(0).GetPartRefByPartIndex(0, 0);
                //IPositionSet positionSet = m2mStructure.GetDescendentPositionSetByAncestorPart(levelSequence, rootPart, 0);

                //List<IPosition_Connected> position_ConnectedList = new List<IPosition_Connected>();
                //positionSet.InitToTraverseSet();
                //while (positionSet.NextPosition())
                //{
                //    position_ConnectedList.Add((IPosition_Connected)positionSet.GetPosition());
                //}

                //PositionSet_Connected positionSet_Connected = new PositionSet_Connected(position_ConnectedList);

                Layer_PartSet_Connected layer_PartSet_Connected = new Layer_PartSet_Connected(m2mStructure, levelSequence);
                //layer_PartSet_Connected.MainColor
                //layer_PartSet_Connected.Active = true;
                //layer_PartSet_Connected.SetPositionSetTransformByM2MLevel(level);

                layers.Add(layer_PartSet_Connected);
            }

            layersPainterForm.ShowDialog();
        }
Пример #3
0
        private void TestBotton_Click(object sender, EventArgs e)
        {
            PainterDialog painterDialog = new PainterDialog();

            RandomPositionSet_Connected_Config config = new RandomPositionSet_Connected_Config();

            new ConfiguratedByForm(config);
            IPositionSet_ConnectedEdit pSet = config.Produce();

            painterDialog.DrawPositionSet_Connected(pSet);

            M2MSCreater_ForGeneralM2MStruture m2m_Creater_ForGeneralM2MStruture = new M2MSCreater_ForGeneralM2MStruture();

            m2m_Creater_ForGeneralM2MStruture.PartType = typeof(Part_Multi);
            m2m_Creater_ForGeneralM2MStruture.SetPointInPartFactor(10);
            m2m_Creater_ForGeneralM2MStruture.SetUnitNumInGridLength(4);

            IM2MStructure m2mStructure = m2m_Creater_ForGeneralM2MStruture.CreateAutomatically(pSet);

            m2mStructure.Preprocessing(pSet);
            painterDialog.DrawM2MStructure(m2mStructure);

            BuildPartSetConnectionForM2MStructure buildPartSetConnectionForM2MStructure = new BuildPartSetConnectionForM2MStructure();

            buildPartSetConnectionForM2MStructure.GetPartSetInSpecificLevel += delegate(ILevel level, int levelSequence, IPositionSet positionSet) {
                List <IPosition_Connected> position_ConnectedList = new List <IPosition_Connected>();

                positionSet.InitToTraverseSet();
                while (positionSet.NextPosition())
                {
                    IPart_Multi partMulti = (IPart_Multi)positionSet.GetPosition();
                    IEnumerable <IPart_Connected> part_ConnectedEnumerable = partMulti.GetSubPartSet();

                    foreach (IPart_Connected part in part_ConnectedEnumerable)
                    {
                        position_ConnectedList.Add((IPosition_Connected)part);
                    }
                }

                PositionSet_Connected       positionSet_Connected       = new PositionSet_Connected(position_ConnectedList);
                Layer_PositionSet_Connected layer_PositionSet_Connected = new Layer_PositionSet_Connected(positionSet_Connected);
                layer_PositionSet_Connected.SetPositionSetTransformByM2MLevel(level);
                painterDialog.Layers.Add(layer_PositionSet_Connected);

                painterDialog.Show();
            };

            buildPartSetConnectionForM2MStructure.TraversalEveryLevelAndBuild(m2mStructure);

            for (int levelSequence = 1; levelSequence < m2mStructure.GetLevelNum(); levelSequence++)
            {
                ILevel       level       = m2mStructure.GetLevel(levelSequence);
                IPart        rootPart    = m2mStructure.GetLevel(0).GetPartRefByPartIndex(0, 0);
                IPositionSet positionSet = m2mStructure.GetDescendentPositionSetByAncestorPart(levelSequence, rootPart, 0);

                List <IPosition_Connected> position_ConnectedList = new List <IPosition_Connected>();
                positionSet.InitToTraverseSet();
                while (positionSet.NextPosition())
                {
                    if (positionSet.GetPosition() is IPart_Multi)
                    {
                        IPart_Multi partMulti = (IPart_Multi)positionSet.GetPosition();
                        IEnumerable <IPart_Connected> part_ConnectedEnumerable = partMulti.GetSubPartSet();

                        foreach (IPart_Connected part in part_ConnectedEnumerable)
                        {
                            position_ConnectedList.Add((IPosition_Connected)part);
                        }
                    }
                    else
                    {
                        position_ConnectedList.Add((IPosition_Connected)positionSet.GetPosition());
                    }
                }
                PositionSet_Connected positionSet_Connected = new PositionSet_Connected(position_ConnectedList);

                Layer_PositionSet_Connected layer_PartSet_Connected = new Layer_PositionSet_Connected(positionSet_Connected);
                //layer_PartSet_Connected.MainColor
                //layer_PartSet_Connected.Active = true;
                layer_PartSet_Connected.SetPositionSetTransformByM2MLevel(level);

                painterDialog.Layers.Add(layer_PartSet_Connected);
            }

            painterDialog.Show();
            //painterDialog.Show();
        }