コード例 #1
0
        public static void dumptree(grammar g, node n)
        {
            int i;

            if (n == null)
            {
                printf("NIL");
            }
            else
            {
                label l = new label();
                l.lb_type = TYPE(n);
                l.lb_str  = STR(n);
                printf("%s", PyGrammar_LabelRepr(l));
                if (ISNONTERMINAL(TYPE(n)))
                {
                    printf("(");
                    for (i = 0; i < NCH(n); i++)
                    {
                        if (i > 0)
                        {
                            printf(",");
                        }
                        dumptree(g, CHILD(n, i));
                    }
                    printf(")");
                }
            }
        }
コード例 #2
0
ファイル: LabelController.cs プロジェクト: GuoLinJun99/yi.bbs
        //需要用户id和主题id,将这个标签归属与这个用户
        public async Task <Result> AddLabelByUserId(label myLabel)
        {
            myLabel.user = await _userBll.GetEntities(u => u.id == _user.id).FirstOrDefaultAsync();

            _labelBll.Add(myLabel);
            return(Result.Success());
        }
コード例 #3
0
        private void button_modify_Click(object sender, RoutedEventArgs e)
        {
            string        LanguageName     = (listview_locallabel.SelectedItem as label).lang;
            string        ElementNameValue = (listview_locallabel.SelectedItem as label).Text[0];
            List <string> ExistList        = new List <string>();

            foreach (label Item in LanguageList)
            {
                ExistList.Add(Item.lang);
            }

            LocalizationWizard LWizard = new LocalizationWizard("Name", LanguageName, ElementNameValue, ExistList: ExistList);

            if (LWizard.ShowDialog() == true)
            {
                if (LanguageList.Contains((listview_locallabel.SelectedItem as label)))
                {
                    LanguageList.Remove((listview_locallabel.SelectedItem as label));
                }

                var label = new label();
                label.lang = LWizard.LangComboBox.Text;
                label.Text = LWizard.ElementNameTextBox.Text.Trim().Split('\n');
                LanguageList.Add(label);
            }

            if (listview_locallabel.Items.Count == 0 || listview_locallabel.SelectedItem == null)
            {
                LangListBtnEnable(false);
            }
        }
コード例 #4
0
ファイル: grammar1.c.cs プロジェクト: weimingtom/cecilia
        public static CharPtr PyGrammar_LabelRepr(label lb)
        {
            //static char buf[100];

            if (lb.lb_type == ENDMARKER)
            {
                return("EMPTY");
            }
            else if (ISNONTERMINAL(lb.lb_type))
            {
                if (lb.lb_str == null)
                {
                    PyOS_snprintf(PyGrammar_LabelRepr_buf, 100 /*sizeof(buf)*/, "NT%d", lb.lb_type);
                    return(new CharPtr(PyGrammar_LabelRepr_buf));
                }
                else
                {
                    return(new CharPtr(lb.lb_str));
                }
            }
            else
            {
                if (lb.lb_str == null)
                {
                    return(_PyParser_TokenNames[lb.lb_type]);
                }
                else
                {
                    PyOS_snprintf(PyGrammar_LabelRepr_buf, 100 /*sizeof(buf)*/, "%.32s(%.32s)",
                                  _PyParser_TokenNames[lb.lb_type], lb.lb_str);
                    return(new CharPtr(PyGrammar_LabelRepr_buf));
                }
            }
        }
コード例 #5
0
 private void createLoadingLabel()
 {
     lblLoading           = new label(assetManager.FontLib["UIHeader"]);
     lblLoading.isVisible = true;
     lblLoading.Text      = "Loading...";
     lblLoading.TextColor = Color.White;
     lblLoading.Position  = new Point(graphics.PreferredBackBufferWidth / 2 - lblLoading.Width, graphics.PreferredBackBufferHeight / 2);
 }
コード例 #6
0
        public ActionResult Verwijderen(int id)
        {
            label label = db.labels.Where(x => x.labelid == id).FirstOrDefault();

            db.labels.Remove(label);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #7
0
        public static object UsuarioEncrypt()
        {
            XmlDocument xmlDocument = new XmlDocument();
            label       root        = new label();

            dbcnString = root.ToString();
            CnString   = (aes.Decrypt(dbcnString, appPwdUnique, int.Parse("256")));
            return(CnString);
        }
コード例 #8
0
        public static object UsuariosEncryp()
        {
            XmlDocument doc  = new XmlDocument();
            label       root = new label();

            dbcnString = root.ToString();
            cnString   = (aes.Decrypt(dbcnString, apppwdunique, int.Parse("256")));
            return(cnString);
        }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "labelid,labelname")] label labels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(labels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(labels));
 }
