LandXML C++ Software Development Kit.LandXML is an open, XML-based data standard for civil engineering and transportation applications.
Be the first to post a text review of LandXML Software Development Kit. Rate and review a project by clicking thumbs up or thumbs down in the right column.
LandXML Software Developers Kit /* * The LandXML.org Open Software License, Version 1.0 * * * Copyright (c) 1999-2003 LandXML.org. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL LandXML.org OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the LandXML.org and was * originally based on software copyright (c) 2002, Autodesk, Inc., * http://www.autodesk.com. */ Build Instructions The LandXML SDK is build using the SAX interface from the MSXML4 parser from Microsoft. Three build targets/environemnt project files are provided: *** Microsoft Developer Studio 6.0 *** LandXMLSDK60.dsw LandXMLSDK60.dsp output: .\release, .\debug Release builds DLL in .\release\LandXMLSDK60.dll LIB in .\release\LandXMLSDK60.lib Debug builds DLL in .\debug\LandXMLSDK60D.dll LIB in .\debug\LandXMLSDK60D.lib *** Microsoft Developer Studio .NET 2002 *** LandXMLSDK70.sln LandXMLSDK70.vcproj output: .\LandXmlSdkDll70___Win32_Release, .\LandXmlSdkDll70___Win32_Debug Release builds DLL copied to .\build\bin\LandXMLSDK70.dll LIB copied to .\build\bin\LandXMLSDK70.lib Debug builds DLL copied to .\build\bin\LandXMLSDK70D.dll LIB copied to .\build\bin\LandXMLSDK70D.lib *** Microsoft Developer Studio .NET 2003 *** LandXMLSDK70.sln LandXMLSDK70.vcproj output: .\LandXmlSdkDll71___Win32_Release, .\LandXmlSdkDll71___Win32_Debug Release builds DLL copied to .\build\bin\LandXMLSDK71.dll LIB copied to .\build\bin\LandXMLSDK71.lib Debug builds DLL copied to .\build\bin\LandXMLSDK71D.dll LIB copied to .\build\bin\LandXMLSDK71D.lib The full source code is provided you are welcome to port the SDK to any development environment or operating system you like. _______________________________________________________________________________________________ Change notes for LandXML beta build 1, September 7, 2003 First many thanks to Dave Peterson, Martin Daly and Jeff Bramlett for their contributions to improving the SDK. Fixed most memory leaks from new allocations that were reused without being freed. Fixed incorrect msxml SAX parser invocation. Now msxml 4 is prefered and if not found msxml 3 is used. Fixed LXBowser app to unload current LandXML file and clear tree before loading another. Changed spriral radiusStart and RadiusEnd parsing to support "INF" radius values. This applies to all double values in the SDK. The value returned by the parser is equal to DBL_MAX. Setting any double precision value to DBL_MAX will produce "INF" in the LandXML file. Added a new build target and project files for Microsoft Developer Studio .NET 2003. The project file is called LandXMLSDK70.sln and LandXMLSDK70.vcproj. Fixed COM initialization code that was not calling CoUnintialize(). <biztalk> headers are now ignored and parsed properly. Carraige returns in coordinate values may now parse properly <CgPoint name="foo"> 1.0 2.0 3.0 </CgPoint> The remove() function of NamedObjMap and NamedObjMultMap to move the iterator past the removed element, but forgot ObjList. The LXBrowser doing a "generate document" throws an exception. CLXBrowserApp::OnFileGeneratefile() uses pPt = pFactory->createP(); pPt->reserve(3); // Reserve 3 coordinates. (*pPt)[0] = (i * 10.0); // Set Northing. (*pPt)[1] = (j * 10.0); // Set Easting. (*pPt)[2] = 0.0; // Set Elevation. while "reserve" allocates space, it doesn't create any items to assign to. To allow assignment to [0], [1], and [2], privateinclude/IndexedListValueCollectionTmpl.inl (line 215) changed to: template <class T, class BaseT, class TObject> T& IndexedListValueCollectionTmpl<T, BaseT, TObject>::operator[] ( const int i) { if( i >= (int) m_arrValues.size() ) // if will be assigning to a new entry, m_arrValues.resize(i+1); // make space for it return m_arrValues.at(i); } When compiling the MXBrowser using the release LandXMLSDK70.lib (and .dll), doing a "generate document" throws an exception from free. LXBrowser.cpp, line 235, uses: LX::Project* pProject = pFactory->createProject(); pProject->setName(L"Test Project"); The output .xml file generated by toXml is one long line. This makes viewing tough as well as diff programs trying to compare input .xml file to output .xml file. In publicinclude/IStream.h I added: // Start an element: left brack at the start of a new line. #define ELEM_START L"\n<" and in xs_privateinclude I replaced L"<" with ELEM_START in most (178) of the .inl files So LandXMLTmpl.inl has: template <class T> void LandXMLTmpl<T>::toXml (IStream& stream) { static const wchar_t* kstrElementName = L"LandXML"; stream.write(ELEM_START); stream.write(kstrElementName); stream.write(L" xmlns=\"http://www.landxml.org/schema/LandXML-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.landxml.org/schema/LandXML-1.0 http://www.landxml.org/schema/LandXML-1.0/LandXML-1.0.xsd\""); if (m_bDate_valueSet) . . . The number of digits (6) for double values changed to 8. In privateinclude\ValueTypeObjectsTmpl.inl : // Number of digits after the . for real numbers. #define F_FORMAT L"%.8f" template<class T> String DoubleObjectTmpl<T>::toString() const { wchar_t strValue[100]; swprintf(strValue, F_FORMAT, m_dValue); // convert number wchar_t* p = strValue; while( *p != 0 ) p++; // find end while( *--p == L'0' ) *p = 0; // remove trailing zeros return String(strValue); } Same change to ::streamOut (only last line is different) Strings, chars between " ", may contain "<" and ">" if escaped using "<" and ">". These read in fine, but are not written out escaped (causing the output file to be invalid XML). In privateinclude\ValueTypeObjectsTmpl.inl: template<class T> void StringObjectTmpl<T>::streamOut ( const String& strValue, IStream& stream) { #define MAXCHS 95 wchar_t str2[ MAXCHS+5 ]; const wchar_t* c; int i = -1; for( c = strValue.c_str(); *c != 0; ++c ) { if( *c == L'<' ) { // escape XML reserved chars str2[ ++i ] = L'&'; str2[ ++i ] = L'l'; str2[ ++i ] = L't'; str2[ ++i ] = L';'; } else if( *c == L'>' ) { str2[ ++i ] = L'&'; str2[ ++i ] = L'g'; str2[ ++i ] = L't'; str2[ ++i ] = L';'; } else if( *c == L'&' ) { str2[ ++i ] = L'&'; str2[ ++i ] = L'a'; str2[ ++i ] = L'm'; str2[ ++i ] = L'p'; str2[ ++i ] = L';'; } else str2[ ++i ] = *c; if( i >= MAXCHS ) { str2[ ++i ] = 0; stream.write( str2 ); i = -1; } } if( i >= 0 ) { str2[ ++i ] = 0; stream.write( str2 ); } }
Be the first person to add a text review.
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use
Thanks for your rating!
Would you also like to write a review?