• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Location类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vividsolutions.jts.geom.Location的典型用法代码示例。如果您正苦于以下问题:Java Location类的具体用法?Java Location怎么用?Java Location使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Location类属于com.vividsolutions.jts.geom包,在下文中一共展示了Location类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: computeIntersectionNodes

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * Insert nodes for all intersections on the edges of a Geometry.
     * Label the created nodes the same as the edge label if they do not already have a label.
     * This allows nodes created by either self-intersections or
     * mutual intersections to be labelled.
     * Endpoint nodes will already be labelled from when they were inserted.
     */
    private void computeIntersectionNodes(int argIndex) {
        for (Iterator i = this.arg[argIndex].getEdgeIterator(); i.hasNext(); ) {
            Edge e = (Edge) i.next();
            int eLoc = e.getLabel().getLocation(argIndex);
            for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
                EdgeIntersection ei = (EdgeIntersection) eiIt.next();
                RelateNode n = (RelateNode) this.nodes.addNode(ei.coord);
                if (eLoc == Location.BOUNDARY) {
                    n.setLabelBoundary(argIndex);
                } else {
                    if (n.getLabel().isNull(argIndex)) {
                        n.setLabel(argIndex, Location.INTERIOR);
                    }
                }
//Debug.println(n);
            }
        }
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:26,代码来源:RelateComputer.java


示例2: labelIntersectionNodes

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * For all intersections on the edges of a Geometry,
     * label the corresponding node IF it doesn't already have a label.
     * This allows nodes created by either self-intersections or
     * mutual intersections to be labelled.
     * Endpoint nodes will already be labelled from when they were inserted.
     */
    private void labelIntersectionNodes(int argIndex) {
        for (Iterator i = this.arg[argIndex].getEdgeIterator(); i.hasNext(); ) {
            Edge e = (Edge) i.next();
            int eLoc = e.getLabel().getLocation(argIndex);
            for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
                EdgeIntersection ei = (EdgeIntersection) eiIt.next();
                RelateNode n = (RelateNode) this.nodes.find(ei.coord);
                if (n.getLabel().isNull(argIndex)) {
                    if (eLoc == Location.BOUNDARY) {
                        n.setLabelBoundary(argIndex);
                    } else {
                        n.setLabel(argIndex, Location.INTERIOR);
                    }
                }
//n.print(System.out);
            }
        }
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:26,代码来源:RelateComputer.java


示例3: computeIntersectionNodes

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * Insert nodes for all intersections on the edges of a Geometry.
     * Label the created nodes the same as the edge label if they do not already have a label.
     * This allows nodes created by either self-intersections or
     * mutual intersections to be labelled.
     * Endpoint nodes will already be labelled from when they were inserted.
     * <p>
     * Precondition: edge intersections have been computed.
     */
    public void computeIntersectionNodes(GeometryGraph geomGraph, int argIndex) {
        for (Iterator edgeIt = geomGraph.getEdgeIterator(); edgeIt.hasNext(); ) {
            Edge e = (Edge) edgeIt.next();
            int eLoc = e.getLabel().getLocation(argIndex);
            for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
                EdgeIntersection ei = (EdgeIntersection) eiIt.next();
                RelateNode n = (RelateNode) this.nodes.addNode(ei.coord);
                if (eLoc == Location.BOUNDARY) {
                    n.setLabelBoundary(argIndex);
                } else {
                    if (n.getLabel().isNull(argIndex)) {
                        n.setLabel(argIndex, Location.INTERIOR);
                    }
                }
//Debug.println(n);
            }
        }
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:28,代码来源:RelateNodeGraph.java


示例4: computeLabel

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
 * This computes the overall edge label for the set of
 * edges in this EdgeStubBundle.  It essentially merges
 * the ON and side labels for each edge.  These labels must be compatible
 */
