I just want to know if there is any way to determine if the current Google earth plug-in is in street view mode or not.
To test if street view is enabled in the Google Earth plugin:
var navcontrol = ge.getNavigationControl();
var response = navcontrol.getStreetViewEnabled(); // default=false
// response: true -> enabled; false -> disabled
if (!response) {
// to enable street view mode
navcontrol.setStreetViewEnabled(true);
}
If street view is enabled by calling setStreetViewEnabled(true) then user will be able to interactively enter StreetView by manually zooming in (or using pegman).
Note the API docs documents calling ge.getPlugin().streetViewEnabled(true) but this is an error since the getPlugin() method does not exist. The correct method is calling getNavigationControl().
Here's how to test if street view mode is active:
var la = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
var viewerOptions = la.getViewerOptions();
if (viewerOptions) {
var state = viewerOptions.getOption(ge.OPTION_STREET_VIEW);
if (state == ge.OPTION_STATE_ENABLED) {
// street view mode is active
// do something here
}
}
// if viewerOptions is null then no modes are active
State can be one of three values:
GEPlugin.OPTION_STATE_DEFAULT (0)
GEPlugin.OPTION_STATE_ENABLED (1)
GEPlugin.OPTION_STATE_DISABLED (2)
Reference: Interface options and GE Plugin.
Related
How can I achieve to show the view bounds on the HERE maps for a particular city on flutter platform?
First you need to get bounding box for your city that available in property "boundingBox" of Place object https://developer.here.com/documentation/flutter-sdk-explore/4.6.2.0/api_reference/search/Place/boundingBox.html
To search your city and look at it view bounds use this roughly sample of code (not tested):
await (new SearchEngine()).searchByText("DEU Berlin", SearchOptions.withDefaults(),
(SearchError searchError, List<here.Place> placeList) async {
if (SearchError == null) {
here.Place place = placeList.first;
_hereMapController.camera.lookAtAreaWithOrientation(place.boundingBox, MapCameraOrientationUpdate.withDefaults());
} else {
var error = searchError.toString();
}
});
Additional help links:
https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/explore/flutter/camera_app/lib/CameraExample.dart
https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/explore/flutter/routing_app/lib/RoutingExample.dart
https://developer.here.com/documentation/flutter-sdk-explore/4.6.2.0/api_reference/mapview/MapCamera/lookAtAreaWithOrientation.html
https://developer.here.com/documentation/flutter-sdk-explore/4.6.2.0/api_reference/search/SearchEngine/searchByText.html
I am using Core Location in my app and I am trying to present a calibration alert when the device compass / heading values are too imprecise.
I am correctly reading the heading values from the didUpdateHeading delegate function.
I read the related posts and I the CLLocationManager documentation (https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate/1621457-locationmanagershoulddisplayhead).
In the locationManagerShouldDisplayHeadingCalibration(_:) delegate function I tried those two implementations:
func locationManagerShouldDisplayHeadingCalibration(_ manager: CLLocationManager) -> Bool {
return true
}
And:
func locationManagerShouldDisplayHeadingCalibration(_ manager: CLLocationManager) -> Bool {
print("locationManagerShouldDisplayHeadingCalibration")
if let h = manager.heading {
return h.headingAccuracy < 0 || h.headingAccuracy > 10
}
return true
}
In the documentation, it is stated "If you return false from this method or do not provide an implementation for it in your delegate, Core Location does not display the heading calibration alert. Even if the alert is not displayed", but I don't know how to "provide an implementation for it".
Moreover, I see that there is no way to present the system calibration alert manually, if the alert is not presented as often as I want, is it a good solution to poll the headingAccuracy value on the didUpdateHeading callback and to present a system-like alert ? Also as I never saw it is there any way I can trigger the system calibration alert ?
I am developing one chat app in that i need to show message status like WhatsApp app for that i have tried XEP-0333(Chat Marker) but facing issue Like.
1) After getting Received Marker from other end XMPPMessage Archive not updated message with Received Marker (In Core data, message chat marker status not updated).
2) How to implement Displayed Marker logic? (means for each message we need to send displayed marker or for only one dialog at once.)
XEP Link : XEP-0333
Code:
//(Sender Part)
let completeMessage = DDXMLElement.element(withName: "message") as! DDXMLElement //(In that i have set id,body,to and type as chat)
let msgObj = XMPPMessage(from: completeMessage)
msgObj?.addMarkableChatMarker()
xmppStream?.send(msgObj)
//(Receiver Part)
didReceivedMessage - Method
//*Check One condition*
if message.isChatMessageWithBody() && message.isErrorMessage() == false {
if (message.hasChatMarker() == true){
printLog("Message ID\(message.elementID())")
let msgElement = XMPPMessageMng.getChatMessageElement(recipient: message.from().bare(), thread: "")
let threadElement = DDXMLElement.element(withName: "thread") as! DDXMLElement
threadElement.stringValue = "Thread"
msgElement.addChild(threadElement)
let msgReceived = XMPPMessage(from: msgElement)
msgReceived?.addReceivedChatMarker(withID: message.elementID())
xmppStream.send(msgReceived)
}
}
else{
if (message.hasMarkableChatMarker() == true){
printLog("Chat Marker ID\(message.chatMarkerID())")
}else if (message.hasReceivedChatMarker() == true){
printLog("Chat Marker ID\(message.chatMarkerID())")
}
}
//For Display Marker I have done below things.
- When you load message from message archive with JID.
loadArchivedMessagesFromJID - Method
//message as XMPPMessageArchiving_Message_CoreDataObject
let msgReceived = XMPPMessage(from: msgElement)
msgReceived?.addDisplayedChatMarker(withID: message.message.elementID())
xmppStream.send(msgReceived)
Let me know in which right way we can implement Chat marker protocol.
Dev Tools : Xcode 8.3(Swift 3.0) ,
Server : ejabberd
ejabberd still doesn't support xep-0333
here's the link for supported XEP:
Protocols Supported by ejabberd
On my Google Site I've inserted an Apps Script Gadget (by pasting the URL of an Apps Script that I published as a service). This Apps Script allows the user to enter a value (their 'Blow Number') and view the corresponding data (based on API calls to my Google Fusion tables).
Right now, the script returns 3 hyperlinks:
Click here for a table of Blow Number 1
Click here for a chart of Blow Number 1
Click here for a map of Blow Number 1
This is because my script function getblowdetails has 3 app.createAnchor variables. Instead of having the script return 3 hyperlinks (that the user has to click on and view the resulting URL in a new window), I would like for the script to automatically invoke the 3 URLs and display the table, chart, and map in panels on the same page.
So the user would enter their Blow Number and press enter. They would then view the table, chart, and map directly below the text box on the same web page.
Please see the Code that I've included below and advise...Thanks for the help- I'm an apps-script novice so a thorough and understand-able response is greatly appreciated!
Code
Note: I've removed the URLs from the createAnchor variables because I'm only allowed to include 2 links in the post, but you can see them by going to www.OnSiteBAC.com/ViewMyBlows and entering Blow Number = 1...then click on the hyperlinks.
function doGet() {
var app = UiApp.createApplication();
// Create input boxes, buttons, labels, and links
var textBoxA = app.createTextBox().setId('textBoxA').setName('textBoxA').setFocus(true);
var buttonA = app.createButton('Get Blow Details').setEnabled(false);
var label = app.createLabel('Please enter your Blow Number here');
var link = app.createAnchor('where can I find my Blow Number?', 'http://www.onsitebac.com');
// Create a handler to call the getblowdetails function.
// A validation is added to this handler so that it will only invoke 'getblowdetails' if textBoxA contains a number
var handler = app.createServerClickHandler('getblowdetails').validateNumber(textBoxA).addCallbackElement(textBoxA);
// Create a handler to enable the button if all input is legal
var onValidInput = app.createClientHandler().validateNumber(textBoxA).forTargets(buttonA).setEnabled(true).forTargets(label, link).setVisible(false);
// Create a handler to mark invalid input in textBoxA and disable the button
var onInvalidInput1 = app.createClientHandler().validateNotNumber(textBoxA).forTargets(buttonA).setEnabled(false).forTargets(textBoxA).setStyleAttribute("color", "red").forTargets(label, link).setVisible(true);
// Create a handler to mark the input in textBoxA as valid
var onValidInput1 = app.createClientHandler().validateNumber(textBoxA).forTargets(textBoxA).setStyleAttribute("color", "black");
// only fire ServerHandler for onKeyUp if it passes validation
var textBoxHandler = app.createServerHandler('textBoxHandlerFunction');
// Add all the handlers to be called when the user types in the text boxes
textBoxHandler.addCallbackElement(textBoxA);
textBoxA.addKeyUpHandler(onInvalidInput1);
textBoxA.addKeyUpHandler(onValidInput1);
textBoxA.addKeyUpHandler(onValidInput);
textBoxA.addKeyUpHandler(textBoxHandler);
buttonA.addClickHandler(handler);
app.add(textBoxA);
app.add(buttonA);
app.add(label);
app.add(link);
return app;
}
function textBoxHandlerFunction(e) {
var app = UiApp.getActiveApplication();
if (e.parameter.keyCode == 13)
{
app = getblowdetails(e);
}
return app;
}
function getblowdetails(e) {
var app = UiApp.getActiveApplication();
var panel2 = app.createVerticalPanel();
var link2 = app.createAnchor ().setStyleAttribute("color", "green");
var panel3 = app.createVerticalPanel();
var link3 = app.createAnchor ();
var panel4 = app.createVerticalPanel();
var link4 = app.createAnchor ();
panel3.add(link3);
app.add(panel3);
panel4.add(link4);
app.add(panel4);
return app;
}
I don't think you'll be able to actually download the result and show it. So, there's no easy solution.
But you can build that table and chart on Apps Script easily (assuming you can already fetch the info from tables using its API).
The last issue is the map. On Apps Script you can only create static maps, meaning, an image. You can add custom markers and polygons, set the zoom, etc. But in the end it's a photo. The user will not be able to drag it around or use the map as an embedded google map as one would expect.
If you have 2 pushpins on 'London' at the same geolocation, is there anything in the API to move them apart so they are both visible?
I can only find documentation on their old map points API which had PreventIconCollisions, this is what I want but can't see any reference to this in the new API.
I am using the JavaScript API.
So if I understand correctly, you have similar information on the same location, it this correct?
In order to display both information, you will have two options:
Merge information in the textbox using an appropriate way to present the information inside this ui element (using your own tabbed infobox for example)
Decluster the point manually when you're at a certain level of zoom
There is no default property to set this and it would really messy to do this on many pushpins, but in the main idea, you would have to: detect viewchangeend event, if you're at a certain level of zoom (or higher zoom level) then you're declustering them (I call it decluter nearby pushpins).
// Bind pushpin mouseover.
Microsoft.Maps.Events.addHandler(pin, 'mouseover', function (e) {
var currentPin = e.target;
currentPin.setOptions({ visible: false });
var currentLocation = currentPin.getLocation().clone();
var currentPoint = bmGlobals.geo.map.tryLocationToPixel(currentLocation);
if (currentPin.associatedCluster.length == 2) {
// Display the first pushpin
var pinA = createPin(currentPin.associatedCluster[0]);
var locA = bmGlobals.geo.map.tryPixelToLocation(new Microsoft.Maps.Point(currentPoint.x - pinA.getWidth(), currentPoint.y));
pinA.setLocation(locA);
bmGlobals.geo.layerClusteredPin.push(pinA);
// Display the second pushpin
var pinB = createPin(currentPin.associatedCluster[1]);
var locB = bmGlobals.geo.map.tryPixelToLocation(new Microsoft.Maps.Point(currentPoint.x + pinB.getWidth(), currentPoint.y));
pinB.setLocation(locB);
bmGlobals.geo.layerClusteredPin.push(pinB);
}
});
I will try to write a bing maps module about this, but in the fact, you'll have to get your clustered pushpins (or your own pushpin that has two associated data object) and then you will have to set their position based on the rendering on the client side.
I know this question is really old, but if someone is looking for something similar (clustering the pins) here is a good start: http://rtsinani.github.io/PinClusterer/