Package globus.glmap
Class GLMapDrawable
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapDrawObject
globus.glmap.GLMapDrawable
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
GLMapBalloon,GLMapImage,GLMapLabel,GLMapLineArrow,GLMapVectorLayer
GLMapDrawable is a bridge class that displays single object on map. This can be
image, text or vector object.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDraw target of drawable objectsstatic @interfaceDetermines how to use scale and offset of drawable -
Method Summary
Modifier and TypeMethodDescriptionfloatgetAngle()Angle of imageintReturns draw target of object.intLoaded image height.Offset of imagePosition of imagebooleanWhether image rotates with the mapdoublegetScale()Scale of vector objectandroid.graphics.RectFgetScreenBBox(GLMapViewRenderer mapView) Calculates screen bbox of objectintgetWidth()Loaded image width.voidsetAngle(float angle) Sets angle of image.voidsetDrawTarget(int drawTarget) Sets draw target of objectvoidsetOffset(int offsetX, int offsetY) Image offset from position.voidsetPosition(MapPoint position) Sets position of the drawable on the map.voidsetRotatesWithMap(boolean rotate) Sets whether image rotates with the map.voidsetScale(double scale) Scale of vector objectvoidsetTransformMode(int transformMode) If drawable contains vector object and you will use position and scale to transform vector object, then set this to TransformMode.Custom.Methods inherited from class globus.glmap.GLMapDrawObject
getDrawOrder, isHidden, setHiddenMethods inherited from class globus.glmap.GLNativeObject
close, dispose
-
Method Details
-
getScreenBBox
Calculates screen bbox of object- Parameters:
mapView- mapView where object is displayed- Returns:
- screen bbox of object
-
setPosition
Sets position of the drawable on the map.image.setPosition(MapPoint.CreateFromGeoCoordinates(40.7, -74.0)); // New York- Parameters:
position- position in internal map coordinates- See Also:
-
getPosition
Position of image- Returns:
- position of image in internal map coordinates
-
setScale
public void setScale(double scale) Scale of vector object- Parameters:
scale- new scale for vector object
-
getScale
public double getScale()Scale of vector object- Returns:
- scale of vector object
-
setAngle
public void setAngle(float angle) Sets angle of image.image.setAngle(45);- Parameters:
angle- angle to set
-
getAngle
public float getAngle()Angle of image- Returns:
- angle of image in degrees.
-
getWidth
public int getWidth()Loaded image width.- Returns:
- width of image in pixels.
-
getHeight
public int getHeight()Loaded image height.- Returns:
- height of image in pixels.
-
setRotatesWithMap
public void setRotatesWithMap(boolean rotate) Sets whether image rotates with the map.- Parameters:
rotate-trueto rotate with map
-
getRotatesWithMap
public boolean getRotatesWithMap()Whether image rotates with the map- Returns:
- true if image rotates with the map
-
setDrawTarget
public void setDrawTarget(int drawTarget) Sets draw target of object- Parameters:
drawTarget- new value
-
getDrawTarget
public int getDrawTarget()Returns draw target of object. Default value can be different for different types.- Returns:
- object draw target
-
setOffset
public void setOffset(@IntRange(from=-32768L,to=32767L) int offsetX, @IntRange(from=-32768L,to=32767L) int offsetY) Image offset from position. When offset is (0,0), bottom left corner of image is displayed atpositionimage.setOffset(bmp.getWidth()/2, bmp.getHeight()/2); // image center displayed at position- Parameters:
offsetX- x offset of imageoffsetY- y offset of image- See Also:
-
setTransformMode
public void setTransformMode(int transformMode) If drawable contains vector object and you will use position and scale to transform vector object, then set this to TransformMode.Custom.- Parameters:
transformMode- mode of transforming position and scale
-
getOffset
Offset of image- Returns:
- offset of image in pixels
-