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 onInfoRouteListMosueOver(Point point) { Object value = null; try { int pos = infoRouteJList.locationToIndex(point); value = ((DefaultListModel) infoRouteJList.getModel()).get(pos); if (value != null && value instanceof InfoRouteStretchBean) { InfoRouteStretchBean actualStretchBean = (InfoRouteStretchBean) value; ArrayList<Geometry> geoArrayList = new ArrayList<Geometry>(); 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())); } } GeometryFactory geoFactory = new GeometryFactory(); GeometryCollection geoCollection = new GeometryCollection( geoArrayList.toArray(new Geometry[geoArrayList.size()]), geoFactory); pluginContext.getLayerViewPanel().flash(geoCollection); try { // Component comp = getInfoListPanel().getComponentAt(point); // if (comp != null){ // comp.setBackground(Color.LIGHT_GRAY); // comp.setForeground(Color.RED); // } } catch (Exception e) { e.printStackTrace(); } } } 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)); } }
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)); } }