private void toolStripButton1_Click(object sender, EventArgs e) { GeoText text = new GeoText(); // 设置文本子对象的属性 TextPart textPart = new TextPart(); textPart.AnchorPoint = new Point2D(250, 500); textPart.Rotation = 30; textPart.Text = "城市地籍图"; textPart.X = 250; textPart.Y = 500; textPart.Offset(10.0, 20.0); // 设置文本风格 TextStyle textStyle = new TextStyle(); textStyle.Shadow = true; textStyle.Alignment = TextAlignment.TopCenter; textStyle.FontName = "宋体"; textStyle.FontHeight = 10.0; textStyle.FontWidth = 10.0; textStyle.Weight = 500; textStyle.BackColor = System.Drawing.Color.White; textStyle.ForeColor = System.Drawing.Color.Black; Geometry geometry = new GeoText(textPart, textStyle); LayoutElements elements = mapLayoutControl1.MapLayout.Elements; elements.AddNew(geometry); }
private void InitializeLayout() { try { LayoutElements elements = mapLayoutControl1.MapLayout.Elements; // 构造GeoMap // Create the GeoMap object. GeoMap geoMap = new GeoMap(); geoMap.MapName = "地籍图"; // 设置GeoMap对象的外切矩形 // Set the exterior rectangle. Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D( 1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapID = elements.GetID(); // 构造指北针 // Initialize the GeoNorthArrow GeoNorthArrow northArrow = new GeoNorthArrow( NorthArrowStyleType.EightDirection, new Rectangle2D(new Point2D(1400, 2250), new Size2D(350, 350)), 0); northArrow.BindingGeoMapID = m_mapID; elements.AddNew(northArrow); // 构造比例尺 // Initialize the scale GeoMapScale scale = new GeoMapScale(m_mapID, new Point2D(125, 400), 50, 50); scale.LeftDivisionCount = 2; scale.ScaleUnit = Unit.Kilometer; scale.SegmentCount = 4; elements.AddNew(scale); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public gk065() { InitializeComponent(); workspace1 = new SuperMap.Data.Workspace(); /* WorkspaceConnectionInfo workspaceConnectionInfo = new WorkspaceConnectionInfo(); * workspaceConnectionInfo.Type = WorkspaceType.Oracle; * workspaceConnectionInfo.Server = "ORCL"; * workspaceConnectionInfo.Database = ""; * workspaceConnectionInfo.Name = "workspace"; * workspaceConnectionInfo.User = "******"; * workspaceConnectionInfo.Password = "******"; * workspace1.Open(workspaceConnectionInfo);*/ workspace1.Open(gkfqd.Common.Tool.GetConnectionInfo()); mapLayoutControl1.MapLayout.Workspace = workspace1; mapLayoutControl1.IsHorizontalScrollbarVisible = true; mapLayoutControl1.IsVerticalScrollbarVisible = true; try { LayoutElements elements = mapLayoutControl1.MapLayout.Elements; //构造GeoMap GeoMap geoMap = new GeoMap(); geoMap.MapName = "temp"; //设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D( 1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapID = elements.GetID(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } mapLayoutControl1.TrackMode = TrackMode.Edit; mapLayoutControl1.MapLayout.Zoom(4); }
private void AddMap(string mapName) { try { LayoutElements elements = mapLayoutControl1.MapLayout.Elements; //构造GeoMap GeoMap geoMapUse = new GeoMap(); geoMapUse.MapName = mapName; // geoMapUse. = m_mapControl.Map; //设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D( 1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMapUse.Shape = geoRect; elements.AddNew(geoMapUse); m_mapID = elements.GetID(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
public void InitializeLayout(string mapName) { try { LayoutElements elements = m_mapLayoutControl.MapLayout.Elements; // 构造GeoMap GeoMap geoMap = new GeoMap(); //设置地图名称,在工作空间内的地图 geoMap.MapName = mapName; // 设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(1000, 1300), new Size2D(1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapID = elements.GetID(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
private void AddData() { try { WorkspaceTreeNodeBase node = workspaceControl1.WorkspaceTree.SelectedNode as WorkspaceTreeNodeBase; WorkspaceTreeNodeDataType type = node.NodeType; if ((type & WorkspaceTreeNodeDataType.Dataset) != WorkspaceTreeNodeDataType.Unknown) { type = WorkspaceTreeNodeDataType.Dataset; } switch (type) { case WorkspaceTreeNodeDataType.Dataset: { Dataset dataset = node.GetData() as Dataset; layersControl1.Map.Layers.Add(dataset, true); layersControl1.Map.Refresh(); m_mapControlEagleEye.Map.Layers.Add(dataset, true); m_mapControlEagleEye.Map.Refresh(); } break; case WorkspaceTreeNodeDataType.MapName: { mapName = node.GetData() as String; mapControl1.Map.Open(mapName); geoMap.MapName = mapName; rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(1500, 1500)); geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapControlEagleEye.Map.Open(mapName); mapControl1.Map.Refresh(); m_mapControlEagleEye.Map.Refresh(); m_mapControlEagleEye.Map.ViewEntire(); } break; case WorkspaceTreeNodeDataType.SymbolMarker: { SymbolLibraryDialog.ShowDialog(workspace1.Resources, SymbolType.Marker); } break; case WorkspaceTreeNodeDataType.SymbolLine: { SymbolLibraryDialog.ShowDialog(workspace1.Resources, SymbolType.Line); } break; case WorkspaceTreeNodeDataType.SymbolFill: { SymbolLibraryDialog.ShowDialog(workspace1.Resources, SymbolType.Fill); } break; default: break; } } catch { } }