How can I integrate a navigator app on a device - movilizer

What is the best approach to make use of navigation features like route planning when I have an address in my Movelet and want to trigger a navigation via an external app on iOS, Android and Windwos Phone?

To jump into another app you need the Movilizer AppJump feature, with this you can open a connection (Module SPI) and trigger the execution in use of the exec command. What you or the user still has to do is to start the navigation manually by pressing the Start button in the maps app.
For the Android Client you need to use the protocol named geo. Geo gives you two opportunities, you can either enter the specific coordinates or enter an address.
The use of specific coords will look like this:
'geo:49.483611111111,8.463055555555697?z=18'
In case you don't know the coords you can also use:
'geo:0,0?q=Wilhelm-Varnholt-Allee 1, 68165 Mannheim?z=18'
In your code it will look like that:
if(platform == 11)
{
intentURL = conCat('geo:0,0?q=', destPoint,'?z=18');
conStr = conCat('exec:', intentURL);
}
For the iOS Client the URL scheme looks quite similar, but instead of using geo you need to use to point on the app which you want to open.
'exec:maps://?q=Wilhelm-Varnholt-Allee 1, 68165 Mannheim?z=18'
The use of maps:// will open the Apple Maps app if you want to have Google Maps you must use comgooglemaps://
I've prepared a small example this may helps you to solve the problem you have:
<question key="#1" type="6" title="Address">
<answer key="#1_0" nextQuestionKey="END" dummyAnswer="true"/>
<onEnterAssignment>
addresses =
{
'Diakoniekrankenhaus Mannheim' : 'Speyerer Str. 91, 68163 Mannheim';
'Moll-Gymnasium' : 'Feldbergstraße 16, 68163 Mannheim';
'Planetarium Mannheim' : 'Wilhelm-Varnholt-Allee 1, 68165 Mannheim';
'Karl Benz Stadion' : 'Theodor-Heuss-Anlage 20, 68165 Mannheim';
'Luisenpark' : 'Theodor-Heuss-Anlage 2, 68165 Mannheim';
'Mannheim City Airport':'Seckenheimer Landstr.172, 68163 Mannheim';
};
for(dest:addresses)
{
addAnswer($answer:'#1_0', dest, dest);
}
platform = getClientType();
</onEnterAssignment>
<onLeaveOkPersistAssignment>
destPoint = addresses[getQuestionValue()];
if(platform == 11)
{
intentURL = conCat('geo:0,0?q=', destPoint,'?z=18');
conStr = conCat('exec:', intentURL);
}
else
{
conStr = conCat('exec:maps://?q=', destPoint, '?z=18');
}
conID = connect(conStr, null);
if(isConnectionOpen(conID))
{
close(conID);
}
</onLeaveOkPersistAssignment>

I've also found another way on Android:
addressTxt = "Wenceslas Square, Prague, CZ";
connStr = concat("exec://", "%com.google.android.apps.maps%", "http://maps.google.com/maps?daddr=", addressTxt);
connection = connect(connStr, "name");
try
{
close(connection);
}
catch (exception)
{
}
Result on YouTube

For the navigation on Android, the following worked for me.
intentURL = '%com.google.android.apps.maps%google.navigation:q=Address';
conID = connect(concat('exec:', intentURL), "name");
if (conID ?ge 0)
{
close(conID);
}
Address could be: RMZ Eco World Rd, Adarsh Palm Retreat Villas, Bellandur, Bengaluru, Karnataka 560103, India

Related

ARKIT issue loading assets in virtual object

ARKIT issue.
On upgrading the iPhone ios from 15.6 to ios 16, i am facing issue in loading virtual object contents on the screen.
Below mentioned code is working fine with iPhone iOS version 15.6.
In ios 16, below function is keep on calling in the code.
Tag: ProcessRaycastResults
private func setVirtualObject3DPosition(_ results: [ARRaycastResult], with virtualObject: VirtualObject) {
guard let result =
results.first else {
print("Unexpected case: the update handler is always supposed to return at least one result.")
return;
}
self.setTransform(of: virtualObject, with: result)
// If the virtual object is not yet in the scene, add it.
if virtualObject.parent == nil {
self.childNodesPortal = virtualObject.childNodes
self.getMatrials(scene: virtualObject.childNodes)
}
}
func getMatrials(scene:[SCNNode]){
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5 ) {
for child in scene {
material.diffuse.contents = "https//xyz.png"
material.normal.contents = "https//xss.png"
//setting here materials with the png images from url.
}
}
}
Anyone could suggest why there is variation for iOS version 16 device and what workaround I should do.

