Changeset 13807 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2018-05-21T19:34:43+02:00 (6 years ago)
Author:
Don-vip
Message:

define getDataSet() in IPrimitive, tune Geometry methods signatures

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

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

    r13806 r13807  
    417417     */
    418418    List<? extends IPrimitive> getReferrers();
     419
     420    /**
     421     * Returns the parent data set of this primitive.
     422     * @return OsmData this primitive is part of.
     423     */
     424    OsmData<?, ?, ?, ?> getDataSet();
    419425}
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r13806 r13807  
    237237    }
    238238
    239     /**
    240      *
    241      * @return DataSet this primitive is part of.
    242      */
     239    @Override
    243240    public DataSet getDataSet() {
    244241        return dataSet;
  • trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java

    r13806 r13807  
    176176
    177177    @Override
     178    public OsmData<?, ?, ?, ?> getDataSet() {
     179        return null;
     180    }
     181
     182    @Override
    178183    public StyleCache getCachedStyle() {
    179184        return null;
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r13805 r13807  
    571571    /**
    572572     * Tests if two polygons intersect.
    573      * @param <N> type of node
    574573     * @param first List of nodes forming first polygon
    575574     * @param second List of nodes forming second polygon
    576575     * @return intersection kind
    577576     */
    578     public static <N extends INode> PolygonIntersection polygonIntersection(List<N> first, List<N> second) {
     577    public static PolygonIntersection polygonIntersection(List<? extends INode> first, List<? extends INode> second) {
    579578        Area a1 = getArea(first);
    580579        Area a2 = getArea(second);
     
    620619    /**
    621620     * Tests if point is inside a polygon. The polygon can be self-intersecting. In such case the contains function works in xor-like manner.
    622      * @param <N> type of node
    623621     * @param polygonNodes list of nodes from polygon path.
    624622     * @param point the point to test
    625623     * @return true if the point is inside polygon.
    626624     */
    627     public static <N extends INode> boolean nodeInsidePolygon(N point, List<N> polygonNodes) {
     625    public static boolean nodeInsidePolygon(INode point, List<? extends INode> polygonNodes) {
    628626        if (polygonNodes.size() < 2)
    629627            return false;
    630628
    631629        //iterate each side of the polygon, start with the last segment
    632         N oldPoint = polygonNodes.get(polygonNodes.size() - 1);
     630        INode oldPoint = polygonNodes.get(polygonNodes.size() - 1);
    633631
    634632        if (!oldPoint.isLatLonKnown()) {
     
    637635
    638636        boolean inside = false;
    639         N p1, p2;
    640 
    641         for (N newPoint : polygonNodes) {
     637        INode p1, p2;
     638
     639        for (INode newPoint : polygonNodes) {
    642640            //skip duplicate points
    643641            if (newPoint.equals(oldPoint)) {
     
    943941     * @return {@code true} if the node is inside the multipolygon
    944942     */
    945     public static boolean isNodeInsideMultiPolygon(Node node, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) {
     943    public static boolean isNodeInsideMultiPolygon(INode node, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) {
    946944        return isPolygonInsideMultiPolygon(Collections.singletonList(node), multiPolygon, isOuterWayAMatch);
    947945    }
     
    957955     * @return {@code true} if the polygon formed by nodes is inside the multipolygon
    958956     */
    959     public static boolean isPolygonInsideMultiPolygon(List<Node> nodes, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) {
     957    public static boolean isPolygonInsideMultiPolygon(List<? extends INode> nodes, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) {
    960958        // Extract outer/inner members from multipolygon
    961959        final Pair<List<JoinedPolygon>, List<JoinedPolygon>> outerInner;
Note: See TracChangeset for help on using the changeset viewer.