コード例 #1
0
        public ActionResult Create(ModelGroup.Book book)
        {
            if (ModelState.IsValid)
            {
                context.Books.Add(book);
                context.SaveChanges();

                return RedirectToAction("Index");
            }

            return View(book);
        }
コード例 #2
0
        public bool ContainsGroup(ModelGroup modelGroup)
        {
            bool containsGroupName            = this.GroupNames.GroupNames.Count(kvp => kvp.Key == modelGroup.GetInternalNameOffset()) > 0;
            bool containsDescriptiveGroupName = this.GroupNames.GroupNames.Count(kvp => kvp.Key == modelGroup.GetInternalDescriptiveNameOffset()) > 0;

            // sometimes, model groups don't contain a descriptive name.
            if (modelGroup.GetInternalDescriptiveNameOffset() > 0)
            {
                return(containsGroupName && containsDescriptiveGroupName);
            }

            return(containsGroupName);
        }
コード例 #3
0
        /// <summary>
        /// 添加信息分组
        /// </summary>
        /// <param name="g">信息分组对象</param>
        /// <returns>影响条目数</returns>
        public int AddGroup(ModelGroup g)
        {
            int rowAffects = 0;

            SqlParameter[] array =
            {
                new SqlParameter("@sn",    g.Sn),
                new SqlParameter("@title", g.Title),
                new SqlParameter("@memo",  g.Memo),
            };
            rowAffects = DBUtil.ExecuteNonQuery(SQL_addGroup, array);
            return(rowAffects);
        }
