private void onZoomToRouteButtonDo() { if (this.pluginContext != null) { // GeometryFactory geoFactory = new GeometryFactory(); ArrayList<Geometry> geoArrayList = new ArrayList<Geometry>(); if (this.infoRoutesStretchBeansCollection != null && !this.infoRoutesStretchBeansCollection.isEmpty()) { Iterator<InfoRouteStretchBean> it = this.infoRoutesStretchBeansCollection.iterator(); while (it.hasNext()) { InfoRouteStretchBean actualStretchBean = it.next(); if (actualStretchBean != null && actualStretchBean.getGeometries() != null && !actualStretchBean.getGeometries().isEmpty()) { geoArrayList.addAll(actualStretchBean.getGeometries()); } } } // GeometryCollection geoCollection = new GeometryCollection(geoArrayList.toArray(new // Geometry[geoArrayList.size()]), geoFactory); try { zoomToSelectedItemsPlugIn.zoom(geoArrayList, pluginContext.getLayerViewPanel()); } catch (NoninvertibleTransformException e) { e.printStackTrace(); ErrorDialog.show( null, "Error resaltar la ruta", I18N.get( "routedescription", "routeengine.route.description.error.route.not.zoom.message"), StringUtil.stackTrace(e)); } } }
private void onInfoRouteListeMouseClicked() { Object value = null; try { value = infoRouteJList.getSelectedValue(); ArrayList<Geometry> geoArrayList = new ArrayList<Geometry>(); if (value != null && value instanceof InfoRouteStretchBean) { InfoRouteStretchBean actualStretchBean = (InfoRouteStretchBean) value; if (actualStretchBean != null && actualStretchBean.getGeometries() != null && !actualStretchBean.getGeometries().isEmpty()) { geoArrayList.addAll(actualStretchBean.getGeometries()); } if (value instanceof TurnRouteStreetchBean) { GeometryFactory geoFactory = new GeometryFactory(); if (((TurnRouteStreetchBean) value).getTurnNode() != null) { geoArrayList.add( geoFactory.createPoint( ((XYNode) ((TurnRouteStreetchBean) value).getTurnNode()).getCoordinate())); } } zoomToSelectedItemsPlugIn.zoom(geoArrayList, pluginContext.getLayerViewPanel()); } } catch (Exception ex) { ex.printStackTrace(); ErrorDialog.show( null, "Error resaltar un tramo de la ruta.", I18N.get( "routedescription", "routeengine.route.description.error.route.not.zoom.message"), StringUtil.stackTrace(ex)); } }