Esempio n. 1
0
File: Cloth.cs Progetto: KnYaZuK/OOP
 public Cloth(weartype _WearType, material _Material, size _Size, color _Color)
 {
     WearType = _WearType;
     Material = _Material;
     Size     = _Size;
     Color    = _Color;
 }
        public IHttpActionResult Postmaterial(material material)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.material.Add(material);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (materialExists(material.codigo))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = material.codigo }, material));
        }
Esempio n. 3
0
 public UnderWear(wearsubtype _WearSubType, bool _hasPockets, bool _hasBelt, material _Material, size _Size, color _Color)
     : base(weartype.underwear, _Material, _Size, _Color)
 {
     WearSubType = _WearSubType;
     hasPockets  = _hasPockets;
     hasBelt     = _hasBelt;
 }
Esempio n. 4
0
        public IHttpActionResult Putmaterial(int id, material material)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != material.id)
            {
                return(BadRequest());
            }

            db.Entry(material).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!materialExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public DetailDto getSimpleMaterial(int id)
        {
            material  m           = db.materials.Where(s => s.id == id).FirstOrDefault();
            DetailDto materialDto = new DetailDto(m.id.ToString(), m.name);

            return(materialDto);
        }
Esempio n. 6
0
    private float GetCapacity(material mat)
    {
        float cap_scaling = 4.1813f;

        // Heat capacities determine how much heat the element stores per degree of temperature
        // Must be the same values as in TemperatureShader or funny things will happen
        // https://en.wikipedia.org/wiki/Table_of_specific_heat_capacities

        switch (mat)
        {
        case material.water:
            return(4.1813f / cap_scaling);

        case material.steam:
            return(2.0800f / cap_scaling);

        case material.lava:
            return(1.5600f / cap_scaling);

        case material.obsidian:
            return(1.0000f / cap_scaling);

        case material.dirt:
            return(0.8000f / cap_scaling);

        case material.copper:
            return(0.3850f / cap_scaling);
        }

        return(0.0f);
    }
        public static STGenericMaterial LoadMaterial(material daeMat)
        {
            STGenericMaterial mat = new STGenericMaterial();

            mat.Name = daeMat.id;
            return(mat);
        }
 private void initialize(double objVol)
 {
     this.refVolume = objVol;
     elemList       = new List <elements.element>();
     em             = new material((_e, _i) => { _i.energyDensity = 0; return(_i.stress2.zeros().plus_xA(1.0, _i.invMetric)); });
     gvt            = new materials.zeroGravity().getGravity();
 }
Esempio n. 9
0
        private void moveZtoPrintPosition(int layerNumber, material mat)
        {
            double zeroheight = new double();

            switch (mat)
            {
            case material.m1:
                zeroheight = Z_zeroMat1;
                break;

            case material.m2:
                zeroheight = Z_zeroMat2;
                break;

            case material.m3:
                zeroheight = Z_zeroMat3;
                break;

            case material.m4:
                zeroheight = Z_zeroMat4;
                break;
            }

            setAbsoluteCoordinates();
            move(new Tuple <axis, double>(axis.z, zeroheight - (layerNumber * _layerHeight)));
        }
Esempio n. 10
0
 public seat(bool headrest, rating rating, material material, int belt)
 {
     mHeadrest = headrest;
     mRating   = rating;
     mMaterial = material;
     mBelt     = belt;
 }
