예제 #1
0
        private IGeometry RotateLine(IGeometry geom, double newAngle, double oldAngle, bool isLine = true)
        {
            IPoint centerPoint;
            IElement elem;
            if (isLine)
            {
                IPointCollection ptCol = geom as IPointCollection;
                centerPoint = ptCol.get_Point(0);
                elem = new LineElement();
            }
            else
            {
                centerPoint = new PointClass
                {
                    X = (geom.Envelope.LowerLeft.X + geom.Envelope.LowerRight.X) / 2,
                    Y = (geom.Envelope.LowerLeft.Y + geom.Envelope.UpperRight.Y) / 2
                };
                elem = new PolygonElement();
            }

            elem.Geometry = geom;
            ITransform2D trans = elem as ITransform2D;

            double angle = newAngle - oldAngle;
            if ((newAngle - oldAngle) > Math.PI / 2)
            {
                angle += Math.PI;
            }
            if ((newAngle - oldAngle) < -1 * Math.PI / 2)
            {
                angle -= Math.PI;
            }

            trans.Rotate(centerPoint, angle);
            return elem.Geometry;
        }
예제 #2
0
 private IGeometry MoveGeom(IGeometry geom, double dx, double dy)
 {
     IElement elem = new PolygonElement();
     elem.Geometry = geom;
     ITransform2D trans = elem as ITransform2D;
     trans.Move(dx, dy);
     return elem.Geometry;
 }
예제 #3
0
파일: GisUtil.cs 프로젝트: Leooonard/CGXM
 public static IElement drawPolygonByScore(IGeometry geom, double score, AxMapControl mapControl)
 {
     ISimpleFillSymbol fSym = new SimpleFillSymbolClass();
     ILineSymbol lSym = new SimpleLineSymbolClass();
     IRgbColor color = new RgbColorClass();
     if (score == 0)
     {
         color.Red = 255;
         color.Green = 255;
         color.Blue = 255;
     }
     else if (score > 0 && score <= 0.3)
     {
         color.Blue = 255;
         color.Red = 0;
         color.Green = 0;
     }
     else if (score > 0.3 && score <= 0.6)
     {
         color.Green = 255;
         color.Red = 0;
         color.Blue = 0;
     }
     else
     {
         color.Red = 255;
         color.Green = 0;
         color.Blue = 0;
     }
     fSym.Color = color;
     color.Red = 255;
     color.Green = 255;
     color.Blue = 255;
     lSym.Color = color;
     fSym.Outline = lSym;
     fSym.Style = esriSimpleFillStyle.esriSFSSolid;
     PolygonElement pFillElement = new PolygonElement();
     pFillElement.Symbol = fSym;
     pFillElement.Opacity = 50;
  
     IElement pEle = pFillElement as IElement;
     pEle.Geometry = geom;
     IGraphicsContainer pGraphics = mapControl.Map as IGraphicsContainer;
     IActiveView pActiveView = mapControl.ActiveView;
     pGraphics.AddElement(pEle, 0);
     pActiveView.Refresh();
     return pEle;
 }