コード例 #4
0
        public override object GetValue(NodePort port)
        {
            object o = base.GetValue(port);

            if (o != null)
            {
                return(o);
            }

            Bezier3DSpline spline     = GetInputValue <Bezier3DSpline>("spline", this.spline);
            Material       material   = GetInputValue <Material>("material", this.material);
            float          resolution = GetInputValue <float>("resolution", this.resolution);

            if (spline != null)
            {
                List <Vector2> points = new List <Vector2>();
                for (int i = 0; i < spline.KnotCount; i++)
                {
                    Vector3 pos = spline.GetKnot(i).position;
                    points.Add(new Vector2(pos.x, pos.z));

                    Bezier3DCurve curve = spline.GetCurve(i);
                    if (!curve.isLinear)
                    {
                        for (int k = 1; k < resolution; k++)
                        {
                            float t = (float)k / resolution;
                            pos = curve.GetPoint(t);
                            points.Add(new Vector2(pos.x, pos.z));
                        }
                    }
                }
                int[]          tris  = Triangulate(points);
                List <Vector3> verts = points.Select(x => new Vector3(x.x, 0, x.y)).ToList();
                List <Vector3> norms = points.Select(x => Vector3.up).ToList();

                Mesh mesh = new Mesh();
                mesh.vertices  = verts.ToArray();
                mesh.triangles = tris;
                mesh.normals   = norms.ToArray();
                ModelGroup output = new ModelGroup();
                Material[] mats   = new Material[] { material };
                output.Add(new Model(mesh, mats));
                return(output);
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
        /*
         * To actually run this example, you'll need to train a sequence
         * model on the Indico IPA Platform with the labeled-swaps-200.csv
         * file contained with this repo. Be aware that training will likely
         * take a couple hours. Once training is complete, you can run the
         * example by passing in the directory of the two sample PDF files in
         * the repo (Confirmation letter and Confirmation of Interest Rate Swap).
         *
         * Before running, replace the Model Group ID (mgId) with the
         * ID for your trained model. You can find it on the model's Review page.
         */
        async static Task Main(string[] args)
        {
            // Replace this with your Model Group ID
            int mgId = 4352;

            List <string> targetFiles = GetTargetFiles(args[0]);

            if (targetFiles.Count == 0)
            {
                Console.WriteLine("No files to process");
                Environment.Exit(0);
            }

            IndicoClient client = new IndicoClient();

            JObject extractConfig = new JObject()
            {
                { "preset_config", "legacy" }
            };

            List <string>      texts    = new List <string>();
            DocumentExtraction ocrQuery = client.DocumentExtraction(extractConfig);

            foreach (string path in targetFiles)
            {
                Console.WriteLine(path);
                Job ocrJob = await ocrQuery.Exec(path);

                JObject result = await ocrJob.Result();

                string resUrl = (string)result.GetValue("url");
                Blob   blob   = await client.RetrieveBlob(resUrl).Exec();

                JObject obj = blob.AsJSONObject();
                texts.Add((string)obj.GetValue("text"));
            }

            ModelGroup mg = await client.ModelGroupQuery(mgId).Exec();

            string status = await client.ModelGroupLoad(mg).Exec();

            Console.WriteLine($"Model status = {status}");

            Job job = await client.ModelGroupPredict(mg).Data(texts).Exec();

            JArray jobResult = await job.Results();

            Console.WriteLine(jobResult);
        }
コード例 #6
0
 public Product(string reference, string name, string description, string categoryReference, Price price,
                List <Part> parts, List <ProductMaterial> productMaterialList, List <DimensionValues> dimensions,
                SlotDefinition slotDef, ModelGroup modelGroup)
 {
     this.Reference           = reference;
     this.Name                = name;
     this.Description         = description;
     this.CategoryReference   = categoryReference;
     this.Price               = price;
     this.Parts               = parts;
     this.ProductMaterialList = productMaterialList;
     this.Dimensions          = dimensions;
     this.SlotDefinition      = slotDef;
     this.ModelGroup          = modelGroup;
 }
コード例 #7
0
ファイル: InfoGroupBLL.cs プロジェクト: NingMoe/UniICWeb
        private List <ModelGroup> ToModelGroup(DataSet ds)
        {
            List <ModelGroup> list = new List <ModelGroup>();
            DataRowCollection rows = ds.Tables[0].Rows;

            for (int i = 0; i < rows.Count; i++)
            {
                ModelGroup g = new ModelGroup();
                g.Sn    = Convert.ToInt32(rows[i]["GrTypeSN"]);
                g.Title = rows[i]["Title"].ToString();
                g.Memo  = DBUtil.DBNullReplace(rows[i]["Memo"], "").ToString();
                list.Add(g);
            }
            return(list);
        }
コード例 #8
0
        /// <summary>
        /// 通过编码获取信息分组
        /// </summary>
        /// <param name="sn">信息分组编码</param>
        /// <returns></returns>
        public ModelGroup GetGroupBySN(int sn)
        {
            ModelGroup g = null;

            SqlParameter[] array = { new SqlParameter("@sn", sn) };
            DataSet        ds    = DBUtil.ExecuteQuery(SQL_getGroupBySN, array);

            if (ds.Tables[0].Rows.Count > 0)
            {
                g       = new ModelGroup();
                g.Sn    = sn;
                g.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                g.Memo  = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Memo"], "").ToString();
            }
            return(g);
        }
コード例 #9
0
        public ActionResult Edit(int id, ModelGroup.Book book)
        {
            ModelGroup.Book _book = context.Books.Single(p => p.BookID == id);

            if (ModelState.IsValid)
            {
                _book.BookName = book.BookName;
                _book.ISBN = book.ISBN;

                context.SaveChanges();

                return RedirectToAction("Index");
            }

            return View(book);
        }
コード例 #10
0
ファイル: FrmGroup.cs プロジェクト: pawit1357/BAirway
        private void B_ADD_Click(object sender, EventArgs e)
        {
            if (isValidInputData())
            {
                ModelGroup model = new ModelGroup();
                model.id                = this.id;
                model.group_code        = txtCode.Text;
                model.group_description = txtDesc.Text;
                model.group_order       = Convert.ToInt32(txtOrder.Text);

                Boolean result = false;
                switch (B_ADD.Text)
                {
                case "บันทึก":
                    //Check Exist
                    List <ModelGroup> stationLists = groupDao.Select(" Where group_code='" + model.group_code + "'");
                    if (stationLists.Count > 0)
                    {
                        MessageBox.Show("มีข้อมูล " + model.group_code + " ในระบบแล้ว");
                        txtCode.SelectAll();
                        txtCode.Focus();
                        //txtDesc.Text = "";
                    }
                    else
                    {
                        result = groupDao.Insert(model);
                        if (result)
                        {
                            MessageBox.Show("บันทึกข้อมูลเรียบร้อยแล้ว");
                        }
                    }
                    break;

                case "แก้ไข":
                    result = groupDao.Update(model);
                    if (result)
                    {
                        MessageBox.Show("แก้ไขข้อมูลเรียบร้อยแล้ว");
                    }
                    break;
                }
                if (result)
                {
                    refresh();
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Initialize the OpenGL state of the given model group.
        /// </summary>
        /// <param name="modelGroup">The model group to initialize.</param>
        private void InitializeModelGroup(ModelGroup modelGroup)
        {
            /*
             *  Buffers
             */

            var vertexBuffer     = new Buffer <Vector3>(BufferTarget.ArrayBuffer, BufferUsageHint.StaticDraw);
            var normalBuffer     = new Buffer <Vector3>(BufferTarget.ArrayBuffer, BufferUsageHint.StaticDraw);
            var coordinateBuffer = new Buffer <Vector2>(BufferTarget.ArrayBuffer, BufferUsageHint.StaticDraw);
            var vertexIndexes    = new Buffer <ushort>(BufferTarget.ElementArrayBuffer, BufferUsageHint.StaticDraw);

            // Upload all of the vertices in this group
            vertexBuffer.Data = modelGroup.GetVertices().Select(v => v.ToOpenGLVector()).ToArray();
            _vertexBufferLookup.Add(modelGroup, vertexBuffer);

            vertexBuffer.AttachAttributePointer(new VertexAttributePointer(0, 3, VertexAttribPointerType.Float, 0, 0));

            // Upload all of the normals in this group
            normalBuffer.Data = modelGroup.GetNormals().Select(v => v.ToOpenGLVector()).ToArray();
            _normalBufferLookup.Add(modelGroup, normalBuffer);

            normalBuffer.AttachAttributePointer(new VertexAttributePointer(1, 3, VertexAttribPointerType.Float, 0, 0));

            // Upload all of the UVs in this group
            coordinateBuffer.Data = modelGroup.GetTextureCoordinates().Select(v => v.ToOpenGLVector()).ToArray();
            _textureCoordinateBufferLookup.Add(modelGroup, coordinateBuffer);

            coordinateBuffer.AttachAttributePointer
            (
                new VertexAttributePointer(2, 2, VertexAttribPointerType.Float, 0, 0)
            );

            // Upload vertex indices for this group
            vertexIndexes.Data = modelGroup.GetVertexIndices().ToArray();
            _vertexIndexBufferLookup.Add(modelGroup, vertexIndexes);

            var boundingBox = new RenderableBoundingBox
                              (
                modelGroup.GetBoundingBox(),
                this.ActorTransform
                              );

            boundingBox.Initialize();

            _boundingBoxLookup.Add(modelGroup, boundingBox);
        }
コード例 #12
0
ファイル: HandModelManager.cs プロジェクト: nexttai/leap_AR
        private void InitializeModelGroup(ModelGroup collectionGroup)
        {
            // Prevent the ModelGroup be initialized by multiple times
            if (modelGroupMapping.ContainsValue(collectionGroup))
            {
                return;
            }

            collectionGroup._handModelManager = this;
            HandModelBase leftModel;
            HandModelBase rightModel;

            if (collectionGroup.IsLeftToBeSpawned)
            {
                HandModelBase modelToSpawn = collectionGroup.LeftModel;
                GameObject    spawnedGO    = Instantiate(modelToSpawn.gameObject);
                leftModel = spawnedGO.GetComponent <HandModelBase>();
                leftModel.transform.parent = this.transform;
            }
            else
            {
                leftModel = collectionGroup.LeftModel;
            }
            if (leftModel != null)
            {
                collectionGroup.modelList.Add(leftModel);
                modelGroupMapping.Add(leftModel, collectionGroup);
            }

            if (collectionGroup.IsRightToBeSpawned)
            {
                HandModelBase modelToSpawn = collectionGroup.RightModel;
                GameObject    spawnedGO    = Instantiate(modelToSpawn.gameObject);
                rightModel = spawnedGO.GetComponent <HandModelBase>();
                rightModel.transform.parent = this.transform;
            }
            else
            {
                rightModel = collectionGroup.RightModel;
            }
            if (rightModel != null)
            {
                collectionGroup.modelList.Add(rightModel);
                modelGroupMapping.Add(rightModel, collectionGroup);
            }
        }
コード例 #13
0
ファイル: FrmGroup.cs プロジェクト: pawit1357/BAirway
 private void B_DELETE_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Really delete?", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         ModelGroup model = new ModelGroup();
         model.id                = this.id;
         model.group_code        = txtCode.Text;
         model.group_description = txtDesc.Text;
         model.group_order       = Convert.ToInt32(txtOrder.Text);
         Boolean result = groupDao.Delete(model);
         if (result)
         {
             MessageBox.Show("ลบข้อมูลเรียบร้อยแล้ว");
             refresh();
         }
     }
 }
コード例 #14
0
        private void RenderBoundingBox(ModelGroup modelGroup, Matrix4 modelViewProjection, Color4 colour)
        {
            BoundingBoxShader boxShader = this.Cache.GetShader(EverlookShader.BoundingBox) as BoundingBoxShader;

            if (boxShader == null)
            {
                throw new ShaderNullException(typeof(BoundingBoxShader));
            }

            boxShader.Enable();
            boxShader.SetMVPMatrix(modelViewProjection);
            boxShader.SetLineColour(colour);

            GL.Disable(EnableCap.CullFace);

            // Render the object
            // Send the vertices to the shader
            GL.EnableVertexAttribArray(0);
            GL.BindBuffer(BufferTarget.ArrayBuffer, this.BoundingBoxVertexBufferLookup[modelGroup]);
            GL.VertexAttribPointer
            (
                0,
                3,
                VertexAttribPointerType.Float,
                false,
                0,
                0
            );

            // Bind the index buffer
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, this.BoundingBoxVertexIndexBufferID);

            // Now draw the box
            GL.DrawRangeElements
            (
                PrimitiveType.LineLoop,
                0,
                23,
                24,
                DrawElementsType.UnsignedByte,
                new IntPtr(0)
            );

            GL.DisableVertexAttribArray(0);
        }
コード例 #15
0
ファイル: UVTRS.cs プロジェクト: UnityProjIT/Graphmesh
        public override object GetValue(NodePort port)
        {
            object o = base.GetValue(port);

            if (o != null)
            {
                return(o);
            }

            // Get inputs
            ModelGroup[] input = GetInputValues("input", this.input);
            Vector2      t     = GetInputValue("t", this.t);
            float        r     = GetInputValue("r", this.r);
            Vector2      s     = GetInputValue("s", this.s);

            ModelGroup output = new ModelGroup();

            // Loop through input model groups
            for (int mg = 0; mg < input.Length; mg++)
            {
                if (input[mg] == null)
                {
                    continue;
                }
                // Loop through group models
                for (int i = 0; i < input[mg].Count; i++)
                {
                    Mesh      mesh = input[mg][i].mesh.Copy();
                    Vector2[] uvs  = mesh.uv;
                    for (int u = 0; u < uvs.Length; u++)
                    {
                        uvs[u] += t;
                        // TODO rotation
                        uvs[u] *= s;
                    }
                    mesh.uv = uvs;
                    output.Add(new Model(input[mg][i])
                    {
                        mesh = mesh
                    });
                }
            }
            return(output);
        }
コード例 #16
0
        private ModelGroup ModelsFromGameObjects(Transform root)
        {
            ModelGroup output = new ModelGroup();

            MeshRenderer[] renderers = root.GetComponentsInChildren <MeshRenderer>();
            for (int i = 0; i < renderers.Length; i++)
            {
                MeshRenderer renderer = renderers[i];
                MeshFilter   filter   = renderer.GetComponent <MeshFilter>();
                if (filter == null)
                {
                    continue;
                }
                Mesh       mesh      = BakeMeshTransform(root, filter);
                Material[] materials = renderer.sharedMaterials;
                output.Add(new Model(mesh, materials));
            }
            return(output);
        }
コード例 #17
0
ファイル: GroupDao.cs プロジェクト: pawit1357/BAirway
 //Delete statement
 public Boolean Delete(ModelGroup model)
 {
     try
     {
         string query = "DELETE FROM tb_group WHERE id=" + model.id;
         using (MySqlConnection connection = new MySqlConnection(Configurations.MysqlStr))
         {
             connection.Open();
             MySqlCommand cmd = new MySqlCommand(query, connection);
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.InnerException);
         return(false);
     }
     return(true);
 }
コード例 #18
0
ファイル: GroupDao.cs プロジェクト: pawit1357/BAirway
        //Select statement
        public List <ModelGroup> Select(String cri)
        {
            string query = "SELECT * FROM tb_group " + cri + " order by group_order asc";

            //Create a list to store the result
            List <ModelGroup> lists = new List <ModelGroup>();

            //Open connection
            using (MySqlConnection connection = new MySqlConnection(Configurations.MysqlStr))
            {
                connection.Open();
                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, connection);
                //Create a data reader and Execute the command
                MySqlDataReader dr = cmd.ExecuteReader();

                //Read the data and store them in the list
                while (dr.Read())
                {
                    ModelGroup model = new ModelGroup();
                    model.id                = (DBNull.Value == dr["id"]) ? -1 : Convert.ToInt16(dr["id"]);
                    model.group_code        = (DBNull.Value == dr["group_code"]) ? "" : Convert.ToString(dr["group_code"]);
                    model.group_description = (DBNull.Value == dr["group_description"]) ? "" : Convert.ToString(dr["group_description"]);
                    model.group_order       = Convert.ToInt16((DBNull.Value == dr["group_order"]) ? "0" : Convert.ToString(dr["group_order"]));
                    lists.Add(model);
                }

                //close Data Reader
                dr.Close();
            }

            //return list to be displayed
            if (lists.Count > 0)
            {
                ModelGroup model1 = new ModelGroup();
                model1.id                = -1;
                model1.group_code        = "";
                model1.group_description = "";
                model1.group_order       = 0;
                lists.Insert(0, model1);
            }
            return(lists);
        }
コード例 #19
0
        public ActionResult Create(ModelGroup.Review review)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ModelGroup.Book book = context.Books.SingleOrDefault(b => b.BookID == review.BookID);
                    book.Reviews.Add(review);
                    context.SaveChanges();

                    return RedirectToAction("Details", "Books", new {id = book.BookID});
                }

                return View();
            }
            catch
            {
                return View();
            }
        }
