示例#1
0
        private void btnProjection2D_Click(object sender, EventArgs e)
        {
            if (vizcore3d.Model.IsOpen() == false)
            {
                return;
            }

            VIZCore3D.NET.Data.Projection2D projection = vizcore3d.View.Get2DProjectionVertex(80, false, 1);

            if (projection == null)
            {
                return;
            }

            result.SetData(projection);
        }
示例#2
0
        public void SetData(VIZCore3D.NET.Data.Projection2D projectionData, System.Drawing.Point translation, bool enableCustomMargine, System.Drawing.Point CustomTranslation)
        {
            projection = projectionData;

            txtArea.Text           = projection.Area.ToString();
            txtVertexCount.Text    = projection.VertexCount.ToString();
            txtVertexBoundBox.Text = projection.BoundBoxVertex.ToString();
            txtNodeBoundBox.Text   = projection.BoundBoxNode.ToStringMax();
            txtMatrix.Text         = projection.Matrix;

            txtCorrectionFactorX.Text = projection.CorrectionFactor.X.ToString();
            txtCorrectionFactorY.Text = projection.CorrectionFactor.Y.ToString();

            txtPoints.Text       = projection.Points;
            txtVertex.Text       = projection.Vertex;
            txtPathGeometry.Text = projection.PathGeometryString;

            if (ctrlHost == null)
            {
                ctrlHost = new ElementHost();
                //ctrlHost.Dock = DockStyle.Fill;
                ctrlHost.Size = new System.Drawing.Size(3000, 3000);
                panelPath.Controls.Add(ctrlHost);
                P2D_Viewer = new DrawControl.PathGeometryControl();
                P2D_Viewer.InitializeComponent();
                ctrlHost.Child = P2D_Viewer;
            }

            if (projection.EnableCoordinateCorrection == true)
            {
                projection.MovePoints(translation.X, translation.Y, true);
            }

            if (enableCustomMargine == true)
            {
                projection.MovePoints(CustomTranslation.X, CustomTranslation.Y, true);
            }

            P2D_Viewer.DrawPathGeometry(projection.PathGeometryString);
        }
示例#3
0
        public void SetData(VIZCore3D.NET.Data.Projection2D projection)
        {
            txtArea.Text           = projection.Area.ToString();
            txtVertexCount.Text    = projection.VertexCount.ToString();
            txtVertexBoundBox.Text = projection.BoundBoxVertex.ToString();
            txtNodeBoundBox.Text   = projection.BoundBoxNode.ToStringMax();
            txtMatrix.Text         = projection.Matrix;

            txtPoints.Text       = projection.Points;
            txtVertex.Text       = projection.Vertex;
            txtPathGeometry.Text = projection.PathGeometryString;

            if (ctrlHost == null)
            {
                ctrlHost      = new ElementHost();
                ctrlHost.Dock = DockStyle.Fill;
                tabPage5.Controls.Add(ctrlHost);
                P2D_Viewer = new DrawControl.PathGeometryControl();
                P2D_Viewer.InitializeComponent();
                ctrlHost.Child = P2D_Viewer;
            }

            P2D_Viewer.DrawPathGeometry(projection.PathGeometryString);
        }
示例#4
0
        public void SetData(VIZCore3D.NET.Data.Projection2D projectionData, System.Drawing.Point translation, bool enableCustomMargine, System.Drawing.Point CustomTranslation)
        {
            projection = projectionData;

            txtArea.Text           = projection.Area.ToString();
            txtVertexCount.Text    = projection.VertexCount.ToString();
            txtVertexBoundBox.Text = projection.BoundBoxVertex.ToString();
            txtNodeBoundBox.Text   = projection.BoundBoxNode.ToStringMax();
            txtMatrix.Text         = projection.Matrix;

            txtCorrectionFactorX.Text = projection.CorrectionFactor.X.ToString();
            txtCorrectionFactorY.Text = projection.CorrectionFactor.Y.ToString();

            txtPoints.Text       = projection.Points;
            txtVertex.Text       = projection.Vertex;
            txtPathGeometry.Text = projection.PathGeometryString;

            if (ctrlHost == null)
            {
                ctrlHost = new ElementHost();
                //ctrlHost.Dock = DockStyle.Fill;
                ctrlHost.Size = new System.Drawing.Size(3000, 3000);
                panelPath.Controls.Add(ctrlHost);
                P2D_Viewer = new DrawControl.PathGeometryControl();
                P2D_Viewer.InitializeComponent();
                ctrlHost.Child = P2D_Viewer;
            }

            if (projection.EnableCoordinateCorrection == true)
            {
                projection.MovePoints(translation.X, translation.Y, true);
            }

            if (enableCustomMargine == true)
            {
                projection.MovePoints(CustomTranslation.X, CustomTranslation.Y, true);
            }

            int minX = 0;
            int minY = 0;
            int maxX = 0;
            int maxY = 0;

            List <System.Drawing.Point> pointList = projection.GetPointList();

            for (int i = 0; i < pointList.Count; i++)
            {
                System.Drawing.Point current = pointList[i];

                if (i != 0)
                {
                    minX = Math.Min(minX, current.X);
                    minY = Math.Min(minY, current.Y);

                    maxX = Math.Max(maxX, current.X);
                    maxY = Math.Max(maxY, current.Y);
                }
                else
                {
                    minX = current.X;
                    minY = current.Y;

                    maxX = current.X;
                    maxY = current.Y;
                }
            }

            txtMinX.Text = minX.ToString();
            txtMinY.Text = minY.ToString();
            txtMaxX.Text = maxX.ToString();
            txtMaxY.Text = maxY.ToString();

            P2D_Viewer.DrawPathGeometry(projection.PathGeometryString);
        }
