private void btnMoveUp_Click(object sender, EventArgs e) { if (_map != null && lstShapefiles.SelectedItem != null) { EGIS.ShapeFileLib.ShapeFile sf = lstShapefiles.SelectedItem as EGIS.ShapeFileLib.ShapeFile; _map.MoveShapeFileUp(lstShapefiles.SelectedItem as EGIS.ShapeFileLib.ShapeFile); lstShapefiles.SelectedItem = sf; } }
private void OpenRoadsfile(string path) { sfMapGIS.ClearShapeFiles(); sfMapGIS.AddShapeFile(path, "Roads", ""); EGIS.ShapeFileLib.ShapeFile sf = sfMapGIS[0]; sf.RenderSettings.UseToolTip = false; sf.RenderSettings.ToolTipFieldName = sf.RenderSettings.FieldName; sf.RenderSettings.IsSelectable = false; }
private void btnRemove_Click(object sender, EventArgs e) { if (_map != null && lstShapefiles.SelectedItem != null) { if (MessageBox.Show(this, "Remove Layer " + lstShapefiles.SelectedItem.ToString() + "?", "Confirm Layer Removal", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { EGIS.ShapeFileLib.ShapeFile sf = lstShapefiles.SelectedItem as EGIS.ShapeFileLib.ShapeFile; _map.RemoveShapeFile(sf); sf.Close(); } } }
private void OpenMetersfile(string path) { sfMapGIS.AddShapeFile(path, "meters", ""); EGIS.ShapeFileLib.ShapeFile sf = sfMapGIS[1]; _rs = new KSAMetersRenderSettings(sf.RenderSettings, "Serial Num", sf); sf.RenderSettings.CustomRenderSettings = _rs; sf.RenderSettings.UseToolTip = false; sf.RenderSettings.ToolTipFieldName = sf.RenderSettings.FieldName; sf.RenderSettings.IsSelectable = false; sf.SelectRecord(0, true); }
private void map_ShapeFilesChanged(object sender, EventArgs args) { this.lstShapefiles.Items.Clear(); if (Map == null) { return; } EGIS.ShapeFileLib.ShapeFile[] shapefiles = new EGIS.ShapeFileLib.ShapeFile[_map.ShapeFileCount]; for (int n = 0; n < shapefiles.Length; n++) { shapefiles[n] = _map[n]; } this.lstShapefiles.Items.AddRange(shapefiles); if (lstShapefiles.Items.Count > 0) { this.lstShapefiles.SelectedIndex = lstShapefiles.Items.Count - 1; } }
public static void ReadCoastlineShapefile(string shapePath) { string fileBaseName = config["OutputDataFolder"] + "coastlines"; EGIS.ShapeFileLib.ShapeFile sf = new EGIS.ShapeFileLib.ShapeFile(shapePath); var recordCount = sf.RecordCount; StringBuilder geometryBuilds = new StringBuilder(); StringBuilder tagBuilds = new StringBuilder(); for (int i = 0; i < recordCount; i++) { var shapeData = sf.GetShapeDataD(i); var poly = Converters.ShapefileRecordToPolygon(shapeData); geometryBuilds.Append(100000000000 + i).Append("\t").Append("2").Append("\t").Append(poly.AsText()).Append("\t").Append(poly.Area).Append("\t").Append(Guid.NewGuid()).Append("\r\n"); tagBuilds.Append(100000000000 + i).Append("\t").Append("2").Append("\t").Append("natural").Append("\t").Append("coastline").Append("\r\n"); } File.WriteAllText(fileBaseName + ".geomData", geometryBuilds.ToString()); File.WriteAllText(fileBaseName + ".tagData", tagBuilds.ToString()); }
private void OpenShapefile(string path) { // clear any shapefiles the map is currently displaying this.sfMap1.ClearShapeFiles(); // open the shapefile passing in the path, display name of the shapefile and // the field name to be used when rendering the shapes (we use an empty string // as the field name (3rd parameter) can not be null) this.sfMap1.AddShapeFile(path, "ShapeFile", ""); // read the shapefile dbf field names and set the shapefiles's RenderSettings // to use the first field to label the shapes. EGIS.ShapeFileLib.ShapeFile sf = this.sfMap1[0]; sf.RenderSettings.FieldName = sf.RenderSettings.DbfReader.GetFieldNames()[4]; sf.RenderSettings.UseToolTip = true; sf.RenderSettings.ToolTipFieldName = sf.RenderSettings.FieldName; sf.RenderSettings.IsSelectable = true; //select the first record sf.SelectRecord(0, true); }
private void map_ShapeFilesChanged(object sender, EventArgs args) { this.lstShapefiles.Items.Clear(); if(Map == null) return; EGIS.ShapeFileLib.ShapeFile[] shapefiles = new EGIS.ShapeFileLib.ShapeFile[_map.ShapeFileCount]; for (int n = 0; n < shapefiles.Length; n++) { shapefiles[n] = _map[n]; } this.lstShapefiles.Items.AddRange(shapefiles); if (lstShapefiles.Items.Count > 0) { this.lstShapefiles.SelectedIndex = lstShapefiles.Items.Count-1; } }
public _cl_map_hydro(string ShpPath, string DbfPath, Encoding code) { sf = new EGIS.ShapeFileLib.ShapeFile(ShpPath); dbr = new EGIS.ShapeFileLib.DbfReader(DbfPath); endcode = code; }