コード例 #20
0
        override public List <List <Property> > ApplySpecialProperties(ModelGroup test, List <List <Property> > combos)
        {
            // Adds UV 0 for both primitives into each model
            var uv0Prim0 = requiredProperty.Find(e => e.name == Propertyname.Primitive0VertexUV0);
            var uv1Prim0 = requiredProperty.Find(e => e.name == Propertyname.Primitive1VertexUV0);

            foreach (var combo in combos)
            {
                combo.Add(uv0Prim0);
                combo.Add(uv1Prim0);
            }

            // Moves the texture combos next to each other
            var baseColorTexture = combos[5];

            combos.RemoveAt(5);
            combos.Insert(4, baseColorTexture);

            return(combos);
        }
コード例 #21
0
ファイル: FollowSpline.cs プロジェクト: UnityProjIT/Graphmesh
        public override object GetValue(NodePort port)
        {
            object o = base.GetValue(port);

            if (o != null)
            {
                return(o);
            }

            ModelGroup[]   input  = GetInputValues <ModelGroup>("input", this.input);
            Bezier3DSpline spline = GetInputValue <Bezier3DSpline>("spline", this.spline);
            ModelGroup     output = new ModelGroup();

            if (input == null)
            {
                return(output);
            }

            // Loop through input model groups
            for (int mg = 0; mg < input.Length; mg++)
            {
                if (input[mg] == null)
                {
                    continue;
                }
                // Loop through group models
                for (int i = 0; i < input[mg].Count; i++)
                {
                    Mesh mesh = input[mg][i].mesh.Copy();
                    if (spline != null)
                    {
                        FollowCurve(mesh, spline);
                    }
                    output.Add(new Model(input[mg][i])
                    {
                        mesh = mesh
                    });
                }
            }
            return(output);
        }
