public static void SaveGraph(DrawGraph <int> graphD, string path) { Graph <NP <int> > graph = graphD.graph; FileStream file = new FileStream(path, FileMode.Create); BinaryWriter writer = new BinaryWriter(file); writer.Write(graph.Count); writer.Write(graphD.Width); writer.Write(graphD.Height); for (int i = 0; i < graph.Count; i++) { writer.Write(graph[i].Value.V); writer.Write(graph[i].Value.X); writer.Write(graph[i].Value.Y); } for (int i = 0; i < graph.Count; i++) { for (int j = i + 1; j < graph.Count; j++) { Edge <NP <int> > edge = graph[i].GetEdge(graph[j]); if (edge == null) { writer.Write(-1); } else { writer.Write(edge.Value); } } } writer.Close(); file.Close(); }
public static DrawGraph <int> OpenGraph(string path) { Graph <NP <int> > graph = new Graph <NP <int> >(); FileStream file = new FileStream(path, FileMode.Open); BinaryReader reader = new BinaryReader(file); int Count = reader.ReadInt32(); int Width = reader.ReadInt32(); int Height = reader.ReadInt32(); DrawGraph <int> graphD = new DrawGraph <int>(Width, Height); graphD.graph = graph; for (int i = 0; i < Count; i++) { int value = reader.ReadInt32(); int X = reader.ReadInt32(); int Y = reader.ReadInt32(); graph.AddNode(new NP <int>(value, X, Y)); } for (int i = 0; i < Count; i++) { for (int j = i + 1; j < Count; j++) { int value = reader.ReadInt32(); if (value != -1) { graph[i].AddDualLinkedEdgeTo(graph[j], value); } } } reader.Close(); file.Close(); return(graphD); }
public void SaveImageManager(Panel canvas) { SaveFileDialog saveImage = new SaveFileDialog() { FileName = "Graph_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"), Filter = @"PNG Image|*.png|JPEG Image|*.jpeg|GIF Image|*.gif|Bitmap Image|*.bmp", DefaultExt = "png", AddExtension = true, InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) }; // save graph as an image if (saveImage.ShowDialog() == DialogResult.OK) { string filePath = saveImage.FileName; int width = canvas.Size.Width; int height = canvas.Size.Height; Bitmap bitmap = new Bitmap(width, height); var drawer = new DrawGraph(bitmap); _forestGraph.DrawWithPath(drawer, _graphPath); bitmap.Save(filePath); Process.Start(filePath); } }
private void btnZGraph_Click(object sender, EventArgs e) { // Make up some data points from the N, N log(N) functions //int N = 40; //double[] x_values = new double[N]; //double[] y_values_N = new double[N]; //double[] y_values_NLogN = new double[N]; //for (int i = 0; i < N; i++) //{ // x_values[i] = i; // y_values_N[i] = i; // y_values_NLogN[i] = i * Math.Log(i); //} //Create a graph and add two curves to it //ZGraphForm ZGF = new ZGraphForm("Sample Graph", "N", "f(N)"); //ZGF.add_curve("f(N) = N", x_values, y_values_N, Color.Red); //ZGF.add_curve("f(N) = N Log(N)", x_values, y_values_NLogN, Color.Blue); //ZGF.Show(); GraphType graphType; int wMax = (int)numMaxWindow_Graph.Value; if (cmbZGraph.SelectedIndex.Equals(0)) //Alpha-Trim is choosen { graphType = GraphType.ALPHA_TRIM; } else { graphType = GraphType.ADAPTIVE_MEDIAN; } DrawGraph.draw(wMax, graphType); }
public virtual void Awake() { mf = gameObject.AddComponent <MeshFilter>(); mr = gameObject.AddComponent <MeshRenderer>(); mesh = mf.mesh; mesh.Clear(); visible = true; color = Color.white; cullBack = false; colorPointOn = false; LifeTimeOn = false; face = Face.xy; visiblePrev = visible; colorPointOnPrev = colorPointOn; cullBackPrev = cullBack; facePrev = face; //シーン内からDrawGraphオブジェクトを自動的に探して発見すれば登録する //複数あれば最初に見つけた方に集中する controler = FindObjectOfType <DrawGraph>(); if (!controler) { print("not find DrawGraph Obj"); } }
private void Open_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { try { if (sender == OpenA) { DrawA = FileGraph.OpenGraph(openFileDialog.FileName); DrawA.DrawEdgeValue = EdgeParam.Checked; UpdatePicter(OutputA); } else { DrawB = FileGraph.OpenGraph(openFileDialog.FileName); DrawB.DrawEdgeValue = EdgeParam.Checked; UpdatePicter(OutputB); } } catch (Exception) { MessageBox.Show("error"); } } }
private void ChangeContextBtn_Click(object sender, EventArgs e) { if (SelectedNode != null) { DrawGraph <int> draw = SelectedNode.Head == DrawA.graph ? DrawA : DrawB; GetValue get = new GetValue(); get.Value = SelectedNode.Value.V; if (get.ShowDialog() == DialogResult.OK) { SelectedNode.Value.V = get.Value; } UpdatePicter(draw == DrawA?OutputA:OutputB); } else if (SelectedEdge != null) { DrawGraph <int> draw = SelectedEdge.First.Head == DrawA.graph ? DrawA : DrawB; GetValue get = new GetValue(); get.Value = SelectedEdge.Value; if (get.ShowDialog() == DialogResult.OK) { SelectedEdge.Value = get.Value; } UpdatePicter(draw == DrawA ? OutputA : OutputB); } menuwork = false; SelectedNode = null; }
void Awake() { GameObject go = Instantiate(Resources.Load("DrawGraph")) as GameObject; dg = go.GetComponent <DrawGraph>(); dg.AddCircle("circle1", Vector3.zero, 3, 32, Color.grey); dg.AddLine("Line1", new Vector3(-5.0f, 3.0f, 0.0f), new Vector3(20.0f, 3.0f, 0.0f), Color.cyan); dg.AddLine("Line2", new Vector3(-5.0f, 0.0f, 0.0f), new Vector3(20.0f, 0.0f, 0.0f), Color.cyan); dg.AddLine("Line3", new Vector3(-5.0f, -3.0f, 0.0f), new Vector3(20.0f, -3.0f, 0.0f), Color.cyan); dg.AddLine("Line4", new Vector3(-3.0f, 5.0f, 0.0f), new Vector3(-3.0f, -20.0f, 0.0f), Color.cyan); dg.AddLine("Line5", new Vector3(0.0f, 5.0f, 0.0f), new Vector3(0.0f, -20.0f, 0.0f), Color.cyan); dg.AddLine("Line6", new Vector3(3.0f, 5.0f, 0.0f), new Vector3(3.0f, -20.0f, 0.0f), Color.cyan); GameObject grid1 = dg.AddGrid("grid1", 14 * 2, 6 * 2, new Color(100, 100, 100, 0.2f), 0.5f, 0.5f); grid1.transform.position = new Vector3(12, 0, 0); //普通にゲームオブジェクトとして扱えます GameObject grid2 = dg.AddGrid("grid2", 6 * 2, 14 * 2, new Color(100, 100, 100, 0.2f), 0.5f, 0.5f); grid2.transform.position = new Vector3(0, -12, 0); //VectorMeshを継承した独自オブジェクトをDrawGraphクラスの辞書に登録 //この独自オブジェクトは独立したゲームオブジェクトとしても使える //辞書に登録すればRemoveやカラー変更等の機能も一括管理で利用できる(登録するか、しないかは自由) GameObject go2 = Instantiate(Resources.Load("AnimationSinVectorMesh")) as GameObject; dg.AddVectorMeshObjcect("AnimationSinVectorMesh1", go2); GameObject go3 = Instantiate(Resources.Load("AnimationSinVectorMesh")) as GameObject; dg.AddVectorMeshObjcect("AnimationSinVectorMesh2", go3); }
private void Declare() { Action = new MainMenu.Action(this); Button = new ButtonItem(this); CreateMain = new Create(this); Keyboard = new Keyboard(this); MainMenu = new MainMenu.Menu(this); Mouse = new Mouse(this); Nav = new Navigation(this); Shutter = new Shutter(this); SubAction = new SubMenu.Action(this); SubMenu = new SubMenu.Menu(this); SubSelectMenu = new SubSelectMenu.Menu(this); SubSelectVar = new SubSelectMenu.Var(); SubNav = new SubSelectMenu.Navigation(this); Var = new Variables(); Data = new Interaction(); Fps = new FrameCount(); Gamepad = new Gamepad(this); User = new User(); DrawGui = new DrawGraph(); Display = new Display(this); VideoDevice = new CaptureDevice(this); Profiles = new Profiles(this); RemapMenu = new Remap.Remap(this); RemapGamepad = new Remap.Gamepad(this); RemapNav = new Remap.Navigation(this); ConfigVr = new VR.Config(this); ResizeVr = new Resize(this); RepositionVr = new Reposition(this); }
void OnDisable() { SaveData(); DrawGraph.Clear(); DrawGraph.onInput -= OnInput; }
public Form1(string[] args) { InitializeComponent(); this.Icon = Icon.FromHandle(Properties.Resources.graph_icon.GetHicon()); DrawGraph.CreateGraphics(display); DrawTool.Initialize(this, args); }
public MainForm() { InitializeComponent(); _matrixDialog = null; _drawer = new DrawGraph(); _rectangle = new Rectangle(0, 0, 0, 0); _rectangleDrawing = false; _forestGraph = new Graph <string, VertexData, string, EdgeData>(); _saved = true; _graphPath = new List <string>(); _dijkstra = new DijkstraAlhorithm <string, VertexData, string, EdgeData>(_forestGraph); _trajectoryMatrix = new TrajectoryMatrix(); _trajectoryMatrixReady = false; _matrixGeneration = null; _saveFileName = ""; _rangeTree = new RangeTree <VertexData>(); _binaryFile = @".\data.bin"; SetTitle(); #if DEBUG _autoloadPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; #else _autoloadPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath); #endif _autoloadPath += @"\autoload.xml"; // autoload data if (File.Exists(_autoloadPath)) { try { DataSerializer.LoadData(_forestGraph, _autoloadPath); graphCanvas.Invalidate(); RegenerateTrajectoryMatrix(); BuildRangeTree(); } catch (Exception ex) { MessageBox.Show(Resources.AutoImportError + "\n\nDetail chyby:\n" + ex.Message, Resources.AutoImportErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } Size size = Properties.Settings.Default.MainformSize; if (size.Width >= 500 && size.Height >= 300) { Size = size; } Point position = Properties.Settings.Default.MainformPosition; if (!(position.X <= -1000 && position.Y <= -1000)) { StartPosition = FormStartPosition.Manual; Location = position; } }
void Start() { graph = GetComponent <DrawGraph>(); graph.area = new Rect(10, 10, Screen.width - 20, Screen.height - 20); graph.AddItem("Horizontal", Color.red, -4, 1); graph.AddItem("Vertical", Color.blue, -4, 1); graph.AddItem("HorizontalRaw", new Color(1.0f, 0.5f, 0.5f, 0.8f), -4, 1); graph.AddItem("VerticalRaw", new Color(0.5f, 0.8f, 1.0f, 0.8f), -4, 1); graph.AddItem("A", Color.cyan, -3, 10); graph.AddItem("D", Color.green, -3, 10); graph.AddItem("R", Color.cyan, 0, 7); graph.AddItem("L", Color.green, 0, 7); }
private void Remove(object sender, EventArgs e) { if (SelectedNode != null) { DrawGraph <int> draw = SelectedNode.Head == DrawA.graph ? DrawA : DrawB; draw.graph.RemoveNode(SelectedNode); UpdatePicter(draw == DrawA ? OutputA : OutputB); } else if (SelectedEdge != null) { DrawGraph <int> draw = SelectedEdge.First.Head == DrawA.graph ? DrawA : DrawB; SelectedEdge.First.RemoveEdge(SelectedEdge); UpdatePicter(draw == DrawA ? OutputA : OutputB); } menuwork = false; SelectedNode = null; }
public FormGlobal() { InitializeComponent(); V = new List <Vertex>(); G = new DrawGraph(ImageBox.Width, ImageBox.Height); E = new List <Edge>(); ImageBox.Image = G.GetBitmap(); ToolTip t = new ToolTip(); t.SetToolTip(drawVertexButton, "Намалювати вершину"); t.SetToolTip(drawEdgeButton, "Провести ребро"); t.SetToolTip(selectButtonFloyd, "Знайти найкоротший шлях за алгоритмом Флойда-Воршелла\nІ вивести матрицю найкоротших шляхів"); t.SetToolTip(selectButtonFord, "Знайти найкоротший шлях за алгоритмом Форда-Беллмана\nІ показати цей шлях на малюнку"); t.SetToolTip(deleteButton, "Видалити один елемент"); t.SetToolTip(deleteALLButton, "Видалити граф"); t.SetToolTip(saveButton, "Зберегти зображення графу"); }
void Start() { // Supported types: float, Quaternion, Vector3 DrawGraph.Add("Vec3Test", Vector3.zero) // Use System.Linq::ForEach( ... ) to assing group style values .ForEach(graph => graph .SetLineWidth(2f) .SetGraphHeight(120f) .SetStepSize(0.25f) .SetLimits(-2f, 2f) ); DrawGraph.Add("Empty graph test", 0f); //Combine two graphs in the same view DrawGraph.Get("c1").SetGroup("GroupC"); DrawGraph.Get("c2").SetGroup("GroupC"); }
private void Output_MouseMove(object sender, MouseEventArgs e) { if (SelectedNode != null) { DrawGraph <int> draw = sender == OutputA ? DrawA : DrawB; if (ChangeBtn.Checked) { if (draw.PlaceChangeFree(e.Location, SelectedNode)) { SelectedNode.Value.P = e.Location; } UpdatePicter(sender); } if (AddEdge.Checked) { ((PictureBox)sender).Image = draw.Draw(SelectedNode, e.Location); } } }
/// <summary> /// Set listbox handler /// </summary> /// <param name="display">Listbox handler</param> public static void SetDisplayHandler(ListBox display) { if (display != null) { Display = display; } Display.SelectedIndexChanged += (s, e) => { if (SelectedIndex != -1) { DrawGraph.HighlightPath ( GetItem <GraphPath>().StringPath, DefaultSettings.PathColor, DefaultSettings.PathBeginColor, DefaultSettings.PathEndColor ); } }; }
void Update() { if (!updateGraph) { return; } // Add values to be drawn in the graph // ( seperate graphs, not in a group ) // Since no settings are assigned, default style // values are used for A & B DrawGraph.Add("A", Random.value); DrawGraph.Add("B", Random.value); // Automaticlly create a group for Vector3 and // assign each of the x,y,z componenets into the // same group DrawGraph.Add("Vec3Test", new Vector3( Mathf.Sin(Time.time / 10), Mathf.Tan(1 / Time.time), Mathf.Cos(Time.time / 10) )); // c1 & c2 will be drawn in the same group DrawGraph.Add("c1", Mathf.Sin(1 / Time.time)); // If you are feeling particulary lazy, style values // can be assined during update DrawGraph.Add("Random red", Random.value).SetLengthLimit(250) .SetColor(Color.red) .SetLineWidth(4f) .SetStepSize(2f); // Grouped items don't need to be updated in the same place or time if (Random.value > 0.7) { // c1 & c2 will be drawn in the same group DrawGraph.Add("c2", Mathf.Tan(1 / Time.time)); } }
public static DrawGraph Singelton() { if (instance == null) { InitEvents(); instance = GameObject.Find(GameObjectName)?.GetComponent <DrawGraph>(); if (instance == null) { var go = new GameObject(GameObjectName); go.hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy; instance = go.AddComponent <DrawGraph>(); } instance.data = new Dictionary <string, GraphItem>(); } return(instance); }
public void AddItemsToMenu(GenericMenu menu) { GraphStrings.MenuStrings(); menu.AddItem(GraphStrings.MenuAutoOpen, data.autoOpen, () => { data.autoOpen = !data.autoOpen; SaveData(); }); menu.AddItem(GraphStrings.MenuDataLength, data.showCounts, () => { data.showCounts = !data.showCounts; SaveData(); }); menu.AddItem(GraphStrings.MenuHeaderValues, data.showValues, () => { data.showValues = !data.showValues; SaveData(); }); menu.AddSeparator(""); if (DrawGraph.Singelton().hasData) { menu.AddItem(GraphStrings.MenuClearAll, false, () => DrawGraph.Clear()); } else { menu.AddDisabledItem(GraphStrings.MenuClearAll); } menu.AddSeparator(""); menu.AddItem(GraphStrings.MenuExpandAll, false, () => DrawGraph.Singelton().data.Values.ToList().ForEach(item => item._.visible = true)); menu.AddItem(GraphStrings.MenuCollapseAll, false, () => DrawGraph.Singelton().data.Values.ToList().ForEach(item => item._.visible = false)); menu.AddSeparator(""); menu.AddDisabledItem(GraphStrings.MenuDefaultItems); }
public MainWindow() { InitializeComponent(); InitializeColorPickers(); draw = new DrawGraph(mainCanvas, GraphCreator.CreateFullGraph()); }
private void GraphForm_Load(object sender, EventArgs e) { DrawA = new DrawGraph <int>(OutputA.Size); DrawB = new DrawGraph <int>(OutputB.Size); }
private void ToolStripMenuItem_GenerateReport_Click(object sender, EventArgs e) { WordHelper wh = new WordHelper(); SaveFileDialog sfd = new SaveFileDialog(); string blkGrad = ""; sfd.Filter = "Word File|*.doc|(*.*)|*.*"; sfd.Title = "保存文件"; //sfd.ShowDialog(); StringBuilder strBlocks = new StringBuilder(); //******************************************************************// double dbVal; List <double> wgtGeo = new List <double>(); List <double> wgtEng = new List <double>(); List <double> wgtEco = new List <double>(); DrawGraph dgGeo = null; Bitmap bmGeo = null; string bmGeoPath = null; DrawGraph dgEng = null; Bitmap bmEng = null; string bmEngPath = null; DrawGraph dgEco = null; Bitmap bmEco = null; string bmEcoPath = null; //对地质参数用画图类的构造函数进行实例化 if (PublicValues.ArrGeoParas.Length != 0) { foreach (string str in PublicValues.ArrGeoParas) { PublicValues.DicGeoP_W.TryGetValue(str, out dbVal); wgtGeo.Add(dbVal); } dgGeo = new DrawGraph(PublicValues.ArrGeoParas, wgtGeo.ToArray(), "参数", "权重值", "黑体", 180); bmGeo = dgGeo.DrawBarGraph(); bmGeoPath = System.Windows.Forms.Application.StartupPath + "\\geoWgtBar.jpeg"; bmGeo.Save(bmGeoPath, MyImage.ImageFormat.Jpeg); } //对工程参数用画图类的构造函数进行实例化 if (PublicValues.ArrEngParas.Length != 0) { foreach (string str in PublicValues.ArrEngParas) { PublicValues.DicEngP_W.TryGetValue(str, out dbVal); wgtEng.Add(dbVal); } dgEng = new DrawGraph(PublicValues.ArrEngParas, wgtEng.ToArray(), "参数", "权重值", "黑体", 180); bmEng = dgEng.DrawBarGraph(); bmEngPath = System.Windows.Forms.Application.StartupPath + "\\engWgtBar.jpeg"; bmEng.Save(bmEngPath, MyImage.ImageFormat.Jpeg); } if (!strName.Contains("dgvBsn_TDM")) { // 对经济参数用画图类的构造函数进行实例化 if (PublicValues.ArrEcoParas.Length != 0) { foreach (string str in PublicValues.ArrEcoParas) { PublicValues.DicEcoP_W.TryGetValue(str, out dbVal); wgtEco.Add(dbVal); } dgEco = new DrawGraph(PublicValues.ArrEcoParas, wgtEco.ToArray(), "参数", "权重值", "黑体", 180); bmEco = dgEco.DrawBarGraph(); bmEcoPath = System.Windows.Forms.Application.StartupPath + "\\ecoWgtBar.jpeg"; bmEco.Save(bmEcoPath, MyImage.ImageFormat.Jpeg); } } bool isOpen = false; bool flag = true; //******************************************************************// foreach (string str in arr_TgtName) { if (str != arr_TgtName.Last()) { strBlocks.Append(str + "、"); } else { strBlocks.Append(str + ";"); } } if (strName.Contains("dgvBlk_TDM")) { blkGrad = "有利区"; } if (strName.Contains("dgvBsn_TDM")) { blkGrad = "远景区"; } if (strName.Contains("dgvTgt_TDM")) { blkGrad = "核心区"; } string strFileName = null; if (sfd.ShowDialog() == DialogResult.OK) { strFileName = sfd.FileName; wh.CreateWord(strFileName); wh.InsertText("页岩气选区评价结果分析", 18, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphCenter, 0); wh.NewLine(); wh.InsertText("一、" + blkGrad + "参与评价区块", 16, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 0); wh.NewLine(); wh.InsertText(strBlocks.ToString(), 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("二、TOPSIS方法评价参数、判断矩阵及权重", 16, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 0); wh.NewLine(); wh.InsertText("2.1、地质因素", 14, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 20); wh.NewLine(); wh.InsertText("2.1.1、评价参数", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); if (PublicValues.ArrGeoParas.Length != 0) { wh.InsertText(PublicValues.GeoParas, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } else { wh.InsertText("没有地质参数参与评价。", 10, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } //wh.InsertText(PublicValues.GeoParas, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("2.1.2、判断矩阵", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); flag = wh.DGV2Word(PublicValues.dgv_Geo); if (flag == false) { return; } //wh.DGV2Word(PublicValues.dgv_Geo); //wh.NewLine(); wh.InsertText("2.1.3、地质参数权重", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); if (PublicValues.ArrGeoParas.Length != 0) { wh.InsertPicture(bmGeoPath); } else { wh.InsertText("没有地质参数参与评价。", 10, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } //wh.InsertText(PublicValues.GeoWgt, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("2.2、工程因素", 14, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 20); wh.NewLine(); wh.InsertText("2.2.1、评价参数", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); if (PublicValues.ArrEngParas.Length != 0) { wh.InsertText(PublicValues.EngParas, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } else { wh.InsertText("没有工程参数参与评价。", 10, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } //wh.InsertText(PublicValues.EngParas, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("2.2.2、判断矩阵", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); wh.DGV2Word(PublicValues.dgv_Eng); //wh.NewLine(); wh.InsertText("2.2.3、工程参数权重", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); if (PublicValues.ArrEngParas.Length != 0) { wh.InsertPicture(bmEngPath); } else { wh.InsertText("没有工程参数参与评价。", 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } //wh.InsertText(PublicValues.EngWgt, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); if (!strName.Contains("dgvBsn_TDM")) { wh.InsertText("2.3、经济因素", 14, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 20); wh.NewLine(); wh.InsertText("2.3.1、评价参数", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); if (PublicValues.ArrEcoParas.Length != 0) { wh.InsertText(PublicValues.EcoParas, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } else { wh.InsertText("没有经济参数参与评价。", 10, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } //wh.InsertText(PublicValues.EcoParas, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("2.3.2、判断矩阵", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); wh.DGV2Word(PublicValues.dgv_Eco); //wh.NewLine(); wh.InsertText("2.3.3、经济参数权重", 14, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 25); wh.NewLine(); if (PublicValues.ArrEcoParas.Length != 0) { wh.InsertPicture(bmEcoPath); } else { wh.InsertText("没有经济参数参与评价。", 10, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } //wh.InsertText(PublicValues.EcoWgt, 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); } wh.InsertText("三、评价结果", 16, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 0); wh.NewLine(); wh.InsertText("3.1、有利区", 14, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 20); wh.NewLine(); if (strClass_1.Equals(null)) { MessageBox.Show("未对参数进行自然分类,所以分类评价结果为Null。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); wh.InsertText("Null", 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("3.2、一般区", 14, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 20); wh.NewLine(); wh.InsertText("Null", 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("3.3、较差区", 14, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 20); wh.NewLine(); wh.InsertText("Null", 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } else { wh.InsertText(strClass_1.ToString(), 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("3.2、一般区", 14, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 20); wh.NewLine(); wh.InsertText(strClass_2.ToString(), 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); wh.NewLine(); wh.InsertText("3.3、较差区", 14, 1, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 20); wh.NewLine(); wh.InsertText(strClass_3.ToString(), 12, 0, "SimHei", MyWord.WdParagraphAlignment.wdAlignParagraphLeft, 30); } isOpen = wh.SaveWord(strFileName); if (isOpen == false) { return; } } DialogResult dr = MessageBox.Show("报告已完成,是否打开该报告?。", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { wh.OpenWordDoc(strFileName); } else { wh.QuitWordApp(strFileName); } }
private void Output_MouseDown(object sender, MouseEventArgs e) { menuwork = false; DrawGraph <int> draw = sender == OutputA ? DrawA : DrawB; if (e.Button == MouseButtons.Right) { SelectedNode = draw.GetNode(e.Location); SelectedEdge = draw.GetEdge(e.Location); if (SelectedNode != null || SelectedEdge != null) { contextMenuStrip.Show((Control)sender, e.Location); } menuwork = true; return; } if (AddBtn.Checked) { if (draw.PlaceFree(e.Location)) { GetValue get = new GetValue(); if (get.ShowDialog() == DialogResult.OK) { draw.Add(get.Value, e.Location); UpdatePicter(sender); } } } if (AddEdge.Checked) { if (SelectedNode == null) { SelectedNode = draw.GetNode(e.Location); } else { if (SelectedNode.Head == draw.graph) { Node <NP <int> > T = draw.GetNode(e.Location); if (T != SelectedNode && T != null && T.GetEdge(SelectedNode) == null) { GetValue get = new GetValue(); if (get.ShowDialog() == DialogResult.OK) { SelectedNode.AddDualLinkedEdgeTo(T, get.Value); } UpdatePicter(sender); } SelectedNode = null; } else { SelectedNode = draw.GetNode(e.Location); } } } if (ChangeBtn.Checked) { SelectedNode = draw.GetNode(e.Location); } }
void OnGUI() { if (!DrawGraph.Singelton().hasData) { EditorGUILayout.HelpBox(GraphStrings.NoData, MessageType.Info); return; } if (WasAutoOpen && !DismissAutoOpen) { using (new GUILayout.HorizontalScope()) { EditorGUILayout.HelpBox(GraphStrings.AutoOpened, MessageType.Info); if (GUILayout.Button("X", GUILayout.Width(24), GUILayout.Height(38))) { DismissAutoOpen = true; } } } float ppp = EditorGUIUtility.pixelsPerPoint; bool isWide = Screen.width / ppp > 400; using (var scope = new GUILayout.ScrollViewScope(data.scroll)) { GUILayout.Space(10); data.scroll = scope.scrollPosition; var groups = DrawGraph.Singelton().data._GetDataWGroups(); var groups_count = groups.Count; for (var i = 0; i < groups_count; ++i) { if (isWide && groups_count > 1 && !(i == groups_count - 1 && groups_count % 2 == 1)) { if (i % 2 == 0) { GUILayout.BeginHorizontal(); } GraphGroupGUI(groups[i], Screen.width / ppp / 2 - 5); if (i % 2 != 0) { GUILayout.EndHorizontal(); } } else { GraphGroupGUI(groups[i], Screen.width); } } var graphs = DrawGraph.Singelton().data._GetDataWoGroups(); var graphs_count = graphs.Count; for (var i = 0; i < graphs_count; ++i) { if (isWide && graphs_count > 1 && !(i == graphs_count - 1 && graphs_count % 2 == 1)) { if (i % 2 == 0) { GUILayout.BeginHorizontal(); } GraphGUI(graphs[i], Screen.width / ppp / 2 - 5); if (i % 2 != 0) { GUILayout.EndHorizontal(); } } else { GraphGUI(graphs[i], Screen.width); } } GUILayout.Space(20); } }