From c611e7c33e80aac22f1de28606e1eb1365eb6316 Mon Sep 17 00:00:00 2001
From: edgrif <edgrif>
Date: Fri, 24 Jun 2005 13:20:39 +0000
Subject: [PATCH] add structs/code to support alignments and blocks and better
 hashing from feature context to canvas items.

---
 src/include/ZMap/zmapFeature.h     | 62 +++++++++++-----------
 src/zmapFeature/zmapFeature.c      | 58 ++++++++++++--------
 src/zmapFeature/zmapFeatureTypes.c | 15 +++---
 src/zmapFeature/zmapFeatureUtils.c | 85 ++++++++++++++++++++++++------
 4 files changed, 144 insertions(+), 76 deletions(-)

diff --git a/src/include/ZMap/zmapFeature.h b/src/include/ZMap/zmapFeature.h
index 922b718fc..89a8e1137 100755
--- a/src/include/ZMap/zmapFeature.h
+++ b/src/include/ZMap/zmapFeature.h
@@ -22,12 +22,12 @@
  * 	Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk,
  *      Rob Clack (Sanger Institute, UK) rnc@sanger.ac.uk
  *
- * Description: Data structures describing a genetic feature.
+ * Description: Data structures describing a sequence feature.
  *              
  * HISTORY:
- * Last edited: Jun 23 09:37 2005 (rnc)
+ * Last edited: Jun 24 14:13 2005 (edgrif)
  * Created: Fri Jun 11 08:37:19 2004 (edgrif)
- * CVS info:   $Id: zmapFeature.h,v 1.28 2005-06-24 12:07:12 rnc Exp $
+ * CVS info:   $Id: zmapFeature.h,v 1.29 2005-06-24 13:20:39 edgrif Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAP_FEATURE_H
@@ -118,7 +118,9 @@ typedef struct
 typedef struct
 {
   int q1, q2 ;						    /* coords in query sequence */
+  ZMapStrand q_strand ;
   int t1, t2 ;						    /* coords in target sequence */
+  ZMapStrand t_strand ;
 } ZMapAlignBlockStruct, *ZMapAlignBlock ;
 
 
@@ -136,7 +138,8 @@ typedef struct
 
 
 
-/* DO THESE STRUCTS NEED TO BE EXPOSED ? PROBABLY NOT.... */
+/* DO THESE STRUCTS NEED TO BE EXPOSED ? PROBABLY NOT....TO HIDE THEM WOULD REQUIRE
+ * QUITE A NUMBER OF ACCESS FUNCTIONS.... */
 
 
 typedef struct ZMapFeatureAlignmentStruct_ *ZMapFeatureAlignment ;
@@ -163,32 +166,25 @@ typedef struct ZMapFeatureContextStruct_
   ZMapMapBlockStruct sequence_to_parent ;		    /* Shows how this sequence maps to its
 							       ultimate parent. */
 
-
   ZMapFeatureAlignment master_align ;			    /* The target/master alignment out of
 							       the below set. */
 
-  /* Alignments.... */
+  GList *types ;					    /* Global list of types, _only_ these
+							       types are loaded into the context. */
+
   GData *alignments ;					    /* All the alignements for this zmap
 							       as a set of ZMapFeatureAlignment. */
 
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-  /* Feature sets. */
-  GData *feature_sets ;					    /* A set of ZMapFeatureSetStruct. */
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
+} ZMapFeatureContextStruct, *ZMapFeatureContext ;
 
 
-} ZMapFeatureContextStruct, *ZMapFeatureContext ;
 
 typedef struct ZMapFeatureAlignmentStruct_
 {
   ZMapFeatureContext parent_context ;			    /* Our parent context. */
 
   GQuark unique_id ;					    /* Unique id this alignment. */
-  GQuark original_id ;					    /* Original id, species ? */
-
-  /* We may need some mapping data here.... */
-
-  GData *types ;
+  GQuark original_id ;					    /* Original id of this sequence. */
 
   GList *blocks ;					    /* A set of ZMapFeatureStruct. */
 
@@ -201,9 +197,9 @@ typedef struct ZMapFeatureBlockStruct_
   ZMapFeatureAlignment parent_alignment ;		    /* Our parent alignment. */
 
   GQuark unique_id ;					    /* Unique id for this block. */
-  GQuark original_id ;					    /* Original id, not needed ? */
-
-  ZMapMapBlockStruct features_to_sequence ;		    /* Shows how these features map to the
+  GQuark original_id ;					    /* Original id, probably not needed ? */
+  
+  ZMapAlignBlockStruct block_to_sequence ;		    /* Shows how these features map to the
 							       sequence, n.b. this feature set may only
 							       span part of the sequence. */
 
@@ -227,7 +223,7 @@ typedef struct ZMapFeatureSetStruct_
 
   GData *features ;					    /* A set of ZMapFeatureStruct. */
 
-  GQuark style ;					    /* Style for these features. */
+  GQuark style_id ;					    /* Style for these features. */
 
 } ZMapFeatureSetStruct, *ZMapFeatureSet ;
 