コード例 #22
0
ファイル: HandPool.cs プロジェクト: Qiao126/Hitting-ball
        /**
         * MakeHandRepresentation receives a Hand and combines that with an IHandModel to create a HandRepresentation
         * @param hand The Leap Hand data to be drive an IHandModel
         * @param modelType Filters for a type of hand model, for example, physics or graphics hands.
         */

        public override HandRepresentation MakeHandRepresentation(Hand hand, ModelType modelType)
        {
            Chirality          handChirality = hand.IsRight ? Chirality.Right : Chirality.Left;
            HandRepresentation handRep       = new HandProxy(this, hand, handChirality, modelType);

            for (int i = 0; i < ModelPool.Count; i++)
            {
                ModelGroup group = ModelPool[i];
                if (group.IsEnabled)
                {
                    IHandModel model = group.TryGetModel(handChirality, modelType);
                    if (model != null)
                    {
                        handRep.AddModel(model);
                        modelToHandRepMapping.Add(model, handRep);
                    }
                }
            }
            activeHandReps.Add(handRep);
            return(handRep);
        }
コード例 #23
0
 public void EnableGroup(string groupName)
 {
     for (int i = 0; i < ModelPool.Count; i++)
     {
         if (ModelPool[i].GroupName == groupName)
         {
             ModelGroup group = ModelPool[i];
             for (int hp = 0; hp < activeHandReps.Count; hp++)
             {
                 HandRepresentation handRep = activeHandReps[hp];
                 IHandModel         model   = group.TryGetModel(handRep.RepChirality, handRep.RepType);
                 if (model != null)
                 {
                     handRep.AddModel(model);
                     modelToHandRepMapping.Add(model, handRep);
                 }
             }
             group.IsEnabled = true;
         }
     }
 }
