Getting S52 rendering to work

View: New views
3 Messages — Rating Filter:   Alert me  

Getting S52 rendering to work

by Joel Bjurström :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I guess this one's for Sylvain.
I'm starting a new topic here, to avoid going too far offtopic with my previous OGR issues.
In the other thread, I attached the diff with the changes I had to make to be able to compile
libS52. It still crashed when invoked by openev-testmain though. Now I've been playing a bit
more with these things, and I've finally got testmain to draw *something* using libS52! :)
I'm attaching my first patch (compile problems) for the record, as well as the one with the
stuff that got something drawn on my screen. My openev-testmain output log is there as well.

I'll try to explain what (I think) I did in this latest patch... :)
First, I added a call to _addCell() in S52_loadLayer(). This solved the problem with _cellList
that I mentioned before. I'm calling _addCell() with a hardcoded path to a S57 file, that of course
needs to be done differently.

Then I added S52_USE_GV to the s52gv2 CFLAGS (it was present in s52gv cflags, but not -gv2).
Then, when I ran testmain, I got:

S57gv.c:154: S57_gvLoadObject(): FIXME: wkbMultiLineString found ???                    
**                                                                                      
ERROR:S57gv.c:155:S57_gvLoadObject: code should not be reached                          
Aborted

I removed the call to g_assert_not_reached() in S57gv.c which caused the abort.

Things still didn't work out, and I found out that I had to somehow call S52_setView() before
S52_draw(). To do this, I borrowed some code from tests/s52gtk2.c to create S52_draw_pre().
I had this function replace S52_draw() in the event callback from where it was called.
S52_draw_pre() calls S52_setView(), and then S52_draw().
Don't ask me how I came to this "solution", it's too late and I can't remember. But now it worked!
Well, at least it was drawing something resembling a S52 chart. :)

I'm grateful for hints on how to improve my quick&dirty hacks. I'm still getting a lot of errors and
warnings as you can see in the log, and I still can't scroll, pan, zoom etc. in testmain.
I haven't tried using the plugin with OpenEV2 itself either. I figured I'd get it to work with
testmain first...

Thanks, and good night! ;)

--
// Joel Bjurström
maxxflow@...
http://maxxflow.com

[S52-fixes-buildproblems-2009-05-27-maxxflow.diff]

diff -aur S52-orig/Makefile S52/Makefile
--- S52-orig/Makefile 2009-05-20 22:09:42.000000000 +0200
+++ S52/Makefile 2009-05-27 21:08:11.000000000 +0200
@@ -27,7 +27,15 @@
 DBG3 = -O0 -g3 -Wall -DDEBUG
 DBG  = $(DBG3)
 
-CC   = gcc -std=c99 -fPIC
+CC   = gcc -std=c99 -fPIC \
+  -I../openev2/src/lib/gv \
+  -I/usr/include/gtk-2.0 \
+  -I/usr/include/cairo \
+  -I/usr/include/atk-1.0 \
+  -I/usr/include/pango-1.0 \
+  -I/usr/include/gtkglext-1.0 \
+  -I/usr/lib/gtk-2.0/include \
+  -I/usr/lib/gtkglext-1.0/include
 
 # win32: check this
 s52win32 : MINGW = /usr/bin/i586-mingw32msvc-
@@ -42,7 +50,7 @@
 OBJS_GV  = gvS57layer.o S57gv.o
 
 OPENEV_HOME  = `pwd -P`/../../openev
-OPENEV2_HOME = `pwd -P`/../../../openev2/trunk/src/lib/gv
+OPENEV2_HOME = `pwd -P`/../openev2/src/lib/gv
 
 # NOTE: -malign-double: for 32bits system --useless on 64its
 
diff -aur S52-orig/S52.c S52/S52.c
--- S52-orig/S52.c 2009-05-20 22:09:43.000000000 +0200
+++ S52/S52.c 2009-05-27 21:49:17.000000000 +0200
@@ -43,6 +43,28 @@
 
 #define MIN_RANGE 0.01  // minimum range (NM)
 
