Class Viewport (2.40.0)

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
Type Description
int

LOW_FIELD_NUMBER

public static final int LOW_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Viewport getDefaultInstance()
Returns
Type Description
Viewport

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static Viewport.Builder newBuilder()
Returns
Type Description
Viewport.Builder

newBuilder(Viewport prototype)

public static Viewport.Builder newBuilder(Viewport prototype)
Parameter
Name Description
prototype Viewport
Returns
Type Description
Viewport.Builder

parseDelimitedFrom(InputStream input)

public static Viewport parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Viewport
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Viewport parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Viewport
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Viewport parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Viewport
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Viewport
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Viewport parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Viewport
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Viewport
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Viewport parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Viewport
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Viewport
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Viewport parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Viewport
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Viewport
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Viewport parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Viewport
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Viewport parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Viewport
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Viewport> parser()
Returns
Type Description
Parser<Viewport>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getDefaultInstanceForType()

public Viewport getDefaultInstanceForType()
Returns
Type Description
Viewport

getHigh()

public LatLng getHigh()

Required. The high point of the viewport.

.google.type.LatLng high = 2;

Returns
Type Description
LatLng

The high.

getHighOrBuilder()

public LatLngOrBuilder getHighOrBuilder()

Required. The high point of the viewport.

.google.type.LatLng high = 2;

Returns
Type Description
LatLngOrBuilder

getLow()

public LatLng getLow()

Required. The low point of the viewport.

.google.type.LatLng low = 1;

Returns
Type Description
LatLng

The low.

getLowOrBuilder()

public LatLngOrBuilder getLowOrBuilder()

Required. The low point of the viewport.

.google.type.LatLng low = 1;

Returns
Type Description
LatLngOrBuilder

getParserForType()

public Parser<Viewport> getParserForType()
Returns
Type Description
Parser<Viewport>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

hasHigh()

public boolean hasHigh()

Required. The high point of the viewport.

.google.type.LatLng high = 2;

Returns
Type Description
boolean

Whether the high field is set.

hasLow()

public boolean hasLow()

Required. The low point of the viewport.

.google.type.LatLng low = 1;

Returns
Type Description
boolean

Whether the low field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Viewport.Builder newBuilderForType()
Returns
Type Description
Viewport.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Viewport.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Viewport.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public Viewport.Builder toBuilder()
Returns
Type Description
Viewport.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException