Is there a way to remove the route without clearing the markers? Using function clear() is really bad.
tomtomMap.clear();
route = null;
origin = null;
destination = null;
Is there a function clearRoute() that do not clear the markers.
Take a look at the API reference
https://d221h2fa9j1k6s.cloudfront.net/downloads/mapssdk/APIReferences/JavaDocMap_2.4.376/index.html
I was able to test the function in my project and verified that it works.
tomtomMap.clearRoute() should solve your problem.
Regards!
Related
I am looking for realtime scaling of objects/models in ARcore. I found that it can be done using
getScaleController() and PinchGesture class. I have a TransformableNode and I want to use the above method and class for achieving realtime scalling of model to update model's dimensions at runtime.
I checked the documentation already, but it didn't help me.
here is my code
TransformableNode node =
new TransformableNode(arFragment.getTransformationSystem());
node.setParent(anchorNode);
node.setRenderable(modelRenderable);
node.select();
/* After this I want to use PinchGester or PinchGestureListener and
node.getScaleController() to achieve my goal */
Thanks in advance
I am building an application where I am using osmdroid with its bonus pack and mapnik for tiles. I want to be able to output shortest path between multiples points, and as a next step build paths considering time-frames. From my research it looks like Graphhopper Routing Optimization API is exactly what I need, but I can't figure out how to use it in my project properly. Since I am using os OSMBonusPack it looks like my only option is to set up Road Manager properly to be able to use routing optimization. Following tutorial for OSMBonusPack I am able to create Road manager and draw paths from one point to another, but not sure how to add optimization to find shortest path to it as well as set the road type to be "pedestrian" not a car. Any help will be highly appreciated. That's the code I am using to build a path between my points, pretty much exactly the same as tutorial:
ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
for (int i = 0; i < chosenAttractions.size(); i++) {
GeoPoint point = new GeoPoint(chosenAttractions.get(i).latitude, chosenAttractions.get(i).longitude);
waypoints.add(point);
}
if (count > 1) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
RoadManager roadManager = new GraphHopperRoadManager("fae5bf0a-402a-48b2-96ac-324e138f53dc", true);
// roadManager.addRequestOption("routeType=bicycle");
Road road = roadManager.getRoad(waypoints);
Polyline roadOverlay = RoadManager.buildRoadOverlay(road);
map.getOverlays().add(roadOverlay);
map.invalidate();
}
}
Turns out to use optimization or vehicle option of Routing API one has to pass it as an argument to addRequestOption function, for example:
roadManager.addRequestOption("vehicle=foot");
roadManager.addRequestOption("optimize=true");
I'm currently working with jamod in order to set up a small control system for work. We are working with several PLCs and I need to use the MODBUS protocol for communication. I have been able to read the values that are measured by the controllers, however I am unsuccessful in writing to the controller (adjusting amperage).
My question is, how do I instantiate a Register object using jamod?
Register[] reg_1 = new Register[5];
reg_1[0].setValue(16000);
This doesn't work. Essentially I would like to set the value of the register at position 0 to the integer 16000. I have also tried using
reg_1[0].setValue(Integer.parseInt("16000"));
I've been looking through the jamod documentation and can't find any way of creating a proper register object nor any examples of how to set a proper register to write.
If anyone has any ideas, I'd be most grateful. :)
I figured it out. The proper way to set up a Register[] for writing, in my case, was setting up several SimpleRegisters made up of UINT_16s,then throwing them into the Register[] array like so:
Register reg1 = new SimpleRegister(48911);
Register reg2 = new SimpleRegister(23593);
Register reg3 = new SimpleRegister(48911);
Register reg4 = new SimpleRegister(23593);
WriteMultipleRegistersRequest req = new WriteMultipleRegistersRequest(41200,new Register[]{reg1,reg2,reg3,reg4});
WriteMultipleRegistersResponse res = new WriteMultipleRegistersResponse();
Where 41200 was the reference point to which the register writing starts. You can do this with multiple amounts, even 1 or 100, and adjust your register amounts accordingly. In my case I was sending and receiving two 8bit words from the modbus so I had two registers per value.
I have a service which I need to access from an android app. The goal is simply to send a number value from a textbox and get a result string back.
I know it is possible to do so in VB using a Service Reference, which I have done. Here is the sample code :
Private Async Sub Button_Click(sender As Object, e As RoutedEventArgs)
Dim service As New ServiceReference2.Service1Client(ServiceReference2.Service1Client.EndpointConfiguration.BasicHttpBinding_IService1)
Try
lblReturn.Text = Await service.GetDataAsync(CInt(txtValueSent.Text))
Catch ex As Exception
lblReturn.Text = ex.Message
If Not ex.InnerException.Message Is Nothing Then
lblReturn.Text = lblReturn.Text + ex.InnerException.Message
End If
End Try
End Sub
After research I can't seem to find any way to have a quick and simple result like it is possible to with Visual Studio using Android Studio
Are there any tools available which work in a similar way ?
If not which process would be recommanded to achieve the same result ?
Are there any usefull links which could help enlighten me?
In my Android app I use Picasso to load images. This normally works perfectly well.
Today I tried loading a static image from the google maps api, but this doesn't seem to work. When I open the example link as provided on their info page, I get to see the static map image perfectly well. When I load it in my Android app using the line below, I get nothing at all.
Picasso.with(getContext()).load("http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=370x250&maptype=roadmap%20&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318%20&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false").into(mapView);
I also tried to download the image and uploading it to my personal webspace, from which it loads perfectly well, but somehow, it doesn't seem to load directly from the direct google API url.
Does anybody know why this is so, and how I can solve it?
The only programmatic point-of-failure that comes to mind is in parsing the URI. Looking at the current Picasso code (https://github.com/square/picasso/blob/master/picasso/src/main/java/com/squareup/picasso/Picasso.java) I see the following:
public RequestCreator load(String path) {
if (path == null) {
return new RequestCreator(this, null, 0);
}
if (path.trim().length() == 0) {
throw new IllegalArgumentException("Path must not be empty.");
}
return load(Uri.parse(path));
}
So I'd first debug
Uri.parse("http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=370x250&maptype=roadmap%20&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318%20&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false")
and see what that Object looks like. Does it drop or confuse any of your parameters?
If that doesn't lead you anwhere, try downloading the file manually using a HttpClient [or similar]. Then at least you can fully debug the request/response.
Also, I know Google maps has some limits -- are you sure you haven't reached them?
replace http with https
replace | with %7C
add api key
The .loadMap() function has many declared variables. This is the heart of the whole process.
So what is required for the static maps API to give us an image is that we make an http request with a given url, for which an image response (URL) is received. Let us run through the meaning and utility of these variables. Yes, all of them have a completely different meaning!
The mapUrlInitial variable is always the same while making an API call. It has a query of center ( ?center ) which specifies that we want the location to be centered in the map.
The mapUrlProperties variable contains a string where you control the actual zooming of the image response you will get, the size ofthe image and the color of the marker which will point out our place.
The mapUrlMapType variable is a string where you can actually determine the marker size you want and the type of the map. We are using a roadtype map in the app.
Finally latLong is a string which concatenates the latitude and the longitude of the place we want to pinpoint!
We then concatenate all of these strings to form a feasible Url. The Url is then loaded as we have seen above, in the Picasso code. One thing we can notice is that an event object is always required for all of this to happen, because we are able to fetch the position details using the event object! Final Code:-
fun loadMap(event: Event): String{
//location handling
val mapUrlInitial = “https://maps.googleapis.com/maps/api/staticmap?center=”
val mapUrlProperties = “&zoom=12&size=1200×390&markers=color:red%7C”
val mapUrlMapType = “&markers=size:mid&maptype=roadmap”
val latLong: String = “” +event.latitude + “,” + event.longitude
return mapUrlInitial + latLong + mapUrlProperties + latLong + mapUrlMapType
}
//load image
Picasso.get()
.load(loadMap(event))
.placeholder(R.drawable.ic_map_black_24dp)
.into(rootView.image_map)