Skip to main content
edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
deleted 3 characters in body
Source Link
NewBee
  • 157
  • 2
  • 12

I am building a custom arcMap Addin button which onclick event tells how mapny features areinfo about selected features.

Following is my java class ---

public class Break extends Button {

/**
 * Called when the button is clicked.
 * 
 * @exception java.io.IOException if there are interop problems.
 * @exception com.esri.arcgis.interop.AutomationException if the component throws an ArcObjects exception.
 */
@Override
public void onClick() throws IOException, AutomationException {
    // TODO Auto-generated method stub
    
    
    MapBean mapBean = new MapBean();
    try{
        IMap map = mapBean.getMap();
        ISelection selection = map.getFeatureSelection();
        IEnumFeature enumFeature = (IEnumFeature)selection;
        enumFeature.reset();
        IFeature feature = enumFeature.next();
        while (feature != null){
            System.out.println("FEATURE ID: " + feature.getOID());
            feature = enumFeature.next();
        }
    }
    catch (Exception e){
        e.printStackTrace();
    }
    }
}   

I implimented the button on ArcMap but nothing seems to work onclick event , might be its not getting the ArcMap at all.Could anybody tell how to resolve this issue.

Thanks in advance////

I am building a custom arcMap Addin button which onclick event tells how mapny features are selected.

Following is my java class ---

public class Break extends Button {

/**
 * Called when the button is clicked.
 * 
 * @exception java.io.IOException if there are interop problems.
 * @exception com.esri.arcgis.interop.AutomationException if the component throws an ArcObjects exception.
 */
@Override
public void onClick() throws IOException, AutomationException {
    // TODO Auto-generated method stub
    
    
    MapBean mapBean = new MapBean();
    try{
        IMap map = mapBean.getMap();
        ISelection selection = map.getFeatureSelection();
        IEnumFeature enumFeature = (IEnumFeature)selection;
        enumFeature.reset();
        IFeature feature = enumFeature.next();
        while (feature != null){
            System.out.println("FEATURE ID: " + feature.getOID());
            feature = enumFeature.next();
        }
    }
    catch (Exception e){
        e.printStackTrace();
    }
    }
}   

I implimented the button on ArcMap but nothing seems to work onclick event , might be its not getting the ArcMap at all.Could anybody tell how to resolve this issue.

Thanks in advance////

I am building a custom arcMap Addin button which onclick event tells info about selected features.

Following is my java class ---

public class Break extends Button {

/**
 * Called when the button is clicked.
 * 
 * @exception java.io.IOException if there are interop problems.
 * @exception com.esri.arcgis.interop.AutomationException if the component throws an ArcObjects exception.
 */
@Override
public void onClick() throws IOException, AutomationException {
    // TODO Auto-generated method stub
    
    
    MapBean mapBean = new MapBean();
    try{
        IMap map = mapBean.getMap();
        ISelection selection = map.getFeatureSelection();
        IEnumFeature enumFeature = (IEnumFeature)selection;
        enumFeature.reset();
        IFeature feature = enumFeature.next();
        while (feature != null){
            System.out.println("FEATURE ID: " + feature.getOID());
            feature = enumFeature.next();
        }
    }
    catch (Exception e){
        e.printStackTrace();
    }
    }
}   

I implimented the button on ArcMap but nothing seems to work onclick event , might be its not getting the ArcMap at all.Could anybody tell how to resolve this issue.

Thanks in advance////

edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Source Link
NewBee
  • 157
  • 2
  • 12
Loading