示例#5
0
        private void btnLoadTest_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Multiselect = true;
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            List <string> models = dlg.FileNames.ToList();

            int  scale     = Convert.ToInt32(txtScale.Text);
            bool vertexAll = ckVertexAll.Checked;
            int  quality   = tbQuality.Value;

            int virtualImageWidth  = Convert.ToInt32(txtVirtualImageWidth.Text);
            int virtualImageHeight = Convert.ToInt32(txtVirtualImageHeight.Text);

            bool enableCoordinateCorrection = ckCoordinateCorrection.Checked;

            vizcore3d.EnableProgressForm = false;
            vizcore3d.EnableWaitForm     = false;

            while (true)
            {
                foreach (string item in models)
                {
                    //vizcore3d.ShowWaitForm();

                    vizcore3d.Model.Open(item);

                    VIZCore3D.NET.Data.Projection2D projection = vizcore3d.View.Get2DProjectionVertex(
                        scale                           /* Scale이 클수록 Point의 범위가 줄어듬. 실제 모델의 축소 비율 */
                        , vertexAll                     /* True : 모든 형상의 데이터, False : 영역이 제일 큰 형상의 외곽 정보만 추출 */
                        , quality                       /* 투영 공간 개수. 범위(1~10). 1(빠르게 처리되지만 품질 보통) ~ 10(오래걸리지만 품질 높음) */
                        , virtualImageWidth             /* 투영 공간의 가로 길이. PX단위. 원격(혹은 콘솔) 모드에서는 1024만 가능 */
                        , virtualImageHeight            /* 투영 공간의 세로 길이. PX단위. 원격(혹은 콘솔) 모드에서는 1024만 가능 */
                        , enableCoordinateCorrection    /* 2D 투영 포인트 좌표 보정 여부. True(XY평면좌표), False(투영결과좌표) */
                        );

                    if (projection == null)
                    {
                        return;
                    }

                    System.Drawing.Point translation = new Point(0, 0);

                    if (String.IsNullOrEmpty(txtX.Text) == false)
                    {
                        translation.X = Convert.ToInt32(txtX.Text);
                    }

                    if (String.IsNullOrEmpty(txtY.Text) == false)
                    {
                        translation.Y = Convert.ToInt32(txtY.Text);
                    }

                    System.Drawing.Point customTranslation = new Point(0, 0);

                    if (String.IsNullOrEmpty(txtCustomMargineX.Text) == false)
                    {
                        customTranslation.X = Convert.ToInt32(txtCustomMargineX.Text);
                    }

                    if (String.IsNullOrEmpty(txtCustomMargineY.Text) == false)
                    {
                        customTranslation.Y = Convert.ToInt32(txtCustomMargineY.Text);
                    }

                    result.SetData(projection, translation, ckCustomMargine.Checked, customTranslation);

                    //vizcore3d.CloseWaitForm();
                }
            }
        }
示例#6
0
        private void btnProjection2D_Click(object sender, EventArgs e)
        {
            if (vizcore3d.Model.IsOpen() == false)
            {
                return;
            }

            vizcore3d.ShowWaitForm();

            int  scale     = Convert.ToInt32(txtScale.Text);
            bool vertexAll = ckVertexAll.Checked;
            int  quality   = tbQuality.Value;

            int virtualImageWidth  = Convert.ToInt32(txtVirtualImageWidth.Text);
            int virtualImageHeight = Convert.ToInt32(txtVirtualImageHeight.Text);

            bool enableCoordinateCorrection = ckCoordinateCorrection.Checked;

            //VIZCore3D.NET.Data.Projection2D projection = vizcore3d.View.Get2DProjectionVertex(80, false, 1, 1024, 1024);

            VIZCore3D.NET.Data.Projection2D projection = vizcore3d.View.Get2DProjectionVertex(
                scale                           /* Scale이 클수록 Point의 범위가 줄어듬. 실제 모델의 축소 비율 */
                , vertexAll                     /* True : 모든 형상의 데이터, False : 영역이 제일 큰 형상의 외곽 정보만 추출 */
                , quality                       /* 투영 공간 개수. 범위(1~10). 1(빠르게 처리되지만 품질 보통) ~ 10(오래걸리지만 품질 높음) */
                , virtualImageWidth             /* 투영 공간의 가로 길이. PX단위. 원격(혹은 콘솔) 모드에서는 1024만 가능 */
                , virtualImageHeight            /* 투영 공간의 세로 길이. PX단위. 원격(혹은 콘솔) 모드에서는 1024만 가능 */
                , enableCoordinateCorrection    /* 2D 투영 포인트 좌표 보정 여부. True(XY평면좌표), False(투영결과좌표) */
                );

            if (projection == null)
            {
                return;
            }

            System.Drawing.Point translation = new Point(0, 0);

            if (String.IsNullOrEmpty(txtX.Text) == false)
            {
                translation.X = Convert.ToInt32(txtX.Text);
            }

            if (String.IsNullOrEmpty(txtY.Text) == false)
            {
                translation.Y = Convert.ToInt32(txtY.Text);
            }

            System.Drawing.Point customTranslation = new Point(0, 0);

            if (String.IsNullOrEmpty(txtCustomMargineX.Text) == false)
            {
                customTranslation.X = Convert.ToInt32(txtCustomMargineX.Text);
            }

            if (String.IsNullOrEmpty(txtCustomMargineY.Text) == false)
            {
                customTranslation.Y = Convert.ToInt32(txtCustomMargineY.Text);
            }

            result.SetData(projection, translation, ckCustomMargine.Checked, customTranslation);

            vizcore3d.CloseWaitForm();
        }