コード例 #10
0
ファイル: SelectMenu.cs プロジェクト: badhitman/HtmlGenerator
        public SelectMenu(string Label, select my_select)
        {
            if (!string.IsNullOrEmpty(Label))
            {
                LabelSelectMenu = new label(Label, my_select.Id_DOM);
            }

            tag_custom_name = typeof(div).Name;
            AddCSS("form-group");
            Select = my_select;
            Select.AddCSS("form-control");
        }
コード例 #11
0
        public TextInput(string Label, string InputID)
        {
            Input.AddCSS("form-control");
            tag_custom_name = typeof(div).Name;
            if (!string.IsNullOrEmpty(Label))
            {
                LabelInput = new label(Label, InputID);
            }

            Input.Name   = InputID;
            Input.Id_DOM = InputID;
        }
コード例 #12
0
        public CheckboxInput(string Label, string InputID)
        {
            Input.AddCSS("form-check-input");
            tag_custom_name = typeof(div).Name;
            AddCSS("form-check");

            if (!string.IsNullOrEmpty(Label))
            {
                LabelInput = new label(Label, InputID);
                LabelInput.AddCSS("form-check-label");
            }
            Input.Id_DOM = InputID;
        }
コード例 #13
0
        // GET: label/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            label labels = db.labels.Find(id);

            if (labels == null)
            {
                return(HttpNotFound());
            }
            return(View(labels));
        }
コード例 #14
0
 public ActionResult Create([Bind(Include = "labelid,labelname")] label labels)
 {
     if (ModelState.IsValid && labels.labelname != null)
     {
         if (db.labels.Any(check => check.labelname == labels.labelname))
         {
             ViewBag.Message = string.Format("Label Exist");
             return(View());
         }
         db.labels.Add(labels);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectToAction("Index"));
     }
 }
コード例 #15
0
        private void button_add_Click(object sender, RoutedEventArgs e)
        {
            List <string> ExistList = new List <string>();

            foreach (label Item in LanguageList)
            {
                ExistList.Add(Item.lang);
            }

            LocalizationWizard LWizard = new LocalizationWizard("Name", ExistList: ExistList);

            if (LWizard.ShowDialog() == true)
            {
                var label = new label();
                label.lang = LWizard.LangComboBox.Text;
                label.Text = LWizard.ElementNameTextBox.Text.Trim().Split('\n');
                LanguageList.Add(label);
            }
        }
コード例 #16
0
        protected virtual void TestStarted(string suitId, MSTestResult testResult)
        {
            TestCaseStartedWithTimeEvent testCase = new TestCaseStartedWithTimeEvent(suitId, testResult.Name, testResult.Start);

            if (testResult.Owner != null)
            {
                label ownerLabel = new label("Owner", testResult.Owner);

                testCase.Labels = new label[] { ownerLabel };

                // allure doesnt support custom labels so until issue #394 is solved
                // the test description is used.
                //
                // https://github.com/allure-framework/allure-core/issues/394

                string description = FormatDescription(testResult);

                testCase.Description = new description(descriptiontype.text, description);
            }

            Allure.Lifecycle.Fire(testCase);
        }
コード例 #17
0
ファイル: Surface.cs プロジェクト: xmatakt/bakalarka
        private void LoadData(string pathToFile)
        {
            label label = new label(SetToolStripLabel);
            progres progres = new progres(SetProgressBar);
            form.statusStrip1.Invoke(label, "Prebieha načítavanie dát...");
            int count = File.ReadLines(pathToFile).Count();
            int d = count / 100;
            StreamReader sr;
            Vector3 tmp;
            char[] separator = { ' ', '\t' };
            string[] line;
            try
            {
                sr = new StreamReader(pathToFile);
                while (!sr.EndOfStream)
                {
                    line = sr.ReadLine().Split(separator);
                    tmp = new Vector3(float.Parse(line[0]), float.Parse(line[1]), float.Parse(line[2]));
                    coords.Add(tmp);
                    if (coords.Last().X < minX)
                        minX = coords.Last().X;
                    if (coords.Last().X > maxX)
                        maxX = coords.Last().X;
                    if (coords.Last().Y < minY)
                        minY = coords.Last().Y;
                    if (coords.Last().Y > maxY)
                        maxY = coords.Last().Y;
                    if (coords.Last().Z < min)
                        min = coords.Last().Z;
                    if (coords.Last().Z > max)
                        max = coords.Last().Z;

                    if (coords.Count % d == 0)
                        form.statusStrip1.Invoke(progres, 100 * coords.Count / count);
                }
                sr.Close();
            }
            catch (FileNotFoundException)
            {
                System.Windows.Forms.MessageBox.Show("Subor sa nenasiel!");
            }
        }
