Example #1
0
        public void PolygonNode()
        {
            var tc = new TestCore();

            tc.Init();

            PolygonNode node = new PolygonNode()
            {
                Position = new Vector2F(250, 250)
            };

            Engine.AddNode(node);

            Span <Vector2F> span = stackalloc Vector2F[]
            {
                new Vector2F(-100, -100),
                new Vector2F(100, -100),
                new Vector2F(100, 100),
                new Vector2F(-100, 100),
            };

            node.SetVertexes(span, new Color(255, 0, 0));

            foreach (var current in node.Buffers)
            {
                System.Diagnostics.Debug.WriteLine(current);
            }

            tc.LoopBody(c => { }, null);

            tc.End();
        }
Example #2
0
        public void PolygonNode_SetVertexesByVector2F()
        {
            var tc = new TestCore(new Configuration()
            {
                WaitVSync = false
            });

            tc.Init();

            var node = new PolygonNode();

            Engine.AddNode(node);

            tc.LoopBody(c =>
            {
                var sin = MathF.Sin(MathHelper.DegreeToRadian(c)) * 50;
                var cos = MathF.Cos(MathHelper.DegreeToRadian(c)) * 50;

                node.SetVertexes(new[] {
                    new Vector2F(100 + cos, 100 - sin),
                    new Vector2F(100 - sin, 100 - cos),
                    new Vector2F(100 - cos, 100 + sin),
                    new Vector2F(100 + sin, 100 + cos),
                }, new Color(255, c % 255, 255, 255));
            }, null);

            tc.End();
        }
Example #3
0
 public void InsertLoop(LineLoop l)
 {
     if (!AnyIntersects(l) && !ContainsLoop(l))
     {
         PolygonNode        lowestEnclosingLoop   = FindLowestNodeEnclosing(l);
         List <PolygonNode> highestEnclosedByLoop = FindHighestNodeEnclosedBy(l);
         if (lowestEnclosingLoop == null)
         {
             nodes.Add(new PolygonNode(l, null));
         }
         else
         {
             lowestEnclosingLoop.children.Add(new PolygonNode(l, lowestEnclosingLoop));
         }
         if (highestEnclosedByLoop != null)
         {
             foreach (PolygonNode n in highestEnclosedByLoop)
             {
                 n.ChangeParent(null);
             }
         }
     }
     else
     {
         throw new Exception("Loop to be added intersects pre-existing loops");
     }
 }
