123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using PaintDotNet.Base;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.Data.Param;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace PaintDotNet.Data.Action
- {
- public class Action11012ArbitrationLaw : ActionAnalysis
- {
- public Action11012ArbitrationLaw() {
- //旋转角度
- IntegerNumber one = new IntegerNumber(0, 50);
- one.key = "rotateangle";
- one.name = "旋转角度";
- one.initialValue = 0;
- one.value = 0;
- lists.Add(one);
- lists.Add(new BooleanObject("displaygrainboundaries", "显示晶界", false, null));
- lists.Add(new BooleanObject("displaygrid", "显示网格", false, null));
- lists.Add(new BooleanObject("displaygridsections", "显示网点", false, null));
- lists.Add(new BooleanObject("autoaddgridsections", "自动添加网点", false, null));
- ChoiseArray selectedItem = new ChoiseArray("selectgrid", "选择辅助线", null);//new BooleanObject[] //{ // new BooleanObject("1", PdnResources.GetString("Menu.solid.text"), true, null),//fill // new BooleanObject("2", PdnResources.GetString("Menu.Sideline.text"), false, null)//solid //}
- GrainSizeArbitrationLawModel grainSize = XmlSerializeHelper.DESerializer<GrainSizeArbitrationLawModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + "Default"/*Startup.instance.SettingPrefix*/ + "\\" + "GrainSizeArbitrationLawModel.xml"/*modelName*/, FileMode.Open));
- selectedItem.choiseList.AddRange(getComboboxArrayList1(grainSize));
- if (selectedItem.choiseList.Count == 0)
- selectedItem.choiseList.Add(new BooleanObject(PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text")/*"1"/*"0"*/, PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text"), true, null));
- lists.Add(selectedItem);
- }
- public List<Args> getComboboxArrayList1(GrainSizeArbitrationLawModel grainSize)
- {
- ArrayList arrayList0 = new ArrayList();
- List<Args> arrayList1 = new List<Args>();
- List<int> indexList1 = new List<int>();
- if (grainSize.GridStyleList != null)
- {
- foreach (var hGuideStyle in grainSize.GridStyleList)
- {
- //if (arrayList1.Count == 0)
- // arrayList1.Add(new BooleanObject("1"/*"0"*/, hGuideStyle.tag, true, null));
- //else
- // arrayList1.Add(new BooleanObject((arrayList1.Count + 1).ToString(), hGuideStyle.tag, false, null));
- arrayList0.Add(hGuideStyle.gridName/*""*/);
- indexList1.Add(grainSize.GridStyleList.IndexOf(hGuideStyle));
- }
- }
- if (arrayList0.Count > 0)
- {
- bool sortSuccess = false;
- while (!sortSuccess)
- {
- sortSuccess = true;
- int firstIndex = 0;
- int secondIndex = 0;
- for (int i = 0; i < indexList1.Count; i++)
- {
- for (int j = i + 1; j < indexList1.Count; j++)
- {
- if (indexList1[i] > indexList1[j])
- {
- sortSuccess = false;
- firstIndex = i;
- secondIndex = j;
- }
- }
- if (!sortSuccess)
- break;
- }
- string firstValue = arrayList0[firstIndex] + "";
- arrayList0[firstIndex] = arrayList0[secondIndex] + "";
- arrayList0[secondIndex] = firstValue;
- int firstIndexV = indexList1[firstIndex] + 0;
- indexList1[firstIndex] = indexList1[secondIndex] + 0;
- indexList1[secondIndex] = firstIndexV;
- }
- for (int i = 0; i < arrayList0.Count; i++)
- {
- if (i == 0)
- arrayList1.Add(new BooleanObject(arrayList0[i].ToString()/*"1"*/, arrayList0[i].ToString(), true, null));
- else
- arrayList1.Add(new BooleanObject(arrayList0[i].ToString()/*(arrayList1.Count + 1).ToString()*/, arrayList0[i].ToString(), false, null));
- }
- //arrayList1.Insert(0, PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text"));
- }
- return arrayList1;
- }
- }
- }
|