コード例 #18
0
 select(label, inst);
コード例 #19
0
        /// <summary>
        /// Initializes a new instance of the MainWindow class.
        /// </summary>
        public MainWindow()
        {
            // one sensor is currently supported
            this.kinectSensor = KinectSensor.GetDefault();

            // get the coordinate mapper
            this.coordinateMapper = this.kinectSensor.CoordinateMapper;

            // get the depth (display) extents
            FrameDescription frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription;

            // get size of joint space
            this.displayWidth  = frameDescription.Width;
            this.displayHeight = frameDescription.Height;



            //new vars

            // open the reader for the color frames
            this.colorFrameReader = this.kinectSensor.ColorFrameSource.OpenReader();

            // wire handler for frame arrival
            this.colorFrameReader.FrameArrived += this.Reader_ColorFrameArrived;


            // create the colorFrameDescription from the ColorFrameSource using Bgra format
            //added func to send image
            FrameDescription colorFrameDescription = this.kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra);

            // create the bitmap to display
            this.colorBitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null);

            //run python file on image


            ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(@Directory.GetCurrentDirectory() + "/tensorflow_cpu/python.exe");

            myProcessStartInfo.Arguments = "evaluate.py";
            Process myProcess = new Process();

            myProcess.StartInfo = myProcessStartInfo;
            myProcess.Start();
            myProcess.WaitForExit();
            myProcess.Close();

            // read in file

            string[] lines = File.ReadAllLines("boxes.txt");

            foreach (string line in lines)
            {
                string[] sections = line.Split(':');

                string[] box    = sections[1].Split(',');
                double[] intBox = Array.ConvertAll(box, Double.Parse);
                double   x0     = intBox[0] * displayWidth;
                double   y0     = intBox[1] * displayHeight;
                double   w      = intBox[2] * displayWidth;
                double   h      = intBox[3] * displayHeight;
                double[] bbox   = { x0, y0, w, h };
                label    newBox = new label((sections[0]), bbox);
                this.Labels.Add(newBox);
            }



            // open the reader for the body frames
            this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader();

            // a bone defined as a line between two joints
            this.bones = new List <Tuple <JointType, JointType> >();

            // Torso
            this.bones.Add(new Tuple <JointType, JointType>(JointType.Head, JointType.Neck));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.Neck, JointType.SpineShoulder));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineShoulder, JointType.SpineMid));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineMid, JointType.SpineBase));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineShoulder, JointType.ShoulderRight));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineShoulder, JointType.ShoulderLeft));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineBase, JointType.HipRight));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineBase, JointType.HipLeft));

            // Right Arm
            this.bones.Add(new Tuple <JointType, JointType>(JointType.ShoulderRight, JointType.ElbowRight));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.ElbowRight, JointType.WristRight));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.WristRight, JointType.HandRight));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.HandRight, JointType.HandTipRight));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.WristRight, JointType.ThumbRight));

            // Left Arm
            this.bones.Add(new Tuple <JointType, JointType>(JointType.ShoulderLeft, JointType.ElbowLeft));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.ElbowLeft, JointType.WristLeft));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.WristLeft, JointType.HandLeft));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.HandLeft, JointType.HandTipLeft));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.WristLeft, JointType.ThumbLeft));

            // Right Leg
            this.bones.Add(new Tuple <JointType, JointType>(JointType.HipRight, JointType.KneeRight));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.KneeRight, JointType.AnkleRight));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.AnkleRight, JointType.FootRight));

            // Left Leg
            this.bones.Add(new Tuple <JointType, JointType>(JointType.HipLeft, JointType.KneeLeft));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.KneeLeft, JointType.AnkleLeft));
            this.bones.Add(new Tuple <JointType, JointType>(JointType.AnkleLeft, JointType.FootLeft));

            // populate body colors, one for each BodyIndex
            this.bodyColors = new List <Pen>();

            this.bodyColors.Add(new Pen(Brushes.Red, 6));
            this.bodyColors.Add(new Pen(Brushes.Orange, 6));
            this.bodyColors.Add(new Pen(Brushes.Green, 6));
            this.bodyColors.Add(new Pen(Brushes.Blue, 6));
            this.bodyColors.Add(new Pen(Brushes.Indigo, 6));
            this.bodyColors.Add(new Pen(Brushes.Violet, 6));

            // set IsAvailableChanged event notifier
            this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;

            // open the sensor
            this.kinectSensor.Open();

            // set the status text
            this.StatusText = this.kinectSensor.IsAvailable ? Properties.Resources.RunningStatusText
                                                            : Properties.Resources.NoSensorStatusText;

            // Create the drawing group we'll use for drawing
            this.drawingGroup = new DrawingGroup();

            // Create an image source that we can use in our image control
            this.imageSource = new DrawingImage(this.drawingGroup);

            // use the window object as the view model in this simple example
            this.DataContext = this;

            // initialize the components (controls) of the window
            this.InitializeComponent();
        }
