Beispiel #1
0
        /// <summary>
        /// 更新半径
        /// </summary>
        /// <param name="radius"></param>
        public void UpdatePosition(double radius)
        {
            this.radius = radius;
            IZAware zAware = (IGeometry)centerPoint as IZAware;

            zAware.ZAware     = true;
            upperAxisVector3D = new Vector3DClass();
            upperAxisVector3D.SetComponents(0, 0, 10);
            lowerAxisVector3D = new Vector3DClass();
            lowerAxisVector3D.SetComponents(0, 0, -10);
            lowerAxisVector3D.XComponent -= vectorComponentOffset;
            normalVector3D           = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;
            normalVector3D.Magnitude = this.radius;
            double rotationAngleInRadians = 2 * (Math.PI / 180);

            geometryCollection = new MultiPatchClass();
            pointCollection.RemovePoints(0, pointCollection.PointCount);

            for (int i = 0; i < 180; i++)
            {
                normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);
                IPoint vertexPoint = new PointClass();
                vertexPoint.X = centerPoint.X + normalVector3D.XComponent;
                vertexPoint.Y = centerPoint.Y + normalVector3D.YComponent;
                vertexPoint.Z = centerPoint.Z;
                pointCollection.AddPoint(vertexPoint, missing, missing);
            }
            base.Geometry = pointCollection as IGeometry;

            this.Update();
        }
Beispiel #2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="graphicsLayer">图层</param>
        /// <param name="kmlCircle">圆的kml</param>
        public Circle_ArcGlobe(IGlobeGraphicsLayer _graphicsLayer, KmlCircle kmlCircle)
        {
            this.ElementType = Core.Model.ElementTypeEnum.Circle;
            graphicsLayer    = _graphicsLayer;
            lineSymbol       = new SimpleLineSymbolClass();

            lineSymbol.Color = new RgbColorClass()
            {
                Red   = kmlCircle.StrokeColor.R,
                Green = kmlCircle.StrokeColor.G,
                Blue  = kmlCircle.StrokeColor.B
            };

            if (kmlCircle.StrokeWidth == 0)
            {
                kmlCircle.StrokeWidth = 2;
            }

            lineSymbol.Width   = kmlCircle.StrokeWidth;
            fillSymbol         = new SimpleFillSymbolClass();
            fillSymbol.Outline = lineSymbol;
            fillSymbol.Color   = new RgbColorClass()
            {
                Red   = kmlCircle.FillColor.R,
                Green = kmlCircle.FillColor.G,
                Blue  = kmlCircle.FillColor.B
            };

            radius       = kmlCircle.Radius;
            outlineColor = kmlCircle.StrokeColor;
            fillColor    = kmlCircle.FillColor;

            centerPoint = new PointClass();//圆心坐标
            centerPoint.PutCoords(kmlCircle.Position.Lng, kmlCircle.Position.Lat);
            centerPoint.Z = kmlCircle.Position.Alt;

            missing = System.Type.Missing;
            IZAware zAware = (IGeometry)centerPoint as IZAware;

            zAware.ZAware     = true;
            upperAxisVector3D = new Vector3DClass();
            upperAxisVector3D.SetComponents(0, 0, 2);
            lowerAxisVector3D = new Vector3DClass();
            lowerAxisVector3D.SetComponents(0, 0, -2);
            lowerAxisVector3D.XComponent -= vectorComponentOffset;
            lowerAxisVector3D.YComponent -= vectorComponentOffset;//TODO
            normalVector3D           = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;
            normalVector3D.Magnitude = kmlCircle.Radius;
            double rotationAngleInRadians = 2 * (Math.PI / 180);

            //geometryCollection = new MultiPatchClass();
            pointCollection = new PolygonClass();

            for (int i = 0; i < 180; i++)
            {
                normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);
                IPoint vertexPoint = new PointClass();
                vertexPoint.X = centerPoint.X + normalVector3D.XComponent;
                vertexPoint.Y = centerPoint.Y + normalVector3D.YComponent;
                vertexPoint.Z = centerPoint.Z;
                pointCollection.AddPoint(vertexPoint, missing, missing);
            }

            base.Symbol   = fillSymbol;
            base.Geometry = pointCollection as IGeometry;

            flashTimer          = new System.Timers.Timer();
            flashTimer.Elapsed += new System.Timers.ElapsedEventHandler(flashTimer_Elapsed);
            flashTimer.Interval = 500;
        }