コード例 #24
0
        public void ToggleGroup(string groupName)
        {
            ModelGroup modelGroup = ModelPool.Find(i => i.GroupName == groupName);

            if (modelGroup != null)
            {
                if (modelGroup.IsEnabled == true)
                {
                    DisableGroup(groupName);
                    modelGroup.IsEnabled = false;
                }
                else
                {
                    EnableGroup(groupName);
                    modelGroup.IsEnabled = true;
                }
            }
            else
            {
                Debug.LogWarning("A group matching that name does not exisit in the modelPool");
            }
        }
コード例 #25
0
        /*
         * Get the progress (% complete) of a training model group. This
         * is handy as some sequence models can take a very long time (hours)
         * to train. Pass your model's Model Group ID on the command line.
         * You can find the model group ID on your model's Review page.
         */
        async static Task Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Please provide a model group id");
                Environment.Exit(0);
            }

            int mgId = Int32.Parse(args[0]);

            IndicoConfig config = new IndicoConfig(
                host: "app.indico.io"
                );

            IndicoClient client = new IndicoClient(config);
            ModelGroup   mg     = await client.ModelGroupQuery(mgId).Exec();

            JArray trainingStatus = await client.TrainingModelWithProgressQuery(mg).Exec();

            Console.WriteLine(mg.Name);
            Console.WriteLine(trainingStatus);
        }
