Class Viewport (2.23.1)

public final class Viewport extends GeneratedMessageV3 implements ViewportOrBuilder

A latitude-longitude viewport, represented as two diagonally opposite low and high points. A viewport is considered a closed region, i.e. it includes its boundary. The latitude bounds must range between -90 to 90 degrees inclusive, and the longitude bounds must range between -180 to 180 degrees inclusive. Various cases include:

  • If low = high, the viewport consists of that single point.

  • If low.longitude > high.longitude, the longitude range is inverted (the viewport crosses the 180 degree longitude line).

  • If low.longitude = -180 degrees and high.longitude = 180 degrees, the viewport includes all longitudes.

  • If low.longitude = 180 degrees and high.longitude = -180 degrees, the longitude range is empty.

  • If low.latitude > high.latitude, the latitude range is empty.

    Both low and high must be populated, and the represented box cannot be empty (as specified by the definitions above). An empty viewport will result in an error.

    For example, this viewport fully encloses New York City:

    { "low": { "latitude": 40.477398, "longitude": -74.259087 }, "high": { "latitude": 40.91618, "longitude": -73.70018 } }

Protobuf type google.geo.type.Viewport

Implements

ViewportOrBuilder

Static Fields

HIGH_FIELD_NUMBER

public static final int HIGH_FIELD_NUMBER
Field Value
TypeDescription
int

LOW_FIELD_NUMBER

public static final int LOW_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static Viewport getDefaultInstance()
Returns
TypeDescription
Viewport

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static Viewport.Builder newBuilder()
Returns
TypeDescription
Viewport.Builder

newBuilder(Viewport prototype)

public static Viewport.Builder newBuilder(Viewport prototype)
Parameter
NameDescription
prototypeViewport
Returns
TypeDescription
Viewport.Builder

parseDelimitedFrom(InputStream input)

public static Viewport parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Viewport parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static Viewport parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Viewport parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Viewport parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static Viewport parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static Viewport parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Viewport
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<Viewport> parser()
Returns
TypeDescription
Parser<Viewport>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getDefaultInstanceForType()

public Viewport getDefaultInstanceForType()
Returns
TypeDescription
Viewport

getHigh()

public LatLng getHigh()

Required. The high point of the viewport.

.google.type.LatLng high = 2;

Returns
TypeDescription
LatLng

The high.

getHighOrBuilder()

public LatLngOrBuilder getHighOrBuilder()

Required. The high point of the viewport.

.google.type.LatLng high = 2;

Returns
TypeDescription
LatLngOrBuilder

getLow()

public LatLng getLow()

Required. The low point of the viewport.

.google.type.LatLng low = 1;

Returns
TypeDescription
LatLng

The low.

getLowOrBuilder()

public LatLngOrBuilder getLowOrBuilder()

Required. The low point of the viewport.

.google.type.LatLng low = 1;

Returns
TypeDescription
LatLngOrBuilder

getParserForType()

public Parser<Viewport> getParserForType()
Returns
TypeDescription
Parser<Viewport>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

hasHigh()

public boolean hasHigh()

Required. The high point of the viewport.

.google.type.LatLng high = 2;

Returns
TypeDescription
boolean

Whether the high field is set.

hasLow()

public boolean hasLow()

Required. The low point of the viewport.

.google.type.LatLng low = 1;

Returns
TypeDescription
boolean

Whether the low field is set.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public Viewport.Builder newBuilderForType()
Returns
TypeDescription
Viewport.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Viewport.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
Viewport.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public Viewport.Builder toBuilder()
Returns
TypeDescription
Viewport.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides
Exceptions
TypeDescription
IOException