/** DOCUMENT ME! */ private void zoomToBadFeature() { final Feature badGeomFeature = getBadGeomFeature(); final Collection<Feature> aFeatureCollection = new ArrayList<Feature>(); aFeatureCollection.add(badGeomFeature); aFeatureCollection.add(getFeature()); // TODO boundingbox MAPPING_COMPONENT.zoomToAFeatureCollection( aFeatureCollection, false, MAPPING_COMPONENT.isFixedMapScale()); }
/** * DOCUMENT ME! * * @param value DOCUMENT ME! */ private void setPointValue(final double value) { if (isEditable()) { if (LOG.isDebugEnabled()) { LOG.debug("change bean value to " + value); } final CidsBean pointBean = getCidsBean(); final double oldValue = LinearReferencingHelper.getLinearValueFromStationBean(pointBean); if (oldValue != value) { try { if (!isFeatureChangeLocked()) { MAPPING_COMPONENT.getFeatureCollection().select(getFeature()); } if (!isBeanChangeLocked()) { LinearReferencingHelper.setLinearValueToStationBean( (double) Math.round(value), pointBean); } } catch (Exception ex) { if (LOG.isDebugEnabled()) { LOG.debug("error changing bean", ex); } } } else { if (LOG.isDebugEnabled()) { LOG.debug("no changes needed, old value was " + oldValue); } } } }
/** DOCUMENT ME! */ private void switchBadGeomVisibility() { if (isEditable()) { final Feature badGeomFeature = getBadGeomFeature(); final Feature pointFeature = getFeature(); final boolean selected = getBadGeomButton().isSelected(); if (selected) { boundingbox = (XBoundingBox) MAPPING_COMPONENT.getCurrentBoundingBox(); MAPPING_COMPONENT.getFeatureCollection().addFeature(badGeomFeature); MAPPING_COMPONENT.getFeatureCollection().select(pointFeature); zoomToBadFeature(); } else { MAPPING_COMPONENT.getFeatureCollection().removeFeature(badGeomFeature); MAPPING_COMPONENT.gotoBoundingBoxWithoutHistory(boundingbox); } getBadGeomCorrectButton().setVisible(selected); } }
/** * DOCUMENT ME! * * @param routeBean DOCUMENT ME! * @return DOCUMENT ME! */ private double getPointInCurrentBB(final CidsBean routeBean) { // Geometrie für BoundingBox erzeugen final XBoundingBox boundingBox = (XBoundingBox) MAPPING_COMPONENT.getCurrentBoundingBox(); final Collection<Coordinate> coordinates = new ArrayList<Coordinate>(); coordinates.add(new Coordinate(boundingBox.getX1(), boundingBox.getY1())); coordinates.add(new Coordinate(boundingBox.getX2(), boundingBox.getY1())); coordinates.add(new Coordinate(boundingBox.getX2(), boundingBox.getY2())); coordinates.add(new Coordinate(boundingBox.getX1(), boundingBox.getY2())); coordinates.add(new Coordinate(boundingBox.getX1(), boundingBox.getY1())); final GeometryFactory gf = new GeometryFactory(); final LinearRing shell = gf.createLinearRing(coordinates.toArray(new Coordinate[coordinates.size()])); final Polygon boundingBoxGeom = gf.createPolygon(shell, new LinearRing[0]); // Testen, ob Punkt 0 in der BoundingBox liegt final Geometry routeGeom = (Geometry) routeBean.getProperty(PROP_ROUTE_GEOM + "." + PROP_GEOM_GEOFIELD); final Geometry pointZero = LinearReferencedPointFeature.getPointOnLine(0d, routeGeom); if (pointZero.within(boundingBoxGeom)) { return 0d; } else { // niedrigster Stationierungswert, der die Boundingbox schneidet, bestimmen final LineString boundingBoxLineGeom = gf.createLineString(coordinates.toArray(new Coordinate[coordinates.size()])); double bestPosition = 0; // Coordinaten durchlaufen und anhand der Position auf der Linie sortieren final Geometry intersectionGeom = routeGeom.intersection(boundingBoxLineGeom); for (final Coordinate coord : intersectionGeom.getCoordinates()) { final double position = LinearReferencedPointFeature.getPositionOnLine(coord, routeGeom); if (bestPosition == 0) { bestPosition = position; } else if (position < bestPosition) { bestPosition = position; } } return bestPosition; } }
/** DOCUMENT ME! */ private void cleanup() { final CidsBean pointBean = getCidsBean(); if (pointBean != null) { pointBean.removePropertyChangeListener(getCidsBeanListener()); } if (isEditable()) { if (pointBean != null) { // altes feature entfernen final LinearReferencedPointFeature oldFeature = FEATURE_REGISTRY.removeStationFeature(pointBean); if (oldFeature != null) { // listener auf altem Feature entfernen oldFeature.removeListener(getFeatureListener()); } FEATURE_REGISTRY.removeListener(pointBean, getMapRegistryListener()); } final Feature badGeomFeature = getBadGeomFeature(); if (badGeomFeature != null) { // badgeomfeature entfernen. MAPPING_COMPONENT.getFeatureCollection().removeFeature(badGeomFeature); setBadGeomFeature(null); } } setInited(false); if (isEditable()) { // auf startzustand setzen => hinzufügenpanel anzeigen showCard(Card.add); } else { setErrorMsg("keine Station zugewiesen"); showCard(Card.error); } }