public ABS_Layer(LayerType T_in, double depth_in, double Flow_Resistance, double _porosity, double YoungsModulus, double density, double PoissonsRatio, double tortuosity, double Viscous_Characteristic_Length, double Thermal_Permeability, double SpeedofSound) { T = T_in; depth = depth_in; Flow_Resist = Flow_Resistance; porosity = _porosity; }
public ColorLayer(LayerType type, DataUsed dataused, Interp interp, ProcessLayer calcdata, IGradientMap gr, double param1 = 0, double param2 = 0, double cycle = 1, double alpha = 1, double saturation = 1, double value = 1, LayerExtra alphaextr = LayerExtra.LAYER_EXTRA_NORMAL, LayerExtra saturationextr = LayerExtra.LAYER_EXTRA_NORMAL, LayerExtra valueextr = LayerExtra.LAYER_EXTRA_NORMAL) { c_type = type; c_dataused = dataused; c_interp = interp; c_valueextr = valueextr; c_saturationextr = saturationextr; c_alphaextr = alphaextr; c_param1 = param1; c_param2 = param2; c_value = value; c_saturation = saturation; c_alpha = alpha; c_cycle = cycle; c_calcdata = calcdata; c_gr = gr; }
public ILayer CreateLayer(int neurons, LayerType type) { var layer = new Layer(); layer.Type = type; layer.Neurons = (List<INeuron>) neuronFactory.CreateNeuronCollection(neurons); return layer; }
private Color GetLayerColor(LayerType fx) { Color color = null; switch (fx) { case LayerType.f1: color = Color.FromColorIndex(ColorMethod.ByAci, 7); break; case LayerType.f2: color = Color.FromColorIndex(ColorMethod.ByAci, 210); break; case LayerType.f3: color = Color.FromColorIndex(ColorMethod.ByAci, 1); break; case LayerType.f4: color = Color.FromColorIndex(ColorMethod.ByAci, 70); break; case LayerType.f5: color = Color.FromColorIndex(ColorMethod.ByAci, 132); break; case LayerType.f6: color = Color.FromColorIndex(ColorMethod.ByAci, 132); break; case LayerType.AC: color = Color.FromColorIndex(ColorMethod.ByAci, 1); break; } return color; }
/// <summary> /// Constructor for Drawing PolyLines and Polygons /// </summary> /// <param name="layerType"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="bEditingStarted"></param> /// <param name="mainControler"></param> public DrawAction(LayerType layerType, double x, double y, bool bEditingStarted, MainControler mainControler) { this.layerType = layerType; this.mainControler = mainControler; this.x = x; this.y = y; this.bEditingStarted = bEditingStarted; }
public ABS_Layer(LayerType T_in, double depth_in, double pitch_in, double width_in, double Flow_Resistivity, double _porosity) { T = T_in; depth = depth_in; pitch = pitch_in; width = width_in; Flow_Resist = Flow_Resistivity; porosity = _porosity; }
private void CreateIfDoesntExists(string layerName, LayerType fx, bool isPlottable) { Transaction trans = db.TransactionManager.StartTransaction(); using (trans) { CreateIfDoesntExists(trans, layerName, fx, isPlottable); trans.Commit(); } }
GameObject CreateLayerGameObject(string name, LayerType type) { GameObject layer = new GameObject(name); layer.transform.parent = mParent.transform; layer.transform.localPosition = new Vector3(0,0,((int)type) * -1); layer.transform.localEulerAngles = Vector3.zero; layer.transform.localScale = Vector3.one; return layer; }
public LayerControl(string name, bool visible, LayerType type) { this.visible = visible; this.type = type; this.Initialize(); this.Index = "0"; this.Name = name; this.Text = name; this.Selected = false; }
/// <summary> /// Called when [element changed]. /// </summary> /// <param name="e">The e.</param> protected override void OnElementChanged(ElementChangedEventArgs<Image> e) { base.OnElementChanged(e); if (e.OldElement == null && (int)Android.OS.Build.VERSION.SdkInt < 15) { LayerType it = new LayerType (); SetLayerType(it, null); } }
GameObject CreateLayerTypeObject(string name, LayerType lType) { GameObject layer = new GameObject(name); layer.transform.SetParent(layerParent); layer.transform.localEulerAngles = Vector3.zero; layer.transform.localScale = Vector3.one; layer.transform.localPosition = new Vector3(0, 0, (int)lType); return layer; }
public GameTileLayer(int width, int height, LayerType.LayerTypesEnum layerType) : base(width, height, layerType) { m_layerLayout = new GameTile[width, height]; //Set tile layer layout to be empty for (int x = 0; x < m_layoutWidth; x++) for (int y = 0; y < m_layoutHeight; y++) m_layerLayout[x, y] = new GameTile(EMPTYTILEINDEX, new Point(x * TileWidth, y * TileHeight)); }
public TileLayer(int width, int height, LayerType.LayerTypesEnum layerType) { m_tileTextureList = new List<Texture2D>(); m_layoutWidth = width; m_layoutHeight = height; m_layerType = layerType; m_alphaChannel = 1.0f; }
private LayerTableRecord GetLayer(string layerName, LayerType fx, bool isPlottable, Transaction trans) { LayerTableRecord ltr = new LayerTableRecord(); ltr.Name = layerName; Color color = GetLayerColor(fx); ltr.Color = color; LinetypeTable ltt = trans.GetObject(db.LinetypeTableId, OpenMode.ForRead) as LinetypeTable; ltr.LinetypeObjectId = ltt["Continuous"]; ltr.IsPlottable = isPlottable; return ltr; }
private void CreateIfDoesntExists(Transaction trans, string layerName, LayerType fx, bool isPlottable) { LayerTable lt = trans.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable; if (!lt.Has(layerName)) { LayerTableRecord ltr = GetLayer(layerName, fx, isPlottable, trans); lt.UpgradeOpen(); lt.Add(ltr); trans.AddNewlyCreatedDBObject(ltr, true); } }
public void deleteLayer(LayerType layerType) { layers[(int)layerType].isSet = false; layers[(int)layerType].breakLinks(); if (layerType == LayerType.SILICON_N ^ layerType == LayerType.SILICON_P) via = false; draw(); }
/// <summary> /// /// Constructor for Drawing Points /// </summary> /// <param name="absoluteZoom"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="mainControler"></param> public DrawAction(double absoluteZoom, double x, double y, MainControler mainControler) { this.layerType = LayerType.PointCanvas; this.mainControler = mainControler; this.absoluteZoom = absoluteZoom; this.x = x; this.y = y; this.shpInfo.iShapeInf = null; this.shpInfo.quadTreePosItemInf = null; this.Comment = String.Empty; this.Category = String.Empty; }
//--------------------------------------------------------------------- public Layer(LayerName name, LayerType type) { this.name = name; this.type = type; this.carbon = 0.0; this.nitrogen = 0.0; this.decayValue = 0.0; this.fractionLignin = 0.0; this.netMineralization = 0.0; this.grossMineralization = 0.0; }
public EditorTileLayer(int width, int height, LayerType.LayerTypesEnum layerType) : base(width, height, layerType) { m_layerLayout = new EditorTile[width, height]; //Set tile layer layout to be empty for (int x = 0; x < m_layoutWidth; x++) for (int y = 0; y < m_layoutHeight; y++) m_layerLayout[x, y] = new EditorTile(EMPTYTILEINDEX, new Point(x * TileWidth, y * TileHeight)); //initialize tile rectangle, only it's position will be changing in draws, not it's width or height unless tilewidth, or tileheight we changed m_tileRectangle = new Rectangle(0, 0, TileLayer.TileWidth, TileLayer.TileHeight); }
public void SetLayer(GameObject current,LayerType type) { if(mLayerDic.Count < Enum.GetNames(typeof(LayerType)).Length){ LayerInit(); } current.transform.parent = mLayerDic[type].transform; UIPanel[] panelArr = current.GetComponentsInChildren<UIPanel>(true); foreach(UIPanel panel in panelArr){ panel.depth += (int)type; } }
private void LayerPane_ItemTypeChanged(object sender, int index, LayerType type) { if (this.ActiveMapPanel != null) { GameMapLayer layer = this.ActiveMapPanel.Map.GetLayerAt(index); if (layer != null) { layer.Type = type; } else throw new NullReferenceException("Tentative de modification du type d'un objet inexistant"); } else throw new NullReferenceException("Tentative de modification d'un control enfant inexistant"); }
/// <summary> /// 设置Layer /// </summary> /// <param name="obj"></param> /// <param name="lType"></param> public void SetLayer(GameObject obj, LayerType lType) { int nums = Enum.GetNames(typeof(LayerType)).Length; if (layerTypeDict.Count < nums) { InitLayerType(); } obj.transform.SetParent(layerTypeDict[lType].transform); UIPanel[] panels = obj.GetComponentsInChildren<UIPanel>(true); foreach (UIPanel panel in panels) { panel.depth += (int)lType; } }
public static string LayerTypeToString(LayerType type) { switch(type) { case LayerType.Actor: return "Actor"; case LayerType.Mothership: return "Mothership"; case LayerType.Projectile: return "Projectile"; } return "Invalid"; }
public override void Draw(Graphics g, int x, int y, Size sizTile, TemplateDoc tmpd, LayerType layer, bool fSelected) { if (layer == LayerType.Galaxite) { Bitmap[] abm = m_gimg.GetBitmapSides(sizTile); Bitmap bm = abm[0]; if (fSelected) { Rectangle rcDst = new Rectangle(x, y, bm.Width, bm.Height); ImageAttributes attr = new ImageAttributes(); attr.SetGamma(0.5f); g.DrawImage(bm, rcDst, 0, 0, bm.Width, bm.Height, GraphicsUnit.Pixel, attr); } else { g.DrawImage(bm, x, y); } } }
// Adds a tile to a specific layer's bitmap. Uses The Layer enum // instead of an int for clarity. public void addToMapLayer(LayerType layer, int x, int y, int id) { Graphics g = Graphics.FromImage(mapLayers[(int)layer]); g.Clip = new Region(new Rectangle(x * tileSize, y * tileSize, tileSize, tileSize)); g.Clear(Color.Empty); if (id >= 0) { if(layer == LayerType.COLLISION) { if(id == 0) g.DrawImage(collision, x * tileSize, y * tileSize, new Rectangle(0, 0, tileSize, tileSize), GraphicsUnit.Pixel); } else g.DrawImage(getTile(layer, id), x * tileSize, y * tileSize, new Rectangle(0, 0, tileSize, tileSize), GraphicsUnit.Pixel); } g.Dispose(); }
public Layer(LayerType layerType, IActivationFunction activationFunction, int layerOrder, int numberOfNodes) { if (layerType == LayerType.Input) { if (layerOrder != 0) { throw new ArgumentException("LayerType of Input must be at LayerOrder of 0."); } if (activationFunction != null) { throw new ArgumentException("LayerType of Input must have ActivationFunction of null."); } } else { if (layerOrder == 0) { throw new ArgumentException("LayerType of Hidden or Output must not be at LayerOrder of 0."); } } if (numberOfNodes <= 0) { throw new ArgumentException("Must have one or more nodes."); } //assign all variables this.Weights = new List<double>(); this.Biases = new List<double>(); this.LayerOrder = layerOrder; this.LayerType = layerType; this.ActivationFunction = activationFunction; //generate nodes this.Nodes = new List<Node>(); for (int i = 0; i < numberOfNodes; i++) { this.Nodes.Add(new Node(activationFunction)); } }
public LayerBase GetOrCreateLayer(Int32 zIndex, LayerType type) { if (zIndex < LayerMinZIndex || zIndex > LayerMaxZIndex) throw new ArgumentOutOfRangeException(); if(Layers.ContainsKey(zIndex)) { if (type == LayerType.World && Layers[zIndex] is WorldLayer) return (WorldLayer)Layers[zIndex]; else if (type == LayerType.Screen && Layers[zIndex] is ScreenLayer) return (ScreenLayer)Layers[zIndex]; else throw new ArgumentException("The requested layer exists but is the wrong type."); } if (type == LayerType.World) return new WorldLayer(DrawEngine2d, zIndex); else if (type == LayerType.Screen) return new ScreenLayer(DrawEngine2d, zIndex); else throw new ArgumentException("The requested layer is an unknown type."); }
public void AddToChangeList(Vector3Int position, LayerType LayerType, Layer layer, TileLocation RelatedTileLocation, bool multilayer, bool remove) { var preExistingTileChange = TryGetPreExisting(position, layer, multilayer); if (preExistingTileChange != null) { if (remove) { preExistingTileChange.TileChangeToRemove(); } else { preExistingTileChange.TileChangeToSet(RelatedTileLocation); } return; } var TileChange = new TileChangeEntry() { position = position, LayerType = LayerType, RelatedTileLocation = RelatedTileLocation, }; if (multilayer == false) { if (PresentTiles.ContainsKey(layer) == false) { PresentTiles[layer] = new Dictionary <Vector3Int, TileChangeEntry>(); } PresentTiles[layer][position] = TileChange; } else { if (MultilayerPresentTiles.ContainsKey(layer) == false) { MultilayerPresentTiles[layer] = new Dictionary <Vector3Int, List <TileChangeEntry> >(); } //TODO Tilemap upgrade var ZZeroposition = position; ZZeroposition.z = 0; if (MultilayerPresentTiles[layer].ContainsKey(ZZeroposition) == false) { MultilayerPresentTiles[layer][ZZeroposition] = new List <TileChangeEntry>(); } var tileLocations = MultilayerPresentTiles[layer][ZZeroposition]; while ((tileLocations.Count <= Math.Abs(1 - position.z))) { tileLocations.Add(null); } tileLocations[Math.Abs(1 - position.z)] = TileChange; } changeList.List.Add(TileChange); }
private void AddLayer(int nX, int nY, LayerType layerType, int bitMaskValue, Tile[,] tileGrid) { tileGrid[nX, nY].AddLayer(GroundLayerController.GetLayerByBitMask(layerType, bitMaskValue)); }
private void Init(TextAsset mapFile) { XDocument mapX = XDocument.Parse(mapFile.text); TmxMap map = new TmxMap(mapX); PlayerMovement player = Instantiate(playerPrefab); GameManager.main.SetPlayer(player); GameManager.main.SetToolCounts( Tools.IntParseFast(map.Properties["Bombs"]), Tools.IntParseFast(map.Properties["Dynamites"]), Tools.IntParseFast(map.Properties["Blocks"]) ); for (int index = 0; index < map.ObjectGroups.Count; index += 1) { for (int oIndex = 0; oIndex < map.ObjectGroups[index].Objects.Count; oIndex += 1) { TmxObject tmxObject = map.ObjectGroups[index].Objects[oIndex]; int layerTypeIndex = System.Array.IndexOf(layerTypes, map.ObjectGroups[index].Properties["Type"]); LayerType layerType = (LayerType)layerTypeIndex; if (layerType == LayerType.Player) { player.transform.SetParent(world, false); player.transform.localPosition = new Vector3((float)tmxObject.X / 64f, map.Height - (float)tmxObject.Y / 64f, 0); player.GetComponent <PlayerUseTool>().Initialize(mapGrid); } //SpawnObject(tmxObject, world.GetItemContainer().transform, map.Width, map.Height); } } mapGrid.Initialize(map.Width, map.Height, player); for (int index = 0; index < map.Layers.Count; index += 1) { TmxLayer layer = map.Layers[index]; //LayerType layerType = (LayerType)Tools.IntParseFast(layer.Properties["Type"]); int layerTypeIndex = System.Array.IndexOf(layerTypes, layer.Properties["Type"]); LayerType layerType = (LayerType)layerTypeIndex; TiledMesh tiledMesh; if (layerType == LayerType.Ground) { tiledMesh = Instantiate(tiledMeshPrefab); tiledMesh.transform.SetParent(otherStuff, false); tiledMesh.Init(map.Width, map.Height, layer, groundMaterial, transform); tiledMesh.GetComponent <MeshCollider>().enabled = false; } else if (layerType == LayerType.Slime) { int tilesX = map.Width; int tilesY = map.Height; for (int y = 0; y < tilesY; y++) { for (int x = 0; x < tilesX; x++) { TmxLayerTile tile = layer.Tiles[(tilesY - y - 1) * tilesX + x]; int tileId = tile.Gid - 1; if (tileId == -1) { continue; } mapGrid.AttemptToCreateSlime(-1, -1, x, y); } } } else if (layerType == LayerType.Wall) { int tilesX = map.Width; int tilesY = map.Height; for (int y = 0; y < tilesY; y++) { for (int x = 0; x < tilesX; x++) { TmxLayerTile tile = layer.Tiles[(tilesY - y - 1) * tilesX + x]; int tileId = tile.Gid - 1; if (tileId == -1) { continue; } mapGrid.PlaceWall(x, y); } } } } mapGrid.Activate(); }
public void RemoveTile(Vector3Int position, LayerType refLayer, bool removeAll = false) { Layers[refLayer].RemoveTile(position, removeAll); }
static private LayerType GetLayerType(XmlNode node, string attributeName = "type", LayerType def = LayerType.UNDEFINED) { try { var type = node.Attributes.GetNamedItem(attributeName).Value; switch (type) { case "FLOOR": return(LayerType.FLOOR); case "LIGHTS": return(LayerType.LIGHTS); case "OBJECTS": return(LayerType.OBJECTS); case "WALL": return(LayerType.WALL); default: return(def); } } catch (Exception ex) { Logger.Warning("UiFactory", "GetLayerType", ex.ToString()); return(def); } }
public override void LoadModel(string filename, bool bTrain = false) { Logger.WriteLine(Logger.Level.info, "Loading bi-directional model: {0}", filename); using (var sr = new StreamReader(filename)) { var br = new BinaryReader(sr.BaseStream); IsCRFTraining = br.ReadBoolean(); var layerSize = br.ReadInt32(); LayerType layerType = LayerType.None; //Load forward layers from file forwardHiddenLayers = new List <SimpleLayer>(); for (var i = 0; i < layerSize; i++) { layerType = (LayerType)br.ReadInt32(); forwardHiddenLayers.Add(Load(layerType, br)); SimpleLayer layer = forwardHiddenLayers[forwardHiddenLayers.Count - 1]; if (bTrain) { layer.SetRunningMode(RunningMode.Training); layer.InitializeInternalTrainingParameters(); } else { layer.SetRunningMode(RunningMode.Test); } } //Load backward layers from file backwardHiddenLayers = new List <SimpleLayer>(); for (var i = 0; i < layerSize; i++) { layerType = (LayerType)br.ReadInt32(); backwardHiddenLayers.Add(Load(layerType, br)); SimpleLayer layer = backwardHiddenLayers[backwardHiddenLayers.Count - 1]; if (bTrain) { layer.SetRunningMode(RunningMode.Training); layer.InitializeInternalTrainingParameters(); } else { layer.SetRunningMode(RunningMode.Test); } } Logger.WriteLine("Create output layer"); layerType = (LayerType)br.ReadInt32(); OutputLayer = Load(layerType, br); if (bTrain) { OutputLayer.SetRunningMode(RunningMode.Training); OutputLayer.InitializeInternalTrainingParameters(); } else { OutputLayer.SetRunningMode(RunningMode.Test); } if (IsCRFTraining) { Logger.WriteLine("Loading CRF tag trans weights..."); CRFWeights = RNNHelper.LoadMatrix(br); } if (bTrain) { InitCache(forwardHiddenLayers, backwardHiddenLayers, OutputLayer.CreateLayerSharedWegiths()); } } }
public void CmdRequestMeleeAttack(GameObject victim, Vector2 attackDirection, BodyPartType damageZone, LayerType layerType) { var weapon = playerScript.playerNetworkActions.GetActiveHandItem(); var tiles = victim.GetComponent <InteractableTiles>(); if (tiles) { //validate based on position of target vector if (!Validations.CanApply(playerScript, victim, NetworkSide.Server, targetVector: attackDirection)) { return; } } else { //validate based on position of target object if (!Validations.CanApply(playerScript, victim, NetworkSide.Server)) { return; } } if (!playerMove.allowInput || playerScript.IsGhost || !victim || !playerScript.playerHealth.serverPlayerConscious ) { return; } if (!allowAttack) { return; } var isWeapon = weapon != null; ItemAttributesV2 weaponAttr = isWeapon ? weapon.GetComponent <ItemAttributesV2>() : null; var damage = isWeapon ? weaponAttr.ServerHitDamage : fistDamage; var damageType = isWeapon ? weaponAttr.ServerDamageType : DamageType.Brute; var attackSoundName = isWeapon ? weaponAttr.ServerHitSound : "Punch#"; LayerTile attackedTile = null; bool didHit = false; // If Tilemap LayerType is not None then it is a tilemap being attacked if (layerType != LayerType.None) { var tileChangeManager = victim.GetComponent <TileChangeManager>(); if (tileChangeManager == null) { return; //Make sure its on a matrix that is destructable } //Tilemap stuff: var tileMapDamage = victim.GetComponentInChildren <MetaTileMap>().Layers[layerType].gameObject .GetComponent <TilemapDamage>(); if (tileMapDamage != null) { var worldPos = (Vector2)transform.position + attackDirection; attackedTile = tileChangeManager.InteractableTiles.LayerTileAt(worldPos); tileMapDamage.DoMeleeDamage(worldPos, gameObject, (int)damage); didHit = true; } } else { //a regular object being attacked //butchering //TODO: Move butchering logic to IF2, it should be a progress action done on corpses (make a Corpse component probably) LivingHealthBehaviour victimHealth = victim.GetComponent <LivingHealthBehaviour>(); if (victimHealth != null && victimHealth.IsDead && isWeapon && weaponAttr.HasTrait(KnifeTrait)) { if (victim.GetComponent <SimpleAnimal>()) { SimpleAnimal attackTarget = victim.GetComponent <SimpleAnimal>(); RpcMeleeAttackLerp(attackDirection, weapon); playerMove.allowInput = false; attackTarget.Harvest(); SoundManager.PlayNetworkedAtPos("BladeSlice", transform.position); } else { PlayerHealth attackTarget = victim.GetComponent <PlayerHealth>(); RpcMeleeAttackLerp(attackDirection, weapon); playerMove.allowInput = false; attackTarget.Harvest(); SoundManager.PlayNetworkedAtPos("BladeSlice", transform.position); } } var integrity = victim.GetComponent <Integrity>(); if (integrity != null) { //damaging an object integrity.ApplyDamage((int)damage, AttackType.Melee, damageType); didHit = true; } else { //damaging a living thing var rng = new System.Random(); // This is based off the alien/humanoid/attack_hand punch code of TGStation's codebase. // Punches have 90% chance to hit, otherwise it is a miss. if (isWeapon || 90 >= rng.Next(1, 100)) { // The attack hit. victimHealth.ApplyDamageToBodypart(gameObject, (int)damage, AttackType.Melee, damageType, damageZone); didHit = true; } else { // The punch missed. string victimName = victim.Player()?.Name; SoundManager.PlayNetworkedAtPos("PunchMiss", transform.position); Chat.AddCombatMsgToChat(gameObject, $"You attempted to punch {victimName} but missed!", $"{gameObject.Player()?.Name} has attempted to punch {victimName}!"); } } } //common logic to do if we hit something if (didHit) { SoundManager.PlayNetworkedAtPos(attackSoundName, transform.position); if (damage > 0) { Chat.AddAttackMsgToChat(gameObject, victim, damageZone, weapon, attackedTile: attackedTile); } if (victim != gameObject) { RpcMeleeAttackLerp(attackDirection, weapon); playerMove.allowInput = false; } } //no matter what, start a cooldown for attacking again so they can't spam attack requests StartCoroutine(AttackCoolDown()); }
private void OnTileUpdated(LayerType layerType, int x, int y) { var info = new TileUpdateInfo(layerType, new Point(x, y)); AddUpdateInfo(info); }
private void OnAreaUpdated(LayerType layerType, Area area) { var info = new AreaUpdateInfo(layerType, area); AddUpdateInfo(info); }
protected TerrainUpdateInfo(LayerType type, Point position) { Position = position; Type = type; }
/// <summary>Force inks layer to be redrawn</summary> public void Invalidate(Renderer renderer, int x, int y, int width, int height, LayerType layers) { if (height >= 0) { if ((layers & LayerType.MODEL) != 0) { modelLayer.Update(); } if ((layers & LayerType.CAPTURE) != 0) { captureLayer.Update(); } } }
private void InternalRemoveTile(Vector3 position, LayerType layerType, bool removeAll) { Vector3Int p = position.RoundToInt(); metaTileMap.RemoveTile(p, layerType, removeAll); }
private void Layer_TypeChanged(object sender, LayerType type) { LayerControl control = sender as LayerControl; int index = this.Controls.IndexOf(control); this.ItemTypeChanged?.Invoke(this, index, type); }
public static void PartitionResidue( double inputMass, double inputDecayValue, double inputCNratio, double fracLignin, double ratioCNstructural, //double CNratiofrass, LayerName name, LayerType type, ActiveSite site) { double cAddToMetabolic, cAddToStructural, directAbsorb; double NAddToMetabolic, NAddToStructural, Npart; double fracStructuralLignin, fracMetabolic, fracN, ratioCNtotal, ratioLigninN; double totalNitrogen = 0.0; double totalC = inputMass * 0.47; if (totalC < 0.0000001) { //PlugIn.ModelCore.UI.WriteLine("C inputs to litter layer below threshold"); return; } // ...For each mineral element.. // ...Compute amount of element in residue. Npart = totalC / inputCNratio; // ...Direct absorption of mineral element by residue // (mineral will be transferred to donor compartment // and then partitioned into structural and metabolic // using flow routines.) // ...If minerl(SRFC,iel) is negative then directAbsorb = zero. if (SiteVars.MineralN[site] <= 0.0) directAbsorb = 0.0; else directAbsorb = SiteVars.MineralN[site] * OtherData.FractionSurfNAbsorbed * System.Math.Max(totalC / OtherData.ResidueMaxDirectAbsorb, 1.0); // ...If C/N ratio is too low, transfer just enough to make // C/N of residue = damrmn if (Npart + directAbsorb <= 0.0) ratioCNtotal = 0.0; else ratioCNtotal = totalC / (Npart + directAbsorb); if (ratioCNtotal < OtherData.MinResidueCN ) directAbsorb = (totalC / OtherData.MinResidueCN) - Npart; if (directAbsorb < 0.0) directAbsorb = 0.0; if(directAbsorb > SiteVars.MineralN[site]) directAbsorb = SiteVars.MineralN[site]; SiteVars.MineralN[site] -= directAbsorb; totalNitrogen = directAbsorb + Npart; // ...Partition carbon into structural and metabolic fraction of // residue (including direct absorption) which is nitrogen fracN = totalNitrogen / inputMass; // (totalC * 2.0); // ...Lignin/nitrogen ratio of residue ratioLigninN = fracLignin / fracN; // METABOLIC calculations // ...Carbon added to metabolic // Compute the fraction of carbon that goes to metabolic. fracMetabolic = OtherData.MetaStructSplitIntercept - OtherData.MetaStructSplitSlope * ratioLigninN; // ...Make sure the fraction of residue which is lignin isn't // greater than the fraction which goes to structural. -rm 12/91 if (fracLignin > (1.0 - fracMetabolic)) fracMetabolic = (1.0 - fracLignin); // ...Make sure at least 1% goes to metabolic if (fracMetabolic < 0.20) fracMetabolic = 0.20; // ...Compute amounts to flow cAddToMetabolic = totalC * fracMetabolic; if (cAddToMetabolic < 0.0) cAddToMetabolic = 0.0; if((int) type == (int) LayerType.Surface) { SiteVars.SurfaceMetabolic[site].Carbon += cAddToMetabolic; } else { SiteVars.SoilMetabolic[site].Carbon += cAddToMetabolic; } // STRUCTURAL calculations cAddToStructural = totalC - cAddToMetabolic; // ...Adjust lignin content of structural. // ...fracStructuralLignin is the fraction of incoming structural residue // which is lignin; restricting it to a maximum of .8 fracStructuralLignin = fracLignin / (cAddToStructural / totalC); if((int) type == (int) LayerType.Surface && cAddToMetabolic <= 0.0) //PlugIn.ModelCore.UI.WriteLine(" SURFACE cAddToMetabolic={0}.", cAddToMetabolic); // ...Changed allowable maximum fraction from .6 to 1.0 -lh 1/93 if (fracStructuralLignin > 1.0) fracStructuralLignin = 1.0; if((int) type == (int) LayerType.Surface) { SiteVars.SurfaceStructural[site].Carbon += cAddToStructural; } else { SiteVars.SoilStructural[site].Carbon += cAddToStructural; } // ...Adjust lignin in Structural Layers // adjlig(strucc(lyr), fracStructuralLignin, cAddToStructural, strlig(lyr)); Layer structuralLayer; if((int) type == (int) LayerType.Surface) structuralLayer = SiteVars.SurfaceStructural[site]; else structuralLayer = SiteVars.SoilStructural[site]; structuralLayer.AdjustLignin(cAddToStructural, fracStructuralLignin); // Don't adjust litter decay rate: the base decay rate is // always 1.0 // AdjustDecayRate(); // ...Partition mineral elements into structural and metabolic // ...Flow into structural // ...Flow into metabolic NAddToStructural = cAddToStructural / ratioCNstructural; //RATIO CN STRUCTURAL from species data NAddToMetabolic = totalNitrogen - NAddToStructural; if((int) type == (int) LayerType.Surface) { SiteVars.SurfaceStructural[site].Nitrogen += NAddToStructural; SiteVars.SurfaceMetabolic[site].Nitrogen += NAddToMetabolic; } else { SiteVars.SoilStructural[site].Nitrogen += NAddToStructural; SiteVars.SoilMetabolic[site].Nitrogen += NAddToMetabolic; //PlugIn.ModelCore.UI.WriteLine(" N added to Structural Soil: {0}.", NAddToStructural); } return; //} }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { LayerType layerType = (LayerType)value; if (layerType.HasFlag(LayerType.Raster) || layerType.HasFlag(LayerType.BaseMap)) { return(new RectangleGeometry(new System.Windows.Rect(0, 0, 5, 5))); //return new Rectangle() //{ // HorizontalAlignment = System.Windows.HorizontalAlignment.Center, // VerticalAlignment = System.Windows.VerticalAlignment.Center, // Stroke = parameters.VisualParameters.Stroke, // StrokeThickness = 1.0, // Fill = new SolidColorBrush(Colors.LightBlue), // Width = 5, // Height = 5 //}; } if (layerType.HasFlag(LayerType.Point)) { return(new RectangleGeometry(new System.Windows.Rect(0, 0, 5, 5))); //return new Rectangle() //{ // HorizontalAlignment = System.Windows.HorizontalAlignment.Center, // VerticalAlignment = System.Windows.VerticalAlignment.Center, // Stroke = parameters.VisualParameters.Stroke, // StrokeThickness = 1.0, // Fill = parameters.VisualParameters.Fill, // Width = 5, // Height = 5 //}; } else if (layerType.HasFlag(LayerType.Polyline)) { return(new LineGeometry(new System.Windows.Point(0, 0), new System.Windows.Point(10, 10))); //return new Line() //{ // StrokeThickness = 3, // X1 = 0, // Y1 = 10, // X2 = 10, // Y2 = 10, // Stroke = parameters.VisualParameters.Stroke, // HorizontalAlignment = System.Windows.HorizontalAlignment.Center, // VerticalAlignment = System.Windows.VerticalAlignment.Center //}; } else if (layerType.HasFlag(LayerType.Polygon)) { return(Geometry.Parse("F1 M 0.499,10.500L 9.769,10.500L 6.342,6.005L 9.825,1.230L 4.264,0.499L 0.837,4.938L 0.499,10.500 Z")); //return new Path() //{ // Data = Geometry.Parse("F1 M 0.499,10.500L 9.769,10.500L 6.342,6.005L 9.825,1.230L 4.264,0.499L 0.837,4.938L 0.499,10.500 Z"), // HorizontalAlignment = System.Windows.HorizontalAlignment.Center, // VerticalAlignment = System.Windows.VerticalAlignment.Center, // Stroke = parameters.VisualParameters.Stroke, // StrokeThickness = parameters.VisualParameters.StrokeThickness, // Fill = parameters.VisualParameters.Fill, // Width = 15, // Stretch = Stretch.Uniform // //Height = 15 //}; } else { return(new EllipseGeometry(new System.Windows.Rect(0, 0, 5, 5))); } }
static void Update(BusinessLayer myBusinessLayer, LayerType layerType) { switch (layerType) { case LayerType.STANDARD: foreach (var s in myBusinessLayer.GetAllStandards()) { Console.WriteLine(s.StandardId + " " + s.StandardName); } Console.WriteLine("Enter Standard ID: "); int NameStandard = Int32.Parse(Console.ReadLine()); Console.WriteLine("Enter New Name For Standard: "); myBusinessLayer.GetStandardByID(NameStandard).StandardName = Console.ReadLine(); myBusinessLayer.UpdateStandard(myBusinessLayer.GetStandardByID(NameStandard)); Console.WriteLine("Standard name has been updated to: " + myBusinessLayer.GetStandardByID(NameStandard).StandardName); break; case LayerType.STUDENT: foreach (var s in myBusinessLayer.getAllStudents()) { Console.WriteLine(s.StudentID + " " + s.StudentName); } Console.WriteLine("Enter Course ID: "); int NameStudent = Int32.Parse(Console.ReadLine()); int choice = -1; Console.WriteLine ( "\n 0. Update Name \n " + "1. Update Standard \n " ); try { choice = Int32.Parse(Console.ReadLine()); } catch { Console.WriteLine("Selection invalid\n"); } switch (choice) { case 0: Console.WriteLine("Enter New Name For Student: "); myBusinessLayer.GetStudentByID(NameStudent).StudentName = Console.ReadLine(); myBusinessLayer.UpdateStudent(myBusinessLayer.GetStudentByID(NameStudent)); Console.WriteLine("Student name has been updated to: " + myBusinessLayer.GetStudentByID(NameStudent).StudentName); break; case 1: Console.WriteLine("Enter New Teacher Id For Course: "); myBusinessLayer.GetStudentByID(NameStudent).StandardId = Int32.Parse(Console.ReadLine()); myBusinessLayer.UpdateStudent(myBusinessLayer.GetStudentByID(NameStudent)); Console.WriteLine("Course teacher id has been updated to: " + myBusinessLayer.GetStudentByID(NameStudent).StandardId); break; default: break; } break; case LayerType.TEACHER: foreach (var s in myBusinessLayer.getAllTeachers()) { Console.WriteLine(s.TeacherId + " " + s.TeacherName); } Console.WriteLine("Enter Teacher ID: "); int NameTeacher = Int32.Parse(Console.ReadLine()); Console.WriteLine("Enter New Name For Teacher: "); myBusinessLayer.GetTeacherByID(NameTeacher).TeacherName = Console.ReadLine(); myBusinessLayer.UpdateTeacher(myBusinessLayer.GetTeacherByID(NameTeacher)); Console.WriteLine("Teacher name has been updated to: " + myBusinessLayer.GetTeacherByID(NameTeacher).TeacherName); break; case LayerType.COURSE: foreach (var s in myBusinessLayer.GetAllCourses()) { Console.WriteLine(s.CourseId + " " + s.CourseName); } Console.WriteLine("Enter Course ID: "); int NameCourse = Int32.Parse(Console.ReadLine()); int c = -1; Console.WriteLine ( "\n 0. Update Name \n " + "1. Update Teacher \n " ); try { choice = Int32.Parse(Console.ReadLine()); } catch { Console.WriteLine("Selection invalid\n"); } switch (c) { case 0: Console.WriteLine("Enter New Name For Course: "); myBusinessLayer.GetCourseByID(NameCourse).CourseName = Console.ReadLine(); myBusinessLayer.UpdateCourse(myBusinessLayer.GetCourseByID(NameCourse)); Console.WriteLine("Course name has been updated to: " + myBusinessLayer.GetCourseByID(NameCourse).CourseName); break; case 1: Console.WriteLine("Enter New Teacher Id For Course: "); myBusinessLayer.GetCourseByID(NameCourse).TeacherId = Int32.Parse(Console.ReadLine()); myBusinessLayer.UpdateCourse(myBusinessLayer.GetCourseByID(NameCourse)); Console.WriteLine("Course teacher id has been updated to: " + myBusinessLayer.GetCourseByID(NameCourse).TeacherId); break; default: break; } break; default: break; } }
public AreaUpdateInfo(LayerType type, Area area) : base(type, area.Center) { Area = area; }
public TileUpdateInfo(LayerType type, Point position) : base(type, position) { }
public bool HasTile(Vector3Int position, LayerType layerType) { return(Layers[layerType].HasTile(position)); }
public ConnectionDC(int from, int to, LayerType fromLayerType, LayerType toLayerType, bool include) { this.Connection = new Connection(from, to, fromLayerType, toLayerType); this.Include = include; }
public FinishDrawingAction(LayerType layerType, LayerManager layerManager) { this.layerType = layerType; this.layerManager = layerManager; this.shpInfo = layerManager.getDrawShapeInformation(); }
public bool HasTile(Vector3Int position, LayerType layerType, bool isServer) { return(Layers[layerType].HasTile(position, isServer)); }
public static ILayerDefinition CreateDefault(LayerType type) { return(LayerDefinition.CreateDefault(type)); }
public async Task <IActionResult> Preview(int?id, int width, int height) { if (id == null) { return(NotFound()); } var layerRecord = await ConfigContext.Layers .Include(l => l.Service) .FirstOrDefaultAsync(m => m.Id == id); if (layerRecord == null) { return(NotFound()); } ServiceRecord serviceRecord = layerRecord.Service; View view = new View(); OpenLayers.layer.BaseLayer baseLayer = null; switch (serviceRecord.Type) { case OgcServiceType.Wmts: GdalWmtsService gdalWmtsService = new GdalWmtsService(); string capabilitiesPath = ServicePathManager.GetCapabilitiesPath(serviceRecord.Type, serviceRecord.Version, serviceRecord.Name); Capabilities capabilities = null; using (StreamReader sr = new StreamReader(capabilitiesPath)) { capabilities = gdalWmtsService.XmlDeSerialize(sr); } LayerType layerType = capabilities.GetLayerType(layerRecord.Name); string format = layerType.Format.FirstOrDefault(); string destTileMatrixSetName = layerType.TileMatrixSetLink.FirstOrDefault()?.TileMatrixSet; TileMatrixSet tileMatrixSet = capabilities.GetTileMatrixSet(destTileMatrixSetName); double[] origin = tileMatrixSet.TileMatrix.FirstOrDefault()?.TopLeftCorner?.ToDoubleValues(); string[] matrixIds = tileMatrixSet.TileMatrix.Select(x => x.Identifier.Value).ToArray(); double[] resolutions = tileMatrixSet.GetResolutions(matrixIds).ToArray(); var bound = layerType.BoundingBox.FirstOrDefault(); double[] lowerCorner = bound.LowerCorner.ToDoubleValues(); double[] upperCorner = bound.UpperCorner.ToDoubleValues(); double xmin = lowerCorner[0]; double ymin = lowerCorner[1]; double xmax = upperCorner[0]; double ymax = upperCorner[1]; double[] extent = new double[] { xmin, ymin, xmax, ymax }; double centerX = (xmin + xmax) / 2; double centerY = (ymin + ymax) / 2; view.center = new double[] { centerX, centerY }; view.extent = extent; view.resolution = TileMatrixSet.GetSuitableResolution(resolutions.ToList(), xmin, ymin, xmax, ymax, width, height); view.minResolution = resolutions[resolutions.Length - 1]; view.maxResolution = resolutions[0]; if (!string.IsNullOrEmpty(tileMatrixSet.SupportedCRS)) { string[] array = tileMatrixSet.SupportedCRS.Split("EPSG"); if (array.Length > 0) { string epsg = array[array.Length - 1].Replace(":", ""); view.projection = $"EPSG:{epsg}"; } } WmtsTileGrid tileGrid = new WmtsTileGrid() { origin = origin, matrixIds = matrixIds, resolutions = resolutions, extent = extent }; OpenLayers.source.Wmts source = new OpenLayers.source.Wmts() { url = capabilities.GetHref(), layer = layerRecord.Name, tileGrid = tileGrid, matrixSet = destTileMatrixSetName, format = format }; baseLayer = new OpenLayers.layer.TileLayer() { source = source }; break; default: return(NotFound()); } Map map = new Map() { layers = new OpenLayers.layer.BaseLayer[] { baseLayer }, view = view }; return(new JsonResult(map)); //PreviewModel previewModel = new PreviewModel() //{ // Layers = new OpenLayers.layer.BaseLayer[] { baseLayer }, // View = view //}; //return View(previewModel); }
public void Constructor_ThrowsArgumentException_OnWrongNumberOfCompositions(LayerType layerType, IEnumerable <Composition> compositions) { Assert.That(() => new LayeredQuiverSpecification(layerType, compositions), Throws.ArgumentException); }
public void ServerPerformMeleeAttack(GameObject victim, Vector2 attackDirection, BodyPartType damageZone, LayerType layerType) { if (Cooldowns.IsOnServer(playerScript, CommonCooldowns.Instance.Melee)) { return; } var weapon = playerScript.playerNetworkActions.GetActiveHandItem(); var tiles = victim.GetComponent <InteractableTiles>(); if (tiles) { //validate based on position of target vector if (!Validations.CanApply(playerScript, victim, NetworkSide.Server, targetVector: attackDirection)) { return; } } else { //validate based on position of target object if (!Validations.CanApply(playerScript, victim, NetworkSide.Server)) { return; } } if (!playerMove.allowInput || playerScript.IsGhost || !victim || !playerScript.playerHealth.serverPlayerConscious ) { return; } var isWeapon = weapon != null; ItemAttributesV2 weaponAttr = isWeapon ? weapon.GetComponent <ItemAttributesV2>() : null; var damage = isWeapon ? weaponAttr.ServerHitDamage : fistDamage; var damageType = isWeapon ? weaponAttr.ServerDamageType : DamageType.Brute; var attackSoundName = isWeapon ? weaponAttr.ServerHitSound : "Punch#"; LayerTile attackedTile = null; bool didHit = false; ItemAttributesV2 weaponStats = null; if (isWeapon) { weaponStats = weapon.GetComponent <ItemAttributesV2>(); } // If Tilemap LayerType is not None then it is a tilemap being attacked if (layerType != LayerType.None) { var tileChangeManager = victim.GetComponent <TileChangeManager>(); if (tileChangeManager == null) { return; //Make sure its on a matrix that is destructable } //Tilemap stuff: var tileMapDamage = victim.GetComponentInChildren <MetaTileMap>().Layers[layerType].gameObject .GetComponent <TilemapDamage>(); if (tileMapDamage != null) { if (isWeapon && weaponStats != null && weaponStats.hitSoundSettings == SoundItemSettings.OnlyObject) { attackSoundName = ""; } var worldPos = (Vector2)transform.position + attackDirection; attackedTile = tileChangeManager.InteractableTiles.LayerTileAt(worldPos, true); tileMapDamage.DoMeleeDamage(worldPos, gameObject, (int)damage); didHit = true; } } else { //a regular object being attacked LivingHealthBehaviour victimHealth = victim.GetComponent <LivingHealthBehaviour>(); var integrity = victim.GetComponent <Integrity>(); if (integrity != null) { //damaging an object if (isWeapon && weaponStats != null && weaponStats.hitSoundSettings == SoundItemSettings.Both) { SoundManager.PlayNetworkedAtPos(integrity.soundOnHit, gameObject.WorldPosServer(), Random.Range(0.9f, 1.1f)); } else if (isWeapon && weaponStats != null && weaponStats.hitSoundSettings == SoundItemSettings.OnlyObject && integrity.soundOnHit != "") { SoundManager.PlayNetworkedAtPos(integrity.soundOnHit, gameObject.WorldPosServer(), Random.Range(0.9f, 1.1f)); attackSoundName = ""; } integrity.ApplyDamage((int)damage, AttackType.Melee, damageType); didHit = true; } else { //damaging a living thing var rng = new System.Random(); // This is based off the alien/humanoid/attack_hand punch code of TGStation's codebase. // Punches have 90% chance to hit, otherwise it is a miss. if (isWeapon || 90 >= rng.Next(1, 100)) { // The attack hit. victimHealth.ApplyDamageToBodypart(gameObject, (int)damage, AttackType.Melee, damageType, damageZone); didHit = true; } else { // The punch missed. string victimName = victim.Player()?.Name; SoundManager.PlayNetworkedAtPos("PunchMiss", transform.position); Chat.AddCombatMsgToChat(gameObject, $"You attempted to punch {victimName} but missed!", $"{gameObject.Player()?.Name} has attempted to punch {victimName}!"); } } } //common logic to do if we hit something if (didHit) { if (!string.IsNullOrEmpty(attackSoundName)) { SoundManager.PlayNetworkedAtPos(attackSoundName, transform.position); } if (damage > 0) { Chat.AddAttackMsgToChat(gameObject, victim, damageZone, weapon, attackedTile: attackedTile); } if (victim != gameObject) { RpcMeleeAttackLerp(attackDirection, weapon); //playerMove.allowInput = false; } } Cooldowns.TryStartServer(playerScript, CommonCooldowns.Instance.Melee); }
public static void CreateTile <T>(LayerType layer, string tileName) where T : LayerTile { CreateAsset(CreateTile <T>(layer), tileName); }
private Layer(IList <object> shapes, LottieComposition composition, string layerName, long layerId, LayerType layerType, long parentId, string refId, IList <Mask> masks, AnimatableTransform transform, int solidWidth, int solidHeight, Color solidColor, float timeStretch, float startProgress, int preCompWidth, int preCompHeight, IList <IKeyframe <float?> > inOutKeyframes, MatteType matteType) { _shapes = shapes; _composition = composition; Name = layerName; Id = layerId; _layerType = layerType; ParentId = parentId; RefId = refId; Masks = masks; Transform = transform; SolidWidth = solidWidth; SolidHeight = solidHeight; SolidColor = solidColor; TimeStretch = timeStretch; StartProgress = startProgress; PreCompWidth = preCompWidth; PreCompHeight = preCompHeight; InOutKeyframes = inOutKeyframes; _matteType = matteType; }
//return the color of a layer type public Color GetColorOfType(LayerType type) { return((Color)LayerColorTable[type]); }
public Layer(List <IContentModel> shapes, LottieComposition composition, string layerName, long layerId, LayerType layerType, long parentId, string refId, List <Mask> masks, AnimatableTransform transform, int solidWidth, int solidHeight, SKColor solidColor, float timeStretch, float startFrame, int preCompWidth, int preCompHeight, AnimatableTextFrame text, AnimatableTextProperties textProperties, List <Keyframe <float?> > inOutKeyframes, MatteType matteType, AnimatableFloatValue timeRemapping, bool hidden) { Shapes = shapes; Composition = composition; Name = layerName; Id = layerId; _layerType = layerType; ParentId = parentId; RefId = refId; Masks = masks; Transform = transform; SolidWidth = solidWidth; SolidHeight = solidHeight; SolidColor = solidColor; TimeStretch = timeStretch; StartFrame = startFrame; PreCompWidth = preCompWidth; PreCompHeight = preCompHeight; Text = text; TextProperties = textProperties; InOutKeyframes = inOutKeyframes; _matteType = matteType; TimeRemapping = timeRemapping; IsHidden = hidden; }
/// <summary> /// 保存配置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSaveConfig_Click(object sender, EventArgs e) { if (panel1.Controls.Count < 2) { MessageBox.Show("没有可保存的内容,请设计好模板后再保存配置!"); return; } PrintConfig pcongif = new PrintConfig(); pcongif.PageHeight = PagerSetting.PageHeight; pcongif.PageWidth = PagerSetting.PageWidth; pcongif.PagePadding = PagerSetting.PagePadding; List <object> layerConfigs = new List <object>(); //先得到纸张属性 int pageX = 0; int pageY = 0; if (((ImageLayerBase)panel1.Controls[panel1.Controls.Count - 1]).layerType == LayerType.Paper) { pageX = panel1.Controls[panel1.Controls.Count - 1].Left; pageY = panel1.Controls[panel1.Controls.Count - 1].Top; } for (int i = 0; i < panel1.Controls.Count; i++) { LayerType lt = ((ImageLayerBase)panel1.Controls[i]).layerType; switch (lt) { case LayerType.BarCode: BarCodeLayer blayer = (BarCodeLayer)panel1.Controls[i]; BarCodeLayerConfig bc = new BarCodeLayerConfig(); bc.X = blayer.Left - pageX; bc.Y = blayer.Top - pageY; bc.Width = blayer.Width; bc.Height = blayer.Height; bc.Content = blayer.VarContent; bc.CodeType = blayer.CodeType; bc.IsShowText = blayer.IsShowText; layerConfigs.Add(bc); break; case LayerType.Image: ImageLayer imglayer = (ImageLayer)panel1.Controls[i]; ImageLayerConfig imglc = new ImageLayerConfig(); imglc.X = imglayer.Left - pageX; imglc.Y = imglayer.Top - pageY; imglc.Width = imglayer.Width; imglc.Height = imglayer.Height; imglc.ImageFilePath = imglayer.ImagePath; layerConfigs.Add(imglc); break; case LayerType.Text: TextLayer tl = (TextLayer)panel1.Controls[i]; TextLayerConfig tlc = new TextLayerConfig(); tlc.X = tl.Left - pageX; tlc.Y = tl.Top - pageY; tlc.Content = tl.VarContent; tlc.ContentColor = tl.ForeColor; tlc.ContentFont = tl.Font; layerConfigs.Add(tlc); break; case LayerType.Line: LineLayer ll = (LineLayer)panel1.Controls[i]; LineLayerConfig lc = new LineLayerConfig(); lc.X = ll.Left - pageX; lc.Y = ll.Top - pageY; lc.lineWidth = ll.lineWidth; lc.lineLength = ll.lineLength; lc.lineDirect = ll.lineDirect; layerConfigs.Add(lc); break; default: break; } } pcongif.Layers = layerConfigs; if (SerializeHelper.Serialize(typeof(PrintConfig), pcongif)) { m_printConfig = pcongif; MessageBox.Show("保存成功!"); } else { MessageBox.Show("保存失败!"); } }
public static void PartitionResidue( double inputMass, double inputDecayValue, double inputCNratio, double fracLignin, LayerName name, LayerType type, ActiveSite site) { double directAbsorb = 0.0; double ratioCNtotal = 0.0; double totalNitrogen = 0.0; // from dry matter to C, 0.5 ratio double totalC = inputMass * 0.47; if (totalC < 0.0000001) return; // ...For each mineral element.. // ...Compute amount of element in residue. double Npart = totalC / inputCNratio; //UI.WriteLine("tC={0}, inputCNratio={1}, name={2}, type={3}.", totalC, inputCNratio, name, type); // ...Direct absorption of mineral element by residue // (mineral will be transferred to donor compartment // and then partitioned into structural and metabolic // using flow routines.) // ...If minerl(SRFC,iel) is negative then directAbsorb = zero. if (SiteVars.MineralN[site] <= 0.0) directAbsorb = 0.0; else directAbsorb = OtherData.FractionSurfNAbsorbed * SiteVars.MineralN[site] * System.Math.Max(totalC / OtherData.ResidueMaxDirectAbsorb, 1.0); // ...If C/N ratio is too low, transfer just enough to make // C/N of residue = damrmn if (Npart + directAbsorb <= 0.0) ratioCNtotal = 0.0; else ratioCNtotal = totalC / (Npart + directAbsorb); if (ratioCNtotal < OtherData.MinResidueCN ) directAbsorb = (totalC / OtherData.MinResidueCN) - Npart; if (directAbsorb < 0.0) directAbsorb = 0.0; if(directAbsorb > SiteVars.MineralN[site]) directAbsorb = SiteVars.MineralN[site]; SiteVars.MineralN[site] -= directAbsorb; totalNitrogen = directAbsorb + Npart; Layer layer; if((int) name == (int) LayerName.Wood) layer = SiteVars.SurfaceDeadWood[site]; else layer = SiteVars.SoilDeadWood[site]; layer.Carbon += totalC; layer.Nitrogen += totalNitrogen; // ...Adjust lignin and decay rates in Structural Layers layer.AdjustLignin(totalC, fracLignin); layer.AdjustDecayRate(totalC, inputDecayValue); return; //} }
private void LayerType_SelectionChanged(object sender, SelectionChangedEventArgs e) { ColorPanel.Visibility = Visibility.Collapsed; ImagePanel.Visibility = Visibility.Collapsed; LightingPanel.Visibility = Visibility.Collapsed; ComboBoxItem item = LayerTypeCombo.SelectedItem as ComboBoxItem; LayerType layerType = (LayerType)item.Tag; if (Layer.LayerType != layerType) { Layer layer = null; switch (layerType) { case LayerType.Backdrop: { layer = new BackdropLayer(); } break; case LayerType.BackdropHost: { layer = new BackdropHostLayer(); } break; case LayerType.Color: { layer = new ColorLayer(); } break; case LayerType.Image: { layer = new ImageLayer(); } break; case LayerType.Lighting: { layer = new LightingLayer(); } break; case LayerType.Group: { layer = new GroupLayer(); } break; default: Debug.Assert(false); break; } // Set the new layer Layer.GroupLayer.ReplaceLayer(Layer, layer); Layer = layer; // Update the edit control UI UpdateUI(); } }