org.deegree.geometry.primitive.Point.getAsArray()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(130)

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

Point.getAsArray介绍

[英]Returns all ordinates.
[中]返回所有坐标。

代码示例

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

@Override
public boolean equals( Geometry geometry ) {
  if ( !( geometry instanceof Point ) ) {
    return false;
  }
  double[] coordinates = ( (Point) geometry ).getAsArray();
  if ( coordinates.length != this.coordinates.length ) {
    return false;
  }
  for ( int i = 0; i < coordinates.length; i++ ) {
    if ( !( coordinates[i] == this.coordinates[i] ) ) {
      return false;
    }
  }
  return true;
}

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

@Override
public void setOrdinate( int index, int ordinateIndex, double value ) {
  double[] coords = points.get( index ).getAsArray();
  if ( coords.length > ordinateIndex && ordinateIndex >= 0 )
    coords[ordinateIndex] = value;
  else
    throw new IndexOutOfBoundsException();
}

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

@Override
public Point getCentroid() {
  if ( centroid == null ) {
    double[] coordinates = new double[max.getAsArray().length];
    for ( int i = 0; i < coordinates.length; i++ ) {
      coordinates[i] = min.getAsArray()[i] + ( max.getAsArray()[i] - min.getAsArray()[i] ) / 2d;
    }
    centroid = new DefaultPoint( null, getCoordinateSystem(), getPrecision(), coordinates );
  }
  return centroid;
}

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

private void writeEnvelope( DataOutputStream out, Envelope env )
            throws IOException {
  double[] min = env.getMin().getAsArray();
  double[] max = env.getMax().getAsArray();
  out.writeDouble( min[0] );
  out.writeDouble( min[1] );
  out.writeDouble( min[2] );
  out.writeDouble( max[0] );
  out.writeDouble( max[1] );
  out.writeDouble( max[2] );
}

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

@Override
public double[] getAsArray() {
  return getReferencedObject().getAsArray();
}

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

@Override
public double[] getUpper() {
  return value.getMax().getAsArray();
}

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

@Override
public double[] getLower() {
  return value.getMin().getAsArray();
}

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

@Override
  public float[] getModelBBox() {
    if ( modelBBox == null ) {
      modelBBox = new float[6];
      double[] min = bbox.getMin().getAsArray();
      double[] max = bbox.getMax().getAsArray();
      modelBBox[0] = (float) min[0];
      modelBBox[1] = (float) min[1];
      modelBBox[2] = (float) min[2];

      modelBBox[3] = (float) max[0];
      modelBBox[4] = (float) max[1];
      modelBBox[5] = (float) max[2];
    }
    return modelBBox;
  }
}

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

/**
 * @param crs
 */
public void setCoordinateSystem( ICRS crs ) {
  this.crs = crs;
  if ( envelope != null ) {
    // rb: this is not correct, the values of the envelope should be converted to the given crs, shouldn't they.
    this.envelope = geomFactory.createEnvelope( envelope.getMin().getAsArray(), envelope.getMax().getAsArray(),
                          crs );
  }
}

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

/**
 * @param crs
 */
public void setCoordinateSystem( ICRS crs ) {
  this.crs = crs;
  bbox = fac.createEnvelope( bbox.getMin().getAsArray(), bbox.getMax().getAsArray(), crs );
}

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

private float[] calcOptimalEye( Envelope bBox ) {
  float[] eye = new float[] { 0, 1, 1 };
  if ( bBox != null ) {
    double[] min = bBox.getMin().getAsArray();
    double[] max = bBox.getMax().getAsArray();
    double centerX = min[0] + ( ( max[0] - min[0] ) * 0.5f );
    double centerY = min[1] + ( ( max[1] - min[1] ) * 0.5f );
    // float centerZ = bBox[2] + ( ( bBox[2] - bBox[5] ) * 0.5f );
    double eyeZ = 2 * ( ( Math.max( bBox.getSpan0(), bBox.getSpan1() ) / 2 ) / Math.tan( Math.toRadians( fov * 0.5 ) ) );
    eye = new float[] { (float) centerX, (float) centerY, (float) eyeZ };
  }
  return eye;
}

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

