private function _build() { $deploy = $this->_get_deploy(); // get domains $domains = array(); foreach ($deploy->{'domains'} as $d) { $domain = Domain::fromJson($d); $domains[$domain->getId()] = $domain; Logger::debug("load domain %s", $domain->toString()); } // get layers foreach ($deploy->{'layers'} as $l) { $domain = $domains[$l->{'domain_id'}]; $layer = new Layer($l->{'id'}, $domain); $this->_layers[$l->{'id'}] = $layer; Logger::debug("load layer %s", $layer->toString()); } // assign experiments foreach ($deploy->{'experiments'} as $e) { $exp = Experiment::fromJson($e); $this->_exps[$exp->getId()] = $exp; $layer = $this->_layers[$exp->getLayerId()]; $layer->assign($exp); Logger::debug("load exp %s", $exp->toString()); } foreach ($deploy->{'parameters'} as $p) { $param = Parameter::fromJson($p); $this->_baseParams[$param->getName()] = $param->getValue(); Logger::debug("load param %s => %s", $param->getName(), $param->getValue()); } }
public function renderCell($x, $y) { $cell = $this->layer->getCell($x, $y); if (empty($cell)) { exit($x . ' ' . $y); } return $this->render($cell); }
public static function DisplayTopper($idtopper) { $cakeid = $_SESSION['cakeModelID']; $Layer = Layer::where('id', '=', $idtopper)->get(); if ($Layer != NULL) { foreach ($Layer as $Layers) { } return $Layers['image']; } else { return $idtopper; } }
public static function constructFromArray($props) { $layers = array(); if (isset($props['layers'])) { foreach ($props['layers'] as $layer) { if ($layer instanceof Layer) { $layers[] = $layer; } else { $layers[] = Layer::constructFromArray($layer); } } } $directions = array(); if (isset($props['directions'])) { foreach ($props['directions'] as $direction) { switch ($direction['directionType']) { case 'metronome': $directions[] = DirectionMetronome::constructFromArray($direction); break; case 'dynamics': $directions[] = DirectionDynamics::constructFromArray($direction); break; default: } } } if ($props['time'] instanceof Time) { $time = $props['time']; } else { $time = Time::constructFromArray($props['time']); } if ($props['clef'] instanceof Clef) { $clef = $props['clef']; } else { $clef = Clef::constructFromArray($props['clef']); } if ($props['key'] instanceof Key) { $key = $props['key']; } else { $key = Key::constructFromArray($props['key']); } $divisions = $props['divisions']; if ($props['barline'] instanceof Barline) { $barline = $props['barline']; } else { $barline = Barline::constructFromArray($props['barline']); } $implicit = $props['implicit']; $nonControlling = $props['nonControlling']; $width = $props['width']; return new Measure($layers, $directions, $time, $clef, $key, $divisions, $barline, $implicit, $nonControlling, $width); }
/** * @uses Neuron::setDelta() * @uses Neuron::getWeight() * @uses Neuron::getDelta() * @uses Neuron::getOutput() * @uses getNeurons() */ public function calculateHiddenDeltas() { $floatDelta = 0; $floatSum = 0; $arrNeuronsNextLayer = $this->objNextLayer->getNeurons(); /* @var $objNeuron Neuron */ foreach ($this->arrNeurons as $intKeyNeuron => $objNeuron) { /* @var $objNeuronNextLayer Neuron */ foreach ($arrNeuronsNextLayer as $objNeuronNextLayer) { $floatSum += $objNeuronNextLayer->getWeight($intKeyNeuron) * $objNeuronNextLayer->getDelta() * $this->objNetwork->floatMomentum; } $floatOutput = $objNeuron->getOutput(); $floatDelta = $floatOutput * (1 - $floatOutput) * $floatSum; $objNeuron->setDelta($floatDelta); } }
function parseLayers() { $layerParameters = array("name", "group", "type", "projection", "connection", "connectiontype", "data", "filter", "opacity", "minscaledenom", "maxscaledenom", "labelitem", "labelminscaledenom", "labelmaxscaledenom", "vue_defaut"); $layerMetaData = array("wms_name", "wms_title", "wms_group_title", "wfs_maxfeatures", "gml_include_items", "gml_exclude_items", "ows_exclude_items", "ows_include_items", "msp_classe_meta", "wms_attribution_title", "layer_name_igo"); $layerZIndex = array('LINE' => 2001, 'POINT' => 3001, 'POLYGON' => 1001, 'RASTER' => 1, 'CHART' => 5000, 'CIRCLE' => 1001, 'QUERY' => 0, 'ANNOTATION' => 4001, 'TILEINDEX' => 1001); $baseIndex = -1; $index = -1; $layers = array(); //Parse layers for ($i = 0; $i < $this->oMap->numlayers; $i++) { //create new layer object $layer = new Layer($this->oMap->getLayer($i)); //Create new empty hash array to store layer data $l = array(); //Get some layer parameters foreach ($layerParameters as $parameter) { $l[$parameter] = $layer->getParam($parameter); } //Get some metadata foreach ($layerMetaData as $metaData) { $metaDataValue = $layer->getMeta($metaData); $l[$metaData] = $metaDataValue; if ('layer_name_igo' == $metaData && $metaDataValue) { $l['name'] = $metaDataValue; } } //Get other parameters as plain text $l['layer_def'] = $layer->getLayerDef($layerParameters); //Get other metadata as plain text $l['meta_def'] = $layer->getMetaDef($layerMetaData); //Get attributes $l['attributes'] = $layer->getAttributes(); //Parse layer classes $classes = $layer->getClasses(); $l['classes'] = array(); foreach ($classes as $class) { $l['classes'][] = utf8_encode($class->convertToString()); } if ($layerZIndex[$l['type']] > $baseIndex && $layerZIndex[$l['type']] > $index) { $index = $layerZIndex[$l['type']]; } else { $index += 1; } $baseIndex = $layerZIndex[$l['type']]; $l['zIndex'] = $index; $layers[] = $l; } return $layers; }
/** * @uses Layer::getNeurons() * @uses Logging::logData() * @uses Neuron::getWeights() * @uses getNetworkError() */ protected function logWeights() { $arrData = array(); $arrData['E'] = $this->getNetworkError(); // ****** arrHiddenLayers **************** foreach ($this->arrHiddenLayers as $intKeyLayer => $objHiddenLayer) { $arrNeurons = $objHiddenLayer->getNeurons(); foreach ($arrNeurons as $intKeyNeuron => $objNeuron) { foreach ($objNeuron->getWeights() as $intKeyWeight => $weight) { $arrData["H{$intKeyLayer}-N{$intKeyNeuron}-W{$intKeyWeight}"] = round($weight, 5); } } } // ****** objOutputLayer ***************** $arrNeurons = $this->objOutputLayer->getNeurons(); foreach ($arrNeurons as $intKeyNeuron => $objNeuron) { foreach ($objNeuron->getWeights() as $intKeyWeight => $weight) { $arrData["O-N{$intKeyNeuron}-W{$intKeyWeight}"] = round($weight, 5); } } // ************************************ $this->objLoggingWeights->logData($arrData); }
public function createLayersForCxn($cxn, $data) { $layerType = new LayerType(); $layerTypes = $layerType->listToConstruction(); foreach ($layerTypes as $lt) { $layer = new Layer(); $layer->setIdLayerType($lt['idLayerType']); $layer->setIdAnnotationSet($this->getId()); $layer->setRank(1); $layer->save(); } // obtem as relações CXN-FR e cria as camadas FE $layerCEFE = $layerType->listCEFE(); $er = new EntityRelation(); $relations = $er->listCxnFrameRelations($cxn->getIdEntity())->asQuery()->getResult(); foreach ($relations as $relation) { $layer = new Layer(); $layer->setIdLayerType($layerCEFE[0]['idLayerType']); $layer->setIdAnnotationSet($this->getId()); $layer->setRank(1); $layer->save(); } }
ini_set('display_errors', 1); ?> <html> <head> <meta name="viewport" content="initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"> <?php require_once '../PHPMusicXML.php'; $scale = new Scale(array('root' => new Pitch('C4'), 'mode' => 'prometheus')); $measureOptions = array('divisions' => 4, 'key' => new Key('C major'), 'time' => array('beats' => 6, 'beat-type' => 8), 'clef' => array(new Clef('treble'), new Clef('bass')), 'barline' => array(new Barline(array('location' => 'left', 'bar-style' => 'light-heavy', 'repeat' => array('direction' => 'forward', 'winged' => 'none'), 'ending' => array('type' => 'stop', 'number' => 1))), new Barline(array('location' => 'right', 'bar-style' => 'heavy-light', 'repeat' => array('direction' => 'backward'), 'ending' => array('type' => 'stop', 'number' => 2)))), 'implicit' => false, 'non-controlling' => false, 'number' => 1, 'width' => 180); $pitches = $scale->getPitches(); //var_dump($pitches); $score = new Score(); $part = new Part('Piano'); $measure = new Measure($measureOptions); $layer = new Layer(); foreach ($pitches as $pitch) { $note = new Note(array('pitch' => $pitch, 'duration' => 4, 'type' => 'quarter')); $layer->addNote($note); // this essentially adds a chord with only one note in it. } $measure->addLayer($layer); $newlayer = clone $layer; $newlayer->transpose(-12); $measure->addLayer($newlayer); // puts this layer in staff two $newlayer->setStaff(2); for ($i = 0; $i < 12; $i++) { $newmeasure = clone $measure; $newmeasure->transpose($i, -1); $part->addMeasure($newmeasure);
/** * @param Layer layer * @return Cluster */ public function setLayer(Layer $layer) { $this->set($layer->getName(), $layer->getValue()); return $this; }
public static function handleExecuteCommandRequest(Layer $layer, $command, $args = []) { return static::respond('commandExecuted', ['layer' => $layer, 'command' => $command, 'args' => $args, 'output' => $layer->getGitWrapper()->run($command, $args)]); }
/** * Create a server from an array of LayerDefinitions * * @param LayerDefinition[] $definitions * @return LayarPOIServer */ public function createLayarPOIServerFromLayerDefinitions(array $definitions) { $result = new LayarPOIServer(); foreach ($definitions as $definition) { $layer = new Layer($definition->name, $this->developerId, $this->developerKey); if ($definition->getSourceType() == LayerDefinition::DSN) { $poiConnector = new $definition->connector($definition->source["dsn"], $definition->source["username"], $definition->source["password"]); } else { if ($definition->getSourceType() == LayerDefinition::FILE) { $poiConnector = new $definition->connector($definition->source); } } foreach ($definition->connectorOptions as $optionName => $option) { $poiConnector->setOption($optionName, $option); } // for WebApi: pass full definition object if (method_exists($poiConnector, 'initDefinition')) { $poiConnector->initDefinition($definition); } $layer->setPOIConnector($poiConnector); $result->addLayer($layer); } return $result; }