private void GoToTag(bool inNewTab) { //Initialize our parent control Control parent = this; //Create an instance of MapForm which we will obtain MapForm ParentMapForm = null; //Loop while (true) { //If our parent's parent is null if (parent.Parent == null) { //Break out of the loop. break; } //Set our parent as the previous control's parent. parent = parent.Parent; //If our parent is the map form if (parent.GetType().ToString() == "Alteration.Forms.MapForm") { //Set our map form instance ParentMapForm = (MapForm)parent; //Break out of the loop break; } } //If our parent map form is null.. if (ParentMapForm == null) { //Stop processing code return; } //Otherwise... //If we are to make a new tab if (inNewTab) { //Make it. ParentMapForm.CreateNewDocument(); } //Go to the tag ParentMapForm.GotoTag(identGrid.SelectedItems[0].SubItems[2].Text, identGrid.SelectedItems[0].SubItems[3].Text); }
/// <summary> /// Called when Entity is closed (closes all open instances of MAPFORM). /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void newMapForm_FormClosed(object sender, FormClosedEventArgs e) { MapForm mapForm = (MapForm)sender; // make sure map stream is closed mapForm.map.CloseMap(); // update map count MapCount--; if (MapCount <= 0) { closemapmenu.Enabled = false; } Prefs.Save(); }
/// <summary> /// The custom plugin editor_ load. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void CustomPluginEditor_Load(object sender, EventArgs e) { // Add each tag listing foreach (DictionaryEntry de in map.MetaInfo.TagTypes) { treeViewTags.Nodes.Add((string)de.Key); } treeViewTags.Sort(); // Load all Custom Plugin Names foreach (Prefs.CustomPluginMask pluginMask in Prefs.CustomPluginMasks) { comboBoxPluginName.Items.Add(pluginMask.Name); } // set to same selection as in mapform MapForm mf = (MapForm)((Form)sender).Owner; if (mf.comboBox1.SelectedIndex == 0) { comboBoxPluginName.SelectedIndex = 0; } else { comboBoxPluginName.SelectedIndex = mf.comboBox1.SelectedIndex - 1; } if (map.SelectedMeta != null && treeViewTags.Nodes.Count > 0) { TreeNode tn = treeViewTags.Nodes[0]; while (tn != null) { if (tn.Text == map.SelectedMeta.type) { treeViewTags.SelectedNode = treeViewTags.Nodes[treeViewTags.Nodes.IndexOf(tn)]; break; } tn = tn.NextNode; } } saveTagBtn.Enabled = false; tagsChanged = false; }
private void ListTerrains_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Tag.GetType().Equals(typeof(MapForm))) { MapForm map = (MapForm)e.ClickedItem.Tag; if (map.XCount % 2 == 1 && map.YCount / map.XCount == 3) { MapClip = map; initDeepNodes(); initFixNodes(); refreshRegion(); } } }
/// <summary> /// Excel 转 shp /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ExcelToMap_Click(object sender, ItemClickEventArgs e) { IList <string> paths = FileUtils.SelectExcelFiles(); if (MyUtils.Utils.CheckListExists(paths)) { MapFormCustom mapFormCustom = MapFormCustom.GetInstance(); ArcGisController arcGisController = new ArcGisController(MapForm.GetAxMapControl()); try { arcGisController.ExcelToShp(paths); } catch (Exception e1) { MessageBox.Show("表格有问题,请注意检查!!!"); } } }
public SwapTagHeader(HaloMap.TagItem meta, MapForm mf) { InitializeComponent(); Meta = meta; form = mf; foreach (TagHierarchy.TagHClass class2 in Meta.Map.Tag_Hierarchy.TagClasses) { if (class2.TagClass == Meta.Class) { foreach (TagHierarchy.TagHName name in class2.Tags) { comboBox1.Items.Add(name.TagName); } } } comboBox1.Sorted = true; comboBox1.SelectedIndex = 0; }
private void menuButtonItem1_Activate(object sender, EventArgs e) { //Initialize our OpenFileDialog OpenFileDialog ofd = new OpenFileDialog(); //Set the filter for Halo 3 Map Files. ofd.Filter = "Halo 3 Map Files|*.map"; if (ofd.ShowDialog() == DialogResult.OK) { //Initialize our instance of the Halo 3 Map Class. HaloMap map = new HaloMap(ofd.FileName); //Initialize a new instance of our MDI child form. MapForm mapForm = new MapForm(map); //Set the mapForm's MDI Parent Container as this form. mapForm.MdiParent = this; //Show our mapForm. mapForm.Show(); } }
/// <summary> /// Initializes a new instance of the <see cref="MetaItemComparer"/> class. /// </summary> /// <param name="currentForm">The current form.</param> /// <remarks></remarks> public MetaItemComparer(MapForm currentForm) { Map map = currentForm.map; int counter = 0; for (counter = 0; counter < map.MapHeader.fileCount; counter++) { currentForm.SetProgressBar(counter * 100 / map.MapHeader.fileCount); ifpMeta = new Meta(map); manualMeta = new Meta(map); manualMeta.ReadMetaFromMap(counter, false); ifpMeta.ReadMetaFromMap(counter, false); // parse ifp and scan meta with it try { IFPIO io = IFPHashMap.GetIfp(ifpMeta.type, map.HaloVersion); ifpMeta.headersize = io.headerSize; manualMeta.headersize = io.headerSize; try { ifpMeta.scanner.ScanWithIFP(ref io); } catch (Exception ex) { Global.ShowErrorMsg("Broken IFP - " + ifpMeta.type, ex); } manualMeta.scanner.ScanManually(); check(map); } catch (Exception ex) { Globals.Global.ShowErrorMsg(string.Empty, ex); } } currentForm.SetProgressBar(0); }
/// <summary> /// The custom plugin editor_ form closed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void CustomPluginEditor_FormClosed(object sender, FormClosedEventArgs e) { Prefs.Save(); MapForm mf = (MapForm)this.Owner; // If the visiblity state of any tags changed, reload the tags TreeView if (tagsChanged) { mf.RefreshTreeView(); } // if the selected tag type was changed, reload that tag type if (changesMade && map.SelectedMeta != null) { // Null the type so it reloads the tag completely mf.metaEditor1.selectedTagType = null; mf.LoadMeta(map.SelectedMeta.TagIndex); } }
/// <summary> /// The tree view 1_ after select. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (treeView1.SelectedNode.Level == 2) { currBitm = treeView1.SelectedNode.Parent.Parent.Index; currChunk = treeView1.SelectedNode.Parent.Index; currMipMap = treeView1.SelectedNode.Index; } else if (treeView1.SelectedNode.Level == 1) { currBitm = treeView1.SelectedNode.Parent.Index; currChunk = treeView1.SelectedNode.Index; currMipMap = 0; } else { currBitm = treeView1.SelectedNode.Index; currChunk = 0; currMipMap = 0; } DisplayBitmap(currBitm, currChunk, currMipMap); object o = ((Form)this.TopLevelControl).ActiveMdiChild; if (o is MapForm) { MapForm mf = (MapForm)o; Meta meta = map.SelectedMeta; ParsedBitmap pm = new ParsedBitmap(ref meta, map); Bitmap b = pm.FindChunkAndDecode(currBitm, currChunk, currMipMap, ref meta, map, 0, 0); mf.pictureBox = (Bitmap)pictureBox1.Image.Clone(); mf.statusBarText = (Math.Max(pm.Properties[currBitm].width >> currChunk >> currMipMap, 1)).ToString().PadLeft(4) + " X " + (Math.Max(pm.Properties[currBitm].height >> currChunk >> currMipMap, 1)).ToString().PadRight(4) + "X " + (Math.Max(pm.Properties[currBitm].depth >> currChunk >> currMipMap, 1)).ToString().PadRight(4) + " " + ("(" + pm.Properties[currBitm].typename.ToString().Remove(0, 10) + ") ").PadRight(10) + pm.Properties[currBitm].formatname.ToString().Remove(0, 12).PadRight(10) + " - Swizzle:" + pm.Properties[0].swizzle + "- Location: " + meta.raw.rawChunks[0].rawLocation; } }
public SetRouteForm(MapForm mf) { InitializeComponent(); this.mf = mf; objects = new GMapOverlay(routemap, "objects"); routemap.Overlays.Add(objects); routes = new GMapOverlay(routemap, "routes"); routemap.Overlays.Add(routes); Net = new GMapOverlay(routemap, "Net"); routemap.Overlays.Add(Net); infolayers = new GMapOverlay(routemap, "Info"); routemap.Overlays.Add(infolayers); WebNodeLayer = new GMapOverlay(routemap, "webnode"); routemap.Overlays.Add(WebNodeLayer); g = routemap.CreateGraphics(); routemap.Manager.Mode = AccessMode.ServerAndCache; string MyExecPath = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName); xmldoc = MyExecPath + "\\" + "config.xml"; }
private static void OutputMessage(string Message, MapForm form) { DateTime time = form.Initialized_Time; TimeSpan span = DateTime.Now.Subtract(time); string str = span.Hours.ToString(); string str2 = span.Minutes.ToString(); string str3 = span.Seconds.ToString(); while (str.Length != 2) { str = "0" + str; } while (str2.Length != 2) { str2 = "0" + str2; } while (str3.Length != 2) { str3 = "0" + str3; } bool flag = form.rtbOutputBox.SelectionStart >= (form.rtbOutputBox.Text.Length - 1); string[] strArray = Message.Split(new char[] { '\n' }); foreach (string str4 in strArray) { if (str4.Replace(" ", "") != "") { string text = form.rtbOutputBox.Text; form.rtbOutputBox.Text = text + "[" + str + ":" + str2 + ":" + str3 + "] " + str4 + "\n"; } } if (flag) { form.rtbOutputBox.SelectionStart = form.rtbOutputBox.Text.Length - 1; form.rtbOutputBox.ScrollToCaret(); } }
public void relocation(MapForm map) { pictureBox1.Refresh(); }
private void SaveMxd_Click(object sender, ItemClickEventArgs e) { AddDocument(MapFormCustom.GetInstance()); MapForm.MXDSave(); }
/// <summary> /// Attempts to load a mapand bring up a map form for /// it. Function will fail if the map is corrupt and /// display an error message. Provide a null string to /// show openfileDialog. Returns a refernce to the created mapform /// if needed /// </summary> /// <param name="mapFileName">The map File Name.</param> /// <returns></returns> /// <remarks></remarks> public MapForm TryLoadMapForm(string mapFileName) { // Only allow for 10 map forms to be open at any one time, for // memory reasons if (MapCount >= 10) { MessageBox.Show("Too many maps open, close a map."); return(null); } // show a dialog if null filename if (mapFileName == null) { openmapdialog.InitialDirectory = Prefs.pathMapsFolder; // if the user cancels out the dialog, no map to open if (openmapdialog.ShowDialog() == DialogResult.Cancel) { return(null); } Prefs.pathMapsFolder = openmapdialog.InitialDirectory; // set the file name to user chosen file mapFileName = openmapdialog.FileName; } // Check map isn't already loaded into a map form foreach (MapForm mapForm in this.MdiChildren) { if (mapForm.map.filePath == mapFileName) { MessageBox.Show("This map is already open in this editor!.."); return(mapForm); } } // Show a wait cursor while map is loading this.Cursor = Cursors.WaitCursor; // Attempt to load the map Map newMap = Map.LoadFromFile(mapFileName); // Restore our arrow cursor after map is loaded this.Cursor = Cursors.Arrow; // map failed to load for some reason if (newMap == null) { MessageBox.Show("Map failed to load..."); return(null); } // Show a wait cursor while map is loading this.Cursor = Cursors.WaitCursor; // create a map form for the map MapForm newMapForm = new MapForm(newMap); // Restore our arrow cursor after map is loaded this.Cursor = Cursors.Arrow; // set it to a child of this main form newMapForm.MdiParent = this; // keep track of open maps MapCount++; if (MapCount > 0) { closemapmenu.Enabled = true; } // store map in recent list UpdateRecentFiles(mapFileName); // give the form a close event newMapForm.FormClosed += newMapForm_FormClosed; // show form newMapForm.Show(); return(newMapForm); }
private void DeleteTuFuKuang_Click(object sender, ItemClickEventArgs e) { AddDocument(MapFormCustom.GetInstance()); MapForm.DeleteTuFuKuang(); }
public void putSelectRegion( MapForm map, int bx, int by) { if (MapClip != null) { MapLayer clip_layer = MapClip.getCurLayer(); MapLayer dst_layer = map.getCurLayer(); int px = MapClip.XCount / 2; int py = MapClip.XCount / 2; bx -= px; by -= py; for (int x = 0; x < MapClip.XCount; x++) { for (int y = 0; y < MapClip.XCount; y++) { int lenx = Math.Abs(x - px); int leny = Math.Abs(y - py); int dbx = bx + x; int dby = by + y; if (dbx >= 0 && dbx < map.XCount && dby >= 0 && dby < map.YCount) { int srcTile = MapClip.getTileID(clip_layer, x, y); int srcFlip = MapClip.getTileFlip(clip_layer, x, y); DeepNode srcDeep = getTileDeep(srcTile, srcFlip); int dstTile = map.getTileID(dst_layer, dbx, dby); int dstFlip = map.getTileFlip(dst_layer, dbx, dby); DeepNode dstDeep = getTileDeep(dstTile, dstFlip); if (dstDeep == null) { srcTile = MapClip.getTileID(clip_layer, x, y); srcFlip = MapClip.getTileFlip(clip_layer, x, y); map.putTile(dst_layer, srcTile, dbx, dby); map.putFlip(dst_layer, srcFlip, dbx, dby); } else { if (dstDeep.Len < srcDeep.Len)//联合 { if (srcDeep.DX != 0 && srcDeep.DY != 0) { if (srcDeep.DX == -dstDeep.DX || srcDeep.DY == -dstDeep.DY) { FixNode fix = null; if (srcDeep.DX == -dstDeep.DX) { fix = getFixNode(-srcDeep.DX, srcDeep.DY, dstDeep.DX, dstDeep.DY); } else if (srcDeep.DY == -dstDeep.DY) { fix = getFixNode(srcDeep.DX, -srcDeep.DY, dstDeep.DX, dstDeep.DY); } if (fix != null) { // Console.WriteLine("联合 : " + x + ", " + y); map.putTile(dst_layer, fix.Tile, dbx, dby); map.putFlip(dst_layer, fix.Flip, dbx, dby); } } } } else if (dstDeep.Len > srcDeep.Len)//覆盖 { FixNode fix = null; if (dstDeep.DX != 0 && dstDeep.DY != 0) { if (srcDeep.DX == -dstDeep.DX) { fix = getFixNode(srcDeep.DX, 0, -dstDeep.DX, dstDeep.DY); } else if (srcDeep.DY == -dstDeep.DY) { fix = getFixNode(0, srcDeep.DY, dstDeep.DX, -dstDeep.DY); } } // Console.WriteLine("覆盖 : " + x + ", " + y); if (fix != null) { map.putTile(dst_layer, fix.Tile, dbx, dby); map.putFlip(dst_layer, fix.Flip, dbx, dby); } else { map.putTile(dst_layer, srcTile, dbx, dby); map.putFlip(dst_layer, srcFlip, dbx, dby); } } else if (srcDeep.Len == dstDeep.Len) { if (srcTile != dstTile || srcFlip != dstFlip)//冲突 { // if (srcDeep.Len == 0 || dstDeep.Len == 0) { map.putTile(dst_layer, srcTile, dbx, dby); map.putFlip(dst_layer, srcFlip, dbx, dby); } else { FixNode fix = null; //冲突 : 0, 1 //srcDeep : -1, 0 //dstDeep : 0, 1 //冲突 : 1, 0 //srcDeep : 0, -1 //dstDeep : 1, 0 Console.WriteLine("冲突 : " + x + ", " + y); Console.WriteLine("srcDeep : " + srcDeep.DX + ", " + srcDeep.DY); Console.WriteLine("dstDeep : " + dstDeep.DX + ", " + dstDeep.DY); if (x != 0 && y != 0) { fix = getFixNode(srcDeep.DX, srcDeep.DY, dstDeep.DX, dstDeep.DY); } if (fix != null) { map.putTile(dst_layer, fix.Tile, dbx, dby); map.putFlip(dst_layer, fix.Flip, dbx, dby); } /* * if (srcDeep.DX != 0 && srcDeep.DX == -dstDeep.DX && * srcDeep.DY != 0 && srcDeep.DY == -dstDeep.DY) * { * * } */ else { int sdx = x; int sdy = y; if (srcDeep.DX != dstDeep.DX && srcDeep.DY == dstDeep.DY)//水平扩展 { sdx -= Util.getDirect(x - px); } else if (srcDeep.DX == dstDeep.DX && srcDeep.DY != dstDeep.DY)//垂直扩展 { sdy -= Util.getDirect(y - py); } else // 缩回 { sdx += Util.getDirect(px - x); sdy += Util.getDirect(py - y); } if (sdx >= 0 && sdx < MapClip.XCount && sdy >= 0 && sdy < MapClip.YCount) { srcTile = MapClip.getTileID(clip_layer, sdx, sdy); srcFlip = MapClip.getTileFlip(clip_layer, sdx, sdy); map.putTile(dst_layer, srcTile, dbx, dby); map.putFlip(dst_layer, srcFlip, dbx, dby); } } } } } } } } } } }
public MapFormFunc(MapForm map, String script) { InitializeComponent(); CurMap = map; TextScript.Text = script; }
public MapFormFunc(MapForm map) { InitializeComponent(); CurMap = map; }
public void renderSelectRegion(Graphics g, int rx, int ry, int bx, int by, MapForm map) { if (MapClip != null) { bx -= MapClip.XCount / 2; by -= MapClip.XCount / 2; int px = -MapClip.XCount / 2 * MapClip.CellW; int py = -MapClip.XCount / 2 * MapClip.CellH; g.DrawRectangle(Pens.GreenYellow, rx + px, ry + py, MapClip.getWidth(), MapClip.getWidth() ); /* * for (int x = 0; x < MapClip.XCount; x++) * { * for (int y = 0; y < MapClip.XCount; y++) * { * int srcTile = MapClip.getTileID(x, y); * int srcFlip = MapClip.getTileFlip(x, y); * DeepNode srcDeep = getTileDeep(srcTile, srcFlip); * * g.DrawString( * srcDeep.Len.ToString("f2"), * javax.microedition.lcdui.Graphics.font, * Brushes.Red, * rx + px + x * MapClip.CellW, * ry + py + y * MapClip.CellH * ); * * int dbx = bx + x; * int dby = by + y; * * if (dbx >= 0 && dbx < map.XCount && * dby >= 0 && dby < map.YCount) * { * int dstTile = map.getTileID(dbx, dby); * int dstFlip = map.getTileFlip(dbx, dby); * * DeepNode dstDeep = getTileDeep(dstTile, dstFlip); * * if (dstDeep != null) * { * g.DrawString( * dstDeep.Len.ToString("f2"), * javax.microedition.lcdui.Graphics.font, * Brushes.Blue, * rx + px + x * MapClip.CellW, * ry + py + y * MapClip.CellH + 16 * ); * } * * * } * } * } */ //g.DrawImage(MapRegion.Image, x + px, y + py); } }
public void init(MapForm map) { CurMap = map; }