Esempio n. 1
0
 public CmdStartSketch(IAppContext context)
 {
     _context          = context;
     this.m_caption    = "草图";
     this.m_toolTip    = "创建要素";
     this.m_category   = "编辑器";
     this.m_message    = "创建要素";
     this.m_name       = "Editor_Start_Sketch";
     this._key         = "Editor_Start_Sketch";
     this._itemType    = RibbonItemType.Tool;
     this.m_bitmap     = Properties.Resources.icon_pencil;
     this.m_cursor     = new Cursor(new MemoryStream(Resource.Digitise));
     this.pCommandFlow = new SketchCommandFlow();
     SketchShareEx.m_pSketchCommandFolw = this.pCommandFlow as SketchCommandFlow;
     OnCreate(context);
 }
Esempio n. 2
0
        public bool HandleCommand(string string_2)
        {
            bool flag;

            char[]   chrArray;
            string[] strArrays;
            double   num;
            double   num1;
            double   num2;
            IPoint   pointClass;

            this.bool_0 = false;
            if (string_2 == "ESC")
            {
                this.icommandFlow_0 = null;
                this.Cancel();
                flag = true;
            }
            else if (this.int_0 != 0)
            {
                if (this.icommandFlow_0 != null)
                {
                    if (!this.icommandFlow_0.IsFinished)
                    {
                        flag = this.icommandFlow_0.HandleCommand(string_2);
                        return(flag);
                    }
                    if ((this.icommandFlow_0 is ThreePointArcCommandFlow
                        ? true
                        : this.icommandFlow_0 is ConstructTangentArcCommandFlow))
                    {
                        if (SketchToolAssist.Feedback is INewPolylineFeedback)
                        {
                            (SketchToolAssist.Feedback as INewPolylineFeedback).ChangeLineType(enumLineType.LTLine);
                        }
                        if (SketchToolAssist.Feedback is INewPolygonFeedbackEx)
                        {
                            (SketchToolAssist.Feedback as INewPolygonFeedbackEx).ChangeLineType(enumLineType.LTLine);
                        }
                    }
                    this.icommandFlow_0 = null;
                }
                try
                {
                    this.string_1 = string_2.Trim();
                    if (this.string_1.Length != 0)
                    {
                        if (this.string_1.Length != 1)
                        {
                            string string1 = this.string_1;
                            chrArray      = new char[] { ',' };
                            strArrays     = string1.Split(chrArray);
                            this.string_1 = "";
                            num           = 0;
                            num1          = 0;
                            num2          = 0;
                            pointClass    = new ESRI.ArcGIS.Geometry.Point();
                            if ((int)strArrays.Length < 2)
                            {
                                this._appContext.ShowCommandString("输入不正确", CommandTipsType.CTTLog);
                            }
                            else
                            {
                                SketchCommandFlow int0 = this;
                                int0.int_0 = int0.int_0 + 1;
                                num        = Convert.ToDouble(strArrays[0]);
                                pointClass.PutCoords(num, Convert.ToDouble(strArrays[1]));
                                if ((int)strArrays.Length >= 3)
                                {
                                    pointClass.Z = Convert.ToDouble(strArrays[2]);
                                }
                                SketchShareEx.SketchMouseDown(pointClass, this._appContext.MapControl.Map as IActiveView,
                                                              Editor.CurrentEditTemplate.FeatureLayer);
                            }
                        }
                        else
                        {
                            string lower = this.string_1.ToLower();
                            if (lower != null)
                            {
                                switch (lower)
                                {
                                case "c":
                                {
                                    if (SketchToolAssist.Feedback is INewPolylineFeedback)
                                    {
                                        (SketchToolAssist.Feedback as INewPolylineFeedback).Close();
                                    }
                                    this.method_0();
                                    break;
                                }

                                case "u":
                                {
                                    if (SketchToolAssist.Feedback is IOperation)
                                    {
                                        (SketchToolAssist.Feedback as IOperation).Undo();
                                    }
                                    SketchCommandFlow sketchCommandFlow = this;
                                    sketchCommandFlow.int_0 = sketchCommandFlow.int_0 - 1;
                                    break;
                                }

                                case "r":
                                {
                                    if (SketchToolAssist.Feedback is IOperation)
                                    {
                                        (SketchToolAssist.Feedback as IOperation).Redo();
                                    }
                                    SketchCommandFlow int01 = this;
                                    int01.int_0 = int01.int_0 + 1;
                                    break;
                                }

                                case "a":
                                {
                                    if (SketchToolAssist.Feedback is INewPolylineFeedback)
                                    {
                                        (SketchToolAssist.Feedback as INewPolylineFeedback).ChangeLineType(
                                            enumLineType.LTCircularArc);
                                    }
                                    if (SketchToolAssist.Feedback is INewPolygonFeedbackEx)
                                    {
                                        (SketchToolAssist.Feedback as INewPolygonFeedbackEx).ChangeLineType(
                                            enumLineType.LTCircularArc);
                                    }
                                    SketchCommandFlow sketchCommandFlow1 = this;
                                    sketchCommandFlow1.int_0 = sketchCommandFlow1.int_0 + 1;
                                    this.icommandFlow_0      = new ThreePointArcCommandFlow(this)
                                    {
                                        AppContext = this._appContext
                                    };
                                    break;
                                }

                                case "t":
                                {
                                    if (SketchToolAssist.Feedback is INewPolylineFeedback)
                                    {
                                        (SketchToolAssist.Feedback as INewPolylineFeedback).ChangeLineType(
                                            enumLineType.LTTangentCircularArc);
                                    }
                                    if (SketchToolAssist.Feedback is INewPolygonFeedbackEx)
                                    {
                                        (SketchToolAssist.Feedback as INewPolygonFeedbackEx).ChangeLineType(
                                            enumLineType.LTTangentCircularArc);
                                    }
                                    SketchCommandFlow int02 = this;
                                    int02.int_0         = int02.int_0 + 1;
                                    this.icommandFlow_0 = new ConstructTangentArcCommandFlow(this)
                                    {
                                        AppContext = this._appContext
                                    };
                                    break;
                                }

                                case "j":
                                {
                                    SketchCommandFlow sketchCommandFlow2 = this;
                                    sketchCommandFlow2.int_0 = sketchCommandFlow2.int_0 + 1;
                                    this.icommandFlow_0      = new GDCommandFlow()
                                    {
                                        AppContext = this._appContext
                                    };
                                    break;
                                }

                                case "g":
                                {
                                    SketchCommandFlow int03 = this;
                                    int03.int_0 = int03.int_0 + 1;
                                    int    pointCount = SketchToolAssist.m_pPointColn.PointCount;
                                    IPoint point      = SketchToolAssist.m_pPointColn.Point[pointCount - 2];
                                    IPoint point1     = SketchToolAssist.m_pPointColn.Point[pointCount - 1];
                                    IPoint point2     = SketchToolAssist.m_pPointColn.Point[0];
                                    pointClass = CommonHelper.GetGD(point, point1, point2);
                                    SketchShareEx.SketchMouseDown(pointClass,
                                                                  this._appContext.MapControl.Map as IActiveView,
                                                                  Editor.CurrentEditTemplate.FeatureLayer);
                                    this.method_0();
                                    break;
                                }

                                case "d":
                                {
                                    SketchCommandFlow sketchCommandFlow3 = this;
                                    sketchCommandFlow3.int_0 = sketchCommandFlow3.int_0 + 1;
                                    if (!(SketchToolAssist.Feedback is INewPolylineFeedback))
                                    {
                                        break;
                                    }
                                    pointClass =
                                        (SketchToolAssist.Feedback as INewPolylineFeedback).ReverseOrientation();
                                    if (pointClass == null)
                                    {
                                        break;
                                    }
                                    SketchShareEx.LastPoint = pointClass;
                                    break;
                                }

                                case "f":
                                {
                                    SketchShareEx.EndSketch(false, this._appContext.MapControl.Map as IActiveView,
                                                            Editor.CurrentEditTemplate.FeatureLayer);
                                    this.int_0 = 0;
                                    this._appContext.ShowCommandString("完成", CommandTipsType.CTTInput);
                                    this.Reset();
                                    Editor.EnableUndoRedo = true;
                                    flag = true;
                                    return(flag);
                                }

                                default:
                                {
                                    this._appContext.ShowCommandString("输入不正确", CommandTipsType.CTTLog);
                                    this.string_1 = "";
                                    if (this.icommandFlow_0 != null)
                                    {
                                        this.icommandFlow_0.ShowCommandLine();
                                        flag = true;
                                        return(flag);
                                    }
                                    break;
                                }
                                }
                            }
                            else
                            {
                            }

                            this.string_1 = "";
                            if (this.icommandFlow_0 != null)
                            {
                                this.icommandFlow_0.ShowCommandLine();
                                flag = true;
                                return(flag);
                            }
                        }
                    }
                    else if (SketchToolAssist.Feedback == null)
                    {
                        flag = false;
                        return(flag);
                    }
                    else if (this._appContext != null)
                    {
                        SketchShareEx.EndSketch(false, this._appContext.MapControl.Map as IActiveView,
                                                Editor.CurrentEditTemplate.FeatureLayer);
                    }
                }
                catch
                {
                    this._appContext.ShowCommandString("输入不正确", CommandTipsType.CTTLog);
                }
                this.ShowCommandLine();
                flag = true;
            }
            else
            {
                chrArray      = new char[] { ',' };
                strArrays     = string_2.Split(chrArray);
                this.string_1 = "";
                num           = 0;
                num1          = 0;
                num2          = 0;
                pointClass    = new ESRI.ArcGIS.Geometry.Point();
                try
                {
                    if ((int)strArrays.Length < 2)
                    {
                        this._appContext.ShowCommandString("输入不正确", CommandTipsType.CTTLog);
                    }
                    else
                    {
                        num = Convert.ToDouble(strArrays[0]);
                        pointClass.PutCoords(num, Convert.ToDouble(strArrays[1]));
                        if ((int)strArrays.Length >= 3)
                        {
                            pointClass.Z = Convert.ToDouble(strArrays[2]);
                        }
                        SketchShareEx.SketchMouseDown(pointClass, this._appContext.MapControl.Map as IActiveView,
                                                      Editor.CurrentEditTemplate.FeatureLayer);
                        if ((Editor.CurrentEditTemplate.FeatureLayer.FeatureClass.ShapeType ==
                             esriGeometryType.esriGeometryPoint
                            ? false
                            : Editor.CurrentEditTemplate.FeatureLayer.FeatureClass.FeatureType !=
                             esriFeatureType.esriFTAnnotation))
                        {
                            SketchCommandFlow int04 = this;
                            int04.int_0 = int04.int_0 + 1;
                        }
                    }
                }
                catch
                {
                    this._appContext.ShowCommandString("输入不正确", CommandTipsType.CTTLog);
                }
                this.ShowCommandLine();
                flag = true;
            }
            return(flag);
        }
Esempio n. 3
0
 public void Reset()
 {
     this.int_0          = 0;
     this.icommandFlow_0 = null;
     this.ShowCommandLine();
 }
Esempio n. 4
0
 public ExtendLineCommandFlow(ICommandFlow icommandFlow_1)
 {
     this.icommandFlow_0 = icommandFlow_1;
 }
Esempio n. 5
0
 public TrimCommandFlow(ICommandFlow icommandFlow_1)
 {
     this.icommandFlow_0 = icommandFlow_1;
 }
 public ConstructTangentArcCommandFlow(ICommandFlow icommandFlow_1)
 {
     this.icommandFlow_0 = icommandFlow_1;
 }
Esempio n. 7
0
 public GDCommandFlow(ICommandFlow icommandFlow_1)
 {
     this.icommandFlow_0 = icommandFlow_1;
 }
Esempio n. 8
0
 public ThreePointArcCommandFlow(ICommandFlow icommandFlow_1)
 {
     this.icommandFlow_0 = icommandFlow_1;
 }