Esempio n. 11
0
        /// <summary>
        /// Updates the preview box with the specified image. If no file number is specified, then the image will be black
        /// </summary>
        /// <param name="mat">the material preview to be updated</param>
        /// <param name="fileNumber">the file number of the material to preview</param>
        private void updatePreviewImage(material mat, int fileNumber = -1)
        {
            try
            {
                PictureBox pic = new PictureBox();
                switch (mat)
                {
                case material.m1:
                    pic = previewPic1;
                    break;

                case material.m2:
                    pic = previewPic2;
                    break;

                case material.m3:
                    pic = previewPic3;
                    break;

                case material.m4:
                    pic = previewPic4;
                    break;
                }
                if (fileNumber == -1)
                {
                    pic.Image = null;
                }
                else
                {
                    pic.Image = Image.FromFile(_fileNames[(int)mat].ElementAt(fileNumber));
                }
            }
            catch { }
        }
        unsafe public stVenantMaterial()
        {
            m_mat = new material((_e, _i) =>
            {
                double J  = Math.Sqrt(_i.metric.det / _i.refMetric.det);
                double _m = 1 / J * 2 * this.mu;
                double _l = 1 / J * this.lambda;
                int N     = _i.__N;
                //_i.stress2.zeros();

                /*for (int i = 0; i < N; i++)
                 * {
                 *  for (int j = 0; j <N; j++)
                 *  {
                 *      _i.stress2[i, j]=0;
                 *      for (int k = 0; k < N; k++)
                 *      {
                 *          for (int l = 0; l < N; l++)
                 *          {
                 *              _i.stress2[i, j] = _i.stress2[i, j]+_l * _i.invMetric[i, j] * _i.invMetric[k, l] * _i.strain[k, l] + _m * _i.invMetric[i, k] * _i.strain[k,l] * _i.invMetric[l,j];
                 *          }
                 *      }
                 *  }
                 * }*/
                fixed(double *_ptr1 = &_i.stress2.rawData[0, 0], _ptr2 = &_i.strain.rawData[0, 0], _ptr3 = &_i.refInvMetric.rawData[0, 0], _ptr4 = &_i.refInvMetric.rawData[0, 0])
                {
                    double *ptr1 = _ptr1;
                    double *ptr3 = _ptr3;
                    double *ptr5 = _ptr3;
                    double *ptr7 = _ptr4;
                    double v     = 0;
                    for (int i = 0; i < N; i++)
                    {
                        for (int j = 0; j < N; j++)
                        {
                            v              = 0;
                            double *ptr2   = _ptr2;
                            double *ptr4   = _ptr4;
                            double *__ptr7 = ptr7;
                            for (int k = 0; k < N; k++)
                            {
                                for (int l = 0; l < N; l++)
                                {
                                    v += _l * *(ptr3 /* + i * N + j*/) * *(ptr4 /* + k * N + l*/) * *(ptr2 /* + k * N + l*/) + _m * *(ptr7 /* + i * N + k*/) * *(ptr2 /* + k * N + l*/) * *(ptr5 + l * N + j);
                                    ptr2++;
                                    ptr4++;
                                }
                                ptr7++;
                            }
                            ptr7  = __ptr7;
                            *ptr1 = v;
                            ptr1++;
                            ptr3++;
                        }
                        ptr7 += N;
                    }
                }
                return(_i.stress2);
            });
        }
Esempio n. 13
0
 public void setSurface(material _surface)
 {
     if (Enum.IsDefined(typeof(material), _surface))
     {
         this.surface = _surface;
     }
 }
Esempio n. 14
0
 public Desk(float width, float depth, int drawers, material surface)
 {
     this.width   = width;
     this.depth   = depth;
     this.drawers = drawers;
     this.surface = surface;
 }
Esempio n. 15
0
        public void setAvaibleOne(int matID)
        {
            material mat = db.materials.FirstOrDefault(x => x.matID == matID);

            mat.avaible = true;

            db.SaveChanges();
        }
