public static IPointCollection VectorArrowPoints(double beginPntX, double beginPntY, IMapPoint endPnt)
        {
            double x     = beginPntX - endPnt.X;
            double y     = beginPntY - endPnt.Y;
            double angle = Math.Atan2(y, x);

            double alpha  = Math.PI / 6;                        // arrow is 30 degree by each side of original line
            double length = Math.Sqrt(x * x + y * y) * 0.25;    // arrow is a quarter of original length

            double x1 = endPnt.X + length * Math.Cos(angle + alpha);
            double y1 = endPnt.Y + length * Math.Sin(angle + alpha);
            double x2 = endPnt.X + length * Math.Cos(angle - alpha);
            double y2 = endPnt.Y + length * Math.Sin(angle - alpha);

            IMapPoint p1 = Runtime.geometryEngine.newMapPoint(x1, y1);
            IMapPoint p2 = Runtime.geometryEngine.newMapPoint(x2, y2);

            IPointCollection pc = Runtime.geometryEngine.newPointCollection();

            pc.Add(p1);
            pc.Add(endPnt);
            pc.Add(p2);

            return(pc);
        }
        // Draw horizontal distributed load
        // Note: x1<x2, (x1,y1)-(x2,y1) is a horizontal line, (x1,y2)-(x2,y3) is a oblique line
        //
        public static IGraphicCollection DistributedLoad_Horizontal(double x1, double x2, double y1, double y2, double y3,
                                                                    ISymbol backgroundFillSymbol, ISymbol arrowFillSymbol, ISymbol lineSymbol)
        {
            IGraphicCollection gc = Runtime.graphicEngine.newGraphicCollection();

            IMapPoint p1 = Runtime.geometryEngine.newMapPoint(x1, y1);
            IMapPoint p2 = Runtime.geometryEngine.newMapPoint(x1, y2);
            IMapPoint p3 = Runtime.geometryEngine.newMapPoint(x2, y3);
            IMapPoint p4 = Runtime.geometryEngine.newMapPoint(x2, y1);
            IGraphic  g  = Runtime.graphicEngine.newQuadrilateral(p1, p2, p3, p4);

            g.Symbol = backgroundFillSymbol;
            gc.Add(g);

            IPointCollection pc = Runtime.geometryEngine.newPointCollection();

            pc.Add(p1);
            pc.Add(p2);
            pc.Add(p3);
            pc.Add(p4);
            pc.Add(p1);
            g        = Runtime.graphicEngine.newPolyline(pc);
            g.Symbol = lineSymbol;
            gc.Add(g);

            double x00, y00, y01;

            for (int i = 0; i <= 10; ++i)
            {
                x00 = x1 + i * (x2 - x1) / 10.0;
                y00 = y1;
                y01 = y2 + i * (y3 - y2) / 10.0;
                IMapPoint p00 = Runtime.geometryEngine.newMapPoint(x00, y00);
                IMapPoint p01 = Runtime.geometryEngine.newMapPoint(x00, y01);
                g        = Runtime.graphicEngine.newLine(p00, p01);
                g.Symbol = lineSymbol;
                gc.Add(g);

                pc       = GeomUtil.VectorArrowPoints(x00, y2, p00);
                g        = Runtime.graphicEngine.newPolygon(pc);
                g.Symbol = arrowFillSymbol;
                gc.Add(g);
            }
            return(gc);
        }
Beispiel #3
0
        void test()
        {
            IPointCollection pc = Runtime.geometryEngine.newPointCollection();
            IMapPoint        p1 = Runtime.geometryEngine.newMapPoint(0, 0);
            IMapPoint        p2 = Runtime.geometryEngine.newMapPoint(0, 100);
            IMapPoint        p3 = Runtime.geometryEngine.newMapPoint(100, 0);

            pc.Add(p1);
            pc.Add(p2);
            pc.Add(p3);

            IGraphicCollection gc = Runtime.graphicEngine.newGraphicCollection();
            IGraphic           g1 = Runtime.graphicEngine.newLine(p1, p2);
            IGraphic           g2 = Runtime.graphicEngine.newLine(p1, p3);

            gc.Add(g1);
            gc.Add(g2);

            IEnvelope env = GraphicsUtil.GetGraphicsEnvelope(gc);
        }
        public static void Reverse(IPointCollection pts)
        {
            IEnumerable <IMapPoint> reversedPts = pts.Reverse();

            IPointCollection newPts = Runtime.geometryEngine.newPointCollection();

            foreach (IMapPoint pt in reversedPts)
            {
                newPts.Add(pt);
            }

            pts = Runtime.geometryEngine.newPointCollection();
            foreach (IMapPoint pt in newPts)
            {
                pts.Add(pt);
            }
        }
Beispiel #5
0
        public static void Reverse(IPointCollection pts)
        {
            IEnumerable<IMapPoint> reversedPts = pts.Reverse();

            IPointCollection newPts = Runtime.geometryEngine.newPointCollection();
            foreach (IMapPoint pt in reversedPts)
                newPts.Add(pt);

            pts = Runtime.geometryEngine.newPointCollection();
            foreach (IMapPoint pt in newPts)
                pts.Add(pt);
        }