Ejemplo n.º 1
0
 private void button4_Click(object sender, EventArgs e)
 {
     AutoRescale = false;
     try
     {
         YMax = Double.Parse(textBox2.Text);
     }
     catch (System.FormatException) { textBox2.Text = YMax.ToString("F0"); }
     try
     {
         YMin = Double.Parse(textBox3.Text);
     }
     catch (System.FormatException) { textBox3.Text = YMin.ToString("F0"); }
     try
     {
         XMin = Double.Parse(textBox4.Text);
     }
     catch (System.FormatException) { textBox4.Text = XMin.ToString("F0"); }
     try
     {
         XMax = Double.Parse(textBox5.Text);
     }
     catch (System.FormatException) { textBox5.Text = XMax.ToString("F0"); }
     PlotRescale();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Map 분석(Harzard와 맵크기를 찾아냄)
        /// </summary>
        private void MapAnalysis()
        {
            XMax      = map.Size.Width;
            YMax      = map.Size.Height;
            HazardCnt = 0;

            for (int x = 0; x < XMax; x++)
            {
                for (int y = 0; y < YMax; y++)
                {
                    // y가 0베이스
                    Color col = map.GetPixel(x, YMax - y - 1);
                    if (col.R > 240 &&
                        col.G < 60 &&
                        col.B < 60)
                    {
                        HazardCnt++;
                        LoadedHazardList.Add(new Spot(x, y));
                    }

                    else if (col.G > 240 &&
                             col.R < 60 &&
                             col.B < 60)
                    {
                        SearchCnt++;
                        LoadedSearchSpotList.Add(new Spot(x, y));
                    }
                }
            }

            HazardTBox.Text = HazardCnt.ToString();
            SearchTBox.Text = SearchCnt.ToString();
            XTbox.Text      = XMax.ToString();
            YTBox.Text      = YMax.ToString();
        }
Ejemplo n.º 3
0
 public override int GetHashCode() =>
 XMin.GetHashCode() ^
 YMin.GetHashCode() ^
 XMax.GetHashCode() ^
 YMax.GetHashCode() ^
 ZMin.GetHashCode() ^
 ZMax.GetHashCode() ^
 MMin.GetHashCode() ^
 MMax.GetHashCode();
Ejemplo n.º 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = XMin.GetHashCode();
         result = (result * 397) ^ YMin.GetHashCode();
         result = (result * 397) ^ XMax.GetHashCode();
         result = (result * 397) ^ YMax.GetHashCode();
         return(result);
     }
 }
Ejemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = XMin.GetHashCode();
         hashCode = (hashCode * 397) ^ YMin.GetHashCode();
         hashCode = (hashCode * 397) ^ XMax.GetHashCode();
         hashCode = (hashCode * 397) ^ YMax.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 6
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (SpatialReference != null ? SpatialReference.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ XMin.GetHashCode();
         hashCode = (hashCode * 397) ^ XMax.GetHashCode();
         hashCode = (hashCode * 397) ^ YMin.GetHashCode();
         hashCode = (hashCode * 397) ^ YMax.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 7
0
        protected override IEnumerator ProcessPayload(VisualPayload payload)
        {
            //payload.ClearBoundVisualizer();

            var volume = VisualizerFactory.InstantiateRectangularVolume();

            //payload.GetTargetBound().ChildWithinBound(volume.transform);
            //.BoundedVisual = volume;

            volume.Initialize(this, payload);

            volume.SetOpaqueMaterial(UseOpaqueMaterial.GetFirstValue(payload.Data));


            var xProportion = XAxis.GetFirstValue(payload.Data);

            if (XMax.CouldResolve(payload.Data) && XMax.GetFirstValue(payload.Data) > .001f)
            {
                xProportion = xProportion / XMax.GetFirstValue(payload.Data);
            }

            var yProportion = YAxis.GetFirstValue(payload.Data);

            if (YMax.CouldResolve(payload.Data) && YMax.GetFirstValue(payload.Data) > .001f)
            {
                yProportion = yProportion / YMax.GetFirstValue(payload.Data);
            }

            var zProportion = ZAxis.GetFirstValue(payload.Data);

            if (ZMax.CouldResolve(payload.Data) && ZMax.GetFirstValue(payload.Data) > .001f)
            {
                zProportion = zProportion / ZMax.GetFirstValue(payload.Data);
            }

            volume.Xscale = xProportion;
            volume.Yscale = yProportion;
            volume.Zscale = zProportion;

            volume.Color = Color.GetFirstValue(payload.Data);

            var newPayload = new VisualPayload(payload.Data, new VisualDescription(volume.Bound));

            var iterator = Router.TransmitAll(newPayload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
Ejemplo n.º 8
0
    // Start is called before the first frame update
    void Start()
    {
        Camera myCamera = Camera.main;

        XMin = myCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).x + padding;
        Debug.Log("XMin: " + XMin.ToString());
        XMax = myCamera.ViewportToWorldPoint(new Vector3(1, 0, 0)).x - padding;
        Debug.Log("XMax: " + XMax.ToString());
        YMin = myCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).y + padding;
        Debug.Log("YMin: " + YMin.ToString());
        YMax = myCamera.ViewportToWorldPoint(new Vector3(0, 1, 0)).y - padding;
        Debug.Log("YMax: " + YMax.ToString());

        // myCirclePrefab = (GameObject)Resources.Load("Circle");
        Instantiate(myCirclePrefab, new Vector3(XMin, YMin, 0), Quaternion.identity);
        Instantiate(myCirclePrefab, new Vector3(XMin, YMax, 0), Quaternion.identity);
        Instantiate(myCirclePrefab, new Vector3(XMax, YMin, 0), Quaternion.identity);
        Instantiate(myCirclePrefab, new Vector3(XMax, YMax, 0), Quaternion.identity);
    }
Ejemplo n.º 9
0
    // Start is called before the first frame update
    void Start()
    {
        Camera gameCamera = Camera.main;

        XMin = gameCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).x + padding;
        Debug.Log("XMin: " + XMin.ToString());
        XMax = gameCamera.ViewportToWorldPoint(new Vector3(1, 0, 0)).x - padding;
        Debug.Log("XMax: " + XMax.ToString());
        YMin = gameCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).y + padding;
        Debug.Log("YMin: " + XMin.ToString());
        YMax = gameCamera.ViewportToWorldPoint(new Vector3(0, 1, 0)).y - padding;
        Debug.Log("YMax: " + XMin.ToString());



        Instantiate(mycirclePrefab, new Vector3(XMin, YMin, 0), Quaternion.identity);
        Instantiate(mycirclePrefab, new Vector3(XMin, YMax, 0), Quaternion.identity);
        Instantiate(mycirclePrefab, new Vector3(XMax, YMin, 0), Quaternion.identity);
        Instantiate(mycirclePrefab, new Vector3(XMax, YMax, 0), Quaternion.identity);
    }
Ejemplo n.º 10
0
 public bool Equals(Extent other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(SpatialReference, other.SpatialReference) && XMin.Equals(other.XMin) && XMax.Equals(other.XMax) && YMin.Equals(other.YMin) && YMax.Equals(other.YMax));
 }
Ejemplo n.º 11
0
 public override string ToString()
 {
     return(XMin.ToString() + "," + YMin.ToString() + "," + XMax.ToString() + "," + YMax.ToString());
 }
