Example #1
0
        /// <summary>
        /// Build the graphic polyline.
        /// </summary>
        private void BuildPolyline()
        {
            // If there is already a polyline built remove the previous polyline
            if (_polyline != null)
            {
                this.RemovePrimitive(_polyline);
            }

            // Add the new polyline in the representation
            _polyline = new OCGraphic2d_Polyline(this, _array1OfVertex);
            _polyline.SetColorIndex(1);
            _polyline.SetWidthIndex(1);
            _polyline.SetTypeIndex(1);
        }
        /// <summary>
        /// Calculates the rectangle vertexes. It also builds the vertex markers.
        /// </summary>
        private void BuildPolyline()
        {
            if (_polyline != null)
            {
                this.RemovePrimitive(_polyline);
            }

            Double BottomLeftX = _leftBottomX;
            Double BottomLeftY = _leftBottomY;

            Double BottomRightX = _leftBottomX + (Math.Cos(_angle) * (_rightBottomX - _leftBottomX));
            Double BottomRightY = _leftBottomY + (Math.Sin(_angle) * (_rightBottomX - _leftBottomX));

            Double TopRightX = _leftBottomX + (Math.Cos(_angle) * (_rightBottomX - _leftBottomX)) + (-Math.Sin(_angle) * (_leftTopY - _leftBottomY));
            Double TopRightY = _leftBottomY + (Math.Sin(_angle) * (_rightBottomX - _leftBottomX)) + (Math.Cos(_angle) * (_leftTopY - _leftBottomY));

            Double TopLeftX = _leftBottomX + (-Math.Sin(_angle) * (_leftTopY - _leftBottomY));
            Double TopLeftY = _leftBottomY + (Math.Cos(_angle) * (_leftTopY - _leftBottomY));

            _array1OfVertex.SetValue(1, new OCGraphic2d_Vertex(BottomLeftX, BottomLeftY));
            _array1OfVertex.SetValue(2, new OCGraphic2d_Vertex(TopLeftX, TopLeftY));
            _array1OfVertex.SetValue(3, new OCGraphic2d_Vertex(TopRightX, TopRightY));
            _array1OfVertex.SetValue(4, new OCGraphic2d_Vertex(BottomRightX, BottomRightY));
            _array1OfVertex.SetValue(5, new OCGraphic2d_Vertex(BottomLeftX, BottomLeftY));

            // Add the polyline in the representation, for all modes
            _polyline = new OCGraphic2d_Polyline(this, _array1OfVertex);
            _polyline.SetColorIndex(1);
            _polyline.SetWidthIndex(1);
            _polyline.SetTypeIndex(1);

            // Position the markers
            _leftBottomMarker.SetPosition(BottomLeftX, BottomLeftY);
            _leftTopMarker.SetPosition(TopLeftX, TopLeftY);
            _rightTopMarker.SetPosition(TopRightX, TopRightY);
            _rightBottomMarker.SetPosition(BottomRightX, BottomLeftY);
        }