Class Map
- java.lang.Object
-
- com.supermap.mapping.Map
-
public class Map extends java.lang.Object
map class, responsible for the management of the map display environment.
The map is a visualization of geographic data, usually consisting of one or more layers. A map object usually manages all of its layers through its layer collection object Layers, and the map must be associated with a workspace to display the data in the workspace. In addition, the setting of the map's display mode will work for all of the layers. This class provides the return and settings of the various display modes of the map, such as the display range of the map, the scale, the coordinates and the default display mode of the measurement unit, the coordinate system and the text, the point, etc., and provide the map Such as the opening and closing of the map, zooming, translating and full-width display, and the output of the map.
Note:
- After editing the Map from the workspace, it must be saved to Maps in the workspace. Otherwise, editing of the Map can not be saved.
- Close the Map object;
- Close the MapControl object;
- Close the Workspace object.
- If Workspace and MapControl have been associated while programming, when closing the objects, you should follow the following orders.
-
-
Constructor Summary
Constructors Constructor and Description Map()
Initializes a new instance of the Map class.Map(Workspace workspace)
Initializes a new instance of the Map class, and associates this map with the specified workspace.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
addLayersFromMap(java.lang.String strMapName, boolean useDynamicProjectionIfNeeded)
Merges mapsvoid
close()
Closes this map.Legend
createLegend()
Sets a legend This legend supports to display filling symbols.void
dispose()
Disposes the resources occupied by the object.double
getAngle()
Returns the rotation angle of this map.int
getARMapType()
Gets different ARMap typesGeoStyle
getBackgroundStyle()
Returns the background style of the map.Rectangle2D
getBounds()
Returns the spatial extent of this map.Point2D
getCenter()
Returns the center point of the view bounds of this map.GeoRegion
getClipRegion()
Gets the face used for map croppingMapColorMode
getColorMode()
Get the color mode of the mapLegend
getCreateLegend()
Gets a legendint
getCurrentPlayerTick()
Returns the playing frame number of the current mapjava.lang.String
getCurrentTickEndTime()
When playing the temporal data, gets the ending time of the current framejava.lang.String
getCurrentTickStartTime()
When playing the temporal data, gets the starting time of the current framejava.util.Date
getDefaultMapEndTime()
Traverses all enabling times and time fields of visible layers.java.util.Date
getDefaultMapStartTime()
Traverses all enabling times and time fields of visible layers.java.lang.String
getDescription()
Returns the description of the map.CoordSysTransMethod
getDynamicPrjTransMethond()
The projection algorithm used to get the map dynamic projection needs to be set in different ellipsoids.CoordSysTransParameter
getDynamicPrjTransParameter()
The conversion parameters used to get the map dynamic projectionint
getImageSizeHeight()
Returns the height of the image.int
getImageSizeWidth()
Returns the width of the image.boolean
getIsPOIOptimized()
Whether to optimize POI displayLayers
getLayers()
Returns the layers object of this map.Legend
getLegend()
Gets the legend of the map.Rectangle2D
getLockedViewBounds()
Returns the locked view bounds of the map control.int
getMapDownLoadThreadNum()
Gets the number of network download threads Should be called before adding or opening a mapdouble
getMapDPI()
Gets the Map dpi.java.util.Date
getMapEndTime()
Returns the ending time of the time line displayed when playing the temporal data.MapLoadedListener
getMapLoadedListener()
Get a listener which is used to receive the map add complete events.java.util.Date
getMapStartTime()
Returns the starting time of the time line displayed when playing the temporal data.MapView
getMapView()
Gets map comtrol of Mapdouble
getMaxScale()
Returns the maximum scale of the map.int
getMaxVisibleVertex()
Gets the maximum number of visible nodesdouble
getMinScale()
Returns the minimum scale of the map.TimeSpan
getMinTimeStep()
Calculates the default time step when playing the temporal datajava.lang.String
getName()
Returns the name of the current map.MapOverlapDisplayedOptions
getOverlapDisplayedOptions()
Gets or sets overlap options.PrjCoordSys
getPrjCoordSys()
Returns the projected coordinate system of the map.double
getScale()
Returns the display scale of the current map.ScreenLayer
getScreenLayer()
Get the screen layer.double
getSlantAngle()
Gets the rotation anglejava.lang.String
getTimeFormat()
When playing temporal data, if you set the window displays the time range of the current frame, the interface returns the time format.TimeSpan
getTimeStep()
Returns the time step interval of the temporal dataTimeSpan
getTimeWindow()
Returns the time windowTrackingLayer
getTrackingLayer()
Gets the tracking layer of this map.Rectangle2D
getUserEditBounds()
Gets the user editing bound.Rectangle2D
getViewBounds()
Returns the view bounds of this map, and the view bounds are also called display extent.double[]
getVisibleScales()
Get a fixed scale array, which is a scale that can be displayed when a fixed scale is displayedWorkspace
getWorkspace()
Returns the workspace that the current map is associated with.boolean
isAntialias()
Returns a boolean value indicating whether to anti-alias this map.boolean
IsArmap()
Whether it is an Ar mapboolean
IsClipRegionEnabled()
Gets whether the map clipping took effectboolean
isDrawCADTextAsPOI()
Gets whether CAD text is drawn in POI modeboolean
isDynamicProjection()
Returns whether to allow dynamic projection while displaying the map.boolean
isFullScreenDrawModel()
Gets whether or not to use full-screen drawing mode.boolean
isHighDefinitionMode()
Gets whether the image display mode is high definitionboolean
isHighPerformSymbolMode()
Returns whether the high-performance symbol rendering mode is performed, and filters the symbol rendering based on the number of objects and scale Requires calling before adding or opening a mapboolean
isModified()
Returns a boolean value indicating whether this map is modified.boolean
isMVTTop()
Returns whether the MVT layer is on top.boolean
isOverlapDisplayed()
Gets or sets a value indicating whether to display objects when there are overlaps including text overlaps text and diagrams overlap diagrams.boolean
isPaintBackground()
Returns a boolean value indicating whether the background of this map will be painted.boolean
isShowTime()
Returns whether the window displays the text of the time range of the current frame.boolean
isTimeEnable()
Returns whether the map enables the feature Play Temporal Databoolean
isUseSystemDPI()
Get whether to use system DPI. setDPI is valid when it is false.boolean
isViewBoundsLocked()
Returns a boolean value used to specify whether to lock the visible extent of the map in the map control.boolean
isVisibleScalesEnabled()
Whether to use a fixed scale to display the mapPoint
mapToPixel(Point2D point)
Converts the map coordinates of the specified point to the pixel coordinates.boolean
open(java.lang.String name)
Opens the map with the specified name.DatasetImage
outputMapToDatasetImage(Datasource datasource, java.lang.String datasetName, double resolution, Rectangle2D bounds, EncodeType encodeType)
Saves the current map as an image datasetvoid
pan(double offsetX, double offsetY)
Pans this map by the specified distance.Point2D
pixelToMap(Point point)
Converts the pixel coordinates of the specified point to the map coordinates.void
refresh()
Redraws the current map.void
removePrjCoordSysTransListener(PrjCoordSysTranslatorListener listener)
Remove the custom projection conversion algorithm interface classboolean
save()
Save current map to the workspace.boolean
save(java.lang.String mapName)
Save the map with a specified name, but the name cannot be the same with the name of the maps in currentl workspace.boolean
saveAs(java.lang.String mapName)
Save current map as a map with specified name.void
setAngle(double value)
Sets the rotation angle of this map.void
setAntialias(boolean value)
Sets a boolean value indicating whether to anti-alias this map.void
setARMapType(int value)
Sets different ARMap typesvoid
setBackgroundStyle(GeoStyle style)
Sets the background style of this map.void
setCenter(Point2D point)
Sets the center point of the view bounds of this map.void
setClipRegion(GeoRegion region)
Sets the face used for map croppingvoid
setClipRegionEnabled(boolean value)
Sets whether the map clipping takes effectvoid
setColorMode(MapColorMode mapColorMode)
Set the color mode of the mapvoid
setCurrentPlayerTick(int currentTick)
Sets the playing frame number of the current mapvoid
setDescription(java.lang.String value)
Sets the description of the map.void
setDrawCADTextAsPOI(boolean nDrawCADTextAsPOI)
Sets whether CAD text is drawn in POI modevoid
setDynamicPrjTransMethond(CoordSysTransMethod transMethod)
The algorithm used to convert the geographic coordinate system when dynamic projection is set, does not support the extended algorithm, ie:CoordSysTransMethod.MTH_EXTENTIONvoid
setDynamicPrjTransParameter(CoordSysTransParameter value)
Sets the conversion parameters used when the map is dynamically projectedvoid
setDynamicProjection(boolean value)
Sets whether to allow dynamic projection while displaying the map.void
setDynamicProjection(boolean bDynamic, PrjCoordSys value)
Set whether the map is dynamically projected, and the projected coordinate system of the mapvoid
setFullScreenDrawModel(boolean isFullScreen)
Sets whether drawing in the full screen.void
setHighDefinitionMode(boolean isHighDefinitionMode)
Sets the high definition image display mode Calls before adding or opening a mapvoid
setHighPerformSymbolMode(boolean isHighPerformSymbolMode)
Set the high-performance symbol rendering mode to filter the symbol rendering based on the number of objects and scale Requires calling before adding or opening a mapvoid
setIsArmap(boolean isArmap)
Set to an Ar mapvoid
setIsCadBatchRender(boolean bIsCadBatchRender)
Sets whether to enable bulk drawing mode for CAD layer.void
setIsPOIOptimized(boolean bPOIOptimized)
Whether to optimize POI displayvoid
setIsShowTime(boolean isShowTime)
Sets whether the window displays the text of the time range of the current frame.void
setLockedViewBounds(Rectangle2D rect)
Sets the locked view bounds of this MapControl.void
setMapDownLoadThreadNum(int num)
Set the number of network download threads Should be called before adding or opening a mapvoid
setMapDPI(double dpi)
Sets the Map dpi.void
setMapEndTime(java.util.Date endTime)
Sets the ending time of the time line displayed when playing the temporal data.void
setMapLoadedListener(MapLoadedListener listener)
Adds a listener which is used to receive the map add complete events.void
setMapOperateListener(MapOperateListener listener)
Adds a listener used to receive map open and closed events.void
setMapStartTime(java.util.Date startTime)
Sets the starting time of the time line displayed when playing the temporal data.void
setMaxScale(double value)
Sets the maximum display scale of the map.void
setMaxVisibleVertex(int value)
Sets the maximum number of visible nodesvoid
setMinScale(double value)
Sets the minimum display scale of the map.void
setModified(boolean value)
Sets whether the map has been edited.void
setMVTTop(boolean MVTTop)
Sets whether the MVT layer is on top.void
setOverlapDisplayed(boolean value)
Gets or sets a value indicating whether to display objects when there are overlaps including text overlaps text and diagrams overlap diagrams.void
setOverlapDisplayedOptions(MapOverlapDisplayedOptions value)
Gets or sets the overlap item.void
setPaintBackground(boolean value)
Sets a boolean value indicating whether the background of this map will be painted.void
setPrjCoordSys(PrjCoordSys value)
Sets the projected coordinate system of the map.void
setPrjCoordSysTransListener(PrjCoordSysTranslatorListener listener, PrjCoordSys srcPrjCoordSys, PrjCoordSys desPrjCoordSys)
Set the custom projection conversion algorithm interface classvoid
setScale(double value)
Sets the display scale of the current map.void
setSlantAngle(double value)
Sets the rotation anglevoid
setTimeEnable(boolean bEnable)
Sets whether the map enables the feature Play Temporal Datavoid
setTimeFormat(java.lang.String timeFormat)
When playing temporal data, if you set the window displays the time range of the current frame, the interface sets the time format.void
setTimeStep(TimeSpan timeStep)
Sets the time step interval of the temporal datavoid
setTimeWindow(TimeSpan timeWindow)
Sets the time windowvoid
setUserEditBounds(Rectangle2D rect)
Sets the user editing bound.void
setUseSystemDPI(boolean setMapDPI)
Set whether to use system DPI. setDPI is valid when it is false.void
setViewBounds(Rectangle2D rect)
Sets the view bounds of this map, and the view bounds are also called display extent.void
setViewBoundsLocked(boolean value)
Sets a boolean value used to specify whether to lock the visible extent of the map in the map control.void
setVisibleScales(double[] values)
Set the fixed scale array, that is, the scale that can be displayed when the fixed scale is displayedvoid
setVisibleScalesEnabled(boolean value)
Sets whether to use a fixed scale to display the mapvoid
setWorkspace(Workspace workspace)
Sets the workspace that the current map is associated with.java.lang.String
toXML()
Returns the xml string representation of the map object.void
viewEntire()
Displays the map in full extent.void
zoom(double ratio)
The specified ratio by which to zoom the map.
-
-
-
Constructor Detail
-
Map
public Map()
Initializes a new instance of the Map class.
-
Map
public Map(Workspace workspace)
Initializes a new instance of the Map class, and associates this map with the specified workspace.- Parameters:
workspace
- Specifies the workspace.
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of the current map.- Returns:
- the name of the current map.
- Default:
- defaults to UntitledMap.
-
getDescription
public java.lang.String getDescription()
Returns the description of the map.- Returns:
- description of the current map.
- Default:
- defaults to an empty string.
-
addLayersFromMap
public boolean addLayersFromMap(java.lang.String strMapName, boolean useDynamicProjectionIfNeeded)
Merges maps- Parameters:
strMapName
- StringuseDynamicProjectionIfNeeded
- boolean- Returns:
- boolean
-
setDescription
public void setDescription(java.lang.String value)
Sets the description of the map.- Parameters:
value
- Specifies the description of the current map.
-
getAngle
public double getAngle()
Returns the rotation angle of this map. The unit is degree, and the positive direction is anticlockwise. The rotation angle is accurate to 0.1 degree. If user input the negative value, the map will rotate in the clockwise direction.- Returns:
- double The rotation angle of the current map.
- Default:
- defaults to 0 degrees, ie does not rotate
-
setAngle
public void setAngle(double value)
Sets the rotation angle of this map. The unit is degree, and the positive direction is anticlockwise. The rotation angle is accurate to 0.1 degree. If user input the negative value, the map will rotate in the clockwise direction.Note: Setting the map rotation angle function is only supported when the full-screen drawing mode is turned on.
- Parameters:
value
- Specifies the rotation angle of the current map.
-
getBackgroundStyle
public GeoStyle getBackgroundStyle()
Returns the background style of the map.- Returns:
- The background style of the current map.
- Default:
- defaults to {FillBackColor=Color [A=255, R=255, G=255, B=255],FillForeColor=Color [A=255, R=255, G=255, B=255],FillGradientAngle=0,FillGradientMode=None,FillGradientOffsetRatioX=0,FillGradientOffsetRatioY=0,FillOpaqueRate=100,FillSymbolID=0,LineColor=Color [A=255, R=0, G=0, B=0],LineSymbolID=0,LineWidth=0.1,MarkerAngle=0,MarkerSize={Width=2.4,Height=-1},MarkerSymbolID=0}.
-
setBackgroundStyle
public void setBackgroundStyle(GeoStyle style)
Sets the background style of this map.- Parameters:
style
- Specifies the background style of the current map.
-
getBounds
public Rectangle2D getBounds()
Returns the spatial extent of this map. The spatial extent of a map is the boundary rectangle of extents of all the datasets, that is, the minimum rectangle that contains extents of all the datasets. When adding or deleting datasets that displayed in the map, the spatial extent will change correspondingly.- Returns:
- the current space of the map.
- Default:
- The default value is Rectangle2D(0,0,0,0).
-
getViewBounds
public Rectangle2D getViewBounds()
Returns the view bounds of this map, and the view bounds are also called display extent. Besides thesetViewBounds()
method, the view bounds of this map can also be set by specifying the Center and Scale of display extent of the map.- Returns:
- The visible range of the current map.
- Default:
- The default value is Rectangle2D(0,0,0,0).
-
setViewBounds
public void setViewBounds(Rectangle2D rect)
Sets the view bounds of this map, and the view bounds are also called display extent. Besides thesetViewBounds()
method, the view bounds of this map can also be set by specifying the Center and Scale of display extent of the map.- Parameters:
rect
- Specifies the visible range of the current map.
-
getCenter
public Point2D getCenter()
Returns the center point of the view bounds of this map.- Returns:
- the center of the current map's display range.
- Default:
- The default value is Point2D (0,0).
-
setCenter
public void setCenter(Point2D point)
Sets the center point of the view bounds of this map.- Parameters:
point
- Specifies the center of the display range of the current map.
-
isAntialias
public boolean isAntialias()
Returns a boolean value indicating whether to anti-alias this map. When the line and text are anti-aliased, you can remove some of them to make the display more beautiful. The examples below illustrate the representations of line and text after being anti-aliased.- Returns:
- Specifies whether a boolean map is anti-aliasing.
- Default:
- defaults to false, that is, the default map is not anti-aliasing.
-
setAntialias
public void setAntialias(boolean value)
Sets a boolean value indicating whether to anti-alias this map. When the line and text are anti-aliased, you can remove some of them to make the display more beautiful. The examples below illustrate the representations of line and text after being anti-aliased.- Parameters:
value
- Specifies whether or not to use a boolean map.
-
isModified
public boolean isModified()
Returns a boolean value indicating whether this map is modified. Whether any of the display properties of the map is modified, or the properties of the layers object or one of the layers of this map is changed, this map will be considered modified.- Returns:
- A boolean value that specifies whether the current map has been modified.
- Default:
- defaults to false, ie the current map has not been modified.
-
setMapDPI
public void setMapDPI(double dpi)
Sets the Map dpi.The user gets the DPI of the android device, using the densityDpi in DisplayMetics as the device's DPI. Use the default DPI when displaying a cache file opened in the form of EngineType.IMAGEPLUGINS.
- Parameters:
dpi
- The map shows the dpi.
-
getMapDPI
public double getMapDPI()
Gets the Map dpi.- Returns:
- map shows DPI.
-
setIsArmap
public void setIsArmap(boolean isArmap)
Set to an Ar map- Parameters:
isArmap
- Whether it is an Ar map
-
IsArmap
public boolean IsArmap()
Whether it is an Ar map- Returns:
- Returns whether it is an Ar map
-
setUseSystemDPI
public void setUseSystemDPI(boolean setMapDPI)
Set whether to use system DPI. setDPI is valid when it is false.- Parameters:
setMapDPI
- whether to use the system DPI.Note: Not all maps can use custom DPI
-
isUseSystemDPI
public boolean isUseSystemDPI()
Get whether to use system DPI. setDPI is valid when it is false.- Returns:
- A Boolean value that indicates whether to use the system's DPI, which returns true, indicating the use of the system's DPI.
-
setModified
public void setModified(boolean value)
Sets whether the map has been edited.If any of the display properties of the map change, or where the layers or layer objects are changed, the map is considered to be modified.
- Parameters:
value
- Whether the current map has been modified
-
getImageSizeWidth
public int getImageSizeWidth()
Returns the width of the image.- Returns:
- returns the width of the image size.
-
getImageSizeHeight
public int getImageSizeHeight()
Returns the height of the image.- Returns:
- picture high
-
isViewBoundsLocked
public boolean isViewBoundsLocked()
Returns a boolean value used to specify whether to lock the visible extent of the map in the map control.- Returns:
- A Boolean value that specifies whether the visual range of this map control is locked.
- Default:
- The default value is false, that is, the visual control of the map control is not locked.
-
setViewBoundsLocked
public void setViewBoundsLocked(boolean value)
Sets a boolean value used to specify whether to lock the visible extent of the map in the map control.- Parameters:
value
- Specifies a Boolean value that specifies whether the visual range of this map control is locked.
-
getLockedViewBounds
public Rectangle2D getLockedViewBounds()
Returns the locked view bounds of the map control. When the view bounds of the map control is locked, only the specified map in the view bounds will be displayed. The content of the map beyond the view bounds will not be displayed.- Returns:
- The control range of the map control is locked.
- Default:
- The default value is Rectangle2D(0,0,0,0).
-
setLockedViewBounds
public void setLockedViewBounds(Rectangle2D rect)
Sets the locked view bounds of this MapControl. When the view bounds of MapControl is locked, only the specified map in the view bounds will be displayed. The content of the map beyond the view bounds will not be displayed.- Parameters:
rect
- Specifies the visual range of the map control's lock.
-
isPaintBackground
public boolean isPaintBackground()
Returns a boolean value indicating whether the background of this map will be painted.- Returns:
- A Boolean value specifies whether the map background is drawn.
- Default:
- The default value is true, that is, the map background is drawn.
-
setPaintBackground
public void setPaintBackground(boolean value)
Sets a boolean value indicating whether the background of this map will be painted.- Parameters:
value
- Use a boolean value to specify whether to draw a map background.
-
mapToPixel
public Point mapToPixel(Point2D point)
Converts the map coordinates of the specified point to the pixel coordinates. This method can only work properly after setting the setImageSize(int width, int height) method.- Parameters:
point
- To change the specified point of the coordinates.- Returns:
- Specifies the pixel coordinates of the point.
-
pixelToMap
public Point2D pixelToMap(Point point)
Converts the pixel coordinates of the specified point to the map coordinates.- Parameters:
point
- To change the specified point of the coordinates.- Returns:
- Specify the coordinates of the map.
-
setMapOperateListener
public void setMapOperateListener(MapOperateListener listener)
Adds a listener used to receive map open and closed events.- Parameters:
listener
- A listener for receiving a map open, closing event.
-
setMapLoadedListener
public void setMapLoadedListener(MapLoadedListener listener)
Adds a listener which is used to receive the map add complete events.- Parameters:
listener
- A listener for receiving map completion.
-
getMapLoadedListener
public MapLoadedListener getMapLoadedListener()
Get a listener which is used to receive the map add complete events.- Returns:
- Gets a listener for receiving map completion.
-
getScale
public double getScale()
Returns the display scale of the current map.- Returns:
- The display scale of the current map.
- Default:
- The default value is 0.
-
setScale
public void setScale(double value)
Sets the display scale of the current map.- Parameters:
value
- Specifies the display scale for the current map.
-
getTrackingLayer
public TrackingLayer getTrackingLayer()
Gets the tracking layer of this map. The tracking layer is a blank and transparent layer that is on top of all the other layers. For more details, please refer to theTrackingLayer
class.- Returns:
- The current map's tracking layer.
- Default:
- The default value is the default value for TrackingLayer.
-
isDynamicProjection
public boolean isDynamicProjection()
Returns whether to allow dynamic projection while displaying the map. If the projection of the map in the current map window is different from the projection of the datasource, performing this operation can change the map projection to the projection of datasource.- Returns:
- Whether to allow the map dynamic projection display.
- Default:
- The default value is false. That is not allowed to map dynamic projection display.
-
setDynamicProjection
public void setDynamicProjection(boolean value)
Sets whether to allow dynamic projection while displaying the map. If the projection of the map in the current map window is different from the projection of the datasource, performing this operation can change the map projection to the projection of datasource.- Parameters:
value
- A Boolean value that specifies whether to allow the map to be dynamically projected.
-
getPrjCoordSys
public PrjCoordSys getPrjCoordSys()
Returns the projected coordinate system of the map. Refer toPrjCoordSys
.- Returns:
- map of the projection coordinate system.
- Default:
- The default value is PrjCoordSys's default value.
-
setPrjCoordSys
public void setPrjCoordSys(PrjCoordSys value)
Sets the projected coordinate system of the map. Refer toPrjCoordSys
.- Parameters:
value
- Map of the projection coordinate system.
-
getLayers
public Layers getLayers()
Returns the layers object of this map. The layers object of this map manages all the layers in this map.- Returns:
- The current map contains the layer collection object.
- Default:
- The default value is the default value for the Layers object.
-
getWorkspace
public Workspace getWorkspace()
Returns the workspace that the current map is associated with. A map displays the data in the workspace that it is associated with.- Returns:
- The current map is associated with the workspace.
- Default:
- The default value is null. That can not access Layers, can not figure out, related to the operation of the data are not available, the other available.
-
setWorkspace
public void setWorkspace(Workspace workspace)
Sets the workspace that the current map is associated with. A map displays the data in the workspace that it is associated with.- Parameters:
workspace
- Specifies the workspace associated with the current map.
-
open
public boolean open(java.lang.String name)
Opens the map with the specified name. This specified name is the name of the map in the maps object, which belongs to the workspace that the map is associated with, and you should distinguish this name with the display name of this Map.- Parameters:
name
- Map name.- Returns:
- Returns true if successful, false otherwise.
-
close
public void close()
Closes this map.
-
zoom
public void zoom(double ratio)
The specified ratio by which to zoom the map. The scale of the map after zooming is (the original scale* ratio), where, the ratio should be a positive value. When ratio is larger than 1, the map will be zoomed in; when ratio is shorter than 1, the map will be zoomed out.- Parameters:
ratio
- Scale the map scale, this value can not be negative.
-
pan
public void pan(double offsetX, double offsetY)
Pans this map by the specified distance.- Parameters:
offsetX
- The moving distance in the X direction, in units of coordinates.offsetY
- The moving distance in the Y direction, in units of coordinates.
-
refresh
public void refresh()
Redraws the current map.
-
viewEntire
public void viewEntire()
Displays the map in full extent.
-
dispose
public void dispose()
Disposes the resources occupied by the object. After calling this method, this object will not be usable.
-
getMinScale
public double getMinScale()
Returns the minimum scale of the map.- Returns:
- Returns the minimum scale of the map.
- Default:
- The default value is 0, which means that the map can be scaled to infinity or infinity by default.
-
getMaxScale
public double getMaxScale()
Returns the maximum scale of the map.- Returns:
- The maximum scale of the map.
- Default:
- The default value is 0, which means that the map can be scaled to infinity or infinity by default.
-
toXML
public java.lang.String toXML()
Returns the xml string representation of the map object.Any map can be exported as an xml string, and the map's xml string can also be imported into a map to display. The xml string of the map stores the display settings and the associated data information about the map and its layers. In addition, you can save the xml string of the map as an xml file.
- Returns:
- The description of the XML form of the map.
- Example:
- The following code demonstrates the opening of the map and the map as a description of the XML string.
Assuming that a workspace object
workspace
is opened, there is a map in the workspace.public void toAndFromXMLTest() { // Open map from workspace Map map = new Map(workspace); map.open(workspace.getMaps().get(0)); // Export map to XML String xml = map.toXML(); map.close(); //Release resource. map.dispose(); }
-
setFullScreenDrawModel
public void setFullScreenDrawModel(boolean isFullScreen)
Sets whether drawing in the full screen. The function is only applicable to memory display engine but OpenGL.When using full-screen drawing mode, points, text, and normal layers are displayed at the same time. Otherwise, the point, and the text are drawn after the basemap is drawn,
- Parameters:
isFullScreen
- Whether to use the full-screen drawing mode.
-
isFullScreenDrawModel
public boolean isFullScreenDrawModel()
Gets whether or not to use full-screen drawing mode.- Returns:
- Whether to use the full-screen drawing mode.
-
getScreenLayer
public ScreenLayer getScreenLayer()
Get the screen layer.- Returns:
- Map of the screen layer.
-
save
public boolean save() throws java.lang.Exception
Save current map to the workspace.- Returns:
- Returns a boolean type that returns true if the save succeeds; false otherwise.
1. Fail to save if current map is closed. 2. Fail to save if current map isn't bound to the workspace.
- Throws:
java.lang.Exception
- Throws an exception at some not saved status like the open has beed closed or the object has been released.- Example:
- The following code demonstrates how to save an open map; open a workspace, open a map, save the current map.
public void testSaveMap{ String rootPath = android.os.Environment.getExternalStorageDirectory().getAbsolutePath(); MapControl mapControl = new MapControl(context); Map map = mapControl.getMap(); Workspace workspace = new Workspace(); WorkspaceConnectionInfo info = workspace.getConnectionInfo(); info.setType(WorkspaceType.SMWU); info.setServer(rootPath + "/SuperMap/data/World.smwu"); workspace.open(info); map.setWorkspace(workspace); String mapName = workspace.getMaps(0); map.open(mapName); ...... map.save(); }
-
save
public boolean save(java.lang.String mapName) throws java.lang.Exception
Save the map with a specified name, but the name cannot be the same with the name of the maps in currentl workspace.- Parameters:
mapName
- Map name- Returns:
- Returns a boolean type that returns true if the save succeeds; false otherwise.
- Throws:
java.lang.Exception
- Throws an exception at some not saved status like the open has beed closed or the object has been released.- Example:
- The following code demonstrates how to save the map with the specified name; open a workspace, add a layer to the map, generate a new map, save the current map, and name the map.
public void testSaveMap{ MapControl mapControl = new MapControl(context); Map map = mapControl.getMap(); String rootPath = android.os.Environment.getExternalStorageDirectory().getAbsolutePath(); Workspace workspace = new Workspace(); WorkspaceConnectionInfo info = workspace.getConnectionInfo(); info.setType(WorkspaceType.SMWU); info.setServer(rootPath + "/SuperMap/data/World.smwu"); workspace.open(info); map.setWorkspace(workspace); Dataset dataset = workspace.getDatasources().get(0).getDatasets().get(0); map.getLayers.add(dataset, true); ....... String mapName = "Map_1"; map.save(mapName); }
-
saveAs
public boolean saveAs(java.lang.String mapName) throws java.lang.Exception
Save current map as a map with specified name.- Parameters:
mapName
- The map name can not be null or empty ("").- Returns:
- Returns a boolean type that returns true if the save succeeds; false otherwise.
1. Fail to save if the specified map name is null or empty string(""). 2. Fail to save if current map is closed. 3. Fail to save if current map isn't bound to the workspace.
- Throws:
java.lang.Exception
- Throws an exception at some not saved status like the open has beed closed or the object has been released. * @example The following code demonstrates how to save the map as; open a workspace, open a map, save the map as a new map.public void testSaveMap{ String rootPath = android.os.Environment.getExternalStorageDirectory().getAbsolutePath(); MapControl mapControl = new MapControl(context); Map map = mapControl.getMap(); Workspace workspace = new Workspace(); WorkspaceConnectionInfo info = workspace.getConnectionInfo(); info.setType(WorkspaceType.SMWU); info.setServer(rootPath + "/SuperMap/data/World.smwu"); workspace.open(info); map.setWorkspace(workspace); String mapName = workspace.getMaps(0); map.open(mapName); ....... String mapName = "MyWorldMap"; map.saveAs(mapName); }
-
getLegend
public Legend getLegend()
Gets the legend of the map.- Returns:
- Map the legend control
-
setUserEditBounds
public void setUserEditBounds(Rectangle2D rect)
Sets the user editing bound.- Parameters:
rect
- Specifies the edit range.
-
getUserEditBounds
public Rectangle2D getUserEditBounds()
Gets the user editing bound.- Returns:
- User edit range.
-
setMinScale
public void setMinScale(double value)
Sets the minimum display scale of the map.- Parameters:
value
- The minimum display scale for the map.
-
setMaxScale
public void setMaxScale(double value)
Sets the maximum display scale of the map.- Parameters:
value
- The maximum display scale for the map.
-
isVisibleScalesEnabled
public boolean isVisibleScalesEnabled()
Whether to use a fixed scale to display the map- Returns:
- Returns whether or not to use a fixed scale to display the map
-
setVisibleScalesEnabled
public void setVisibleScalesEnabled(boolean value)
Sets whether to use a fixed scale to display the map- Parameters:
value
- Whether to use a fixed scale to display the map
-
getVisibleScales
public double[] getVisibleScales()
Get a fixed scale array, which is a scale that can be displayed when a fixed scale is displayed- Returns:
- Returns a fixed scale array
-
setVisibleScales
public void setVisibleScales(double[] values)
Set the fixed scale array, that is, the scale that can be displayed when the fixed scale is displayed- Parameters:
values
- Fixed scale array
-
getColorMode
public MapColorMode getColorMode()
Get the color mode of the map- Returns:
- Color mode
-
setColorMode
public void setColorMode(MapColorMode mapColorMode)
Set the color mode of the map- Parameters:
mapColorMode
- Color mode
-
setPrjCoordSysTransListener
public void setPrjCoordSysTransListener(PrjCoordSysTranslatorListener listener, PrjCoordSys srcPrjCoordSys, PrjCoordSys desPrjCoordSys)
Set the custom projection conversion algorithm interface class- Parameters:
listener
- Custom Projection Conversion Algorithm Interface ClasssrcPrjCoordSys
- Source projection coordinate systemdesPrjCoordSys
- Target projection coordinate system
-
removePrjCoordSysTransListener
public void removePrjCoordSysTransListener(PrjCoordSysTranslatorListener listener)
Remove the custom projection conversion algorithm interface class- Parameters:
listener
- Custom Projection Conversion Algorithm Interface Class
-
setDynamicProjection
public void setDynamicProjection(boolean bDynamic, PrjCoordSys value)
Set whether the map is dynamically projected, and the projected coordinate system of the map- Parameters:
bDynamic
- Whether the map is dynamicvalue
- Projection coordinate system
-
getDynamicPrjTransMethond
public CoordSysTransMethod getDynamicPrjTransMethond()
The projection algorithm used to get the map dynamic projection needs to be set in different ellipsoids.- Returns:
- Returns the algorithm used by the conversion of the geographic coordinate system. The default value is:MTH_GEOCENTRIC_TRANSLATION
-
setDynamicPrjTransMethond
public void setDynamicPrjTransMethond(CoordSysTransMethod transMethod)
The algorithm used to convert the geographic coordinate system when dynamic projection is set, does not support the extended algorithm, ie:CoordSysTransMethod.MTH_EXTENTION- Parameters:
transMethod
- The algorithm used to convert the geographic coordinate system
-
getDynamicPrjTransParameter
public CoordSysTransParameter getDynamicPrjTransParameter()
The conversion parameters used to get the map dynamic projection- Returns:
- Return projection conversion parameters, the default 7 parameters all 0
-
setDynamicPrjTransParameter
public void setDynamicPrjTransParameter(CoordSysTransParameter value)
Sets the conversion parameters used when the map is dynamically projected- Parameters:
value
- Projection conversion parameters
-
outputMapToDatasetImage
public DatasetImage outputMapToDatasetImage(Datasource datasource, java.lang.String datasetName, double resolution, Rectangle2D bounds, EncodeType encodeType)
Saves the current map as an image dataset- Parameters:
datasource
- The data source used to hold the image datasetdatasetName
- The name of the image datasetresolution
- Screen Resolutionbounds
- Need to save the map rangeencodeType
- Encoding format- Returns:
- Returns the resulting image dataset
-
setARMapType
public void setARMapType(int value)
Sets different ARMap types- Parameters:
value
- ARMap type
-
getARMapType
public int getARMapType()
Gets different ARMap types- Returns:
- different ARMap types
-
getOverlapDisplayedOptions
public MapOverlapDisplayedOptions getOverlapDisplayedOptions()
Gets or sets overlap options.- Returns:
- MapOverlapDisplayedOptions
-
setOverlapDisplayedOptions
public void setOverlapDisplayedOptions(MapOverlapDisplayedOptions value)
Gets or sets the overlap item.- Parameters:
value
- MapOverlapDisplayedOptions
-
isOverlapDisplayed
public boolean isOverlapDisplayed()
Gets or sets a value indicating whether to display objects when there are overlaps including text overlaps text and diagrams overlap diagrams.- Returns:
- boolean
-
setOverlapDisplayed
public void setOverlapDisplayed(boolean value)
Gets or sets a value indicating whether to display objects when there are overlaps including text overlaps text and diagrams overlap diagrams.- Parameters:
value
- Color
-
getMapView
public MapView getMapView()
Gets map comtrol of Map- Returns:
- MapView
-
createLegend
public Legend createLegend()
Sets a legend This legend supports to display filling symbols. Setting a background color or a foreground color wont make the system load the legend- Returns:
- Sets a legend
-
getCreateLegend
public Legend getCreateLegend()
Gets a legend- Returns:
- Gets a legend
-
setSlantAngle
public void setSlantAngle(double value)
Sets the rotation angle- Parameters:
value
- the rotation angle
-
getSlantAngle
public double getSlantAngle()
Gets the rotation angle
-
getIsPOIOptimized
public boolean getIsPOIOptimized()
Whether to optimize POI display- Returns:
- bool
-
setIsPOIOptimized
public void setIsPOIOptimized(boolean bPOIOptimized)
Whether to optimize POI display- Parameters:
bPOIOptimized
- bool
-
setHighDefinitionMode
public void setHighDefinitionMode(boolean isHighDefinitionMode)
Sets the high definition image display mode Calls before adding or opening a map- Parameters:
isHighDefinitionMode
- bool
-
isHighDefinitionMode
public boolean isHighDefinitionMode()
Gets whether the image display mode is high definition- Returns:
- bool
-
isTimeEnable
public boolean isTimeEnable()
Returns whether the map enables the feature Play Temporal Data- Parameters:
- -
- Returns:
-
setTimeEnable
public void setTimeEnable(boolean bEnable)
Sets whether the map enables the feature Play Temporal Data- Parameters:
- -
-
getTimeStep
public TimeSpan getTimeStep()
Returns the time step interval of the temporal data- Parameters:
- -
- Returns:
-
setTimeStep
public void setTimeStep(TimeSpan timeStep)
Sets the time step interval of the temporal data- Parameters:
- -
-
getTimeWindow
public TimeSpan getTimeWindow()
Returns the time window- Parameters:
- -
- Returns:
-
setTimeWindow
public void setTimeWindow(TimeSpan timeWindow)
Sets the time window- Parameters:
- -
-
getCurrentPlayerTick
public int getCurrentPlayerTick()
Returns the playing frame number of the current map- Parameters:
- -
- Returns:
-
setCurrentPlayerTick
public void setCurrentPlayerTick(int currentTick)
Sets the playing frame number of the current map- Parameters:
- -
-
getMapStartTime
public java.util.Date getMapStartTime()
Returns the starting time of the time line displayed when playing the temporal data.- Parameters:
- -
- Returns:
-
setMapStartTime
public void setMapStartTime(java.util.Date startTime)
Sets the starting time of the time line displayed when playing the temporal data.- Parameters:
- -
-
getMapEndTime
public java.util.Date getMapEndTime()
Returns the ending time of the time line displayed when playing the temporal data.- Parameters:
- -
- Returns:
-
setMapEndTime
public void setMapEndTime(java.util.Date endTime)
Sets the ending time of the time line displayed when playing the temporal data.- Parameters:
- -
-
getDefaultMapStartTime
public java.util.Date getDefaultMapStartTime()
Traverses all enabling times and time fields of visible layers. Returns the minimum time value as the starting time of the time line- Parameters:
- -
- Returns:
-
getDefaultMapEndTime
public java.util.Date getDefaultMapEndTime()
Traverses all enabling times and time fields of visible layers. Returns the maximum time value as the ending time of the time line- Parameters:
- -
- Returns:
-
getMinTimeStep
public TimeSpan getMinTimeStep()
Calculates the default time step when playing the temporal data- Parameters:
- -
- Returns:
-
getTimeFormat
public java.lang.String getTimeFormat()
When playing temporal data, if you set the window displays the time range of the current frame, the interface returns the time format.- Parameters:
- -
- Returns:
-
setTimeFormat
public void setTimeFormat(java.lang.String timeFormat)
When playing temporal data, if you set the window displays the time range of the current frame, the interface sets the time format.- Parameters:
- -
-
isShowTime
public boolean isShowTime()
Returns whether the window displays the text of the time range of the current frame. True means yes.- Parameters:
- -
- Returns:
-
setIsShowTime
public void setIsShowTime(boolean isShowTime)
Sets whether the window displays the text of the time range of the current frame. True means yes.- Parameters:
- -
-
getCurrentTickStartTime
public java.lang.String getCurrentTickStartTime()
When playing the temporal data, gets the starting time of the current frame- Parameters:
- -
- Returns:
-
getCurrentTickEndTime
public java.lang.String getCurrentTickEndTime()
When playing the temporal data, gets the ending time of the current frame- Parameters:
- -
- Returns:
-
setIsCadBatchRender
public void setIsCadBatchRender(boolean bIsCadBatchRender)
Sets whether to enable bulk drawing mode for CAD layer.- Parameters:
bIsCadBatchRender
-
-
getMaxVisibleVertex
public int getMaxVisibleVertex()
Gets the maximum number of visible nodes- Returns:
- 0
-
setMaxVisibleVertex
public void setMaxVisibleVertex(int value)
Sets the maximum number of visible nodes- Parameters:
value
-
-
setDrawCADTextAsPOI
public void setDrawCADTextAsPOI(boolean nDrawCADTextAsPOI)
Sets whether CAD text is drawn in POI mode- Parameters:
nDrawCADTextAsPOI
-
-
isDrawCADTextAsPOI
public boolean isDrawCADTextAsPOI()
Gets whether CAD text is drawn in POI mode- Returns:
-
setMapDownLoadThreadNum
public void setMapDownLoadThreadNum(int num)
Set the number of network download threads Should be called before adding or opening a map- Parameters:
num
- Specifies the number of threads. The default value is 5, the minimum value is 1, the maximum value is 10, and the value exceeds 10 is 10
-
getMapDownLoadThreadNum
public int getMapDownLoadThreadNum()
Gets the number of network download threads Should be called before adding or opening a map- Returns:
-
setClipRegionEnabled
public void setClipRegionEnabled(boolean value)
Sets whether the map clipping takes effect- Parameters:
value
-
-
IsClipRegionEnabled
public boolean IsClipRegionEnabled()
Gets whether the map clipping took effect- Returns:
- whether the map clipping took effect
-
setClipRegion
public void setClipRegion(GeoRegion region)
Sets the face used for map cropping- Parameters:
region
-
-
getClipRegion
public GeoRegion getClipRegion()
Gets the face used for map cropping- Parameters:
region
-
-
setHighPerformSymbolMode
public void setHighPerformSymbolMode(boolean isHighPerformSymbolMode)
Set the high-performance symbol rendering mode to filter the symbol rendering based on the number of objects and scale Requires calling before adding or opening a map- Parameters:
isHighPerformSymbolMode
-
-
isHighPerformSymbolMode
public boolean isHighPerformSymbolMode()
Returns whether the high-performance symbol rendering mode is performed, and filters the symbol rendering based on the number of objects and scale Requires calling before adding or opening a map- Returns:
-
setMVTTop
public void setMVTTop(boolean MVTTop)
Sets whether the MVT layer is on top. MVT is a special form that is independent of the other layers of the map, and can only be located at the top of the map, or at the bottom of the map. The default value is true- Parameters:
MVTTop
-
-
isMVTTop
public boolean isMVTTop()
Returns whether the MVT layer is on top. The default value is true- Returns:
-
-