Example #4
0
        public override void Render(Node node, Context context)
        {
            PolygonNode poly = node as PolygonNode;

            LayoutOutline(poly, context);
            context.Color = poly.Color.MultiplyAlpha(poly.Opacity).ToCairo();
            context.Fill();
        }
 public static dynamic GetTSObject(PolygonNode dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Example #6
0
        private void CreateSceneGraph()
        {
            PolygonNode poly1 = new PolygonNode();
            PolygonNode poly2 = new PolygonNode();
            PolygonNode poly3 = new PolygonNode();
            PolygonNode poly4 = new PolygonNode();
            GroupNode   rt    = new GroupNode();

            Vector3 a = new Vector3(.0f, .0f, 2.5f);
            Vector3 b = new Vector3(2.5f, .0f, -2.5f);
            Vector3 c = new Vector3(-2.5f, .0f, 2.5f);
            Vector3 d = new Vector3(.0f, 4.0f, .0f);

            poly1.AddNormal(new Vector3(.0f, -1.0f, .0f));
            poly1.AddVertex(0, c);
            poly1.AddVertex(1, b);
            poly1.AddVertex(2, c);

            poly2.AddNormal(new Vector3(.861411f, .269191f, .430706f));
            poly2.AddVertex(0, d);
            poly2.AddVertex(1, a);
            poly2.AddVertex(2, b);

            poly3.AddNormal(new Vector3(.0f, .529999f, -.847998f));
            poly3.AddVertex(0, d);
            poly3.AddVertex(1, b);
            poly3.AddVertex(2, c);

            poly4.AddNormal(new Vector3(-.861411f, .269191f, .430706f));
            poly4.AddVertex(0, d);
            poly4.AddVertex(1, c);
            poly4.AddVertex(2, a);

            GroupNode      root  = new GroupNode();
            GraphLinesNode graph = new GraphLinesNode();
            GroupNode      rt1   = new GroupNode();
            GroupNode      rt2   = new GroupNode();

            root.AddChild(graph);
            root.AddChild(rt1);
            root.AddChild(rt2);

            rt1.AddChild(rt);
            rt2.AddChild(rt);

            rt1.SetTranslation(5, 0, 0);
            rt2.SetTranslation(-5, 0, 0);

            rt.AddChild(poly1);
            rt.AddChild(poly2);
            rt.AddChild(poly3);
            rt.AddChild(poly4);

            m_sceneGraph = root;

            m_hook1 = rt1;
            m_hook2 = rt2;
        }
Example #7
0
        public void IBPolygonNode()
        {
            var tc = new TestCore();

            tc.Init();

            var node = new PolygonNode()
            {
                Position = new Vector2F(250, 250)
            };

            Engine.AddNode(node);

            //Span<Vector2F> span = stackalloc Vector2F[]
            //{
            //    new Vector2F(-100, -100),
            //    new Vector2F(-50, -100),
            //    new Vector2F(-50, -50),
            //    new Vector2F(-100, -50),
            //    new Vector2F(50, 50),
            //    new Vector2F(100, 50),
            //    new Vector2F(100, 100),
            //    new Vector2F(50, 100),
            //};

            //node.SetVertexes(span, new Color(255, 0, 0));

            //node.Buffers = new[]
            //{
            //    new IndexBuffer(0, 1, 2),
            //    new IndexBuffer(0, 2, 3),
            //    new IndexBuffer(4, 5, 6),
            //    new IndexBuffer(4, 6, 7),
            //};

            node.SetVertexGroupsFromPositions(new[]
            {
                new[]
                {
                    new Vector2F(-100, -100),
                    new Vector2F(-50, -100),
                    new Vector2F(-50, -50),
                    new Vector2F(-100, -50),
                },
                new[]
                {
                    new Vector2F(50, 50),
                    new Vector2F(100, 50),
                    new Vector2F(100, 100),
                    new Vector2F(50, 100),
                },
            }, new Color(255, 0, 0));

            tc.LoopBody(null, null);

            tc.End();
        }
Example #8
0
 private PolygonNode FindLowestNodeEnclosing(LineLoop l)
 {
     foreach (PolygonNode n in nodes)
     {
         PolygonNode lowest = n.FindLowestNodeEnclosing(l);
         if (lowest != null)
         {
             return(lowest);
         }
     }
     return(null);
 }
Example #9
0
 public void ChangeParent(PolygonNode newParent)
 {
     if (parent != null)
     {
         parent.children.Remove(this);
     }
     if (newParent != null)
     {
         newParent.children.Add(this);
     }
     parent = newParent;
 }
Example #10
0
        public override void LayoutOutline(Node node, Context context)
        {
            PolygonNode poly = node as PolygonNode;

            // polygons have 3 sides
            if (poly.Verticies.Count <= 2)
            {
                return;
            }

            var renderVerts = poly.Verticies.Select(v => new Point(v.X * node.Width, v.Y * node.Height)).ToList();

            context.MoveTo(renderVerts.First().ToCairo());
            renderVerts.ForEach(v => context.LineTo(v.ToCairo()));
        }
Example #11
0
        public static void Main(string[] args)
        {
            Application.Init();
            MainWindow win = new MainWindow();

            Gtk.Canvas canvas = new Gtk.Canvas();
            canvas.Engine.SetBackground(new Color(0.5, 0.5, 0.5));
            win.Add(canvas);

            BoxNode box = new BoxNode(new Color(1, 1, 1), 100, 100);

            box.Draggable = true;
            canvas.Root.Add(box);

            PolygonNode poly = new PolygonNode(50, 50);

            poly.Color = new Color(0, 0, 1);
            poly.SetVerticies(new [] {
                new Point(0, 1),
                new Point(0, 0),
                new Point(1, 0.5),
            });
            poly.Draggable = true;
            canvas.Root.Add(poly);

            LabelNode label = new LabelNode("Label Node Test");

            label.Color     = new Color(1, 0, 0);
            label.Draggable = true;
            label.ClipInputToTextExtents = true;
            canvas.Root.Add(label);

            Random r = new Random();

            box.ActivatedEvent += (sender, e) => {
                box.RotateTo(r.NextDouble() * 5);
            };

            ButtonNode button = new ButtonNode(new LabelNode("Button"));

            canvas.Root.Add(button);
            button.MoveTo(300, 100);

            win.SetSizeRequest(800, 200);
            win.ShowAll();

            Application.Run();
        }
Example #12
0
        protected override DataRow CreateRow(EntityNode entityNode)
        {
            DataRow dataRow = base.CreateRow(entityNode);

            if (dataRow != null)
            {
                PolygonNode polygonNode = entityNode as PolygonNode;
                if (polygonNode != null)
                {
                    dataRow[FieldName_PolygonType] = polygonNode.PolygonType;
                    dataRow[FieldName_X]           = polygonNode.LablePointInfoNode.X;
                    dataRow[FieldName_Y]           = polygonNode.LablePointInfoNode.Y;
                    dataRow[FieldName_ComposeType] = polygonNode.ComposeType;
                    return(dataRow);
                }
            }
            return(null);
        }
Example #13
0
        public void IBPolygonNodeWithTexture()
        {
            var tc = new TestCore();

            tc.Init();

            var texture = Texture2D.Load(@"TestData/IO/AltseedPink.png");

            Assert.NotNull(texture);

            var node = new PolygonNode()
            {
                Position = new Vector2F(250, 250),
                Texture  = texture
            };

            Engine.AddNode(node);

            var basePositions = new[]
            {
                new Vector2F(-100f, -100f),
                new Vector2F(100f, 100f),
                new Vector2F(-150f, 250f),
                new Vector2F(250f, -150f),
            };
            var array = new Vector2F[basePositions.Length][];

            for (int i = 0; i < basePositions.Length; i++)
            {
                array[i] = new[]
                {
                    basePositions[i],
                    basePositions[i] + new Vector2F(50f, 0f),
                    basePositions[i] + new Vector2F(50f, 50f),
                    basePositions[i] + new Vector2F(0f, 50f),
                };
            }

            node.SetVertexGroupsFromPositions(array, new Color(255, 255, 255));

            tc.LoopBody(null, null);

            tc.End();
        }
Example #14
0
 public PolygonNode FindLowestNodeEnclosing(LineLoop l)
 {
     if (l.IsInsideOther(loop))
     {
         foreach (PolygonNode n in children)
         {
             PolygonNode lowest = n.FindLowestNodeEnclosing(l);
             if (lowest != null)
             {
                 return(lowest);
             }
         }
         return(this);
     }
     else
     {
         return(null);
     }
 }
Example #15
0
        public void GetEntityNodeByDataRow(DataRow dataRow, ref PolygonNode polygonNode)
        {
            if (dataRow != null)
            {
                if (polygonNode != null)
                {
                    EntityNode entityNode = polygonNode as EntityNode;

                    base.GetEntityNodeByDataRow(dataRow, ref entityNode);

                    polygonNode.PolygonType = dataRow[FieldName_PolygonType] == System.DBNull.Value ? -1 : Convert.ToInt32(dataRow[FieldName_PolygonType]);

                    double        dX            = dataRow[FieldName_X] == System.DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_X]);
                    double        dY            = dataRow[FieldName_Y] == System.DBNull.Value ? 0.0 : Convert.ToDouble(dataRow[FieldName_Y]);
                    PointInfoNode pointInfoNode = new PointInfoNode(dX, dY);
                    polygonNode.LablePointInfoNode = pointInfoNode;

                    polygonNode.LineNodes = new System.Collections.Generic.List <LineNodeEx>();
                    //polygonNode.ComposeType = dataRow[FieldName_ComposeType] == null ? -1 : Convert.ToInt32(dataRow[FieldName_ComposeType]);
                }
            }
        }
