当前位置: 首页>>代码示例>>Java>>正文


Java Polygonal类代码示例

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


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

示例1: computeSimple

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
private boolean computeSimple(Geometry geom) {
    this.nonSimpleLocation = null;
    if (geom.isEmpty()) {
        return true;
    }
    if (geom instanceof LineString) {
        return this.isSimpleLinearGeometry(geom);
    }
    if (geom instanceof MultiLineString) {
        return this.isSimpleLinearGeometry(geom);
    }
    if (geom instanceof MultiPoint) {
        return this.isSimpleMultiPoint((MultiPoint) geom);
    }
    if (geom instanceof Polygonal) {
        return this.isSimplePolygonal(geom);
    }
    if (geom instanceof GeometryCollection) {
        return this.isSimpleGeometryCollection(geom);
    }
    // all other geometry types are simple by definition
    return true;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:24,代码来源:IsSimpleOp.java

示例2: reduce

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
public Geometry reduce(Geometry geom) {
    Geometry reducePW = this.reducePointwise(geom);
    if (this.isPointwise) {
        return reducePW;
    }

    //TODO: handle GeometryCollections containing polys
    if (!(reducePW instanceof Polygonal)) {
        return reducePW;
    }

    // Geometry is polygonal - test if topology needs to be fixed
    if (reducePW.isValid()) {
        return reducePW;
    }

    // hack to fix topology.
    // TODO: implement snap-rounding and use that.
    return this.fixPolygonalTopology(reducePW);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:21,代码来源:GeometryPrecisionReducer.java

示例3: create

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
/**
 * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}.
 *
 * @param geom the geometry to prepare
 * @return the prepared geometry
 */
public PreparedGeometry create(Geometry geom) {
    if (geom instanceof Polygonal) {
        return new PreparedPolygon((Polygonal) geom);
    }
    if (geom instanceof Lineal) {
        return new PreparedLineString((Lineal) geom);
    }
    if (geom instanceof Puntal) {
        return new PreparedPoint((Puntal) geom);
    }

    /**
     * Default representation.
     */
    return new BasicPreparedGeometry(geom);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:23,代码来源:PreparedGeometryFactory.java

示例4: isProperIntersectionImpliesNotContainedSituation

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
private boolean isProperIntersectionImpliesNotContainedSituation(Geometry testGeom) {
    /**
     * If the test geometry is polygonal we have the A/A situation.
     * In this case, a proper intersection indicates that
     * the Epsilon-Neighbourhood Exterior Intersection condition exists.
     * This condition means that in some small
     * area around the intersection point, there must exist a situation
     * where the interior of the test intersects the exterior of the target.
     * This implies the test is NOT contained in the target.
     */
    if (testGeom instanceof Polygonal) {
        return true;
    }
    /**
     * A single shell with no holes allows concluding that
     * a proper intersection implies not contained
     * (due to the Epsilon-Neighbourhood Exterior Intersection condition)
     */
    return isSingleShell(prepPoly.getGeometry());
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:21,代码来源:AbstractPreparedPolygonContains.java

示例5: findCenterPoint

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
private LatLon findCenterPoint()
{
	try
	{
		Geometry geom = JTSConst.toGeometry(this);
		if(!geom.isValid()) return null;

		if(geom instanceof Polygonal)
		{
			return JTSConst.toLatLon(geom.getInteriorPoint());
		}
		else if(geom instanceof Lineal)
		{
			LengthIndexedLine lil = new LengthIndexedLine(geom);
			return JTSConst.toLatLon(lil.extractPoint(geom.getLength() / 2.0));
		}
	}
	catch (Exception e)
	{
		// unable to create proper geometry...
		return null;
	}
	return null;
}
 
开发者ID:westnordost,项目名称:StreetComplete,代码行数:25,代码来源:ElementGeometry.java

示例6: reduce

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
public Geometry reduce(Geometry geom) {
    Geometry reducePW = reducePointwise(geom);
    if (isPointwise)
        return reducePW;

    //TODO: handle GeometryCollections containing polys
    if (!(reducePW instanceof Polygonal))
        return reducePW;

    // Geometry is polygonal - test if topology needs to be fixed
    if (reducePW.isValid()) return reducePW;

    // hack to fix topology.
    // TODO: implement snap-rounding and use that.
    return fixPolygonalTopology(reducePW);
}
 
开发者ID:Semantive,项目名称:jts,代码行数:17,代码来源:GeometryPrecisionReducer.java

示例7: isProperIntersectionImpliesNotContainedSituation

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
private boolean isProperIntersectionImpliesNotContainedSituation(Geometry testGeom) {
    /**
     * If the test geometry is polygonal we have the A/A situation.
     * In this case, a proper intersection indicates that
     * the Epsilon-Neighbourhood Exterior Intersection condition exists.
     * This condition means that in some small
     * area around the intersection point, there must exist a situation
     * where the interior of the test intersects the exterior of the target.
     * This implies the test is NOT contained in the target.
     */
    if (testGeom instanceof Polygonal) return true;
    /**
     * A single shell with no holes allows concluding that
     * a proper intersection implies not contained
     * (due to the Epsilon-Neighbourhood Exterior Intersection condition)
     */
    if (isSingleShell(prepPoly.getGeometry())) return true;
    return false;
}
 
开发者ID:Semantive,项目名称:jts,代码行数:20,代码来源:AbstractPreparedPolygonContains.java

示例8: jtsToSchemaPolygon

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
/**
 * Converts a JTS polygonal geometry to an EAD polygon. EAD polygons are
 * converted to GDX polygons before use, and therefore share limitations.
 * 
 * @param g
 *            geometry to convert (must be a closed polygon)
 * @return a schema polygon
 */
public static es.eucm.ead.schema.data.shape.Polygon jtsToSchemaPolygon(
		Geometry g) {
	if (!(g instanceof Polygonal)) {
		throw new IllegalArgumentException(
				"Can only convert JTS Polygons, but supplied a " + g);
	}

	Coordinate[] cs = g.getCoordinates();
	Array<Float> resultVertices = new Array<Float>(cs.length);
	for (Coordinate c : cs) {
		resultVertices.add((float) c.x);
		resultVertices.add((float) c.y);
	}
	// remove the last point, as it is the same as the first
	resultVertices.removeIndex(resultVertices.size - 1);
	resultVertices.removeIndex(resultVertices.size - 1);

	es.eucm.ead.schema.data.shape.Polygon result = new es.eucm.ead.schema.data.shape.Polygon();
	result.setPoints(resultVertices);
	return result;
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:30,代码来源:GeometryUtils.java

示例9: load

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
public static LinkedList<PreparedPolygon> load() throws IOException {

		URL krajeShp = Kraje.class
				.getResource("kraje/hranice_krajov_simpl.shp");
		FileDataStore store = FileDataStoreFinder.getDataStore(krajeShp);
		FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = store
				.getFeatureSource();
		FeatureCollection<SimpleFeatureType, SimpleFeature> fC = featureSource
				.getFeatures();

		FeatureIterator<SimpleFeature> iter = fC.features();

		LinkedList<PreparedPolygon> list = new LinkedList<PreparedPolygon>();

		try {
			while (iter.hasNext()) {
				Feature f = iter.next();
				GeometryAttribute geomAttr = f.getDefaultGeometryProperty();
				list.add(new PreparedPolygon((Polygonal) geomAttr.getValue()));
			}
		} finally {
			iter.close();
		}

		return list;
	}
 
开发者ID:MilanNobonn,项目名称:freemapKaPor,代码行数:27,代码来源:Kraje.java

示例10: snapToSelf

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
/**
 * Snaps the vertices in the component {@link LineString}s
 * of the source geometry
 * to the vertices of the given snap geometry.
 *
 * @param snapTolerance the snapping tolerance
 * @param cleanResult whether the result should be made valid
 * @return a new snapped Geometry
 */
public Geometry snapToSelf(double snapTolerance, boolean cleanResult) {
    Coordinate[] snapPts = this.extractTargetCoordinates(this.srcGeom);

    SnapTransformer snapTrans = new SnapTransformer(snapTolerance, snapPts, true);
    Geometry snappedGeom = snapTrans.transform(this.srcGeom);
    Geometry result = snappedGeom;
    if (cleanResult && result instanceof Polygonal) {
        // TODO: use better cleaning approach
        result = snappedGeom.buffer(0);
    }
    return result;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:22,代码来源:GeometrySnapper.java

示例11: IndexedPointInAreaLocator

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
/**
 * Creates a new locator for a given {@link Geometry}
 *
 * @param g the Geometry to locate in
 */
public IndexedPointInAreaLocator(Geometry g) {
    if (!(g instanceof Polygonal)) {
        throw new IllegalArgumentException("Argument must be Polygonal");
    }
    this.buildIndex(g);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:12,代码来源:IndexedPointInAreaLocator.java

示例12: locate

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
/**
 * Determines the {@link Location} of the given {@link Coordinate}
 * in this geometry.
 *
 * @param p the point to test
 * @return the location of the point in the geometry
 */
public int locate(Coordinate pt) {
    if (this.parentGeom instanceof Polygonal && this.parentGeom.getNumGeometries() > 50) {
        // lazily init point locator
        if (this.areaPtLocator == null) {
            this.areaPtLocator = new IndexedPointInAreaLocator(this.parentGeom);
        }
        return this.areaPtLocator.locate(pt);
    }
    return this.ptLocator.locate(pt, this.parentGeom);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:18,代码来源:GeometryGraph.java

示例13: containsProperly

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
/**
 * Tests whether this PreparedPolygon containsProperly a given geometry.
 *
 * @param geom the test geometry
 * @return true if the test geometry is contained properly
 */
public boolean containsProperly(Geometry geom) {
    /**
     * Do point-in-poly tests first, since they are cheaper and may result
     * in a quick negative result.
     *
     * If a point of any test components does not lie in the target interior, result is false
     */
    boolean isAllInPrepGeomAreaInterior = this.isAllTestComponentsInTargetInterior(geom);
    if (!isAllInPrepGeomAreaInterior) {
        return false;
    }

    /**
     * If any segments intersect, result is false.
     */
    List lineSegStr = SegmentStringUtil.extractSegmentStrings(geom);
    boolean segsIntersect = this.prepPoly.getIntersectionFinder().intersects(lineSegStr);
    if (segsIntersect) {
        return false;
    }

    /**
     * Given that no segments intersect, if any vertex of the target
     * is contained in some test component.
     * the test is NOT properly contained.
     */
    if (geom instanceof Polygonal) {
        // TODO: generalize this to handle GeometryCollections
        boolean isTargetGeomInTestArea = this.isAnyTargetComponentInAreaTest(geom, this.prepPoly.getRepresentativePoints());
        if (isTargetGeomInTestArea) {
            return false;
        }
    }

    return true;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:43,代码来源:PreparedPolygonContainsProperly.java

示例14: setExtent

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
/**
 * Sets a polygonal mask.
 *
 * @param mask
 * @throws IllegalArgumentException if the mask is not polygonal
 */
public void setExtent(Geometry mask) {
    if (!(mask instanceof Polygonal)) {
        throw new IllegalArgumentException("Only polygonal extents are supported");
    }
    this.maskPoly = mask;
    this.setExtent(mask.getEnvelopeInternal());
    this.extentLocator = new IndexedPointInAreaLocator(mask);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:15,代码来源:RandomPointsBuilder.java

示例15: create

import com.vividsolutions.jts.geom.Polygonal; //导入依赖的package包/类
/**
 * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}.
 *
 * @param geom the geometry to prepare
 * @return the prepared geometry
 */
public PreparedGeometry create(Geometry geom) {
    if (geom instanceof Polygonal)
        return new PreparedPolygon((Polygonal) geom);
    if (geom instanceof Lineal)
        return new PreparedLineString((Lineal) geom);
    if (geom instanceof Puntal)
        return new PreparedPoint((Puntal) geom);

    /**
     * Default representation.
     */
    return new BasicPreparedGeometry(geom);
}
 
开发者ID:Semantive,项目名称:jts,代码行数:20,代码来源:PreparedGeometryFactory.java


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