MSFViewState
Objective-C
@interface MSFViewState : NSObject {
void *swigCPtr;
BOOL swigCMemOwn;
}
Swift
class MSFViewState : NSObject
A class containing various view parameters for a view state.
-
Checks if this object is equal to the specified object.
Declaration
Objective-C
- (BOOL)isEqual:(id)object;Swift
func isEqual(_ object: Any!) -> BoolParameters
objectThe reference object.
Return Value
True when objects are equal, false otherwise.
-
Returns the hash value of this object.
Declaration
Objective-C
- (NSUInteger)hash;Swift
func hash() -> UIntReturn Value
The hash value of this object.
-
Moves the focus AND the camera by deltaZ, keeping zoom, tilt and rotation: the camera-to-focus vector is untouched. MapRenderer uses it to keep the focus ON the terrain under it, which is what makes the zoom the camera’s distance to the ground at the focus, as in mapbox, rather than to sea level.
Declaration
Objective-C
- (void)liftFocus:(double)deltaZ;Swift
func liftFocus(_ deltaZ: Double) -
Returns the camera tilt angle. A NEGATIVE tilt means the view looks above the horizon.
Declaration
Objective-C
- (float)getTilt;Swift
func getTilt() -> FloatReturn Value
The camera tilt angle in degrees.
-
Sets the tilt of the VIEW only, leaving the camera where it is. The difference between the camera tilt and this one is applied as a rotation of the view about the camera, so the camera does not move at all - which is what a first person look is.
Declaration
Objective-C
- (void)setViewTilt:(float)tilt;Swift
func setViewTilt(_ tilt: Float)Parameters
tiltThe new view tilt angle in degrees.
-
Returns the tilt the CAMERA POSITION is built at: the camera-to-focus vector is at this angle, never below the horizon, and the difference to the view tilt is a rotation of the view about the camera (see calculateLookatMat).
Declaration
Objective-C
- (float)getCameraTilt;Swift
func getCameraTilt() -> FloatReturn Value
The camera tilt angle in degrees, never negative.
-
Returns the unit direction the camera looks along, including the look above the horizon that a negative tilt adds.
Declaration
Objective-C
- (SWIGTYPE_cglib__vec3T_double_t *)calculateViewDir;Swift
func calculateViewDir() -> SWIGTYPE_cglib__vec3T_double_t!Return Value
The view direction, or a zero vector if the camera and the focus coincide.
-
Returns the camera zoom level.
Declaration
Objective-C
- (float)getZoom;Swift
func getZoom() -> FloatReturn Value
The camera zoom level.
-
Returns the state of the camera changed flag.
Declaration
Objective-C
- (BOOL)isCameraChanged;Swift
func isCameraChanged() -> BoolReturn Value
True if camera has changed since the last frame.
-
Returns the camera rotation angle.
Declaration
Objective-C
- (float)getRotation;Swift
func getRotation() -> FloatReturn Value
The camera rotation angle in degrees.
-
The zoom the RENDERER works in: the reported zoom plus Options::ZoomOffset. vt sizes by
2^(zoom - tileZoom), so it needs the zoom the tiles were chosen for.Declaration
Objective-C
- (float)getRenderZoom;Swift
func getRenderZoom() -> FloatReturn Value
The renderer’s zoom level.
-
Returns the distance between the focus and the camera position, when the zoom level is set to 0. This parameter depends on the screen size, DPI, tile draw size and field of view settings.
Declaration
Objective-C
- (float)getZoom0Distance;Swift
func getZoom0Distance() -> FloatReturn Value
The distance between focus to camera position, when zoom level = 0.
-
Returns the width of the map screen.
Declaration
Objective-C
- (int)getWidth;Swift
func getWidth() -> Int32Return Value
The map screen width.
-
Returns the height of the map screen.
Declaration
Objective-C
- (int)getHeight;Swift
func getHeight() -> Int32Return Value
The map screen height.
-
Returns the aspect ratio of the map screen. Equal to width / height.
Declaration
Objective-C
- (float)getAspectRatio;Swift
func getAspectRatio() -> FloatReturn Value
The aspect ratio of the map screen.
-
Returns the near plane distance.
Declaration
Objective-C
- (float)getNear;Swift
func getNear() -> FloatReturn Value
The new plane distance.
-
Returns the far plane distance.
Declaration
Objective-C
- (float)getFar;Swift
func getFar() -> FloatReturn Value
The far plane distance.
-
Sets the terrain height range (in internal units). The range extends the near/far plane calculation so that displaced terrain is not clipped.
Declaration
Objective-C
- (void)setTerrainHeightRange:(float)minZ maxZ:(float)maxZ;Swift
func setTerrainHeightRange(_ minZ: Float, maxZ: Float)Parameters
minZThe minimum terrain height.
maxZThe maximum terrain height.
-
Turns the terrain zoom bound off (no terrain, or a non-planar projection).
Declaration
Objective-C
- (void)clearTerrainCameraReference;Swift
func clearTerrainCameraReference() -
Returns the maximum zoom allowed by the terrain clearance, or infinity when no terrain bound is active. Evaluated against the CURRENT camera state, so it carries no frame lag: zooming in by this delta lands the camera exactly on the clearance shell. Every zoom path (gesture, animation, kinetic fling, API) is clamped by it, which is what keeps the camera from being pushed into the terrain and then corrected back out - the correction/gesture fight that makes zooming jump back and forth. Below the current zoom when the camera is already under the shell: the bound then stops a zoom in, and MapRenderer’s correction lifts the camera.
Declaration
Objective-C
- (float)getTerrainMaxZoom;Swift
func getTerrainMaxZoom() -> FloatReturn Value
The terrain-imposed maximum zoom.
-
Returns the camera-to-focus distance at the given zoom, what the zoom is calibrated on.
Declaration
Objective-C
- (double)getOrbitDistance:(float)zoom;Swift
func getOrbitDistance(_ zoom: Float) -> DoubleParameters
zoomThe zoom.
Return Value
The distance in internal units.
-
Returns the vertical field of view angle.
Declaration
Objective-C
- (int)getFOVY;Swift
func getFOVY() -> Int32Return Value
The vertical field of view angle in degrees.
-
Returns a value that is used for converting display independent pixels (dp) to pixels (px). This values depends on the screen density.
Declaration
Objective-C
- (float)getDPToPX;Swift
func getDPToPX() -> FloatReturn Value
The dp to px value.
-
Returns the dots per inch parameter of the screen.
Declaration
Objective-C
- (float)getDPI;Swift
func getDPI() -> FloatReturn Value
The screen DPI parameter.
-
Returns the conversion ratio between internal map units and screen pixels. This parameter is dependent on the zoom level and other screen parameters.
Declaration
Objective-C
- (float)getUnitToPXCoef;Swift
func getUnitToPXCoef() -> FloatReturn Value
The conversion ratio between internal map units and screen pixels.
-
Returns the conversion ratio between internal map units and screen density independent pixels (DP or DIP). This parameter is dependent on the zoom level, DPI and other screen parameters.
Declaration
Objective-C
- (float)getUnitToDPCoef;Swift
func getUnitToDPCoef() -> FloatReturn Value
The conversion ratio between internal map units and screen density independent pixels.
-
Returns the view frustum grown by the label padding band, the one tiles must reach for their labels to be placed before they scroll in. See vt::ViewState::labelPadding.
Declaration
Objective-C
- (SWIGTYPE_p_cglib__frustum3T_double_t *)getLabelFrustum;Swift
func getLabelFrustum() -> SWIGTYPE_p_cglib__frustum3T_double_t!Return Value
The label view frustum.
-
Returns the screen width.
Declaration
Objective-C
- (int)getScreenWidth;Swift
func getScreenWidth() -> Int32Return Value
The current screen width.
-
Returns the screen height.
Declaration
Objective-C
- (int)getScreenHeight;Swift
func getScreenHeight() -> Int32Return Value
The current screen height.
-
Returns the normalized device y below which no ray from the screen reaches the sky - the horizon, in other words, in the space the sky quad is drawn in. 1 when no sky is visible at all. Only meaningful when isSkyVisible() is true.
Declaration
Objective-C
- (float)getSkyHorizonNDC;Swift
func getSkyHorizonNDC() -> FloatReturn Value
The horizon’s position in normalized device coordinates, -1 (bottom) to 1 (top).
-
How far from the camera the map is drawn, in internal units - tangram’s rule, scaled by TerrainOptions::ViewDistanceFactor. Both the far plane and the tile walk stop here, so the tiles fetched are exactly the tiles the frustum can show. 0 means “as far as the visible ground goes” (factor 0).
Declaration
Objective-C
- (double)calculateViewDistance:(MSFOptions *)options;Swift
func calculateViewDistance(_ options: MSFOptions!) -> DoubleParameters
optionsThe options object.
Return Value
The view distance in internal units, or 0 if it is unbounded.
-
The distance from the camera to the focus point - tangram’s m_pos.z, which is what their near and far planes are built on. It is a function of the zoom alone, so the depth budget does not change with the terrain under the camera.
Declaration
Objective-C
- (double)calculateCameraDistance;Swift
func calculateCameraDistance() -> DoubleReturn Value
The camera to focus distance in internal units.
-
Undocumented
Declaration
Objective-C
-(void)dealloc;Swift
func dealloc()