Exemple #1
0
        public void SetProperties(Double xPos, Double yPos, Double majorRadius, Double minorRadius, Double angle)
        {
            OCAIS2D_InteractiveContext context = GetContext();

            _centerX     = xPos;
            _centerY     = yPos;
            _majorRadius = majorRadius;
            _minorRadius = minorRadius;
            _angle       = angle;

            // The OCC requires the minor radius to be higher than 0
            if ((majorRadius < 0.01) || (minorRadius < 0.01))
            {
                return;
            }

            // The OCC ellipse requires the minor radius to be smaller than the major radius
            if (minorRadius > majorRadius)
            {
                return;
            }

            // Build the markers
            _leftMarker   = new PolylineMarker2D(context, 0, 0, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);
            _rightMarker  = new PolylineMarker2D(context, 0, 0, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);
            _topMarker    = new PolylineMarker2D(context, 0, 0, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);
            _bottomMarker = new PolylineMarker2D(context, 0, 0, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);

            // Compute the shape and the markers
            BuildEllipse();
        }
Exemple #2
0
        /// <summary>
        /// The endpoints of the line can be set to other coordinates.
        /// </summary>
        public void SetEndpoints(Double xPos, Double yPos, Double xEndPos, Double yEndPos)
        {
            OCAIS2D_InteractiveContext context = GetContext();

            // Create the 2 markers for the end of the segment
            _startMarker = new PolylineMarker2D(context, xPos, yPos, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);
            _endMarker   = new PolylineMarker2D(context, xEndPos, yEndPos, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);

            // Store the line attributes
            _array1OfVertex.SetValue(1, new OCGraphic2d_Vertex(xPos, yPos));
            _array1OfVertex.SetValue(2, new OCGraphic2d_Vertex(xEndPos, yEndPos));

            BuildPolyline();
        }
        /// <summary>
        /// The endpoints of the rectangle can be set to other coordinates.
        /// </summary>
        public void SetEndpoints(Double xPos, Double yPos, Double width, Double height, Double angle)
        {
            OCAIS2D_InteractiveContext context = GetContext();

            // Store internally the parameters passed to the constructor
            _leftBottomX  = xPos;
            _leftBottomY  = yPos;
            _rightBottomX = _leftBottomX + width;
            _leftTopY     = _leftBottomY + height;
            _angle        = angle;

            // Build the markers
            _leftBottomMarker  = new PolylineMarker2D(context, 0, 0, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);
            _leftTopMarker     = new PolylineMarker2D(context, 0, 0, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);
            _rightTopMarker    = new PolylineMarker2D(context, 0, 0, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);
            _rightBottomMarker = new PolylineMarker2D(context, 0, 0, GeometryConstants.MarkerWidth, GeometryConstants.MarkerWidth);

            // Build the shape, calculate the vertexes using the internally stored parameters and position the markers
            BuildPolyline();
        }