Esempio n. 16
0
        public ActionResult DeleteConfirmed(int id)
        {
            material material = db.materials.Find(id);

            db.materials.Remove(material);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 17
0
 /// <summary>
 /// Takes out _currentMaterial
 /// </summary>
 private void takeOutMaterial(material mat)
 {
     setAbsoluteCoordinates();
     move(X_toClipPosition);
     move(Y_towerPositionsHookPull[(int)mat]);
     move(X_pullOutPosition);
     move(X_printPosition);
 }
 unsafe public formFindingMaterial()
 {
     m_mat = new material((_e, _i) =>
     {
         double n         = this.Power * this.Weight * Math.Pow(_e.Volume, this.Power - 1);
         _i.energyDensity = this.Weight * Math.Pow(_e.Volume, this.Power - 1);
         return(_i.stress2.zeros().plus_xA(n, _i.invMetric));
     });
 }
        public MaterialDto getMaterial(int id)
        {
            material    m           = db.materials.Where(s => s.id == id).FirstOrDefault();
            MaterialDto materialDto = new MaterialDto(m.id, m.name, supplierRepository.getSupplier(m.supplier_infor_id), m.barcode,
                                                      materialTypeRepository.getMaterialType(m.type_id), m.main_unit, m.change_unit,
                                                      statusRepository.getStatus(m.status_id));

            return(materialDto);
        }
Esempio n. 20
0
        public void setMaterial(materials.iMaterial mat, materials.iGravity gvt)
        {
            material m = mat.getMaterial();
            gravity  g = gvt.getGravity();

            foreach (elements.element e in this.elemList)
            {
                e.setMaterial(m, g);
            }
        }
Esempio n. 21
0
 public ActionResult Edit([Bind(Include = "id,material_name")] material material)
 {
     if (ModelState.IsValid)
     {
         db.Entry(material).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(material));
 }
Esempio n. 22
0
 public ActionResult Edit([Bind(Include = "ID,name")] material material)
 {
     //TODO: This action need to be deeply reviewed
     if (ModelState.IsValid)
     {
         db.Entry(material).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(material));
 }
Esempio n. 23
0
 RenderItems.Add(new RenderItem(
                     material,
                     vertexBuffer0,
                     vertexBuffer1,
                     cullFlags,
                     boundingBox,
                     world,
                     DrawCommand.Draw,
                     vertexStart,
                     vertexCount,
                     0, 0, null));
Esempio n. 24
0
 public ActionResult Edit([Bind(Include = "id_material,id_tipo_material,nome,sin_ativo")] material material)
 {
     if (ModelState.IsValid)
     {
         db.Entry(material).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_tipo_material = new SelectList(db.tipo_material, "id_tipo_material", "nome", material.id_tipo_material);
     return(View(material));
 }
Esempio n. 25
0
        public IHttpActionResult Getmaterial(int id)
        {
            material material = db.material.Find(id);

            if (material == null)
            {
                return(NotFound());
            }

            return(Ok(material));
        }
Esempio n. 26
0
        void getResult(double input1, double input2, double input3)
        {
            string  machineName = comboBox1.Text;
            machine mac         = new machine();

            machineDic.TryGetValue(machineName, out mac);
            string   materialName = comboBox2.Text;
            material mat          = new material();

            materialDic.TryGetValue(materialName, out mat);
        }
Esempio n. 27
0
        public ActionResult Create([Bind(Include = "id,material_name")] material material)
        {
            if (ModelState.IsValid)
            {
                db.materials.Add(material);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(material));
        }
        unsafe public neoHookeanMaterial()
        {
            m_mat = new material((_e, _i) =>
            {
                double J  = Math.Sqrt(_i.metric.det / _i.refMetric.det);
                int N     = _i.__N;
                double K  = m_K;
                double u1 = m_mu1;
                double KK = K / 2d * (J - 1d) /**J*/;//Cauchy stress なのでJで割る
                //_i.stress2.zeros();
                double I1 = 0;

                /*for (int i = 0; i < N; i++)
                 * {
                 *  for (int j = 0; j < N; j++)
                 *  {
                 *      I1 += _i.metric[i, j] * _i.refInvMetric[i, j];
                 *  }
                 * }
                 *
                 * for (int i = 0; i < N; i++)
                 * {
                 *  for (int j = 0; j < N; j++)
                 *  {
                 *      _i.stress2[i, j] = (_i.refInvMetric[i, j] - I1/3d  * _i.invMetric[i, j]) * u1
                 + K  /2d * (J - 1d) * _i.invMetric[i, j];
                 +  }
                 + }*/
                fixed(double *_ptr1 = &_i.metric.rawData[0, 0], _ptr2 = &_i.refInvMetric.rawData[0, 0], _ptr3 = &_i.invMetric.rawData[0, 0], _ptr4 = &_i.stress2.rawData[0, 0])
                {
                    double *ptr1 = _ptr1;
                    double *ptr2 = _ptr2;
                    for (int i = 0; i < N * N; i++)
                    {
                        I1 += *ptr1 * *ptr2;
                        ptr1++;
                        ptr2++;
                    }
                    ptr1         = _ptr1;
                    ptr2         = _ptr2;
                    double *ptr3 = _ptr3;
                    double *ptr4 = _ptr4;
                    for (int i = 0; i < N * N; i++)
                    {
                        *ptr4 = (*ptr2 - I1 / 3d * *ptr3) * u1 + KK * *ptr3; //全然違うやん!
                        ptr2++;
                        ptr3++;
                        ptr4++;
                    }
                }

                return(_i.stress2);
            });
        }
Esempio n. 29
0
        public static STGenericMaterial LoadMaterial(ColladaScene scene, material daeMat)
        {
            STGenericMaterial mat = new STGenericMaterial();

            mat.Name = daeMat.id;

            if (daeMat.instance_effect != null)
            {
                var effectid = daeMat.instance_effect.url.Remove(0, 1);
                if (scene.effectLookup.ContainsKey(effectid))
                {
                    var effect = scene.effectLookup[effectid];
                    if (effect.Items == null)
                    {
                        return(mat);
                    }

                    foreach (var item in effect.Items)
                    {
                        if (item.Items == null)
                        {
                            continue;
                        }

                        foreach (var param in item.Items)
                        {
                            if (param is common_newparam_type)
                            {
                                var newparam = (common_newparam_type)param;
                                if (newparam.ItemElementName == ItemChoiceType.surface)
                                {
                                    var surface = newparam.Item as fx_surface_common;
                                    var name    = surface.init_from[0].Value;
                                    mat.TextureMaps.Add(new STGenericTextureMap()
                                    {
                                        Name = name,
                                        Type = STTextureType.Diffuse,
                                    });
                                }
                            }
                            if (param is technique)
                            {
                                var technique = (technique)param;
                            }
                        }
                    }
                }
                else
                {
                    Console.WriteLine($"cannot find id! {effectid}");
                }
            }
            return(mat);
        }
Esempio n. 30
0
        private IDAEMaterial CreateMaterial(DAELoaderNode loader, material mat)
        {
            DAEEffect    efx = loader.LibEffects.GetEffect(loader, DAEUtils.GetUrl(mat.instance_effect.url).Id);
            IDAEMaterial m   = efx.CreateMaterial(loader);

            //TODO set parameter

            _materials.Add(mat.id, m);

            return(m);
        }