예제 #1
0
 /** updates geometry with current ({@link #spArc}) arc */
 private void applyArc() {
   List<Point> points = drawingPane.getDrawObjectsAsGeoPoints();
   if (points.size() > 2) {
     double d = GeometryUtils.distance(points.get(1).getPosition(), points.get(0).getPosition());
     Point p =
         GeometryUtils.vectorByAngle(
             points.get(1), points.get(0), d, Math.toRadians(getArc()), false);
     points.set(2, p);
     digitizerModule.getMapModule().update();
   }
 }
예제 #2
0
 @Override
 public void dispose() {
   digitizerModule.setDigitizingAction(null);
   if (drawingPane != null && drawingPane.getDrawObjectsAsGeoPoints() != null) {
     drawingPane.getDrawObjectsAsGeoPoints().clear();
   }
   digitizerModule.resetDigitizerPane();
   digitizerModule.resetFunctionSelect();
   digitizerModule.getMapModule().update();
   super.dispose();
 }
예제 #3
0
  /** updates geometry with current ({@link #spArcRadius}) radius */
  private void applyRadius() {
    List<Point> points = drawingPane.getDrawObjectsAsGeoPoints();
    if (points.size() > 2) {
      // calculate new end point for first vector
      double[] lineParam =
          LineUtils.getLineFromPoints(
              points.get(0).getX(), points.get(0).getY(),
              points.get(1).getX(), points.get(1).getY());
      Pair<Position, Position> pair1 =
          LineUtils.getSymmetricPoints(
              points.get(0).getX(), points.get(0).getY(), lineParam[0], getRadius());

      // calculate new end point for second vector
      lineParam =
          LineUtils.getLineFromPoints(
              points.get(0).getX(), points.get(0).getY(),
              points.get(2).getX(), points.get(2).getY());
      Pair<Position, Position> pair2 =
          LineUtils.getSymmetricPoints(
              points.get(0).getX(), points.get(0).getY(), lineParam[0], getRadius());
      // must check to ensure correct direction
      if (points.get(1).getX() >= points.get(0).getX()) {
        points.set(
            1, GeometryFactory.createPoint(pair1.first, points.get(0).getCoordinateSystem()));
      } else {
        points.set(
            1, GeometryFactory.createPoint(pair1.second, points.get(0).getCoordinateSystem()));
      }
      if (points.get(2).getX() >= points.get(0).getX()) {
        points.set(
            2, GeometryFactory.createPoint(pair2.first, points.get(0).getCoordinateSystem()));
      } else {
        points.set(
            2, GeometryFactory.createPoint(pair2.second, points.get(0).getCoordinateSystem()));
      }
      digitizerModule.getMapModule().update();
    }
  }