public void Exit(Categories category, Layers layer, string className, string methodName, string message, string outArgs, long? elapsedMiliSeconds) { if (IsEnabled()) { WriteEvent(EventIds.MethodEnd, category, layer, className, methodName, message, outArgs, elapsedMiliSeconds); } }
public void Enter(Categories category, Layers layer, string className, string methodName, string message, string inArgs) { if (IsEnabled()) { WriteEvent(EventIds.MethodStart, category, layer, className, methodName, message, inArgs); } }
public TraceCallGraphAspect(Categories category, Layers layer, CallFlowType flowType=CallFlowType.Layer, bool logCallStack=false) { this.Category = category; this.Layer = layer; this.FlowType = flowType; this.LogCallStack = logCallStack; }
public LayerVisibilityMenuController(ToolStripMenuItem menuItem, Layers layer) { this.menuItem = menuItem; this.layer = layer; menuItem.Click += MenuItem_Click; }
public virtual object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { Diagram diagram = (Diagram) obj; diagram.SuspendEvents = true; diagram.Suspend(); mShapes = (Elements) info.GetValue("Shapes",typeof(Elements)); mLines = (Elements) info.GetValue("Lines",typeof(Elements)); mLayers = (Layers) info.GetValue("Layers",typeof(Layers)); //Diagram is created without a constructor, so need to do some initialization diagram.SetRender(new Render()); diagram.DiagramSize = Serialize.GetSize(info.GetString("DiagramSize")); diagram.Zoom = info.GetSingle("Zoom"); diagram.ShowTooltips = info.GetBoolean("ShowTooltips"); diagram.Paged = info.GetBoolean("Paged"); diagram.CheckBounds = info.GetBoolean("CheckBounds"); diagram.Margin = (Margin) info.GetValue("Margin",typeof(Margin)); diagram.WorkspaceColor = Color.FromArgb(Convert.ToInt32(info.GetString("WorkspaceColor"))); if (Serialize.Contains(info,"Animator", typeof(Animator))) diagram.Animator = (Animator) info.GetValue("Animator", typeof(Animator)); diagram.Resume(); diagram.SuspendEvents = false; return diagram; }
void Awake() { alertArea = GetComponent<SphereCollider>(); monster = GetComponent<Monster>(); player = GameObject.FindGameObjectWithTag(Tags.player); layers = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<Layers>(); }
public void TimeMethod(decimal elapsedMiliSeconds, Categories category, Layers layer) { if (IsEnabled()) { WriteEvent(EventIds.TimeMethod, elapsedMiliSeconds, category, layer); } }
void Awake() { layer = GameObject.FindGameObjectWithTag(Tags.gameController) .GetComponent<Layers>(); gamecon = GameObject.FindGameObjectWithTag(Tags.gameController) .GetComponent<GameController>(); bgm = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<BGMManager>(); }
//生成するオブジェクト //座標 //親 public GameObject CreateUI(GameObject instance, Vector2 position, Layers parentIndex = Layers.Layer_Front) { GameObject instanceUI = null; if (Vector2.zero != position) instanceUI = Instantiate(instance, position, Quaternion.identity) as GameObject; else instanceUI = Instantiate(instance) as GameObject; instanceUI.transform.SetParent(SearchParent(parentIndex).transform,false); return instanceUI; }
public static void Insert(IVisualBlock block, Layers.LayerInfo layer = null) { if (block == null) return; var doc = Application.DocumentManager.MdiActiveDocument; var db = doc.Database; var idBtr = GetInsertBtr(block.Name, block.File, db); BlockInsert.Insert(block.Name, layer); }
public Layer() { Name = "new_layer"; //Parent = parentLayer; _childLayers = new Layers(this); _attributes = new Dictionary<string, string>(); _maps = new Maps(); }
private void Parse( Layers layers, int level ) { string indentation = GetIndentation(level); foreach(ILayerNode layer in layers) { Console.WriteLine(indentation + layer.Title); Parse(layer.Layers, level+1); } }
public Scene() { Layers = new Layers(); AllLayers = new Layers(); Animations = new Animations(); ScriptFiles = new List<string>(); Maps = new Maps(); }
public void Enter(Categories category, Layers layer, string className, string methodName, string message, string inArgs) { Trace.WriteLine(string.Format("{0}-{1}: {2}.{3}\n\t{4}", category, layer, className, methodName, message)); if (!string.IsNullOrEmpty(inArgs)) { Trace.WriteLine(string.Format("\tinput: {0}", inArgs)); } else { Trace.WriteLine("\tinput: null"); } }
public static void Polyline(Layers.LayerInfo layer = null, Color color=null, LineWeight? lineWeight = null, string lineType = null, double? lineTypeScale = null) { // Обертка запуска команды рисования полилинии с заданными свойствами. Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; // Вызов команды рисования полилинии using (new DrawParameters(db, layer, color, lineWeight, lineType, lineTypeScale)) { doc.Editor.Command("_PLINE"); } }
public static void InsertBlock(string fileBlocks, Predicate<string> filter, Layers.LayerInfo layer = null) { List<IVisualBlock> visuals; if (!dictFiles.TryGetValue(filter, out visuals)) { visuals = LoadVisuals(fileBlocks, filter); dictFiles.Add(filter, visuals); } var vm = new VisualBlocksViewModel(visuals); var winVisual = new WindowVisualBlocks(vm); Application.ShowModalWindow(winVisual); }
public Chart(Graphics graph, Layers layers, ChartSizing chartSizing) { _pen = new Pen(Color.White); _pen.Width = 3.0f; _solidBursh = new SolidBrush(Color.White); _chartSizing = chartSizing; _graphics = graph; Layers = layers; _drawableRectangles = new List<DrawableRectangle>(); _drawableLines = new List<DrawableLine>(); }
protected GameObject GetMothership(Layers team) { GameObject mothership = null; if (team == Layers.Team1Actor) mothership = GameObject.Find("Team1Mothership"); else if (team == Layers.Team2Actor) mothership = GameObject.Find("Team2Mothership"); else throw new ArgumentException("Given layer is invalid: " + team.ToString()); return mothership; }
void Awake() { gman = GameObject.FindGameObjectWithTag(Tags.gameController) .GetComponent<GUIManager>(); csm = GameObject.FindGameObjectWithTag(Tags.mainCamera) .GetComponent<CutSceneManager>(); layer = GameObject.FindGameObjectWithTag(Tags.gameController) .GetComponent<Layers>(); gamecon = GameObject.FindGameObjectWithTag(Tags.gameController) .GetComponent<GameController>(); flag = Flag.GetInstance(); buttonRect = new Rect(640, 216, 640, 648); }
public void Exit(Categories category, Layers layer, string className, string methodName, string message, string outArgs, long? elapsedMiliSeconds) { Trace.WriteLine(string.Format("{0}-{1}: {2}.{3}\n\t{4}", category, layer, className, methodName, message)); if (!string.IsNullOrEmpty(outArgs)) { Trace.WriteLine(string.Format("\toutput: {0}", outArgs)); } else { Trace.WriteLine("\toutput: null"); } if (elapsedMiliSeconds.HasValue) { Trace.WriteLine(string.Format("\tcost: {0}ms", elapsedMiliSeconds)); } }
public override void Init( ) { Layers.Add(new RLTerrain( )); }
public override void Show() { _music = AssetManager.Load <Music>("song.mp3"); _soundEffect = AssetManager.Load <SoundEffect>("click.wav"); var backgroundLayer = new SpriteLayer(GraphicsDevice, Game.Camera); Layers.Add(backgroundLayer); var backgroundTexture = AssetManager.Load <Texture>("hills_800x480.png"); var backgroundSprite = Sprite.Create(backgroundTexture, 0, 0, 800, 480); backgroundLayer.Sprites.Add(backgroundSprite); var guiLayer = new GuiLayer(GraphicsDevice, Game.Camera); var font = AssetManager.Load("courier-new-32.fnt", new BitmapFontLoader()); var label = new GuiLabel(font) { Text = "Welcome to", TextColor = new Color(81, 32, 0), Position = new Vector2(400, 45) }; guiLayer.Controls.Add(label); var logoTexture = AssetManager.Load <Texture>("astrid-logo.png"); var image = new GuiImage(logoTexture) { Position = new Vector2(400, -150), Origin = new Vector2(0.5f, 1.0f) }; guiLayer.Controls.Add(image); var parameters = new TransitionParameters(1.0f, EasingFunctions.QuadraticEaseIn); Animations.CreateSequence(image) .MoveTo(new Vector2(400, 150), parameters) .ScaleTo(new Vector2(1.2f, 0.6f), new TransitionParameters(0.2f, EasingFunctions.CubicEaseOut)) .ScaleTo(new Vector2(1.0f, 1.0f), new TransitionParameters(0.2f, EasingFunctions.CubicEaseIn)) .ScaleTo(new Vector2(0.8f, 1.2f), new TransitionParameters(0.2f, EasingFunctions.CubicEaseOut)) .ScaleTo(new Vector2(1.0f, 1.0f), new TransitionParameters(0.2f, EasingFunctions.CubicEaseIn)) .Play(); var buttonTexture = AssetManager.Load <Texture>("play-button.png"); var playButton = new GuiButton(buttonTexture.ToTextureRegion()) { Position = new Vector2(400, -260), Rotation = MathHelper.TwoPi }; playButton.Click += PlayButtonOnClick; guiLayer.Controls.Add(playButton); Layers.Add(guiLayer); var transitionParameters = new TransitionParameters(1.0f, EasingFunctions.CubicEaseInOut); Animations .CreateSequence(playButton) .MoveTo(new Vector2(50, 50), transitionParameters) .MoveTo(new Vector2(700, 400), transitionParameters) .MoveTo(new Vector2(700, 230), transitionParameters) .MoveTo(new Vector2(400, 250), transitionParameters) .Delay(1.0f) .RotateTo(0, transitionParameters) .Delay(1.0f) .RotateTo(MathHelper.TwoPi, transitionParameters) .FadeOut(transitionParameters) .FadeIn(transitionParameters) .Play(); base.Show(); }
public Planet(StellarBody sun, Body parentBody, Length semiMajorAxisAU, Ratio eccentricity, Angle axialTilt, Duration dayLengthHours, Duration orbitalPeriodDays, Mass massSM, Mass gasMassSM, Length radius, Pressure surfPressure, Temperature dayTimeTempK, Temperature nightTimeTempK, Temperature surfTempK, Acceleration surfGrav) : base(new Seed(semiMajorAxisAU, eccentricity, massSM, massSM - gasMassSM, gasMassSM), sun, parentBody) { Parent = parentBody; StellarBody = sun; SemiMajorAxis = semiMajorAxisAU; Eccentricity = eccentricity; AxialTilt = axialTilt; OrbitZone = Science.Astronomy.GetOrbitalZone(sun.Luminosity, SemiMajorAxis); DayLength = dayLengthHours; OrbitalPeriod = orbitalPeriodDays; Mass = massSM; GasMass = gasMassSM; DustMass = massSM - GasMass; Radius = radius; Density = Science.Physics.GetDensityFromStar(Mass, SemiMajorAxis, sun.EcosphereRadius, true); ExosphereTemperature = Temperature.FromKelvins(GlobalConstants.EARTH_EXOSPHERE_TEMP / Extensions.Pow2(SemiMajorAxis / sun.EcosphereRadius)); SurfaceAcceleration = surfGrav; //Acceleration.FromCentimetersPerSecondSquared(GlobalConstants.GRAV_CONSTANT * massSM.Grams / Utilities.Pow2(radius.Centimeters)); EscapeVelocity = Science.Dynamics.GetEscapeVelocity(GasMass + DustMass, Radius); DaytimeTemperature = dayTimeTempK; NighttimeTemperature = nightTimeTempK; Temperature = surfTempK; //SurfaceGravityG = surfGrav; MolecularWeightRetained = Science.Physics.GetMolecularWeightRetained(SurfaceAcceleration, GasMass + DustMass, Radius, ExosphereTemperature, sun.Age); VolatileGasInventory = Science.Physics.GetVolatileGasInventory(GasMass + DustMass, EscapeVelocity, RMSVelocity, sun.Mass, GasMass, OrbitZone, Science.Planetology.TestHasGreenhouseEffect(sun.EcosphereRadius, SemiMajorAxis)); SurfacePressure = Science.Physics.GetSurfacePressure(VolatileGasInventory, Radius, SurfaceAcceleration); if (Science.Planetology.TestIsGasGiant(Mass, GasMass, MolecularWeightRetained)) { Layers.Add(new BasicGiantGaseousLayer(Radius).Generate(this, Mass, Chemical.All.Values.ToArray(), Layers)); } else { // Add basic Burrows layer. Layers.Add(new BasicSolidLayer(CoreRadius).Generate(this, DustMass, new Chemical[0], new Layer[0])); // Generate complete atmosphere. Layers.Add(new BasicGaseousLayer(Radius - CoreRadius, SurfacePressure).Generate(this, GasMass, Chemical.All.Values.ToArray(), Layers)); } IsForming = false; }
IEnumerator IEnumerable.GetEnumerator() { return(Layers.GetEnumerator()); }
public abstract void EnableLayers(Layers mask);
/// <summary> /// Removes all objects and all layers. /// </summary> public void ClearLayers() { Layers.Clear(); }
/// <summary> /// Serializes file data to a stream. /// </summary> protected override void Write(BinaryWriterEx bw) { bw.BigEndian = false; Entries entries; entries.Models = Models.GetEntries(); entries.Events = Events.GetEntries(); entries.Regions = Regions.GetEntries(); entries.Routes = Routes.GetEntries(); entries.Layers = Layers.GetEntries(); entries.Parts = Parts.GetEntries(); entries.PartsPoses = PartsPoses.GetEntries(); entries.BoneNames = BoneNames.GetEntries(); foreach (Model model in entries.Models) { model.CountInstances(entries.Parts); } foreach (Event evt in entries.Events) { evt.GetIndices(this, entries); } foreach (Region region in entries.Regions) { region.GetIndices(this, entries); } foreach (Part part in entries.Parts) { part.GetIndices(this, entries); } foreach (PartsPose pose in entries.PartsPoses) { pose.GetIndices(this, entries); } bw.WriteASCII("MSB "); bw.WriteInt32(1); bw.WriteInt32(0x10); bw.WriteBoolean(false); bw.WriteBoolean(false); bw.WriteByte(1); bw.WriteByte(0xFF); Models.Write(bw, entries.Models); bw.FillInt64("NextParamOffset", bw.Position); Events.Write(bw, entries.Events); bw.FillInt64("NextParamOffset", bw.Position); Regions.Write(bw, entries.Regions); bw.FillInt64("NextParamOffset", bw.Position); Routes.Write(bw, entries.Routes); bw.FillInt64("NextParamOffset", bw.Position); Layers.Write(bw, entries.Layers); bw.FillInt64("NextParamOffset", bw.Position); Parts.Write(bw, entries.Parts); bw.FillInt64("NextParamOffset", bw.Position); PartsPoses.Write(bw, entries.PartsPoses); bw.FillInt64("NextParamOffset", bw.Position); BoneNames.Write(bw, entries.BoneNames); bw.FillInt64("NextParamOffset", 0); }
private IRevolver[] _revolvers; // star mesh and 2 glows public StarDisplayManager(IWidgetTrackable trackedStar, Layers meshLayer) : base(trackedStar, meshLayer) { }
internal static void Open(string path, Scene scene, TextureManager textureManager, Layers layers) { XmlTextReader xmlReader = new System.Xml.XmlTextReader(path); xmlReader.MoveToContent(); // Jumps into top level header while (xmlReader.Read()) { if ("texturedata" == xmlReader.Name) { LoadTextureData(xmlReader, textureManager); } else if("scenedata" == xmlReader.Name) { LoadSceneData(xmlReader, scene, textureManager); } } layers.RefreshLayerContent(scene.Layers); }
public void SetAsEnemyBullet(float speed = 5) { _ownerLayer = Layers.Enemy; tag = ObjectTags.EnemyBullet; Speed = speed; }
// IMPROVE primaryMeshRenderer's sole purpose right now is to allow receipt of visibility changes by CameraLosChangedListener // Other ideas could include making an invisible bounds mesh for the plane like done for UIWidgets in CameraLosChangedListener public SystemDisplayManager(GameObject trackedItemGo, Layers meshLayer) : base(trackedItemGo, meshLayer) { }
private Task UpdateForActiveMap(bool activeMapChanged = true, Dictionary <MapMember, List <long> > mapSelection = null) { return(QueuedTask.Run(() => { SelectedLayerInfo selectedLayerInfo = null; if (!_selectedLayerInfos.ContainsKey(_activeMap)) { selectedLayerInfo = new SelectedLayerInfo(); _selectedLayerInfos.Add(_activeMap, selectedLayerInfo); } else { selectedLayerInfo = _selectedLayerInfos[_activeMap]; } if (activeMapChanged) { RefreshLayerCollection(); SetProperty(ref _selectedLayer, (selectedLayerInfo.SelectedLayer != null) ? selectedLayerInfo.SelectedLayer : Layers.FirstOrDefault(), () => SelectedLayer); if (_selectedLayer == null) { FrameworkApplication.SetCurrentToolAsync("esri_mapping_exploreTool"); return; } selectedLayerInfo.SelectedLayer = SelectedLayer; } if (SelectedLayer == null) { RefreshSelectionOIDs(new List <long>()); } else { List <long> oids = new List <long>(); if (mapSelection != null) { if (mapSelection.ContainsKey(SelectedLayer)) { oids.AddRange(mapSelection[SelectedLayer]); } } else { oids.AddRange(SelectedLayer.GetSelection().GetObjectIDs()); } RefreshSelectionOIDs(oids); } SetProperty(ref _selectedOID, (selectedLayerInfo.SelectedOID != null && LayerSelection.Contains(selectedLayerInfo.SelectedOID)) ? selectedLayerInfo.SelectedOID : LayerSelection.FirstOrDefault(), () => SelectedOID); selectedLayerInfo.SelectedOID = SelectedOID; ShowAttributes(); })); }
private void CreateLayers(int inputs) { Layers.Add(new Layer(HiddenUnits, TrainingSamples, LearningRate, inputs, TypeofLayer.Hidden)); Layers.Add(new Layer(OutputUnits, TrainingSamples, LearningRate, HiddenUnits, TypeofLayer.OutPut)); }
// Calculate based on top charge return running charge private ChargeDensity EvaluateGivenCharge(ChargeDensity topCharge, CancellationToken cancellationToken = default(CancellationToken)) { // Set the top metal to have a charge at the bottom (location = thickness) TopLayer.Prepare(); // Set the first point to all zeros TopLayer.EvalPoints[0] = new EvalPoint(); // Add charge to the last point TopLayer.EvalPoints[1] = new EvalPoint { Location = TopLayer.Thickness, ChargeDensity = topCharge }; var runningCharge = topCharge; var runningPotential = ElectricPotential.Zero; // Now integrate the charges to get the electric field in all the dielectrics foreach (var layer in Layers.Skip(1).Take(Layers.Count - 2)) // Only inner layers { if (cancellationToken.IsCancellationRequested) { return(ChargeDensity.Zero); } if (layer is Dielectric) { var dielectric = (Dielectric)layer; dielectric.Prepare(); for (var i = 0; i < dielectric.EvalPoints.Count; i++) { if (cancellationToken.IsCancellationRequested) { return(ChargeDensity.Zero); } var point = dielectric.EvalPoints[i]; // Integrate the charge (sum really) runningCharge += point.ChargeDensity; // Calculate the Electric Field point.ElectricField = runningCharge / dielectric.Permittivity; // Calculate the potential if (i == 0) { point.Potential = runningPotential; } else { var previousPoint = dielectric.EvalPoints[i - 1]; runningPotential -= previousPoint.ElectricField * (point.Location - previousPoint.Location); point.Potential = runningPotential; } } } else if (layer is Metal) { var metal = (Metal)layer; metal.Prepare(); // For the first point put the neg of the charge we have accumulated so far metal.EvalPoints[0].ChargeDensity = -runningCharge; metal.EvalPoints[0].ElectricField = ElectricField.Zero; metal.EvalPoints[0].Potential = runningPotential; // For the last point put the accumulated charge plus the free charge runningCharge += metal.ExtraCharge; // Integrate the extra charge metal.EvalPoints[1].ChargeDensity = runningCharge; metal.EvalPoints[1].ElectricField = ElectricField.Zero; metal.EvalPoints[1].Potential = runningPotential; } else // layer is Semiconductor { // do nothing } } if (cancellationToken.IsCancellationRequested) { return(ChargeDensity.Zero); } // Now add the stuff for the last point - here we assume that it is a metal if (IsBottomLayerMetal) { var metal = (Metal)BottomLayer; metal.Prepare(); // For the first point put the neg of the charge we have accumulated so far metal.EvalPoints[0].ChargeDensity = -runningCharge; metal.EvalPoints[0].ElectricField = ElectricField.Zero; metal.EvalPoints[0].Potential = runningPotential; // For the last point put no charge metal.EvalPoints[1].ChargeDensity = ChargeDensity.Zero; metal.EvalPoints[1].ElectricField = ElectricField.Zero; metal.EvalPoints[1].Potential = runningPotential; } else if (IsBottomLayerSemiconductor) { var semiconductor = (Semiconductor)BottomLayer; // Calculate the surface potential and prepare semiconductor.ExtraCharge = -runningCharge; semiconductor.Prepare(); // Evaulate the potential drop given the remaining charge semiconductor.EvalPoints[0].ChargeDensity = -runningCharge; semiconductor.EvalPoints[0].Potential = runningPotential; if (cancellationToken.IsCancellationRequested) { return(ChargeDensity.Zero); } // Last Point semiconductor.EvalPoints[1].Potential = runningPotential - semiconductor.SurfacePotential; } return(runningCharge); }
public override void Init( ) { Layers.Add(new RLLightMap( )); }
public UniverseCenterDisplayManager(GameObject trackedItemGo, Layers meshLayer) : base(trackedItemGo, meshLayer) { }
public override void Init( ) { Layers.Add(new RLMultiPassAnim( )); }
/// <summary>User has clicked the search button.</summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">Event arguments.</param> private void OnSearchClicked(object sender, EventArgs e) { try { explorerPresenter.MainPresenter.ShowWaitCursor(true); if (!string.IsNullOrEmpty(placeNameEditBox.Text) && !string.IsNullOrEmpty(countryDropDown.SelectedValue)) { if (!GetLatLongFromPlaceName()) { throw new Exception("Cannot find a latitude/longitude from the specified place name."); } } if (string.IsNullOrEmpty(latitudeEditBox.Text) || string.IsNullOrEmpty(longitudeEditBox.Text)) { throw new Exception("Must specifiy either a place name or a latitude/longitude."); } var apsoilTask = Task.Run(() => GetApsoilSoils()); var gridTask = Task.Run(() => GetGridSoils()); //var isricTask = Task.Run(() => GetISRICSoils()); // Web API no longer operational? var worldModellersTask = Task.Run(() => GetWorldModellersSoils()); var placeNameTask = Task.Run(() => GetPlacenameFromLatLong()); DataTable soilData = new DataTable(); soilData.Columns.Add("Name", typeof(string)); soilData.Columns.Add("Data source", typeof(string)); soilData.Columns.Add("Soil type", typeof(string)); soilData.Columns.Add("Distance (km)", typeof(string)); soilData.Columns.Add("PAWC for profile", typeof(string)); soilData.Columns.Add("PAWC to 300mm", typeof(string)); soilData.Columns.Add("PAWC to 600mm", typeof(string)); soilData.Columns.Add("PAWC to 1500mm", typeof(string)); Task.WaitAll(apsoilTask, gridTask, worldModellersTask, placeNameTask /*, isricTask*/); // Update the place name edit box. placeNameEditBox.Text = placeNameTask.Result; allSoils = apsoilTask.Result.Concat(gridTask.Result).Concat(worldModellersTask.Result); double[] pawcmappingLayerStructure = { 300, 300, 900 }; foreach (var soilInfo in allSoils) { var soilPhysical = soilInfo.Soil.FindChild <Physical>(); var row = soilData.NewRow(); row["Name"] = soilInfo.Soil.Name; row["Data source"] = soilInfo.DataSource; row["Soil type"] = soilInfo.Soil.SoilType; row["Distance (km)"] = MetUtilities.Distance(Convert.ToDouble(latitudeEditBox.Text, System.Globalization.CultureInfo.InvariantCulture), Convert.ToDouble(longitudeEditBox.Text, System.Globalization.CultureInfo.InvariantCulture), soilInfo.Soil.Latitude, soilInfo.Soil.Longitude).ToString("F1"); var pawc = soilPhysical.PAWCmm; row["PAWC for profile"] = pawc.Sum().ToString("F1"); var pawcConcentration = MathUtilities.Divide(pawc, soilPhysical.Thickness); var mappedPawcConcentration = Layers.MapConcentration(pawcConcentration, soilPhysical.Thickness, pawcmappingLayerStructure, 0); var mappedPawc = MathUtilities.Multiply(mappedPawcConcentration, pawcmappingLayerStructure); row["PAWC to 300mm"] = mappedPawc[0].ToString("F1"); row["PAWC to 600mm"] = (mappedPawc[0] + mappedPawc[1]).ToString("F1"); row["PAWC to 1500mm"] = mappedPawc.Sum().ToString("F1"); soilData.Rows.Add(row); } dataView.DataSource = soilData; } catch (Exception err) { explorerPresenter.MainPresenter.ShowError(err.Message); } finally { explorerPresenter.MainPresenter.ShowWaitCursor(false); } }
private void AddMissingLayers(HashSet <string> existingLayers, IEnumerable <string> layersToAdd) { AddMissingTableItems <DxfLayer>(existingLayers, layersToAdd, l => Layers.Add(l)); }
//-------------------------------------------------------------------------------------------------- public void Add(Layer layer) { if (Layers.Any(l => l.Guid == layer.Guid)) { return; } CoreContext.Current?.UndoHandler?.AddTopologyChange(UndoHandler.TopologyAction.Added, this, layer); layer.Collection = this; Layers.Add(layer); CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, layer, Layers.IndexOf(layer))); }
Entity IUndoableTopology.GetParent(Entity instance) { return(Layers.Contains(instance) ? this : null); }
public PlanetDisplayManager(IWidgetTrackable trackedPlanet, Layers meshLayer) : base(trackedPlanet, meshLayer) { }
//-------------------------------------------------------------------------------------------------- #region IEnumerable public IEnumerator <Layer> GetEnumerator() { return(Layers.GetEnumerator()); }
/////////////////////////////////////////////////////////////////////////// /// <summary> /// Load Layers Info section, including image data. /// </summary> /// <param name="reader">PSD reader.</param> /// <param name="hasHeader">Whether the Layers Info section has a length header.</param> internal void LoadLayers(PsdBinaryReader reader, bool hasHeader) { Util.DebugMessage(reader.BaseStream, "Load, Begin, Layers Info section"); long sectionLength = 0; if (hasHeader) { sectionLength = IsLargeDocument ? reader.ReadInt64() : reader.ReadUInt32(); if (sectionLength <= 0) { // The callback may take action when there are 0 layers, so it must // be called even though the Layers Info section is empty. LoadContext.OnLoadLayersHeader(this); Util.DebugMessage(reader.BaseStream, "Load, End, Layers Info section"); return; } } var startPosition = reader.BaseStream.Position; var numLayers = reader.ReadInt16(); // If numLayers < 0, then number of layers is absolute value, // and the first alpha channel contains the transparency data for // the merged result. if (numLayers < 0) { AbsoluteAlpha = true; numLayers = Math.Abs(numLayers); } for (int i = 0; i < numLayers; i++) { var layer = new Layer(reader, this); Layers.Add(layer); } // Header is complete just before loading pixel data LoadContext.OnLoadLayersHeader(this); //----------------------------------------------------------------------- // Load image data for all channels. foreach (var layer in Layers) { Util.DebugMessage(reader.BaseStream, "Load, Begin, Layer image, layer.Name"); foreach (var channel in layer.Channels) { channel.LoadPixelData(reader); } Util.DebugMessage(reader.BaseStream, "Load, End, Layer image, layer.Name"); } // Length is set to 0 when called on higher bitdepth layers. if (sectionLength > 0) { // Layers Info section is documented to be even-padded, but Photoshop // actually pads to 4 bytes. var endPosition = startPosition + sectionLength; var positionOffset = reader.BaseStream.Position - endPosition; Debug.Assert(positionOffset > -4, "LoadLayers did not read the full length of the Layers Info section."); Debug.Assert(positionOffset <= 0, "LoadLayers read past the end of the Layers Info section."); if (reader.BaseStream.Position < endPosition) { reader.BaseStream.Position = endPosition; } } Util.DebugMessage(reader.BaseStream, "Load, End, Layers"); }
private IFeatureLayer addLayer(string path, string name, bool isForObserved, bool isWorkingLayer) { Debug.WriteLine(DateTime.Now); Debug.WriteLine("Adding Layer..., " + name); if (!System.IO.File.Exists(path)) { Debug.WriteLine(path + " doesn't exist!"); return(null); } IFeatureLayer layer = this.Layers.Add(path) as IFeatureLayer; layer.SelectionEnabled = isWorkingLayer; layer.LegendText = name; foreach (DataColumn col in layer.DataSet.DataTable.Columns) { col.ColumnName = col.ColumnName.ToLower(); } //working layer and result display if (isWorkingLayer && !isForObserved) { //add result column DataTable dt = layer.DataSet.DataTable; dt.Columns.Add(RESULT_COLUMN, typeof(double)); //create schema for result display layer.Symbology.EditorSettings.ClassificationType = ClassificationType.Quantities; layer.Symbology.EditorSettings.FieldName = RESULT_COLUMN; layer.Symbology.EditorSettings.IntervalMethod = IntervalMethod.Quantile; layer.Symbology.EditorSettings.IntervalSnapMethod = IntervalSnapMethod.SignificantFigures; layer.Symbology.EditorSettings.IntervalRoundingDigits = 3; //3 significant number layer.Symbology.EditorSettings.StartSize = 5; layer.Symbology.EditorSettings.EndSize = 25; layer.Symbology.EditorSettings.NumBreaks = 5; layer.Symbology.EditorSettings.UseSizeRange = true; //start and end color layer.Symbology.EditorSettings.StartColor = Color.Green; layer.Symbology.EditorSettings.EndColor = Color.Red; } //set normal symbol //for result display, this is just the initial symbol. The symbol would be updated based on result //after the result is retrieved. if (layer.DataSet.FeatureType == DotSpatial.Topology.FeatureType.Polygon) //subbasin { layer.Symbolizer = new PolygonSymbolizer(System.Drawing.Color.LightGray, System.Drawing.Color.Black, 0.5); //show label for subbasin MapLabelLayer label = new MapLabelLayer(); label.Symbology.Categories[0].Expression = "[" + ID_COLUMN_NAME + "]"; layer.LabelLayer = label; layer.ShowLabels = true; } else if (layer.DataSet.FeatureType == DotSpatial.Topology.FeatureType.Line) //reach { layer.Symbolizer = new LineSymbolizer(System.Drawing.Color.Blue, 3.0); //set selection sysmbol for reach as wider red to make it more obvious layer.SelectionSymbolizer = new LineSymbolizer(System.Drawing.Color.Red, 3.0); } else if (layer.DataSet.FeatureType == DotSpatial.Topology.FeatureType.Point) //reservoir { //set the symbol color,shape and size layer.Symbolizer = new PointSymbolizer(Color.Green, DotSpatial.Symbology.PointShape.Hexagon, 20.0); layer.SelectionSymbolizer = new PointSymbolizer(Color.Cyan, DotSpatial.Symbology.PointShape.Hexagon, 20.0); //also set to just show reservoir //first to see if there are some reservoir there Type = R if (layer.DataSet.DataTable.Rows.Count == 0) { Layers.Remove(layer as IMapLayer); return(null); } int reservoirNum = int.Parse(layer.DataSet.DataTable.Compute("count(" + ID_COLUMN_NAME + ")", "type = 'R' or type = 'r'").ToString()); if (reservoirNum <= 0) { Layers.Remove(layer as IMapLayer); return(null); } //only show reservoir List <int> hiddenMoniterPoints = new List <int>(); for (int i = 0; i < layer.DataSet.DataTable.Rows.Count; i++) { ArcSWAT.RowItem item = new ArcSWAT.RowItem(layer.DataSet.DataTable.Rows[i]); string type = item.getColumnValue_String("type"); if (!type.Equals("R") && !type.Equals("r")) { hiddenMoniterPoints.Add(i); } } layer.RemoveFeaturesAt(hiddenMoniterPoints); } //add a column to show if the feature has observed data if (isForObserved) { //add observed column DataTable dt = layer.DataSet.DataTable; dt.Columns.Add(OBSERVED_COLUMN, typeof(int)); //create schema observed column to make feature with observed data more obvious if (layer.DataSet.FeatureType != DotSpatial.Topology.FeatureType.Polygon) { layer.Symbology.ClearCategories(); //get the observed data status ArcSWAT.SWATUnitType unitType = ArcSWAT.SWATUnitType.RCH; if (layer.DataSet.FeatureType == DotSpatial.Topology.FeatureType.Point) { unitType = ArcSWAT.SWATUnitType.RES; } foreach (DataRow r in layer.DataSet.DataTable.Rows) { int id = getIDFromFeatureRow(r); if (_project.Observation(Interval).getObservedData(unitType, id).Count > 0) { r[OBSERVED_COLUMN] = 1; } else { r[OBSERVED_COLUMN] = 0; } } //set the category IFeatureCategory cat_observed = layer.Symbology.CreateNewCategory(Color.Blue, 3.0) as IFeatureCategory; cat_observed.FilterExpression = string.Format("[{0}]=0", OBSERVED_COLUMN.ToUpper()); IFeatureCategory cat_no_observed = layer.Symbology.CreateNewCategory(Color.Red, 3.0) as IFeatureCategory; cat_no_observed.FilterExpression = string.Format("[{0}]=1", OBSERVED_COLUMN.ToUpper()); //for reservoir, change default size and shape if (layer.DataSet.FeatureType == DotSpatial.Topology.FeatureType.Point) { cat_observed.SelectionSymbolizer = new PointSymbolizer(Color.Cyan, DotSpatial.Symbology.PointShape.Hexagon, 20.0); cat_no_observed.SelectionSymbolizer = new PointSymbolizer(Color.Cyan, DotSpatial.Symbology.PointShape.Hexagon, 20.0); ((cat_observed.Symbolizer as PointSymbolizer).Symbols[0] as SimpleSymbol).Size = new Size2D(20.0, 20.0); ((cat_no_observed.Symbolizer as PointSymbolizer).Symbols[0] as SimpleSymbol).Size = new Size2D(20.0, 20.0); ((cat_observed.Symbolizer as PointSymbolizer).Symbols[0] as SimpleSymbol).PointShape = DotSpatial.Symbology.PointShape.Hexagon; ((cat_no_observed.Symbolizer as PointSymbolizer).Symbols[0] as SimpleSymbol).PointShape = DotSpatial.Symbology.PointShape.Hexagon; } layer.Symbology.AddCategory(cat_observed); layer.Symbology.AddCategory(cat_no_observed); layer.ApplyScheme(layer.Symbology); } } if (isWorkingLayer) { layer.SelectionEnabled = true; //for selection changed event layer.SelectionChanged += (ss, _e) => { if (onLayerSelectionChanged == null) { return; } ArcSWAT.SWATUnitType unitType = ArcSWAT.SWATUnitType.SUB; if (layer.DataSet.FeatureType == DotSpatial.Topology.FeatureType.Point) { unitType = ArcSWAT.SWATUnitType.RES; } else if (layer.DataSet.FeatureType == DotSpatial.Topology.FeatureType.Line) { unitType = ArcSWAT.SWATUnitType.RCH; } int id = -1; if (layer.Selection.NumRows() > 0) { IFeature fea = layer.Selection.ToFeatureList()[0]; id = getIDFromFeatureRow(fea.DataRow); } onLayerSelectionChanged(unitType, id); _id = id; }; } return(layer); }
public Layer FindBestLayer() => Layers.OrderBy(x => x.Count('0')).First();
/// <summary> /// Добавляет правило столкновения указанных слоёв. /// </summary> /// <param name="firstLayer"></param> /// <param name="secondLayer"></param> /// <param name="collision">Указывает должны ли объекты сталкиваться.</param> public static void AddCollisionRule(Layers firstLayer, Layers secondLayer, bool collision = true) { collisionRules[(int)firstLayer, (int)secondLayer] = collision; collisionRules[(int)secondLayer, (int)firstLayer] = collision; }
public void Run() { // Prepare data var baseDataDirectoryPath = @"E:\DataSets\Imdb"; var trainFilePath = Path.Combine(baseDataDirectoryPath, "imdb_sparse_train_50w.txt"); var testFilePath = Path.Combine(baseDataDirectoryPath, "imdb_sparse_test_50w.txt"); // Define the input and output shape. var inputShape = new int[] { 129888 + 4 }; // Number distinct input words + offset for one-hot, sparse var numberOfClasses = 2; var outputShape = new int[] { numberOfClasses }; // Define data type and device for the model. var dataType = DataType.Float; var device = DeviceDescriptor.UseDefaultDevice(); // Setup initializers var random = new Random(232); Func <CNTKDictionary> weightInit = () => Initializers.GlorotNormal(random.Next()); var biasInit = Initializers.Zero(); // Ensure reproducible results with CNTK. CNTKLib.SetFixedRandomSeed((uint)random.Next()); CNTKLib.ForceDeterministicAlgorithms(); // Create the architecture. var network = Layers.Input(inputShape, dataType, isSparse: true) .Embedding(8, weightInit(), dataType, device) .Dense(32, weightInit(), biasInit, device, dataType) .ReLU() .Dense(numberOfClasses, weightInit(), biasInit, device, dataType) .Softmax(); // Since we are processing sequence data, // wrap network in sequenceLast. network = CNTKLib.SequenceLast(network); // Get input and target variables from network. var inputVariable = network.Arguments[0]; var targetVariable = Variable.InputVariable(outputShape, dataType, dynamicAxes: new List <Axis>() { Axis.DefaultBatchAxis() }, isSparse: false); // setup loss and learner. var lossFunc = Losses.CategoricalCrossEntropy(network.Output, targetVariable); var metricFunc = Metrics.Accuracy(network.Output, targetVariable); // setup trainer. var learner = Learners.Adam(network.Parameters()); var trainer = Trainer.CreateTrainer(network, lossFunc, metricFunc, new List <Learner> { learner }); // Create the network. var model = new Model(trainer, network, dataType, device); // Write model summary. Trace.WriteLine(model.Summary()); // Setup minibatch sources. // Network will be trained using the training set, // and tested using the test set. var featuresName = "x"; var targetsName = "y"; // setup name to variable map. var nameToVariable = new Dictionary <string, Variable> { { featuresName, inputVariable }, { targetsName, targetVariable }, }; // The order of the training data is randomize. var train = CreateMinibatchSource(trainFilePath, featuresName, targetsName, numberOfClasses, inputShape, randomize: true); var trainingSource = new CntkMinibatchSource(train, nameToVariable); // Notice randomization is switched off for test data. var test = CreateMinibatchSource(testFilePath, featuresName, targetsName, numberOfClasses, inputShape, randomize: false); var testSource = new CntkMinibatchSource(test, nameToVariable); // Train the model using the training set. var history = model.Fit(trainingSource, epochs: 100, batchSize: 512, validationMinibatchSource: testSource); // Trace loss and validation history TraceLossValidationHistory(history); // Evaluate the model using the test set. var(loss, metric) = model.Evaluate(testSource); // Write the test set loss and metric to debug output. Trace.WriteLine($"Test set - Loss: {loss}, Metric: {metric}"); // Write first ten predictions var predictions = model.Predict(testSource) .Take(10); // Use tensor data directly, since only 1 element pr. sample. Trace.WriteLine($"Predictions: [{string.Join(", ", predictions.Select(p => p.First()))}]"); }
/// <summary> /// Saves the state of the layers in the ASP.NET session. /// </summary> /// <param name="layers">Layers collection</param> /// <remarks>Restore method is not required because ASP.NET restores ISerializable objects automatically.</remarks> public static void SaveLayersState(Layers layers) { if (IsManualState()) { HttpContext.Current.Session[GetKey("Layers")] = layers; } }
public override void Init( ) { Layers.Add(new RLNoFX( )); }
public void SetAsPlayerBullet(float speed = 10) { _ownerLayer = Layers.Player; tag = ObjectTags.PlayerBullet; Speed = speed; }
protected override void Generate() { var planet = this; var sun = StellarBody; var mass = GasMass + DustMass; planet.OrbitZone = Science.Astronomy.GetOrbitalZone(sun.Luminosity, SemiMajorAxis); planet.OrbitalPeriod = Science.Astronomy.GetPeriod(SemiMajorAxis, mass, sun.Mass); planet.AxialTilt = GetRandomInclination(SemiMajorAxis); planet.ExosphereTemperature = Science.Thermodynamics.GetEstimatedExosphereTemperature(SemiMajorAxis, sun.EcosphereRadius, sun.Temperature); planet.RMSVelocity = Science.Physics.GetRMSVelocity(Mass.FromGrams(GlobalConstants.MOL_NITROGEN), ExosphereTemperature); planet.CoreRadius = Science.Planetology.GetCoreRadius(DustMass, OrbitZone, false); // Calculate the radius as a gas giant, to verify it will retain gas. // Then if mass > Earth, it's at least 5% gas and retains He, it's // some flavor of gas giant. planet.Density = Science.Physics.GetDensityFromStar(mass, SemiMajorAxis, sun.EcosphereRadius, true); planet.Radius = Mathematics.GetRadiusFromVolume(mass, Density); planet.SurfaceAcceleration = GetAcceleration(mass, Radius); //planet.SurfaceGravityG = Environment.Gravity(planet.SurfaceAcceleration); planet.MolecularWeightRetained = Science.Physics.GetMolecularWeightRetained(SurfaceAcceleration, mass, Radius, ExosphereTemperature, sun.Age); // Is the planet a gas giant? if (Science.Planetology.TestIsGasGiant(mass, GasMass, MolecularWeightRetained)) { //Type = GetGasGiantType(MassSM, GasMassSM); AdjustPropertiesForGasBody(); SurfacePressure = Pressure.Zero; Layers.Clear(); Layers.Add(new BasicGiantGaseousLayer(Radius).Generate(this, GasMass, new Chemical[0], Layers)); } else // If not, it's rocky. { Radius = Science.Planetology.GetCoreRadius(mass, OrbitZone, false); Density = Science.Physics.GetDensityFromBody(mass, Radius); // Radius has changed, we need to adjust Surfa SurfaceAcceleration = GetAcceleration(mass, Radius); //SurfaceGravityG = Environment.Gravity(SurfaceAcceleration); AdjustPropertiesForRockyBody(); MolecularWeightRetained = Science.Physics.GetMolecularWeightRetained(SurfaceAcceleration, mass, Radius, ExosphereTemperature, sun.Age); } planet.AngularVelocity = Science.Dynamics.GetAngularVelocity(mass, Radius, Density, SemiMajorAxis, Science.Planetology.TestIsGasGiant(Mass, GasMass, MolecularWeightRetained), sun.Mass, sun.Age); planet.DayLength = Science.Astronomy.GetDayLength(planet.AngularVelocity, planet.OrbitalPeriod, planet.Eccentricity); planet.HasResonantPeriod = Science.Planetology.TestHasResonantPeriod(planet.AngularVelocity, planet.DayLength, planet.OrbitalPeriod, planet.Eccentricity); planet.EscapeVelocity = Science.Dynamics.GetEscapeVelocity(mass, planet.Radius); planet.VolatileGasInventory = Science.Physics.GetVolatileGasInventory(mass, EscapeVelocity, RMSVelocity, sun.Mass, GasMass, OrbitZone, HasGreenhouseEffect); planet.HillSphere = Science.Astronomy.GetHillSphere(sun.Mass, mass, planet.SemiMajorAxis); if (!Science.Planetology.TestIsGasGiant(mass, GasMass, MolecularWeightRetained)) { Pressure surfpres = Science.Physics.GetSurfacePressure(planet.VolatileGasInventory, planet.Radius, planet.SurfaceAcceleration); // Calculate all atmosphere layers total mass. if (GasMass == Mass.Zero) { Area surf = Area.FromSquareKilometers(4.0 * Math.PI * Math.Pow(planet.Radius.Kilometers, 2.0)); GasMass = Mass.FromKilograms(surf.SquareMeters * surfpres.NewtonsPerSquareMeter / planet.SurfaceAcceleration.MetersPerSecondSquared); } planet.BoilingPointWater = Science.Thermodynamics.GetBoilingPointWater(surfpres); // Sets: planet.surf_temp, planet.greenhs_rise, planet.albedo, planet.hydrosphere, // planet.cloud_cover, planet.ice_cover AdjustSurfaceTemperatures(surfpres); planet.IsTidallyLocked = Science.Planetology.TestIsTidallyLocked(DayLength, OrbitalPeriod); // Add basic Burrows layer. Layers.Add(new BasicSolidLayer(CoreRadius).Generate(this, DustMass, new Chemical[0], new Layer[0])); // Generate complete atmosphere. if (surfpres.Millibars > 0.0 && GasMass.SolarMasses > 0.0) { Layers.Add(new BasicGaseousLayer(Radius - CoreRadius, surfpres).Generate(this, GasMass, Chemical.All.Values.ToArray(), Layers)); } SurfacePressure = surfpres; HasGreenhouseEffect = Science.Planetology.TestHasGreenhouseEffect(sun.EcosphereRadius, SemiMajorAxis) & SurfacePressure > Pressure.Zero; } Type = Science.Planetology.GetBodyType(Mass, GasMass, MolecularWeightRetained, SurfacePressure, WaterCoverFraction, IceCoverFraction, MaxTemperature, BoilingPointWater, Temperature); IsForming = false; }
public static extern void BizSetLayerMask(IntPtr ctx, Layers mask);
public void CreateMainMenu(Gtk.MenuBar menu) { // File menu ImageMenuItem file = (ImageMenuItem)menu.Children[0]; file.Submenu = new Menu(); File.CreateMainMenu((Menu)file.Submenu); //Edit menu ImageMenuItem edit = (ImageMenuItem)menu.Children[1]; edit.Submenu = new Menu(); Edit.CreateMainMenu((Menu)edit.Submenu); // View menu ImageMenuItem view = (ImageMenuItem)menu.Children[2]; View.CreateMainMenu((Menu)view.Submenu); // Image menu ImageMenuItem image = (ImageMenuItem)menu.Children[3]; image.Submenu = new Menu(); Image.CreateMainMenu((Menu)image.Submenu); //Layers menu ImageMenuItem layer = (ImageMenuItem)menu.Children[4]; layer.Submenu = new Menu(); Layers.CreateMainMenu((Menu)layer.Submenu); //Adjustments menu ImageMenuItem adj = (ImageMenuItem)menu.Children[5]; adj.Submenu = new Menu(); Adjustments.CreateMainMenu((Menu)adj.Submenu); // Effects menu ImageMenuItem eff = (ImageMenuItem)menu.Children[6]; eff.Submenu = new Menu(); Effects.CreateMainMenu((Menu)eff.Submenu); // Add-ins menu ImageMenuItem addins = (ImageMenuItem)menu.Children[7]; addins.Submenu = new Menu(); Addins.CreateMainMenu((Menu)addins.Submenu); // Window menu ImageMenuItem window = (ImageMenuItem)menu.Children[8]; window.Submenu = new Menu(); Window.CreateMainMenu((Menu)window.Submenu); //Help menu ImageMenuItem help = (ImageMenuItem)menu.Children[9]; help.Submenu = new Menu(); Help.CreateMainMenu((Menu)help.Submenu); }
/** <summary>Populates a PDF file with contents.</summary> */ private void Populate( Document document ) { // Initialize a new page! Page page = new Page(document); document.Pages.Add(page); // Initialize the primitive composer (within the new page context)! PrimitiveComposer composer = new PrimitiveComposer(page); composer.SetFont(new StandardType1Font(document, StandardType1Font.FamilyEnum.Helvetica, true, false), 12); // Initialize the block composer (wrapping the primitive one)! BlockComposer blockComposer = new BlockComposer(composer); // Initialize the document layer configuration! LayerDefinition layerDefinition = document.Layer; document.PageMode = Document.PageModeEnum.Layers; // Shows the layers tab on document opening. // Get the root layers collection! Layers rootLayers = layerDefinition.Layers; // 1. Nested layers. { Layer nestedLayer = new Layer(document, "Nested layers"); rootLayers.Add(nestedLayer); Layers nestedSubLayers = nestedLayer.Layers; Layer nestedLayer1 = new Layer(document, "Nested layer 1"); nestedSubLayers.Add(nestedLayer1); Layer nestedLayer2 = new Layer(document, "Nested layer 2"); nestedSubLayers.Add(nestedLayer2); nestedLayer2.Locked = true; /* NOTE: Text in this section is shown using PrimitiveComposer. */ composer.BeginLayer(nestedLayer); composer.ShowText(nestedLayer.Title, new PointF(50, 50)); composer.End(); composer.BeginLayer(nestedLayer1); composer.ShowText(nestedLayer1.Title, new PointF(50, 75)); composer.End(); composer.BeginLayer(nestedLayer2); composer.ShowText(nestedLayer2.Title, new PointF(50, 100)); composer.End(); } // 2. Simple group (labeled group of non-nested, inclusive-state layers). { Layers simpleGroup = new Layers(document, "Simple group"); rootLayers.Add(simpleGroup); Layer layer1 = new Layer(document, "Grouped layer 1"); simpleGroup.Add(layer1); Layer layer2 = new Layer(document, "Grouped layer 2"); simpleGroup.Add(layer2); /* NOTE: Text in this section is shown using BlockComposer along with PrimitiveComposer to demonstrate their flexible cooperation. */ blockComposer.Begin(new RectangleF(50, 125, 200, 50), XAlignmentEnum.Left, YAlignmentEnum.Middle); composer.BeginLayer(layer1); blockComposer.ShowText(layer1.Title); composer.End(); blockComposer.ShowBreak(new SizeF(0, 15)); composer.BeginLayer(layer2); blockComposer.ShowText(layer2.Title); composer.End(); blockComposer.End(); } // 3. Radio group (labeled group of non-nested, exclusive-state layers). { Layers radioGroup = new Layers(document, "Radio group"); rootLayers.Add(radioGroup); Layer radio1 = new Layer(document, "Radiogrouped layer 1"); radioGroup.Add(radio1); radio1.Visible = true; Layer radio2 = new Layer(document, "Radiogrouped layer 2"); radioGroup.Add(radio2); radio2.Visible = false; Layer radio3 = new Layer(document, "Radiogrouped layer 3"); radioGroup.Add(radio3); radio3.Visible = false; // Register this option group in the layer configuration! LayerGroup options = new LayerGroup(document); options.Add(radio1); options.Add(radio2); options.Add(radio3); layerDefinition.OptionGroups.Add(options); /* NOTE: Text in this section is shown using BlockComposer along with PrimitiveComposer to demonstrate their flexible cooperation. */ blockComposer.Begin(new RectangleF(50, 185, 200, 75), XAlignmentEnum.Left, YAlignmentEnum.Middle); composer.BeginLayer(radio1); blockComposer.ShowText(radio1.Title); composer.End(); blockComposer.ShowBreak(new SizeF(0, 15)); composer.BeginLayer(radio2); blockComposer.ShowText(radio2.Title); composer.End(); blockComposer.ShowBreak(new SizeF(0, 15)); composer.BeginLayer(radio3); blockComposer.ShowText(radio3.Title); composer.End(); blockComposer.End(); } // 4. Print-only layer. { Layer printOnlyLayer = new Layer(document, "Print-only layer"); printOnlyLayer.Visible = false; printOnlyLayer.Printable = true; printOnlyLayer.Locked = true; rootLayers.Add(printOnlyLayer); composer.BeginLayer(printOnlyLayer); composer.ShowText(printOnlyLayer.Title, new PointF(50, 270)); composer.End(); } composer.Flush(); }
private void ProcessExpression(string expr, DirectoryInfo root) { if (expr.StartsWith("comp:", StringComparison.OrdinalIgnoreCase)) { expr = expr.Substring(5); } var layers = expr.Split(';'); if (layers.Length < 2) { throw new ArgumentException( "compositionExpression was not formatted correctly or contains no images", nameof(expr) ); } /////////////////////////////////// // Options var options = layers[0]; var opts = options.Split(','); if (opts.Length < 2) { throw new ArgumentException( "compositionExpression was not formatted correctly: too few options", nameof(expr) ); } var dxStr = opts[0]; var dyStr = opts[1]; if (!int.TryParse(dxStr, NumberStyles.Integer, CultureInfo.InvariantCulture, out var dx)) { throw new ArgumentException("Image X size must be an integer", nameof(expr)); } if (!int.TryParse(dyStr, NumberStyles.Integer, CultureInfo.InvariantCulture, out var dy)) { throw new ArgumentException("Image Y size must be an integer", nameof(expr)); } Dimensions = new Size(dx, dy); if (opts.Length >= 3) { var bpp = opts[2]; if (!bpp.StartsWith("Format", StringComparison.OrdinalIgnoreCase)) { bpp = "Format" + bpp; } #if QUANTIZE try { PixelFormat = (PixelFormat)Enum.Parse(typeof(PixelFormat), bpp, true); } catch (ArgumentException) { } #endif } /////////////////////////////////// // Layers for (var i = 1; i < layers.Length; i++) { var layerExpr = layers[i]; var l = new CompositedLayer(layerExpr, root); Layers.Add(l); } }
public FacilityDisplayManager(IWidgetTrackable trackedFacility, Layers meshLayer) : base(trackedFacility, meshLayer) { }
/// <summary> /// add new layer to neuronet, firs must be aded before /// </summary> /// <param name="newLayer"></param> /// <param name="_neuronCount"></param> public void AddHiddenLayer(INeuron _neuron, int _neuronCount) { AddLayer(new LayerNormal(_neuron, Layers.Last().LayerNeuronCount(), _neuronCount)); }
private void SetEffectLayer() { if (rbEffect1.Checked) EffectLayer = Layers.Effect1; if (rbEffect2.Checked) EffectLayer = Layers.Effect2; if (rbMask1.Checked) EffectLayer = Layers.Mask1; if (rbMask2.Checked) EffectLayer = Layers.Mask2; if (rbUnmask1.Checked) EffectLayer = Layers.Unmask1; if (rbUnmask2.Checked) EffectLayer = Layers.Unmask2; if (rbLayer.Checked) EffectLayer = Layers.Layered; if (rbAverage.Checked) EffectLayer = Layers.Average; }
/// <summary> ///Perform back propagation algorithm, /// with bias, and gradient sum on _samples, and regularization (_samples - 1 batch) /// </summary> /// <param name="_samples">matrix of _samples, each columns is one sample, first elems of each is 1 for bias</param> /// <param name="_answers">answers to this _samples, each columns is one answer, first elems of each is 1 for bias</param> /// <returns></returns> public void BackPropagation(Matrix _samples, Matrix _answers) { //2 // steps matrix for each examples, each column for 1 example, each matrix in list for 1 layer List <Matrix> forwardpropag = ForvardPropagationSaveSteps(_samples); //3 List <Matrix> layerErrors = new List <Matrix>(); //each matrix is one layer(starting from first hidden), each column - for one sample // Matrix answers = _answers.ComposeAddRow(new Matrix(1, _answers.Columns, 1), 0); //added 1 to compare whith output which have bias //for last layer layerErrors.Add(Matrix.MultiplySimple(forwardpropag.Last() - _answers, forwardpropag.Last().ApplyFunc(Layers.Last().Neuron.f1))); //4 for (int i = forwardpropag.Count - 2; i > 0; i--) { layerErrors.Insert(0, Matrix.MultiplySimple(Layers[i + 1].Weights.Transpose() * layerErrors[0], forwardpropag[i].ApplyFunc(Layers[i].Neuron.f1))); } //5 List <Matrix> deltaWeight = new List <Matrix>(); //delta w, for each layers, except starting for (int i = 1; i < Layers.Count; i++) { deltaWeight.Add(layerErrors[i - 1] * (forwardpropag[i - 1].Transpose())); } //6a - L2 regularization if (L2Regularization != 0.0) { for (int i = 1; i < Layers.Count; i++) { deltaWeight[i - 1] += Layers[i].Weights * L2Regularization; } } //6b - inertnist if (this.LearnInert != 0.0) { if (_prevDeltaWeights != null) { for (int i = 1; i < Layers.Count; i++) { deltaWeight[i - 1] *= 1.0 - LearnInert; deltaWeight[i - 1] += _prevDeltaWeights[i - 1] * LearnInert; } } _prevDeltaWeights = deltaWeight; } //6 adding deltaw for (int i = 1; i < Layers.Count; i++) { Layers[i].Weights += deltaWeight[i - 1] * (-LearnRate / _samples.Columns); } // divide _samles.columns - batch size }