Ejemplo n.º 12
0
        private void PlotRescale()
        {
            if (AutoRescale)
            {
                if (OperationMode == MODE_MAIN)
                {
                    plotSurface2D1.XAxis1.WorldMin = 0;
                    plotSurface2D1.XAxis1.WorldMax = time;
                    plotSurface2D1.YAxis1.WorldMin = YMIN;
                    plotSurface2D1.YAxis1.WorldMax = YMAX;

                    plotSurface2D1.XAxis1.WorldMin -= plotSurface2D1.XAxis1.WorldLength * 0.1;
                    plotSurface2D1.XAxis1.WorldMax += plotSurface2D1.XAxis1.WorldLength * 0.5;
                    plotSurface2D1.YAxis1.WorldMin -= plotSurface2D1.YAxis1.WorldLength * 0.1;
                    plotSurface2D1.YAxis1.WorldMax += plotSurface2D1.YAxis1.WorldLength * 0.1;

                    textBox2.Text = plotSurface2D1.YAxis1.WorldMax.ToString("F0");
                    textBox3.Text = plotSurface2D1.YAxis1.WorldMin.ToString("F0");
                    textBox4.Text = plotSurface2D1.XAxis1.WorldMin.ToString("F0");
                    textBox5.Text = plotSurface2D1.XAxis1.WorldMax.ToString("F0");

                    XMin = plotSurface2D1.XAxis1.WorldMin;
                    XMax = plotSurface2D1.XAxis1.WorldMax;
                    YMin = plotSurface2D1.YAxis1.WorldMin;
                    YMax = plotSurface2D1.YAxis1.WorldMax;

                    textBox2.BackColor = SystemColors.Menu;
                    textBox3.BackColor = SystemColors.Menu;
                    textBox4.BackColor = SystemColors.Menu;
                    textBox5.BackColor = SystemColors.Menu;

                    plotSurface2D1.Refresh();
                }
                if (OperationMode == SCAN_CELL)
                {
                    plotSurface2D1.XAxis1.WorldMin = 0;
                    plotSurface2D1.XAxis1.WorldMax = time;
                    plotSurface2D1.YAxis1.WorldMin = YMIN;
                    plotSurface2D1.YAxis1.WorldMax = YMAX;

                    plotSurface2D1.XAxis1.WorldMin -= plotSurface2D1.XAxis1.WorldLength * 0.1;
                    plotSurface2D1.XAxis1.WorldMax += plotSurface2D1.XAxis1.WorldLength * 0.5;
                    plotSurface2D1.YAxis1.WorldMin -= plotSurface2D1.YAxis1.WorldLength * 0.1;
                    plotSurface2D1.YAxis1.WorldMax += plotSurface2D1.YAxis1.WorldLength * 0.1;

                    plotSurface2D1.XAxis1.WorldMin -= plotSurface2D1.XAxis1.WorldLength * 0.1;
                    plotSurface2D1.XAxis1.WorldMax += plotSurface2D1.XAxis1.WorldLength * 0.5;
                    plotSurface2D1.YAxis1.WorldMin -= plotSurface2D1.YAxis1.WorldLength * 0.1;
                    plotSurface2D1.YAxis1.WorldMax += plotSurface2D1.YAxis1.WorldLength * 0.1;

                    textBox2.Text = YMax.ToString("F0");
                    textBox3.Text = YMin.ToString("F0");
                    textBox4.Text = XMin.ToString("F0");
                    textBox5.Text = XMax.ToString("F0");

                    textBox2.BackColor = SystemColors.Menu;
                    textBox3.BackColor = SystemColors.Menu;
                    textBox4.BackColor = SystemColors.Menu;
                    textBox5.BackColor = SystemColors.Menu;

                    plotSurface2D1.Refresh();
                }
            }
            else
            {
                plotSurface2D1.XAxis1.WorldMin = XMin;
                plotSurface2D1.XAxis1.WorldMax = XMax;
                plotSurface2D1.YAxis1.WorldMin = YMin;
                plotSurface2D1.YAxis1.WorldMax = YMax;

                textBox2.BackColor = SystemColors.Window;
                textBox3.BackColor = SystemColors.Window;
                textBox4.BackColor = SystemColors.Window;
                textBox5.BackColor = SystemColors.Window;

                plotSurface2D1.Refresh();
            }
        }
Ejemplo n.º 13
0
 get => new Int32Rect(XMin, YMin, XMax - XMin, YMax - YMin);
Ejemplo n.º 14
0
 public bool Equals(BoundingBox2D other) =>
 other != null &&
 (double.IsNaN(XMin) && double.IsNaN(other.XMin) || XMin.Equals(other.XMin)) &&
 (double.IsNaN(YMin) && double.IsNaN(other.YMin) || YMin.Equals(other.YMin)) &&
 (double.IsNaN(XMax) && double.IsNaN(other.XMax) || XMax.Equals(other.XMax)) &&
 (double.IsNaN(YMax) && double.IsNaN(other.YMax) || YMax.Equals(other.YMax));