コード例 #26
0
        /**
         * MakeHandRepresentation receives a Hand and combines that with an IHandModel to create a HandRepresentation
         * @param hand The Leap Hand data to be drive an IHandModel
         * @param modelType Filters for a type of hand model, for example, physics or graphics hands.
         */

        public override HandRepresentation MakeHandRepresentation(Hand hand, ModelType modelType)
        {
            VRGIN.Core.VRLog.Info("Make hand representation: {0}", modelType);

            Chirality          handChirality = hand.IsRight ? Chirality.Right : Chirality.Left;
            HandRepresentation handRep       = new HandProxy(this, hand, handChirality, modelType);

            for (int i = 0; i < ModelPool.Count; i++)
            {
                VRGIN.Core.VRLog.Info("Try group {0}", i);

                ModelGroup group = ModelPool[i];
                if (group.IsEnabled)
                {
                    VRGIN.Core.VRLog.Info("Enabled!");
                    try
                    {
                        IHandModel model = group.TryGetModel(handChirality, modelType);
                        if (model != null)
                        {
                            VRGIN.Core.VRLog.Info("Model found");
                            handRep.AddModel(model);

                            modelToHandRepMapping.Add(model, handRep);
                        }
                        else
                        {
                            VRGIN.Core.VRLog.Info("Model is null");
                        }
                    } catch (System.Exception e)
                    {
                        VRGIN.Core.VRLog.Error(e);
                    }
                }
            }
            activeHandReps.Add(handRep);
            return(handRep);
        }
