
|
Re: Getting S52 rendering to work
Hello guys. It's me again. :) I saw that the S52 CVS has been updated since last time. I still fail to build the s52gv2 target "out of the box" however... (I haven't tried the s52gv target, but that's only for
GTK+1 and the old "stable" openev, right? I'm not interested in such things... ;) I'm attaching the changes I made to the current CVS code to be able to build it and use it with testmain, and actually with openev2 itself as well, for the first time. :D
(Had some free time today :) Before succeeding with that, I also met some resistance from the gv library code, addressed by the second diff I'm attaching. (The other openev2 patches from my previous posts are applied first.)
One of the main problems was that _renderLC() and _renderAP() wasn't working, due to a strange variable value causing an infinite loop in both of the functions, I think it was. As you can see in the diff, I didn't try to dig further into this, just disabled them both
where they are called in S52GL.c. Now I can load S57 charts in openev2 and they are rendered successfully by libS52. But just like in my testmain trials, I can't pan or zoom. But if I resize the window, more of the chart is drawn just like it should. I also found out that if I load only one (or a few)
layers, I can see the S52 layer drawn on top with the regular green-colored layers behind. I can zoom and pan the green layers, but the S52 layer on top stays the same. Am I supposed to have the green layers rendered behind, or is this a bug? And what
can be causing the inability to pan or zoom the S52 layer? (I realized this might be a little offtopic here on the openev list. But I still thought our discussion could be of interest to other people who wants to give S52 rendering
a try. What do you say?)
Regards, / Joel On Mon, Jun 8, 2009 at 4:53 PM, s duclos <sylvain_duclos@...> wrote:
Hi Joel,
Sorry you cough me in the middle of a gtk2 upgrade.
The targets s52glx, s52gtk2 and s52win32 work as is.
The target s52gv need a bit of love as you discovered :)
I'm working to fix the target s52gv and I will update CVS when I'm done.
rgds,
Sylvain.
--- On Mon, 6/8/09, Joel Bjurström <maxxflow@...> wrote:
> From: Joel Bjurström <maxxflow@...>
> Subject: Re: [Openev-discuss] Getting S52 rendering to work
> To: openev-discuss@...
> Received: Monday, June 8, 2009, 6:13 PM
> 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
>
>
>
>
>
>
>
>
>
> -----Inline Attachment Follows-----
>
> ------------------------------------------------------------------------------
> 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
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Openev-discuss mailing list
> Openev-discuss@...
> https://lists.sourceforge.net/lists/listinfo/openev-discuss
>
__________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.
[S52-collective-2009-06-29-maxxflow.diff] diff -aur S52-orig/Makefile S52/Makefile
--- S52-orig/Makefile 2009-06-12 01:37:27.000000000 +0200
+++ S52/Makefile 2009-06-29 22:53:32.000000000 +0200
@@ -43,7 +43,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
@@ -66,6 +66,10 @@
-DGV_USE_DOUBLE_PRECISION_COORD \
`gtk-config --cflags` -I$(OPENEV_HOME)
+s52gv2 : CFLAGS += -I$(OPENEV2_HOME) \
+ `pkg-config --cflags gtk+-2.0 gtkglext-1.0` \
+ -DS52_USE_GV
+
LIBS = `pkg-config --libs glib-2.0 lcms` \
`gdal-config --libs` \
-lGL -lGLU
@@ -79,13 +83,16 @@
`gtk-config --libs` \
-llcms
+s52gv2 : LIBS += -lproj -lgobject-2.0 -lgv
+
#PROJ = -lproj
#s52win32: PROJ = libproj.a
s52glx : libS52.so test/s52glx
s52gv : libS52gv.so test/s52gv
-s52gv2 : libS52gv.so test/s52gv2
+#s52gv2 : libS52gv.so test/s52gv2
+s52gv2 : libS52gv.so
s52gtk2 : libS52.so test/s52gtk2
s52win32: libS52.dll test/s52win32
diff -aur S52-orig/gvS57layer.c S52/gvS57layer.c
--- S52-orig/gvS57layer.c 2009-06-08 18:07:18.000000000 +0200
+++ S52/gvS57layer.c 2009-06-29 22:53:12.000000000 +0200
@@ -28,6 +28,7 @@
extern int S52_init();
extern int S52_draw();
+extern int S52_draw_pre();
extern int S52_loadLayer(const char *layername, void *layer);
extern int S52_pickAt(double x, double y);
extern int S52_done();
@@ -62,7 +63,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",
@@ -70,7 +71,7 @@
G_OBJECT(view));
#else
gtk_signal_connect_object(GTK_OBJECT(view), "gldraw",
- GTK_SIGNAL_FUNC(S52_draw),
+ GTK_SIGNAL_FUNC(S52_draw_pre),
GTK_OBJECT(view));
gtk_signal_connect_object(GTK_OBJECT(view), "button-release-event",
diff -aur S52-orig/S52.c S52/S52.c
--- S52-orig/S52.c 2009-06-16 00:13:30.000000000 +0200
+++ S52/S52.c 2009-06-29 22:53:12.000000000 +0200
@@ -500,6 +500,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);
+ return S52_draw();
+}
DLL int STD S52_draw()
{
if (_doInit) {
diff -aur S52-orig/S52.h S52/S52.h
--- S52-orig/S52.h 2009-06-16 00:13:30.000000000 +0200
+++ S52/S52.h 2009-06-29 22:53:12.000000000 +0200
@@ -73,6 +73,7 @@
extern DLL int STD S52_init();
#endif
+extern DLL int STD S52_draw_pre();
extern DLL int STD S52_draw();
// mouse
diff -aur S52-orig/S52GL.c S52/S52GL.c
--- S52-orig/S52GL.c 2009-06-16 00:13:30.000000000 +0200
+++ S52/S52GL.c 2009-06-29 22:53:13.000000000 +0200
@@ -1802,10 +1802,12 @@
//PRINTF("TX: %f TY: %f TU: %f TV: %f\n", tileNbrX,tileNbrY,tileNbrU,tileNbrV);
//PRINTF("WORLD: widht: %f height: %f tileW: %f tileH: %f\n", (x2-x1), (y2-y1), w, h);
//PRINTF("PIXEL: widht: %i height: %i tileW: %f tileH: %f\n", (_vp[2] - _vp[0]), (_vp[3] - _vp[1]), tileWidthPix, tileHeightPix);
+ /*
if (tileNbrX + 4 < tileNbrU)
g_assert(0);
if (tileNbrY + 4 < tileNbrV)
g_assert(0);
+ */
}
// NOTE: pattern that do not fit entirely inside an area
@@ -2190,9 +2192,9 @@
case S52_CMD_TXT_TE: _parseTEX(obj); _ncmd++; break; // TE&TX
case S52_CMD_SYM_PT: _renderSY(obj); _ncmd++; break; // SY
case S52_CMD_SIM_LN: _renderLS(obj); _ncmd++; break; // LS
- case S52_CMD_COM_LN: _renderLC(obj); _ncmd++; break; // LC
+ case S52_CMD_COM_LN: /*_renderLC(obj);*/ _ncmd++; break; // LC
case S52_CMD_ARE_CO: _renderAC(obj); _ncmd++; break; // AC
- case S52_CMD_ARE_PA: _renderAP(obj); _ncmd++; break; // AP
+ case S52_CMD_ARE_PA: /*_renderAP(obj);*/ _ncmd++; break; // AP
// this is a trap call for CS that have not been resolve
case S52_CMD_CND_SY: _traceCS(obj); break; // CS
diff -aur S52-orig/S57gv.c S52/S57gv.c
--- S52-orig/S57gv.c 2009-06-08 18:10:53.000000000 +0200
+++ S52/S57gv.c 2009-06-29 22:53:13.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();
[openev2-renderplugin-2009-06-29-maxxflow.diff] diff -aur openev2-orig/src/lib/gv/gvproperties.c openev2/src/lib/gv/gvproperties.c
--- openev2-orig/src/lib/gv/gvproperties.c 2007-04-29 03:15:38.000000000 +0200
+++ openev2/src/lib/gv/gvproperties.c 2009-06-29 22:28:35.000000000 +0200
@@ -266,6 +266,7 @@
keyid = PROP_KEYID(properties,prop_index);
+ return NULL;
g_assert( keyid >= 1 && keyid <= gvpk_keyid_seq_id );
return gvpk_keyids[keyid-1];
diff -aur openev2-orig/src/lib/gv/gvshapeslayer.c openev2/src/lib/gv/gvshapeslayer.c
--- openev2-orig/src/lib/gv/gvshapeslayer.c 2007-04-29 03:15:38.000000000 +0200
+++ openev2/src/lib/gv/gvshapeslayer.c 2009-06-29 22:27:50.000000000 +0200
@@ -206,11 +206,13 @@
gv_shape_layer_set_num_shapes(GV_SHAPE_LAYER(layer),
gv_shapes_num_shapes(data));
+#define GV_USE_RENDER_PLUGIN
#ifdef GV_USE_RENDER_PLUGIN
{
const char *prop_name = "_ogr_driver_name";
GvProperties *properties = gv_data_get_properties(GV_DATA(data));
- const char *prop_value = gv_properties_get(properties, prop_name);
+ //const char *prop_value = gv_properties_get(properties, prop_name);
+ const char *prop_value = "S57";
if (g_module_supported() && (NULL != prop_value)) {
gchar* (*get_drv_name) ();
------------------------------------------------------------------------------
_______________________________________________
Openev-discuss mailing list
Openev-discuss@...
https://lists.sourceforge.net/lists/listinfo/openev-discuss
|