public void mousePressed(MouseEvent me) { try { mxDoc = (IMxDocument) app.getDocument(); IActiveView pactiveView = mxDoc.getActivatedView(); IMap pMap = pactiveView.getFocusMap(); MapSelection iefeature = (MapSelection) pMap.getFeatureSelection(); IFeature ifeature = iefeature.next(); while(ifeature != null) { int oid = ifeature.getOID(); list.add(oid); ifeature = iefeature.next(); } JOptionPane.showMessageDialog(null,"Found :"+ list.size()); mxDoc.getActiveView().refresh(); } catch(Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, "Error :"+ex); } }
IEnumFeature works on all of the FeatureLayers as a whole. Each FeatureLayer has a ISelectionSet and IEnumFeature steps through all of these as though there was only one. Because IEnumFeature works with all the FeatureLayers, you cannot use it to loop through the features belonging to just one FeatureLayer.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.