コード例 #20
0
ファイル: Surface.cs プロジェクト: xmatakt/bakalarka
        private void ScaleHeights(float L)
        {
            label label = new label(SetToolStripLabel);
            progres progres = new progres(SetProgressBar);
            form.statusStrip1.Invoke(label, "Prebieha škálovanie výšok...");
            LinearFunction map_z;
            LinearFunction percenta = new LinearFunction(50.0f, 1.0f, 0.5f, 0.01f);
            if((maxX-minX)>(maxY-minY))
                map_z = new LinearFunction(min, max, 0, (maxX - minX) * percenta.Value(L));
            else
                map_z = new LinearFunction(min, max, 0, (maxY - minY) * percenta.Value(L));

            //System.Diagnostics.Debug.WriteLine("[{0},{1}]",map_z.Value(min),map_z.Value(max));
            //System.Windows.Forms.MessageBox.Show("["+map_z.Value(min)+","+map_z.Value(max)+"]");

            int d = coords.Count / 100;
            float dx = minX + (maxX - minX) / 2.0f;
            float dy = minY + (maxY - minY) / 2.0f;

            for (int i = 0; i < coords.Count; i++)
            {
                //vertices[i] = new Vector3( -coords[i].X + dx, coords[i].Y - dy, coords[i].Z / (L * dl) - dz / (L * dl));
                vertices[i] = new Vector3(-coords[i].X + dx, coords[i].Y - dy, map_z.Value(coords[i].Z));
                if (i % d == 0)
                    form.statusStrip1.Invoke(progres, i * 100 / coords.Count);
            }
        }
コード例 #21
0
 return(AutoFit(context, trainData, label, validationData, settings,
                purposeOverrides, cancellationToken, iterationCallback, null));
コード例 #22
0
 ValidatePurposeOverrides(trainData, validationData, label, purposeOverrides);
