Directions from xml file - gmlib

I know you can set a direction, modify with drag-n-drop and then save the result as an xml file.
Is there a way to load this xml again to be shown on the map?
I tried something like:
DirectionsResult := TDirectionsResult.Create(GMDirection, 1);
DirectionsResult.XMLData.LoadFromFile('results.xml');
GMDirectionRota.Execute;
Any Ideia?

There is limitation to calculate the direction ?
I added more than 10 point stop and not display anything on the map.
Marcio

Related

Auto desk - Forge Viewer - Markup - am not able to get markups array in markup extension while loading markups

While loading markups, I am not able to get markups array from markup extension as referneced in below code, actually I need client position coordinates of the loaded markup. In below code am getting markups array empty. But while drawing a new markup, we always have markup array filled.
Please advise
markup.viewer.restoreState(viewState);
markup.loadMarkups(svgTxt, "layerName")
var pos = markup.markups[0].getClientPosition()
Since you're not editing the layer you specified, the markupExt.markups will not contain anything. Please use this instead:
const activeLayerMarkup = markupExt.svgLayersMap[markupExt.activeLayer]
activeLayerMarkup.markups[0].getClientPosition()
Or try to edit the layer
markupExt.loadMarkups(svgTxt, 'layerName')
markupExt.enterEditMode('layerName')
markup.markups[0].getClientPosition()

Missing properties (Globalds) from IFC file in viewer

To resume the steps leading to my issue:
Upload a file to bucket in Forge.
Convert the file.
Extract the IFC data using external tool.
Now I am trying to get (using the Viewer) the GlobalIds of each element, as in IFC they are unique and match them to the data that I already have by this property.
Currently in the converted file that is shown in the viewer, not all the elements from the geometry are providing the correct data on click.
For example: If I open a IFC file in viewer and I click on the Roof element, it does not select the IfcRoof element, but some IfcElement that is lower in the structure and that neither have a GlobalId, nor has some data attached, cause it is not supposed to. So now it is not possible to get the proper properties of the element using the viewer because it does not selects the right element, which I need to match the data that I extract with the external tool.
Any ideas how I can proceed with that?
Can you simply traverse the structure from the lower level element upwards until you reach an element that does provide a valid global id?
So the clue is that you should iterate the response's __parent's till you get an element with type 'IFC' and get his GlobalId. It works in most cases.

D3 JSON diagram shapes

I'm creating a diagram with D3 and JSON which is based on this:
http://bl.ocks.org/mbostock/4063550
The difference is, I also want to have different shapes for nodes (not just circles, but for example, trianges.)
I have a attribute in the JSON file that says something like "shape":"triangle".
How do I update that index.html file so that I can get different shapes to be displayed?
Really urgently need assistance...any help/advice really appreciated.
Trying modifying this line to be what you want, which is currently drawing a circle:
node.append("circle")
.attr("r", 4.5);
D3 has some built in SVG helpers for drawing symbols: d3.svg.symbol. AS #pfrank suggests, you should be able to append a path instead of a circle and set the d attribute to the output of the symbol helper configured to whatever shape you want.

Google Map Pins Missing

I have a site using Google map but is now having pins disappear. The code that create the pins are valid and have already been tested. From the inspector, they all seem to be pointing to the a.xa.Fa property in http://maps.gstatic.com/intl/en_us/mapfiles/api-3/13/9/main.js which I believe is injected (as I have included no such script).
I'm quite desperate and have no idea what to do with it. So any input is appreciated.
You try to add markers without supplying a proper pin-argument to add(), therefore the creation of new google.maps.MarkerImage(pin) will fail in add().
This happens the first time at the 6th marker(that's why you see only 5 markers, the error will stop the script-execution at this point).
Solution: you may either fix it(supply a proper pin-argument), there is also a LatLng of 0,0 provided, I guess something went wrong with your data.
or add this to the begin of add() to have a default-pin for these situations:
pin=pin||'http://www.mychinaroots.com/wp-content/themes/mychinaroots/images/8-default.png';

Redraw the saved image data to HTML 5 canvas

I am studying HTML5. I want to create / draw some shapes in canvas and save it in MySQL database and restore it in the canvas itself.
I followed this tutorial
And saved the data in database. I got this in my database column
data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAZAAAADICAYAAADGFbfiAAAEAUlEQVR4nO3dv48VVRgG4DcRtjEWJBQbOhortYQ%2FASOtyWpCBQkWFtQm1jTGnlBQEV2NCTWVfwCVNiRsZSwwuFRsRAJ7sbjBrLkz98cyO9%2Bc%2BDzJtJv3NPvmzHfO3AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOL7tJLMkr3ue2ZHneZL7NTEBmJLt9BfHps%2BbkjlM8jTJlRHXAcCIhiyPTUtmluQgyb0TXyUAg%2Bp7ZTXreMYumTc5bp7Y6gE4lr5S2N7g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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADABv4B7KWsU334yWgAAAAASUVORK5CYII%3D
In one of my page I just need to render the saved image in a canvas...
Anyone please advice ?
the src attribute of an image can be a data-url - base64-encoded binary image data. The function canvas.toDataURL(); converts the content of the canvas to such a data URL. The code in the tutorial you posted then runs it through the encodeURIComponent function to get it into an ajax-friendly format.
When you retrieve that string from the database later, you need to run it through decodeURIComponent (this will replace %3A with :, %2F with a / and so on to turn it back into a syntactically correct data-url) and then assign the resulting string to a new Image() element. You should then be able to draw this image to a canvas.