コード例 #1
0
 public function routeToBpmnGateway($objectBpmnType, $objectUid, $objectBouX, $objectBouY, $objectBouWidth, $objectBouHeight, $gatewayName, $gatewayType, $gatewayDirection)
 {
     try {
         $gatewayBouWidth = 45;
         $gatewayBouHeight = $gatewayBouWidth;
         $gatewayBouWidth2 = (int) ($gatewayBouWidth / 2);
         $gatewayBouHeight2 = (int) ($gatewayBouHeight / 2);
         //
         $objectBouWidth2 = (int) ($objectBouWidth / 2);
         $objectBouHeight2 = (int) ($objectBouHeight / 2);
         //Gateway
         $gatewayBouX = $objectBouX + $objectBouWidth2 - $gatewayBouWidth2;
         $gatewayBouY = $gatewayDirection == "DIVERGING" ? $objectBouY + $objectBouHeight + $gatewayBouHeight2 : $objectBouY - $gatewayBouHeight - $gatewayBouHeight2;
         $arrayData = array("GAT_NAME" => $gatewayName, "GAT_TYPE" => $gatewayType, "GAT_DIRECTION" => $gatewayDirection, "GAT_DEFAULT_FLOW" => "0", "BOU_X" => $gatewayBouX, "BOU_Y" => $gatewayBouY, "BOU_WIDTH" => $gatewayBouWidth, "BOU_HEIGHT" => $gatewayBouHeight);
         $gatewayUid = $this->bp->addGateway($arrayData);
         //Flow
         if ($gatewayDirection == "DIVERGING") {
             $flowX1 = $objectBouX + $objectBouWidth2;
             $flowY1 = $objectBouY + $objectBouHeight;
             $flowX2 = $flowX1;
             $flowY2 = $gatewayBouY;
         } else {
             $flowX1 = $objectBouX + $objectBouWidth2;
             $flowY1 = $gatewayBouY + $gatewayBouHeight;
             $flowX2 = $flowX1;
             $flowY2 = $objectBouY;
         }
         $arrayData = array("FLO_TYPE" => "SEQUENCE", "FLO_ELEMENT_ORIGIN" => $gatewayDirection == "DIVERGING" ? $objectUid : $gatewayUid, "FLO_ELEMENT_ORIGIN_TYPE" => $gatewayDirection == "DIVERGING" ? $objectBpmnType : "bpmnGateway", "FLO_ELEMENT_DEST" => $gatewayDirection == "DIVERGING" ? $gatewayUid : $objectUid, "FLO_ELEMENT_DEST_TYPE" => $gatewayDirection == "DIVERGING" ? "bpmnGateway" : $objectBpmnType, "FLO_IS_INMEDIATE" => 1, "FLO_CONDITION" => "", "FLO_X1" => $flowX1, "FLO_Y1" => $flowY1, "FLO_X2" => $flowX2, "FLO_Y2" => $flowY2, "FLO_STATE" => json_encode(array(array("x" => $flowX1, "y" => $flowY1), array("x" => $flowX1, "y" => $flowY2 - 5), array("x" => $flowX2, "y" => $flowY2 - 5), array("x" => $flowX2, "y" => $flowY2))));
         $flowUid = $this->bp->addFlow($arrayData);
         //Return
         return $gatewayUid;
     } catch (\Exception $e) {
         throw $e;
     }
 }