/// <summary>
        /// 0518 민호 클릭하지 않아도 닫는 함수 생성. 종료 전 currentnewprojectwindow 변수 초기화
        /// </summary>
        public bool CloseWithoutOkClick()
        {
            ButtonStateCheck(ButtonState.None);

            if (TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet == null)
            {
                return(false);
            }


            if (points.Count == 0)
            {
                var result = MessageBox.Show("대지의 경사 정보가 설정되지 않았습니다. 평평한 대지로 계속 하시겠습니까?", "경사 정보 없음", MessageBoxButton.YesNo);

                if (result == MessageBoxResult.No)
                {
                    return(false);
                }
            }
            else
            {
                var result = MessageBox.Show("정보 입력을 마치고 설계를 시작합니다.", "창 닫기", MessageBoxButton.YesNo);

                if (result == MessageBoxResult.No)
                {
                    return(false);
                }
            }


            RhinoDoc.SelectObjects -= SelectSlopePoint;

            endWhileLoop = true;

            TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.Getdir(points);

            foreach (var gggg in spguids)
            {
                RhinoDoc.ActiveDoc.Objects.Hide(gggg, true);
            }

            if (NorthCheck.IsChecked == true)
            {
                TuringAndCorbusierPlugIn.InstanceClass.plot.ignoreNorth = true;
            }
            else
            {
                TuringAndCorbusierPlugIn.InstanceClass.plot.ignoreNorth = false;
            }

            if (SpecialCase.IsChecked == true)
            {
                TuringAndCorbusierPlugIn.InstanceClass.plot.isSpecialCase = true;
            }
            else
            {
                TuringAndCorbusierPlugIn.InstanceClass.plot.isSpecialCase = false;
            }

            if (TuringAndCorbusierPlugIn.InstanceClass.regSettings != null)
            {
                double result = double.NaN;
                if (double.TryParse(fromRoad.Text, out result))
                {
                    TuringAndCorbusierPlugIn.InstanceClass.regSettings.DistanceEase[0] = result;
                    result = double.NaN;
                }
                if (double.TryParse(fromSurr.Text, out result))
                {
                    TuringAndCorbusierPlugIn.InstanceClass.regSettings.DistanceEase[1] = result;
                    result = double.NaN;
                }
                if (double.TryParse(fromLighting.Text, out result))
                {
                    TuringAndCorbusierPlugIn.InstanceClass.regSettings.DistanceLighting = result;
                    result = double.NaN;
                }
                if (double.TryParse(fromOtherBuilding.Text, out result))
                {
                    TuringAndCorbusierPlugIn.InstanceClass.regSettings.DistanceIndentation = result;
                    result = double.NaN;
                }
                if (double.TryParse(easeFloor.Text, out result))
                {
                    TuringAndCorbusierPlugIn.InstanceClass.regSettings.EaseFloor = result;
                    result = double.NaN;
                }
            }


            RhinoApp.SetFocusToMainWindow();
            //System.Windows.Forms.SendKeys.SendWait("{ESC}");
            string      manualPlotArea      = this.manualPlotArea.Text;
            List <char> manualPlotAreaList  = manualPlotArea.ToList();
            string      manualPlotAreaValue = manualPlotArea;

            TuringAndCorbusierPlugIn.InstanceClass.page1Settings = new Settings_Page1(this.projectName.Text, this.address.Text, this.plotType, double.Parse(manualPlotAreaValue), double.Parse(this.maxFloorAreaRatio.Text), double.Parse(this.maxBuildingCoverage.Text), int.Parse(this.maxFloors.Text));
            if (TuringAndCorbusierPlugIn.InstanceClass.plot != null)
            {
                TuringAndCorbusierPlugIn.InstanceClass.plot.PlotType = this.plotType2;
            }
            ((Rhino.UI.Panels.GetPanel(TuringHost.PanelId) as RhinoWindows.Controls.WpfElementHost).Child as Turing).RefreshProjectInfo();
            TuringAndCorbusierPlugIn.InstanceClass.currentNewProjectWindow  = null;
            TuringAndCorbusierPlugIn.InstanceClass.turing.Calculate.Content = "설계 시작";
            TuringAndCorbusierPlugIn.InstanceClass.turing.Calculate.Click  -= TuringAndCorbusierPlugIn.InstanceClass.turing.Btn_SetInputValues;
            TuringAndCorbusierPlugIn.InstanceClass.turing.Calculate.Click  += TuringAndCorbusierPlugIn.InstanceClass.turing.Calculate_Click;



            UIManager.getInstance().HideWindow(this, UIManager.WindowType.Basic);

            return(true);
        }
        private void Btn_SetWidth_Click(object sender, RoutedEventArgs e)
        {
            ButtonStateCheck(ButtonState.GetWidth);
            RhinoApp.SendKeystrokes("Cancel", true);

            RhinoApp.Wait();

            UIManager.getInstance().SnapSetter(UIManager.SnapMode.OffAll);



            if (TuringAndCorbusierPlugIn.InstanceClass.plot == null)
            {
                MessageBox.Show("먼저 커브를 선택하세요");

                return;
            }

            if (TuringAndCorbusierPlugIn.InstanceClass.plot.Boundary.ClosedCurveOrientation(Plane.WorldXY) == CurveOrientation.Clockwise)
            {
                TuringAndCorbusierPlugIn.InstanceClass.plot.Boundary.Reverse();
            }

            List <Curve>       inputList       = TuringAndCorbusierPlugIn.InstanceClass.plot.Boundary.DuplicateSegments().ToList();
            List <ConduitLine> tempConduitLine = new List <ConduitLine>();

            if (inputList.Count == TuringAndCorbusierPlugIn.InstanceClass.plot.Surroundings.Length)
            {
                foreach (Curve i in inputList)
                {
                    Rhino.Geometry.Line tempLine            = new Rhino.Geometry.Line(i.PointAt(i.Domain.T0), i.PointAt(i.Domain.T1));
                    ConduitLine         tempTempConduitLine = new ConduitLine(tempLine, TuringAndCorbusierPlugIn.InstanceClass.plot.Surroundings[inputList.IndexOf(i)]);

                    tempConduitLine.Add(tempTempConduitLine);
                }
            }
            else
            {
                TuringAndCorbusierPlugIn.InstanceClass.plot.Surroundings = new int[inputList.Count];

                foreach (Curve i in inputList)
                {
                    Rhino.Geometry.Line tempLine            = new Rhino.Geometry.Line(i.PointAt(i.Domain.T0), i.PointAt(i.Domain.T1));
                    ConduitLine         tempTempConduitLine = new ConduitLine(tempLine);
                    TuringAndCorbusierPlugIn.InstanceClass.plot.Surroundings[inputList.IndexOf(i)] = 4;

                    tempConduitLine.Add(tempTempConduitLine);
                }
            }

            Corbusier.conduitLines.Clear();
            Corbusier.conduitLines = tempConduitLine;

            Corbusier.conduitLineDisplay         = new LinesConduit(Corbusier.conduitLines);
            Corbusier.conduitLineDisplay.Enabled = true;
            RhinoDoc.ActiveDoc.Views.Redraw();

            var gcl = new GetConduitLine(Corbusier.conduitLines);

            RhinoApp.WriteLine("늘리거나 줄일 도로 선택 ( 클릭 = 늘리기 , Ctrl + 클릭 = 줄이기 , Shift + 클릭 = 전체 늘리기 , Shift + Ctrl + 클릭 = 전체 줄이기 , ESC = 마침");

            while (!endWhileLoop)
            {
                gcl.AcceptNothing(true);
                gcl.Get(true);
                RhinoDoc.ActiveDoc.Views.Redraw();

                if (gcl.CommandResult() != Rhino.Commands.Result.Success)
                {
                    break;
                }
            }


            if (TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.boundary.ClosedCurveOrientation(Plane.WorldXY) == CurveOrientation.CounterClockwise)
            {
                TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.boundary.Reverse();
            }



            Curve[] boundarysegs = TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.boundary.DuplicateSegments();


            /////대지경계선후퇴적용
            //for (int i = 0; i < Corbusier.RoadWidth.Count; i++)
            //{

            //    if (Corbusier.RoadWidth[i] < 4 && Corbusier.RoadWidth[i] >= 0)
            //    {

            //        Vector3d curvev = boundarysegs[i].PointAtEnd - boundarysegs[i].PointAtStart;
            //        curvev.Rotate(RhinoMath.ToRadians(-90), Vector3d.ZAxis);
            //        curvev.Unitize();

            //        boundarysegs[i].Translate(curvev * ((Corbusier.RoadWidth[i] - 4) * 500));
            //        boundarysegs[i].Extend(CurveEnd.Both, 1000, CurveExtensionStyle.Line);

            //        LoadManager.getInstance().DrawObjectWithSpecificLayer(boundarysegs[i], LoadManager.NamedLayer.Guide);


            //    }
            //}

            //for (int i = 0; i < boundarysegs.Length; i++)
            //{
            //    int i2 = (i + 1) % boundarysegs.Length;
            //    var intersection = Rhino.Geometry.Intersect.Intersection.CurveCurve(boundarysegs[i], boundarysegs[i2], 0, 0);
            //    foreach (var x in intersection)
            //    {
            //        if (x.ParameterA != 1)
            //            boundarysegs[i] = boundarysegs[i].Split(x.ParameterA)[0];

            //        if (x.ParameterB != 1)
            //            boundarysegs[i2] = boundarysegs[i2].Split(x.ParameterB)[1];
            //    }

            //}


            //List<Curve> tojoin = new List<Curve>();

            //for (int i = 0; i < boundarysegs.Length; i++)
            //{


            //}

            //Curve[] joined = Curve.JoinCurves(boundarysegs);



            //TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.setbackBoundary = joined[0];
            //대지경계선후퇴 끝
            //kdginfoset 의 setbackBoundary에 저장.

            //LoadManager.getInstance().DrawObjectWithSpecificLayer(TuringAndCorbusierPlugIn.InstanceClass.kdgInfoSet.setbackBoundary, LoadManager.NamedLayer.Model);

            Corbusier.conduitLineDisplay.Enabled = false;
            TuringAndCorbusierPlugIn.InstanceClass.plot.Surroundings = Corbusier.conduitLines.Select(n => n.RoadWidth * 1000).ToArray();      //    .RoadWidth.Select(n=>n*1000).ToArray();
            TuringAndCorbusierPlugIn.InstanceClass.plot.UpdateSimplifiedSurroundings();
            //TuringAndCorbusierPlugIn.InstanceClass.plot.Adjust();
            UIManager.getInstance().SnapSetter(UIManager.SnapMode.Current);
            ButtonStateCheck(ButtonState.None);
            RhinoDoc.ActiveDoc.Views.Redraw();
        }
Ejemplo n.º 3
0
 private void Button_Close_Click(object sender, RoutedEventArgs e)
 {
     currentProgressFactor = 0;
     TuringAndCorbusierPlugIn.InstanceClass.page3.DisableConduit();
     UIManager.getInstance().HideWindow(TuringAndCorbusierPlugIn.InstanceClass.navigationHost, UIManager.WindowType.Navi);
 }