示例#1
0
        public SerializablePlot(Plot toCopy, KDGinfo kdg)
        {
            plotType               = (int)toCopy.PlotType;
            boundary               = toCopy.Boundary?.DuplicateSegments().Select(n => n.PointAtStart).ToList();
            surroundings           = toCopy.Surroundings;
            outrect                = kdg.outrect?.DuplicateSegments().Select(n => n.PointAtStart).ToList();
            simplifiedSurroundings = toCopy.SimplifiedSurroundings;
            simplifiedBoundary     = toCopy.SimplifiedBoundary?.DuplicateSegments().Select(n => n.PointAtStart).ToList();
            ignoreNorth            = toCopy.ignoreNorth;
            isSpecialCase          = toCopy.isSpecialCase;
            var x = kdg.surrbuildings[0];

            kdg.surrbuildings?.ForEach(n => layout.Add(OpenCurveToPoint(n)));
        }
        private void SetCurve2(Curve boundary, double scalefactor)
        {
            KDGinfo tempKDGinfo = new KDGinfo(boundary, scalefactor, false);

            TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet = tempKDGinfo;

            Curve scaledBoundary = tempKDGinfo.boundary;

            var objectsToHide = Rhino.RhinoDoc.ActiveDoc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.AnyObject);

            foreach (var objectToHide in objectsToHide)
            {
                Rhino.RhinoDoc.ActiveDoc.Objects.Hide(objectToHide.Id, true);
            }


            var guid = LoadManager.getInstance().DrawObjectWithSpecificLayer(scaledBoundary, LoadManager.NamedLayer.Guide);

            //Rhino.RhinoDoc.ActiveDoc.Layers.SetCurrentLayerIndex(Rhino.RhinoDoc.ActiveDoc.Layers.Find("ZC304", true), true);
            //var guid = RhinoDoc.ActiveDoc.Objects.AddCurve(scaledBoundary);
            LoadManager.getInstance().DrawObjectWithSpecificLayer(tempKDGinfo.outrect, LoadManager.NamedLayer.Model);
            //var rectguid = RhinoDoc.ActiveDoc.Objects.AddCurve(tempKDGinfo.outrect);
            int index = TuringAndCorbusierPlugIn.InstanceClass.turing.stackPanel.Children.Count;


            /// checkpoint 테스트용
            ///

            LoadManager.getInstance().DrawObjectWithSpecificLayer(tempKDGinfo.surrbuildings, LoadManager.NamedLayer.Model);

            //foreach (var surrcurve in TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.surrbuildings)
            //{

            //    RhinoDoc.ActiveDoc.Objects.AddCurve(surrcurve);
            //}
            ///
            RhinoDoc.ActiveDoc.Objects.Select(guid);
            RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.ZoomExtentsSelected();

            RhinoDoc.ActiveDoc.Views.Redraw();
            //RhinoDoc.ActiveDoc.Layers.SetCurrentLayerIndex(Rhino.RhinoDoc.ActiveDoc.Layers.Find("Default", true), true);
            TuringAndCorbusierPlugIn.InstanceClass.plot          = new TuringAndCorbusier.Plot(scaledBoundary);
            TuringAndCorbusierPlugIn.InstanceClass.plot.PlotType = this.plotType2;
        }
        private void SetCurve(Curve boundary)
        {
            double plotArea_Manual = double.Parse(manualPlotArea.Text);

            double plotArea_CAD = CommonFunc.getArea(boundary);


            if (plotArea_Manual == 0)
            {
                manualPlotArea.Text = System.Math.Round(plotArea_CAD).ToString();
                plotArea_Manual     = plotArea_CAD;
            }
            if (System.Math.Abs(plotArea_Manual - plotArea_CAD / 1000000) / plotArea_Manual >= 0.03)
            {
                var           location          = System.Windows.Forms.Control.MousePosition;
                plotAreaError tempPlotAreaError = new plotAreaError("(공부상면적 : " + System.Math.Round(plotArea_Manual, 0).ToString() + ", 캐드파일 면적 : " + System.Math.Round(plotArea_CAD, 0).ToString() + ")");

                tempPlotAreaError.Left = location.X - tempPlotAreaError.Width / 2;
                tempPlotAreaError.Top  = location.Y - tempPlotAreaError.Height / 2;
                int tempDialogReturn = tempPlotAreaError.showDialogReturnValue();

                if (tempDialogReturn == 1)
                {
                    Show();
                    return;
                }
                else if (tempDialogReturn == 2)
                {
                    SetCurve2(boundary, System.Math.Pow(plotArea_Manual / (plotArea_CAD / 1000000), 0.5));

                    //TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet = tempKDGinfo;

                    //Curve scaledBoundary = tempKDGinfo.boundary;

                    //var objectsToHide = Rhino.RhinoDoc.ActiveDoc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.AnyObject);

                    //foreach (var objectToHide in objectsToHide)
                    //{
                    //    Rhino.RhinoDoc.ActiveDoc.Objects.Hide(objectToHide.Id, true);
                    //}



                    //var guid = RhinoDoc.ActiveDoc.Objects.AddCurve(scaledBoundary);

                    //int index = TuringAndCorbusierPlugIn.InstanceClass.turing.stackPanel.Children.Count;


                    ///// checkpoint 테스트용
                    //foreach (var surrcurve in TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.surrbuildings)
                    //{
                    //    RhinoDoc.ActiveDoc.Objects.AddCurve(surrcurve);
                    //}
                    /////
                    //RhinoDoc.ActiveDoc.Objects.Select(guid);
                    //RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.ZoomExtentsSelected();

                    //RhinoDoc.ActiveDoc.Views.Redraw();

                    //TuringAndCorbusierPlugIn.InstanceClass.plot = new TuringAndCorbusier.Plot(scaledBoundary);
                }
                else
                {
                    SetCurve2(boundary, 1000);

                    //KDGinfo tempKDGinfo = new KDGinfo(boundary, 1000, false);
                    //TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet = tempKDGinfo;

                    //Curve scaledBoundary = tempKDGinfo.boundary;

                    //var objectsToHide = Rhino.RhinoDoc.ActiveDoc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.AnyObject);

                    //foreach (var objectToHide in objectsToHide)
                    //{
                    //    Rhino.RhinoDoc.ActiveDoc.Objects.Hide(objectToHide.Id, true);
                    //}



                    //var guid = RhinoDoc.ActiveDoc.Objects.AddCurve(scaledBoundary);

                    //int index = TuringAndCorbusierPlugIn.InstanceClass.turing.stackPanel.Children.Count;


                    ///// checkpoint 테스트용
                    //foreach (var surrcurve in TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.surrbuildings)
                    //{
                    //    RhinoDoc.ActiveDoc.Objects.AddCurve(surrcurve);
                    //}
                    /////
                    //RhinoDoc.ActiveDoc.Objects.Select(guid);
                    //RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.ZoomExtentsSelected();

                    //RhinoDoc.ActiveDoc.Views.Redraw();

                    //TuringAndCorbusierPlugIn.InstanceClass.plot = new TuringAndCorbusier.Plot(scaledBoundary);
                }
            }
            else
            {
                KDGinfo tempKDGinfo = new KDGinfo(boundary, System.Math.Pow(plotArea_Manual / (plotArea_CAD / 1000000), 1), false);
                TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet = tempKDGinfo;

                Curve scaledBoundary = tempKDGinfo.boundary;

                var objectsToHide = Rhino.RhinoDoc.ActiveDoc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.AnyObject);

                foreach (var objectToHide in objectsToHide)
                {
                    Rhino.RhinoDoc.ActiveDoc.Objects.Hide(objectToHide.Id, true);
                }

                var guid = RhinoDoc.ActiveDoc.Objects.AddCurve(scaledBoundary);
                RhinoDoc.ActiveDoc.Objects.Select(guid);
                RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.ZoomExtentsSelected();

                RhinoDoc.ActiveDoc.Views.Redraw();

                TuringAndCorbusierPlugIn.InstanceClass.plot = new TuringAndCorbusier.Plot(boundary);
            }


            Show();
        }