private void method_0(IGxSelection igxSelection_1, object object_0) { if (this.igxSelection_0 == igxSelection_1) { this.igxObject_0 = igxSelection_1.FirstObject; } }
public void Refresh() { IGxSelection pGxSelection = null; IGxObject pLocation = null; pGxSelection = m_pSelection; pLocation = pGxSelection.Location; //Clean up frmTextView.txtContents.Clear(); string fname = null; fname = pLocation.Name.ToLower(); if (fname.IndexOf(".txt") != -1) { try { frmTextView.txtContents.Text = System.IO.File.ReadAllText(pLocation.FullName); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } finally { pGxSelection = null; pLocation = null; } } }
private void GxSelection_Changed(IGxSelection igxSelection, object gobject) { if (_gxSelection == igxSelection) { _gxObject = igxSelection.FirstObject; } }
public override void OnClick() { frmNewObjectClass frmNewObjectClass = new frmNewObjectClass(); IObjectClass objectClass = null; IGxSelection gxSelection = _context.GxSelection as IGxSelection; if (gxSelection.FirstObject is IGxDatabase) { GxCatalogCommon.ConnectGDB(gxSelection.FirstObject as IGxDatabase); if ((gxSelection.FirstObject as IGxDatabase).Workspace == null) { return; } frmNewObjectClass.Workspace = (gxSelection.FirstObject as IGxDatabase).Workspace; if (frmNewObjectClass.ShowDialog() == System.Windows.Forms.DialogResult.OK) { objectClass = frmNewObjectClass.ObjectClass; } } else if (gxSelection.FirstObject is IGxDataset && (gxSelection.FirstObject as IGxDataset).DatasetName.Type == esriDatasetType.esriDTFeatureDataset) { try { frmNewObjectClass.Workspace = (gxSelection.FirstObject as IGxDataset).Dataset; if (frmNewObjectClass.ShowDialog() == System.Windows.Forms.DialogResult.OK) { objectClass = frmNewObjectClass.ObjectClass; } } catch { MessageService.Current.Warn("该要素集有问题,不能新建要素类!"); } } if (objectClass != null) { gxSelection.FirstObject.Refresh(); } }
public void Refresh() { //If the selection does not support IGxDataset, do nothing. IGxSelection pSelection = null; IGxObject pLocation = null; IGraphicsContainer pGraphicsLayer = null; try { pSelection = m_pSelection; pLocation = pSelection.Location; if (!(pLocation is IGxDataset)) { return; } //Clear the contents of the graphics layer. pGraphicsLayer = (IGraphicsContainer)frmExtentView.AxMapControl1.Map.BasicGraphicsLayer; pGraphicsLayer.DeleteAllElements(); //Some dataset may not have content at all IGxDataset pGxDataset = null; IGeoDataset pGeoDataset = null; IElement pElement = null; IFillShapeElement pFillShapeElement = null; try { //Get the geodataset out of the GxDataset. pGxDataset = (IGxDataset)pLocation; if (pGxDataset.Type == esriDatasetType.esriDTLayer | pGxDataset.Type == esriDatasetType.esriDTFeatureClass | pGxDataset.Type == esriDatasetType.esriDTFeatureDataset) { pGeoDataset = (IGeoDataset)pGxDataset.Dataset; } else { return; } //Create a rectangular graphic element to represent the geodataset's full extent. pElement = new RectangleElement(); pElement.Geometry = pGeoDataset.Extent; //Set the element's symbology. pFillShapeElement = (IFillShapeElement)pElement; pFillShapeElement.Symbol = m_pFillSymbol; //Add the rectangle element to the graphics layer, and force the map to redraw. pGraphicsLayer.AddElement(pElement, 0); frmExtentView.AxMapControl1.Refresh(); } catch (Exception ex) { frmExtentView.AxMapControl1.Refresh(); throw ex; } finally { pGxDataset = null; pGeoDataset = null; pElement = null; pFillShapeElement = null; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { pSelection = null; pLocation = null; pGraphicsLayer = null; } }
private void m_pSelection_OnSelectionChanged(IGxSelection Selection, ref object initiator) { Refresh(); frmGxStyleView.RefreshView(); }
private void OnSelectionChanged(IGxSelection Selection, ref object initiator) { //Refresh view Refresh(); }
private void OnSelectionChanged(IGxSelection Selection, ref object initiator) { //Refresh view Refresh(); }
private void m_pSelection_OnSelectionChanged(IGxSelection Selection, ref object initiator) { Refresh(); frmGxStyleView.RefreshView(); }
public void DoFilter() { try { IFilterValue filter = pGxObjectFilter as IFilterValue; filter.Filter = ""; filteredObjects.Clear(); Debug.WriteLine(string.Format("DoFilter: {0}", this.Value)); string filterString = this.Value; Debug.WriteLine(filterString); IGxObject pGxObj; IEnumGxObject pEnumGxObject; IGxSelection pGxSelection = _pGxApp.Selection; if (pGxSelection == null) { return; } IEnumGxObject pSelectedGxObjects = pGxSelection.SelectedObjects; IGxObject pGxObject_Current = pGxSelection.Location; IGxObjectContainer pGxObjectContainer = null; if (pGxObject_Current is IGxObjectContainer) { pGxObjectContainer = pGxObject_Current as IGxObjectContainer; } if (!pGxObjectContainer.HasChildren) { return; } pEnumGxObject = pGxObjectContainer.Children; if (pEnumGxObject == null) { return; } filter = pGxObjectFilter as IFilterValue; filter.Filter = filterString; pGxObj = pEnumGxObject.Next(); while (pGxObj != null) { bool canDisplay = pGxObjectFilter.CanDisplayObject(pGxObj); if (canDisplay == false) { //* if the object is not going to be displayed (due to being filtered out) we will track it so we can unselect it later (if it was selected) filteredObjects.Add(pGxObj); } pGxObj = pEnumGxObject.Next(); } //* Since selected objects stay selected after filtering, we need to manually unselect hidden items due to the filter IGxObject pGxObjSelected = pSelectedGxObjects.Next(); while (pGxObjSelected != null) { if (filteredObjects.Contains(pGxObjSelected)) { Debug.WriteLine("Selected Object that is hidden: " + pGxObjSelected.FullName); pGxSelection.Unselect(pGxObjSelected, null); } pGxObjSelected = pSelectedGxObjects.Next(); } pGxContentsView.ObjectFilter = pGxObjectFilter; } catch (Exception ex) { ArcCatalog.Application.StatusBar.set_Message(0, ex.Message); } finally { _pGxView.Refresh(); } //UpdateItems(filterString); }
protected override void OnClick() { try { IGxSelection gxSelection = this.pGxApp.Selection; if (gxSelection.Count < 1) { return; } // Inizializzo le variabili per la progress bar... ITrackCancel trkCancel = null; IProgressDialogFactory prgFact = new ProgressDialogFactoryClass(); IStepProgressor stepProgressor = null; IProgressDialog2 progressDialog = null; int intNumberFcConverted = 0; int cont = gxSelection.Count; IEnumGxObject enumGxObject = gxSelection.SelectedObjects; stepProgressor = prgFact.Create(trkCancel, 0); progressDialog = stepProgressor as IProgressDialog2; progressDialog.Description = "Removing extensions..."; progressDialog.Title = "Removing extensions..."; progressDialog.Animation = esriProgressAnimationTypes.esriProgressSpiral; progressDialog.ShowDialog(); stepProgressor.MinRange = 0; stepProgressor.MaxRange = cont; stepProgressor.StepValue = 1; stepProgressor.Show(); IGxObject pGxObject = enumGxObject.Next(); while (pGxObject != null) { if (!(pGxObject is IGxDataset)) { return; } IGxDataset pGxDataset = pGxObject as IGxDataset; if (pGxDataset == null) { return; } //if (((pGxObject as IGxDataset).Type) != esriDatasetType.esriDTFeatureClass) //{ // return; //} this.engine(pGxDataset, pGxObject, ref intNumberFcConverted); pGxObject = enumGxObject.Next(); stepProgressor.Step(); } stepProgressor.Message = "End"; stepProgressor.Hide(); progressDialog.HideDialog(); MessageBox.Show($@"Extension removed for {intNumberFcConverted} objects!", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message.ToString()); } }