Update of /cvsroot/playerstage/code/player/examples/libplayerc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20455/examples/libplayerc

Modified Files:
        Makefile.am 
Added Files:
        vmap.c 
Log Message:
added vectormap interface
added postgis vectormap driver
Thanks to Ben Morelli for these changes


--- NEW FILE: vmap.c ---
#include <libplayerc/playerc.h>

void PrintMapInfo(playerc_vectormap_t* vmap);
void PrintLayerInfo(playerc_vectormap_t* vmap);
void PrintLayerData(playerc_vectormap_t* vmap);
void PrintFeatureData(playerc_vectormap_t* vmap);

int main()
{
  playerc_client_t* client = NULL;
  playerc_vectormap_t* vmap = NULL;

  printf("Creating client\n");
  client = playerc_client_create(NULL, "localhost", 6665);
  if (0 != playerc_client_connect(client))
  {
          printf("Error connecting client\n");
          return -1;
  }

  printf("Creating vectormap\n");
  vmap = playerc_vectormap_create(client, 0);
  if (vmap == NULL)
  {
          printf("vmap is NULL\n");
          return -1;
  }

  printf("Subscribing\n");
  if (playerc_vectormap_subscribe(vmap, PLAYER_OPEN_MODE))
  {
          printf("Error subscribing\n");
          return -1;
  }

  assert(vmap != NULL);

  printf("Getting map info\n");
  if (playerc_vectormap_get_map_info(vmap))
  {
          printf("Error getting info\n");
          return -1;
  }

  PrintMapInfo(vmap);

  printf("Getting layer info\n");
  if (playerc_vectormap_get_layer_info(vmap, 0))
  {
    printf("Error getting layer info\n");
  }

  PrintMapInfo(vmap);
  PrintLayerInfo(vmap);

  printf("Getting layer data\n");
  if (playerc_vectormap_get_layer_data(vmap, 0))
  {
          printf("Error getting layer data\n");
  }

  PrintMapInfo(vmap);
  PrintLayerInfo(vmap);
  PrintLayerData(vmap);

  printf("Getting feature data\n");
  GEOSGeom g = playerc_vectormap_get_feature_data(vmap, 0, 0);
  if (g == NULL)
  {
    printf("Error getting feature data\n");
  }

  PrintMapInfo(vmap);
  PrintLayerInfo(vmap);
  PrintLayerData(vmap);
  PrintFeatureData(vmap);

  printf("\n");
  printf("Unsubscribing\n");
  playerc_vectormap_unsubscribe(vmap);
  return 0;
}

void PrintMapInfo(playerc_vectormap_t* vmap)
{
  printf("MapInfo\n");
  printf("srid = %d\nlayer_count = %d\n", vmap->srid, vmap->layers_count);
  player_extent2d_t extent = vmap->extent;
  printf("extent = (%f %f, %f %f)\n", extent.x0, extent.y0, extent.x1, 
extent.y1);
}

void PrintLayerInfo(playerc_vectormap_t* vmap)
{
  printf("LayerInfo\n");
  player_extent2d_t extent = vmap->layers[0]->info.extent;
  printf("extent = (%f %f, %f %f)\n", extent.x0, extent.y0, extent.x1, 
extent.y1);
  printf("name = %s\n", vmap->layers[0]->info.name);
}

void PrintLayerData(playerc_vectormap_t* vmap)
{
  printf("LayerData\n");
  printf("feature count = %d\n", vmap->layers[0]->features_count);
}

void PrintFeatureData(playerc_vectormap_t* vmap)
{
  printf("FeatureData\n");
  printf("wkb count = %d\n", vmap->layers[0]->features[0].wkb_count);
  printf("name = %s\n", vmap->layers[0]->features[0].name);
}

Index: Makefile.am
===================================================================
RCS file: /cvsroot/playerstage/code/player/examples/libplayerc/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Makefile.am 2 Aug 2006 17:24:51 -0000       1.11
--- Makefile.am 20 Aug 2007 19:42:47 -0000      1.12
***************
*** 14,19 ****
  exampledir = $(prefix)/share/player/examples/libplayerc
  
! example_PROGRAMS = simple speech_c_client
! example_DATA = simple.c speech_c_client.c
  
  simple_SOURCES = simple.c
--- 14,23 ----
  exampledir = $(prefix)/share/player/examples/libplayerc
  
! example_PROGRAMS = vmap simple speech_c_client
! example_DATA = vmap.c simple.c speech_c_client.c
! 
! vmap_SOURCES = vmap.c
! vmap_LDADD = -lplayerc $(PLAYERC_LIB_DIRS) -lm -lplayerxdr -lplayererror
! vmap_DEPENDENCIES = $(PLAYERC_DEPS)
  
  simple_SOURCES = simple.c


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to