src/main/java/org/a05annex/util/geo2d/KochanekBartelsSpline.java
@SuppressWarnings("unchecked")
    public boolean savePath(@NotNull String filename) {
        JSONObject path = new JSONObject();
        path.put(TITLE, m_title);
        path.put(DESCRIPTION, m_description);
        path.put(SPEED_MULTIPLIER, m_speedMultiplier);
        JSONArray controlPoints = new JSONArray();
        path.put(CONTROL_POINTS, controlPoints);
        for (ControlPoint pt : getControlPoints()) {
            controlPoints.add(pt.toJSON());
        }
        //Write JSON file
        try (FileWriter file = new FileWriter(filename)) {
            file.write(path.toJSONString());
            file.flush();
            return true;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return false;
    }
/**
     * Save the path to a {@code .json} path file.
     *
     * @param filename (String, not null) The filename the path will be written to.
     * @return {@code true} if the path was successfully saved, {@code false} otherwise.
     */
Save the path to a  .json path file.
@param filename (String, not null) The filename the path will be written to.
@return  true if the path was successfully saved,  false otherwise.
Save the path to a . json path file . @param filename ( String not null ) The filename the path will be written to . @return true if the path was successfully saved false otherwise .
@SuppressWarnings("unchecked")
    public boolean savePath(@NotNull String filename) {
        JSONObject path = new JSONObject();
        path.put(TITLE, m_title);
        path.put(DESCRIPTION, m_description);
        path.put(SPEED_MULTIPLIER, m_speedMultiplier);
        JSONArray controlPoints = new JSONArray();
        path.put(CONTROL_POINTS, controlPoints);
        for (ControlPoint pt : getControlPoints()) {
            controlPoints.add(pt.toJSON());
        }
        try (FileWriter file = new FileWriter(filename)) {
            file.write(path.toJSONString());
            file.flush();
            return true;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return false;
    }
@ SuppressWarnings ( "unchecked" ) public boolean savePath ( @ NotNull String filename ) { JSONObject path = new JSONObject ( ) ; path . put ( TITLE , m_title ) ; path . put ( DESCRIPTION , m_description ) ; path . put ( SPEED_MULTIPLIER , m_speedMultiplier ) ; JSONArray controlPoints = new JSONArray ( ) ; path . put ( CONTROL_POINTS , controlPoints ) ; for ( ControlPoint pt : getControlPoints ( ) ) { controlPoints . add ( pt . toJSON ( ) ) ; } try ( FileWriter file = new FileWriter ( filename ) ) { file . write ( path . toJSONString ( ) ) ; file . flush ( ) ; return true ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return false ; }
Save the path to a {@code .json} path file.
Save the path to a { @code . json } path file .
//Write JSON file