Ejemplo n.º 1
0
        /// <summary>
        /// Draws a TextGraphics primitive
        /// </summary>
        public TextGraphics DrawText(
            string text,
            bool scalable,
            GraphicsNode node)
        {
            try
            {
                CGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                TextGraphics graphic = (scalable ? node.AddScalableTextGraphics() : node.AddTextGraphics());

                graphic.Text = text;

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Draws a PointGraphics  primitive
        /// </summary>
        public PointGraphics DrawPoint(
            double[] position,
            GraphicsNode node)
        {
            try
            {
                CGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                PointGraphics graphic = node.AddPointGraphics();

                if (position != null)
                {
                    GraphicsCoordinateSet coordSet =
                        graphicsData.GraphicsDataSets.CreateCoordinateSet(
                            graphicsData.GetDataSetFreeId());

                    coordSet.PutCoordinates(ref position);

                    graphic.CoordinateSet = coordSet;
                }

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Draws a TriangleStripGraphics primitive
        /// </summary>
        /// <returns>TriangleStripGraphics</returns>
        public TriangleStripGraphics DrawTriangleStrip(
            double[] coordinates,
            GraphicsNode node)
        {
            try
            {
                CGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                TriangleStripGraphics graphic = node.AddTriangleStripGraphics();

                if (coordinates != null)
                {
                    GraphicsCoordinateSet coordSet =
                        graphicsData.GraphicsDataSets.CreateCoordinateSet(
                            graphicsData.GetDataSetFreeId());

                    coordSet.PutCoordinates(ref coordinates);

                    graphic.CoordinateSet = coordSet;
                }

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns a new GraphicsNode
        /// </summary>
        /// <returns>GraphicsNode</returns>
        public GraphicsNode CreateNewGraphicsNode()
        {
            CGraphics graphicsData = WorkingGraphics;

            GraphicsNode node = graphicsData.ClientGraphics.AddNode(
                graphicsData.GetGraphicNodeFreeId());

            return(node);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Draws a TriangleGraphics primitive
        /// </summary>
        /// <returns>TriangleGraphics</returns>
        public TriangleGraphics DrawTriangle(
            double[] v1,
            double[] v2,
            double[] v3,
            GraphicsNode node)
        {
            try
            {
                CGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                TriangleGraphics graphic = node.AddTriangleGraphics();

                if ((v1 != null) && (v2 != null) && (v3 != null))
                {
                    GraphicsCoordinateSet coordSet =
                        graphicsData.GraphicsDataSets.CreateCoordinateSet(
                            graphicsData.GetDataSetFreeId());

                    List <double> coordinates = new List <double>();

                    coordinates.AddRange(v1);
                    coordinates.AddRange(v2);
                    coordinates.AddRange(v3);

                    double[] coordsArray = coordinates.ToArray();

                    coordSet.PutCoordinates(ref coordsArray);

                    graphic.CoordinateSet = coordSet;
                }

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Draws a ComponentGraphics primitive
        /// </summary>
        public ComponentGraphics DrawComponent(
            ComponentDefinition compDef,
            GraphicsNode node)
        {
            try
            {
                CGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                ComponentGraphics graphic = node.AddComponentGraphics(compDef);

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Draws a SurfaceGraphics primitive
        /// </summary>
        public SurfaceGraphics DrawSurface(
            object surface,
            GraphicsNode node)
        {
            try
            {
                CGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                SurfaceGraphics graphic = node.AddSurfaceGraphics(surface);

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Draws a CurveGraphics primitive
        /// </summary>
        public CurveGraphics DrawCurve(
            object curve,
            GraphicsNode node)
        {
            try
            {
                CGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                CurveGraphics graphic = node.AddCurveGraphics(curve);

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Draws a LineGraphics primitive
        /// </summary>
        /// <returns>LineGraphics</returns>
        public LineGraphics DrawLine(
            double[] startPoint,
            double[] endPoint,
            GraphicsNode node)
        {
            try
            {
                CGraphics graphicsData = WorkingGraphics;

                if (node == null)
                {
                    node = graphicsData.ClientGraphics.AddNode(
                        graphicsData.GetGraphicNodeFreeId());
                }

                LineGraphics graphic = node.AddLineGraphics();

                if ((startPoint != null) && (endPoint != null))
                {
                    GraphicsCoordinateSet coordSet =
                        graphicsData.GraphicsDataSets.CreateCoordinateSet(
                            graphicsData.GetDataSetFreeId());

                    double[] coordsArray = startPoint.Concat(endPoint).ToArray();

                    coordSet.PutCoordinates(ref coordsArray);

                    graphic.CoordinateSet = coordSet;
                }

                return(graphic);
            }
            catch
            {
                return(null);
            }
        }