public UndoMapTileExchange(MapEditor Editor, MapProject Project, int TileIndex1, int TileIndex2) { _MapEditor = Editor; _MapProject = Project; _TileIndex1 = TileIndex1; _TileIndex2 = TileIndex2; }
public UndoMapSwap(MapEditor Editor, MapProject Project, int MapIndex1, int MapIndex2) { _MapEditor = Editor; _MapProject = Project; _MapIndex1 = MapIndex1; _MapIndex2 = MapIndex2; }
public UndoMapRemove(MapEditor Editor, MapProject Project, int MapIndex) { _MapEditor = Editor; _MapIndex = MapIndex; _MapProject = Project; _RemovedMap = _MapProject.Maps[_MapIndex]; }
public UndoMapTileRemove(MapEditor Editor, MapProject Project, int TileIndex) { _MapEditor = Editor; _TileIndex = TileIndex; _MapProject = Project; _RemovedTile = _MapProject.Tiles[TileIndex]; }
/// <summary> // Returns a StandardValuesCollection of standard value objects. /// </summary> /// <param name="context"></param> /// <returns>List of Schema objects</returns> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { // Get the list of Schema objects List <MapItem> mapItem = MapProject.GetMapsList(context); // Passes the local array. return(new StandardValuesCollection(mapItem)); }
public ProjectDTO Update(ProjectDTO objet) { Project entity = MapProject.ToEntity(objet, false); Project resultat = _repo.Update(entity); ProjectDTO retour = MapProjectDTO.ToDto(resultat); return(retour); }
public ProjectDTO Create(ProjectDTO objet) { Project entite = MapProject.ToEntity(objet, true); Project resultat = _repo.Create(entite); objet = MapProjectDTO.ToDto(resultat); return(objet); }
protected override List <ShapeFile> CreateMapLayers(HttpContext context) { string mapid = context.Request["mapid"]; if (string.IsNullOrEmpty(mapid)) { throw new InvalidOperationException("mapid parameters not set"); } MapProject project = SFMap.ReadEGPProject(context.Server.MapPath(mapid)); return(project.Layers); }
protected override List <ShapeFile> CreateMapLayers(HttpContext context) { MapProject project = SFMap.ReadEGPProject(context.Server.MapPath(EGPName)); List <ShapeFile> layers = project.Layers; //string shapeFilePath = context.Server.MapPath("/demos/us_demo_files/counties.shp"); //ShapeFile sf = new ShapeFile(shapeFilePath); ////set the field name used to label the shapes //sf.RenderSettings.FieldName = "NAME"; //sf.RenderSettings.FillColor = Color.Red; //sf.RenderSettings.FontColor = Color.Blue; //sf.RenderSettings.Font = new Font("Arial", 16); ////sf.RenderSettings.CustomRenderSettings = CreatePopulationRenderSettings(sf); //layers.Add(sf); return(layers); }
public FeatureInformations GetIdentifyFeatureInfos(MapObjects2.Point mousePosition, AxMapObjects2.AxMap mapControl,MapProject.MapStruct mapInfosCollection) { FeatureInformations oFeatureInfos = null; foreach (ILayerStruct oLayerInfos in mapInfosCollection.Layers) { if (oLayerInfos.LayerType != (short)LayerTypeConstants.moMapLayer) continue; MapUtil.MapOperation oMapOper = new MapOperation(); MapObjects2.MapLayer oMapLayer = oMapOper.GetLayerByName(mapControl, oLayerInfos.AliasName) as MapObjects2.MapLayer; if (oMapLayer.Visible == false) continue; Recordset oSelectedRecords = oMapLayer.SearchShape(mousePosition, SearchMethodConstants.moAreaIntersect, ""); if (oSelectedRecords.EOF) continue; oSelectedRecords.MoveFirst(); oFeatureInfos = new FeatureInformations(); oFeatureInfos.CurrentLayerInfos = oLayerInfos; oFeatureInfos.Geometry = oSelectedRecords.Fields.Item("shape").Value; TableDesc oTableDesc = oSelectedRecords.TableDesc; oFeatureInfos.FieldsAndValuesCollection = new Dictionary<string, string>(); int iFieldsCount = oTableDesc.FieldCount; string sFieldName = ""; string sValue = ""; for (short i = 0; i < iFieldsCount; i++) { sFieldName = oTableDesc.get_FieldName(i); sValue = oSelectedRecords.Fields.Item(sFieldName).ValueAsString; oFeatureInfos.FieldsAndValuesCollection.Add(sFieldName, sValue); } break; } return oFeatureInfos; }
private void Open_MouseDown(object sender, RoutedEventArgs e) { OpenFileDialog opendlg = new OpenFileDialog(); opendlg.Filter = "smartgisproject(*.pro)|*.pro"; if (opendlg.ShowDialog(this) == true) { mappro = MapProject.LoadMapProject(opendlg.FileName); if (mappro == null) { //MessageBox.Show("打开地图失败!"); return; } mappro.projectpath = opendlg.FileName; List <string> datapathlist = mappro.dic_datapath.Values.ToList(); mapControl.mapcontent = mapcontent.LoadMapContent(mappro.projectname, mappro.dic_datapath, mappro.dic_stylepath, mappro.server, mappro.port, mappro.username, mappro.password, mappro.database); this.gdb = mapControl.mapcontent.gdb; ShowTreeView(mapControl.mapcontent); mapControl.SetDefaultoffsetandDisplayScale(mapControl.mapcontent); mapControl.mapcontrol_refresh(); } //OpenFileDialog dialog = new OpenFileDialog(); //dialog.Filter = "Map File (.txt)|*.txt"; //if (dialog.ShowDialog() == true) //{ // string path = dialog.FileName; // mapControl.Map.OpenMap(path); // List<Layer> layers = mapControl.Map.GetLayers(); // for (int i = 0; i < mapControl.Map.LayerCount; i++) // { // layers[i].Name = "test"; // treeView.Items.Add(new LayerModel(layers[i].Name)); // //items.Add(layers[i].Name); // } // mapControl.Refresh(); // this.Title = "Mercury GIS - " + System.IO.Path.GetFileNameWithoutExtension(path); // curLayer = layers[0]; //} }
public UndoMapTileModified(MapEditor Editor, MapProject Project, int TileIndex) { this.TileIndex = TileIndex; this.Project = Project; MapEditor = Editor; var Tile = Project.Tiles[TileIndex]; this.Tile = new MapProject.Tile(); this.Tile.Chars = new GR.Game.Layer <MapProject.TileChar>(); this.Tile.Chars.Resize(Tile.Chars.Width, Tile.Chars.Height); for (int i = 0; i < Tile.Chars.Width; ++i) { for (int j = 0; j < Tile.Chars.Height; ++j) { this.Tile.Chars[i, j] = new MapProject.TileChar(); this.Tile.Chars[i, j].Character = Tile.Chars[i, j].Character; this.Tile.Chars[i, j].Color = Tile.Chars[i, j].Color; } } this.Tile.Name = Tile.Name; }
private void New_MouseDown(Object sender, RoutedEventArgs e) { NewMap dialog = new NewMap(); if (dialog.ShowDialog() == true) { string name = dialog.mapName; //创建工程对象 mappro = MapProject.CreateMapProject(name); mappro.server = dialog.server; mappro.port = dialog.port; mappro.username = dialog.username; mappro.password = dialog.password; mappro.database = dialog.database; //创建mapcontent对象 mapcontent mapcontent = mapcontent.createnewmapcontentofnolayer(name, dialog.server, dialog.port, dialog.username, dialog.password, dialog.database); gdb = mapcontent.gdb; mapControl.mapcontent = mapcontent; mapControl.mapcontrol_refresh(); this.Title = "Mercury GIS - " + name; //刷新图层树 //ShowTreeView(mapcontent); } }
protected override List <ShapeFile> CreateMapLayers(HttpContext context) { MapProject project = SFMap.ReadEGPProject(context.Server.MapPath(EGPName)); return(project.Layers); }
public UndoMapTileAdd(MapEditor Editor, MapProject Project, int TileIndex) { _MapEditor = Editor; _MapProject = Project; _TileIndex = TileIndex; }
public UndoMapAdd(MapEditor Editor, MapProject Project, int MapIndex) { _MapEditor = Editor; _MapProject = Project; _MapIndex = MapIndex; }
public override bool HandleImport(CharsetScreenProject CharScreen, CharsetScreenEditor Editor) { string filename; if (Editor.OpenFile("Open Charpad project, Marq's PETSCII editor files or binary data", Constants.FILEFILTER_CHARSET_CHARPAD + Constants.FILEFILTER_MARQS_PETSCII + Constants.FILEFILTER_ALL, out filename)) { if (System.IO.Path.GetExtension(filename).ToUpper() == ".CTM") { // a charpad project file GR.Memory.ByteBuffer projectFile = GR.IO.File.ReadAllBytes(filename); Formats.CharpadProject cpProject = new RetroDevStudio.Formats.CharpadProject(); if (!cpProject.LoadFromFile(projectFile)) { return(false); } CharScreen.CharSet.Colors.BackgroundColor = cpProject.BackgroundColor; CharScreen.CharSet.Colors.MultiColor1 = cpProject.MultiColor1; CharScreen.CharSet.Colors.MultiColor2 = cpProject.MultiColor2; CharScreen.CharSet.Colors.BGColor4 = cpProject.BackgroundColor4; int maxChars = cpProject.NumChars; if (maxChars > CharScreen.CharSet.TotalNumberOfCharacters) { maxChars = CharScreen.CharSet.TotalNumberOfCharacters; } CharScreen.CharSet.ExportNumCharacters = maxChars; for (int charIndex = 0; charIndex < CharScreen.CharSet.ExportNumCharacters; ++charIndex) { CharScreen.CharSet.Characters[charIndex].Tile.Data = cpProject.Characters[charIndex].Data; CharScreen.CharSet.Characters[charIndex].Tile.CustomColor = cpProject.Characters[charIndex].Color; Editor.RebuildCharImage(charIndex); } // import tiles var mapProject = new MapProject(); mapProject.MultiColor1 = cpProject.MultiColor1; mapProject.MultiColor2 = cpProject.MultiColor2; for (int i = 0; i < cpProject.NumTiles; ++i) { Formats.MapProject.Tile tile = new Formats.MapProject.Tile(); tile.Name = "Tile " + (i + 1).ToString(); tile.Chars.Resize(cpProject.TileWidth, cpProject.TileHeight); tile.Index = i; for (int y = 0; y < tile.Chars.Height; ++y) { for (int x = 0; x < tile.Chars.Width; ++x) { tile.Chars[x, y].Character = (byte)cpProject.Tiles[i].CharData.UInt16At(2 * (x + y * tile.Chars.Width)); tile.Chars[x, y].Color = cpProject.Tiles[i].ColorData.ByteAt(x + y * tile.Chars.Width); } } mapProject.Tiles.Add(tile); } var map = new Formats.MapProject.Map(); map.Tiles.Resize(cpProject.MapWidth, cpProject.MapHeight); for (int j = 0; j < cpProject.MapHeight; ++j) { for (int i = 0; i < cpProject.MapWidth; ++i) { map.Tiles[i, j] = cpProject.MapData.ByteAt(i + j * cpProject.MapWidth); } } map.TileSpacingX = cpProject.TileWidth; map.TileSpacingY = cpProject.TileHeight; mapProject.Maps.Add(map); Editor.comboBackground.SelectedIndex = mapProject.Charset.Colors.BackgroundColor; Editor.comboMulticolor1.SelectedIndex = mapProject.Charset.Colors.MultiColor1; Editor.comboMulticolor2.SelectedIndex = mapProject.Charset.Colors.MultiColor2; Editor.comboBGColor4.SelectedIndex = mapProject.Charset.Colors.BGColor4; Editor.comboCharsetMode.SelectedIndex = (int)cpProject.DisplayModeFile; GR.Memory.ByteBuffer charData = new GR.Memory.ByteBuffer((uint)(map.Tiles.Width * map.TileSpacingX * map.Tiles.Height * map.TileSpacingY)); GR.Memory.ByteBuffer colorData = new GR.Memory.ByteBuffer((uint)(map.Tiles.Width * map.TileSpacingX * map.Tiles.Height * map.TileSpacingY)); for (int y = 0; y < map.Tiles.Height; ++y) { for (int x = 0; x < map.Tiles.Width; ++x) { int tileIndex = map.Tiles[x, y]; if (tileIndex < mapProject.Tiles.Count) { // a real tile var tile = mapProject.Tiles[tileIndex]; for (int j = 0; j < tile.Chars.Height; ++j) { for (int i = 0; i < tile.Chars.Width; ++i) { charData.SetU8At(x * map.TileSpacingX + i + (y * map.TileSpacingY + j) * (map.Tiles.Width * map.TileSpacingX), tile.Chars[i, j].Character); colorData.SetU8At(x * map.TileSpacingX + i + (y * map.TileSpacingY + j) * (map.Tiles.Width * map.TileSpacingX), tile.Chars[i, j].Color); } } } } } if (cpProject.MapColorData != null) { // this charpad project has alternative color data for (int i = 0; i < cpProject.MapHeight; ++i) { for (int j = 0; j < cpProject.MapWidth; ++j) { colorData.SetU8At(j + i * cpProject.MapWidth, cpProject.MapColorData.ByteAt(j + i * cpProject.MapWidth)); } } } Editor.ImportFromData(map.TileSpacingX * map.Tiles.Width, map.TileSpacingY * map.Tiles.Height, charData, colorData, CharScreen.CharSet); } else if (System.IO.Path.GetExtension(filename).ToUpper() == ".C") { string cData = GR.IO.File.ReadAllText(filename); if (!string.IsNullOrEmpty(cData)) { int dataStart = cData.IndexOf('{'); if (dataStart == -1) { return(false); } /* * int dataEnd = cData.IndexOf( '}', dataStart ); * if ( dataEnd == -1 ) * { * return false; * } * string actualData = cData.Substring( dataStart + 1, dataEnd - dataStart - 2 ); */ string actualData = cData.Substring(dataStart + 1); var screenData = new ByteBuffer(); var dataLines = actualData.Split('\n'); string dataType = ""; for (int i = 0; i < dataLines.Length; ++i) { var dataLine = dataLines[i].Trim(); if (dataLine.StartsWith("//")) { if (dataLine.Contains("META:")) { int metaPos = dataLine.IndexOf("META:"); // META: 16 25 DIRART upper string[] parms = dataLine.Substring(metaPos + 5).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (parms.Length >= 2) { int newWidth = GR.Convert.ToI32(parms[0]); int newHeight = GR.Convert.ToI32(parms[1]); if ((newWidth > 0) && (newHeight > 0)) { Editor.SetScreenSize(newWidth, newHeight); } } if (parms.Length >= 3) { dataType = parms[2].ToUpper(); } } continue; } int pos = 0; int commaPos = -1; while (pos < dataLine.Length) { commaPos = dataLine.IndexOf(',', pos); if (commaPos == -1) { // end of line byte byteValue = GR.Convert.ToU8(dataLine.Substring(pos)); screenData.AppendU8(byteValue); break; } else { byte byteValue = GR.Convert.ToU8(dataLine.Substring(pos, commaPos - pos)); screenData.AppendU8(byteValue); pos = commaPos + 1; } } } // border and BG first if (dataType != "DIRART") { CharScreen.CharSet.Colors.BackgroundColor = screenData.ByteAt(1); screenData = screenData.SubBuffer(2); } Editor.ImportFromData(screenData); } } else { GR.Memory.ByteBuffer data = GR.IO.File.ReadAllBytes(filename); Editor.ImportFromData(data); } } return(true); }