Exemplo n.º 1
0
        private void Map_LayerAdded(object sender, LayerEventArgs e)
        {
            if (e.Layer == null)
                return;

            AddContextMenuItems(e.Layer);
        }
Exemplo n.º 2
0
        private void OnLearningNeuralNet(float[][] expectedSignals, int numberOfActiveDataset)
        {
            try
            {
                LayerEventArgs learningEventArgs = new LayerEventArgs();
                learningEventArgs.ActivationFunc          = ActivationFunc;
                learningEventArgs.LearningOptimizing      = LearningOptimizing;
                learningEventArgs.LearningRate            = LearningRate;
                learningEventArgs.MomentumRate            = MomentumRate;
                learningEventArgs.ExpectedSignalsOutLayer = expectedSignals;
                learningEventArgs.NumberOfActiveDataset   = numberOfActiveDataset;
                (_NeuralLayers.Last.Value as NeuralLayer).Learning(this, learningEventArgs);
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("\nInnerException: " + ex.InnerException);
                Console.WriteLine("\nMessage: " + ex.Message);
                Console.WriteLine("\nSource: " + ex.Source);
                Console.WriteLine("\nTargetSite: " + ex.TargetSite);
                Console.WriteLine("\nStackTrace: ");
                Console.WriteLine("\n" + ex.StackTrace);
                Console.ReadKey();

                //Logger.Fatal(exception.Message);
                //LogManager.Flush();
                //LogManager.Shutdown();
                //Environment.Exit(0);
            }
        }
 internal virtual void OnLayerCongifurationStarted(LayerEventArgs args)
 {
     if (LayerConfigurationStarted != null)
     {
         LayerConfigurationStarted(this, args);
     }
 }
Exemplo n.º 4
0
 private void FireEvent(EventHandler <LayerEventArgs> handler, LayerEventArgs args)
 {
     if (handler != null)
     {
         handler(null, args);
     }
 }
Exemplo n.º 5
0
 private void MapFrameOnLayerRemoved(object sender, LayerEventArgs e)
 {
     if (e.Layer == _activeLayer)
     {
         _activeLayer = null;
     }
 }
Exemplo n.º 6
0
 private void LayerAddedHandler(object sender, LayerEventArgs e)
 {
     if (_undoRedoEnabled && !_restoringState && _trackingEnabled)
     {
         SaveState();
     }
 }
Exemplo n.º 7
0
 private static void DrawExtraLayer(Layer layer, LayerEventArgs layerEventArgs)
 {
     if (layer.Id != "Front")
     {
         layer.Draw(Game1.mapDisplayDevice, layerEventArgs.Viewport, new xTile.Dimensions.Location(0, 0), false, Game1.pixelZoom);
     }
 }
Exemplo n.º 8
0
 protected override void CalculateDeltasErrorsForThisLayer(LayerEventArgs nextLayerEventArgs)
 {
     _DeltasErrorsOfNeurons = Backpropagation.GetDeltasOutputLayer(
         _OutputSignals[(int)nextLayerEventArgs.NumberOfActiveDataset],
         nextLayerEventArgs.ExpectedSignalsOutLayer[(int)nextLayerEventArgs.NumberOfActiveDataset],
         nextLayerEventArgs.ActivationFunc);
 }
 protected virtual void OnLayerSelectionChanged(LayerEventArgs args)
 {
     if (LayerSelectionChanged != null)
     {
         LayerSelectionChanged(this, args);
     }
 }
Exemplo n.º 10
0
        private static void Layer_Draw(LayerEventArgs layerEventArgs, string drawProperty, Dictionary <Layer, List <Layer> > cache)
        {
            if (cache.TryGetValue(layerEventArgs.Layer, out List <Layer> extraLayers))
            {
                extraLayers.ForEach((extralayer) => DrawExtraLayer(extralayer, layerEventArgs));
                return;
            }

            cache.Add(layerEventArgs.Layer, new List <Layer>());

            layerEventArgs.Layer.Map.Layers
            .Where(l => l.Properties.TryGetValue(UseProperty, out PropertyValue value) &&
                   value.ToString().Split(' ') is string[] p &&
                   p.Length >= 2 &&
                   p[0] == drawProperty &&
                   p[1] == layerEventArgs.Layer.Id &&
                   (!l.Properties.TryGetValue(UseConditionProperty, out PropertyValue conditions) || Plato.CheckConditions(conditions.ToString(), l))
                   )
            .ToList()
            .ForEach((l) => {
                if (!cache[layerEventArgs.Layer].Contains(l))
                {
                    cache[layerEventArgs.Layer].Add(l);
                }
            });

            Layer_Draw(layerEventArgs, drawProperty, cache);
        }