コード例 #27
0
ファイル: GroupDao.cs プロジェクト: pawit1357/BAirway
        public Boolean InsertOffline(ModelGroup model)
        {
            try
            {
                string query = "INSERT INTO tb_group(group_code,group_description,group_order) VALUES('" + model.group_code + "','" + model.group_description + "'," + model.group_order + ")";
                //open connection
                using (SQLiteConnection connection = new SQLiteConnection(Configurations.SqLiteStr))
                {
                    connection.Open();
                    //create command and assign the query and connection from the constructor
                    SQLiteCommand cmd = new SQLiteCommand(query, connection);

                    //Execute command
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.InnerException);
                return(false);
            }
            return(true);
        }
コード例 #28
0
        public override void Setup(ModelGroup group, HashSet <Brick> bricks, List <MeshRenderer> scopedPartRenderers, Vector3 brickPivotOffset, Bounds scopedBounds, bool cameraAlignedRotation, bool cameraRelativeMovement)
        {
            base.Setup(group, bricks, scopedPartRenderers, brickPivotOffset, scopedBounds, cameraAlignedRotation, cameraRelativeMovement);

            m_Bricks = bricks;
            m_ScopedPartRenderers = scopedPartRenderers;
            m_Bounds = scopedBounds;

            // Change the shader of all scoped part renderers.
            foreach (var partRenderer in scopedPartRenderers)
            {
                m_OriginalShaders.Add(partRenderer.sharedMaterial.shader);

                // The renderQueue value is reset when changing the shader, so transfer it.
                var renderQueue = partRenderer.material.renderQueue;
                partRenderer.material.shader      = Shader.Find("Deformed");
                partRenderer.material.renderQueue = renderQueue;

                m_Materials.Add(partRenderer.material);
            }

            m_AnimationPivot = transform.InverseTransformVector(new Vector3(m_Bounds.center.x, m_Bounds.min.y, m_Bounds.center.z) - transform.position);
        }
コード例 #29
0
        private void RenderBoundingBox(ModelGroup modelGroup, Matrix4 modelViewProjection, Color4 colour)
        {
            GL.UseProgram(this.BoundingBoxShaderID);
            GL.Disable(EnableCap.CullFace);

            // Render the object
            // Send the vertices to the shader
            GL.EnableVertexAttribArray(0);
            GL.BindBuffer(BufferTarget.ArrayBuffer, this.boundingBoxVertexBufferLookup[modelGroup]);
            GL.VertexAttribPointer(
                0,
                3,
                VertexAttribPointerType.Float,
                false,
                0,
                0);

            // Bind the index buffer
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, this.boundingBoxVertexIndexBufferID);

            // Send the model matrix to the shader
            int projectionShaderVariableHandle = GL.GetUniformLocation(this.BoundingBoxShaderID, "ModelViewProjection");

            GL.UniformMatrix4(projectionShaderVariableHandle, false, ref modelViewProjection);

            // Send the box colour to the shader
            int boxColourShaderVariableHandle = GL.GetUniformLocation(this.BoundingBoxShaderID, "boxColour");

            GL.Uniform4(boxColourShaderVariableHandle, colour);

            // Now draw the box
            GL.DrawRangeElements(PrimitiveType.LineLoop, 0,
                                 23, 24,
                                 DrawElementsType.UnsignedByte, new IntPtr(0));

            GL.DisableVertexAttribArray(0);
        }
コード例 #30
0
ファイル: HandModelManager.cs プロジェクト: nexttai/leap_AR
        private IEnumerator toggleGroup(string groupName)
        {
            yield return(new WaitForEndOfFrame());

            ModelGroup modelGroup = ModelPool.Find(i => i.GroupName == groupName);

            if (modelGroup != null)
            {
                if (modelGroup.IsEnabled == true)
                {
                    DisableGroup(groupName);
                    modelGroup.IsEnabled = false;
                }
                else
                {
                    EnableGroup(groupName);
                    modelGroup.IsEnabled = true;
                }
            }
            else
            {
                Debug.LogWarning("A group matching that name does not exisit in the modelPool");
            }
        }