Example #16
0
        static void Main(string[] args)
        {
            // Altseed を初期化します。
            Engine.Initialize("Sound_BGM", 640, 480);

            // 音ファイルを読み込みます。
            // 効果音の場合は第2引数を true に設定して再生しながら解凍することが推奨されている。
            var bgm = Sound.Load(@"TestData\Sound\bgm1.ogg", false);

            // 音を再生します。
            var id = Engine.Sound.Play(bgm);

            // スペクトルバーのインスタンスを1024個作成します。
            var spectrumBars = new PolygonNode[1024];

            for (int i = 0; i < 1024; ++i)
            {
                // ※ 640 / 1024 = 0.625
                var spectrumBar = new PolygonNode();
                spectrumBar.Position = new Vector2F(i * 0.625f, 1.0f);
                var vertexes = new Vector2F[4];
                vertexes[0] = new Vector2F(0.0f, 480.0f);
                vertexes[1] = new Vector2F(0.0f, 480.0f);
                vertexes[2] = new Vector2F(0.625f, 480.0f);
                vertexes[3] = new Vector2F(0.625f, 480.0f);
                spectrumBar.SetVertexes(vertexes);
                spectrumBars[i] = spectrumBar;
                Engine.AddNode(spectrumBar);
            }

            // メインループ。
            // Altseed のウインドウが閉じられると終了します。
            while (Engine.DoEvents())
            {
                // Altseedを更新します。
                Engine.Update();

                // 再生されている音のスペクトル情報を取得します。
                // データの長さは2のn乗でなくてはなりません。
                var spectrum = Engine.Sound.GetSpectrum(id, 1024, FFTWindow.Rectangular);

                // 取得したスペクトル情報をスペクトルバーに反映させます。
                for (int i = 0; i < 1024; ++i)
                {
                    var vertexes = new Vector2F[4];
                    vertexes[0] = new Vector2F(0.0f, 480.0f);
                    vertexes[1] = new Vector2F(0.0f, 480.0f - spectrum[i]);
                    vertexes[2] = new Vector2F(0.625f, 480.0f - spectrum[i]);
                    vertexes[3] = new Vector2F(0.625f, 480.0f);
                    spectrumBars[i].SetVertexes(vertexes);
                }

                // 音の再生が終了しているか調べる。
                if (!Engine.Sound.GetIsPlaying(id))
                {
                    break;
                }
            }

            // Altseed の終了処理をします。
            Engine.Terminate();
        }
