aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generic/Track.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/generic/Track.c b/generic/Track.c
index a60e4d5..9560b5a 100644
--- a/generic/Track.c
+++ b/generic/Track.c
@@ -43,6 +43,11 @@
static const char rcsid[] = "$Id$";
static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $";
+/*
+ * Define this to enable overlap manager setting
+ * the label distance rho.
+ */
+#undef DP
#define SPEED_VECTOR_PICKING_THRESHOLD 5 /* In pixels */
@@ -86,7 +91,7 @@ typedef struct _TrackItemStruct {
ItemStruct header;
/* Public data */
- unsigned char flags;
+ int flags;
Pixmap symbol; /* item symbol */
ZnGradient *symbol_color;
int label_angle; /* Label angle from track. */
@@ -362,7 +367,7 @@ Init(Item item,
SET(item->part_sensitive, PART_NUMBER_TO_BIT(LEADER));
SET(item->part_sensitive, PART_NUMBER_TO_BIT(CONNECTION));
SET(item->part_sensitive, PART_NUMBER_TO_BIT(SPEED_VECTOR));
- track->symbol_color = ZnGetGradientByValue(wi->fore_gradient);
+ track->symbol_color = ZnGetGradientByValue(wi->fore_color);
track->symbol = Tk_GetBitmap(wi->interp, wi->win, Tk_GetUid("AtcSymbol15"));
track->label_anchor = ZnAnchorCenter;
track->label_angle = DEFAULT_LABEL_ANGLE;
@@ -374,18 +379,18 @@ Init(Item item,
track->label_convergence_style = DEFAULT_CONVERGENCE_STYLE ;
track->leader_anchors = NULL;
- track->leader_color = ZnGetGradientByValue(wi->fore_gradient);
+ track->leader_color = ZnGetGradientByValue(wi->fore_color);
track->leader_style = LINE_SIMPLE;
track->leader_shape = LINE_STRAIGHT;
track->leader_width = DEFAULT_LINE_WIDTH;
- track->connection_color = ZnGetGradientByValue(wi->fore_gradient);
+ track->connection_color = ZnGetGradientByValue(wi->fore_color);
track->connection_style = LINE_SIMPLE;
track->connection_width = DEFAULT_LINE_WIDTH;
- track->marker_color = ZnGetGradientByValue(wi->fore_gradient);
+ track->marker_color = ZnGetGradientByValue(wi->fore_color);
track->marker_style = LINE_SIMPLE;
track->marker_fill_pattern = ZnUnspecifiedPattern;
- track->speed_vector_color = ZnGetGradientByValue(wi->fore_gradient);
- track->history_color = ZnGetGradientByValue(wi->fore_gradient);
+ track->speed_vector_color = ZnGetGradientByValue(wi->fore_color);
+ track->history_color = ZnGetGradientByValue(wi->fore_color);
CLEAR(track->flags, MARKER_FILLED_BIT);
SET(track->flags, FILLED_HISTORY_BIT);
CLEAR(track->flags, DOT_MIXED_HISTORY_BIT);
@@ -821,7 +826,7 @@ ComputeCoordinates(Item item,
* Compute the label position.
*/
if (ISSET(track->flags, POLAR_BIT)) {
-#if 0
+#ifdef DP
/* Alternative on ne calcule pas une distance minimum mais
* on fait confiance à la distance effective track->label_distance
* attention aux problemes d'arrondi de PointPolarToCartesian !!!
@@ -881,13 +886,13 @@ ComputeCoordinates(Item item,
right_x = track->leader_anchors->right_x;
left_y = track->leader_anchors->left_y;
right_y = track->leader_anchors->right_y;
- }
- else {
- left_x = right_x = left_y = right_y = 50;
- }
- if (track->label_angle >= 270 || track->label_angle < 90) {
- if (track->leader_anchors && (left_y < 0)) {
- ITEM_P.GetFieldBBox(field_set, left_x, &bbox);
+ }
+ else {
+ left_x = right_x = left_y = right_y = 50;
+ }
+ if (track->label_angle >= 270 || track->label_angle < 90) {
+ if (track->leader_anchors && (left_y < 0)) {
+ ITEM_P.GetFieldBBox(field_set, left_x, &bbox);
leader_end.x = bbox.orig.x;
leader_end.y = bbox.corner.y;
}
@@ -911,20 +916,20 @@ ComputeCoordinates(Item item,
}
ITEM.SetFieldsAutoAlign(item, alignment);
-
+
/* Clip the leader on the label's fields */
ITEM_P.LeaderToLabel(field_set, &track->dev, &leader_end);
-
+
/* Setup leader shape points */
if (!track->leader_points) {
track->leader_points = ZnListNew(LINE_SHAPE_POINTS, sizeof(ZnPoint));
}
GetLineShape(&track->dev, &leader_end, track->leader_width,
- track->leader_shape, &bbox, track->leader_points);
+ track->leader_shape, &bbox, track->leader_points);
AddBBoxToBBox(&item->item_bounding_box, &bbox);
points = (ZnPoint *) ZnListArray(track->leader_points);
num_points = ZnListSize(track->leader_points);
-
+
/* Setup leader ends */
if (track->leader_first_end != NULL) {
GetLineEnd(&points[0], &points[1], track->leader_width,
@@ -938,7 +943,7 @@ ComputeCoordinates(Item item,
}
}
}
-
+
/* Update connected items. */
if ((old_label_pos.x != field_set->label_pos.x) ||
(old_label_pos.y != field_set->label_pos.y) ||
@@ -1350,7 +1355,6 @@ Render(Item item)
* Draw the speed vector.
*/
if ((item->class == ZnTrack) && (track->speed_vector_width > 0)) {
- ZnPoint mark[2];
int num_clips, svlength, ticksize;
ZnReal svxstep, svystep;
@@ -1822,6 +1826,7 @@ SendTrackToOm(void *ptr,
* roundoff error.
*/
rho_derived = sqrt(track->label_dx*track->label_dx + track->label_dy*track->label_dy);
+#ifdef DP
if (ABS(rho_derived - track->label_distance) < LABEL_DISTANCE_THRESHOLD) {
/* The error is narrow so value discarded */
*rho = track->label_distance ;
@@ -1830,7 +1835,7 @@ SendTrackToOm(void *ptr,
/* Means a user change has been performed on label_dx label_dy */
*rho = rho_derived ;
}
-
+#endif
*theta = track->label_angle;
*visibility = (ISSET(current_item->flags, VISIBLE_BIT) ? 1 : 0 );
*locked = (ISSET(track->flags, FROZEN_LABEL_BIT) ? 1 : 0);
@@ -1866,7 +1871,9 @@ SetLabelAngleFromOm(void *ptr, /* No longer in use. */
if (ISCLEAR(track->flags, FROZEN_LABEL_BIT) &&
(theta >= 0) && (track->label_angle != theta)) {
track->label_angle = theta;
+#ifdef DP
track->label_distance = rho;
+#endif
SET(track->flags, POLAR_BIT);
ITEM.Invalidate((Item) item, ZN_COORDS_FLAG);
((GroupItem) ((Item) item)->parent)->call_om = True;