コード例 #23
0
ファイル: Surface.cs プロジェクト: xmatakt/bakalarka
        public Surface(int w, int h, string pathToFile, System.Windows.Forms.ToolStripProgressBar bar = null, System.Windows.Forms.ToolStripLabel label = null, Form1 form = null, bool shaderOption = false)
        {
            this.shaderOption = shaderOption;
            this.form = form;
            toolStripBar = bar;
            toolStripLabel = label;
            WhatToDraw = 1;
            Status = colrscl = rotate = false;
            minX = minY = min = float.MaxValue;
            maxX = maxY = max = float.MinValue;
            scale = 1.0f;
            angleX = angleY = 0.0f;
            width = w; height = h;
            NumOfIndexes = NumOfVertices = Xwidth = Ywidth = 0;
            //svetlo - smer,ambient,specular,diffuse
            light = new DirectionalLight(new Vector3(0.0f, 0.0f, -1.0f), new Vector3(1.0f, 1.0f, 1.0f), new Vector3(1.0f, 1.0f, 1.0f), new Vector3(1.0f, 1.0f, 1.0f));
            //material - ambient,specular,diffuse,koeficienty - ambient, specular, diffuse, shininess
            material = new Material(0.29f, 0.86f, 0.57f, 128);
            //BigBrother = new Kamera(new Vector3(0.0f, 0.0f, 3.5f), new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f));

            coords = new List<Vector3>();
            VBO = new int[4];
            VAO = new int[1];
            VertexShader = new Shaders.Shader();
            FragmentShader = new Shaders.Shader();
            spMain = new Shaders.ShaderProgram();

            var bw = new System.ComponentModel.BackgroundWorker();

            bw.DoWork += (sender, args) =>
            {
                // do your lengthy stuff here -- this will happen in a separate thread
                LoadData(pathToFile);
                if (Status = SetWidth())
                {
                    vertices = new Vector3[NumOfVertices];
                    color = new Vector3[NumOfVertices];
                    normals = new Vector3[NumOfVertices];
                    Indices = new List<int>();
                    Indexes = new int[NumOfIndexes];
                    //SetIndices();
                    SetIndexes();
                    if (Ywidth > Xwidth)
                    {
                        rotate = true;
                        MatrixStore_Rotations = Matrix4.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), -90.0f * (float)Math.PI / 180.0f);
                    }
                }
                else
                {
                    //dorobit sem este resetovanie progressBaru/labelu
                    System.Windows.Forms.MessageBox.Show("Súbor " + pathToFile + " nemá podporu!", "Vnimanie!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                    label lab = new label(SetToolStripLabel);
                    progres progres = new progres(SetProgressBar);
                    form.statusStrip1.Invoke(lab, "Súbor nemá podporu...");
                    form.statusStrip1.Invoke(progres, 0);
                }
            };

            bw.RunWorkerCompleted += (sender, args) =>
            {
                if (args.Error != null)  // if an exception occurred during DoWork,
                    System.Windows.Forms.MessageBox.Show(args.Error.ToString());  // do your error handling here

                if (Status)
                {
                    colorScale = new ColorScale(min, max, width, height);
                    CalculateColor();
                    ScaleHeights(10.0f);
                    CalculateNormals();
                    InitScene(false);
                    FirstDraw();
                    form.SetBoolean_surface(true);
                }
                else
                    form.SetMenuStrip_Enabled(true);
            };

            bw.RunWorkerAsync(); // starts the background worker
        }
コード例 #24
0
        private static void fixstate(grammar g, state s)
        {
            arcPtr a;
            int    k;
            intPtr accel;
            int    nl = g.g_ll.ll_nlabels;

            s.s_accept = 0;
            accel      = PyMem_NEW_int(nl);
            for (k = 0; k < nl; k++)
            {
                accel[k] = -1;
            }
            a = new arcPtr(s.s_arc);
            for (k = s.s_narcs; --k >= 0; a.inc())
            {
                int   lbl  = a[0].a_lbl;
                label l    = g.g_ll.ll_label[lbl];
                int   type = l.lb_type;
                if (a[0].a_arrow >= (1 << 7))
                {
                    printf("XXX too many states!\n");
                    continue;
                }
                if (ISNONTERMINAL(type))
                {
                    dfa d1 = PyGrammar_FindDFA(g, type);
                    int ibit;
                    if (type - NT_OFFSET >= (1 << 7))
                    {
                        printf("XXX too high nonterminal number!\n");
                        continue;
                    }
                    for (ibit = 0; ibit < g.g_ll.ll_nlabels; ibit++)
                    {
                        if (testbit(d1.d_first, ibit))
                        {
                            if (accel[ibit] != -1)
                            {
                                printf("XXX ambiguity!\n");
                            }
                            accel[ibit] = a[0].a_arrow | (1 << 7) |
                                          ((type - NT_OFFSET) << 8);
                        }
                    }
                }
                else if (lbl == EMPTY)
                {
                    s.s_accept = 1;
                }
                else if (lbl >= 0 && lbl < nl)
                {
                    accel[lbl] = a[0].a_arrow;
                }
            }
            while (nl > 0 && accel[nl - 1] == -1)
            {
                nl--;
            }
            for (k = 0; k < nl && accel[k] == -1;)
            {
                k++;
            }
            if (k < nl)
            {
                int i;
                s.s_accel = PyMem_NEW_int(nl - k);
                if (s.s_accel == null)
                {
                    fprintf(stderr, "no mem to add parser accelerators\n");
                    exit(1);
                }
                s.s_lower = k;
                s.s_upper = nl;
                for (i = 0; k < nl; i++, k++)
                {
                    s.s_accel[i] = accel[k];
                }
            }
            PyMem_DEL(ref accel);
        }
コード例 #25
0
 CheckUserValues(label, features, weights, numLeaves, minDataPerLeaf, learningRate, numBoostRound, onFit);
