use of com.revolsys.swing.map.MapPanel in project com.revolsys.open by revolsys.
the class EditRecordGeometryOverlay method modeEditGeometryVerticesMove.
protected boolean modeEditGeometryVerticesMove(final MouseEvent event) {
if (canOverrideOverlayAction(ACTION_EDIT_GEOMETRY_VERTICES) || isOverlayAction(ACTION_MOVE_GEOMETRY)) {
final double scale = getViewportScale();
final List<CloseLocation> closeLocations = new ArrayList<>();
final MapPanel map = getMap();
for (final CloseLocation location : map.getCloseSelectedLocations()) {
final AbstractRecordLayer layer = location.getLayer();
if (layer.isEditable(scale)) {
closeLocations.add(location);
}
}
if (closeLocations.isEmpty()) {
modeMoveGeometryClear();
modeEditGeometryVerticesClear();
} else if (event.isAltDown()) {
setOverlayAction(ACTION_MOVE_GEOMETRY);
} else {
setOverlayAction(ACTION_EDIT_GEOMETRY_VERTICES);
}
return setMouseOverLocations(closeLocations);
}
return false;
}
use of com.revolsys.swing.map.MapPanel in project com.revolsys.open by revolsys.
the class EditRecordGeometryOverlay method updateMouseOverLocations.
private boolean updateMouseOverLocations() {
final MapPanel map = getMap();
if (hasMouseOverLocation()) {
if (isOverlayAction(ACTION_MOVE_GEOMETRY)) {
map.clearToolTipText();
} else {
final Map<String, Set<CloseLocation>> vertexLocations = new TreeMap<>();
final Map<String, Set<CloseLocation>> segmentLocations = new TreeMap<>();
for (final CloseLocation location : getMouseOverLocations()) {
final String typePath = location.getLayerPath();
if (location.getVertexId() == null) {
Maps.addToSet(segmentLocations, typePath, location);
} else {
Maps.addToSet(vertexLocations, typePath, location);
}
}
final StringBuilder text = new StringBuilder("<html>");
appendLocations(text, "Move Vertices", vertexLocations);
appendLocations(text, "Insert Vertices", segmentLocations);
text.append("</html>");
final Point2D eventPoint = getEventPosition();
map.setToolTipText(eventPoint, text);
}
return true;
} else {
map.clearToolTipText();
return false;
}
}
Aggregations