예제 #1
0
        private void glControl1_MouseMove(object sender, MouseEventArgs e)
        {
            actualGL_pos = new Point(e.Location.X - (int)xWCS, e.Location.Y - (int)yWCS);
            label3.Text = "X: " + actualGL_pos.X.ToString() + " Y: " + actualGL_pos.Y.ToString();

            if (ds.useMoveProgress)
                Render();
            else
            {
                if (cb_vertexSnap.Checked)
                    if (!bgw_vertexSnap.IsBusy)
                        bgw_vertexSnap.RunWorkerAsync(actualGL_pos);

                if (userLine && (mouseDownLoc != new Point()))
                {
                    line temp = new line(mouseDownLoc, actualGL_pos);
                    ds.setProgressObj(temp);
                    ds.useDrawProgress = true;

                }
                if (userPoly && userPolyPts.Count > 0 && mouseDownLoc != new Point())
                {
                    userPolyPts.Add(actualGL_pos); // mouse current location
                    polygon temp = new polygon(userPolyPts);
                    ds.setProgressObj(temp);
                    ds.useDrawProgress = true;
                }
                if (userPoint)
                {
                    point temp = new point(actualGL_pos);
                    temp.size = 5;
                    temp.propColor = Color.Azure;
                    ds.setProgressObj(temp);
                    ds.useDrawProgress = true;
                }
                if (userQuad && (mouseDownLoc != new Point()))
                {
                    quad temp = new quad(mouseDownLoc, actualGL_pos); // use the two point method
                    ds.setProgressObj(temp);
                    ds.useDrawProgress = true;
                    prevDownLoc = mouseDownLoc;
                }
                if (userLoopLine && (mouseDownLoc != new Point()) && (userPoints.Count() > 0))
                {
                    userPoints.Add(actualGL_pos);
                    loopline temp = new loopline(userPoints);
                    userPoints.RemoveAt(userPoints.Count() - 1);
                    ds.setProgressObj(temp);
                    ds.useDrawProgress = true;
                }
            }
        }
        private void buttonOkay_Click(object sender, EventArgs e)
        {
            //Gather up the information and set it
            output = new glPrimitives();
            output = input;

            switch (_Type)
            {
                case "TRIANGLE":
                    _aTri = (triangle)input;
                    _aTri.showVerts = checkBox_showVerts.Checked;
                    _aTri.lineColor = button_VertexColor.BackColor;
                    _aTri.vertSize = (float)Convert.ToDecimal(UpDown_VertextSize.Text.ToString());

                    _aTri.showLines = checkBox_showLines.Checked;
                    _aTri.lineColor = button_LineColor.BackColor;
                    _aTri.lineWidth = (float)Convert.ToDecimal(UpDown_LineWidth.Text.ToString());
                    output = _aTri;
                    break;
                case "LINE":
                    _aLine = (line)input;
                    _aLine.showVerts = checkBox_showVerts.Checked;
                    _aLine.propColor = button_ObjectColor.BackColor;
                    _aLine.vertColor = button_VertexColor.BackColor;
                    _aLine.vertSize = (float)Convert.ToDecimal(UpDown_VertextSize.Text.ToString());
                    output = _aLine;
                    break;
                case "POINT":
                    _aPoint = (point)input;
                    output = _aPoint;
                    break;
                case "POLYGON":
                    _aPoly = (polygon)input;
                    output = _aPoly;
                    break;
                case "QUAD":
                    _aQuad = (quad)input;
                    _aQuad.showVerts = checkBox_showVerts.Checked;
                    _aQuad.lineColor = button_VertexColor.BackColor;
                    _aQuad.vertSize = (float)Convert.ToDecimal(UpDown_VertextSize.Text.ToString());

                    _aQuad.showLines = checkBox_showLines.Checked;
                    _aQuad.lineColor = button_LineColor.BackColor;
                    _aQuad.lineWidth = (float)Convert.ToDecimal(UpDown_LineWidth.Text.ToString());

                    _aQuad.propColor = button_ObjectColor.BackColor;
                    output = _aQuad;
                    break;
                case "LOOPLINE":
                    _aLoopLine = (loopline)input;
                    output = _aLoopLine;
                    break;
                default:

                    break;
            }

            this.Close();
        }
예제 #3
0
        private void glControl1_MouseDown(object sender, MouseEventArgs e)
        {
            prevDownLoc = mouseDownLoc;
            Point actualGL_pos = new Point(e.Location.X - (int)xWCS, e.Location.Y - (int)yWCS);
            mouseDownLoc = actualGL_pos;

            if (userPoint)
            {
                point temp = new point(mouseDownLoc);
                temp.size = 5;
                ds.Add(temp);
                ds.useDrawProgress = true;  // continue showing the point as the mouse moves on screen
            }
            if (ds.useMoveProgress)
            {
                ds.useMoveProgress = false;
            }
        }
        private void glPrimitiveDialog_Load(object sender, EventArgs e)
        {
            this.Text = _Type + " properties";
            _isOpen = true;

            switch (_Type)
            {
                case "TRIANGLE":
                    _aTri = (triangle)input;
                    enableControls(true, true, true);

                    checkBox_showVerts.Checked = _aTri.showVerts;
                    button_VertexColor.BackColor = _aTri.lineColor;
                    UpDown_VertextSize.Text = _aTri.vertSize.ToString();

                    checkBox_showLines.Checked = _aTri.showLines;
                    button_LineColor.BackColor = _aTri.lineColor;
                    UpDown_LineWidth.Text = _aTri.lineWidth.ToString();

                    break;
                case "LINE":
                    _aLine = (line)input;
                    enableControls(true, true, false);
                    checkBox_showVerts.Checked = _aLine.showVerts;
                    UpDown_VertextSize.Text = _aLine.vertSize.ToString();
                    break;
                case "POINT":
                    _aPoint = (point)input;
                    enableControls(true, false, false);
                    break;
                case "POLYGON":
                    _aPoly = (polygon)input;
                    enableControls(true, true, true);
                    break;
                case "QUAD":
                    _aQuad = (quad)input;
                    enableControls(true, true, true);
                    checkBox_showVerts.Checked = _aQuad.showVerts;
                    button_VertexColor.BackColor = _aQuad.lineColor;
                    UpDown_VertextSize.Text = _aQuad.vertSize.ToString();

                    checkBox_showLines.Checked = _aQuad.showLines;
                    button_LineColor.BackColor = _aQuad.lineColor;
                    UpDown_LineWidth.Text = _aQuad.lineWidth.ToString();

                    button_ObjectColor.BackColor = _aQuad.propColor;
                    break;
                case "LOOPLINE":
                    _aLoopLine = (loopline)input;
                    enableControls(true, true, true);
                    break;
                default:

                    break;
            }
        }