Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new graph vertex with the specified predefined shape
        /// </summary>
        /// <remarks>
        /// The new graph vertex style is a copy of the VerticesUserClass style
        /// </remarks>
        /// <param name="shape">predefined shape</param>
        /// <returns>new graph vertex</returns>
        protected virtual NShape CreateVertex(ENBasicShape shape)
        {
            NShape vertex = m_ShapeFactory.CreateShape(shape);

            vertex.Name      = m_sName + " Vertex " + CurrentVertexIndex.ToString(CultureInfo.InvariantCulture);
            vertex.UserClass = m_VerticesUserClass;
            CurrentVertexIndex++;

            return(vertex);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a predefined basic shape
        /// </summary>
        /// <param name="basicShape">basic shape</param>
        /// <param name="bounds">bounds</param>
        /// <param name="text">default label text</param>
        /// <param name="userClass">name of the stylesheet from which to inherit styles</param>
        /// <returns>new basic shape</returns>
        private NShape CreateBasicShape(ENBasicShape basicShape, NRectangle bounds, string text, string userClass)
        {
            // create shape
            NShape shape = new NBasicShapeFactory().CreateShape(basicShape);

            // set bounds, text and user class
            shape.SetBounds(bounds);
            shape.Text      = text;
            shape.UserClass = userClass;

            // add to active page
            m_DrawingDocument.Content.ActivePage.Items.Add(shape);
            return(shape);
        }