コード例 #26
0
 public DropDownMappings(label, excludeMAPFundsVisible, publishXMLVisible)
 {
     Label2Text             = label;
     ExcludeMAPFundsVisible = excludeMAPFundsVisible;
     PublishXMLVisible      = publishXMLVisible;
 }
コード例 #27
0
 new InvoiceLine(label, tuple.basePrice, tuple.tax);
コード例 #28
0
 newInstructions.Add(new Instruction(label, com2.Operation, com2.Argument1, com2.Argument2, com2.Result));
コード例 #29
0
ファイル: Surface.cs プロジェクト: xmatakt/bakalarka
 private void CalculateColor()
 {
     label label = new label(SetToolStripLabel);
     progres progres = new progres(SetProgressBar);
     form.statusStrip1.Invoke(label, "Prebieha nastavovanie farieb...");
     color = colorScale.SetColorList(coords).ToArray();
 }
コード例 #30
0
 ToInvoiceLine(this(Amount basePrice, Amount tax) tuple, string label) => new InvoiceLine(label, tuple.basePrice, tuple.tax);
コード例 #31
0
ファイル: Surface.cs プロジェクト: xmatakt/bakalarka
        private void CalculateNormals()
        {
            label label = new label(SetToolStripLabel);
            progres progres = new progres(SetProgressBar);
            form.statusStrip1.Invoke(label, "Prebieha výpočet normál...");
            int d = NumOfIndexes / 300;

            for (int i = 0; i < NumOfIndexes / 3; i++)
            {
                int index1 = Indexes[i * 3];
                int index2 = Indexes[i * 3 + 1];
                int index3 = Indexes[i * 3 + 2];

                Vector3 side1 = vertices[index1] - vertices[index3];
                Vector3 side2 = vertices[index2] - vertices[index1];
                Vector3 normal = Vector3.Cross(side1, side2);

                normals[index1] += normal;
                normals[index2] += normal;
                normals[index3] += normal;
                if (i % d == 0)
                {
                    float tmp = (3 * i / (float)NumOfIndexes);
                    form.statusStrip1.Invoke(progres, (int)(100 * tmp));
                }
            }
        }
コード例 #32
0
ファイル: ScannerTest.cs プロジェクト: ngallagher/simplexml
 assertTrue(label.Name == Intern(label.Name));
