public void ZoomOutMap(Rectangle mapExtent, ref AxMapObjects2.AxMap mapControl) { Rectangle oRectangle = mapControl.Extent; oRectangle.ScaleRectangle(mapControl.Extent.Height / mapExtent.Extent.Height); mapControl.Extent = oRectangle; }
/// <summary> /// 加载图层集合 /// </summary> /// <param name="layerPaths">图层路径集合</param> /// <param name="map">地图对象</param> public List <LayerInformations> LoadLayers(List <string> layerPaths, ref AxMapObjects2.AxMap mapControl) { BaseHandler.MapManager oMapManager = new GPSTrackingMonitor.BaseHandler.MapManager(); List <LayerInformations> oLayerfosCollection = new List <LayerInformations>(); foreach (string sLayerPath in layerPaths) { string sFileExtent = System.IO.Path.GetExtension(sLayerPath); LayerTypeConstants oLayerType = oMapManager.GetLayerTypeByFileExtent(sFileExtent); if (oLayerType == LayerTypeConstants.moMapLayer) { MapLayer oMapLayer = oMapManager.GetSingleVectorLayer(sLayerPath); mapControl.Layers.Add(oMapLayer); oLayerfosCollection.Add(new LayerInformations(oMapLayer, oMapLayer.GeoDataset.Name, oLayerType, oMapLayer.shapeType)); } else if (oLayerType == LayerTypeConstants.moImageLayer) { ImageLayer oImageLayer = oMapManager.GetSingleImageLayer(sLayerPath); mapControl.Layers.Add(oImageLayer); oLayerfosCollection.Add(new LayerInformations(oImageLayer, oImageLayer.Name, oLayerType, (ShapeTypeConstants)(-1))); } } return(oLayerfosCollection); }
/// <summary> /// /// </summary> /// <param name="map"></param> /// <returns></returns> public double CalcScale(AxMapObjects2.AxMap map) { System.Drawing.Graphics g = System.Drawing.Graphics.FromHwnd((System.IntPtr)map.hWnd); MPoint[] pts = new MPoint[2]; pts[0] = new MPoint(); pts[0].x = map.Extent.Left; pts[0].y = map.Extent.Bottom; pts[1] = new MPoint(); pts[1].x = map.Extent.Right; pts[1].y = map.Extent.Top; double Len1 = pts[1].x - pts[0].x; double Len2 = pts[1].y - pts[0].y; return(Len1 * Len2); #region ... // System.Drawing.Graphics g = System.Drawing.Graphics.FromHwnd((System.IntPtr)map.hWnd); // // MPoint[] pts = new MPoint[2]; // pts[0] = new MPoint(); // pts[0].x = map.Extent.Left; // pts[0].y = map.Extent.Top; // pts[1] = new MPoint(); // pts[1].x = map.Extent.Right; // pts[1].y = map.Extent.Top; // // double dLen1 = this.CalcLenght(pts,2); // // double dLen2 = map.Width / g.DpiX * 2.54 /100; // // return dLen1 / dLen2; #endregion //... }
public frmLayerProperties(AxMapObjects2.AxMap mapControl, object layer) { InitializeComponent(); this._mapControl = mapControl; if (layer == null) throw new Exception("layer is null,please set a valid layer."); if (layer is MapObjects2.ImageLayer) this._imageLayer = layer as MapObjects2.ImageLayer; else if (layer is MapObjects2.MapLayer) this._mapLayer = layer as MapObjects2.MapLayer; if (this._mapLayer != null) { int iColumnsCount = this._mapLayer.Records.TableDesc.FieldCount; string sFieldName = string.Empty; this._fieldsList.Clear(); this._numFieldsList.Clear(); for (short i = 0; i < iColumnsCount; i++) { sFieldName = this._mapLayer.Records.TableDesc.get_FieldName(i); MapObjects2.Field oField = this._mapLayer.Records.Fields.Item(sFieldName); this._fieldsList.Add(oField.Name); if (oField.Type == MapObjects2.FieldTypeConstants.moDouble || oField.Type == MapObjects2.FieldTypeConstants.moLong) this._numFieldsList.Add(oField.Name); } } }
public void LoadLayersToNavigation(AxMapObjects2.AxMap mapControl) { if (mapControl == null || mapControl.Layers.Count == 0) { return; } object oLayer = null; object oBackLayer = null; short iLayersCount = mapControl.Layers.Count; for (short i = 0; i < iLayersCount; i++) { oLayer = mapControl.Layers.Item(i); if (oLayer is MapObjects2.MapLayer && (oLayer as MapObjects2.MapLayer).shapeType == MapObjects2.ShapeTypeConstants.moShapeTypePolygon) { oBackLayer = oLayer; } } if (oBackLayer == null && iLayersCount > 0) { oBackLayer = mapControl.Layers.Item(iLayersCount - 1); } this.mapControl.Layers.Clear(); this.mapControl.Layers.Add(oBackLayer); this.mapControl.Refresh(); }
public void LoadLayersToLegend(AxMapObjects2.AxMap mapObject) { if (mapObject == null) return; this._mapObject = mapObject; int iLayersCount = 0; iLayersCount = mapObject.Layers.Count; pnlLegend.Controls.Clear(); int iCtrlsCounter = 0; for (int i = 0; i < iLayersCount; i++) { CheckBox oCkbLayer = new CheckBox(); object oLayer = mapObject.Layers.Item(i); if(oLayer is MapObjects2.MapLayer) { MapObjects2.MapLayer oMapLayer = oLayer as MapObjects2.MapLayer; oCkbLayer.Text = oMapLayer.Name; oCkbLayer.Checked = oMapLayer.Visible; if(oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypePoint || oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypeMultipoint) oCkbLayer.Image = Properties.Resources.pointShape; else if(oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypeEllipse || oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypeLine || oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypeRectangle) oCkbLayer.Image = Properties.Resources.lineShape; else if (oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypePolygon) oCkbLayer.Image = Properties.Resources.polygonShape; } else if (oLayer is MapObjects2.ImageLayer) { MapObjects2.ImageLayer oImageLayer = oLayer as MapObjects2.ImageLayer; oCkbLayer.Image = Properties.Resources.image; oCkbLayer.Text = oImageLayer.Name; oCkbLayer.Checked = oImageLayer.Visible; } oCkbLayer.Visible = true; oCkbLayer.AutoSize = true; oCkbLayer.FlatStyle = FlatStyle.Flat; oCkbLayer.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left); oCkbLayer.ImageAlign = ContentAlignment.MiddleLeft; oCkbLayer.TextAlign = ContentAlignment.MiddleRight; oCkbLayer.TextImageRelation = TextImageRelation.ImageBeforeText; oCkbLayer.ContextMenuStrip = mnuLayerProperty; oCkbLayer.CheckedChanged += new EventHandler(CkbLayer_CheckedChanged); oCkbLayer.MouseDown += new MouseEventHandler(oCkbLayer_MouseDown); this.pnlLegend.Controls.Add(oCkbLayer); oCkbLayer.Location = new System.Drawing.Point(30, iCtrlsCounter * (oCkbLayer.Height + 12) + 20); iCtrlsCounter++; } this.pnlLegend.Refresh(); }
public ReplayOperation(AxMapObjects2.AxMap mapControl) { this._mapControl = mapControl; this._trackingLayer = mapControl.TrackingLayer; this.AddEventSymbols(); this._trackingPointSymbolIndex = this._trackingLayer.SymbolCount - 1; this._trackingLineSymbolIndex = this._trackingLayer.SymbolCount - 2; }
public frmLegend() { InitializeComponent(); this._mapObject = GlobeVariables.MapControl; object oMapControl = GlobeVariables.MapControl as object; this.mapLegend.setMapSource(ref oMapControl); GlobeVariables.MapLegend = this.mapLegend; }
public void ZoomAndCenterMap(double scaleFactor, Point centerPoint, ref AxMapObjects2.AxMap mapControl) { Rectangle oExtent = new RectangleClass(); oExtent.Left = mapControl.FullExtent.Left; oExtent.Right = mapControl.FullExtent.Right; oExtent.Top = mapControl.FullExtent.Top; oExtent.Bottom = mapControl.FullExtent.Bottom; oExtent.ScaleRectangle(scaleFactor); oExtent.Offset(centerPoint.X - oExtent.Center.X, centerPoint.Y - oExtent.Center.Y); mapControl.Extent = oExtent; }
public MapStruct LoadProjectByMapInfos(string projectFileName, AxMapObjects2.AxMap mapControl) { ProjectSerialization oProjectSerialization = new ProjectSerialization(); MapStruct oMapStruct = oProjectSerialization.DeserializeProject(projectFileName); List <ILayerStruct> oLayers = oMapStruct.Layers; MapObjects2.DataConnection oConn = new MapObjects2.DataConnectionClass(); foreach (ILayerStruct oLayer in oLayers) { if (oLayer is MapLayerInfoStruct) { MapObjects2.MapLayer oMapLayer = new MapObjects2.MapLayerClass(); oConn.Database = System.IO.Path.GetDirectoryName(oLayer.FileName); if (oConn.Connect()) { oMapLayer.GeoDataset = oConn.FindGeoDataset(oLayer.DataSetName); this.SetLayerRender(oMapLayer, (oLayer as MapLayerInfoStruct).Render); this.ConvertSymbol((oLayer as MapLayerInfoStruct).Symbol, oMapLayer.Symbol); oMapLayer.Name = oLayer.AliasName; oMapLayer.Visible = oLayer.Visible; oMapLayer.Tag = string.Format("{0}-{1}", oLayer.MinLevel, oLayer.MaxLevel); mapControl.Layers.Add(oMapLayer); oConn.Disconnect(); } } else if (oLayer is ImageLayerInfoStruct) { //not implement //MapObjects2.ImageLayer oImageLayer = new MapObjects2.ImageLayerClass(); //oImageLayer.Name = oLayer.Name; } } MapObjects2.Rectangle oViewExtent = new MapObjects2.RectangleClass(); oViewExtent.Left = oMapStruct.BBox.MinX; oViewExtent.Top = oMapStruct.BBox.MinY; oViewExtent.Right = oMapStruct.BBox.MaxX; oViewExtent.Bottom = oMapStruct.BBox.MaxY; mapControl.Extent = oViewExtent; //mapControl.CoordinateSystem = oMapStruct.CoordinateSystem; return(oMapStruct); }
public void SaveMapInfosToProject(AxMapObjects2.AxMap mapControl, string saveFileName, MapStruct currentMapInfos) { MapStruct oMapStruct = new MapStruct(); oMapStruct.BBox.MinX = mapControl.Extent.Left; oMapStruct.BBox.MinY = mapControl.Extent.Top; oMapStruct.BBox.MaxX = mapControl.Extent.Right; oMapStruct.BBox.MaxY = mapControl.Extent.Bottom; oMapStruct.BBox.Width = mapControl.Extent.Width; oMapStruct.BBox.Height = mapControl.Extent.Height; // oMapStruct.CoordinateSystem = mapControl.CoordinateSystem; short iLayersCount = mapControl.Layers.Count; for (short i = (short)(iLayersCount - 1); i >= 0; i--) { object oLayer = mapControl.Layers.Item(i); if (oLayer is MapObjects2.MapLayer) { MapObjects2.MapLayer oMapLayer = oLayer as MapObjects2.MapLayer; MapLayerInfoStruct oMapLayerStruct = new MapLayerInfoStruct(); oMapLayerStruct.FileName = currentMapInfos.FindLayer(oMapLayer.Name).FileName; oMapLayerStruct.LayerType = (short)oMapLayer.LayerType; oMapLayerStruct.AliasName = oMapLayer.Name; oMapLayerStruct.DataSetName = System.IO.Path.GetFileNameWithoutExtension(oMapLayerStruct.FileName); oMapLayerStruct.ShapeType = (short)oMapLayer.shapeType; oMapLayerStruct.Visible = oMapLayer.Visible; oMapLayerStruct.MinLevel = int.Parse(oMapLayer.Tag.Split('-')[0]); oMapLayerStruct.MaxLevel = int.Parse(oMapLayer.Tag.Split('-')[1]); oMapLayerStruct.Render = this.ExportLayerRender(oMapLayer); this.DeconvertSymbol(oMapLayer.Symbol, oMapLayerStruct.Symbol); oMapStruct.Layers.Add(oMapLayerStruct as ILayerStruct); } else if (oLayer is MapObjects2.ImageLayer) { throw new NotImplementedException(); } } this.SerializeProject(oMapStruct, saveFileName); }
public object GetLayerByName(AxMapObjects2.AxMap mapControl, string layerName) { short iLayersCount = mapControl.Layers.Count; for (short i = 0; i < iLayersCount; i++) { object oLayer = mapControl.Layers.Item(i); if (oLayer is MapObjects2.MapLayer && (oLayer as MapObjects2.MapLayer).Name.Equals(layerName)) { return(oLayer); } else if (oLayer is MapObjects2.ImageLayer && (oLayer as MapObjects2.ImageLayer).Name.Equals(layerName)) { return(oLayer); } } return(null); }
public bool DeleteLayer(object layer, AxMapObjects2.AxMap mapControl) { if (layer == null || mapControl == null) { return(false); } short iLayersCount = mapControl.Layers.Count; for (short i = 0; i < iLayersCount; i++) { if (layer.Equals(mapControl.Layers.Item(i))) { mapControl.Layers.Remove(i); return(true); } } return(false); }
public void LoadProjectByMapInfos(MapStruct mapInfos, AxMapObjects2.AxMap mapControl) { List <ILayerStruct> oLayers = mapInfos.Layers; MapObjects2.DataConnection oConn = new MapObjects2.DataConnectionClass(); oConn.Database = mapInfos.GeoDataSetPath; oConn.Connect(); foreach (ILayerStruct oLayer in oLayers) { if (oLayer is MapLayerInfoStruct && oConn.Connected) { MapObjects2.MapLayer oMapLayer = new MapObjects2.MapLayerClass(); oMapLayer.GeoDataset = oConn.FindGeoDataset(oLayer.Name); this.SetLayerRender(oMapLayer, (oLayer as MapLayerInfoStruct).Render); this.ConvertSymbol((oLayer as MapLayerInfoStruct).Symbol, oMapLayer.Symbol); mapControl.Layers.Add(oMapLayer); } else if (oLayer is ImageLayerInfoStruct) { //not implement //MapObjects2.ImageLayer oImageLayer = new MapObjects2.ImageLayerClass(); //oImageLayer.Name = oLayer.Name; } } if (oConn.Connected) { oConn.Disconnect(); } mapControl.Extent.Top = mapInfos.BBox.MinX; mapControl.Extent.Left = mapInfos.BBox.MinY; mapControl.Extent.Bottom = mapInfos.BBox.MaxX; mapControl.Extent.Right = mapInfos.BBox.MaxY; mapControl.CoordinateSystem = mapInfos.CoordinateSystem; }
public frmLayerProperties(AxMapObjects2.AxMap mapControl, object layer) { InitializeComponent(); this._mapControl = mapControl; if (layer == null) { throw new Exception("layer is null,please set a valid layer."); } if (layer is MapObjects2.ImageLayer) { this._imageLayer = layer as MapObjects2.ImageLayer; } else if (layer is MapObjects2.MapLayer) { this._mapLayer = layer as MapObjects2.MapLayer; } if (this._mapLayer != null) { int iColumnsCount = this._mapLayer.Records.TableDesc.FieldCount; string sFieldName = string.Empty; this._fieldsList.Clear(); this._numFieldsList.Clear(); for (short i = 0; i < iColumnsCount; i++) { sFieldName = this._mapLayer.Records.TableDesc.get_FieldName(i); MapObjects2.Field oField = this._mapLayer.Records.Fields.Item(sFieldName); this._fieldsList.Add(oField.Name); if (oField.Type == MapObjects2.FieldTypeConstants.moDouble || oField.Type == MapObjects2.FieldTypeConstants.moLong) { this._numFieldsList.Add(oField.Name); } } } }
/// <summary> /// 计算地图的当前比例尺 /// </summary> /// <param name="mapControl"></param> /// <returns></returns> public double ComputeMapScale(AxMapObjects2.AxMap mapControl) { System.Drawing.Graphics g = System.Drawing.Graphics.FromHwnd((System.IntPtr)mapControl.hWnd); Point oPoint1 = new PointClass(); oPoint1.X = mapControl.Extent.Left; oPoint1.Y = mapControl.Extent.Top; Point oPoint2 = new PointClass(); oPoint2.X = mapControl.Extent.Right; oPoint2.Y = mapControl.Extent.Top; double dLen1 = this.ComputeDistance(oPoint1, oPoint2); double dLen2 = mapControl.Width / g.DpiX * 2.54 / 100; g.Dispose(); return(dLen1 / dLen2); }
public MapStruct SaveMapInfosToProject(AxMapObjects2.AxMap mapControl, string geoDataSetPath) { MapStruct oMapStruct = new MapStruct(); oMapStruct.BBox.MinX = mapControl.Extent.Top; oMapStruct.BBox.MinY = mapControl.Extent.Left; oMapStruct.BBox.MaxX = mapControl.Extent.Bottom; oMapStruct.BBox.MaxY = mapControl.Extent.Right; oMapStruct.BBox.Width = mapControl.Extent.Width; oMapStruct.BBox.Height = mapControl.Extent.Height; oMapStruct.CoordinateSystem = mapControl.CoordinateSystem; oMapStruct.GeoDataSetPath = geoDataSetPath; short iLayersCount = mapControl.Layers.Count; for (short i = 0; i < iLayersCount; i++) { object oLayer = mapControl.Layers.Item(i); if (oLayer is MapObjects2.MapLayer) { MapObjects2.MapLayer oMapLayer = oLayer as MapObjects2.MapLayer; MapLayerInfoStruct oMapLayerStruct = new MapLayerInfoStruct(); oMapLayerStruct.LayerType = (short)oMapLayer.LayerType; oMapLayerStruct.Name = oMapLayer.Name; oMapLayerStruct.ShapeType = (short)oMapLayer.shapeType; oMapLayerStruct.Render = this.ExportLayerRender(oMapLayer); this.DeconvertSymbol(oMapLayer.Symbol, oMapLayerStruct.Symbol); } else if (oLayer is MapObjects2.ImageLayer) { throw new NotImplementedException(); } } return(oMapStruct); }
/// <summary> /// 加载图层集合 /// </summary> /// <param name="layerPaths">图层路径集合</param> /// <param name="map">地图对象</param> public void LoadLayers(List <string> layerPaths, MapStruct mapInfoCollection, AxMapObjects2.AxMap mapControl) { BaseHandler.MapManager oMapManager = new BaseHandler.MapManager(); ProjectSerialization oProjectSerilization = new ProjectSerialization(); foreach (string sLayerPath in layerPaths) { string sFileExtent = System.IO.Path.GetExtension(sLayerPath); LayerTypeConstants oLayerType = oMapManager.GetLayerTypeByFileExtent(sFileExtent); if (oLayerType == LayerTypeConstants.moMapLayer) { MapLayer oMapLayer = oMapManager.GetSingleVectorLayer(sLayerPath); oMapLayer.Tag = "0-0"; mapControl.Layers.Add(oMapLayer); MapLayerInfoStruct oMapLayerStruct = oProjectSerilization.LoadLayerInfos(oMapLayer, sLayerPath, -1, -1); mapInfoCollection.Layers.Insert(0, oMapLayerStruct); } else if (oLayerType == LayerTypeConstants.moImageLayer) { ImageLayer oImageLayer = oMapManager.GetSingleImageLayer(sLayerPath); oImageLayer.Tag = "0-0"; mapControl.Layers.Add(oImageLayer); ImageLayerInfoStruct oImageLayerStruct = oProjectSerilization.LoadLayerInfos(oImageLayer, sLayerPath, -1, -1); mapInfoCollection.Layers.Insert(0, oImageLayerStruct); } } }
/// <summary> /// �����֧������ķ��� - ��Ҫʹ�ô���༭���� /// �˷��������ݡ� /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmGisMain)); this.tbGis1 = new System.Windows.Forms.ToolBar(); this.tBarZoomIn = new System.Windows.Forms.ToolBarButton(); this.tBarZoomOut = new System.Windows.Forms.ToolBarButton(); this.tBarFull = new System.Windows.Forms.ToolBarButton(); this.tBarPan = new System.Windows.Forms.ToolBarButton(); this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); this.tBarRe = new System.Windows.Forms.ToolBarButton(); this.tBarExit = new System.Windows.Forms.ToolBarButton(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.axMap1 = new AxMapObjects2.AxMap(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.listBox = new System.Windows.Forms.ListBox(); this.axMap2 = new AxMapObjects2.AxMap(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.radioButton3 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axMap1)).BeginInit(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axMap2)).BeginInit(); this.groupBox2.SuspendLayout(); this.groupBox4.SuspendLayout(); this.SuspendLayout(); // // tbGis1 // this.tbGis1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.tbGis1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.tBarZoomIn, this.tBarZoomOut, this.tBarFull, this.tBarPan, this.toolBarButton1, this.tBarRe, this.tBarExit}); this.tbGis1.DropDownArrows = true; this.tbGis1.ImageList = this.imageList1; this.tbGis1.Location = new System.Drawing.Point(0, 0); this.tbGis1.Name = "tbGis1"; this.tbGis1.ShowToolTips = true; this.tbGis1.Size = new System.Drawing.Size(720, 41); this.tbGis1.TabIndex = 1; this.tbGis1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbGis1_ButtonClick); // // tBarZoomIn // this.tBarZoomIn.ImageIndex = 0; this.tBarZoomIn.Text = "�Ŵ�"; // // tBarZoomOut // this.tBarZoomOut.ImageIndex = 1; this.tBarZoomOut.Text = "��С"; // // tBarFull // this.tBarFull.ImageIndex = 2; this.tBarFull.Text = "ȫͼ"; // // tBarPan // this.tBarPan.ImageIndex = 3; this.tBarPan.Text = "����"; // // toolBarButton1 // this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // tBarRe // this.tBarRe.ImageIndex = 4; this.tBarRe.Text = "��ѯ"; // // tBarExit // this.tBarExit.ImageIndex = 5; this.tBarExit.Text = "�˳�"; // // imageList1 // this.imageList1.ImageSize = new System.Drawing.Size(16, 16); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.axMap1); this.groupBox1.Location = new System.Drawing.Point(8, 44); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(492, 452); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "��ͼ��Ϣ"; // // axMap1 // this.axMap1.ContainingControl = this; this.axMap1.Dock = System.Windows.Forms.DockStyle.Fill; this.axMap1.Location = new System.Drawing.Point(3, 17); this.axMap1.Name = "axMap1"; this.axMap1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMap1.OcxState"))); this.axMap1.Size = new System.Drawing.Size(486, 432); this.axMap1.TabIndex = 0; this.axMap1.MouseDownEvent += new AxMapObjects2._DMapEvents_MouseDownEventHandler(this.axMap1_MouseDownEvent); // // groupBox3 // this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox3.Controls.Add(this.listBox); this.groupBox3.Location = new System.Drawing.Point(504, 172); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(208, 316); this.groupBox3.TabIndex = 6; this.groupBox3.TabStop = false; this.groupBox3.Text = "վ����Ϣ"; // // listBox // this.listBox.BackColor = System.Drawing.Color.White; this.listBox.Dock = System.Windows.Forms.DockStyle.Fill; this.listBox.Font = new System.Drawing.Font("Arial", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.listBox.ItemHeight = 16; this.listBox.Location = new System.Drawing.Point(3, 17); this.listBox.Name = "listBox"; this.listBox.Size = new System.Drawing.Size(202, 292); this.listBox.Sorted = true; this.listBox.TabIndex = 0; this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged); // // axMap2 // this.axMap2.ContainingControl = this; this.axMap2.Location = new System.Drawing.Point(8, 24); this.axMap2.Name = "axMap2"; this.axMap2.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMap2.OcxState"))); this.axMap2.Size = new System.Drawing.Size(192, 136); this.axMap2.TabIndex = 0; this.axMap2.AfterLayerDraw += new AxMapObjects2._DMapEvents_AfterLayerDrawEventHandler(this.axMap2_AfterLayerDraw); this.axMap2.MouseUpEvent += new AxMapObjects2._DMapEvents_MouseUpEventHandler(this.axMap2_MouseUpEvent); // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.axMap2); this.groupBox2.Location = new System.Drawing.Point(504, 492); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(208, 4); this.groupBox2.TabIndex = 7; this.groupBox2.TabStop = false; this.groupBox2.Text = "���ͼ"; // // groupBox4 // this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.groupBox4.Controls.Add(this.radioButton3); this.groupBox4.Controls.Add(this.radioButton2); this.groupBox4.Controls.Add(this.radioButton1); this.groupBox4.Location = new System.Drawing.Point(504, 44); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(208, 124); this.groupBox4.TabIndex = 8; this.groupBox4.TabStop = false; this.groupBox4.Text = "�û�����"; // // radioButton3 // this.radioButton3.Location = new System.Drawing.Point(24, 84); this.radioButton3.Name = "radioButton3"; this.radioButton3.Size = new System.Drawing.Size(128, 32); this.radioButton3.TabIndex = 5; this.radioButton3.Text = " ������ز�"; this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged); // // radioButton2 // this.radioButton2.Location = new System.Drawing.Point(24, 56); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(152, 24); this.radioButton2.TabIndex = 4; this.radioButton2.Text = " ���ȹ�����"; this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged); // // radioButton1 // this.radioButton1.Location = new System.Drawing.Point(24, 24); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(144, 24); this.radioButton1.TabIndex = 3; this.radioButton1.Text = " ��ͼ��"; this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); // // timer1 // this.timer1.Interval = 4500; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // frmGisMain // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(720, 509); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox1); this.Controls.Add(this.tbGis1); this.Name = "frmGisMain"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.frmGisMain_MouseDown); this.Load += new System.EventHandler(this.Form1_Load); this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.axMap1)).EndInit(); this.groupBox3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.axMap2)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox4.ResumeLayout(false); this.ResumeLayout(false); }
public GeoeventUpdate(AxMapObjects2.AxMap mapControl) { this._mapControl = mapControl; this._trackingLayer = this._mapControl.TrackingLayer; this.InitCarSymbols(); }
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); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmGisMain)); this.tbGis = new System.Windows.Forms.ToolBar(); this.tBarZoomIn = new System.Windows.Forms.ToolBarButton(); this.tBarZoomOut = new System.Windows.Forms.ToolBarButton(); this.tBarFull = new System.Windows.Forms.ToolBarButton(); this.tBarPan = new System.Windows.Forms.ToolBarButton(); this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); this.tBarRe = new System.Windows.Forms.ToolBarButton(); this.tBarExit = new System.Windows.Forms.ToolBarButton(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.mapMain = new AxMapObjects2.AxMap(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.listBox = new System.Windows.Forms.ListBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.mapEye = new AxMapObjects2.AxMap(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.radioButton3 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.mapMain)).BeginInit(); this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.mapEye)).BeginInit(); this.groupBox4.SuspendLayout(); this.SuspendLayout(); // // tbGis // this.tbGis.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.tbGis.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.tBarZoomIn, this.tBarZoomOut, this.tBarFull, this.tBarPan, this.toolBarButton1, this.tBarRe, this.tBarExit }); this.tbGis.DropDownArrows = true; this.tbGis.ImageList = this.imageList1; this.tbGis.Location = new System.Drawing.Point(0, 0); this.tbGis.Name = "tbGis"; this.tbGis.ShowToolTips = true; this.tbGis.Size = new System.Drawing.Size(720, 41); this.tbGis.TabIndex = 1; this.tbGis.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbGis_ButtonClick); // // tBarZoomIn // this.tBarZoomIn.ImageIndex = 0; this.tBarZoomIn.Text = "放大"; // // tBarZoomOut // this.tBarZoomOut.ImageIndex = 1; this.tBarZoomOut.Text = "缩小"; // // tBarFull // this.tBarFull.ImageIndex = 2; this.tBarFull.Text = "全图"; // // tBarPan // this.tBarPan.ImageIndex = 3; this.tBarPan.Text = "漫游"; // // toolBarButton1 // this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // tBarRe // this.tBarRe.ImageIndex = 4; this.tBarRe.Text = "查询"; // // tBarExit // this.tBarExit.ImageIndex = 5; this.tBarExit.Text = "退出"; // // imageList1 // this.imageList1.ImageSize = new System.Drawing.Size(16, 16); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.mapMain); this.groupBox1.Location = new System.Drawing.Point(8, 44); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(488, 452); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "地图信息"; // // mapMain // this.mapMain.ContainingControl = this; this.mapMain.Dock = System.Windows.Forms.DockStyle.Fill; this.mapMain.Location = new System.Drawing.Point(3, 17); this.mapMain.Name = "mapMain"; this.mapMain.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("mapMain.OcxState"))); this.mapMain.Size = new System.Drawing.Size(482, 432); this.mapMain.TabIndex = 0; this.mapMain.MouseDownEvent += new AxMapObjects2._DMapEvents_MouseDownEventHandler(this.mapMain_MouseDownEvent); this.mapMain.DblClick += new System.EventHandler(this.mapMain_DblClick); this.mapMain.DrawingCanceled += new System.EventHandler(this.mapMain_DrawingCanceled); // // groupBox3 // this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox3.Controls.Add(this.listBox); this.groupBox3.Location = new System.Drawing.Point(504, 172); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(208, 172); this.groupBox3.TabIndex = 6; this.groupBox3.TabStop = false; this.groupBox3.Text = "站点信息"; // // listBox // this.listBox.BackColor = System.Drawing.Color.White; this.listBox.Dock = System.Windows.Forms.DockStyle.Fill; this.listBox.Font = new System.Drawing.Font("Arial", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.listBox.ItemHeight = 16; this.listBox.Location = new System.Drawing.Point(3, 17); this.listBox.Name = "listBox"; this.listBox.Size = new System.Drawing.Size(202, 148); this.listBox.Sorted = true; this.listBox.TabIndex = 0; this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged); // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.mapEye); this.groupBox2.Location = new System.Drawing.Point(504, 348); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(208, 148); this.groupBox2.TabIndex = 7; this.groupBox2.TabStop = false; this.groupBox2.Text = "鸟瞰地图"; // // mapEye // this.mapEye.ContainingControl = this; this.mapEye.Dock = System.Windows.Forms.DockStyle.Fill; this.mapEye.Location = new System.Drawing.Point(3, 17); this.mapEye.Name = "mapEye"; this.mapEye.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("mapEye.OcxState"))); this.mapEye.Size = new System.Drawing.Size(202, 128); this.mapEye.TabIndex = 0; this.mapEye.AfterLayerDraw += new AxMapObjects2._DMapEvents_AfterLayerDrawEventHandler(this.mapEye_AfterLayerDraw); this.mapEye.MouseUpEvent += new AxMapObjects2._DMapEvents_MouseUpEventHandler(this.mapEye_MouseUpEvent); // // groupBox4 // this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.groupBox4.Controls.Add(this.radioButton3); this.groupBox4.Controls.Add(this.radioButton2); this.groupBox4.Controls.Add(this.radioButton1); this.groupBox4.Location = new System.Drawing.Point(504, 44); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(208, 124); this.groupBox4.TabIndex = 8; this.groupBox4.TabStop = false; this.groupBox4.Text = "用户管理"; // // radioButton3 // this.radioButton3.Location = new System.Drawing.Point(24, 84); this.radioButton3.Name = "radioButton3"; this.radioButton3.Size = new System.Drawing.Size(128, 32); this.radioButton3.TabIndex = 5; this.radioButton3.Text = " 热网监控层"; // // radioButton2 // this.radioButton2.Location = new System.Drawing.Point(24, 56); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(152, 24); this.radioButton2.TabIndex = 4; this.radioButton2.Text = " 供热管网层"; this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged); // // radioButton1 // this.radioButton1.Location = new System.Drawing.Point(24, 24); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(144, 24); this.radioButton1.TabIndex = 3; this.radioButton1.Text = " 地图层"; this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); // // timer1 // this.timer1.Interval = 4500; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // frmGisMain // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(720, 509); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox1); this.Controls.Add(this.tbGis); this.Name = "frmGisMain"; this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.frmGisMain_MouseDown); this.Load += new System.EventHandler(this.Form1_Load); this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.mapMain)).EndInit(); this.groupBox3.ResumeLayout(false); this.groupBox2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.mapEye)).EndInit(); this.groupBox4.ResumeLayout(false); this.ResumeLayout(false); }
public string GetLayerDatasetName(string layerAliasName, AxMapObjects2.AxMap mapControl) { throw new NotImplementedException(); }
public void ZoomInMap(Rectangle mapExtent, ref AxMapObjects2.AxMap mapControl) { mapControl.Extent = mapExtent.Extent; }
public void LoadLayersToLegend(AxMapObjects2.AxMap mapObject) { if (mapObject == null) { return; } this._mapObject = mapObject; int iLayersCount = 0; iLayersCount = mapObject.Layers.Count; pnlLegend.Controls.Clear(); int iCtrlsCounter = 0; for (int i = 0; i < iLayersCount; i++) { CheckBox oCkbLayer = new CheckBox(); object oLayer = mapObject.Layers.Item(i); if (oLayer is MapObjects2.MapLayer) { MapObjects2.MapLayer oMapLayer = oLayer as MapObjects2.MapLayer; oCkbLayer.Text = oMapLayer.Name; oCkbLayer.Checked = oMapLayer.Visible; if (oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypePoint || oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypeMultipoint) { oCkbLayer.Image = Properties.Resources.pointShape; } else if (oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypeEllipse || oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypeLine || oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypeRectangle) { oCkbLayer.Image = Properties.Resources.lineShape; } else if (oMapLayer.shapeType == MapObjects2.ShapeTypeConstants.moShapeTypePolygon) { oCkbLayer.Image = Properties.Resources.polygonShape; } } else if (oLayer is MapObjects2.ImageLayer) { MapObjects2.ImageLayer oImageLayer = oLayer as MapObjects2.ImageLayer; oCkbLayer.Image = Properties.Resources.image; oCkbLayer.Text = oImageLayer.Name; oCkbLayer.Checked = oImageLayer.Visible; } oCkbLayer.Visible = true; oCkbLayer.AutoSize = true; oCkbLayer.FlatStyle = FlatStyle.Flat; oCkbLayer.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left); oCkbLayer.ImageAlign = ContentAlignment.MiddleLeft; oCkbLayer.TextAlign = ContentAlignment.MiddleRight; oCkbLayer.TextImageRelation = TextImageRelation.ImageBeforeText; oCkbLayer.ContextMenuStrip = mnuLayerProperty; oCkbLayer.CheckedChanged += new EventHandler(CkbLayer_CheckedChanged); oCkbLayer.MouseDown += new MouseEventHandler(oCkbLayer_MouseDown); this.pnlLegend.Controls.Add(oCkbLayer); oCkbLayer.Location = new System.Drawing.Point(30, iCtrlsCounter * (oCkbLayer.Height + 12) + 20); iCtrlsCounter++; } this.pnlLegend.Refresh(); }