protected void setCursor(int sideName) { Cursor cursor = null; switch (sideName) { case NONE: cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); break; case NORTH: cursor = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR); break; case SOUTH: cursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); break; case EAST: cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); break; case WEST: cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR); break; case NORTHWEST: cursor = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR); break; case NORTHEAST: cursor = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR); break; case SOUTHWEST: cursor = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR); break; case SOUTHEAST: cursor = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR); break; } this.setCursor(cursor); }
protected Cursor selectResizeCursor(Angle azimuth) { while (azimuth.degrees < 0) azimuth = azimuth.addDegrees(360); if (azimuth.degrees < 22.5) return Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR); else if (azimuth.degrees < 67.5) return Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR); else if (azimuth.degrees < 112.5) return Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); else if (azimuth.degrees < 157.5) return Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR); else if (azimuth.degrees < 202.5) return Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); else if (azimuth.degrees < 247.5) return Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR); else if (azimuth.degrees < 292.5) return Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR); else if (azimuth.degrees < 337.5) return Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR); else // if (azimuth.degrees < 360) return Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR); }
protected void setCursor(MeasureTool.ControlPoint controlPoint) { // TODO: handle 'rotating' mode cursor is this.isRotating() - when using Alt key on regular // shapes if (controlPoint == null) { setComponentCursor(null); } else { if (this.measureTool.isRegularShape()) { if (this.measureTool.isCornerControl(controlPoint)) { Angle azimuth = LatLon.greatCircleAzimuth( controlPoint.getPosition(), this.measureTool.getCenterPosition()); // Account for view heading in cursor selection azimuth = azimuth.subtract(this.measureTool.getWwd().getView().getHeading()); setComponentCursor(selectResizeCursor(azimuth)); } else if (this.measureTool.isCenterControl(controlPoint)) { setComponentCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); } } else { // Line, path and polygon setComponentCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); } } }
public void enable() { this.getShape().setStartPosition(null); LayerList layers = this.getWwd().getModel().getLayers(); if (!layers.contains(this.getLayer())) layers.add(this.getLayer()); if (!this.getLayer().isEnabled()) this.getLayer().setEnabled(true); this.setArmed(true); this.getWwd().addRenderingListener(this); this.getWwd().addSelectListener(this); this.getWwd().getInputHandler().addMouseListener(this); this.getWwd().getInputHandler().addMouseMotionListener(this); this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); }
protected void setComponentCursor(Cursor cursor) { ((Component) this.measureTool.getWwd()) .setCursor(cursor != null ? cursor : Cursor.getDefaultCursor()); }