@Override
public void computeLabel(BoundaryNodeRule boundaryNodeRule) {
    // create the label.  If any of the edges belong to areas,
    // the label must be an area label
    boolean isArea = false;
    for (Iterator it = this.iterator(); it.hasNext(); ) {
        EdgeEnd e = (EdgeEnd) it.next();
        if (e.getLabel().isArea()) {
            isArea = true;
        }
    }
    if (isArea) {
        this.label = new Label(Location.NONE, Location.NONE, Location.NONE);
    } else {
        this.label = new Label(Location.NONE);
    }

    // compute the On label, and the side labels if present
    for (int i = 0; i < 2; i++) {
        this.computeLabelOn(i, boundaryNodeRule);
        if (isArea) {
            this.computeLabelSides(i);
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:31,代码来源:EdgeEndBundle.java


示例5: visitInteriorRing

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
private void visitInteriorRing(LineString ring, PlanarGraph graph) {
    Coordinate[] pts = ring.getCoordinates();
    Coordinate pt0 = pts[0];
    /**
     * Find first point in coord list different to initial point.
     * Need special check since the first point may be repeated.
     */
    Coordinate pt1 = findDifferentPoint(pts, pt0);
    Edge e = graph.findEdgeInSameDirection(pt0, pt1);
    DirectedEdge de = (DirectedEdge) graph.findEdgeEnd(e);
    DirectedEdge intDe = null;
    if (de.getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
        intDe = de;
    } else if (de.getSym().getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
        intDe = de.getSym();
    }
    Assert.isTrue(intDe != null, "unable to find dirEdge with Interior on RHS");

    this.visitLinkedDirectedEdges(intDe);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:21,代码来源:ConnectedInteriorTester.java


示例6: isResultOfOp

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
 * This method will handle arguments of Location.NONE correctly
 *
 * @return true if the locations correspond to the opCode
 */
public static boolean isResultOfOp(int loc0, int loc1, int opCode) {
    if (loc0 == Location.BOUNDARY) {
        loc0 = Location.INTERIOR;
    }
    if (loc1 == Location.BOUNDARY) {
        loc1 = Location.INTERIOR;
    }
    switch (opCode) {
        case INTERSECTION:
            return loc0 == Location.INTERIOR
                    && loc1 == Location.INTERIOR;
        case UNION:
            return loc0 == Location.INTERIOR
                    || loc1 == Location.INTERIOR;
        case DIFFERENCE:
            return loc0 == Location.INTERIOR
                    && loc1 != Location.INTERIOR;
        case SYMDIFFERENCE:
            return (loc0 == Location.INTERIOR && loc1 != Location.INTERIOR)
                    || (loc0 != Location.INTERIOR && loc1 == Location.INTERIOR);
    }
    return false;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:29,代码来源:OverlayOp.java


示例7: locate

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
 * Computes the topological relationship ({@link Location}) of a single point
 * to a Geometry.
 * It handles both single-element
 * and multi-element Geometries.
 * The algorithm for multi-part Geometries
 * takes into account the SFS Boundary Determination Rule.
 *
 * @return the {@link Location} of the point relative to the input Geometry
 */
public int locate(Coordinate p, Geometry geom) {
    if (geom.isEmpty()) {
        return Location.EXTERIOR;
    }

    if (geom instanceof LineString) {
        return this.locate(p, (LineString) geom);
    } else if (geom instanceof Polygon) {
        return this.locate(p, (Polygon) geom);
    }

    this.isIn = false;
    this.numBoundaries = 0;
    this.computeLocation(p, geom);
    if (this.boundaryRule.isInBoundary(this.numBoundaries)) {
        return Location.BOUNDARY;
    }
    if (this.numBoundaries > 0 || this.isIn) {
        return Location.INTERIOR;
    }

    return Location.EXTERIOR;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:34,代码来源:PointLocator.java


示例8: computeLabelling

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * Compute the labelling for all dirEdges in this star, as well
     * as the overall labelling
     */
    @Override
    public void computeLabelling(GeometryGraph[] geom) {
//Debug.print(this);
        super.computeLabelling(geom);

        // determine the overall labelling for this DirectedEdgeStar
        // (i.e. for the node it is based at)
        this.label = new Label(Location.NONE);
        for (Iterator it = this.iterator(); it.hasNext(); ) {
            EdgeEnd ee = (EdgeEnd) it.next();
            Edge e = ee.getEdge();
            Label eLabel = e.getLabel();
            for (int i = 0; i < 2; i++) {
                int eLoc = eLabel.getLocation(i);
                if (eLoc == Location.INTERIOR || eLoc == Location.BOUNDARY) {
                    this.label.setLocation(i, Location.INTERIOR);
                }
            }
        }
//Debug.print(this);
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:26,代码来源:DirectedEdgeStar.java


示例9: setLabelBoundary

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
 * Updates the label of a node to BOUNDARY,
 * obeying the mod-2 boundaryDetermination rule.
 */
public void setLabelBoundary(int argIndex) {
    if (this.label == null) {
        return;
    }

    // determine the current location for the point (if any)
    int loc = Location.NONE;
    if (this.label != null) {
        loc = this.label.getLocation(argIndex);
    }
    // flip the loc
    int newLoc;
    switch (loc) {
        case Location.BOUNDARY:
            newLoc = Location.INTERIOR;
            break;
        case Location.INTERIOR:
            newLoc = Location.BOUNDARY;
            break;
        default:
            newLoc = Location.BOUNDARY;
            break;
    }
    this.label.setLocation(argIndex, newLoc);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:30,代码来源:Node.java


示例10: isInBoundary

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * This method implements the Boundary Determination Rule
     * for determining whether
     * a component (node or edge) that appears multiple times in elements
     * of a MultiGeometry is in the boundary or the interior of the Geometry
     * <br>
     * The SFS uses the "Mod-2 Rule", which this function implements
     * <br>
     * An alternative (and possibly more intuitive) rule would be
     * the "At Most One Rule":
     * isInBoundary = (componentCount == 1)
     */
/*
  public static boolean isInBoundary(int boundaryCount)
  {
    // the "Mod-2 Rule"
    return boundaryCount % 2 == 1;
  }
  public static int determineBoundary(int boundaryCount)
  {
    return isInBoundary(boundaryCount) ? Location.BOUNDARY : Location.INTERIOR;
  }
*/
    public static int determineBoundary(BoundaryNodeRule boundaryNodeRule, int boundaryCount) {
        return boundaryNodeRule.isInBoundary(boundaryCount)
                ? Location.BOUNDARY : Location.INTERIOR;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:28,代码来源:GeometryGraph.java


示例11: addPolygon

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
private void addPolygon(Polygon p) {
    this.addPolygonRing(
            (LinearRing) p.getExteriorRing(),
            Location.EXTERIOR,
            Location.INTERIOR);

    for (int i = 0; i < p.getNumInteriorRing(); i++) {
        LinearRing hole = (LinearRing) p.getInteriorRingN(i);

        // Holes are topologically labelled opposite to the shell, since
        // the interior of the polygon lies on their opposite side
        // (on the left, if the hole is oriented CW)
        this.addPolygonRing(
                hole,
                Location.INTERIOR,
                Location.EXTERIOR);
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:19,代码来源:GeometryGraph.java


示例12: addLineString

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
private void addLineString(LineString line) {
    Coordinate[] coord = CoordinateArrays.removeRepeatedPoints(line.getCoordinates());

    if (coord.length < 2) {
        this.hasTooFewPoints = true;
        this.invalidPoint = coord[0];
        return;
    }

    // add the edge for the LineString
    // line edges do not have locations for their left and right sides
    Edge e = new Edge(coord, new Label(this.argIndex, Location.INTERIOR));
    this.lineEdgeMap.put(line, e);
    this.insertEdge(e);
    /**
     * Add the boundary points of the LineString, if any.
     * Even if the LineString is closed, add both points as if they were endpoints.
     * This allows for the case that the node already exists and is a boundary point.
     */
    Assert.isTrue(coord.length >= 2, "found LineString with single point");
    this.insertBoundaryPoint(this.argIndex, coord[0]);
    this.insertBoundaryPoint(this.argIndex, coord[coord.length - 1]);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:24,代码来源:GeometryGraph.java


示例13: insertBoundaryPoint

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
 * Adds candidate boundary points using the current {@link BoundaryNodeRule}.
 * This is used to add the boundary
 * points of dim-1 geometries (Curves/MultiCurves).
 */
private void insertBoundaryPoint(int argIndex, Coordinate coord) {
    Node n = this.nodes.addNode(coord);
    // nodes always have labels
    Label lbl = n.getLabel();
    // the new point to insert is on a boundary
    int boundaryCount = 1;
    // determine the current location for the point (if any)
    int loc = Location.NONE;
    loc = lbl.getLocation(argIndex, Position.ON);
    if (loc == Location.BOUNDARY) {
        boundaryCount++;
    }

    // determine the boundary status of the point according to the Boundary Determination Rule
    int newLoc = determineBoundary(this.boundaryNodeRule, boundaryCount);
    lbl.setLocation(argIndex, newLoc);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:23,代码来源:GeometryGraph.java


示例14: merge

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
 * merge updates only the NULL attributes of this object
 * with the attributes of another.
 */
public void merge(TopologyLocation gl) {
    // if the src is an Area label & and the dest is not, increase the dest to be an Area
    if (gl.location.length > this.location.length) {
        int[] newLoc = new int[3];
        newLoc[Position.ON] = this.location[Position.ON];
        newLoc[Position.LEFT] = Location.NONE;
        newLoc[Position.RIGHT] = Location.NONE;
        this.location = newLoc;
    }
    for (int i = 0; i < this.location.length; i++) {
        if (this.location[i] == Location.NONE && i < gl.location.length) {
            this.location[i] = gl.location[i];
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:20,代码来源:TopologyLocation.java


示例15: computeIntersectionNodes

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * Insert nodes for all intersections on the edges of a Geometry.
     * Label the created nodes the same as the edge label if they do not already have a label.
     * This allows nodes created by either self-intersections or
     * mutual intersections to be labelled.
     * Endpoint nodes will already be labelled from when they were inserted.
     */
    private void computeIntersectionNodes(int argIndex) {
        for (Iterator i = arg[argIndex].getEdgeIterator(); i.hasNext(); ) {
            Edge e = (Edge) i.next();
            int eLoc = e.getLabel().getLocation(argIndex);
            for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
                EdgeIntersection ei = (EdgeIntersection) eiIt.next();
                RelateNode n = (RelateNode) nodes.addNode(ei.coord);
                if (eLoc == Location.BOUNDARY)
                    n.setLabelBoundary(argIndex);
                else {
                    if (n.getLabel().isNull(argIndex))
                        n.setLabel(argIndex, Location.INTERIOR);
                }
//Debug.println(n);
            }
        }
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:25,代码来源:RelateComputer.java


示例16: labelIntersectionNodes

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * For all intersections on the edges of a Geometry,
     * label the corresponding node IF it doesn't already have a label.
     * This allows nodes created by either self-intersections or
     * mutual intersections to be labelled.
     * Endpoint nodes will already be labelled from when they were inserted.
     */
    private void labelIntersectionNodes(int argIndex) {
        for (Iterator i = arg[argIndex].getEdgeIterator(); i.hasNext(); ) {
            Edge e = (Edge) i.next();
            int eLoc = e.getLabel().getLocation(argIndex);
            for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
                EdgeIntersection ei = (EdgeIntersection) eiIt.next();
                RelateNode n = (RelateNode) nodes.find(ei.coord);
                if (n.getLabel().isNull(argIndex)) {
                    if (eLoc == Location.BOUNDARY)
                        n.setLabelBoundary(argIndex);
                    else
                        n.setLabel(argIndex, Location.INTERIOR);
                }
//n.print(System.out);
            }
        }
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:25,代码来源:RelateComputer.java


示例17: computeIntersectionNodes

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * Insert nodes for all intersections on the edges of a Geometry.
     * Label the created nodes the same as the edge label if they do not already have a label.
     * This allows nodes created by either self-intersections or
     * mutual intersections to be labelled.
     * Endpoint nodes will already be labelled from when they were inserted.
     * <p/>
     * Precondition: edge intersections have been computed.
     */
    public void computeIntersectionNodes(GeometryGraph geomGraph, int argIndex) {
        for (Iterator edgeIt = geomGraph.getEdgeIterator(); edgeIt.hasNext(); ) {
            Edge e = (Edge) edgeIt.next();
            int eLoc = e.getLabel().getLocation(argIndex);
            for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
                EdgeIntersection ei = (EdgeIntersection) eiIt.next();
                RelateNode n = (RelateNode) nodes.addNode(ei.coord);
                if (eLoc == Location.BOUNDARY)
                    n.setLabelBoundary(argIndex);
                else {
                    if (n.getLabel().isNull(argIndex))
                        n.setLabel(argIndex, Location.INTERIOR);
                }
//Debug.println(n);
            }
        }
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:27,代码来源:RelateNodeGraph.java


示例18: computeLabel

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
 * This computes the overall edge label for the set of
 * edges in this EdgeStubBundle.  It essentially merges
 * the ON and side labels for each edge.  These labels must be compatible
 */
public void computeLabel(BoundaryNodeRule boundaryNodeRule) {
    // create the label.  If any of the edges belong to areas,
    // the label must be an area label
    boolean isArea = false;
    for (Iterator it = iterator(); it.hasNext(); ) {
        EdgeEnd e = (EdgeEnd) it.next();
        if (e.getLabel().isArea()) isArea = true;
    }
    if (isArea)
        label = new Label(Location.NONE, Location.NONE, Location.NONE);
    else
        label = new Label(Location.NONE);

    // compute the On label, and the side labels if present
    for (int i = 0; i < 2; i++) {
        computeLabelOn(i, boundaryNodeRule);
        if (isArea)
            computeLabelSides(i);
    }
}
 
开发者ID:Semantive,项目名称:jts,代码行数:26,代码来源:EdgeEndBundle.java


示例19: computeLabelling

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
     * Compute the labelling for all dirEdges in this star, as well
     * as the overall labelling
     */
    public void computeLabelling(GeometryGraph[] geom) {
//Debug.print(this);
        super.computeLabelling(geom);

        // determine the overall labelling for this DirectedEdgeStar
        // (i.e. for the node it is based at)
        label = new Label(Location.NONE);
        for (Iterator it = iterator(); it.hasNext(); ) {
            EdgeEnd ee = (EdgeEnd) it.next();
            Edge e = ee.getEdge();
            Label eLabel = e.getLabel();
            for (int i = 0; i < 2; i++) {
                int eLoc = eLabel.getLocation(i);
                if (eLoc == Location.INTERIOR || eLoc == Location.BOUNDARY)
                    label.setLocation(i, Location.INTERIOR);
            }
        }
//Debug.print(this);
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:24,代码来源:DirectedEdgeStar.java


示例20: setLabelBoundary

import com.vividsolutions.jts.geom.Location; //导入依赖的package包/类
/**
 * Updates the label of a node to BOUNDARY,
 * obeying the mod-2 boundaryDetermination rule.
 */
public void setLabelBoundary(int argIndex) {
    if (label == null) return;

    // determine the current location for the point (if any)
    int loc = Location.NONE;
    if (label != null)
        loc = label.getLocation(argIndex);
    // flip the loc
    int newLoc;
    switch (loc) {
        case Location.BOUNDARY:
            newLoc = Location.INTERIOR;
            break;
        case Location.INTERIOR:
            newLoc = Location.BOUNDARY;
            break;
        default:
            newLoc = Location.BOUNDARY;
            break;
    }
    label.setLocation(argIndex, newLoc);
}
 
开发者ID:Semantive,项目名称:jts,代码行数:27,代码来源:Node.java



注:本文中的com.vividsolutions.jts.geom.Location类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EventBusService类代码示例发布时间:2022-05-22
下一篇:
Java ObjectCache类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap