public int Initialized(UserTool userTool, int workmode, Coordinate coordinate) { if (isInitialized) { return(1); } else if (!isInitialized && userTool != null && coordinate != null) //还没初始化 { if (userTool.NeedGeometryList != null) //需要初始化需求序列 { needList = new List <NeedGeometrySetItem>(); for (int i = 0; i < userTool.NeedGeometryList.Count; i++) { needList.Add(new NeedGeometrySetItem() { type = userTool.NeedGeometryList[i].type, needNumber = userTool.NeedGeometryList[i].needNumber, selectStack = new List <SelectedGeometryStackItem>(), }); } } isInitialized = true; //经过初始化 state = 1; //执行 turn = 0; //填充need list 下标 result = new List <Models.Geometry.Geometry>(); //操作结果记录 this.workingMode = workmode; //工作模式 return(1); } return(0); }
/// <summary> /// 构造函数 /// </summary> /// <param name="userTool">使用工具</param> /// <param name="workmode">工作模式</param> /// <param name="coordinate">工作场景坐标系</param> public DFA(UserTool userTool, int workmode, Coordinate coordinate) { this.userTool = userTool; this.coordinate = coordinate; if (userTool != null && this.coordinate != null) { if (userTool.NeedGeometryList != null) //需要初始化需求序列 { needList = new List <NeedGeometrySetItem>(); for (int i = 0; i < userTool.NeedGeometryList.Count; i++) { needList.Add(new NeedGeometrySetItem() { type = userTool.NeedGeometryList[i].type, needNumber = userTool.NeedGeometryList[i].needNumber, selectStack = new List <SelectedGeometryStackItem>(), }); } } isInitialized = true; //经过初始化 state = 1; //执行 turn = 0; //填充need list 下标 result = new List <Models.Geometry.Geometry>(); //操作结果记录 this.workingMode = workmode; //工作模式 } else { isInitialized = false; turn = -1; state = -1; } }