+char *S52_MARparamName[]  = {
+    "S52_MAR_NONE",             //= 0,    // default
+    "S52_MAR_SHOW_TEXT",        //= 1,    // view group 23
+    "S52_MAR_TWO_SHADES",       //= 2,    // flag indicating selection of two depth shades (on/off) [default ON]
+    "S52_MAR_SAFETY_CONTOUR",   //= 3,    // selected safety contour (meters) [IMO PS 3.6]
+    "S52_MAR_SAFETY_DEPTH",     //= 4,    // selected safety depth (meters) [IMO PS 3.7]
+    "S52_MAR_SHALLOW_CONTOUR",  //= 5,    // selected shallow water contour (meters) (optional)
+    "S52_MAR_DEEP_CONTOUR",     //= 6,    // selected deepwatercontour (meters) (optional)
+    "S52_MAR_SHALLOW_PATTERN",  //= 7,    // flag indicating selection of shallow water highlight (on/off)(optional) [default OFF]
+    "S52_MAR_SHIPS_OUTLINE",    //= 8,    // flag indicating selection of ship scale symbol (on/off) [IMO PS 8.4]
+    "S52_MAR_DISTANCE_TAGS",    //= 9,    // selected spacing of "distance to run" tags at a route (nm)
+    "S52_MAR_TIME_TAGS",        //= 10,   // selected spacing of time tags at the pasttrack (min)
+    "S52_MAR_FULL_SECTORS",     //= 11,   // show full length light sector lines
+    "S52_MAR_SYMBOLIZED_BND",   //= 12,   // symbolized area boundaries
+    "S52_MAR_SYMPLIFIED_PNT",   //= 13,   // simplified point
+    "S52_MAR_DISP_CATEGORY",    //= 14,   // display category
+    "S52_MAR_COLOR_PALETTE",    //= 15,   // color palette
+
+    "S52_MAR_NUM"               //= 16    // number of parameters
+//...123456789012345678901234567890       // name lenght max 23
+};
+
 typedef struct _cell {
     S52_extent ext;
     GString   *filename;
diff -aur S52-orig/S52.h S52/S52.h
--- S52-orig/S52.h 2009-05-20 22:09:43.000000000 +0200
+++ S52/S52.h 2009-05-27 21:48:17.000000000 +0200
@@ -39,6 +39,8 @@
 #define STD
 #endif
 
+extern char *S52_MARparamName[];
+/*
 char *S52_MARparamName[]  = {
     "S52_MAR_NONE",             //= 0,    // default
     "S52_MAR_SHOW_TEXT",        //= 1,    // view group 23
@@ -60,6 +62,7 @@
     "S52_MAR_NUM"               //= 16    // number of parameters
 //...123456789012345678901234567890       // name lenght max 23
 };
+*/
 #define S52_MAR_NAME_MAX        23
 
 //extern DLL double STD S52_getMarinerParam(S52_MAR_param_t param);
diff -aur S52-orig/S57gv.c S52/S57gv.c
--- S52-orig/S57gv.c 2009-05-20 22:09:43.000000000 +0200
+++ S52/S57gv.c 2009-05-27 20:26:39.000000000 +0200
@@ -147,7 +147,7 @@
         case GVSHAPE_COLLECTION: {
             // ogr SPLIT_MULTIPOINT prob !!
             //GvCollectionShape *collection  = (GvCollectionShape *) shape;
-            //int nCollection = gv_shape_collection_get_count(shape);
+            int nCollection = gv_shape_collection_get_count(shape);
 
             PRINTF("nCollection = %i\n", nCollection);
 
diff -aur S52-orig/test/Makefile S52/test/Makefile
--- S52-orig/test/Makefile 2009-04-29 17:43:02.000000000 +0200
+++ S52/test/Makefile 2009-05-27 21:12:57.000000000 +0200
@@ -34,14 +34,14 @@
 
 s52gv2: CFLAGS = `pkg-config --cflags gtk+-2.0 gtkglext-1.0`       \
                  -D_REENTRANT  -DGV_USE_DOUBLE_PRECISION_COORD     \
-                 -I$(OPENEV_HOME) -I..  -DS52_USE_GV -DS52_USE_GTK2
+                 -I$(OPENEV2HOME) -I..  -DS52_USE_GV -DS52_USE_GTK2
 
 # search for libS52.so (-rpath)
 S52_LIBS  = -Wl,-rpath .. -L.. -lS52
 
 # NOTE: need full path in order to find libgv.so at run-time (-rpath)
 OPENEV_HOME = `pwd -P`/../../../openev
-OPENEV2HOME = `pwd -P`/../../../../openev2/trunk/src/lib/gv
+OPENEV2HOME = `pwd -P`/../../openev2/src/lib/gv
 GV_LIBS     = -Wl,-rpath $(OPENEV_HOME) -L$(OPENEV_HOME) -lgv
 GV2LIBS     = -Wl,-rpath $(OPENEV2HOME) -L$(OPENEV2HOME) -lgv
 
@@ -64,10 +64,11 @@
  $(CC) $(CFLAGS) s52gv.c $(LIBS) -o $@
 
 s52gv2: LIBS = $(S52_LIBS) $(GTK2LIBS) $(GV2LIBS) $(OGR_LIBS)
-s52gv2: s52gv.c testmain
+#s52gv2: s52gv.c testmain
+s52gv2: s52gv.c
  $(CC) $(CFLAGS) s52gv.c $(LIBS) -o $@
-testmain:
- $(CC) $(LDFLAGS) testmain.o $(LIBS)  -o $@
+#testmain:
+# $(CC) $(LDFLAGS) testmain.o $(LIBS)  -o $@
 
 s52gtk2: LIBS = $(S52_LIBS) $(GTK2LIBS) $(OGR_LIBS) $(GL__LIBS)
 s52gtk2: s52gtk2.c


[S52-fixes-finallydrawingsomething-2009-06-07-maxxflow.diff]

diff -aur S52-orig/gvS57layer.c S52/gvS57layer.c
--- S52-orig/gvS57layer.c 2009-02-23 17:24:12.000000000 +0100
+++ S52/gvS57layer.c 2009-06-07 17:28:54.000000000 +0200
@@ -55,7 +55,7 @@
 
 #ifdef S52_USE_GTK2
     g_signal_connect(G_OBJECT(view), "gldraw",
-                     G_CALLBACK(S52_draw),
+                     G_CALLBACK(S52_draw_pre),
                      G_OBJECT(view));
 
     g_signal_connect(G_OBJECT(view), "button-release-event",
diff -aur S52-orig/Makefile S52/Makefile
--- S52-orig/Makefile 2009-06-07 17:44:04.000000000 +0200
+++ S52/Makefile 2009-06-07 10:53:55.000000000 +0200
@@ -73,6 +73,8 @@
   -DGV_USE_DOUBLE_PRECISION_COORD \
   `gtk-config --cflags` -I$(OPENEV_HOME)
 
+s52gv2 : CFLAGS += -DS52_USE_GV
+
 LIBS   = `pkg-config  --libs glib-2.0 lcms`     \
          `gdal-config --libs`                   \
           -lGL -lGLU
diff -aur S52-orig/S52.c S52/S52.c
--- S52-orig/S52.c 2009-06-07 17:44:04.000000000 +0200
+++ S52/S52.c 2009-06-07 17:36:57.000000000 +0200
@@ -465,6 +465,7 @@
 
 DLL int     STD S52_loadLayer(const char *layername, void *layer)
 {
+    _addCell("/home/maxxflow/OpenEV2/data/S57_uschart/US5TX51M.000");
 
     if ( (NULL==layername) || (NULL==layer) || (NULL==_cellList)) {
         PRINTF("ERROR: layername / ogrlayer / _cellList --> NULL\n");
@@ -765,6 +766,21 @@
 
     return TRUE;
 }
+DLL int     STD S52_draw_pre()
+{
+    S52_extent ext;
+    S52_view _view;
+
+    if (FALSE == S52_getCellExtent(NULL, &ext))
+        return FALSE;
+
+    _view.cLat = ext.s + (ext.n - ext.s) / 2.0;
+    _view.cLon = ext.w + (ext.e - ext.w) / 2.0;
+    _view.rNM  = 1.0;
+
+ S52_setView(&_view);
+ S52_draw();
+}
 
 DLL int     STD S52_draw()
 {
diff -aur S52-orig/S52GL.c S52/S52GL.c
--- S52-orig/S52GL.c 2009-05-20 22:09:43.000000000 +0200
+++ S52/S52GL.c 2009-06-07 17:51:09.000000000 +0200
@@ -1070,7 +1071,7 @@
 
 
     // extent overlap --need clip
-    PRINTF("Clipping: %s to %f,%f -- %f,%f\n", S57_getName(geoData), pmin.u, pmin.v, pmax.u, pmax.v);
+    //PRINTF("Clipping: %s to %f,%f -- %f,%f\n", S57_getName(geoData), pmin.u, pmin.v, pmax.u, pmax.v);
 
     // CSG
     {   int i;
diff -aur S52-orig/S52.h S52/S52.h
--- S52-orig/S52.h 2009-06-07 17:44:04.000000000 +0200
+++ S52/S52.h 2009-06-07 17:29:08.000000000 +0200
@@ -73,6 +73,7 @@
 
 //-----need an GL context-----------------------
 extern DLL int    STD S52_init();
+extern DLL int    STD S52_draw_pre();
 extern DLL int    STD S52_draw();
 extern DLL int    STD S52_doPick(double x, double y);
 // set display list for a font
diff -aur S52-orig/S57gv.c S52/S57gv.c
--- S52-orig/S57gv.c 2009-06-07 17:44:04.000000000 +0200
+++ S52/S57gv.c 2009-06-07 10:53:55.000000000 +0200
@@ -152,7 +152,7 @@
             PRINTF("nCollection = %i\n", nCollection);
 
             PRINTF("FIXME: wkbMultiLineString found ???\n");
-            g_assert_not_reached(); // MultiLineString (need this for line removal)
+            //g_assert_not_reached(); // MultiLineString (need this for line removal)
 
             geoData = S57_set_META();
 



------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Openev-discuss mailing list
Openev-discuss@...
https://lists.sourceforge.net/lists/listinfo/openev-discuss

testmain.log (44K) Download Attachment

Re: Getting S52 rendering to work

by Joel Bjurström :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alright...

First, I forgot one patch. This one adds GDK_GL_MODE_STENCIL to glconfig in src/lib/gv/gvviewarea.c
libS52 was complaining about a missing stencil buffer or something, so I looked at s52gtk2.c and found
this solution.

Then I just realized there was a new commit to the S52 cvs last week. The current cvs code (with my patches
applied) doesn't get built for me:

../libS52.so: undefined reference to `S52_doPick'
collect2: ld returned 1 exit status

I'll have a look at that tomorrow, now's time sleep...

--
// Joel Bjurström
maxxflow@...
http://maxxflow.com


On Mon, Jun 8, 2009 at 1:00 AM, Joel Bjurström <maxxflow@...> wrote:
Hi!

I guess this one's for Sylvain.
I'm starting a new topic here, to avoid going too far offtopic with my previous OGR issues.
In the other thread, I attached the diff with the changes I had to make to be able to compile
libS52. It still crashed when invoked by openev-testmain though. Now I've been playing a bit
more with these things, and I've finally got testmain to draw *something* using libS52! :)
I'm attaching my first patch (compile problems) for the record, as well as the one with the
stuff that got something drawn on my screen. My openev-testmain output log is there as well.

I'll try to explain what (I think) I did in this latest patch... :)
First, I added a call to _addCell() in S52_loadLayer(). This solved the problem with _cellList
that I mentioned before. I'm calling _addCell() with a hardcoded path to a S57 file, that of course
needs to be done differently.

Then I added S52_USE_GV to the s52gv2 CFLAGS (it was present in s52gv cflags, but not -gv2).
Then, when I ran testmain, I got:

S57gv.c:154: S57_gvLoadObject(): FIXME: wkbMultiLineString found ???                    
**                                                                                      
ERROR:S57gv.c:155:S57_gvLoadObject: code should not be reached                          
Aborted

I removed the call to g_assert_not_reached() in S57gv.c which caused the abort.

Things still didn't work out, and I found out that I had to somehow call S52_setView() before
S52_draw(). To do this, I borrowed some code from tests/s52gtk2.c to create S52_draw_pre().
I had this function replace S52_draw() in the event callback from where it was called.
S52_draw_pre() calls S52_setView(), and then S52_draw().
Don't ask me how I came to this "solution", it's too late and I can't remember. But now it worked!
Well, at least it was drawing something resembling a S52 chart. :)

I'm grateful for hints on how to improve my quick&dirty hacks. I'm still getting a lot of errors and
warnings as you can see in the log, and I still can't scroll, pan, zoom etc. in testmain.
I haven't tried using the plugin with OpenEV2 itself either. I figured I'd get it to work with
testmain first...

Thanks, and good night! ;)

--
// Joel Bjurström
maxxflow@...
http://maxxflow.com


[openev2-fixes-glconfig-2009-06-06-maxxflow.diff]

Only in openev2-old: build
diff -aur openev2/src/cc/testmain/testmain.c openev2-old/src/cc/testmain/testmain.c
--- openev2/src/cc/testmain/testmain.c 2007-01-03 22:39:56.000000000 +0100
+++ openev2-old/src/cc/testmain/testmain.c 2009-06-06 18:50:14.000000000 +0200
@@ -140,7 +140,7 @@
 
     if( raster != NULL )
     {
-        GtkObject *raster_layer;
+        GObject *raster_layer;
         raster_layer = gv_raster_layer_new(GV_RLM_AUTO, raster, NULL);
 
         gv_view_area_add_layer(GV_VIEW_AREA(view),
@@ -343,7 +343,7 @@
 {
     GvData     *raw_data;
     GvShapes   *shape_data;
-    GtkObject  *layer;
+    GObject  *layer;
 
     int index = 0;
 
diff -aur openev2/src/lib/gv/gvviewarea.c openev2-old/src/lib/gv/gvviewarea.c
--- openev2/src/lib/gv/gvviewarea.c 2009-01-05 04:42:57.000000000 +0100
+++ openev2-old/src/lib/gv/gvviewarea.c 2009-06-06 23:45:32.000000000 +0200
@@ -368,9 +368,15 @@
 static void
 gv_view_area_init(GvViewArea *view)
 {
-    GdkGLConfig *glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB |
+/*    GdkGLConfig *glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB |
                                             GDK_GL_MODE_DEPTH |
-                                            GDK_GL_MODE_DOUBLE);
+                                            GDK_GL_MODE_DOUBLE);*/
+
+    GdkGLConfig *glconfig = gdk_gl_config_new_by_mode ( GDK_GL_MODE_RGBA
+                                                      | GDK_GL_MODE_DEPTH
+                                                      | GDK_GL_MODE_STENCIL
+                                                      | GDK_GL_MODE_DOUBLE
+                                                      );
 
     /* ---- Enable GL capability ---- */
     gtk_widget_set_gl_capability (GTK_WIDGET(view), glconfig,


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Openev-discuss mailing list
Openev-discuss@...
https://lists.sourceforge.net/lists/listinfo/openev-discuss

Re: Getting S52 rendering to work

by Joel Bjurström :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again!

I was a bit tired yesterday, couldn't even write properly. Sorry 'bout that. :)
I saw that S52_doPick() was removed from S52.c in the latest cvs code,
but it was still referenced from gvS57layer.c, so I removed this reference,
and got it working again.
The diffs I'm attaching now contain everything I need to change in the latest
S52 cvs code to be able to build s52gv2 and use it with openev-testmain.
I'm also applying the gv/glconfig diff from my previous mail.
Testmain draws my chart and it looks just fine, though I can't pan, zoom etc.
No error messages when trying. I *can*, however, resize the testmain window
to view more of the chart.

Has this GV mode been working for you, Sylvain? Is it just me that's the problem? :)

Please tell me if I'm bothering you with all those different patches, and excuse me
if I'm a bit confused. This is all new to me, as you know, but I'm learning a lot! :)

Cheers!
--
// Joel Bjurström
maxxflow@...
http://maxxflow.com


On Mon, Jun 8, 2009 at 1:35 AM, Joel Bjurström <maxxflow@...> wrote:
Alright...

First, I forgot one patch. This one adds GDK_GL_MODE_STENCIL to glconfig in src/lib/gv/gvviewarea.c
libS52 was complaining about a missing stencil buffer or something, so I looked at s52gtk2.c and found
this solution.

Then I just realized there was a new commit to the S52 cvs last week. The current cvs code (with my patches
applied) doesn't get built for me:

../libS52.so: undefined reference to `S52_doPick'
collect2: ld returned 1 exit status

I'll have a look at that tomorrow, now's time sleep...


--
// Joel Bjurström
maxxflow@...
http://maxxflow.com


On Mon, Jun 8, 2009 at 1:00 AM, Joel Bjurström <maxxflow@...> wrote:
Hi!

I guess this one's for Sylvain.
I'm starting a new topic here, to avoid going too far offtopic with my previous OGR issues.
In the other thread, I attached the diff with the changes I had to make to be able to compile
libS52. It still crashed when invoked by openev-testmain though. Now I've been playing a bit
more with these things, and I've finally got testmain to draw *something* using libS52! :)
I'm attaching my first patch (compile problems) for the record, as well as the one with the
stuff that got something drawn on my screen. My openev-testmain output log is there as well.

I'll try to explain what (I think) I did in this latest patch... :)
First, I added a call to _addCell() in S52_loadLayer(). This solved the problem with _cellList
that I mentioned before. I'm calling _addCell() with a hardcoded path to a S57 file, that of course
needs to be done differently.

Then I added S52_USE_GV to the s52gv2 CFLAGS (it was present in s52gv cflags, but not -gv2).
Then, when I ran testmain, I got:

S57gv.c:154: S57_gvLoadObject(): FIXME: wkbMultiLineString found ???                    
**                                                                                      
ERROR:S57gv.c:155:S57_gvLoadObject: code should not be reached                          
Aborted

I removed the call to g_assert_not_reached() in S57gv.c which caused the abort.

Things still didn't work out, and I found out that I had to somehow call S52_setView() before
S52_draw(). To do this, I borrowed some code from tests/s52gtk2.c to create S52_draw_pre().
I had this function replace S52_draw() in the event callback from where it was called.
S52_draw_pre() calls S52_setView(), and then S52_draw().
Don't ask me how I came to this "solution", it's too late and I can't remember. But now it worked!
Well, at least it was drawing something resembling a S52 chart. :)

I'm grateful for hints on how to improve my quick&dirty hacks. I'm still getting a lot of errors and
warnings as you can see in the log, and I still can't scroll, pan, zoom etc. in testmain.
I haven't tried using the plugin with OpenEV2 itself either. I figured I'd get it to work with
testmain first...

Thanks, and good night! ;)

--
// Joel Bjurström
maxxflow@...
http://maxxflow.com



[S52-buildproblems-2009-06-08-maxxflow.diff]

diff -aur S52-orig/gvS57layer.c S52/gvS57layer.c
--- S52-orig/gvS57layer.c 2009-06-08 01:20:24.000000000 +0200
+++ S52/gvS57layer.c 2009-06-08 15:57:39.000000000 +0200
@@ -38,12 +38,12 @@
 
 static GModule *self = NULL;  // handel to libS52.so (this)
 
-static void _motion_handle_hint(GtkWidget *view, GdkEventMotion *event)
+/*static void _motion_handle_hint(GtkWidget *view, GdkEventMotion *event)
 {
     if (event->type==GDK_BUTTON_RELEASE && event->state & GDK_SHIFT_MASK) {
         S52_doPick(event->x, event->y);
     }
-}
+}*/
 
 static void gv_S57_layer_setup(GvShapesLayer *layer, GvViewArea *view)
 // load S57 --its in "wkt" OGC layer format
@@ -58,17 +58,17 @@
                      G_CALLBACK(S52_draw),
                      G_OBJECT(view));
 
-    g_signal_connect(G_OBJECT(view), "button-release-event",
+/*    g_signal_connect(G_OBJECT(view), "button-release-event",
                      G_CALLBACK(_motion_handle_hint),
-                     G_OBJECT(view));
+                     G_OBJECT(view));*/
 #else
     gtk_signal_connect_object(GTK_OBJECT(view), "gldraw",
                               GTK_SIGNAL_FUNC(S52_draw),
                               GTK_OBJECT(view));
 
-    gtk_signal_connect_object(GTK_OBJECT(view), "button-release-event",
+/*    gtk_signal_connect_object(GTK_OBJECT(view), "button-release-event",
                               GTK_SIGNAL_FUNC(_motion_handle_hint),
-                              GTK_OBJECT(view));
+                              GTK_OBJECT(view));*/
 #endif
 
 
diff -aur S52-orig/Makefile S52/Makefile
--- S52-orig/Makefile 2009-06-08 01:20:24.000000000 +0200
+++ S52/Makefile 2009-06-08 15:59:19.000000000 +0200
@@ -27,7 +27,10 @@
 DBG3 = -O0 -g3 -Wall -DDEBUG
 DBG  = $(DBG3)
 
-CC   = gcc -std=c99 -fPIC
+CC   = gcc -std=c99 -fPIC \
+  -I$(OPENEV2_HOME) \
+  `pkg-config --cflags gtk+-2.0` \
+  `pkg-config --cflags gtkglext-1.0`
 
 # win32: check this
 s52win32 : MINGW = /usr/bin/i586-mingw32msvc-
@@ -42,7 +45,7 @@
 OBJS_GV  = gvS57layer.o S57gv.o
 
 OPENEV_HOME  = `pwd -P`/../../openev
-OPENEV2_HOME = `pwd -P`/../../../openev2/trunk/src/lib/gv
+OPENEV2_HOME = `pwd -P`/../openev2/src/lib/gv
 
 # NOTE: -malign-double: for 32bits system --useless on 64its
 
diff -aur S52-orig/S52.c S52/S52.c
--- S52-orig/S52.c 2009-06-08 01:20:24.000000000 +0200
+++ S52/S52.c 2009-06-08 15:58:43.000000000 +0200
@@ -47,6 +47,28 @@
 #define ZOOM_FAC   0.1
 #define ZOOM_INI   1.0
 
+char *S52_MARparamName[]  = {
+    "S52_MAR_NONE",             //= 0,    // default
+    "S52_MAR_SHOW_TEXT",        //= 1,    // view group 23
+    "S52_MAR_TWO_SHADES",       //= 2,    // flag indicating selection of two depth shades (on/off) [default ON]
+    "S52_MAR_SAFETY_CONTOUR",   //= 3,    // selected safety contour (meters) [IMO PS 3.6]
+    "S52_MAR_SAFETY_DEPTH",     //= 4,    // selected safety depth (meters) [IMO PS 3.7]
+    "S52_MAR_SHALLOW_CONTOUR",  //= 5,    // selected shallow water contour (meters) (optional)
+    "S52_MAR_DEEP_CONTOUR",     //= 6,    // selected deepwatercontour (meters) (optional)
+    "S52_MAR_SHALLOW_PATTERN",  //= 7,    // flag indicating selection of shallow water highlight (on/off)(optional) [default OFF]
+    "S52_MAR_SHIPS_OUTLINE",    //= 8,    // flag indicating selection of ship scale symbol (on/off) [IMO PS 8.4]
+    "S52_MAR_DISTANCE_TAGS",    //= 9,    // selected spacing of "distance to run" tags at a route (nm)
+    "S52_MAR_TIME_TAGS",        //= 10,   // selected spacing of time tags at the pasttrack (min)
+    "S52_MAR_FULL_SECTORS",     //= 11,   // show full length light sector lines
+    "S52_MAR_SYMBOLIZED_BND",   //= 12,   // symbolized area boundaries
+    "S52_MAR_SYMPLIFIED_PNT",   //= 13,   // simplified point
+    "S52_MAR_DISP_CATEGORY",    //= 14,   // display category
+    "S52_MAR_COLOR_PALETTE",    //= 15,   // color palette
+
+    "S52_MAR_NUM"               //= 16    // number of parameters
+//...123456789012345678901234567890       // name lenght max 23
+};
+
 typedef struct _cell {
     S52_extent ext;
     GString   *filename;
diff -aur S52-orig/S52.h S52/S52.h
--- S52-orig/S52.h 2009-06-08 01:20:24.000000000 +0200
+++ S52/S52.h 2009-06-08 15:58:43.000000000 +0200
@@ -39,6 +39,8 @@
 #define STD
 #endif
 
+extern char *S52_MARparamName[];
+/*
 char *S52_MARparamName[]  = {
     "S52_MAR_NONE",             // 1  - default
     "S52_MAR_SHOW_TEXT",        // 2  - view group 23
@@ -60,6 +62,7 @@
     "S52_MAR_NUM"               // number of Mariner Parameters 16
 //...12345678901234567890123    // name lenght max 23
 };
+*/
 #define S52_MAR_NAME_MAX        23
 
 extern DLL double STD S52_getMarinerParam(char *paramName);
diff -aur S52-orig/S57gv.c S52/S57gv.c
--- S52-orig/S57gv.c 2009-06-08 01:20:24.000000000 +0200
+++ S52/S57gv.c 2009-06-08 15:58:43.000000000 +0200
@@ -147,7 +147,7 @@
         case GVSHAPE_COLLECTION: {
             // ogr SPLIT_MULTIPOINT prob !!
             //GvCollectionShape *collection  = (GvCollectionShape *) shape;
-            //int nCollection = gv_shape_collection_get_count(shape);
+            int nCollection = gv_shape_collection_get_count(shape);
 
             PRINTF("nCollection = %i\n", nCollection);
 
diff -aur S52-orig/test/Makefile S52/test/Makefile
--- S52-orig/test/Makefile 2009-06-08 01:20:24.000000000 +0200
+++ S52/test/Makefile 2009-06-08 15:58:43.000000000 +0200
@@ -34,14 +34,14 @@
 
 s52gv2: CFLAGS = `pkg-config --cflags gtk+-2.0 gtkglext-1.0`       \
                  -D_REENTRANT  -DGV_USE_DOUBLE_PRECISION_COORD     \
-                 -I$(OPENEV_HOME) -I..  -DS52_USE_GV -DS52_USE_GTK2
+                 -I$(OPENEV2HOME) -I..  -DS52_USE_GV -DS52_USE_GTK2
 
 # search for libS52.so (-rpath)
 S52_LIBS  = -Wl,-rpath .. -L.. -lS52
 
 # NOTE: need full path in order to find libgv.so at run-time (-rpath)
 OPENEV_HOME = `pwd -P`/../../../openev
-OPENEV2HOME = `pwd -P`/../../../../openev2/trunk/src/lib/gv
+OPENEV2HOME = `pwd -P`/../../openev2/src/lib/gv
 GV_LIBS     = -Wl,-rpath $(OPENEV_HOME) -L$(OPENEV_HOME) -lgv
 GV2LIBS     = -Wl,-rpath $(OPENEV2HOME) -L$(OPENEV2HOME) -lgv
 
@@ -64,10 +64,11 @@
  $(CC) $(CFLAGS) s52gv.c $(LIBS) -o $@
 
 s52gv2: LIBS = $(S52_LIBS) $(GTK2LIBS) $(GV2LIBS) $(OGR_LIBS)
-s52gv2: s52gv.c testmain
+#s52gv2: s52gv.c testmain
+s52gv2: s52gv.c
  $(CC) $(CFLAGS) s52gv.c $(LIBS) -o $@
-testmain:
- $(CC) $(LDFLAGS) testmain.o $(LIBS)  -o $@
+#testmain:
+# $(CC) $(LDFLAGS) testmain.o $(LIBS)  -o $@
 
 s52gtk2: LIBS = $(S52_LIBS) $(GTK2LIBS) $(OGR_LIBS) $(GL__LIBS)
 s52gtk2: s52gtk2.c
diff -aur S52-orig/test/s52gv.c S52/test/s52gv.c
--- S52-orig/test/s52gv.c 2009-06-08 01:20:24.000000000 +0200
+++ S52/test/s52gv.c 2009-06-08 16:01:24.000000000 +0200
@@ -216,7 +216,7 @@
     //GvShapesLayer *gvlayer    = (GvShapesLayer *)data;
     GvShapes      *shapes_data = GV_SHAPES(data);
     GvViewArea    *view        = GV_VIEW_AREA(VecView);
-    GtkObject     *layer       = NULL;
+    GObject     *layer       = NULL;
 
     //gv_data_set_property(GV_DATA(shape_data), "_filename",        _filename);
     gv_data_set_property(GV_DATA(shapes_data), "_ogr_driver_name", DRVNAME);


[S52-finallydrawingsomething-2009-06-08-maxxflow.diff]

diff -aur S52-orig/gvS57layer.c S52/gvS57layer.c
--- S52-orig/gvS57layer.c 2009-06-08 16:05:01.000000000 +0200
+++ S52/gvS57layer.c 2009-06-08 16:04:56.000000000 +0200
@@ -55,7 +55,7 @@
 
 #ifdef S52_USE_GTK2
     g_signal_connect(G_OBJECT(view), "gldraw",
-                     G_CALLBACK(S52_draw),
+                     G_CALLBACK(S52_draw_pre),
                      G_OBJECT(view));
 
 /*    g_signal_connect(G_OBJECT(view), "button-release-event",
diff -aur S52-orig/Makefile S52/Makefile
--- S52-orig/Makefile 2009-06-08 16:05:01.000000000 +0200
+++ S52/Makefile 2009-06-08 16:04:56.000000000 +0200
@@ -68,6 +68,8 @@
   -DGV_USE_DOUBLE_PRECISION_COORD \
   `gtk-config --cflags` -I$(OPENEV_HOME)
 
+s52gv2 : CFLAGS += -DS52_USE_GV
+
 LIBS   = `pkg-config  --libs glib-2.0 lcms`     \
          `gdal-config --libs`                   \
           -lGL -lGLU
Only in S52: Makefile.orig
diff -aur S52-orig/S52.c S52/S52.c
--- S52-orig/S52.c 2009-06-08 16:05:01.000000000 +0200
+++ S52/S52.c 2009-06-08 16:04:56.000000000 +0200
@@ -502,6 +502,7 @@
 
 DLL int     STD S52_loadLayer(const char *layername, void *layer)
 {
+    _addCell("/home/maxxflow/OpenEV2/data/S57_uschart/US5TX51M.000");
 
     if ( (NULL==layername) || (NULL==layer) || (NULL==_cellList)) {
         PRINTF("ERROR: layername / ogrlayer / _cellList --> NULL\n");
@@ -790,6 +791,21 @@
 
     return TRUE;
 }
+DLL int     STD S52_draw_pre()
+{
+    S52_extent ext;
+    S52_view _view;
+
+    if (FALSE == S52_getCellExtent(NULL, &ext))
+        return FALSE;
+
+    _view.cLat = ext.s + (ext.n - ext.s) / 2.0;
+    _view.cLon = ext.w + (ext.e - ext.w) / 2.0;
+    _view.rNM  = 1.0;
+
+ S52_setView(&_view);
+ S52_draw();
+}
 
 DLL int     STD S52_draw()
 {
diff -aur S52-orig/S52.h S52/S52.h
--- S52-orig/S52.h 2009-06-08 16:05:01.000000000 +0200
+++ S52/S52.h 2009-06-08 16:04:56.000000000 +0200
@@ -71,6 +71,7 @@
 
 //-----need an GL context-----------------------
 extern DLL int    STD S52_init();
+extern DLL int    STD S52_draw_pre();
 extern DLL int    STD S52_draw();
 
 // mouse
diff -aur S52-orig/S57gv.c S52/S57gv.c
--- S52-orig/S57gv.c 2009-06-08 16:05:01.000000000 +0200
+++ S52/S57gv.c 2009-06-08 16:04:56.000000000 +0200
@@ -152,7 +152,7 @@
             PRINTF("nCollection = %i\n", nCollection);
 
             PRINTF("FIXME: wkbMultiLineString found ???\n");
-            g_assert_not_reached(); // MultiLineString (need this for line removal)
+            //g_assert_not_reached(); // MultiLineString (need this for line removal)
 
             geoData = S57_set_META();
 


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Openev-discuss mailing list
Openev-discuss@...
https://lists.sourceforge.net/lists/listinfo/openev-discuss