[Planner Dev] Task Predecessors



Hi again,

Thanks for your comments. I have done some more work on the other predecessor 
types. I farmed the "compute min time for a particular predecessor 
relationsship" into a separate function. I have also implemented (what I 
think) the correct drawing of arrows in the gantt chart, let me know if you 
all think this is how they should work. It would also be nice to make sure 
that no lines were drawn through other tasks, but that might be a bit more 
work.

New screenshot and cvs diff attached. Look at my last one to see what has 
changed.

Anyway, assuming this all looks good...  how do I go about getting it 
committed to CVS? What process does it have to go through.

Cyas,

Corey


-- 

--
Corey Schuhen
corey_m schuhen net
http://schuhen.net

Attachment: gantt_chart.jpg
Description: JPEG image

? .diff.diff.swp
? cppcomplete.tags
? diff.diff
? docs/.getting-started-hacking.xml.swp
? dotnet/Makefile
? dotnet/Makefile.in
? dotnet/libplanner/Makefile
? dotnet/libplanner/Makefile.in
? dotnet/samples/Makefile
? dotnet/samples/Makefile.in
? libplanner/.mrp-task-manager.c.swp
? libplanner/cppcomplete.tags
? libplanner/make_other_dep_types_work.patch
? src/.planner-relation-arrow.c.swp
? src/.planner-relation-arrow.h.swp
? src/cppcomplete.tags
Index: libplanner/mrp-task-manager.c
===================================================================
RCS file: /cvs/gnome/planner/libplanner/mrp-task-manager.c,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 mrp-task-manager.c
856a857,895
> /* Calcluate the earliest start time that a particular predesessor relation 
>  * allows given:
>  * 
>  */
> mrptime
> task_manager_calc_relation(MrpTask	*task,
> 			   MrpRelation	*relation,
> 			   MrpTask	*predecessor)
> {
> 	/* Compute the earliest start time that this particular dependancy 
> 	 * would allow */
> 	switch(mrp_relation_get_relation_type (relation)){
> 	            
> 		case MRP_RELATION_FF:   /* finish-to-finish */
> 			return mrp_task_get_finish (predecessor) +
> 				mrp_relation_get_lag (relation) -
> 				(mrp_task_get_finish(task) -
> 				mrp_task_get_start(task));
>                   
> 		case MRP_RELATION_SS:   /* start-to-start */
> 			return mrp_task_get_start (predecessor) +
> 				mrp_relation_get_lag (relation);
>            
> 		case MRP_RELATION_SF:   /* start-to-finish */
> 			return mrp_task_get_start (predecessor) +
> 				mrp_relation_get_lag (relation) -
> 				(mrp_task_get_finish(task) -
> 				mrp_task_get_start(task));
>                     
> 		case MRP_RELATION_NONE: /* unset */
> 		case MRP_RELATION_FS:   /* finish-to-start */
> 		default:
> 			return mrp_task_get_finish (predecessor) +
> 				mrp_relation_get_lag (relation);
> 	}
> 
> 
> }
> 
871c910
< 	mrptime             finish;
---
> 	mrptime             dep_start_time;
886,887c925,928
< 			finish = mrp_task_get_finish (predecessor) +
< 				mrp_relation_get_lag (relation);
---
> 			dep_start_time 
> 				= task_manager_calc_relation(task,
> 							     relation,
> 							     predecessor);
889c930
< 			start = MAX (start, finish);
---
> 			start = MAX (start, dep_start_time);
Index: src/planner-gantt-chart.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-gantt-chart.c,v
retrieving revision 1.4
diff -r1.4 planner-gantt-chart.c
175c175,176
< 							 TreeNode           *predecessor);
---
> 							 TreeNode           *predecessor,
> 							 MrpRelationType    type);
805c806
< 			arrow = gantt_chart_add_relation (chart, task_node, predecessor_node);
---
> 			arrow = gantt_chart_add_relation (chart, task_node, predecessor_node, mrp_relation_get_relation_type(relation));
1036,1037c1037,1039
< 			  TreeNode     *task,
< 			  TreeNode     *predecessor)
---
> 			  TreeNode     		*task,
> 			  TreeNode     		*predecessor,
> 			  MrpRelationType 	type)
1040c1042,1043
< 				      PLANNER_GANTT_ROW (predecessor->item));
---
> 				      PLANNER_GANTT_ROW (predecessor->item),
> 				      type);
1185c1188,1190
< 					  predecessor_node);
---
> 					  predecessor_node,
> 					  mrp_relation_get_relation_type(
> 						  relation));
Index: src/planner-relation-arrow.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-relation-arrow.c,v
retrieving revision 1.2
diff -r1.2 planner-relation-arrow.c
38a39,70
> SS:
> 
>   1:      A 
>   	 +--XXXXXX
>        B | 
> 	 +---XXXXX
>           C
> 	  
> FF:
> 
>   1:               A 
>   	   XXXXXX----+
> 	             | B
> 	     XXXXX---+
> 		   C
> 		   
> SF:
> 
>   1:                       A (we have a maximum value for A)
>   	   		 +------XXXXXX
> 	               B |
> 		     XXXXX
> 
> 
>   2:	          A (max value)  
>      	         +-XXXXXX
> 	       B |        C
> 	 	 +---------------+
> 	  		         |D
> 	 		   XXXXX-+
>           		        E (max value)
> 
55,56d86
< 
< TODO: Implement other types, remove the arguments from the geometry-changed signal.
254c284,285
< 
---
> 	MrpRelationType type;
> 	
255a287
> 	type = priv->type;
267a300,302
> 	if(type == MRP_RELATION_SS){
> 		priv->num_points = 4;
> 		priv->arrow_dir = PLANNER_ARROW_RIGHT;
269,273c304,305
< 	/* Two cases for FS, as shown at the top of this file. */
< 	if (px2 <= sx1) {
< 		priv->num_points = 3;
< 
< 		priv->points[0].x = px2;
---
> 		/* LHS of pred */
> 		priv->points[0].x = px1;
276,282c308,313
< 		priv->points[1].x = MAX (px2 + MIN_SPACING, sx1);
< 		priv->points[1].y = py1 + (py2 - py1) / 2;
< 
< 		priv->points[2].x = MAX (px2 + MIN_SPACING, sx1);
< 		if (sy1 > py1) {
< 			priv->points[2].y = sy1;
< 			priv->arrow_dir = PLANNER_ARROW_DOWN;
---
> 		/* Next two, a bit left of the most left */
> 		if (sx1 < px1) {
> 			priv->points[1].x = sx1 - MIN_SPACING - ARROW_SIZE;
> 			priv->points[1].y = py1 + (py2 - py1) / 2;
> 			priv->points[2].x = sx1 - MIN_SPACING - ARROW_SIZE;
> 			priv->points[2].y = sy1 + (sy2 - sy1) / 2;
284,285c315,318
< 			priv->points[2].y = sy2;
< 			priv->arrow_dir = PLANNER_ARROW_UP;
---
> 			priv->points[1].x = px1 - MIN_SPACING - ARROW_SIZE;
> 			priv->points[1].y = py1 + (py2 - py1) / 2;
> 			priv->points[2].x = px1 - MIN_SPACING - ARROW_SIZE;
> 			priv->points[2].y = sy1 + (sy2 - sy1) / 2;
287,289c320,327
< 	} else {
< 		priv->num_points = 6;
< 		priv->arrow_dir = PLANNER_ARROW_RIGHT;
---
> 		
> 		priv->points[3].x = sx1;
> 		priv->points[3].y = sy1 + (sy2 - sy1) / 2;
> 		
> 	}else if(type == MRP_RELATION_FF){
> 		
> 		priv->num_points = 4;
> 		priv->arrow_dir = PLANNER_ARROW_LEFT;
290a329
> 		/* LHS of pred */
294,298c333,338
< 		priv->points[1].x = px2 + MIN_SPACING;
< 		priv->points[1].y = py1 + (py2 - py1) / 2;
< 
<  		if (sy1 > py1) {
< 			y = py2 + (py2 - py1) / 2 - 1;
---
> 		/* Next two, a bit left of the most left */
> 		if (sx2 > px2) {
> 			priv->points[1].x = sx2 + MIN_SPACING + ARROW_SIZE;
> 			priv->points[1].y = py1 + (py2 - py1) / 2;
> 			priv->points[2].x = sx2 + MIN_SPACING + ARROW_SIZE;
> 			priv->points[2].y = sy1 + (sy2 - sy1) / 2;
300c340,343
< 			y = py1 - (py2 - py1) / 2 + 2;
---
> 			priv->points[1].x = px2 + MIN_SPACING + ARROW_SIZE;
> 			priv->points[1].y = py1 + (py2 - py1) / 2;
> 			priv->points[2].x = px2 + MIN_SPACING + ARROW_SIZE;
> 			priv->points[2].y = sy1 + (sy2 - sy1) / 2;
303,313c346,447
< 		priv->points[2].x = px2 + MIN_SPACING;
< 		priv->points[2].y = y;
< 
< 		priv->points[3].x = sx1 - ARROW_SIZE - MIN_SPACING;
< 		priv->points[3].y = y;
< 		
< 		priv->points[4].x = sx1 - ARROW_SIZE - MIN_SPACING;
< 		priv->points[4].y = sy1 + (sy2 - sy1) / 2;
< 
< 		priv->points[5].x = sx1;
< 		priv->points[5].y = sy1 + (sy2 - sy1) / 2;
---
> 		priv->points[3].x = sx2;
> 		priv->points[3].y = sy1 + (sy2 - sy1) / 2;
> 	}else if(type == MRP_RELATION_SF){
> 		/* Two cases for SF, as shown at the top of this file. */
> 		if (px1 >= sx2) {
> 			priv->num_points = 3;
> 	
> 			priv->points[0].x = px1;
> 			priv->points[0].y = py1 + (py2 - py1) / 2;
> 	
> 			priv->points[1].x = MIN (px1 - MIN_SPACING, sx2);
> 			priv->points[1].y = py1 + (py2 - py1) / 2;
> 	
> 			priv->points[2].x = MIN (px1 - MIN_SPACING, sx2);
> 			if (sy1 > py1) {
> 				priv->points[2].y = sy1;
> 				priv->arrow_dir = PLANNER_ARROW_DOWN;
> 			} else {
> 				priv->points[2].y = sy2;
> 				priv->arrow_dir = PLANNER_ARROW_UP;
> 			}
> 	
> 			
> 		} else {
> 			priv->num_points = 6;
> 			priv->arrow_dir = PLANNER_ARROW_LEFT;
> 	
> 			priv->points[0].x = px1;
> 			priv->points[0].y = py1 + (py2 - py1) / 2;
> 	
> 			priv->points[1].x = px1 - MIN_SPACING;
> 			priv->points[1].y = py1 + (py2 - py1) / 2;
> 	
> 	 		if (sy1 > py1) {
> 				y = py2 + (py2 - py1) / 2 - 1;
> 			} else {
> 				y = py1 - (py2 - py1) / 2 + 2;
> 			}
> 			
> 			priv->points[2].x = px1 - MIN_SPACING;
> 			priv->points[2].y = y;
> 	
> 			priv->points[3].x = sx2 + ARROW_SIZE + MIN_SPACING;
> 			priv->points[3].y = y;
> 			
> 			priv->points[4].x = sx2 + ARROW_SIZE + MIN_SPACING;
> 			priv->points[4].y = sy1 + (sy2 - sy1) / 2;
> 	
> 			priv->points[5].x = sx2;
> 			priv->points[5].y = sy1 + (sy2 - sy1) / 2;
> 		}
> 	
> 	
> 	}else{
> 		/* Two cases for FS, as shown at the top of this file. */
> 		if (px2 <= sx1) {
> 			priv->num_points = 3;
> 	
> 			priv->points[0].x = px2;
> 			priv->points[0].y = py1 + (py2 - py1) / 2;
> 	
> 			priv->points[1].x = MAX (px2 + MIN_SPACING, sx1);
> 			priv->points[1].y = py1 + (py2 - py1) / 2;
> 	
> 			priv->points[2].x = MAX (px2 + MIN_SPACING, sx1);
> 			if (sy1 > py1) {
> 				priv->points[2].y = sy1;
> 				priv->arrow_dir = PLANNER_ARROW_DOWN;
> 			} else {
> 				priv->points[2].y = sy2;
> 				priv->arrow_dir = PLANNER_ARROW_UP;
> 			}
> 	
> 			
> 		} else {
> 			priv->num_points = 6;
> 			priv->arrow_dir = PLANNER_ARROW_RIGHT;
> 	
> 			priv->points[0].x = px2;
> 			priv->points[0].y = py1 + (py2 - py1) / 2;
> 	
> 			priv->points[1].x = px2 + MIN_SPACING;
> 			priv->points[1].y = py1 + (py2 - py1) / 2;
> 	
> 	 		if (sy1 > py1) {
> 				y = py2 + (py2 - py1) / 2 - 1;
> 			} else {
> 				y = py1 - (py2 - py1) / 2 + 2;
> 			}
> 			
> 			priv->points[2].x = px2 + MIN_SPACING;
> 			priv->points[2].y = y;
> 	
> 			priv->points[3].x = sx1 - ARROW_SIZE - MIN_SPACING;
> 			priv->points[3].y = y;
> 			
> 			priv->points[4].x = sx1 - ARROW_SIZE - MIN_SPACING;
> 			priv->points[4].y = sy1 + (sy2 - sy1) / 2;
> 	
> 			priv->points[5].x = sx1;
> 			priv->points[5].y = sy1 + (sy2 - sy1) / 2;
> 		}
315c449
< 
---
> 	
434c568
< planner_relation_arrow_new (PlannerGanttRow *successor, PlannerGanttRow *predecessor)
---
> planner_relation_arrow_new (PlannerGanttRow *successor, PlannerGanttRow *predecessor, MrpRelationType type)
448c582
< 	
---
> 	arrow->priv->type = type;
Index: src/planner-relation-arrow.h
===================================================================
RCS file: /cvs/gnome/planner/src/planner-relation-arrow.h,v
retrieving revision 1.2
diff -r1.2 planner-relation-arrow.h
55c55,56
< 					     PlannerGanttRow *predecessor);
---
> 					     PlannerGanttRow *predecessor,
> 					     MrpRelationType type);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]