private void exportAsPos( Point point )
            throws XMLStreamException, UnknownCRSException, TransformationException {
  writer.writeStartElement( gmlNs, "pos" );
  double[] ordinates = getTransformedCoordinate( point.getCoordinateSystem(), point.getAsArray() );
  writer.writeCharacters( formatter.format( ordinates[0] ) );
  for ( int i = 1; i < ordinates.length; i++ ) {
    writer.writeCharacters( " " + formatter.format( ordinates[i] ) );
  }
  writer.writeEndElement();
}

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

private final String encodePropValue( Envelope env ) {
    if ( env == null ) {
      return "";
    }
    StringBuilder sb = new StringBuilder();
    sb.append( env.getCoordinateSystem().getId() );
    Point p = env.getMin();
    for ( double d : p.getAsArray() ) {
      sb.append( ',' );
      sb.append( d );
    }
    p = env.getMax();
    for ( double d : p.getAsArray() ) {
      sb.append( ',' );
      sb.append( d );
    }
    return sb.toString();
  }
}

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

@Override
public double[] getAsArray() {
  double[] coords = new double[getDimension() * size()];
  int i = 0;
  for ( Point p : this ) {
    for ( double coord : p.getAsArray() ) {
      coords[i++] = coord;
    }
  }
  return coords;
}

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

private void exportCubicSpline( CubicSpline cubicSpline )
            throws XMLStreamException, UnknownCRSException, TransformationException {
  writer.writeStartElement( "gml", "CubicSpline", gmlNs );
  writer.writeAttribute( "interpolation", "cubicSpline" );
  int dim = cubicSpline.getCoordinateDimension();
  export( cubicSpline.getControlPoints(), dim );
  writer.writeStartElement( "gml", "vectorAtStart", gmlNs );
  double[] array = cubicSpline.getVectorAtStart().getAsArray();
  for ( int i = 0; i < array.length; i++ ) {
    writer.writeCharacters( String.valueOf( array[i] ) + " " );
  }
  writer.writeEndElement();
  writer.writeStartElement( "gml", "vectorAtEnd", gmlNs );
  array = cubicSpline.getVectorAtEnd().getAsArray();
  for ( int i = 0; i < array.length; i++ )
    writer.writeCharacters( String.valueOf( array[i] ) + " " );
  writer.writeEndElement();
  writer.writeEndElement();
}

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

@Override
public double[] getAsArray() {
  double[] coords = new double[getDimension() * size()];
  int i = 0;
  for ( Point p : this ) {
    for ( double coord : p.getAsArray() ) {
      coords[i++] = coord;
    }
  }
  return coords;
}

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

@Override
public double[] getAsArray() {
  double[] coords = new double[getDimension() * size()];
  int i = 0;
  for ( Point p : this ) {
    for ( double coord : p.getAsArray() ) {
      coords[i++] = coord;
    }
  }
  return coords;
}

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

@Override
public double[] getAsArray() {
  double[] coords = new double[getDimension() * size()];
  int i = 0;
  for ( Point p : this ) {
    for ( double coord : p.getAsArray() ) {
      coords[i++] = coord;
    }
  }
  return coords;
}

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

@Override
public double[] getAsArray() {
  double[] coords = new double[getDimension() * ( size() - startIdx )];
  int i = 0;
  int j = 0;
  for ( Point p : this ) {
    if ( i++ >= startIdx ) {
      for ( double coord : p.getAsArray() ) {
        coords[j++] = coord;
      }
    }
  }
  return coords;
}

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

private void exportCoord( Point point )
            throws XMLStreamException, TransformationException, UnknownCRSException {
  double[] ords = getTransformedCoordinate( point.getCoordinateSystem(), point.getAsArray() );
  writer.writeStartElement( "gml", "coord", GML21NS );
  writer.writeStartElement( "gml", "X", GML21NS );
  writer.writeCharacters( formatter.format( ords[0] ) );
  writer.writeEndElement();
  if ( ords.length > 1 ) {
    writer.writeStartElement( "gml", "Y", GML21NS );
    writer.writeCharacters( formatter.format( ords[1] ) );
    writer.writeEndElement();
    if ( ords.length > 2 ) {
      writer.writeStartElement( "gml", "Z", GML21NS );
      writer.writeCharacters( formatter.format( ords[2] ) );
      writer.writeEndElement();
    }
  }
  writer.writeEndElement(); // </gml:coord>
}

相关文章