/// <summary> /// To open the editor form, we need to first determine which barrier is /// being edited, then pass that value to the form /// </summary> private void OpenBarrierEditorForm() { // get the barrier layer by using the category name to as the NAClassName INAWindowCategory activeCategory = GetActiveCategory(); string categoryName = activeCategory.NAClass.ClassDefinition.Name; INALayer naLayer = GetActiveAnalysisLayer(); ILayer layer = naLayer.get_LayerByNAClassName(categoryName); // get a selection count and popup a message if more or less than one item is selected IFeatureSelection fSel = layer as IFeatureSelection; ISelectionSet selSet = fSel.SelectionSet; if (selSet.Count != 1) { System.Windows.Forms.MessageBox.Show("Only one barrier in a category can be selected at a time for this command to execute", "Barrier Location Editor Warning"); } else { // get the object IDs of the selected item int id = selSet.IDs.Next(); // Get the barrier feature by using the selected ID IFeatureClass fClass = naLayer.Context.NAClasses.get_ItemByName(categoryName) as IFeatureClass; IFeature barrierFeature = fClass.GetFeature(id); // display the form for editing the barrier EditorForm form = new EditorForm(m_application, naLayer.Context, barrierFeature); form.ShowDialog(); form = null; } }
public bool Applies(INALayer naLayer, INAWindowCategory category) { // The category is associated with an NAClass. // In our case, we want the PolygonBarriers and PolylineBarriers classes if (category != null) { string categoryName = category.NAClass.ClassDefinition.Name; if (categoryName == "PolygonBarriers" || categoryName == "PolylineBarriers") { return(true); } } return(false); }
public bool Applies(INALayer naLayer, INAWindowCategory category) { // The category is associated with an NAClass. // In our case, we want the PolygonBarriers and PolylineBarriers classes if (category != null) { string categoryName = category.NAClass.ClassDefinition.Name; if (categoryName == "PolygonBarriers" || categoryName == "PolylineBarriers") return true; } return false; }
public bool Applies(INALayer naLayer, INAWindowCategory Category) { return(true); }
public bool Applies(INALayer naLayer, INAWindowCategory Category) { return true; }