How to draw a cross on Google Maps? - java

I have following task - I need to draw on Google Maps a cross with certain coordinates. I know how can I do it using ItemOverlay but I think that there is means without using a custom marker. I need simple black cross with my coordinates. Please, tell me, is it possible?
UPDATE: I don't want to use ItemOverlay because I need to make a custom drawable for it and I hope there is simple android internal elements for it.

I'm sorry, but using Overlays seems to be the only way of drawing any line on Google Maps.

You could draw an ImageView right over the google maps view (with absolute positioning using margins). But then you'd have to take care of coord conversion (and reacting to user scrolling, zooming the map) "by hand".
I think you could also use SurfaceView fully aligned to google maps view and draw your marker right on it.
But both solutions are pretty much overkill; you're better off using ItemizedOverlay unless you have a really good reason no to - in which case you might wanna add some info on what's the reason, maybe we'll find you a nice solution to that one :)

Related

Images on a Image

I am new on this community and i have no idea what I have to search for. So I hope there is no thread like this.
I want to create a java Android App in Android Studio where I can open a floor plan(image) and insert icons(images). If i click once on the icon it should be movable and the size of the icons should be adjustable with a seekbar.
I googled for these functions and the only thing I found was that:
https://developer.android.com/guide/topics/graphics/2d-graphics.html
Can someone tell me which is the best way to do that?
You can use normal ImageViews https://developer.android.com/reference/android/widget/ImageView.html
with events (OnClick, OnTouch).
If you want to resize view, check this answer
-https://stackoverflow.com/a/14283837/8180966
For rotation
//#param rotation The degrees of rotation.
imageView.setRotation(float rotation);
If you want your icons to look nice at any size, you should look at Vector Graphics (https://developer.android.com/studio/write/vector-asset-studio.html)
Hope, this will help :)
You may please visit the following page (especially layer list section of the page) of android developer site. There are a few things which you may be interested in and which may serve either as a solution or an alternative to your problem.
https://developer.android.com/guide/topics/resources/drawable-resource.html

Using multiple backgrounds in Android Application

Here is a scenario on which i done a lot of research on google but hopeless. the scenario is, i am going to develop a 2D game in which i want to use multiple backgrounds and i want to translate them as they are moving forward, it must look like one background is near and translating/moving fast and the other background is a bit far and translating/moving a little slow. the nearer background have almost full intensity and the farer background have a bit low intensity. you can say they have different transparency levels. the question is, how can i get this task done or is this possible to use multiple backgrounds.
any suggestion will be appreciated.
as an example, see the image of BADLAND game bellow.
I think as far as I got your question you want to put two or more images one over another. I mean if you are trying to overlap the multiple backgrounds and asking for it yes it can be done easily.
What you need to do is to use the FrameLayout. as
"FrameLayout represents a simple layout for the user interface of
Android applications. It is usually used for displaying single Views
at a specific area on the screen or overlapping its child views."
and then you can implements the animations on them and translate them You can find different types of translation over them.
Here is all about using the frame layout frameLayout1 framelayout2 and for animations and translation here are links. link , link2 , link3

Google Maps Heatmap Android Display

I have multiple geo-locations that have a weight of +1 or -1 in an android app. I'd like to be able to plot these points as an overlay to a google-maps activity. I thought that the best way to view the data is not on a point-by-point basis but by shading regions depending on the average density of its values. I have done a few searches and I want a heatmap-like rendering and was wondering if anyone had any direction as to how to accomplish this.
If you are okay with using a library then you can use Mapex.
https://code.google.com/p/mapex/source/browse/MapExLib/

Recording/Playback Gesture in Android

I've done a bit of searching and I don't think this has been asked yet (if it has, then I have been searching with the wrong terminology)
I'm trying to find out how to record touch gestures/actions done on Android touchscreen (with respect to time), then use the path of that gesture as the path for a graphic to follow (using android's tweening capabilities)
I'm also looking to be able to save the animation so that it can be loaded later on or exported as a file.
My thoughts around this are to take the point of touch's (x,y) coordinates and save the pair across a set interval of time. Then the coordinates can be loaded from the file later on for an ImageView (or some other view) to be tweened across the device.
Plus, I figure a method like this could make it cross-compatible on screens of different sizes if I saved the coordinates as percents instead of actual values, they can then be loaded depending on the screen size of the device
My questions are: Am I on the right track? Or would this be an inefficient way of doing it?
If this is the right idea, what is the best way of recording the positions and then using the tweening capabilities to animate the object (or is there a better method than tweening to provide a smooth animation)?
And if not, what would be the suggested solution to my problem?
All answers appreciated!
Bitwize
There is a tool to record gestures in the devloper application examples. You can find on the emulator : GestureBuilder.
Here is a tutorial about gestures.
Though, gestures have been provided to be recognized as gestures not like an animation path. But I believe you can extract data from gestures and get the "path" of given single touch gesture. Here is the main class to represent a gesture.
It has a toPath() method that could be useful to you.

Zoom in on a point in an image in with VTK

I have an image in VTK that I'm viewing with vtkImageViewer2, and I want to zoom in on a point the user clicks on. I am working in Java. Does anyone know how to do this?
Thanks
I realize you ask for Java, but my experience doing this has been with c++; equivalent java syntax should work, minus the customizability.
Take a look at these examples for picking and zooming. Also, if you set the interactor style to 'image', the mouse wheel should cause a zoom to wherever the cursor is. You probably don't want to do literally what you asked, but rather either do rubberband zoom or have the mousewheel for zooming. Clicking should do something, not just change the view.
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/PickingAPixel2
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/RubberBandZoom
Depending on what you mean by zoom you want to either change the position and direction of the camera (likely) or change the frustum (unlikely).
Have a look at the methods setPosition() and setFocalPoint() in class vtkCamera. Here is the documentation of vtkCamera:
http://www.vtk.org/doc/nightly/html/classvtkCamera.html

Categories