MKMapView & iOS6, avoid instant update of the map - mkmapview

I have implemented an application that use MKMapView to show satellite map. In my application I need to update the center of the map programmatically together with the transform of the map view. Before iOS 6, this works well. On iOS 6, the two-step operations cannot be joined anymore. That is, when I try to set the map center, it will be immediately refreshed, before I have the opportunities to set the transformation. This is bad because, for an instant, I can see the intermediate representation. Looking inside the new MKMapViewimplementation, I see that now it use OpenGL:
VKMapCanvas: 0x9d29440; frame = (0 0; 1217.57 1217.57); clipsToBounds = YES; layer = [CAEAGLLayer]: 0x9d2a610
I think the problem is that the OpenGL surface is updated immediately. My question is, there's anyway to enable/disable the update of the VKMapCanvas?

Related

vtk render window GetZbufferData method

As I understand it, if I create a vtk render window, then I can add different renderers to it and for each renderer renders from a different perspective. No to actually render the scene I use the vtk render window method render() to render all renderers in parallel. Now there is a vtk render window method called GetZbufferData which apparently returns an array containing the zbuffer. So my question is, to which renderer does this zbuffer correspond to?
Thanks for any clarification.
If you have all renderers in the same window, then they will share the same framebuffer, so also the same z-buffer. So a simple answer to your question is "to all of them". To get the individual z-values, it depends on what you are exactly doing with the renderers.
If you are doing some kind of a "tiled view", you want to assign different viewports (vtkRenderer::SetViewport(), like here) to each of the renderers. Then you can access the z data for a given "tile" (renderer) by passing appropriate x,y coordinates to the GetZBufferData function. For example, to get the whole part of the z buffer that belongs to renderer ren1 of vtkRenderWindow renWin:
double x1 = ren1->GetViewport()[0] * (renWin->GetSize()[0] - 1);
double y1 = ren1->GetViewport()[1] * (renWin->GetSize()[1] - 1);
double x2 = ren1->GetViewport()[2] * (renWin->GetSize()[0] - 1);
double y2 = ren1->GetViewport()[3] * (renWin->GetSize()[1] - 1);
float *ren1Z = renWin->GetZbufferData(
static_cast<int>(x1),static_cast<int>(y1),static_cast<int>(x2),
static_cast<int>(y2));
If you have the same viewport, it would be more complicated. You can have a renderwindow with multiple "layers", by setting vtkRenderWindow::SetNumberOfLayers(int) and then you can assign each renderer to a different layer (vtkRenderer::SetLayer(0-based layer index)). The window then renders from layer 0 to the last layer over each other. If you are interested in getting only one specific renderer's z-data, you should get it if you have it render in the last layer. However, I am not sure if the z-buffer is cleaned in between individual renderer's renders, I would actually bet on that it is not, so you might also get some inconsistent mess.
I would like to complement tomj answer:
Any of the vtkRenderWindow::GetZbufferData() methods query the framebuffer for Z-values, which is contained in the vtkRenderWindow, but there is a slight remark:
You need to set this in your renderers: vtkRenderer::PreserveDepthBufferOn(). This is because as the documentation says:
"By default, the depth buffer is reset for each renderer.
If this flag is true, this renderer will use the existing depth buffer for its rendering."
So, that bring us to the vtkRenderers. There is a layering of vtkRenderers, which tells which "chain" or "precedence order" to make the drawing. Check the method vtkRenderer::SetLayer().
So, you first need to set up your layered vtkRenderers, attach them to the vtkRenderWindow, and then set up correctly if you want to preserve some depth buffers or not.
Notice that if the z-buffer has not been set (first draw of the first vtkRenderer), it will return 1.0. I'm still figuring out why, but currently that is the situation.

Questions about Citymaps

1、I want to create a circle and set an image that customized to fill the circle,use this as a marker on the map, not only could change the image but also the color of circle anytime,what can I do to implements this function? Please look at the picture below!
2、Like your CityMaps app show,when I enlarge the map, some business icon that hide are show on the map,which are hide again while shrink the map, How to achieve this effect?
3、After I initialization the Object Marker and called the method marker.setFadeTime(3000),the software give my tips the method is no exist and I see the class Marker.java but really not find the method,Why is it so?
4、I want to add some stars beside the marker like this:
What can I do to add the stars?the label only can set the text beside the marker.
5、I want to load your maps at the fragment,not the activity that extends FragmentActivity,I found the SupportCitymapsMapFragment is no use,What I can do to complete this requirement?
6、In your apps,it is locate that place after input New York in the search box,What can i do to complete this function whatever i input?
7、During I develop the apps about the Citymaps,I found a serious problem so that your apps had happend too. When I run the apps, the program force flash back all of a sudden and I run your apps Citymaps at this time,the problems are same of the front,I found some error in logical view that is follows:15327-15374/com.map.maplbs A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 15374 (Thread-1819).
To solve the problem,I must restart my device. Why is it so?
I am a developer on the Citymaps SDK, I will do my best to answer your questions.
1) I recommend using the Android Canvas API to construct the images, and then use a Marker to display it on the map. See the documentation for details: http://developer.citymaps.com/markers
2) This is built into the Citymaps BusinessLayer. This functionality is not exposed through an API. If you wish to use the Citymaps BusinessLayer, you should create a CitymapsMapView or CitymapsMapFragment/SupportCitymapsMapFragment and it will automatically be added to your map.
3) At this time, there appears to be a known issue with the fadeTime API. Thank you for bringing this to our attention. We will fix it in an upcoming release. For now, you can animate the alpha property of the Marker.
4) Once again, the functionality of the BusinessLayer is not directly exposed. If you wish to create similar markers, I recommend you construct the image using Android's Canvas and then adding it as a Marker to the map.
5) If you wish to load the map inside of a fragment, you can accomplish this using child fragments (check Android documentation for more details). You can also accomplish this by instantiating CitymapsMapView or MapView directly and adding it to your view hierarchy either in XML or in code. However if you do this, remember to call the lifecycle methods on your map instance, or else the map will not behave properly.
6) If you wish to have a search in your app, it is up to you to implement this feature. We do not currently provide a search API out of the box.
7) Thank you for the bug report. We will investigate this issue and fix it in a future release.
If you have any more questions, feel free to ask, and thank you for using the Citymaps SDK.

