Hi,

To zoom on the selected feature, you may also use lower level function.

You can access to viewport through
WorkbenchContext -> LayerViewPanel -> Viewport

then use the zoom method

Michaël

Check

i think i didn't get what u said.
i have to run the execute method of ZoomtoSelectedItemsPlugin?
ok here's the code of my plugin (the execute method):


public boolean execute(final PlugInContext context) throws Exception {
reportNothingToUndoYet(context);
Layer layer=context.getSelectedLayer(0);
final ZoomToSelectedItemsPlugIn zoomToSelectedItemsPlugIn= new ZoomToSelectedItemsPlugIn(); final List<BasicFeature> list =layer.getFeatureCollectionWrapper().getFeatures();
 List<String> attributeValues = new ArrayList<String>();
for(BasicFeature basicFeature : list) {
  String indice =basicFeature.getString("indice");
if(!attributeValues.contains(indice)) attributeValues.add(indice);
  }
// searchCadastre is the GUI class that contains 2 //comboBox (nature and indice) and 2 text Field (num and //complement)
final SearchCadastre searchCadastre =new SearchCadastre();
ComboBoxModel comboBoxModel=new DefaultComboBoxModel(attributeValues.toArray());
searchCadastre.getCmbIndice().setModel(comboBoxModel);
searchCadastre.getBtnRecherche().addActionListener(new ActionListener() {
 public void actionPerformed(ActionEvent e) {
// here on action it must get the basicFeature if found, and zoom into it
 try {

// am stack here
zoomToSelectedItemsPlugIn.zoom(
 context.getLayerViewPanel().getSelectionManager().getSelectedItems(),
   context.getLayerViewPanel());
} catch (NoninvertibleTransformException e1) {
e1.printStackTrace();
}

 }

private BasicFeature search() {
for(BasicFeature basicFeature : list) {
// here searching for the basicFeature that have the same attribute that one's given bythe user if ( searchCadastre.getCmbIndice().getSelectedItem().equals(basicFeature.getString("indice") ) && searchCadastre.getCmbNature().getSelectedItem().equals(basicFeature.getString("nature")) && searchCadastre.getTxtNum().getText().equals(basicFeature.getString("num")) && searchCadastre.getTxtComplement().getText().equals(basicFeature.getString("complement")) )
return basicFeature;
   }
return null;
}

} );

context.getWorkbenchFrame().addInternalFrame(searchCadastre);
return true;
}

--
*Asma OUQALLI*

Élève ingénieur : 3ème  Sciences d'Information Géographique (SIG).
Chef de commission développement professionnel  - Rotaract EHTP.
Chef de cellule Media - Olympiades EHTP 2012.
  Ecole Hassania des Travaux Publics.
   Mobile : +212 672 48 23 15.
   Email : asma.ouqa...@gmail.com <mailto:asma.ouqa...@gmail.com>



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb


_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to