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

Java IsValidOp类代码示例

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

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



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

示例1: checkJTSFootprint

import com.vividsolutions.jts.operation.valid.IsValidOp; //导入依赖的package包/类
/**
 * Check JTS Footprint validity
 */
public static boolean checkJTSFootprint (String footprint)
{
   try
   {
      WKTReader wkt = new WKTReader();
      Geometry geom = wkt.read(footprint);
      IsValidOp vaildOp = new IsValidOp(geom);
      TopologyValidationError err = vaildOp.getValidationError();
      if (err != null)
      {
         throw new IllegalParameterException(err.getMessage());
      }
      return true;
   }
   catch (Exception e)
   {
      LOGGER.error("JTS Footprint error : " + e.getMessage());
      return false;
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:24,代码来源:ProcessingUtils.java


示例2: testCountryBoundariesGeoJson

import com.vividsolutions.jts.operation.valid.IsValidOp; //导入依赖的package包/类
public void testCountryBoundariesGeoJson() throws IOException
{
	String geoJson = StreamUtils.readToString(getContext().getAssets().open("countryBoundaries.json"));
	GeometryCollection countriesBoundaries = (GeometryCollection) new GeoJsonReader().read(geoJson);
	for(int i = 0; i < countriesBoundaries.getNumGeometries(); ++i)
	{
		Geometry countryBoundary = countriesBoundaries.getGeometryN(i);
		Map<String,String> props = (Map<String,String>) countryBoundary.getUserData();

		TopologyValidationError err = new IsValidOp(countryBoundary).getValidationError();
		if(err != null) {
			String countryCode = props.get("ISO3166-1:alpha2");
			if(countryCode == null) countryCode = props.get("ISO3166-2");
			fail("" + countryCode + ": " + err.toString());
		}
	}
}
 
开发者ID:westnordost,项目名称:StreetComplete,代码行数:18,代码来源:CountryBoundariesGeoJsonTest.java


示例3: create

import com.vividsolutions.jts.operation.valid.IsValidOp; //导入依赖的package包/类
/**
 * As the user increases the number of points, the probability of creating a random valid polygon decreases. 
 * Please take not of this when selecting the generation style, and the number of points. 
 * 
 * May return null if a geometry could not be created.
 * 
 * @see #getNumberPoints()
 * @see #setNumberPoints(int)
 * @see #getGenerationAlgorithm()
 * @see #setGenerationAlgorithm(int)
 * 
 * @see #BOX
 * @see #ARC
 * 
 * @see com.vividsolutions.jts.generator.GeometryGenerator#create()
 * 
 * @throws IllegalStateException When the alg is not valid or the number of points is invalid
 * @throws NullPointerException when either the Geometry Factory, or the Bounding Box are undefined.
 */
public Geometry create() {

	if(geometryFactory == null){
		throw new NullPointerException("GeometryFactory is not declared");
	}
	if(boundingBox == null || boundingBox.isNull()){
		throw new NullPointerException("Bounding Box is not declared");
	}
	if(numberPoints<4){
		throw new IllegalStateException("Too few points");
	}
	
	double x = boundingBox.getMinX(); // base x
	double dx = boundingBox.getMaxX()-x;
	
	double y = boundingBox.getMinY(); // base y
	double dy = boundingBox.getMaxY()-y;
	
	Polygon p = null;
	
	for(int i=0;i<RUNS;i++){
		switch(getGenerationAlgorithm()){
		case BOX:
			p = createBox(x,dx,y,dy,numberHoles,numberPoints,geometryFactory);
			break;
		case ARC:
			p = createArc(x,dx,y,dy,numberHoles,numberPoints,geometryFactory);
			break;
		default:
			throw new IllegalStateException("Invalid Alg. Specified");
		}
		
		IsValidOp valid = new IsValidOp(p);
		if(valid.isValid()){
			return p;
		}
	}
	return null;
}
 
开发者ID:Semantive,项目名称:jts,代码行数:59,代码来源:PolygonGenerator.java


示例4: main

import com.vividsolutions.jts.operation.valid.IsValidOp; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  WKTReader reader = new WKTReader(new GeometryFactory());
  Geometry g = reader.read("GEOMETRYCOLLECTION (POINT (110 300), POINT (100 110), POINT (130 210), POINT (150 210), POINT (150 180), POINT (130 170), POINT (140 190), POINT (130 200), LINESTRING (240 50, 210 120, 270 80, 250 140, 330 70, 300 160, 340 130, 340 130), POLYGON ((210 340, 220 260, 150 270, 230 220, 230 140, 270 210, 360 240, 260 250, 260 280, 240 270, 210 340), (230 270, 230 250, 200 250, 240 220, 240 190, 260 220, 290 230, 250 230, 230 270)))");
  IsValidOp op = new IsValidOp(g);
  if (!op.isValid()) {
    System.out.println(op.getValidationError().getMessage());
  }
  else {
    System.out.println("OK");
  }
}
 
开发者ID:Semantive,项目名称:jts,代码行数:12,代码来源:IsValidTester.java


示例5: create

import com.vividsolutions.jts.operation.valid.IsValidOp; //导入依赖的package包/类
/**
 * As the user increases the number of points, the probability of creating a random valid linestring decreases. 
 * Please take not of this when selecting the generation style, and the number of points. 
 * 
 * May return null if a geometry could not be created.
 * 
 * @see #getNumberPoints()
 * @see #setNumberPoints(int)
 * @see #getGenerationAlgorithm()
 * @see #setGenerationAlgorithm(int)
 * 
 * @see #VERT
 * @see #HORZ
 * @see #ARC
 * 
 * @see com.vividsolutions.jts.generator.GeometryGenerator#create()
 * 
 * @throws IllegalStateException When the alg is not valid or the number of points is invalid
 * @throws NullPointerException when either the Geometry Factory, or the Bounding Box are undefined.
 */
public Geometry create() {

	if(geometryFactory == null){
		throw new NullPointerException("GeometryFactory is not declared");
	}
	if(boundingBox == null || boundingBox.isNull()){
		throw new NullPointerException("Bounding Box is not declared");
	}
	if(numberPoints<2){
		throw new IllegalStateException("Too few points");
	}
	
	Coordinate[] coords = new Coordinate[numberPoints];

	double x = boundingBox.getMinX(); // base x
	double dx = boundingBox.getMaxX()-x;
	
	double y = boundingBox.getMinY(); // base y
	double dy = boundingBox.getMaxY()-y;
	
	
	for(int i=0;i<RUNS;i++){
		switch(getGenerationAlgorithm()){
		case VERT:
			fillVert(x,dx,y,dy,coords,geometryFactory);
			break;
		case HORZ:
			fillHorz(x,dx,y,dy,coords,geometryFactory);
			break;
		case ARC:
			fillArc(x,dx,y,dy,coords,geometryFactory);
			break;
		default:
			throw new IllegalStateException("Invalid Alg. Specified");
		}
		
		LineString ls = geometryFactory.createLineString(coords);
		IsValidOp valid = new IsValidOp(ls);
		if(valid.isValid()){
			return ls;
		}
	}
	return null;
}
 
开发者ID:Semantive,项目名称:jts,代码行数:65,代码来源:LineStringGenerator.java


示例6: isValid

import com.vividsolutions.jts.operation.valid.IsValidOp; //导入依赖的package包/类
/**
 * Tests whether this <code>Geometry</code>
 * is topologically valid, according to the OGC SFS specification.
 * <p>
 * For validity rules see the Javadoc for the specific Geometry subclass.
 *
 * @return <code>true</code> if this <code>Geometry</code> is valid
 * @see IsValidOp
 */
public boolean isValid() {
    return IsValidOp.isValid(this);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:13,代码来源:Geometry.java


示例7: isValid

import com.vividsolutions.jts.operation.valid.IsValidOp; //导入依赖的package包/类
/**
 * Tests whether this <code>Geometry</code>
 * is topologically valid, according to the OGC SFS specification.
 * <p/>
 * For validity rules see the Javadoc for the specific Geometry subclass.
 *
 * @return <code>true</code> if this <code>Geometry</code> is valid
 * @see IsValidOp
 */
public boolean isValid() {
    return IsValidOp.isValid(this);
}
 
开发者ID:Semantive,项目名称:jts,代码行数:13,代码来源:Geometry.java


示例8: isValid

import com.vividsolutions.jts.operation.valid.IsValidOp; //导入依赖的package包/类
/**
 * Tests whether this <code>Geometry</code>
 * is topologically valid, according to the OGC SFS specification.
 * <p>
 * For validity rules see the Javadoc for the specific Geometry subclass.
 *
 *@return <code>true</code> if this <code>Geometry</code> is valid
 *
 * @see IsValidOp
 */
public boolean isValid()
{
	return IsValidOp.isValid(this);
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:15,代码来源:Geometry.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java SnmpUsmKeyHandler类代码示例发布时间:2022-05-22
下一篇:
Java LengthFilter类代码示例发布时间: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