コード例 #31
0
        /*
         * To actually run this example, you need to train a classifier in
         * the Indico IPA Platform using the reviews.csv file included in
         * this repo. After the model is trained, just pass its model group
         * ID into this sample as a command line arg. You can find the model
         * group ID on your trained model's Review page.
         */
        async static Task Main(string[] args)
        {
            int mgId = -1;

            if (args.Length != 1)
            {
                Console.WriteLine("Please provide model group and selected model IDs");
                System.Environment.Exit(0);
            }
            else
            {
                mgId = Int32.Parse(args[0]);
            }

            IndicoConfig config = new IndicoConfig(
                host: "app.indico.io"
            );

            IndicoClient client = new IndicoClient(config);

            ModelGroup mg = await client.ModelGroupQuery(mgId).Exec();

            // Load Model
            string status = await client.ModelGroupLoad(mg).Exec();

            List<string> reviews = new List<string>()
            {
                "This was the best food of our trip. Fantastic experience!",
                "The service was rude and the food was awful. Don\'t waste your time!"
            };

            Job job = await client.ModelGroupPredict(mg).Data(reviews).Exec();

            JArray jobResult = await job.Results();
            Console.WriteLine(jobResult);
        }
コード例 #32
0
 public void DisableGroup(string groupName)
 {
     for (int i = 0; i < ModelPool.Count; i++)
     {
         ModelGroup group = null;
         if (ModelPool[i].GroupName == groupName)
         {
             group = ModelPool[i];
             for (int m = 0; m < group.modelsCheckedOut.Count; m++)
             {
                 IHandModel         model = group.modelsCheckedOut[m];
                 HandRepresentation handRep;
                 if (modelToHandRepMapping.TryGetValue(model, out handRep))
                 {
                     handRep.RemoveModel(model);
                     group.ReturnToGroup(model);
                     m--;
                 }
             }
             Assert.AreEqual(0, group.modelsCheckedOut.Count, group.GroupName + "'s modelsCheckedOut List has not been cleared");
             group.IsEnabled = false;
         }
     }
 }
コード例 #33
0
        /**
         * MakeHandRepresentation receives a Hand and combines that with an IHandModel to create a HandProxy
         * @param hand The Leap Hand data to be drive an IHandModel
         * @param modelType Filters for a type of hand model, for example, physics or graphics hands.
         */

        public override HandRepresentation MakeHandRepresentation(Hand hand, ModelType modelType, bool IsRemote)
        {
            Chirality handChirality = hand.IsRight ? Chirality.Right : Chirality.Left;
            HandProxy handRep       = new HandProxy(this, hand, handChirality, modelType, IsRemote);

            for (int i = 0; i < ModelPool.Count; i++)
            {
                ModelGroup group = ModelPool[i];
                if (group.IsEnabled && IsRemote == group.IsRemote)                              // Make Sure Remote for remote  and  unremote for unremote
                {
                    IHandModel model = group.TryGetModel(handChirality, modelType);
                    if (model != null)
                    {
                        handRep.AddModel(model);
                        if (!modelToHandRepMapping.ContainsKey(model))
                        {
                            modelToHandRepMapping.Add(model, handRep);
                        }
                    }
                }
            }
            activeHandReps.Add(handRep);
            return(handRep);
        }
コード例 #34
0
ファイル: HandPool.cs プロジェクト: WilliamRADFunk/vedic
 public void AddNewGroup(string groupName, IHandModel leftModel, IHandModel rightModel) {
   ModelGroup newGroup = new ModelGroup();
   newGroup.LeftModel = leftModel;
   newGroup.RightModel = rightModel;
   newGroup.GroupName = groupName;
   newGroup.CanDuplicate = false;
   newGroup.IsEnabled = true;
   ModelPool.Add(newGroup);
 }
コード例 #35
0
        public ActionResult Delete(int id, ModelGroup.Book book)
        {
            ModelGroup.Book _book = context.Books.Single(p => p.BookID == id);
            context.Books.Remove(_book);
            context.SaveChanges();

            return RedirectToAction("Index");
        }