/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuClick_HeatNow(System.Object sender, System.EventArgs e) { if (GisMapSNo == "2") { frmDataNowD f = new frmDataNowD(GisMapSName); f.ShowDialog(); } else { frmDataNow f = new frmDataNow(GisMapSName); f.ShowDialog(); } }
/// <summary> /// axMap1 mouse down event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void axMap1_MouseDownEvent(object sender, AxMapObjects2._DMapEvents_MouseDownEvent e) { switch(tBarIndex) { case 1: { MapObjects2.Rectangle zoomInRect=new MapObjects2.RectangleClass(); MapObjects2.Point zoomInPt=new MapObjects2.PointClass(); zoomInRect=this.axMap1.TrackRectangle(); if (zoomInRect.Height>0 && zoomInRect.Width>0) { axMap1.Extent=zoomInRect; axMap1.Extent=axMap1.Extent; } else { zoomInPt=axMap1.ToMapPoint(e.x,e.y); axMap1.CenterAt(zoomInPt.X,zoomInPt.Y); zoomRect=axMap1.Extent; sr=0.5; zoomRect.ScaleRectangle(sr); axMap1.Extent=zoomRect; axMap1.Extent=axMap1.Extent; } ShowLayers(); axMap2.Extent=axMap2.Extent; iScale=System.Convert.ToInt64(mapLayer.CalcScale(this.axMap1)); // MessageBox.Show(iScale.ToString()); // if(iScale<=MAX_SCALE) // { // MessageBox.Show("ѡ��ͼ�α�����С��������ѡ��!","����",MessageBoxButtons.OK,MessageBoxIcon.Warning); // zoomFull(); // return; // } break; } case 2: { MapObjects2.Rectangle zoomOutRect=new MapObjects2.RectangleClass(); MapObjects2.Point zoomOutPt=new MapObjects2.PointClass(); zoomOutRect=axMap1.TrackRectangle(); if(zoomOutRect.Height>0 && zoomOutRect.Width>0) { sr=axMap1.Extent.Width/zoomOutRect.Width; axMap1.CenterAt(zoomOutRect.Center.X,zoomOutRect.Center.Y); } else { zoomOutPt=axMap1.ToMapPoint(e.x,e.y); axMap1.CenterAt(zoomOutPt.X,zoomOutPt.Y); sr=2; } zoomRect=axMap1.Extent; zoomRect.ScaleRectangle(sr); axMap1.Extent=zoomRect; axMap1.Extent=axMap1.Extent; ShowLayers(); axMap2.Extent=axMap2.Extent; break; } case 3: { axMap1.Pan(); axMap2.Extent=axMap2.Extent; break; } default: { if(radioButton1.Checked==false) { MapObjects2.Point point; point=axMap1.ToMapPoint(e.x,e.y); // MessageBox.Show(point.X.ToString()); // MessageBox.Show(point.Y.ToString()); for(int i=0;i<s_Info.Length;i++) { if(point.X>System.Convert.ToDouble( s_Info[i].s_East)-20 && point.X<System.Convert.ToDouble(s_Info[i].s_East)+20 && point.Y>System.Convert.ToDouble(s_Info[i].s_West)-20 && point.Y<System.Convert.ToDouble(s_Info[i].s_West)+20 ) { // Point position=new Point(); GisMapSName=s_Info[i].s_Name; GisMapSNo=s_Info[i].s_No; // position.X=e.x+POSITIONX; // position.Y=e.y+POSITIONY; // GisMapMenu.Show(this,position); if(GisMapSNo=="2"||GisMapSNo=="3") { frmDataNowD f=new frmDataNowD(GisMapSName,GisMapSNo); f.ShowDialog(); break; } else { frmDataNow f=new frmDataNow(GisMapSName); f.ShowDialog(); break; } } } } break; } } }
/// <summary> /// mapMain mouse down event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mapMain_MouseDownEvent(object sender, AxMapObjects2._DMapEvents_MouseDownEvent e) { switch (tBarIndex) { case 1: { MapObjects2.Rectangle zoomInRect = new MapObjects2.RectangleClass(); MapObjects2.Point zoomInPt = new MapObjects2.PointClass(); zoomInRect = this.mapMain.TrackRectangle(); if (zoomInRect.Height > 0 && zoomInRect.Width > 0) { mapMain.Extent = zoomInRect; mapMain.Extent = mapMain.Extent; } else { zoomInPt = mapMain.ToMapPoint(e.x, e.y); mapMain.CenterAt(zoomInPt.X, zoomInPt.Y); zoomRect = mapMain.Extent; sr = 0.5; zoomRect.ScaleRectangle(sr); mapMain.Extent = zoomRect; mapMain.Extent = mapMain.Extent; } ShowLayers(); mapEye.Extent = mapEye.Extent; iScale = System.Convert.ToInt64(mapLayer.CalcScale(this.mapMain)); if (iScale <= MAX_SCALE) { MessageBox.Show("选择图形比例过小,请重新选择!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); zoomFull(); return; } break; } case 2: { MapObjects2.Rectangle zoomOutRect = new MapObjects2.RectangleClass(); MapObjects2.Point zoomOutPt = new MapObjects2.PointClass(); zoomOutRect = mapMain.TrackRectangle(); if (zoomOutRect.Height > 0 && zoomOutRect.Width > 0) { sr = mapMain.Extent.Width / zoomOutRect.Width; mapMain.CenterAt(zoomOutRect.Center.X, zoomOutRect.Center.Y); } else { zoomOutPt = mapMain.ToMapPoint(e.x, e.y); mapMain.CenterAt(zoomOutPt.X, zoomOutPt.Y); sr = 2; } zoomRect = mapMain.Extent; zoomRect.ScaleRectangle(sr); mapMain.Extent = zoomRect; mapMain.Extent = mapMain.Extent; ShowLayers(); mapEye.Extent = mapEye.Extent; break; } case 3: { mapMain.Pan(); mapEye.Extent = mapEye.Extent; break; } default: { if (radioButton1.Checked == false) { MapObjects2.Point point; point = mapMain.ToMapPoint(e.x, e.y); for (int i = 0; i < s_Info.Length; i++) { if (point.X > System.Convert.ToDouble( s_Info[i].s_East) - 5 && point.X <System.Convert.ToDouble(s_Info[i].s_East) + 5 && point.Y> System.Convert.ToDouble(s_Info[i].s_West) - 5 && point.Y < System.Convert.ToDouble(s_Info[i].s_West) + 5 ) { Point position = new Point(); GisMapSName = s_Info[i].s_Name; GisMapSNo = s_Info[i].s_No; // position.X=e.x+POSITIONX; // position.Y=e.y+POSITIONY; // GisMapMenu.Show(this,position); if (GisMapSNo == "2") { frmDataNowD f = new frmDataNowD(GisMapSName); f.ShowDialog(); } else { frmDataNow f = new frmDataNow(GisMapSName); f.ShowDialog(); } } } } break; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuClick_HeatNow(System.Object sender, System.EventArgs e) { if(GisMapSNo=="2") { frmDataNowD f=new frmDataNowD(GisMapSName); f.ShowDialog(); } else { frmDataNow f=new frmDataNow(GisMapSName); f.ShowDialog(); } }