function StrokeConstrains() { $n = count($this->iObj); for ($i = 0; $i < $n; ++$i) { if (empty($this->iObj[$i]->constraints)) { continue; } $numConstrains = count($this->iObj[$i]->constraints); for ($k = 0; $k < $numConstrains; $k++) { $vpos = $this->iObj[$i]->constraints[$k]->iConstrainRow; if ($vpos >= 0) { $c1 = $this->iObj[$i]->iConstrainPos; $targetobj = -1; for ($j = 0; $j < $n && $targetobj == -1; ++$j) { if ($this->iObj[$j]->iVPos == $vpos) { $targetobj = $j; } } if ($targetobj == -1) { JpGraphError::RaiseL(6008, $this->iObj[$i]->iVPos, $vpos); } $c2 = $this->iObj[$targetobj]->iConstrainPos; if (count($c1) == 4 && count($c2) == 4) { switch ($this->iObj[$i]->constraints[$k]->iConstrainType) { case CONSTRAIN_ENDSTART: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[2], $c1[3], $c2[0], $c2[1]); } else { $link = new GanttLink($c1[2], $c1[1], $c2[0], $c2[3]); } $link->SetPath(3); break; case CONSTRAIN_STARTEND: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[0], $c1[3], $c2[2], $c2[1]); } else { $link = new GanttLink($c1[0], $c1[1], $c2[2], $c2[3]); } $link->SetPath(0); break; case CONSTRAIN_ENDEND: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[2], $c1[3], $c2[2], $c2[1]); } else { $link = new GanttLink($c1[2], $c1[1], $c2[2], $c2[3]); } $link->SetPath(1); break; case CONSTRAIN_STARTSTART: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[0], $c1[3], $c2[0], $c2[1]); } else { $link = new GanttLink($c1[0], $c1[1], $c2[0], $c2[3]); } $link->SetPath(3); break; default: JpGraphError::RaiseL(6009, $this->iObj[$i]->iVPos, $vpos); break; } $link->SetColor($this->iObj[$i]->constraints[$k]->iConstrainColor); $link->SetArrow($this->iObj[$i]->constraints[$k]->iConstrainArrowSize, $this->iObj[$i]->constraints[$k]->iConstrainArrowType); $link->Stroke($this->img); } } } } }
function StrokeConstrains() { $n = count($this->iObj); // Stroke all constrains for ($i = 0; $i < $n; ++$i) { // Some gantt objects may not have constraints associated with them // for example we can add IconPlots which doesn't have this property. if (empty($this->iObj[$i]->constraints)) { continue; } $numConstrains = count($this->iObj[$i]->constraints); for ($k = 0; $k < $numConstrains; $k++) { $vpos = $this->iObj[$i]->constraints[$k]->iConstrainRow; if ($vpos >= 0) { $c1 = $this->iObj[$i]->iConstrainPos; // Find out which object is on the target row $targetobj = -1; for ($j = 0; $j < $n && $targetobj == -1; ++$j) { if ($this->iObj[$j]->iVPos == $vpos) { $targetobj = $j; } } if ($targetobj == -1) { JpGraphError::RaiseL(6008, $this->iObj[$i]->iVPos, $vpos); //('You have specifed a constrain from row='.$this->iObj[$i]->iVPos.' to row='.$vpos.' which does not have any activity.'); } $c2 = $this->iObj[$targetobj]->iConstrainPos; if (count($c1) == 4 && count($c2) == 4) { switch ($this->iObj[$i]->constraints[$k]->iConstrainType) { case CONSTRAIN_ENDSTART: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[2], $c1[3], $c2[0], $c2[1]); } else { $link = new GanttLink($c1[2], $c1[1], $c2[0], $c2[3]); } $link->SetPath(3); break; case CONSTRAIN_STARTEND: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[0], $c1[3], $c2[2], $c2[1]); } else { $link = new GanttLink($c1[0], $c1[1], $c2[2], $c2[3]); } $link->SetPath(0); break; case CONSTRAIN_ENDEND: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[2], $c1[3], $c2[2], $c2[1]); } else { $link = new GanttLink($c1[2], $c1[1], $c2[2], $c2[3]); } $link->SetPath(1); break; case CONSTRAIN_STARTSTART: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[0], $c1[3], $c2[0], $c2[1]); } else { $link = new GanttLink($c1[0], $c1[1], $c2[0], $c2[3]); } $link->SetPath(3); break; default: JpGraphError::RaiseL(6009, $this->iObj[$i]->iVPos, $vpos); //('Unknown constrain type specified from row='.$this->iObj[$i]->iVPos.' to row='.$vpos); break; } $link->SetColor($this->iObj[$i]->constraints[$k]->iConstrainColor); $link->SetArrow($this->iObj[$i]->constraints[$k]->iConstrainArrowSize, $this->iObj[$i]->constraints[$k]->iConstrainArrowType); $link->Stroke($this->img); } } } } }
function StrokeConstrains() { $n = count($this->iObj); // Stroke all constrains for ($i = 0; $i < $n; ++$i) { $vpos = $this->iObj[$i]->iConstrainRow; if ($vpos >= 0) { $c1 = $this->iObj[$i]->iConstrainPos; // Find out which object is on the target row $targetobj = -1; for ($j = 0; $j < $n && $targetobj == -1; ++$j) { if ($this->iObj[$j]->iVPos == $vpos) { $targetobj = $j; } } if ($targetobj == -1) { JpGraphError::Raise('You have specifed a constrain from row=' . $this->iObj[$i]->iVPos . ' to row=' . $vpos . ' which does not have any activity.'); exit; } $c2 = $this->iObj[$targetobj]->iConstrainPos; if (count($c1) == 4 && count($c2) == 4) { switch ($this->iObj[$i]->iConstrainType) { case CONSTRAIN_ENDSTART: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[2], $c1[3], $c2[0], $c2[1]); } else { $link = new GanttLink($c1[2], $c1[1], $c2[0], $c2[3]); } $link->SetPath(3); break; case CONSTRAIN_STARTEND: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[0], $c1[3], $c2[2], $c2[1]); } else { $link = new GanttLink($c1[0], $c1[1], $c2[2], $c2[3]); } $link->SetPath(0); break; case CONSTRAIN_ENDEND: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[2], $c1[3], $c2[2], $c2[1]); } else { $link = new GanttLink($c1[2], $c1[1], $c2[2], $c2[3]); } $link->SetPath(1); break; case CONSTRAIN_STARTSTART: if ($c1[1] < $c2[1]) { $link = new GanttLink($c1[0], $c1[3], $c2[0], $c2[1]); } else { $link = new GanttLink($c1[0], $c1[1], $c2[0], $c2[3]); } $link->SetPath(3); break; default: JpGraphError::Raise('Unknown constrain type specified from row=' . $this->iObj[$i]->iVPos . ' to row=' . $vpos); break; } $link->SetColor($this->iObj[$i]->iConstrainColor); $link->SetArrow($this->iObj[$i]->iConstrainArrowSize, $this->iObj[$i]->iConstrainArrowType); $link->Stroke($this->img); } } } }