Esempio n. 1
0
        private IGeometry BuildLinkGeometry(ISchematicInMemoryFeatureLink schLink1, ISchematicInMemoryFeatureNode schNodeToReduce, ISchematicInMemoryFeatureLink schLink2, ISchematicRulesHelper rulesHelper)
        {
            if (schLink1 == null || schLink2 == null || schNodeToReduce == null || rulesHelper == null)
            {
                return(null);
            }

            if (m_keepVertices == false)
            {
                return(null); // no geometry
            }
            Polyline  newPoly   = new Polyline();
            IPolyline polyLink1 = rulesHelper.GetLinkPoints(schLink1, (schLink1.FromNode == schNodeToReduce));
            IPolyline polyLink2 = rulesHelper.GetLinkPoints(schLink2, (schLink2.ToNode == schNodeToReduce));
            IPoint    nodePt    = rulesHelper.GetNodePoint(schNodeToReduce);
            IPoint    Pt;

            IPointCollection newPts   = (IPointCollection)newPoly;
            IPointCollection link1Pts = (IPointCollection)polyLink1;
            IPointCollection link2Pts = (IPointCollection)polyLink2;

            int Count = link1Pts.PointCount;
            int i;

            for (i = 0; i < Count - 1; i++)
            {
                Pt = link1Pts.get_Point(i);
                newPts.AddPoint(Pt);
            }

            newPts.AddPoint(nodePt);

            Count = link2Pts.PointCount;
            for (i = 1; i < Count; i++)
            {
                Pt = link2Pts.get_Point(i);
                newPts.AddPoint(Pt);
            }

            IGeometry buildGeometry = (IGeometry)newPoly;

            return(buildGeometry);
        }
        private IGeometry BuildLinkGeometry(ISchematicInMemoryFeatureLink schLink1, ISchematicInMemoryFeatureNode schNodeToReduce, ISchematicInMemoryFeatureLink schLink2, ISchematicRulesHelper rulesHelper)
        {

            if (schLink1 == null || schLink2 == null || schNodeToReduce == null || rulesHelper == null)
                return null;

            if (m_keepVertices == false)
                return null; // no geometry

            Polyline newPoly = new Polyline();
            IPolyline polyLink1 = rulesHelper.GetLinkPoints(schLink1, (schLink1.FromNode == schNodeToReduce));
            IPolyline polyLink2 = rulesHelper.GetLinkPoints(schLink2, (schLink2.ToNode == schNodeToReduce));
            IPoint nodePt = rulesHelper.GetNodePoint(schNodeToReduce);
            IPoint Pt;

            IPointCollection newPts = (IPointCollection)newPoly;
            IPointCollection link1Pts = (IPointCollection)polyLink1;
            IPointCollection link2Pts = (IPointCollection)polyLink2;

            int Count = link1Pts.PointCount;
            int i;
            for (i = 0; i < Count - 1; i++)
            {
                Pt = link1Pts.get_Point(i);
                newPts.AddPoint(Pt);
            }

            newPts.AddPoint(nodePt);

            Count = link2Pts.PointCount;
            for (i = 1; i < Count; i++)
            {
                Pt = link2Pts.get_Point(i);
                newPts.AddPoint(Pt);
            }

            IGeometry buildGeometry = (IGeometry)newPoly;
            return buildGeometry;
        }