com.vividsolutions.jts.geom.Geometry.isValid()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(248)

本文整理了Java中com.vividsolutions.jts.geom.Geometry.isValid()方法的一些代码示例,展示了Geometry.isValid()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.isValid()方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:isValid

Geometry.isValid介绍

[英]Tests whether this Geometry is topologically valid, according to the OGC SFS specification.

For validity rules see the Javadoc for the specific Geometry subclass.
[中]根据OGC SFS规范,测试此Geometry是否在拓扑上有效。
有关有效性规则,请参阅特定几何体子类的Javadoc。

代码示例

代码示例来源:origin: com.vividsolutions/jts

private void checkValid(Geometry g)
 {
   if (! g.isValid()) {
     System.out.println("Snapped geometry is invalid");
   }
 }
}

代码示例来源:origin: com.vividsolutions/jts

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);
}

代码示例来源:origin: com.vividsolutions/jts

Geometry resultEP = cbo.intersection(geom0, geom1);
if (! resultEP.isValid())
 throw originalEx;
return resultEP;

代码示例来源:origin: com.vividsolutions/jts

Geometry resultEP = cbo.symDifference(geom0, geom1);
if (! resultEP.isValid())
 throw originalEx;
return resultEP;

代码示例来源:origin: com.vividsolutions/jts

Geometry resultEP = cbo.union(geom0, geom1);
if (! resultEP.isValid())
 throw originalEx;
return resultEP;

代码示例来源:origin: com.vividsolutions/jts

Geometry resultEP = cbo.difference(geom0, geom1);
if (! resultEP.isValid())
 throw originalEx;
return resultEP;

代码示例来源:origin: com.vividsolutions/jts

Geometry resultEP = cbo.buffer(geom, distance);
if (! resultEP.isValid())
 throw originalEx;
return resultEP;

代码示例来源:origin: org.geotools/gt2-main

static public boolean isValid(Geometry arg0)
{
   Geometry _this = arg0;
   return _this.isValid();
}

代码示例来源:origin: org.geotools/gt-main

static public boolean isValid(Geometry arg0)
{
   if (arg0 == null) return false;
   Geometry _this = arg0;
   return _this.isValid();
}

代码示例来源:origin: com.vividsolutions/jts-core

private void checkValid(Geometry g)
 {
   if (! g.isValid()) {
     System.out.println("Snapped geometry is invalid");
   }
 }
}

代码示例来源:origin: org.teiid/teiid-engine

public static Boolean isValid(GeometryType geom) throws FunctionExecutionException {
  Geometry g = getGeometry(geom);
  return g.isValid();
}

代码示例来源:origin: stackoverflow.com

if(geom.isValid()){
  return toPolygonGeometry(polygonizer.getPolygons(), geom.getFactory());
}else if(geom instanceof MultiPolygon){
  if(geom.isValid()){

代码示例来源:origin: bedatadriven/activityinfo

@Override
public void write(int adminEntityId, Geometry geometry) throws IOException {
  if (!geometry.isValid()) {
    throw new IllegalStateException(adminEntityId + " has invalid geometry");
  }
  dataOut.writeInt(adminEntityId);
  writer.write(geometry, new OutputStreamOutStream(dataOut));
  numFeatures++;
}

代码示例来源:origin: com.vividsolutions/jts-core

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);
}

代码示例来源:origin: aseldawy/pigeon

@Override
public Boolean exec(Tuple input) throws IOException {
 Geometry geom = null;
 try {
  Object v = input.get(0);
  geom = geometryParser.parseGeom(v);
  return geom.isValid();
 } catch (ExecException ee) {
  throw new GeoException(geom, ee);
 }
}

代码示例来源:origin: org.orbisgis/mapeditor

public Geometry moveTo(double x, double y)
    throws CannotChangeGeometryException {
    com.vividsolutions.jts.geom.Geometry ret = moveJTSTo(x, y);
    if (!ret.isValid()) {
        throw new CannotChangeGeometryException(I18N.tr("The geometry is not valid"));
    }
    return ret;
}

代码示例来源:origin: org.orbisgis/mapeditor

@Override
public Geometry remove() throws TopologyException {
  com.vividsolutions.jts.geom.Geometry ret = removeVertex();
  if (!ret.isValid()) {
    throw new TopologyException(I18N.tr("The geometry is not valid"));
  }
  return ret;
}

代码示例来源:origin: org.orbisgis/mapeditor

@Override
public Geometry moveTo(double x, double y)
    throws CannotChangeGeometryException {
  com.vividsolutions.jts.geom.Geometry g = moveJTSTo(x, y);
  if (!g.isValid()) {
    throw new CannotChangeGeometryException(I18N.tr("The geometry is not valid"));
  }
  return g;
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

public Object getValueAt(final int _rowIndex, final int _columnIndex) {
  if (_columnIndex == 0) {
   return new Integer(_rowIndex + 1);
  } else if (_columnIndex == 1) {
   final Geometry s = (Geometry) ligne_.getGeometry(_rowIndex);
   return new Integer(s.getNumPoints());
  } else if (_columnIndex == 2) {
   final Geometry s = (Geometry) ligne_.getGeometry(_rowIndex);
   return s.isValid() ? valide_ : nonValide_;
  }
  return ligne_.getModel(att_[_columnIndex - 3]).getObjectValueAt(_rowIndex);
 }
}

代码示例来源:origin: org.orbisgis/mapeditor

@Override
public void drawIn_Point(Graphics g, MapContext vc, ToolManager tm)
    throws DrawingException {
  Geometry geom = getCurrentPolygon(vc, tm);
  if (geom != null) {
    tm.addGeomToDraw(geom);
    if (!geom.isValid()) {
      throw new DrawingException(
          i18n.tr("Invalid polygon"));
    }
  }
}

相关文章