org.deegree.geometry.Geometry.getCentroid()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(179)

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

Geometry.getCentroid介绍

[英]Returns the centroid of the geometry.
[中]返回几何体的质心。

代码示例

代码示例来源:origin: deegree/deegree3

@Override
public Geometry process( Geometry inputGeometry, Map<String, Object> params ) {
  return inputGeometry.getCentroid();
}

代码示例来源:origin: deegree/deegree3

@Override
  public TypedObjectNode[] evaluate( List<TypedObjectNode[]> args )
              throws FilterEvaluationException {
    TypedObjectNode[] inputs = args.get( 0 );
    List<TypedObjectNode> outputs = new ArrayList<TypedObjectNode>( inputs.length );
    for ( TypedObjectNode input : inputs ) {
      Geometry geom = getGeometryValue( input );
      if ( geom != null ) {
        outputs.add( geom.getCentroid() );
      }
    }
    return outputs.toArray( new TypedObjectNode[outputs.size()] );
  }
};

代码示例来源:origin: deegree/deegree3

@Override
public Point getCentroid() {
  return getReferencedObject().getCentroid();
}

代码示例来源:origin: deegree/deegree3

@Override
public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info )
            throws ProcessletException {
  ComplexInput gmlInput = (ComplexInput) in.getParameter( "GMLInput" );
  Geometry geometry = readGeometry( gmlInput );
  Point centroid = geometry.getCentroid();
  ComplexOutput centroidOutput = (ComplexOutput) out.getParameter( "Centroid" );
  writeGeometry( centroidOutput, centroid );
}

代码示例来源:origin: deegree/deegree3

private void handleGeometryTypes( TextStyling styling, String text, Font font, Geometry geom ) {
  if ( geom == null ) {
    LOG.warn( "null geometry cannot be handled." );
    return;
  }
  if ( geom instanceof Point ) {
    labelList.add( createLabel( styling, font, text, (Point) geom ) );
  } else if ( geom instanceof Surface && styling.linePlacement != null ) {
    textRenderer.render( styling, font, text, (Surface) geom );
  } else if ( geom instanceof Curve && styling.linePlacement != null ) {
    textRenderer.render( styling, font, text, (Curve) geom );
  } else if ( geom instanceof Polygon && styling.auto ) {
    handlePolygonWithAutoPlacement( styling, font, text, (Polygon) geom );
  } else if ( geom instanceof GeometricPrimitive ) {
    labelList.add( createLabel( styling, font, text, geom.getCentroid() ) );
  } else if ( geom instanceof MultiPoint ) {
    handleMultiGeometry( styling, text, font, (MultiPoint) geom );
  } else if ( geom instanceof MultiCurve<?> && styling.linePlacement != null ) {
    handleMultiGeometry( styling, text, font, (MultiCurve<?>) geom );
  } else if ( geom instanceof MultiLineString && styling.linePlacement != null ) {
    handleMultiGeometry( styling, text, font, (MultiLineString) geom );
  } else if ( geom instanceof MultiGeometry<?> ) {
    handleMultiGeometry( styling, text, font, (MultiGeometry<?>) geom );
  } else {
    LOG.warn( "Trying to use unsupported geometry type '{}' for text rendering.",
         geom.getClass().getSimpleName() );
  }
}

代码示例来源:origin: deegree/deegree3

private void handleGeometryTypes( TextStyling styling, String text, Font font, Geometry geom ) {
  if ( geom instanceof Point ) {
    render( styling, font, text, (Point) geom );
  } else if ( geom instanceof Surface && styling.linePlacement != null ) {
    render( styling, font, text, (Surface) geom );
  } else if ( geom instanceof Curve && styling.linePlacement != null ) {
    render( styling, font, text, (Curve) geom );
  } else if ( geom instanceof GeometricPrimitive ) {
    render( styling, font, text, geom.getCentroid() );
  } else if ( geom instanceof MultiPoint ) {
    handleMultiGeometry( styling, text, font, (MultiPoint) geom );
  } else if ( geom instanceof MultiCurve<?> && styling.linePlacement != null ) {
    handleMultiGeometry( styling, text, font, (MultiCurve<?>) geom );
  } else if ( geom instanceof MultiLineString && styling.linePlacement != null ) {
    handleMultiGeometry( styling, text, font, (MultiLineString) geom );
  } else if ( geom instanceof MultiGeometry<?> ) {
    for ( Geometry g : (MultiGeometry<?>) geom ) {
      render( styling, text, g );
    }
  } else {
    LOG.warn( "Trying to use unsupported geometry type '{}' for text rendering.",
         geom.getClass().getSimpleName() );
  }
}

相关文章