Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
f3c65a6a
Commit
f3c65a6a
authored
15 years ago
by
mh17
Browse files
Options
Downloads
Patches
Plain Diff
fixed ovbious inefficiency previous overlap bump fix
parent
dcca384c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/zmapWindow/zmapWindowColBump.c
+42
-34
42 additions, 34 deletions
src/zmapWindow/zmapWindowColBump.c
with
42 additions
and
34 deletions
src/zmapWindow/zmapWindowColBump.c
+
42
−
34
View file @
f3c65a6a
...
...
@@ -29,7 +29,7 @@
* HISTORY:
* Last edited: Jan 11 09:16 2010 (edgrif)
* Created: Tue Sep 4 10:52:09 2007 (edgrif)
* CVS info: $Id: zmapWindowColBump.c,v 1.5
8
2010-01-2
0 17:17:19
mh17 Exp $
* CVS info: $Id: zmapWindowColBump.c,v 1.5
9
2010-01-2
1 08:48:55
mh17 Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -163,8 +163,8 @@ typedef struct
static
void
bumpColCB
(
gpointer
data
,
gpointer
user_data
)
;
static
void
compareListOverlapCB
(
gpointer
data
,
gpointer
user_data
)
;
static
gint
overlap_cmp
(
gconstpointer
a
,
gconstpointer
b
);
//
static void compareListOverlapCB(gpointer data, gpointer user_data) ;
//
static gint overlap_cmp(gconstpointer a,gconstpointer b);
static
gboolean
featureListCB
(
gpointer
data
,
gpointer
user_data
)
;
...
...
@@ -826,6 +826,36 @@ static void invoke_realize_and_map(FooCanvasItem *item)
return
;
}
static
double
bump_overlap
(
BumpCol
bump_data
,
BumpColRange
new_range
)
{
GList
*
l
;
BumpColRange
curr_range
;
// pos list is sorted by column
for
(
l
=
g_list_first
(
bump_data
->
pos_list
);
l
;
l
=
g_list_next
(
l
))
{
curr_range
=
(
BumpColRange
)
l
->
data
;
if
(
new_range
->
column
==
curr_range
->
column
)
{
// can overlap with this feature: same column
if
(
!
(
new_range
->
y1
>
curr_range
->
y2
||
new_range
->
y2
<
curr_range
->
y1
))
{
new_range
->
column
++
;
new_range
->
offset
+=
new_range
->
incr
;
// got an overlap, try next column
}
}
else
if
(
new_range
->
column
<
curr_range
->
column
)
break
;
}
// either we found a space or ran out of features ie no overlap
bump_data
->
pos_list
=
g_list_insert_before
(
bump_data
->
pos_list
,
l
,
(
gpointer
)
new_range
)
;
return
(
new_range
->
offset
);
}
/* Is called once for each item in a column and sets the horizontal position of that
* item under various "bumping" modes. */
static
void
bumpColCB
(
gpointer
data
,
gpointer
user_data
)
...
...
@@ -922,7 +952,6 @@ static void bumpColCB(gpointer data, gpointer user_data)
{
/* Bump features over if they overlap at all. */
BumpColRange
new_range
;
GList
*
l
;
new_range
=
g_new0
(
BumpColRangeStruct
,
1
)
;
new_range
->
y1
=
y1
;
...
...
@@ -932,30 +961,7 @@ static void bumpColCB(gpointer data, gpointer user_data)
new_range
->
column
=
0
;
// g_list_foreach(bump_data->pos_list, compareListOverlapCB, new_range) ;
// pos list is sorted by column
for
(
l
=
g_list_first
(
bump_data
->
pos_list
);
l
;
l
=
g_list_next
(
l
))
{
BumpColRange
curr_range
=
(
BumpColRange
)
l
->
data
;
if
(
new_range
->
column
==
curr_range
->
column
)
{
// can overlap with this feature: same column
if
(
!
(
new_range
->
y1
>
curr_range
->
y2
||
new_range
->
y2
<
curr_range
->
y1
))
{
new_range
->
column
++
;
new_range
->
offset
+=
new_range
->
incr
;
// got an overlap, try next column
}
}
else
if
(
new_range
->
column
<
curr_range
->
column
)
break
;
}
// either we found a space or ran out of features ie no overlap
bump_data
->
pos_list
=
g_list_insert_sorted
(
bump_data
->
pos_list
,
(
gpointer
)
new_range
,
overlap_cmp
)
;
offset
=
new_range
->
offset
;
offset
=
bump_overlap
(
bump_data
,
new_range
);
break
;
}
case
ZMAPBUMP_NAME
:
...
...
@@ -997,19 +1003,18 @@ static void bumpColCB(gpointer data, gpointer user_data)
{
/* Bump features over if they overlap at all. */
BumpColRange
new_range
;
new_range
=
g_new0
(
BumpColRangeStruct
,
1
)
;
new_range
->
y1
=
y1
;
new_range
->
y2
=
y2
;
new_range
->
offset
=
0
.
0
;
new_range
->
incr
=
x2
-
x1
+
1
.
0
;
g_list_foreach
(
bump_data
->
pos_list
,
compareListOverlapCB
,
new_range
)
;
/* g_list_foreach(bump_data->pos_list, compareListOverlapCB, new_range) ;
bump_data->pos_list = g_list_append(bump_data->pos_list, new_range) ;
offset = new_range->offset ;
*/
offset
=
bump_overlap
(
bump_data
,
new_range
);
break
;
}
break
;
...
...
@@ -1062,6 +1067,7 @@ static void hashDataDestroyCB(gpointer data)
}
#if MH17_NOT_USED
/* GFunc callback func, called from g_list_foreach_find() to test whether current
* element matches supplied overlap coords. */
static
void
compareListOverlapCB
(
gpointer
data
,
gpointer
user_data
)
...
...
@@ -1088,6 +1094,8 @@ static gint overlap_cmp(gconstpointer a,gconstpointer b)
return
(
1
);
}
#endif
/* GFunc callback func, called from g_list_foreach_find() to free list resources. */
static
void
listDataDestroyCB
(
gpointer
data
,
gpointer
user_data
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment