After downloading the dependency it will be necessary to generate the tcz of the dependency so that it is included in the deploy
Find the folder that is located in the dependency, usually is: C:\Users\your_user\.m2\repository\com\totalcross\utils\tc-utilities\0.0.1-SNAPSHOT
To generate tcz execute the command java -cp "% TOTALCROSS 3_HOME%" / dist / totalcross-sdk.jar tc.Deploy tc-utilities-0.0.1-SNAPSHOT.jar / r YOUR_TC_KEY
After tcz is generated, rename the tc-utilities-0.0.1-SNAPSHOT.tcz file to tc-utilities-0.0.1-SNAPSHOTLib.tcz and place it at the root of the project.
At the root of the project create the file named all.pkg and put [L] tc-utilities-0.0.1-SNAPSHOTLib.tcz so that this class is included in deploy
KEY
in the example below, the class was made considering the API HERE, to get an APP ID and APP CODE you have to register on the site and create a project, going into the details of the project you will find this information.
The 3 points are only to represent in a more playful way that there are other dependencies
Static Map Structures
in the example below the class was made considering the API HERE
It receives an address, as in the example: "Av. Washington Soares, 1321 - Edson Queiroz, Fortaleza - CE, 60811-905"
double latitude
it receives a latitude
double logitude
it receives a latitude
int width
Image width
int height
Image height
int zoom
The zoom that is applied in the map photo, going from zero (Vision farther) to 21, where 21 will give the view of the whole state and between 0 to 21 it is possible to adjust how close the image is seen.
int format
Indicates the format of the image received
Boolean mapHeader
Remove or place the map header
String mapStyle
Changes the map style received in the image
How to use
Within the InitUi (), you can declare an image and receive its instance by calling the StaticMap getImage method
Sample using StaticMap
publicclassMapsextendsMainWindow {publicMaps(){setUIStyle(Settings.Material); } @OverridepublicvoidinitUI() {// Cristo Redentor = -22.951916, -43.2126759;double lat =-22.951916;double log =-43.2126759;int gap =UnitsConverter.toPixels(Control.DP+16);Label lblContact =newLabel("Contact");lblContact.setForeColor(0x4286f4);lblContact.setFont(Font.getFont(false,28));add(lblContact, CENTER, TOP +UnitsConverter.toPixels(DP +50));Label lblName =newLabel("Christ the Redeemer:");lblName.setFont(Font.getFont(false,20));add(lblName, LEFT + gap, AFTER +UnitsConverter.toPixels(DP +20));Label lblAdress =newLabel("National Park of Tijuca - Alto da Boa Vista, Rio de Janeiro - RJ");lblAdress.setFont(Font.getFont(false,14));lblAdress.autoSplit=true;add(lblAdress, LEFT + gap, AFTER +UnitsConverter.toPixels(DP +20));StaticMap staticMap =new StaticMap.Builder("Fola4mnv4rVDbjzo3Obu","6Xgu6eVAmLKOPLZXZgy5-Q").setLocation(lat,log).setWidth(Settings.screenWidth-2* gap).setHeight(Settings.screenHeight/3).setZoom(17).build();ImageControl imgC =newImageControl(staticMap.getImage()) ;add(imgC, LEFT + gap, AFTER +UnitsConverter.toPixels(DP +10));Button btn =newButton("Navegate");btn.addPressListener(e -> {String vsEndereco ="geo:"+ lat +","+ log +"?q="+ lat +","+ log;Vm.exec("url", vsEndereco,0,true); });btn.setFont(Font.getFont(false,18));add(btn, CENTER, AFTER +UnitsConverter.toPixels(DP +30)); }}
References
See this link for more information abount GOF patterns.