Exemplo n.º 11
0
        private LayerEventArgs OnActivationNeuralNet(float[][] inputsSignals, int?numberOfActiveDataset = null)
        {
            try
            {
                LayerEventArgs activationEventArgs = new LayerEventArgs();
                activationEventArgs.ActivationFunc          = ActivationFunc;
                activationEventArgs.OutputsSignalsPrevLayer = inputsSignals;
                activationEventArgs.NumberOfActiveDataset   = numberOfActiveDataset;
                (_NeuralLayers.First.Value as NeuralLayer).Activate(this, activationEventArgs);
                return(activationEventArgs);
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("\nInnerException: " + ex.InnerException);
                Console.WriteLine("\nMessage: " + ex.Message);
                Console.WriteLine("\nSource: " + ex.Source);
                Console.WriteLine("\nTargetSite: " + ex.TargetSite);
                Console.WriteLine("\nStackTrace: ");
                Console.WriteLine("\n" + ex.StackTrace);
                Console.ReadKey();

                //Logger.Fatal(exception.Message);
                //LogManager.Flush();
                //LogManager.Shutdown();
                //Environment.Exit(0);
            }
            return(null);
        }
Exemplo n.º 12
0
 protected virtual void OnLayerAdded(LayerEventArgs e)
 {
     if (LayerAdded != null)
     {
         LayerAdded(this, e);
     }
 }
Exemplo n.º 13
0
 private void LayerDoubleClicked(IMuteLegend legend, LayerEventArgs e)
 {
     if (FormHelper.ShowLayerProperties(_context))
     {
         e.Handled = true;
     }
 }
Exemplo n.º 14
0
 private void Map_LayerAdded(object sender, LayerEventArgs e)
 {
     if (e.Layer == null)
     {
         return;                  //occurs when moving layer
     }
     AttachLayerToPlugin(e.Layer);
 }
Exemplo n.º 15
0
        private void plugin_LayerAdded(IMuteLegend legend, LayerEventArgs e)
        {
            var layer = _context.Legend.Layers.ItemByHandle(e.LayerHandle);

            if (layer != null)
            {
                LayerSerializationHelper.LoadSettings(layer, _broadcaster, true);
            }
        }
Exemplo n.º 16
0
 protected virtual void ActionByFull(LayerEventArgs layerEventArgs)
 {
     _InputSignals  = layerEventArgs.OutputsSignalsPrevLayer;
     _OutputSignals = Feedforward.GetOutputSignalsOfAllSamples(
         _InputSignals,
         _NeuronWeights,
         layerEventArgs.ActivationFunc,
         _BiasWeights);
 }
Exemplo n.º 17
0
        private void OnLayerDelete(object sender, LayerEventArgs e)
        {
            if (m_layerDelete == null)
            {
                return;
            }

            m_layerDelete(e);
        }
Exemplo n.º 18
0
        private void OnLayerNew(object sender, LayerEventArgs e)
        {
            if (m_layerNew == null)
            {
                return;
            }

            m_layerNew(e);
        }
Exemplo n.º 19
0
        private void OnLayerProperties(object sender, LayerEventArgs e)
        {
            if (m_layerProperties == null)
            {
                return;
            }

            m_layerProperties(e);
        }
Exemplo n.º 20
0
 private void Layers_LayerRemoved(object sender, LayerEventArgs e)
 {
     if (e.Layer == this._ActiveLayer)
     {
         this._RemovedLayer = this._ActiveLayer;
         this._ActiveLayer  = null;
         this.OnActiveLayerChanged(EventArgs.Empty);
     }
 }
Exemplo n.º 21
0
 private void MapFrameOnLayerRemoved(object sender, LayerEventArgs e)
 {
     if (e.Layer == _activeLayer)
     {
         // _activeLayer = null;
         SetActiveLayer(null);
         RemoveSnapLayer(e.Layer);
     }
 }
Exemplo n.º 22
0
 private void DrawAlwaysFrontFeatures(object s, LayerEventArgs e)
 {
     if (AlphaFeatures.ContainsKey(Game1.currentLocation?.Name))
     {
         foreach (var feature in AlphaFeatures[Game1.currentLocation.Name].Where(_ => _.Type == FeatureType.BelowAlwaysFront))
         {
             feature.Render(Game1.spriteBatch);
         }
     }
 }
Exemplo n.º 23
0
 public virtual void Learning(object sender, LayerEventArgs nextLayerEventArgs)
 {
     CalculateDeltasErrorsForThisLayer(nextLayerEventArgs);
     OnLearningPrevLayer(nextLayerEventArgs);
     UpdateWeightsForNeurons(nextLayerEventArgs);
     if (_BiasWeights != null)
     {
         UpdateWeightsForBias(nextLayerEventArgs);
     }
 }