コード例 #33
0
        void ITemplate.InstantiateIn(System.Web.UI.Control container)
        {
            switch (_templateType)
            {
            case ListItemType.Header: {
                _iField++;

                if (_typeCtrl != TypeTemplateCol.action && _typeCtrl != TypeTemplateCol.action_url &&
                    _typeCtrl != TypeTemplateCol.request && _typeCtrl != TypeTemplateCol.tabledel &&
                    _typeCtrl != TypeTemplateCol.tablelink)
                {
                    html_ctrl fld = new html_ctrl("div", new attrs(new string[, ] {
                            { "class", "header-col" }
                        }));

                    // titolo colonna
                    attrs atrs = new attrs(new string[, ] {
                            { "colgrid", "true" }, { "oncontextmenu", "col_contextmenu('" + _grid_id + "', '" + _fld_name + "')" }
                        });
                    XmlNode h_node  = refHeader();
                    ctrl    c_title = h_node != null ? (ctrl) new link(_col_title, xmlDoc.node_val(h_node, "title") != "" ? xmlDoc.node_val(h_node, "title") : _col_des, "title-col"
                                                                       , _page.page.parse(h_node.Attributes["ref"].Value), atrs) : (ctrl) new label(_col_title, "title-col", _col_des, atrs);
                    fld.add(c_title.control);

                    // freccine ordinamento
                    string direction;
                    bool   sorted = grid_ctrl.find_sort_field(grid_ctrl.xmlOfGrid(_page, _grid_id), _fld_name, out direction);
                    ctrl   f_ctrl = new div(null, "<div class='arrows' title=\".\" "
                                            + " field_name='" + _fld_name + "' onclick=\"updateGridSort('" + _grid_id + "', '" + _fld_name + "')\" oncontextmenu=\"col_contextmenu('" + _grid_id + "', '" + _fld_name + "')\">"
                                            + (!sorted ? "<a class='mif-arrow-up arrow-col'></a>" : (direction.ToLower() == "asc" ? "<a class='mif-arrow-up arrow-col-active'></a>"
                : "<a class='mif-arrow-down arrow-col-active'></a>")) + "</div>");
                    fld.add(f_ctrl.control);

                    container.Controls.Add(fld.control);
                }
            }
            break;

            case ListItemType.Item: {
                _iField++;

                // creazione del controllo
                WebControl ctrl           = null;
                bool       notTransparent = false;
                if (_typeCtrl == TypeTemplateCol.text)
                {
                    ctrl = refItem() != null ?
                           new link(new EventHandler(textlink_DataBinding)).w_ctrl : new text(new EventHandler(text_DataBinding), true).w_ctrl;
                }
                else if (_typeCtrl == TypeTemplateCol.integer)
                {
                    ctrl = refItem() != null ?
                           new link(new EventHandler(intlink_DataBinding)).w_ctrl : new label(new EventHandler(int_DataBinding)).lbl;
                }
                else if (_typeCtrl == TypeTemplateCol.euro)
                {
                    ctrl = refItem() != null ?
                           new link(new EventHandler(eurolink_DataBinding)).w_ctrl : new label(new EventHandler(euro_DataBinding)).lbl;
                }
                else if (_typeCtrl == TypeTemplateCol.real)
                {
                    ctrl = refItem() != null ?
                           new link(new EventHandler(reallink_DataBinding)).w_ctrl : new label(new EventHandler(real_DataBinding)).lbl;
                }
                else if (_typeCtrl == TypeTemplateCol.check)
                {
                    ctrl = new check(_page.newIdControl, new EventHandler(check_DataBinding), false).w_ctrl;
                }
                else if (_typeCtrl == TypeTemplateCol.date || _typeCtrl == TypeTemplateCol.date_hour)
                {
                    if (refItem() != null)
                    {
                        throw new Exception("refitem non supportato per la colonna 'date'");
                    }
                    else
                    {
                        ctrl = new label(new EventHandler(date_DataBinding)).lbl;
                    }
                }
                else if (_typeCtrl == TypeTemplateCol.link)
                {
                    ctrl = new link(new EventHandler(link_DataBinding)).w_ctrl;
                }
                else if (_typeCtrl == TypeTemplateCol.action)
                {
                    notTransparent = true;
                    ctrl           = new link(new EventHandler(action_DataBinding), _icon + " icon-btn").w_ctrl;
                }
                else if (_typeCtrl == TypeTemplateCol.action_url)
                {
                    notTransparent = true;
                    ctrl           = new link(new EventHandler(actionurl_DataBinding), _icon + " icon-btn").w_ctrl;
                }
                else if (_typeCtrl == TypeTemplateCol.request)
                {
                    notTransparent = true;
                    ctrl           = new link(new EventHandler(request_DataBinding), _icon + " icon-btn").w_ctrl;
                }
                else if (_typeCtrl == TypeTemplateCol.tabledel)
                {
                    notTransparent = true;
                    ctrl           = new link(new EventHandler(requestDel_DataBinding), _icon + " icon-btn").w_ctrl;
                }
                else if (_typeCtrl == TypeTemplateCol.tablelink)
                {
                    notTransparent = true;
                    ctrl           = new link(new EventHandler(requestLink_DataBinding), _icon + " icon-btn").w_ctrl;
                }
                else
                {
                    throw new Exception("campo '" + _typeCtrl.ToString() + "' non supportato!");
                }

                // aggiunta controllo alla griglia
                if (ctrl != null)
                {
                    if (_typeCtrl == TypeTemplateCol.action || _typeCtrl == TypeTemplateCol.action_url ||
                        _typeCtrl == TypeTemplateCol.request || _typeCtrl == TypeTemplateCol.tabledel ||
                        _typeCtrl == TypeTemplateCol.tablelink)
                    {
                        ctrl.ToolTip = _col_des;
                    }
                    if (xmlDoc.node_bool(_colNode, "show_title"))
                    {
                        ctrl.Attributes.Add("show_title", "true");
                    }
                    ctrl.Style.Add(HtmlTextWriterStyle.Width, "95%");
                    if (!notTransparent)
                    {
                        ctrl.Style.Add(HtmlTextWriterStyle.BackgroundColor, "transparent");
                    }
                    container.Controls.Add(ctrl);
                }
            }
            break;

            case ListItemType.EditItem:
                //...
                break;

            case ListItemType.Footer: {
                _iField++;

                // creazione del controllo
                WebControl ctrl = null;
                if (_typeCtrl == TypeTemplateCol.euro)
                {
                    ctrl = new label(new EventHandler(eurosum_DataBinding)).lbl;
                }
                else if (_typeCtrl == TypeTemplateCol.real)
                {
                    ctrl = new label(new EventHandler(realsum_DataBinding)).lbl;
                }
                else
                {
                    throw new Exception("campo '" + _typeCtrl.ToString() + "' non supportato!");
                }

                // aggiunta controllo alla griglia
                if (ctrl != null)
                {
                    ctrl.ToolTip = _col_des;
                    ctrl.Style.Add(HtmlTextWriterStyle.Width, "95%");
                    ctrl.Style.Add(HtmlTextWriterStyle.BackgroundColor, "transparent");
                    container.Controls.Add(ctrl);
                }
            }
            break;
            }
        }