Ejemplo n.º 15
0
        private void ChangeOperationMode(int NewMode)
        {
            if (OperationMode == NewMode)
            {
                return;
            }
            if (NewMode == MODE_IDLE)
            {
                if (OutputFile != null)
                {
                    OutputFile.Close();
                }
                button2.Enabled  = false;
                button3.Enabled  = false;
                textBox1.Enabled = true;
                timer1.Enabled   = false;
                OperationMode    = MODE_IDLE;
            }
            if (NewMode == MODE_MAIN)
            {
                SerialWriteBuffer[0] = 'm';
                StartExperiment      = DateTime.Now;
                FileName             = String.Format("polar{0,4:0000}_{1,2:00}_{2,2:00}-{3,2:00}_{4,2:00}_{5,2:00}.out",
                                                     StartExperiment.Year,
                                                     StartExperiment.Month,
                                                     StartExperiment.Day,
                                                     StartExperiment.Hour,
                                                     StartExperiment.Minute,
                                                     StartExperiment.Second);
                if (OutputFile != null)
                {
                    OutputFile.Close();
                }

                OutputFile = new StreamWriter(FileName);        // create file
                OutputFile.Close();

                label1.Text         = FileName;
                YMIN                = 0; YMAX = 0;
                NPlot1              = new LinePlot();
                NPoints             = 0;
                AutoRescale         = true;
                XX                  = new double[1];
                YY                  = new double[1];
                NPlot1.AbscissaData = XX;
                NPlot1.DataSource   = YY;
                plotSurface2D1.Clear();
                plotSurface2D1.Add(NPlot1);
                button2.Enabled  = true;
                button3.Enabled  = true;
                button3.Text     = "Scan";
                timer1.Interval  = 100;
                timer1.Enabled   = true;
                textBox1.Enabled = false;
                OperationMode    = MODE_MAIN;
                TakeEachPoint    = 1;
                TakeEachPointNow = 0;
            }
            if (NewMode == SCAN_CELL)
            {
                //SerialWriteBuffer[0] = 'm';
                StartExperiment = DateTime.Now;
                AutoRescale     = true;
                FileName        = String.Format("scan{0,4:0000}_{1,2:00}_{2,2:00}-{3,2:00}_{4,2:00}_{5,2:00}.out",
                                                StartExperiment.Year,
                                                StartExperiment.Month,
                                                StartExperiment.Day,
                                                StartExperiment.Hour,
                                                StartExperiment.Minute,
                                                StartExperiment.Second);
                if (OutputFile != null)
                {
                    OutputFile.Close();
                }
                OutputFile = new StreamWriter(FileName);
                OutputFile.Close();

                label1.Text         = FileName;
                YMIN                = -3.0; YMAX = 3.0;
                NPlot1              = new LinePlot();
                NPoints             = 0;
                XX                  = new double[1];
                YY                  = new double[1];
                NPlot1.AbscissaData = XX;
                NPlot1.DataSource   = YY;
                plotSurface2D1.Clear();
                plotSurface2D1.Add(NPlot1);

                plotSurface2D1.XAxis1.WorldMin = -0.5;
                plotSurface2D1.XAxis1.WorldMax = 10.5;
                plotSurface2D1.YAxis1.WorldMin = -3.0;
                plotSurface2D1.YAxis1.WorldMax = 0.5;

                XMin = -0.5;
                XMax = 10.5;
                YMin = -2.5;
                YMax = 0.5;

                textBox2.Text = YMax.ToString();
                textBox3.Text = YMin.ToString();
                textBox4.Text = XMin.ToString();
                textBox5.Text = XMax.ToString();

                plotSurface2D1.Refresh();

                button2.Enabled  = true;
                button3.Enabled  = true;
                button3.Text     = "Stop Scan";
                timer1.Interval  = 100;
                timer1.Enabled   = true;
                textBox1.Enabled = false;
                OperationMode    = SCAN_CELL;
            }
        }
Ejemplo n.º 16
0
 public override string ToString()
 {
     return($"{XMin.ToString(CultureInfo.InvariantCulture)},{YMin.ToString(CultureInfo.InvariantCulture)},{ZMin.ToString(CultureInfo.InvariantCulture)},{XMax.ToString((CultureInfo.InvariantCulture))},{YMax.ToString((CultureInfo.InvariantCulture))},{ZMax.ToString((CultureInfo.InvariantCulture))}");
 }
Ejemplo n.º 17
0
 protected bool Equals(EnvelopeXY other)
 {
     return(XMin.Equals(other.XMin) && YMin.Equals(other.YMin) && XMax.Equals(other.XMax) &&
            YMax.Equals(other.YMax));
 }