Exemplo n.º 24
0
 private static void drawTerraformLayer(object sender, LayerEventArgs e)
 {
     foreach (var layer in e.Layer.Map.Layers)
     {
         if (layer.Id.StartsWith(e.Layer.Id + "Terraform"))
         {
             layer.Draw(Game1.mapDisplayDevice, Game1.viewport, xTile.Dimensions.Location.Origin, false, Game1.pixelZoom);
         }
     }
 }
Exemplo n.º 25
0
        /// <summary>
        /// Intra-layer drawing event handler for rendering wind-swept leaves
        /// </summary>
        /// <param name="layerEventArgs"></param>
        private void OnBeforeLayerDraw(object sender, LayerEventArgs layerEventArgs)
        {
            SpriteBatch spriteBatch = m_xnaDisplayDevice.SpriteBatchAlpha;

            foreach (Vector2 vecLeaf in m_vecLeafPositions)
            {
                float fRotation = ((vecLeaf.X + vecLeaf.Y) * 0.01f) % MathHelper.TwoPi;
                spriteBatch.Draw(m_textureLeaf, vecLeaf, null, Color.White, fRotation, Vector2.Zero, 1.0f, SpriteEffects.None, 0.0f);
            }
        }
Exemplo n.º 26
0
 private void DrawBuildingFeatures(object s, LayerEventArgs e)
 {
     if (AlphaFeatures.ContainsKey(Game1.currentLocation?.Name))
     {
         foreach (var feature in AlphaFeatures[Game1.currentLocation.Name].Where(_ => _.Type == FeatureType.Inline))
         {
             feature.Render(Game1.spriteBatch);
         }
     }
     Game1.currentLocation.map.GetLayer("LowFront")?.Draw(Game1.mapDisplayDevice, Game1.viewport, Location.Origin, false, 4);
 }
Exemplo n.º 27
0
        void Layers_LayerRemoved(object sender, LayerEventArgs e)
        {
            UnattachLayerFromPlugin(e.Layer);
            //Hack to make it so the Selection Status display would update when a layer was removed.
            App.Map.Layers.SelectedLayer = null;
            App.DockManager.HidePanel("kDataExplorer");

            FunctionMode f = App.Map.FunctionMode;

            App.Map.FunctionMode = f;
        }
Exemplo n.º 28
0
        protected virtual void ActionBySelect(LayerEventArgs layerEventArgs)
        {
            var _numOfActiveDataset = (int)layerEventArgs.NumberOfActiveDataset;

            _InputSignals[_numOfActiveDataset]  = layerEventArgs.OutputsSignalsPrevLayer[_numOfActiveDataset];
            _OutputSignals[_numOfActiveDataset] = Feedforward.GetOutputSignalOfSample(
                _InputSignals[_numOfActiveDataset],
                _NeuronWeights,
                layerEventArgs.ActivationFunc,
                _BiasWeights);
        }
Exemplo n.º 29
0
 public virtual void Activate(object sender, LayerEventArgs prevLayerEventArgs)
 {
     if (prevLayerEventArgs.NumberOfActiveDataset == null)
     {
         ActionByFull(prevLayerEventArgs);
     }
     else
     {
         ActionBySelect(prevLayerEventArgs);
     }
     OnActivatingNextLayer(prevLayerEventArgs);
 }
Exemplo n.º 30
0
        void Layers_LayerRemoved(object sender, LayerEventArgs e)
        {
            if (_rectangleLayer == null)
            {
                return;
            }

            if (e.Layer == _rectangleLayer)
            {
                Deactivate();
            }
        }
Exemplo n.º 31
0
		private void OnLayerRendered(LayerEventArgs e)
		{
			if (LayerRendered != null)
				LayerRendered(this, e);
		}
Exemplo n.º 32
0
 // This was made public so that the Builder application could utilize this logic when layers are added or removed
 // from the map content control and thus remain in sync with the map layers.
 private void SetSelectedLayer(LayerEventArgs e)
 {
     SelectedLayer = e.Layer;
     OnSelectedLayerChanged(e.Layer);
 }
Exemplo n.º 33
0
 protected virtual void OnLayerSelectionChanged(LayerEventArgs e)
 {
     if (SelectedLayerChanged != null)
         SelectedLayerChanged(this, EventArgs.Empty);
 }
Exemplo n.º 34
0
        //public Double Angle { get; set; }

        internal void PerformLayerRendered(LayerEventArgs e)
        {
            _renderedLayer++;
            if (LayerRendered != null)
                OnLayerRendered(e);

            Progress();
        }