Example #17
0
            public VertexNode[] v = new VertexNode[2] ; /* Left and right vertex list ptrs   */

            #endregion Fields

            #region Constructors

            public PolygonNode( PolygonNode next, double x, double y )
            {
                /* Make v[LEFT] and v[RIGHT] point to new vertex */
                VertexNode vn = new VertexNode( x, y );
                this.v[LEFT ] = vn ;
                this.v[RIGHT] = vn ;

                this.next = next ;
                this.proxy = this ; /* Initialise proxy to point to p itself */
                this.active = 1 ; //TRUE
            }
Example #18
0
        public void Anchor()
        {
            var tc = new TestCore();

            tc.Init();

            var font = Font.LoadDynamicFont("../../Core/TestData/Font/mplus-1m-regular.ttf", 30);

            Assert.NotNull(font);

            var texture = Texture2D.Load(@"../../Core/TestData/IO/AltseedPink.png");

            Assert.NotNull(texture);

            Vector2F rectSize = texture.Size;
            var      parent   = new PolygonNode();

            parent.Position = new Vector2F(320, 240);
            //parent.Pivot = new Vector2F(0.5f, 0.5f);
            parent.SetVertexes(new[] {
                new Vector2F(0, 0),
                new Vector2F(rectSize.X, 0),
                new Vector2F(rectSize.X, rectSize.Y),
                new Vector2F(0, rectSize.Y),
            }, new Color(255, 255, 255, 255));
            parent.AdjustSize();
            Engine.AddNode(parent);

            var child = new SpriteNode();

            child.Texture   = texture;
            child.Position  = new Vector2F(120, 200);
            child.Src       = new RectF(new Vector2F(), texture.Size);
            child.Pivot     = new Vector2F(0.5f, 0.5f);
            child.AnchorMin = new Vector2F(0.2f, 0.0f);
            child.AnchorMax = new Vector2F(0.8f, 1f);
            child.ZOrder    = 10;
            child.Mode      = DrawMode.Fill;
            child.AdjustSize();
            parent.AddChildNode(child);

            var childText = new TextNode();

            childText.Font                = font;
            childText.Color               = new Color(0, 0, 0);
            childText.Text                = "あいうえお";
            childText.Pivot               = new Vector2F(0.5f, 0.5f);
            childText.AnchorMin           = new Vector2F(0.5f, 0.5f);
            childText.AnchorMax           = new Vector2F(0.5f, 0.5f);
            childText.ZOrder              = 15;
            childText.HorizontalAlignment = HorizontalAlignment.Center;
            childText.VerticalAlignment   = VerticalAlignment.Center;
            childText.Size                = child.Size;
            child.AddChildNode(childText);

            var text = new TextNode()
            {
                Font = font, Text = "", ZOrder = 10
            };

            Engine.AddNode(text);

            tc.Duration = 10000;
            tc.LoopBody(c =>
            {
                if (Engine.Keyboard.GetKeyState(Keys.Right) == ButtonState.Hold)
                {
                    rectSize.X += 1.5f;
                }
                if (Engine.Keyboard.GetKeyState(Keys.Left) == ButtonState.Hold)
                {
                    rectSize.X -= 1.5f;
                }
                if (Engine.Keyboard.GetKeyState(Keys.Down) == ButtonState.Hold)
                {
                    rectSize.Y += 1.5f;
                }
                if (Engine.Keyboard.GetKeyState(Keys.Up) == ButtonState.Hold)
                {
                    rectSize.Y -= 1.5f;
                }

                if (Engine.Keyboard.GetKeyState(Keys.D) == ButtonState.Hold)
                {
                    parent.Position += new Vector2F(1.5f, 0);
                }
                if (Engine.Keyboard.GetKeyState(Keys.A) == ButtonState.Hold)
                {
                    parent.Position += new Vector2F(-1.5f, 0);
                }
                if (Engine.Keyboard.GetKeyState(Keys.S) == ButtonState.Hold)
                {
                    parent.Position += new Vector2F(0, 1.5f);
                }
                if (Engine.Keyboard.GetKeyState(Keys.W) == ButtonState.Hold)
                {
                    parent.Position += new Vector2F(0, -1.5f);
                }

                parent.SetVertexes(new[] {
                    new Vector2F(0, 0),
                    new Vector2F(rectSize.X, 0),
                    new Vector2F(rectSize.X, rectSize.Y),
                    new Vector2F(0, rectSize.Y),
                }, new Color(255, 255, 255, 255));
                parent.AdjustSize();

                text.Text = child.Size.ToString();
            }, null);

            tc.End();
        }