Dodge Effect Fix? (FNF Psych Engine)

case 'Dodge': //hahahahahahahaha beat that demo
new FlxTimer().start(0.1, function(tmr:FlxTimer)
{
var warning = new FlxText(0, 0, 0, 'Press Space Bar Now!', 32);
warning.cameras = [camOther];
warning.setFormat(Paths.font("vcr.ttf"), 24, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
warning.screenCenter(X);
warning.size = 50;
warning.screenCenter(Y);
warning.updateHitbox();
add(warning);
});
new FlxTimer().start(0.6, function(tmr:FlxTimer)
{
if (FlxG.keys.justPressed.SPACE)
{
health = 1;
boyfriend.playAnim('dodge', true); //woosh
FlxG.sound.play(Paths.sound('dodge')); //stab
remove(warning);
warning.destroy();
}
else {
health -= 2;
vocals.volume = 0;
doDeathCheck(true); //dead noises
};
});
so it does it but it wont detect space bar being hit
i need it so it will detect the space bar being hit
i am not sure what i did wrong or what i did but it just goes to game over
I would Use lua ( not using source ) Since there is no offical event sorry im a Psych engine nerd- I made 2 engines so i would say make a lua event with it

CBCentralManager ScanForPeripherals with empty CBPeripheral name

I need to solve this issue with my app.
I try to scan the peripherals (Bluetooth devices) using the CBCentralManager from the CoreBluetooth in Xamarin.iOS, but when a peripheral is discovered it has an empty name sometimes, when I do the same from the iOS settings then it has a name.
I'm not searching for a specific UUID.
CBCentralManager manager = new CBCentralManager(CoreFoundation.DispatchQueue.MainQueue);
manager.DiscoveredPeripheral += (sender, e) =>
{
if (e.Peripheral != null)
{
Debug.WriteLine($"DiscoveredPeripheral: {e.Peripheral.Name} - {e.Peripheral.Identifier} - {e.AdvertisementData}");
PeripheralsList.Add(e.Peripheral);
CustomDeviceDiscoveredAction(this, new CustomBTEDevice
{
DeviceName = e.Peripheral.Name,
DeviceAddress = e.Peripheral.Identifier.AsString(),
DeviceGuid = Guid.Parse(e.Peripheral.Identifier.AsString())
});
}
};
manager.ScanForPeripherals(null, new PeripheralScanningOptions
{
AllowDuplicatesKey = false,
});
Check property LocalName in the advertisement data package
Also, my suggestions, do not rely on the device name, better rely on data in advertisement data

Revit API SetPointElementReference(PointOnPlane) - wrong workplane

I try to create a family instance using CreateAdaptiveComponentInstance and try to host it on a reference point, that's also a control point of a CurveByPoints (spline).
The family links properly to the reference point, but the rotation of the reference point's workplane is totally ignored.
Try this standalone example. Move the reference point P2 -> The cross section at P1 will not rotate.
Now, rebuild and change the >> if(true) << to 'false'. Now you see what I want. But as soon as you move the point P2, the link between P2's coordinates and the family is broken.
CurveByPoints spl = null;
ReferencePointArray pts = null;
// create ref points
var p1 = doc.FamilyCreate.NewReferencePoint(new XYZ( 0, 0, 0)); p1.Name = "P1";
var p2 = doc.FamilyCreate.NewReferencePoint(new XYZ(10,10, 0)); p2.Name = "P2";
var p3 = doc.FamilyCreate.NewReferencePoint(new XYZ(30,20, 0)); p3.Name = "P3";
pts = new ReferencePointArray();
pts.Append(p1); pts.Append(p2); pts.Append(p3);
// create a spline
spl = doc.FamilyCreate.NewCurveByPoints(pts);
spl.Visible = true;
spl.IsReferenceLine = false; // MOdelliinie
// change points to adaptive points
foreach(ReferencePoint p in pts)
{
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(doc, p.Id, AdaptivePointType.PlacementPoint);
p.CoordinatePlaneVisibility = CoordinatePlaneVisibility.Always;
p.ShowNormalReferencePlaneOnly = true;
}
// find an adaptive family to place at the points
FamilySymbol fam_sym = null;
var filter = new FilteredElementCollector(doc);
ICollection<Element> col = filter.OfClass(typeof(FamilySymbol)).ToElements();
if(col!=null)
{
foreach(FamilySymbol ele in col)
{
if(ele == null || !AdaptiveComponentInstanceUtils.IsAdaptiveFamilySymbol(ele) ) {continue;}
if(fam_sym == null)
{
fam_sym=ele;
}
if(ele.Name == "profil_adapt_offset_einfach2") // use a special one instead of the first matching
{
fam_sym = ele as FamilySymbol;
break;
}
}
}
// create family instances
if(fam_sym != null)
{
if(true) // this is waht I want. Try "false" to see what I expect
{
foreach (ReferencePoint p in pts)
{
var inst = AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance(doc, fam_sym);
var placements = AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(inst);
ReferencePoint fam_pt = doc.GetElement(placements.FirstOrDefault()) as ReferencePoint;
var pl = Plane.CreateByNormalAndOrigin(new XYZ(1,0,0), p.Position);
// #### I THINK HERE IS MY PROBLEM ####
// "plane" just points to the reference POINT,
// and not the XZ-PLANE of the reference point.
Reference plane = p.GetCoordinatePlaneReferenceYZ();
PointOnPlane pop = doc.Application.Create.NewPointOnPlane(plane, UV.Zero, UV.BasisU, 0.0);
fam_pt.SetPointElementReference(pop);
}
}
else
{
// create family instances and place along the path
// -> looks good until you move a reference point
double ltot=0.0;
for(var i=0; i<pts.Size-1; ++i)
{
ltot += pts.get_Item(i).Position.DistanceTo(pts.get_Item(i+1).Position);
}
double lfromstart=0;
for(var i=0; i<pts.Size; ++i)
{
if(i>0)
{
lfromstart += pts.get_Item(i).Position.DistanceTo(pts.get_Item(i-1).Position);
}
var inst = AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance(doc, fam_sym);
var placements = AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(inst);
var location = new PointLocationOnCurve(PointOnCurveMeasurementType.NormalizedCurveParameter, lfromstart / ltot, PointOnCurveMeasureFrom.Beginning);
PointOnEdge po = doc.Application.Create.NewPointOnEdge(spl.GeometryCurve.Reference, location);
// attach first adaptive point to ref point
var firstPoint = doc.GetElement(placements.FirstOrDefault()) as ReferencePoint;
firstPoint.SetPointElementReference(po);
}
}
}
I'm using Revit 2018.2, here.
People might also search for: GetCoordinatePlaneReferenceXZ, GetCoordinatePlaneReferenceXY.
[edit1]
NewReferencePoint() does not create SketchPlanes
When I manually move a generated reference point -> Now the SketchPlane for this ReferencePoint is generated. But how create that with the API?
[edi2]
- I found that e.g. manually changing the ReferencePoint.CoordinatePlaneVisibility=true will create the SketchPlane I need. But I can't do that in code:
var sel = new List<ElementId>();
foreach (ReferencePoint p in pts)
{
sel.Add(p.Id);
// make plane visible
p.CoordinatePlaneVisibility = CoordinatePlaneVisibility.Always;
// shake point
ElementTransformUtils.MoveElement(doc, p.Id, XYZ.BasisX);
ElementTransformUtils.MoveElement(doc, p.Id, XYZ.BasisX.Negate());
}
ui_doc.Selection.SetElementIds(sel);
doc.Regenerate();
ui_doc.RefreshActiveView();
Will it help if you use the NewReferencePoint overload taking a Transform argument, cf. NewReferencePoint Method (Transform)? That might define the required plane for you and associate it with the point.
The development team replied to your detailed description and test project provided in the attached ZIP file:
The developer seems to be in need of some API we haven’t exposed. PointElement’s API was written before RIDL, so the entire user interface is not exposed to the API. They need an API to get the reference plane that is normal to the the curve that it is driving. This plane is not the same as what is exposed by API PointElement.GetCoordinatePlaneReferenceYZ() (one among the three planes exposed to API).
As per SketchPlanes not being created (in the macro seen in the linked zip file), yes that is correct and matches the UI. SketchPlanes are elements and are different from Autodesk.Revit.DB.Reference. We don’t create them until we have to. And they get garbage collected too. At the end of description, I see some code that should work (assuming they wrapped it in a transaction). Normally selection of the point alone will trigger creation of the SketchPlane from the UI. That aside, I would still not recommend putting the point on SketchPlane for what they want to do.
While, what they want does not exist in API, it still does not quite mean there is no workaround for what they want to achieve. If the Selection or Reference API exposes selectable/visible references on an element, Autodesk.Revit.DB.Reference, then one can iterate over these and host the point. This is generic Element/Reference API.
I hope this clarifies.

Adding Multiple Views to a VC++ 2010 SDI using MFC

I'm trying to add multiple (actually 3 ) views to an SDI application and give the user choose witch View will be load according to his choice :
IMG
I have followed this tutorial in the official MS documentation .
So, have created three classes : CAdminView CAssistantView CBiblioView and an authentication class associated to a dialog frame .
My Questions are :
1) how to edit this three view classes (Graphically) ?
2) at first time I want to show just the authentication dialog window , how to do that ?
* I tried to change m_pMainWnd->ShowWindow(SW_SHOW);
by m_pMainWnd->ShowWindow(SW_HIDE); but no expected result
3) I expect to load the view according to parameter, this is what I added to the InitInstance funnction :
CView* pActiveView = ((CFrameWnd*) m_pMainWnd)->GetActiveView();
m_BiblioView = (CView*) new CBiblioView;
m_AdminView = (CView*) new CAdminView;
m_AssistantView = (CView*) new CAssistantView;
CDocument* pCurrentDoc = ((CFrameWnd*)m_pMainWnd)->GetActiveDocument();
// Initialize a CCreateContext to point to the active document.
// With this context, the new view is added to the document
// when the view is created in CView::OnCreate().
CCreateContext newContext;
newContext.m_pNewViewClass = NULL;
newContext.m_pNewDocTemplate = NULL;
newContext.m_pLastView = NULL;
newContext.m_pCurrentFrame = NULL;
newContext.m_pCurrentDoc = pCurrentDoc;
// The ID of the initial active view is AFX_IDW_PANE_FIRST.
// Incrementing this value by one for additional views works
// in the standard document/view case but the technique cannot
// be extended for the CSplitterWnd case.
UINT viewID = AFX_IDW_PANE_FIRST + 1;
CRect rect(0, 0, 0, 0); // Gets resized later.
// Create the new view. In this example, the view persists for
// the life of the application. The application automatically
// deletes the view when the application is closed.
m_AdminView->Create(NULL, "Fenetre Administrarteur", WS_CHILD, rect, m_pMainWnd, viewID, &newContext);
m_AssistantView->Create(NULL, "Fenetre Assistant", WS_CHILD, rect, m_pMainWnd, viewID, &newContext);
m_BiblioView->Create(NULL, "Fenetre Bibliothecaire ", WS_CHILD, rect, m_pMainWnd, viewID, &newContext);
// When a document template creates a view, the WM_INITIALUPDATE
// message is sent automatically. However, this code must
// explicitly send the message, as follows.
m_AdminView->SendMessage(WM_INITIALUPDATE, 0, 0);
m_AssistantView->SendMessage(WM_INITIALUPDATE, 0, 0);
m_BiblioView->SendMessage(WM_INITIALUPDATE, 0, 0);
and this is my switch function :
CView* CMiniProjetApp::SwitchView(int Code ) //1 : Admi / 2 : Biblio / 3 : Assistant
{
CView* pActiveView =((CFrameWnd*) m_pMainWnd)->GetActiveView();
CView* pNewView= NULL;
switch(Code){
case 1 : pNewView= m_AdminView; break;
case 2 : pNewView= m_BiblioView; break;
case 3 : pNewView= m_AssistantView; break;
}
// Exchange view window IDs so RecalcLayout() works.
#ifndef _WIN32
UINT temp = ::GetWindowWord(pActiveView->m_hWnd, GWW_ID);
::SetWindowWord(pActiveView->m_hWnd, GWW_ID, ::GetWindowWord(pNewView->m_hWnd, GWW_ID));
::SetWindowWord(pNewView->m_hWnd, GWW_ID, temp);
#else
UINT temp = ::GetWindowLong(pActiveView->m_hWnd, GWL_ID);
::SetWindowLong(pActiveView->m_hWnd, GWL_ID, ::GetWindowLong(pNewView->m_hWnd, GWL_ID));
::SetWindowLong(pNewView->m_hWnd, GWL_ID, temp);
#endif
pActiveView->ShowWindow(SW_HIDE);
pNewView->ShowWindow(SW_SHOW);
((CFrameWnd*) m_pMainWnd)->SetActiveView(pNewView);
((CFrameWnd*) m_pMainWnd)->RecalcLayout();
pNewView->Invalidate();
return pActiveView;
}
Any errors notices ??!!
*please help me !
Thanks .
Showing and Hiding the window is the correct way. But you Need to set the view as active too.
You find the required working codein this MSDN Sample VSSWAP32.
The required code to switch and hide the other views is shown in the article.

Resources