AndroidPlot: How to reset LineAndPointFormatter graph to original after zooming

Am using androidplot library to display static graphs using LineAndPointFormatter within my Android app. But now am facing some issue related to zoom i.e. As per the requirement after zooming the graph if user double taps on the graph, same time graph should go back to the original position/initial position. Check below the code snippet which am trying currently i.e.
public void resetZoom() {
newMinX = 0f;
newMaxX = 0f;
fixBoundariesForZoom();
setDomainBoundaries(newMinX, newMaxX, BoundaryMode.FIXED);
redraw();
} // With this code whenever user double taps on the graph same time graph is displaying blank means domain and range value is resetting to the original but line graph is not displaying.
Can anybody please help me or let me know some workaround to deal with this issue.
There is no built-in "reset" option. You could go through the library source and come up with something hardcoded that restores the internal defaults but it would be a brittle solution since the built in defaults could change in a future release of the library. My suggestion would be to explicitly define the boundaries etc. that you'd like to use as your default state in a method and invoke that both at startup and on reset.

Powerbuilder, is there anyway to get position/height/width of a uo/datawindow?

I'm working on an upgrade of a legacy app with multiple UOs and DWs all contained within 1 window.
Our clients are getting monitor upgrades (19" monitors!!! modern resolutions!!) and most of them will be 1280x1024, but there are still a few stations that are using the old 1024x768 resolutions while some executives get to use their fancy laptops with a 1366x768 resolution.
I've been trying to make our interface as responsive as possible but I still have to hardcore fixed values for every single uo and dw.
I'm trying to work it down to where I can simply use something like dw.height = env.height - dw.x-position.
Is this possible?
Currently I use something like this
// height = base height - details ( - buttons)
w_cms.uo_pat.uo_pat_appt.tab_1.tab_os_aptinfo.dw_os_aptinfo.Height = G_uo_height - 420
w_cms.uo_pat.uo_aps_book.uo_aps_cal.dw_free_slot.height = ll_base - 1230
To get the true position, you have to go up the chain of parent objects and add all their coordinates together.
A better approach to this problem is to resize your controls to the size of the window, not just the size of the screen. Not only is this easier, but it also means your application is responsive to window resizings, not just resolution differences. (This also dodges issues with varying sizes of chrome, like task bar size, scroll bar size, window border size, etc...)
The PFC has resize services for windows and DataWindows that do this, and the downloads have documentation on how these functions are used. There used to be articles on how to decouple PFC code and use it with a non-PFC architecture, but as long as you have ancestors for all your windows and DataWindow controls, it's not rocket science.
Good luck,
Terry.

Resizable MKOverlay using MKOverlayRenderer

I want to have a custom MKOverlay that's a circle anchored to the user location annotation that the user can resize by pinching. I was able to successfully achieve this using MKOverlayPathRenderer and a custom MKOverlay object by overriding the createPath method and making an arc. The resizing and moving of the overlay was handled by using KVO on the radius and coordinate properties of my overlay. However the resizing was incredibly choppy and the boundingMapRect wasn't correctly calculated.
I've also tried using an image and instead of subclassing MKOverlayPathRenderer just MKOverlayRenderer, overriding - (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context but when I resize my CPU percentage jumps to 160% usage (not great yeah?) and the boundingRect is again being drawn incorrectly.
I really think the way to do it is with MKOverlayPathRenderer and maybe having an atomic counter of some kind so that a redraw only gets called say every 5 or 10 times the pinch gesture is triggered.
Does anyone have any suggestions? I've also considered but haven't tried making a UIView and adding it as a subview to the map view and putting the pinch gesture on that but that seems hacky and dirty.
When you computed new boundingMapRect on the Overlay, you must invoke invalidatePath on your Renderer. After that, system will invoke createPath for you when appropriate.

Resources