Example #19
0
            public PolygonNode add_local_min( double x, double y )
            {
                PolygonNode existing_min = top_node;

                top_node = new PolygonNode( existing_min, x, y );

                return top_node ;
            }
Example #20
0
            public void merge_right( PolygonNode p, PolygonNode q )
            {
                /* Label contour as external */
                q.proxy.hole = false ;

                if (p.proxy != q.proxy)
                {
                    /* Assign p's vertex list to the right end of q's list */
                    q.proxy.v[RIGHT].next= p.proxy.v[LEFT];
                    q.proxy.v[RIGHT]= p.proxy.v[RIGHT];

                    /* Redirect any p->proxy references to q->proxy */
                    PolygonNode target = p.proxy ;
                    for (PolygonNode node = top_node ; (node != null ); node = node.next)
                    {
                        if (node.proxy == target)
                        {
                            node.active = 0;
                            node.proxy= q.proxy;
                        }
                    }
                }
            }
Example #21
0
        /// <summary>
        /// 获取VCT面实体节点
        /// </summary>
        public override EntityNode GetEntityNode()
        {
            try
            {
                m_PolygonNode = new PolygonNode();
                IFeature pFeature = this.Feature as IFeature;
                ///标识码赋值
                int dBSMIndex = -1;
                dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled);
                if (dBSMIndex != -1)
                    m_PolygonNode.EntityID = Convert.ToInt32(this.Feature.get_Value(dBSMIndex));

                ///图形表现赋值 
                 //m_PolygonNode.Representation = pFeature.Class.AliasName;

                ///要素代码赋值
                //int dSYDMIndex = -1;
                //dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField);
                //if (dSYDMIndex != -1)
                //    m_PolygonNode.FeatureCode = this.Feature.get_Value(dSYDMIndex).ToString();
                //string sAttriTableName = (pFeature.Class as IDataset).Name;
                //m_PolygonNode.FeatureCode = MetaDataFile.GetFeatureCodeByName(sAttriTableName);
                m_PolygonNode.FeatureCode = this.FeatureCode;

                //设置间接坐标面构成类型、面特征类型、图形表现代码
                m_PolygonNode.PolygonType = 100;
                //m_PolygonNode.Representation = pFeature.Class.AliasName;

                ///add by 曾平 2011-9-7 添加裁切
                IGeometry pFeatureGeometry = null;
                if (m_bCut)
                {
                     pFeatureGeometry = GetSubGeometry();
                    if (pFeatureGeometry == null)
                    {
                        pFeatureGeometry = pFeature.Shape;
                    }
                }
                else
                {
                    pFeatureGeometry = pFeature.Shape;
                }

                IPolygon4 pGeoPolygon = pFeatureGeometry as IPolygon4;
                List<LineNodeEx> pListNodeEx = new List<LineNodeEx>();

                IGeometryBag pExteriorRings = pGeoPolygon.ExteriorRingBag;
                ///获取外环集合
                IEnumGeometry pExteriorRingsEnum = pExteriorRings as IEnumGeometry;
                pExteriorRingsEnum.Reset();
                IRing pCurrentExteriorRing = pExteriorRingsEnum.Next() as IRing;

                ////构面的线段要素代码都是面的要素代码
                string strLineFeatureCode =m_PolygonNode.FeatureCode;
                string strRepresentation = m_PolygonNode.Representation;


                ///遍历所有外环及关联的内环
                while (pCurrentExteriorRing != null)
                {
                    ///设置当前外环数据
                    //List<LineNodeEx> pListExLine = GetLineByRing(pCurrentExteriorRing, strLineFeatureCode,strRepresentation, m_PolygonNode.EntityID);
                    List<LineNodeEx> pListExLine = GetLineNodeExsByRing(pCurrentExteriorRing, strLineFeatureCode, strRepresentation, m_PolygonNode.EntityID);
                    if (pListExLine != null)
                    {
                        pListNodeEx.AddRange(pListExLine);

                        ///不相连的环添加标识码为0的空数据
                        LineNodeEx pOutTempLineNodeEx = new LineNodeEx();
                        pOutTempLineNodeEx.EntityID = 0;
                        pOutTempLineNodeEx.PolygonID = m_PolygonNode.EntityID;
                        pListNodeEx.Add(pOutTempLineNodeEx);

                        ///获取当前外环的关联内环
                        IGeometryBag pInteriorRings = pGeoPolygon.get_InteriorRingBag(pCurrentExteriorRing);
                        IEnumGeometry pInteriorRingsEnum = pInteriorRings as IEnumGeometry;
                        pInteriorRingsEnum.Reset();
                        IRing pCurrentInteriorRing = pInteriorRingsEnum.Next() as IRing;
                        ////遍历内环
                        while (pCurrentInteriorRing != null)
                        {

                            List<LineNodeEx> pListInLine = GetLineByRing(pCurrentInteriorRing, strLineFeatureCode, strRepresentation, m_PolygonNode.EntityID);
                            if (pListInLine != null)
                            {
                                pListNodeEx.AddRange(pListInLine);

                                ///不相连的环添加标识码为0的空数据
                                LineNodeEx pInTempLineNodeEx = new LineNodeEx();
                                pInTempLineNodeEx.EntityID = 0;
                                pInTempLineNodeEx.PolygonID = m_PolygonNode.EntityID;
                                pListNodeEx.Add(pInTempLineNodeEx);

                            }

                            //处理下一个内环
                            pCurrentInteriorRing = pInteriorRingsEnum.Next() as IRing;
                        }
                    }
                    ///处理下一个外环
                    pCurrentExteriorRing = pExteriorRingsEnum.Next() as IRing;
                }

                ///删除集合中最后一位补零线段
                if (pListNodeEx.Count>0&& pListNodeEx[pListNodeEx.Count - 1].EntityID == 0)
                    pListNodeEx.RemoveAt(pListNodeEx.Count - 1);
                m_PolygonNode.LineNodes = pListNodeEx;
                //获取标志点
                IArea pArea = pFeature.Shape as IArea;
                if (pArea != null)
                    m_PolygonNode.LablePointInfoNode = new PointInfoNode(pArea.LabelPoint.X, pArea.LabelPoint.Y);
                return m_PolygonNode;
            }
            catch (Exception ex)
            {
                LogAPI.WriteErrorLog(ex);
                return null;
            }
        }