コード例 #34
0
 set => SetNodeByLabel(label, value);
コード例 #35
0
 base.OnGUI(position, property, label, fieldInfo);
コード例 #36
0
 CheckUserValues(label, features, weights, numberOfLeaves, minimumExampleCountPerLeaf, learningRate, numberOfIterations, onFit);
コード例 #37
0
ファイル: Surface.cs プロジェクト: xmatakt/bakalarka
        private void InitScene(bool b)
        {
            label label = new label(SetToolStripLabel);
            progres progres = new progres(SetProgressBar);
            form.statusStrip1.Invoke(label, "Prebieha nastavovanie scény...");
            form.statusStrip1.Invoke(progres, 0);

            SetMatrices(b);

            GL.GenBuffers(4, VBO);
            GL.GenVertexArrays(1, VAO);

            GL.BindVertexArray(VAO[0]);

            //vrcholy
            GL.BindBuffer(BufferTarget.ArrayBuffer, VBO[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(NumOfVertices * Vector3.SizeInBytes), vertices, BufferUsageHint.StaticDraw);
            GL.EnableVertexAttribArray(0);
            GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0);

            //farby
            GL.BindBuffer(BufferTarget.ArrayBuffer, VBO[1]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(NumOfVertices * Vector3.SizeInBytes), color, BufferUsageHint.StaticDraw);
            GL.EnableVertexAttribArray(1);
            GL.VertexAttribPointer(1, 3, VertexAttribPointerType.Float, false, 0, 0);

            //normaly
            GL.BindBuffer(BufferTarget.ArrayBuffer, VBO[2]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(NumOfVertices * Vector3.SizeInBytes), normals, BufferUsageHint.StaticDraw);
            GL.EnableVertexAttribArray(2);
            GL.VertexAttribPointer(2, 3, VertexAttribPointerType.Float, false, 0, 0);

            //indices
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, VBO[3]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(sizeof(int) * Indices.Count), Indices.ToArray(), BufferUsageHint.StaticDraw);
            GL.Enable(EnableCap.PrimitiveRestart);
            GL.PrimitiveRestartIndex(coords.Count);
            //GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(sizeof(int) * Indexes.Length), Indexes, BufferUsageHint.StaticDraw);

            if (shaderOption)
            {
                //per pixel
                if (!VertexShader.LoadShaderS(Kocka.Properties.Resources.perPixelShaderVert, ShaderType.VertexShader))
                    System.Windows.Forms.MessageBox.Show("Nepodarilo sa nacitat vertex sahder!");
                if (!FragmentShader.LoadShaderS(Kocka.Properties.Resources.perPixelShaderFrag, ShaderType.FragmentShader))
                    System.Windows.Forms.MessageBox.Show("Nepodarilo sa nacitat fragment sahder!");
            }
            else
            {
                //per fragment
                if (!VertexShader.LoadShaderS(Kocka.Properties.Resources.perFragmentShaderVert, ShaderType.VertexShader))
                    System.Windows.Forms.MessageBox.Show("Nepodarilo sa nacitat vertex sahder!");
                if (!FragmentShader.LoadShaderS(Kocka.Properties.Resources.perFragmentShaderFrag, ShaderType.FragmentShader))
                    System.Windows.Forms.MessageBox.Show("Nepodarilo sa nacitat fragment sahder!");
            }

            spMain.CreateProgram();
            spMain.AddShaderToProgram(VertexShader);
            spMain.AddShaderToProgram(FragmentShader);
            spMain.LinkProgram();
            spMain.UseProgram();

            spMain.SetUniform("projectionMatrix", projectionMatrix);
            spMain.SetUniform("eye", new Vector3(0.0f, 0.0f, 30.0f));
            material.SetMaterialUniforms(spMain);
            light.SetDirectionalLightUniforms(spMain);
        }