@@ -273,12 +269,6 @@ typedef struct
  *  */
 typedef struct ZMapFeatureStruct_ 
 {
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-  /* I think actually we want to have a pointer to our parent.... */
-
-  GQuark style ;					    /* Style for this feature. */
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-
   ZMapFeatureSet parent_set ;				    /* Our containing set. */
 
 
@@ -293,9 +283,10 @@ typedef struct ZMapFeatureStruct_
 
   Coord x1, x2 ;					    /* start, end of feature in absolute coords. */
 
-
   ZMapStrand strand ;
+
   ZMapPhase phase ;
+
   float score ;
 
   char *text ;						    /* needed ????? */
@@ -353,6 +344,10 @@ typedef struct ZMapFeatureTypeStyleStruct_
 
 
 
+GQuark zMapFeatureAlignmentCreateID(char *align_sequence, gboolean query_sequence) ; 
+GQuark zMapFeatureBlockCreateID(char *align_sequence,
+				int target_start, int target_end, ZMapStrand target_strand,
+				int query_start, int query_end, ZMapStrand query_strand) ;
 
 
 char *zMapFeatureCreateName(ZMapFeatureType feature_type, char *feature_name,
@@ -373,7 +368,7 @@ ZMapFeature zMapFeatureFindFeatureInSet(ZMapFeatureSet feature_set, GQuark featu
 GData *zMapFeatureFindSetInContext(ZMapFeatureContext feature_context, GQuark set_id) ;
 
 
-ZMapFeatureContext zMapFeatureContextCreate(char *sequence) ;
+ZMapFeatureContext zMapFeatureContextCreate(char *sequence, int start, int end, GList *types) ;
 gboolean zMapFeatureContextMerge(ZMapFeatureContext *current_context_inout,
 				 ZMapFeatureContext new_context,
 				 ZMapFeatureContext *diff_context_out) ;
@@ -382,11 +377,14 @@ void zMapFeatureContextAddAlignment(ZMapFeatureContext feature_context,
 void zMapFeatureDump(ZMapFeatureContext feature_context, char *file) ;
 void zMapFeatureContextDestroy(ZMapFeatureContext context, gboolean free_data) ;
 
-ZMapFeatureAlignment zMapFeatureAlignmentCreate(char *align_name, GData *types) ;
+ZMapFeatureAlignment zMapFeatureAlignmentCreate(char *align_name) ;
 void zMapFeatureAlignmentAddBlock(ZMapFeatureAlignment alignment, ZMapFeatureBlock block) ;
 void zMapFeatureAlignmentDestroy(ZMapFeatureAlignment alignment) ;
 
-ZMapFeatureBlock zMapFeatureBlockCreate(char *block_name) ;
+ZMapFeatureBlock zMapFeatureBlockCreate(char *ref_seq,
+					int ref_start, int ref_end, ZMapStrand ref_strand,
+					char *non_seq,
+					int non_start, int non_end, ZMapStrand non_strand) ;
 void zMapFeatureBlockAddFeatureSet(ZMapFeatureBlock feature_block, ZMapFeatureSet feature_set) ;
 void zMapFeatureBlockDestroy(ZMapFeatureBlock block, gboolean free_data) ;
 
@@ -417,10 +415,10 @@ char *zMapStyleCreateName(char *style_name) ;
 GQuark zMapStyleCreateID(char *style_name) ;
 
 char *zMapStyleGetName(ZMapFeatureTypeStyle style) ;
-
+ZMapFeatureTypeStyle zMapFindStyle(GList *styles, GQuark style_id) ;
 ZMapFeatureTypeStyle zMapFeatureTypeCopy(ZMapFeatureTypeStyle type) ;
 void zMapFeatureTypeDestroy(ZMapFeatureTypeStyle type) ;
-GData *zMapFeatureTypeGetFromFile(char *types_file) ;
+GList *zMapFeatureTypeGetFromFile(char *types_file) ;
 gboolean zMapFeatureTypeSetAugment(GData **current, GData **new) ;
 void zMapFeatureTypePrintAll(GData *type_set, char *user_string) ;
 
diff --git a/src/zmapFeature/zmapFeature.c b/src/zmapFeature/zmapFeature.c
index aceef8e95..ed9dd568a 100755
--- a/src/zmapFeature/zmapFeature.c
+++ b/src/zmapFeature/zmapFeature.c
@@ -27,9 +27,9 @@
  *              
  * Exported functions: See zmapView_P.h
  * HISTORY:
- * Last edited: Jun 23 20:02 2005 (rnc)
+ * Last edited: Jun 24 14:14 2005 (edgrif)
  * Created: Fri Jul 16 13:05:58 2004 (edgrif)
- * CVS info:   $Id: zmapFeature.c,v 1.15 2005-06-24 12:08:30 rnc Exp $
+ * CVS info:   $Id: zmapFeature.c,v 1.16 2005-06-24 13:20:39 edgrif Exp $
  *-------------------------------------------------------------------
  */
 
@@ -149,11 +149,6 @@ gboolean zmapFeatureAugmentData(ZMapFeature feature, char *feature_name_id, char
       feature->type = feature_type ;
       feature->x1 = start ;
       feature->x2 = end ;
-
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-      feature->style = style_id ;
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-
       feature->strand = strand ;
       feature->phase = phase ;
       feature->score = score ;
@@ -331,7 +326,7 @@ void zMapFeatureSetDestroy(ZMapFeatureSet feature_set, gboolean free_data)
 }
 
 
-ZMapFeatureAlignment zMapFeatureAlignmentCreate(char *align_name, GData *types)
+ZMapFeatureAlignment zMapFeatureAlignmentCreate(char *align_name)
 {
   ZMapFeatureAlignment alignment ;
 
@@ -345,8 +340,6 @@ ZMapFeatureAlignment zMapFeatureAlignmentCreate(char *align_name, GData *types)
       alignment->unique_id = alignment->original_id ;
     }
 
-  alignment->types = types ;
-
   return alignment ;
 }
 
@@ -373,26 +366,43 @@ void zMapFeatureAlignmentDestroy(ZMapFeatureAlignment alignment)
 
 
 
-ZMapFeatureBlock zMapFeatureBlockCreate(char *block_name)
+ZMapFeatureBlock zMapFeatureBlockCreate(char *ref_seq,
+					int ref_start, int ref_end, ZMapStrand ref_strand,
+					char *non_seq,
+					int non_start, int non_end, ZMapStrand non_strand)
 {
   ZMapFeatureBlock new_block ;
+  char *id_base ;
+
 
-  zMapAssert(!block_name || (block_name && *block_name)) ;
+  /* need some asserts in here.... */
 
   new_block = g_new(ZMapFeatureBlockStruct, 1) ;
 
-  if (block_name)
-    {
-      new_block->original_id = g_quark_from_string(block_name) ;
 
-      /* THIS WILL NEED CHANGING..... */
-      new_block->unique_id = new_block->original_id ;
-    }
+  id_base = g_strdup_printf("%s:%d-%d_vs_%s:%d-%d", 
+			    ref_seq, ref_start, 
+			    ref_end, non_seq, 
+			    non_start, non_end) ;
+  new_block->unique_id = g_quark_from_string(id_base) ;
+  g_free(id_base) ;
+
+  /* Use the sequence name for the original_id */
+  new_block->original_id = g_quark_from_string(non_seq) ; 
+
+  new_block->block_to_sequence.t1 = ref_start ;
+  new_block->block_to_sequence.t2 = ref_end ;
+  new_block->block_to_sequence.t_strand = ref_strand ;
+
+  new_block->block_to_sequence.q1 = non_start ;
+  new_block->block_to_sequence.q2 = non_end ;
+  new_block->block_to_sequence.q_strand = non_strand ;
 
   return new_block ;
 }
 
 
+
 void zMapFeatureBlockAddFeatureSet(ZMapFeatureBlock feature_block, ZMapFeatureSet feature_set)
 {
 
@@ -427,14 +437,20 @@ void zMapFeatureBlockDestroy(ZMapFeatureBlock block, gboolean free_data)
 }
 
 
-ZMapFeatureContext zMapFeatureContextCreate(char *sequence)
+ZMapFeatureContext zMapFeatureContextCreate(char *sequence, int start, int end, GList *types)
 {
   ZMapFeatureContext feature_context ;
 
   feature_context = g_new0(ZMapFeatureContextStruct, 1) ;
 
   if (sequence && *sequence)
-    feature_context->sequence_name = g_quark_from_string(sequence) ;
+    {
+      feature_context->sequence_name = g_quark_from_string(sequence) ;
+      feature_context->sequence_to_parent.c1 = start ;
+      feature_context->sequence_to_parent.c2 = end ;
+    }
+
+  feature_context->types = types ;
 
   g_datalist_init(&(feature_context->alignments)) ;
 
@@ -545,7 +561,7 @@ gboolean zMapFeatureContextMerge(ZMapFeatureContext *current_context_inout,
 	{
 	  FeatureContextsStruct contexts ;
 
-	  diff_context = zMapFeatureContextCreate(NULL) ;
+	  diff_context = zMapFeatureContextCreate(NULL, 0, 0, NULL) ;
 
 	  contexts.current_feature_sets = &(current_context->feature_sets) ;
 	  contexts.diff_feature_sets = &(diff_context->feature_sets) ;
diff --git a/src/zmapFeature/zmapFeatureTypes.c b/src/zmapFeature/zmapFeatureTypes.c
index 722ee60f8..38192ced8 100755
--- a/src/zmapFeature/zmapFeatureTypes.c
+++ b/src/zmapFeature/zmapFeatureTypes.c
@@ -27,12 +27,13 @@
  *              
  * Exported functions: See ZMap/zmapFeature.h
  * HISTORY:
- * Last edited: May 27 13:23 2005 (edgrif)
+ * Last edited: Jun 24 08:45 2005 (edgrif)
  * Created: Tue Dec 14 13:15:11 2004 (edgrif)
- * CVS info:   $Id: zmapFeatureTypes.c,v 1.6 2005-05-27 15:14:31 edgrif Exp $
+ * CVS info:   $Id: zmapFeatureTypes.c,v 1.7 2005-06-24 13:20:39 edgrif Exp $
  *-------------------------------------------------------------------
  */
 
+#include <stdio.h>
 #include <ZMap/zmapUtils.h>
 #include <ZMap/zmapConfig.h>
 #include <zmapFeature_P.h>
@@ -211,9 +212,9 @@ gboolean zMapFeatureTypeSetAugment(GData **current, GData **new)
 
 /* Read the type/method/source (call it what you will) information from the given file
  * which currently must reside in the users $HOME/.ZMap directory. */
-GData *zMapFeatureTypeGetFromFile(char *types_file_name)
+GList *zMapFeatureTypeGetFromFile(char *types_file_name)
 {
-  GData *types = NULL ;
+  GList *types = NULL ;
   gboolean result = FALSE ;
   ZMapConfigStanzaSet types_list = NULL ;
   ZMapConfig config ;
@@ -251,7 +252,7 @@ GData *zMapFeatureTypeGetFromFile(char *types_file_name)
       int num_types = 0 ;
       ZMapConfigStanza next_types ;
 
-      g_datalist_init(&types) ;
+      types = NULL ;
 
       /* Current error handling policy is to connect to servers that we can and
        * report errors for those where we fail but to carry on and set up the ZMap
@@ -280,7 +281,9 @@ GData *zMapFeatureTypeGetFromFile(char *types_file_name)
 				      zMapConfigGetElementBool(next_types, "frame_specific"),
 				      zMapConfigGetElementBool(next_types, "show_reverse")) ;
 
-	      g_datalist_id_set_data(&types, new_type->unique_id, new_type) ;
+
+	      types = g_list_append(types, new_type) ;
+
 	      num_types++ ;
 	    }
 	  else
diff --git a/src/zmapFeature/zmapFeatureUtils.c b/src/zmapFeature/zmapFeatureUtils.c
index 6a29b1cb7..18a0f35a8 100755
--- a/src/zmapFeature/zmapFeatureUtils.c
+++ b/src/zmapFeature/zmapFeatureUtils.c
@@ -26,9 +26,9 @@
  *              1
  * Exported functions: See zmapFeature.h
  * HISTORY:
- * Last edited: May 23 11:53 2005 (edgrif)
+ * Last edited: Jun 24 11:58 2005 (edgrif)
  * Created: Tue Nov 2 2004 (rnc)
- * CVS info:   $Id: zmapFeatureUtils.c,v 1.10 2005-05-27 15:15:06 edgrif Exp $
+ * CVS info:   $Id: zmapFeatureUtils.c,v 1.11 2005-06-24 13:20:39 edgrif Exp $
  *-------------------------------------------------------------------
  */
 
@@ -52,6 +52,8 @@ static void printFeatureBlock(gpointer data, gpointer user_data) ;
 static void printFeatureSet(GQuark key_id, gpointer data, gpointer user_data) ;
 static void printFeature(GQuark key_id, gpointer data, gpointer user_data) ;
 static gboolean printLine(GIOChannel *channel, gchar *line) ;
+static gint findStyle(gconstpointer list_data, gconstpointer user_data) ;
+
 
 
 /* This function creates a unique id for a feature. This is essential if we are to use the
@@ -135,7 +137,7 @@ GQuark zMapFeatureGetStyleQuark(ZMapFeature feature)
 {
   GQuark style_quark ;
 
-  style_quark = feature->parent_set->style ;
+  style_quark = feature->parent_set->style_id ;
 
   return style_quark ;
 }
@@ -144,14 +146,29 @@ GQuark zMapFeatureGetStyleQuark(ZMapFeature feature)
 ZMapFeatureTypeStyle zMapFeatureGetStyle(ZMapFeature feature)
 {
   ZMapFeatureTypeStyle style ;
-  GData *types = feature->parent_set->parent_block->parent_alignment->types ;
+  GList *styles = feature->parent_set->parent_block->parent_alignment->parent_context->types ;
+
+  style = zMapFindStyle(styles, feature->parent_set->style_id) ;
+
+  return style ;
+}
+
+
+
+ZMapFeatureTypeStyle zMapFindStyle(GList *styles, GQuark style_id)
+{
+  ZMapFeatureTypeStyle style ;
+  GList *list ;
+
+  list = g_list_find_custom(styles, GUINT_TO_POINTER(style_id), findStyle) ;
 
-  style = (ZMapFeatureTypeStyle)g_datalist_id_get_data(&(types),
-						       feature->parent_set->style) ;
+  style = list->data ;
 
   return style ;
 }
 
+
+
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
 /* WE MAY STILL WANT A FUNCTION LIKE THIS BUT IT WILL NEED MORE ARGS, E.G. ALIGNMENT... */
 ZMapFeature zMapFeatureFindFeatureInContext(ZMapFeatureContext feature_context,
@@ -197,10 +214,6 @@ GData *zMapFeatureFindSetInBlock(ZMapFeatureBlock feature_block, GQuark set_id)
 }
 
 
-
-
-
-
 /* Dump out a feature context, if file is NULL then goes to stdout. */
 void zMapFeatureDump(ZMapFeatureContext feature_context, char *file)
 {
@@ -238,8 +251,12 @@ void zMapFeatureDump(ZMapFeatureContext feature_context, char *file)
 
   if (!channel)
     {
+
+#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
       zMapShowMsg(ZMAP_MSG_WARNING, "Can't open output file \"%s\": %s",
 		  filepath, channel_error->message) ;
+#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
+
       g_error_free(channel_error) ;
     }
   else
@@ -253,12 +270,20 @@ void zMapFeatureDump(ZMapFeatureContext feature_context, char *file)
       /* close output file */
       if (g_io_channel_shutdown(channel, TRUE, &channel_error) != G_IO_STATUS_NORMAL)
 	{
+
+#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
 	  zMapShowMsg(ZMAP_MSG_WARNING, "Error closing output file \"%s\": %s",
 		      filepath, channel_error->message) ;
+#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
+
 	  g_error_free(channel_error) ;
 	}
+
+#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
       else 
 	zMapShowMsg(ZMAP_MSG_INFORMATION, "Feature Context dumped to \"%s\"", filepath) ;
+#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
+
     }
 
   g_free(filepath) ;
@@ -311,8 +336,8 @@ static void printFeatureContext(ZMapFeatureContext feature_context, DumpFeatures
   char *line ;
 
   line = g_strdup_printf("Feature Context:\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d\n", 
-			 feature_context->sequence_name, 
-			 feature_context->parent_name,
+			 g_quark_to_string(feature_context->sequence_name),
+			 g_quark_to_string(feature_context->parent_name),
 			 feature_context->parent_span.x1,
 			 feature_context->parent_span.x2,
 			 feature_context->sequence_to_parent.p1,
@@ -361,15 +386,22 @@ static void printFeatureBlock(gpointer data, gpointer user_data)
   char *line ;
 
   line = g_strdup_printf("\tBlock:\t%s\t%d\t%d\t%d\t%d\n", g_quark_to_string(block->unique_id),
-			 block->features_to_sequence.p1,
-			 block->features_to_sequence.p2,
-			 block->features_to_sequence.c1,
-			 block->features_to_sequence.c2) ;
+			 block->block_to_sequence.t1,
+			 block->block_to_sequence.t2,
+			 block->block_to_sequence.q1,
+			 block->block_to_sequence.q2) ;
 
 
   /* Only proceed if there's no problem printing the line */
+
+  /* JUST FOR NOW.... */
+  dump_features->status = printLine(dump_features->channel, line) ;
+
+#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
   if ((dump_features->status = printLine(dump_features->channel, line)))
     g_datalist_foreach(&(block->feature_sets), printFeatureSet, dump_features) ;
+#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
+
 
   g_free(line) ;
 
@@ -390,7 +422,7 @@ static void printFeatureSet(GQuark key_id, gpointer data, gpointer user_data)
 
   line = g_strdup_printf("\tFeature Set:\t%s\t%s\n",
 			 g_quark_to_string(feature_set->unique_id),
-			 (char *)g_quark_to_string(feature_set->style)) ;
+			 (char *)g_quark_to_string(feature_set->style_id)) ;
 
   /* Only proceed if there's no problem printing the line */
   if ((dump_features->status = printLine(dump_features->channel, line)))
@@ -499,8 +531,12 @@ static gboolean printLine(GIOChannel *channel, gchar *line)
 
   if (g_io_channel_write_chars(channel, line, -1, &bytes_written, &channel_error) != G_IO_STATUS_NORMAL)
     {
+
+#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
       zMapShowMsg(ZMAP_MSG_WARNING, "Error writing to output file: %50s... : %s",
 		  line, channel_error->message) ;
+#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
+
       g_error_free(channel_error) ;
       status = FALSE ;
     }
@@ -509,3 +545,18 @@ static gboolean printLine(GIOChannel *channel, gchar *line)
 }
 
 
+/* GCompareFunc function, called for each member of a list of styles to see if the supplied 
+ * style id matches the that in the style. */
+static gint findStyle(gconstpointer list_data, gconstpointer user_data)
+{
+  gint result = -1 ;
+  ZMapFeatureTypeStyle style = (ZMapFeatureTypeStyle)list_data ;
+  GQuark style_quark =  GPOINTER_TO_INT(user_data) ;
+
+  if (style_quark == style->unique_id)
+    result = 0 ;
+
+  return result ;
+}
+
+
-- 
GitLab