private void pbCurrResult_Click(object sender, EventArgs e)
        {
            if (currImage == null)
            {
                return;
            }
            PointD pt1 = ((PictureBox)sender).GetMouseEventPositionOnRealImage(e, currImage);

            //theLogWindow = ServiceTools.LogAText(theLogWindow, pt1.ToString()
            //                                    + Environment.NewLine
            //                                    + "======================================", true);
            if (currSectionPoints.Item1.IsNull)
            {
                currSectionPoints = new Tuple <PointD, PointD>(pt1, PointD.nullPointD());
            }
            else
            {
                currSectionPoints = new Tuple <PointD, PointD>(currSectionPoints.Item1, pt1);
                SectionDescription currSection = new SectionDescription(currSectionPoints.Item1, currSectionPoints.Item2,
                                                                        true);
                currSection = currSection.TransformTillMargins(new Rectangle(0, 0, currImage.Width, currImage.Height));
                sectionsList.Add(currSection);
                RaisePaintEvent(null, null);
                currSectionPoints = new Tuple <PointD, PointD>(PointD.nullPointD(), PointD.nullPointD());
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description,IsDeleted,TimeDeleted")] SectionDescription sectionDescription)
        {
            if (id != sectionDescription.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sectionDescription);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SectionDescriptionExists(sectionDescription.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sectionDescription));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Title,Description,IsDeleted,TimeDeleted")] SectionDescription sectionDescription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sectionDescription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sectionDescription));
        }
Exemplo n.º 4
0
        private ISection Build(SectionDescription sectionDescription)
        {
            var section = CreateNewSection(sectionDescription);

            section.HeaderView = Build(sectionDescription.HeaderElement);
            section.FooterView = Build(sectionDescription.FooterElement);

            FillProperties(section, sectionDescription.Properties);
            FillElements(section, sectionDescription.Elements);

            return(section);
        }
Exemplo n.º 5
0
        public virtual SectionDescription ToSectionDescription()
        {
            var toReturn = new SectionDescription();

            base.Fill(toReturn);
            toReturn.Properties["Header"] = Header;
            toReturn.Properties["Footer"] = Footer;
            foreach (var elementAuto in Elements)
            {
                var elementDescription = elementAuto.ToElementDescription();
                toReturn.Elements.Add(elementDescription);
            }
            return(toReturn);
        }
Exemplo n.º 6
0
 protected abstract ISection CreateNewSection(SectionDescription sectionDescription);
 protected override ISection CreateNewSection(SectionDescription sectionDescription)
 {
     return(new Section());
 }
        private void btnGetFuncAlongSection_Click(object sender, EventArgs e)
        {
            foreach (SectionDescription sectionDescription in sectionsList)
            {
                PointD p1 = sectionDescription.p1;
                PointD p2 = sectionDescription.p2;
                bool   fromMarginToMargin = false;

                SectionDescription currSection = new SectionDescription(p1, p2, true);

                LineDescription2D l1 = currSection.SectionLine;

                DenseMatrix dmValues         = (DenseMatrix)currImgData.DmSourceData.Clone();
                DenseMatrix dmDistanceToLine = (DenseMatrix)currImgData.DmSourceData.Clone();
                dmDistanceToLine.MapIndexedInplace((row, col, dVal) =>
                {
                    PointD currPt = new PointD(col, row);

                    double dist = currPt.DistanceToLine(l1);
                    return(dist);
                });

                List <Tuple <PointD, double> > dataArray = new List <Tuple <PointD, double> >();
                for (int row = 0; row < dmValues.RowCount; row++)
                {
                    for (int col = 0; col < dmValues.ColumnCount; col++)
                    {
                        if (dmDistanceToLine[row, col] <= sectionGapWidth)
                        {
                            dataArray.Add(new Tuple <PointD, double>(new PointD(col, row), dmValues[row, col]));
                        }
                    }
                }

                List <Tuple <double, double> > dataArrayRotated = dataArray.ConvertAll((tpl) =>
                {
                    Vector2D pointVector = l1.p0.ToVector2D(tpl.Item1);
                    double projection    = pointVector * l1.directionVector;
                    return(new Tuple <double, double>(projection, tpl.Item2));
                });


                double arrayMinPosition = dataArrayRotated.Min <Tuple <double, double> >(tpl1 => tpl1.Item1);
                double arrayMaxPosition = dataArrayRotated.Max <Tuple <double, double> >(tpl1 => tpl1.Item1);
                if (!fromMarginToMargin)
                {
                    Vector2D pointVector      = l1.p0.ToVector2D(p2);
                    double   projection       = pointVector * l1.directionVector;
                    double   p2DoublePosition = projection;

                    arrayMinPosition = Math.Min(0.0d, p2DoublePosition);
                    arrayMaxPosition = Math.Max(0.0d, p2DoublePosition);
                    dataArrayRotated.RemoveAll(tpl => ((tpl.Item1 < arrayMinPosition) || (tpl.Item1 > arrayMaxPosition)));
                }

                dataArrayRotated =
                    dataArrayRotated.ConvertAll <Tuple <double, double> >(
                        tpl => new Tuple <double, double>(tpl.Item1 - arrayMinPosition, tpl.Item2));

                dataArrayRotated.Sort((tpl1, tpl2) => tpl1.Item1.CompareTo(tpl2.Item1));

                FunctionRepresentationForm form1 = new FunctionRepresentationForm();
                form1.dvScatterXSpace     = DenseVector.OfEnumerable(dataArrayRotated.ConvertAll <double>(tpl => tpl.Item1));
                form1.dvScatterFuncValues =
                    DenseVector.OfEnumerable(dataArrayRotated.ConvertAll <double>(tpl => tpl.Item2));

                if ((rtbMinValuesLimit.Text != "") && (rtbMaxValuesLimit.Text != ""))
                {
                    form1.ForcedFuncMinValue = Convert.ToDouble(rtbMinValuesLimit.Text.Replace(".", ","));
                    form1.ForcedFuncMaxValue = Convert.ToDouble(rtbMaxValuesLimit.Text.Replace(".", ","));
                    form1.ForceFuncLimits    = true;
                }


                if (rbtnShowByDots.Checked)
                {
                    form1.scatterFuncDrawingVariant = SequencesDrawingVariants.circles;
                }
                else if (rbtnShowByLine.Checked)
                {
                    form1.scatterFuncDrawingVariant = SequencesDrawingVariants.polyline;
                }

                form1.Show();
                form1.Represent();
            }
        }