Reading a Cube Voyager Path File from Java
October 8th, 2012As a follow-up to my prior post, this is how to use the Cube Voyager API to read a path file. Â I highly recommend you read the other article first, as it talks more about what is going on here.
The Interface
The interface for the path reader is larger because of the return structure. Â The code below includes the interfaces to the DLL calls and the structure for the path data returned by some of them. Â Note that I didn’t do PathReaderReadDirect. Â It doesn’t seem to work (or I’m not trying hard enough).
The Code
Once the interface is in place, the code is reasonably simple. Â However, I’m seeing a few interesting things in the costs and volumes in both C++ and in Java, so I wouldn’t use those values. Â I guess if you need to determine the costs, you should save the costs with the loaded highway network to a DBF file and read that into an array that can be used to store and get the values.
The Final Word… For Now
Java is a great programming language. Â Using these DLLs can help you do some interesting stuff. Â However, it seems that there are very few people using the API, which is concerning. Â I personally would like to see an interface for reading .NET files and writing matrices. Â But I can’t expect Citilabs to put time in on that when it seems there are so few people using it.