public static function add($object, &$notFoundObjects) { // get OBJECT self::$object = $object; // Get NODES, MEMBERS self::$nodes = \Classes\Factory\Model\Model::getNodes(); self::$members = \Classes\Factory\Model\Model::getMembers(); //Get TABLES self::$hashTable = \Classes\Factory\Model\Model::getHashTable(); self::$loadTable = \Classes\Factory\Model\Model::getLoadTable(); // Set FOUND to FALSE self::$isFound = FALSE; self::$loads = array(); self::$notFoundObject = array(); //Get Properties self::$loadCase = $object->getProperty('loadCase'); self::$name = $object->getProperty('name'); $isDirectionCorrect = \Classes\Utils\Load\LoadDirection::get(self::$direction, $object->getProperty('direction')->get()); if (!$isDirectionCorrect) { throw new \Classes\Exception\Factory\Model\Addition\MemberLoadAddition\IncorrectDirectionException('Incorrect Load Direction'); } // Make direction Property self::$direction = new \Classes\Value\IntValue(self::$direction); self::$x1 = $object->getProperty('x1'); self::$y1 = $object->getProperty('y1'); self::$z1 = $object->getProperty('z1'); self::$value1 = $object->getProperty('value1'); // Check type of load $type = $object->getProperty('type')->get(); // Load type isn't correct if ($type != "C" && $type != "D") { throw new \Classes\Exception\Factory\Model\Addition\MemberLoadAddition\IncorrectTypeException('Incorrect Load Type'); } if ($type == "C") { // If $object will not be found // $object itself will be returned self::$notFoundObject = array(self::$object); // TRY TO APPLY TO NODE self::addNodeConcentratedLoad(); // TRY TO APPLY TO MEMBER if (!self::$isFound) { self::addMemberConcentratedLoad(); } } if ($type == "D") { self::addmemberDistributedLoad(); } foreach (self::$loads as $load) { // Set Properties $load->setProperty('loadCase', self::$loadCase); $load->setProperty('name', self::$name); $load->setProperty('direction', self::$direction); // Add to model \Classes\Factory\Model\Model::addInstance($load); } // If $object is NOT applied if (!self::$isFound) { // Return not found objects $notFoundObjects = self::$notFoundObject; return FALSE; } return TRUE; }
private static function getLoadProperties($load) { //Get Properties self::$loadCase = $load->getProperty('loadCase'); self::$name = $load->getProperty('name'); $isDirectionCorrect = \Classes\Utils\Load\LoadDirection::get(self::$direction, $load->getProperty('direction')->get()); if (!$isDirectionCorrect) { throw new \Classes\Exception\Factory\Model\Addition\MemberLoadAddition\IncorrectDirectionException('Incorrect Load Direction'); } // Make direction Property self::$direction = new \Classes\Value\IntValue(self::$direction); self::$x1 = $load->getProperty('x1'); self::$y1 = $load->getProperty('y1'); self::$z1 = $load->getProperty('z1'); self::$value1 = $load->getProperty('value1'); self::$x2 = $load->getProperty('x2'); self::$y2 = $load->getProperty('y2'); self::$z2 = $load->getProperty('z2'); self::$value2 = $load->getProperty('value2'); }