/// <summary> /// Occurs when this tool is clicked /// </summary> public override void OnClick() { if (m_hookHelper.FocusMap == null) { return; } List <IGeometry> vTemp = GetDataGeometry(m_hookHelper.FocusMap); if (vTemp == null) { return; } ESRI.ArcGIS.Geometry.IGeometry pGeometry = GetUnion(vTemp); if (pGeometry == null) { return; } //DrawGeometry(pGeometry); frmAreaStatistics frm = new frmAreaStatistics(); frm.CurGeometry = pGeometry; frm.CurMap = m_hookHelper.Hook as IMapControlDefault; // frm.SetSliderValue(false); frm.InitFrm(); frm.ShowDialog(); }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { if (m_hookHelper == null) { return; } if (Button == 4 || Button == 2) { return; } IActiveView pAv = m_hookHelper.ActiveView; IMapControl2 pMapCtl = m_hookHelper.Hook as IMapControl2; IGeometry pGeo = null; pGeo = pMapCtl.TrackPolygon(); if (pGeo == null) { return; } //drawgeometryXOR(pGeo); frm = new frmAreaStatistics(); frm.CurGeometry = pGeo; frm.FormClosed += new FormClosedEventHandler(frm_FormClosed); frm.CurMap = m_hookHelper.Hook as IMapControlDefault; frm.InitFrm(); frm.SetSliderValue(true); frm.ShowDialog(); }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { if (m_hookHelper == null) { return; } if (Button == 4 || Button == 2) { return; } IActiveView pAv = m_hookHelper.ActiveView; IMapControl2 pMapCtl = m_hookHelper.Hook as IMapControl2; IPolygon pPoly = new PolygonClass(); IPointCollection polylinePointCollection = new PolygonClass(); pPoly.SpatialReference = pMapCtl.SpatialReference; IEnvelope pGeo = pMapCtl.TrackRectangle(); object missing = Type.Missing; IPoint pPoint = new PointClass(); pPoint.PutCoords(pGeo.XMin, pGeo.YMin); polylinePointCollection.AddPoint(pPoint, ref missing, ref missing); pPoint.PutCoords(pGeo.XMin, pGeo.YMax); polylinePointCollection.AddPoint(pPoint, ref missing, ref missing); pPoint.PutCoords(pGeo.XMax, pGeo.YMax); polylinePointCollection.AddPoint(pPoint, ref missing, ref missing); pPoint.PutCoords(pGeo.XMax, pGeo.YMin); polylinePointCollection.AddPoint(pPoint, ref missing, ref missing); pPoly = polylinePointCollection as IPolygon; pPoly.SimplifyPreserveFromTo(); if (pPoly == null) { return; } //drawgeometryXOR(pGeo); frm = new frmAreaStatistics(); pPoly.SpatialReference = pMapCtl.SpatialReference; //added by chulili 2013-02-28 到这里为止,pPoly的空间参考变成null了,再赋值一次 frm.CurGeometry = pPoly as IGeometry; frm.FormClosed += new FormClosedEventHandler(frm_FormClosed); frm.CurMap = m_hookHelper.Hook as IMapControlDefault; frm.InitFrm(); frm.SetSliderValue(true); frm.ShowDialog(); }