[Liblas-devel] .net/mono bindings in c#
Martin Rodriguez
mrodriguez at stereocarto.com
Thu Aug 7 05:23:31 EDT 2008
Hi:
>Fixed http://liblas.org/ticket/64
Thank you so much, but I find more bugs not only that:
LASHeader_GetCreationDOY ->LASHeader_SetCreationDOY
LASHeader_GetCreationYear->LASHeader_SetCreationYear
LASHeader_GetDataFormatId-> LASHeader_SetDataFormatId
LASHeader_SetScale ????? Why not 3 setters like the 3 getters???
LASHeader_SetOffset????? Why not 3 setters like the 3 getters???
LASHeader_SetMax????? Why not 3 setters like the 3 getters???
LASHeader_SetMin????? Why not 3 setters like the 3 getters???
In respect to macros:
Line -> file -> code
59 \include\liblas\capi\las_config.h #if defined(_MSC_VER) &&
!defined(LAS_DISABLE_DLL)
87 \include\liblas\capi\las_config.h #ifdef _MSC_VER
92 \include\liblas\capi\las_config.h #if defined (_MSC_VER)
259 \include\liblas\detail\utility.hpp #ifdef _MSC_VER
398 \include\liblas\detail\utility.hpp #ifdef _MSC_VER
99 \src\las_c_api.cpp #ifdef _MSC_VER
1508 \src\las_c_api.cpp #ifdef _MSC_VER
161 \include\liblas\cstdint.hpp # elif defined(_MSC_VER)
In this last we have the most complicated solution because of the type
definition. Here the visual C type are not the same like mingw. Here mingw
use the sames types like GCC or cywin.
I think the best is take a look to GLIB or Qt types (steal a little of
code). They are really expert in multiplatform software. It´s almost the
same like liblas types but I think a little more complete in compilers,
architectures and operating systems.
http://library.gnome.org/devel/glib/stable/glib-Basic-Types.html
http://library.gnome.org/devel/glib/stable/glib-Byte-Order-Macros.html
http://library.gnome.org/devel/gio/unstable/GDataOutputStream.html
http://doc.trolltech.com/4.4/qdatastream.html
GIO+CAIRO+GDK+PANGO+GLIB+GTK+GTKGLEXT+GOBJECT+ATK+CLUTTER...=Qt
Behind GTK there real experts in computers:
http://foundation.gnome.org/
In the glib source code there a interesting module gtypes.h. They have there
many interesting stuffs (LGPL source code).
http://ftp.gnome.org/pub/gnome/sources/glib/2.16/
Qt source code is nice I think. They sell privative software for the visual
studio c++ and GPL (free beer version) it´s for mingw:
http://trolltech.com/developer/downloads/qt/windows
The most stable types I think are:
GLIB-> Qt -> c#
gpointer-> void *-> IntPr
gchar-> char * -> string (isos or UTF-8)
gint8-> qint8 -> sbyte
guint8-> quint8 -> byte
gint16-> qint16 -> int16
guint16-> quint16 -> uint16
gint32-> qint32 -> int32
guint32-> quint32 -> uint32
gint64-> qint64 -> Int64
gfloat-> float -> float
gdouble-> double -> double
>If you are interested in including this work as part of libLAS, I can
>provide you with a svn login to allow you to commit it to the source
>repository. It is a little late in our release process, but we can
>hold up the release to include this, as it doesn't directly affect the
>base library and I think others would find it very useful.
Yes. I think it´s the best. Thank you.
Modules:
- Reader
- Writer
- LASPoints
- LAS Header
- Exception class
- Iterator class
- c->C# API
TODO:
- I need manage the .NET exceptions.
- I need Implement the iterator interface.
Here my hello world in .NET:
using System;
using System.Text;
using MonoLAS;
class Program
{
static void Main(string[] args)
{
LASReader lasreader = new LASReader(@"F:\sample.las");
LASPoint laspoint;
LASHeader lasheader = lasreader.GetHeader();
LASWriter laswriter = new LASWriter(@"F:\sample_our.las", lasheader,
LASReadWriteMode.LASModeWrite);
Console.WriteLine("Number of point in file= {0}",
lasheader.PointRecordsCount);
while (lasreader.GetNextPoint())
{
laspoint = lasreader.GetPoint();
//Console.WriteLine(laspoint.X + "," + laspoint.Y + "," +
laspoint.Z);
//laspoint.X=laspoint.X+23.2;
laswriter.WritePoint(laspoint);
}
Console.WriteLine("END");
Console.Read(); }
}
Regards.
More information about the Liblas-devel
mailing list