Google Maps IOS SDK 1.2 need snapshot of map view - google-maps-sdk-ios

In 1.1, the GMSScreenshot class provided a rudimentary way to get a snapshot of the entire screen into a UIImage. In 1.2, the class is missing, and in the release notes, it says this:
Calling renderInContext: on the GMSMapView layer now renders correctly;
this allows for snapshots and UI effects
Unfortunately, I'm not finding this to be the case. Typically renderInContext: does not work on Open GL drawing, but I figured I'd take a shot anyway (it didn't work). Has anyone been successful in getting a (preferred) view or screen snapshot?

I am able to take a screenshot. Here is the code I use:
UIGraphicsBeginImageContext(mapView_.frame.size);
[mapView_.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShotImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
I do not call this straight after I create the map as it can take some frames for the map to render.

Related

Tiled map not rendered fully

I'm using cocos2d-x 3.17. When I run a Follow action on a sprite, the tiled map can't render fully. The map looks exactly the same as the screen record shows in posts below
https://discuss.cocos2d-x.org/t/1-5b2-tiled-map-not-rendered-fully/36661
https://discuss.cocos2d-x.org/t/solved-tilemap-rotation-clipping/37114
But they were using Cocos Creator and can fix it by setting ENABLE_TILEDMAP_CULLING = false.
Is there any equivalent settings in C++ api?
Found out the root cause is that the Scene has been moved by Follow action. It seems in cocos2d-x, Scene is not supposed to move.

how to change a CesiumJS viewer's baselayer url

i am using a CesiumJS instance to display a base map of the earth using a imageryProvider from source A.
var viewer = new Cesium.Viewer('cesiumContainer', imageryProvider:providerA);
Now while using the Viewer I would like to be able to change this map to get images from providerB at a certain event.
I tried:
viewer.scene.imageryLayers.get(0).imageryProvider.url = providerB.url
However that does not seem to work and also feels quite like hack anyway.
I could not find anything in Cesium's documentation .
Is this at all possible without restarting / recreating the viewer instance?
I know that there is a Cesium.BaseLayerPicker (https://cesium.com/docs/cesiumjs-ref-doc/BaseLayerPicker.html)
However I do not see what method this picker calls on "select" )
Thanks a lot.
The BaseLayerPicker widget calls this code when the user selects a new layer.
There's a lot of boilerplate widget management in that block of code, but for your sake, only a couple of the lines are critical. First, the old existing active imagery layer is searched for, and removed:
imageryLayers.remove(layer);
Then, a new imagery provider is constructed and added at index 0, the first position, which is the base imagery layer:
imageryLayers.addImageryProvider(newProviders, 0);
You can directly change the URL of the provider but you should also change appropriate parameters("layers" in case of WMS, "layer", "style", "format", "tileMatrixSetID " ... in case of WMTS) depending on the type of provider(WMS or WMTS).

How to write Javascript code for model browser while using autodesk-forge-viewer API

I am trying to replicate a part of demo shown here using autodesk-forge-viewer api. Particularly, I am not able to find code snippet around how can I do navigation for a particular area of 3D model. For example, if render 3D model is house, I require that If a click on "Bed Room" which is a link somewhere in browser, 3D rendered model should show me that "Bed Room". In sample app shown, they are providing the same as a feature of "Model Browser".
Could anyone please help me with that?
You first need to know the dbId's of the nodes you are interested in, most viewer API methods take dbIds as input. You get those either by listening to selection events, see that post, or by parsing the instance tree and checking the properties of the nodes to see if those are the ones you looking for.
You can then use methods such as viewer.fitToView([dbIds]), viewer.hide([dbIds]), viewer.show([dbIds]) ... Here is another article that might be useful: Hidding completely viewer nodes (no ghosting).
Hope that helps.

WinRT barcode scanner component

I have a Windows Store (Metro) application. I need to add support for scanning barcodes.
I tried using ZXing first. From what I was able to get working, you actually need to click and save an image for it to do the processing. There's no nice overlay of a red line "scanner" nor does it process a live feed. This isn't a very elegant solution. It works far better on Android. Basically, this won't work as I need a constant video and a constant search for a barcode to be in focus.
This blog (http://www.soulier.ch/?p=1275&lang=en) mentions that extrapolating a frame out of a WinRT video stream is not allowed in managed code which means I'd need to use C++.
So, are there any components out there that do this? Anything free or paid that I can get that would be written in C++ and can find and extrapolate a barcode? Learning C++ is not on my bucket list.
You can capture frames while displaying a preview with C# only. Here's an example control that does it:
https://winrtxamltoolkit.codeplex.com/SourceControl/latest#WinRTXamlToolkit/Controls/CameraCaptureControl/CameraCaptureControl.cs
Basically you need to create a MediaCapture object and associate it with a CaptureElement control to display the preview. Then you can use CapturePhotoToStreamAsync() to capture a frame to a stream of your selected encoding format and then have a go at it with your bar code reading code.
I made a lib for WinRT using ZXing & Imaging SDK.
It works well (but does not include any additional focus feature).
There is a lib and a sample app that you can try.
It works for barcodes and QRCode (barcode by default but just change the optional parameter in the scan function code to use QRCode)

How to build iOS7 Style Audio Recorder App

I am trying to build an audio recorder app similar to iOS7 built in one and looking for guidance on what controls to use for the recording app. I understand I will be using a tableview for the list of previous recordings and a UIView for the top recording view and on tapping record adjust the table view and move down the black recording view.
How should I implement the endless horizontal scrolling view? Should I use a collection view and keep adding elements to the model array as the time increments. Also what should I use for the timer. Is there something like setInterval for Objective C like in Javascript that I can use to keep updating the UI at regular time interval?
If someone also knows of a cocoa pod or sample code that would be greatly appreciated.
For recording the simplest audiorecorder is AVAudioRecorder. Here is a simple implementation of an audio recording app: https://github.com/calmez/Recorder. AVAudioRecorder has simple metering methods where you can read volume output of the channels
Honestly though, Apple would probably use CoreAudio to get the audio because it is more optimized. Novocaine is a good core audio engine that could get you started https://github.com/alexbw/novocaine
For rendering the waveform, I would guess that Apple probably uses OpenGL. I don't see how to do it easily and efficiently otherwise. You could draw them using the standard drawing APIs for UIView like this project does (https://github.com/fulldecent/FDWaveformView) but I don't see this animating well.
For the timer, there is NSTimer