public override void OnMouseDown(int Button, int Shift, int X, int Y) { m_pForm = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm; FormCollection pFormCollection = System.Windows.Forms.Application.OpenForms; IActiveView pActiveView = m_pForm.axMapControl1.ActiveView; clsSnippet pSnippet = new clsSnippet(); //Using IRubberband IEnvelope pEnvelop = pSnippet.DrawRectangle(pActiveView); if (pEnvelop.IsEmpty) { int x = X; int y = Y; IPoint pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); double Tol_x = x / int.MaxValue; double Tol_y = y / int.MaxValue; pEnvelop = pPoint.Envelope; pEnvelop.Expand(Tol_x, Tol_y, false); } ISpatialFilter pSpatialFilter = new SpatialFilterClass(); pSpatialFilter.Geometry = pEnvelop; pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; for (int i = 0; i < pActiveView.FocusMap.LayerCount; i++) { ILayer pLayer = m_pForm.axMapControl1.get_Layer(i); IFeatureLayer pFLayer = (IFeatureLayer)pLayer; if (pFLayer.Visible) { //Brushing to Mapcontrol string ShapeFieldName = pFLayer.FeatureClass.ShapeFieldName; pSpatialFilter.GeometryField = pFLayer.FeatureClass.ShapeFieldName; BrushingOnMapControl(pSpatialFilter, pActiveView, pFLayer); m_pBL.BrushingToOthers(pFLayer, m_pForm.Handle); } } pActiveView.GraphicsContainer.DeleteAllElements(); pActiveView.Refresh(); }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { if (pDrawDenplot.cboSourceLayer.Text != "" && pDrawDenplot.cboUField.Text != "" && pDrawDenplot.cboValueField.Text != "") { IGeoFeatureLayer pGeoFeatureLayer = pDrawDenplot.pGeofeatureLayer; mForm = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm; IActiveView pActiveView = mForm.axMapControl1.ActiveView; string strTargetLayerName = pDrawDenplot.cboSourceLayer.Text; string strValueField = pDrawDenplot.cboValueField.Text; string strUncerField = pDrawDenplot.cboUField.Text; clsSnippet pSnippet = new clsSnippet(); //Using IRubberband IEnvelope pEnvelop = pSnippet.DrawRectangle(pActiveView); ISpatialFilter pSpatialFilter = new SpatialFilterClass(); pSpatialFilter.Geometry = pEnvelop; pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; int intTLayerIdx = pSnippet.GetIndexNumberFromLayerName(pActiveView, strTargetLayerName); ILayer pLayer = mForm.axMapControl1.get_Layer(intTLayerIdx); IFeatureLayer pFLayer = (IFeatureLayer)pLayer; string ShapeFieldName = pFLayer.FeatureClass.ShapeFieldName; pSpatialFilter.GeometryField = pFLayer.FeatureClass.ShapeFieldName; IFeatureClass pFeatureClass = pFLayer.FeatureClass; int intValueFldIdx = pFeatureClass.FindField(strValueField); int intUncerFldIdx = pFeatureClass.FindField(strUncerField); IFeatureCursor pFCursor = pGeoFeatureLayer.Search(pSpatialFilter, true); StackedChartRenderer pStackedChartRenderer = new StackedChartRenderer(); pStackedChartRenderer.dblError = pDrawDenplot.dblError; pStackedChartRenderer.intValueFldIdx = intValueFldIdx; pStackedChartRenderer.intUncerFldIdx = intUncerFldIdx; pStackedChartRenderer.dblMaxValue = pDrawDenplot.dblMaxValue; pStackedChartRenderer.bln3Dfeature = pDrawDenplot.bln3Dfeature; pStackedChartRenderer.m_strOriRenderField = strValueField; pStackedChartRenderer.m_strUncernRenderField = strUncerField; pStackedChartRenderer.dblMaxEstimate = pDrawDenplot.dblMaxEstimate; pStackedChartRenderer.dblMaxUncern = pDrawDenplot.dblMaxUncern; pStackedChartRenderer.m_pQueryFilter = pSpatialFilter as IQueryFilter; //pStackedChartRenderer.m_stackedChart = pGeoFeatureLayer.Renderer; //pStackedChartRenderer.PrepareFilter(pFeatureClass, pSpatialFilter); pStackedChartRenderer.m_pDisplay = pActiveView.ScreenDisplay; //pStackedChartRenderer.Draw(pFCursor, esriDrawPhase.esriDPSelection, pDisplay, null); //pStackedChartRenderer.CreateLegend(); pGeoFeatureLayer.Renderer = pStackedChartRenderer; //mForm.axMapControl1.ActiveView.Refresh(); pActiveView.Refresh(); } }