Ignore:
Timestamp:
2014-08-14T11:27:38+02:00 (10 years ago)
Author:
Don-vip
Message:

code cleanup, javadoc update

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java

    r7391 r7392  
    1616import org.openstreetmap.josm.tools.MultiMap;
    1717
    18 public class MultipolygonCreate {
     18/**
     19 * Helper class to build multipolygons from multiple ways.
     20 * @author viesturs
     21 * @since 7392 (rename)
     22 * @since 3704
     23 */
     24public class MultipolygonBuilder {
    1925
    2026    /**
    2127     * Represents one polygon that consists of multiple ways.
    22      * @author Viesturs
    23      *
    2428     */
    2529    public static class JoinedPolygon {
     
    2933        public final Area area;
    3034
     35        /**
     36         * Constructs a new {@code JoinedPolygon} from given list of ways.
     37         * @param ways The ways used to build joined polygon
     38         */
    3139        public JoinedPolygon(List<Way> ways, List<Boolean> reversed) {
    3240            this.ways = ways;
     
    5563                boolean reversed = this.reversed.get(waypos).booleanValue();
    5664
    57                 if (!reversed){
     65                if (!reversed) {
    5866                    for (int pos = 0; pos < way.getNodesCount() - 1; pos++) {
    5967                        nodes.add(way.getNode(pos));
     
    7179    }
    7280
    73 
    7481    /**
    7582     * Helper storage class for finding findOuterWays
    76      * @author viesturs
    7783     */
    7884    static class PolygonLevel {
     
    8995    }
    9096
    91     public List<JoinedPolygon> outerWays;
    92     public List<JoinedPolygon> innerWays;
    93 
    94     public MultipolygonCreate(List<JoinedPolygon> outerWays, List<JoinedPolygon> innerWays){
     97    /** List of outer ways **/
     98    public final List<JoinedPolygon> outerWays;
     99    /** List of inner ways **/
     100    public final List<JoinedPolygon> innerWays;
     101
     102    /**
     103     * Constructs a new {@code MultipolygonBuilder} initialized with given ways.
     104     * @param outerWays The outer ways
     105     * @param innerWays The inner ways
     106     */
     107    public MultipolygonBuilder(List<JoinedPolygon> outerWays, List<JoinedPolygon> innerWays) {
    95108        this.outerWays = outerWays;
    96109        this.innerWays = innerWays;
    97110    }
    98111
    99     public MultipolygonCreate(){
     112    /**
     113     * Constructs a new empty {@code MultipolygonBuilder}.
     114     */
     115    public MultipolygonBuilder() {
    100116        this.outerWays = new ArrayList<>(0);
    101117        this.innerWays = new ArrayList<>(0);
     
    122138     */
    123139    public static class JoinedPolygonCreationException extends RuntimeException {
     140        /**
     141         * Constructs a new {@code JoinedPolygonCreationException}.
     142         * @param message the detail message. The detail message is saved for
     143         *                later retrieval by the {@link #getMessage()} method
     144         */
    124145        public JoinedPolygonCreationException(String message) {
    125146            super(message);
     
    159180        //process unclosed ways
    160181        for (Way startWay: ways) {
    161             if (usedWays.contains(startWay)){
     182            if (usedWays.contains(startWay)) {
    162183                continue;
    163184            }
     
    191212
    192213                Way nextWay = null;
    193                 for(Way way: adjacentWays){
    194                     if (way != curWay){
     214                for(Way way: adjacentWays) {
     215                    if (way != curWay) {
    195216                        nextWay = way;
    196217                    }
     
    217238        List<PolygonLevel> list = findOuterWaysRecursive(0, polygons);
    218239
    219         if (list == null){
     240        if (list == null) {
    220241            return tr("There is an intersection between ways.");
    221242        }
    222243
    223         this.outerWays = new ArrayList<>(0);
    224         this.innerWays = new ArrayList<>(0);
     244        this.outerWays.clear();
     245        this.innerWays.clear();
    225246
    226247        //take every other level
     
    265286                    innerCandidates.add(innerWay);
    266287                }
    267                 else if (intersection == PolygonIntersection.CROSSING)
    268                 {
     288                else if (intersection == PolygonIntersection.CROSSING) {
    269289                    //ways intersect
    270290                    return null;
Note: See TracChangeset for help on using the changeset viewer.