Example #22
0
 public PolygonNode(LineLoop loop, PolygonNode parent)
 {
     this.loop     = loop;
     this.parent   = parent;
     this.children = new List <PolygonNode>();
 }
Example #23
0
 public PolygonNodeRenderer(PolygonNode node)
     : base(node)
 {
     this.node = node;
 }
Example #24
0
        /// <summary>
        /// 创建面实体
        /// </summary>
        /// <param name="pITable">数据表对象</param>
        /// <param name="entinyNode">VCT空间实体节点</param>
        public override void CreateFeature(ITable pITable, EntityNode entinyNode)
        {
            PolygonNode pPolygonNode = entinyNode as PolygonNode;
            if (pPolygonNode != null)
            {
                IFeatureClass pFeatureCls = pITable as IFeatureClass;
                this.Feature = pFeatureCls.CreateFeature();

                ///标识码赋值
                int dBSMIndex = -1;
                dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled);
                if (dBSMIndex != -1)
                    this.Feature.set_Value(dBSMIndex, pPolygonNode.EntityID);

                ///要素代码赋值
                int dSYDMIndex = -1;
                dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField);
                if (dSYDMIndex != -1)
                    this.Feature.set_Value(dSYDMIndex, pPolygonNode.FeatureCode);


                //根据面特征类型构面 
                bool bGetGeometry = false;///指示是否获取图形数据

                ///从配置表获取面的类型InDireCoordinatePolygon表示间接坐标构面
                if (Metadata.MetaDataFile.GraphConfig.GetGraphMark("POLYGONFEATURETYPE", pPolygonNode.PolygonType.ToString()) == "InDireCoordinatePolygon")
                {
                    IGeometryCollection pGeoCollection = new PolygonClass();
                    IPointCollection pPtCollection = new RingClass();

                    ///采用间接构面的方式LineStructPolygon表示引用线构面
                    if (Metadata.MetaDataFile.GraphConfig.GetGraphMark("POLYGONTYPE", pPolygonNode.ComposeType.ToString()) == "LineStructPolygon")
                    {
                        for (int i = 0; i < pPolygonNode.LineNodes.Count; i++)
                        {
                            LineNodeEx pLineNodeEx = pPolygonNode.LineNodes[i];
                            if (pLineNodeEx == null)
                                continue;
                           
                            ///标识码为0表示对象分割标识
                            if (pLineNodeEx.EntityID != 0)
                            {
                                IPoint pPrePoint=null;
                                if (pPtCollection.PointCount > 0)
                                    pPrePoint = pPtCollection.get_Point(pPtCollection.PointCount-1);
                                IPointCollection pPointCollection=GetPointCollection(pLineNodeEx, pPrePoint);
                                if (pPointCollection != null)
                                    pPtCollection.AddPointCollection(pPointCollection);
                                if (i == pPolygonNode.LineNodes.Count - 1)
                                {
                                    IRing pRing = pPtCollection as IRing;
                                    pRing.Close();///闭合当前环
                                    object oTypeMissing = Type.Missing;
                                    pGeoCollection.AddGeometry(pRing as IGeometry, ref oTypeMissing, ref oTypeMissing);
                                    bGetGeometry = true;
                                    pPtCollection = new RingClass();///清空点集数据
                                }
                            }
                            else///独到标识码为0时闭合图形
                            {
                                IRing pRing = pPtCollection as IRing;
                                pRing.Close();///闭合当前环
                                object oTypeMissing = Type.Missing;
                                pGeoCollection.AddGeometry(pRing as IGeometry, ref oTypeMissing, ref oTypeMissing);
                                bGetGeometry = true;
                                pPtCollection = new RingClass();///清空点集数据
                            }
                        }
                        if (bGetGeometry)
                        {
                            (this.Feature as IFeature).Shape = pGeoCollection as IGeometry;
                        }
                    }
                }
                else if (pPolygonNode.PolygonType == 1)
                {

                }


                this.Feature.Store();
            }
        }
Example #25
0
 public PolygonNodeRenderer(PolygonNode node)
     : base(node)
 {
     this.node = node;
 }