Пример #1
0
 public IPolyline ConvertPointsToPolyline(IPointCollection pPoints)
 {
     try
     {
         if (pPoints == null)
         {
             return(null);
         }
         IClone           clone  = pPoints as IClone;
         IPointCollection points = null;
         points = clone.Clone() as IPointCollection;
         if (points.PointCount < 0)
         {
             return(null);
         }
         IPointCollection points2 = null;
         points2 = new PolylineClass();
         int    i      = 0;
         object before = null;
         object after  = null;
         for (i = 0; i <= (points.PointCount - 1); i++)
         {
             points2.AddPoint(points.get_Point(i), ref before, ref after);
         }
         (points2 as ITopologicalOperator).Simplify();
         return(points2 as IPolyline);
     }
     catch (Exception exception)
     {
         this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.GeometryFun", "ConvertPointsToPolyline", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
         return(null);
     }
 }
Пример #2
0
        //面构成线
        private static IPolyline PolygonToPolyline(ref IPolygon pPolygon)
        {
            try
            {
                //创建一个新的Polygon geometry.
                IGeometryCollection pPolygonGeometryCol = new PolylineClass();

                //克隆即将要操作的Polyline
                IClone pClone = pPolygon as IClone;

                IGeometryCollection pGeoms_Polygon = pClone.Clone() as IGeometryCollection;
                object pBObj = Type.Missing;
                object pAObj = Type.Missing;
                for (int i = 0; i < pGeoms_Polygon.GeometryCount; i++)
                {
                    //通过Polyline的每个Path创建为一个新的Ring,并把Ring增加到一个新的Polygon
                    ISegmentCollection pSegs_Path = new Path() as ISegmentCollection;
                    pSegs_Path.AddSegmentCollection(pGeoms_Polygon.get_Geometry(i) as ISegmentCollection);
                    pPolygonGeometryCol.AddGeometry(pSegs_Path as IGeometry, ref pBObj, ref pAObj);
                }
                //生成的Polygon旋转的顺序可能不正确,为确保正确调用SimplifyPreserveFromTo
                IPolyline pNewPolyline = new PolylineClass();
                pNewPolyline = pPolygonGeometryCol as IPolyline;

                return(pNewPolyline);
            }
            catch
            {
                return(null);
            }
        }
Пример #3
0
        //复制MapFrame
        private void CopyMapSurroundFrame(IMapSurroundFrame srcArrow, IMapSurroundFrame destArrow)
        {
            IClone pSrc  = srcArrow as IClone;
            IClone pDest = pSrc.Clone();

            destArrow = pDest as IMapSurroundFrame;
        }
Пример #4
0
        public void ZoomToPoint(AxGlobeControl axGlobeControl, double MapX, double MapY)
        {
            try
            {
                IPoint point = new PointClass();
                point.PutCoords(MapX, MapY);    //设置点击的点坐标
                //point = CommonBaseTool.BaseGISTools.getGeoPoint(MapX, MapY);        //转换坐标

                IPoint ptObserver = new PointClass();
                IPoint ptTarget   = new PointClass();

                //Observer点
                IClone pClone1 = point as IClone;
                ptObserver   = pClone1.Clone() as IPoint;
                ptObserver.Y = ptObserver.Y - 0.08;
                ptObserver.Z = 15.45;
                //Target点
                IClone pClone2 = point as IClone;
                ptTarget   = pClone2.Clone() as IPoint;
                ptTarget.Z = -0.01;

                axGlobeControl.GlobeCamera.SetObserverLatLonAlt(ptObserver.Y, ptObserver.X, ptObserver.Z);
                axGlobeControl.GlobeCamera.SetTargetLatLonAlt(ptTarget.Y, ptTarget.X, ptTarget.Z);
                //刷新
                axGlobeControl.GlobeDisplay.RefreshViewers();
            }
            catch { }
        }
Пример #5
0
        public bool IsEqual(IClone other)
        {
            if (null == other)
            {
                throw new COMException("Invalid objact.");
            }
            if (!(other is TriangleElementClass))
            {
                throw new COMException("Bad object type.");
            }
            TriangleElementClass triangleElementClass = (TriangleElementClass)other;

            return((!(triangleElementClass.Name == this.m_elementName) ||
                    !(triangleElementClass.Type == this.m_elementType) ||
                    triangleElementClass.AutoTransform != this.m_autoTrans ||
                    triangleElementClass.ReferenceScale != this.m_scaleRef ||
                    triangleElementClass.Angle != this.m_rotation || triangleElementClass.Size != this.m_size ||
                    triangleElementClass.AnchorPoint != this.m_anchorPointType ||
                    !((IClone)triangleElementClass.Geometry).IsEqual((IClone)this.m_triangle) ||
                    !((IClone)triangleElementClass.FillSymbol).IsEqual((IClone)this.m_fillSymbol)
                ? true
                : !((IClone)triangleElementClass.SpatialReference).IsEqual((IClone)this.m_nativeSR))
                ? false
                : true);
        }
Пример #6
0
        /// <summary>
        /// Returns TRUE when the receiver and the other object have the same properties.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool IsEqual(IClone other)
        {
            //1. make sure that the 'other' object is pointing to a valid object
            if (null == other)
            {
                throw new COMException("Invalid objact.");
            }

            //2. verify the type of 'other'
            if (!(other is ClonableObjClass))
            {
                throw new COMException("Bad object type.");
            }

            ClonableObjClass otherClonable = (ClonableObjClass)other;

            //test that all ot the object's properties are the same.
            //please note the usage of IsEqual when using arcobjects components that
            //supports cloning
            if (otherClonable.Version == m_version &&
                otherClonable.Name == m_name &&
                otherClonable.ID == m_ID &&
                otherClonable.ManagedArray == m_arr &&
                ((IClone)otherClonable.SpatialReference).IsEqual((IClone)m_spatialRef) &&
                ((IClone)otherClonable.Point).IsEqual((IClone)m_point))
            {
                return(true);
            }

            return(false);
        }
Пример #7
0
        /// <summary>
        /// Checks if a spatial reference is unprojected WGS84.
        /// </summary>
        /// <param name="sr">spatial reference to check</param>
        /// <returns>true if the spatial reference is WGS84, false if not</returns>
        public static bool IsWGS84(ISpatialReference sr)
        {
            IClone wgs84       = (IClone)EsriUtilities.GetWGS84();
            IClone targetDatum = (IClone)EsriUtilities.GetDatum(sr);

            return((targetDatum).IsEqual(wgs84));
        }
Пример #8
0
        public bool IsEqual(IClone other)
        {
            //1. make sure that the 'other' object is pointing to a valid object
            if (null == other)
            {
                throw new COMException("Invalid object.");
            }

            //2. verify the type of 'other'
            if (!(other is TriangleElementClass))
            {
                throw new COMException("Bad object type.");
            }

            TriangleElementClass otherTriangle = (TriangleElementClass)other;

            //test that all of the object's properties are the same.
            //please note the usage of IsEqual when using ArcObjects components that
            //supports cloning
            if (otherTriangle.Name == m_elementName &&
                otherTriangle.Type == m_elementType &&
                otherTriangle.AutoTransform == m_autoTrans &&
                otherTriangle.ReferenceScale == m_scaleRef &&
                otherTriangle.Angle == m_rotation &&
                otherTriangle.Size == m_size &&
                otherTriangle.AnchorPoint == m_anchorPointType &&
                ((IClone)otherTriangle.Geometry).IsEqual((IClone)m_triangle) &&
                ((IClone)otherTriangle.FillSymbol).IsEqual((IClone)m_fillSymbol) &&
                ((IClone)otherTriangle.SpatialReference).IsEqual((IClone)m_nativeSR))
            {
                return(true);
            }

            return(false);
        }
Пример #9
0
        /// <summary>
        /// Determines whether the specified objects are equal.
        /// </summary>
        /// <param name="x">The first object of type <see cref="IGeometry"/> to compare.</param>
        /// <param name="y">The second object of type <see cref="IGeometry"/> to compare.</param>
        /// <returns>
        /// true if the specified objects are equal; otherwise, false.
        /// </returns>
        public virtual bool Equals(IGeometry x, IGeometry y)
        {
            IClone xc = x as IClone;
            IClone yc = y as IClone;

            return((xc != null && yc != null) && xc.IsEqual(yc));
        }
Пример #10
0
        IPoint IntersectPointExtendedTo(IPolyline pPolyline, IPolygon pCirclePoly)
        {
            ICurve               pCurve;
            ILine                pLine;
            IPolyline            pPLine;
            ITopologicalOperator pTopoOpt;
            IGeometryCollection  pGeoCol;

            pCurve = pPolyline;
            pLine  = new Line();
            double gridWidth = _mapTemplate.Width * _scale / 100.0;

            pCurve.QueryTangent(esriSegmentExtension.esriExtendTangentAtTo, 1, true, gridWidth * 1.1, pLine);
            pPLine = new Polyline() as IPolyline;
            IPointCollection pPnts  = pPLine as IPointCollection;
            IClone           pClone = pLine.FromPoint as IClone;

            pPnts.AddPoint(pClone.Clone() as IPoint);
            pClone = pLine.ToPoint as IClone;
            pPnts.AddPoint(pClone.Clone() as IPoint);
            pTopoOpt = pPLine as ITopologicalOperator;
            pGeoCol  = new GeometryBag() as IGeometryCollection;
            pGeoCol  =
                pTopoOpt.Intersect(pCirclePoly, esriGeometryDimension.esriGeometry0Dimension) as IGeometryCollection;
            if (pGeoCol.GeometryCount == 0)
            {
                return(null);
            }
            return(pGeoCol.Geometry[0] as IPoint);
        }
Пример #11
0
        /// <summary>
        /// Gets a list of all geotransforms that use the provided spatial reference and unprojected
        /// WGS84
        /// </summary>
        /// <param name="sr">spatial reference to look for</param>
        /// <returns>List of applicable IGeoTransformation objects</returns>
        public static List <IGeoTransformation> GetTransformations(ISpatialReference sr)
        {
            GeoTransformationComparer transComparer = new GeoTransformationComparer();
            IClone wgs84       = (IClone)EsriUtilities.GetWGS84();
            IClone targetDatum = (IClone)EsriUtilities.GetDatum(sr);
            List <IGeoTransformation> transList = new List <IGeoTransformation>();
            ISpatialReferenceFactory2 srFactory = new SpatialReferenceEnvironmentClass();
            ISet transSet = srFactory.GetPredefinedGeographicTransformations();
            IGeoTransformation trans;
            ISpatialReference  fromDatum;
            ISpatialReference  toDatum;

            for (int i = 0; i < transSet.Count; i++)
            {
                trans = (IGeoTransformation)transSet.Next();
                trans.GetSpatialReferences(out fromDatum, out toDatum);
                if (wgs84.IsEqual((IClone)fromDatum) || wgs84.IsEqual((IClone)toDatum))
                {
                    if (targetDatum.IsEqual((IClone)fromDatum) || targetDatum.IsEqual((IClone)toDatum))
                    {
                        transList.Add(trans);
                    }
                }
            }
            transList.Sort(transComparer.Compare);
            return(transList);
        }
Пример #12
0
        //复制指北针
        private void CopyNorthArrow(INorthArrow srcArrow, INorthArrow destArrow)
        {
            IClone pSrc  = srcArrow as IClone;
            IClone pDest = pSrc.Clone();

            destArrow = pDest as INorthArrow;
        }
Пример #13
0
        private void CopyLayerToOverview(string layerName)
        {
            IFeatureLayer featureLayerClass;
            IFeatureLayer featureLayer = null;

            if (_mainMapControl.LayerCount == 0)
            {
                return;
            }

            ILayer pLayer = LayerHelper.QueryLayerByDisplayName(_context.MapControl.Map, layerName) as ILayer;

            if (pLayer == null)
            {
                CopyLastLayerToOverview();
                return;
            }

            IClone pClone   = pLayer as IClone;
            ILayer newLayer = pClone.Clone() as ILayer;

            newLayer.Visible = true;
            axMapControl1.Map.AddLayer(newLayer);
            this.axMapControl1.Extent = _mainMapControl.FullExtent;
        }
Пример #14
0
 void ESRI.ArcGIS.esriSystem.IClone.Assign(IClone src)
 {
     if (src is IFractionTextSymbol)
     {
         try
         {
             ITextSymbol         textSymbol         = null;
             ITextSymbol         angle              = null;
             IFractionTextSymbol fractionTextSymbol = src as IFractionTextSymbol;
             this.m_DenominatorText       = fractionTextSymbol.DenominatorText;
             this.m_DenominatorTextSymbol = fractionTextSymbol.DenominatorTextSymbol;
             this.m_NumeratorText         = fractionTextSymbol.DenominatorText;
             this.m_NumeratorTextSymbol   = fractionTextSymbol.NumeratorTextSymbol;
             this.m_LineSymbol            = fractionTextSymbol.LineSymbol;
             textSymbol  = src as ITextSymbol;
             angle       = this;
             angle.Angle = textSymbol.Angle;
             angle.Size  = textSymbol.Size;
             angle.Color = textSymbol.Color;
             angle.HorizontalAlignment = textSymbol.HorizontalAlignment;
             angle.RightToLeft         = textSymbol.RightToLeft;
             angle.Text = textSymbol.Text;
             angle.VerticalAlignment = textSymbol.VerticalAlignment;
             //this.ROP2 = (src as ISymbol).ROP2;
             //this.RotateWithTransform = (src as ISymbolRotation).RotateWithTransform;
             //this.MapLevel = (src as IMapLevel).MapLevel;
         }
         catch
         {
         }
     }
 }
Пример #15
0
        private void dataGridView3_CellClick(object obj, DataGridViewCellEventArgs dataGridViewCellEventArgs)
        {
            if (dataGridViewCellEventArgs.RowIndex < 0)
            {
                return;
            }
            IFeatureClass featureClass = this.m_pCurLayer.FeatureClass;

            try
            {
                string        str              = this.dataGridView3[0, dataGridViewCellEventArgs.RowIndex].Value.ToString();
                string        whereClause      = featureClass.OIDFieldName + " = " + str;
                IFeatureClass arg_5C_0         = featureClass;
                IQueryFilter  queryFilterClass = new QueryFilter();
                queryFilterClass.WhereClause = (whereClause);
                IFeatureCursor featureCursor = arg_5C_0.Search(queryFilterClass, false);
                IFeature       feature       = featureCursor.NextFeature();
                IGeometry      shape         = feature.Shape;
                IClone         clone         = (IClone)shape;
                IClone         clone2        = clone.Clone();
                this.igeometry_0 = (IGeometry)clone2;
                this.ScaleToGeo(this.m_iApp.ActiveView, this.igeometry_0);
                this.m_nCurRowIndex = dataGridViewCellEventArgs.RowIndex;
                this.timer_0.Start();
                this.m_nTimerCounter = 0;
                this.m_iApp.ActiveView.Refresh();
            }
            catch (Exception)
            {
            }
        }
Пример #16
0
        private void method_5()
        {
            this.bool_6 = true;
            this.bool_1 = false;
            IEnumFeature        enumFeature        = _context.FocusMap.FeatureSelection as IEnumFeature;
            IGeometryCollection geometryCollection = new GeometryBag() as IGeometryCollection;

            enumFeature.Reset();
            IFeature feature = enumFeature.Next();
            object   value   = Missing.Value;

            while (feature != null)
            {
                esriGeometryType geometryType = feature.Shape.GeometryType;
                if (geometryType == esriGeometryType.esriGeometryPolygon ||
                    geometryType == esriGeometryType.esriGeometryPolyline)
                {
                    IClone clone = feature.Shape as IClone;
                    geometryCollection.AddGeometry(clone.Clone() as IGeometry, ref value, ref value);
                    this.bool_4 = true;
                }
                feature = enumFeature.Next();
            }
            if (this.bool_2)
            {
                this.isegmentGraph_0.SetEmpty();
                this.isegmentGraphCursor_0 = null;
            }
            this.isegmentGraph_0.Load(geometryCollection as IEnumGeometry, false, true);
            this.bool_2 = false;
        }
Пример #17
0
        public IFeatureLayer  CreateLayer(IFeatureClass pFeatureClass, int index)  //新建任意范围打印地图的图层
        {
            string FilePath = @"C:\任意打印\";
            string FileName = "bb" + index.ToString();
            /////////////////////////////////////////////////
            // ILayerFile layerFile = new LayerFileClass();

            // layerFile.New(FilePath + FileName);

            /////////////////////////////////////////////


            IFields           pFields        = pFeatureClass.Fields;
            IClone            pClone         = pFields as IClone;
            IFields           pCloneFields   = pClone.Clone() as IFields;
            IDataset          pDataSet       = pFeatureClass as IDataset;
            IWorkspace        pWorkSpace     = pDataSet.Workspace;
            IFeatureWorkspace pFeatWorkspace = pWorkSpace as IFeatureWorkspace;

            IFeatureClass newFeatcls = pFeatWorkspace.CreateFeatureClass(FileName, pCloneFields,
                                                                         null, null, esriFeatureType.esriFTSimple, pFeatureClass.ShapeFieldName, "");
            IFeatureLayer pFeatureLayer = new FeatureLayerClass();

            pFeatureLayer.FeatureClass = newFeatcls;
            pFeatureLayer.Name         = newFeatcls.AliasName;

            return(pFeatureLayer);

            // System.Runtime.InteropServices.Marshal.ReleaseComObject(FilePath);
            // System.Runtime.InteropServices.Marshal.ReleaseComObject(FileName );
            // System.Runtime.InteropServices.Marshal.ReleaseComObject(pFields );
            //System.Runtime.InteropServices.Marshal.ReleaseComObject(pDataSet );
            // System.Runtime.InteropServices.Marshal.ReleaseComObject(newFeatcls);
        }
Пример #18
0
 public UserVM(IChatHub chat, IClone <UserModel> clone, IFile file)
 {
     _chat  = chat;
     _clone = clone;
     _file  = file;
     _chat.ConnectionStarted += GetCurrentUser;
 }
Пример #19
0
        //尝试复制Legend
        private void DeepCopyLegend(ILegend SrcLegend, ILegend DstLegend)
        {
            IClone pSrc  = SrcLegend as IClone;
            IClone pDest = pSrc.Clone();

            DstLegend = pDest as ILegend;
        }
Пример #20
0
        void ESRI.ArcGIS.esriSystem.IClone.Assign(IClone src)
        {
            ILogoMarkerSymbol logoMarkerSymbol = null;
            IMarkerSymbol     markerSymbol     = null;
            IMarkerSymbol     angle            = null;

            if (src != null)
            {
                if (src is ILogoMarkerSymbol)
                {
                    logoMarkerSymbol   = src as ILogoMarkerSymbol;
                    this.m_colorBorder = logoMarkerSymbol.ColorBorder;
                    this.m_colorLeft   = logoMarkerSymbol.ColorLeft;
                    this.m_colorRight  = logoMarkerSymbol.ColorRight;
                    this.m_colorTop    = logoMarkerSymbol.ColorTop;
                    markerSymbol       = src as IMarkerSymbol;
                    angle         = this;
                    angle.Angle   = markerSymbol.Angle;
                    angle.Size    = markerSymbol.Size;
                    angle.XOffset = markerSymbol.XOffset;
                    angle.YOffset = markerSymbol.YOffset;
                    //this. = (src as ISymbol).ROP2;
                    //this.RotateWithTransform = (src as ISymbolRotation).RotateWithTransform;
                    //this.MapLevel = (src as IMapLevel).MapLevel;
                }
            }
        }
Пример #21
0
        /// <summary>
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool IsEqual(IClone other)
        {
            bool flag;

            flag = (!(other is OleFrame) ? false : this.PropertySet.IsEqual((other as OleFrame).PropertySet));
            return(flag);
        }
Пример #22
0
        //获取当前的缓冲后的几何体
        private void get_BufferGeometry()
        {
            //存在上次的缓冲几何体 则先抹去其图形
            if (m_pBufferGeometry != null)
            {
                drawgeometryXOR(m_pBufferGeometry as IPolygon, m_pScreenDisplay);
            }

            //获取缓冲半径
            double dBufferSize = ((double)trackBar.Value /*/ 10*/);

            dBufferSize = dBufferSize < 1 ? 1 : dBufferSize;
            //if ( dBufferSize == 0.0) dBufferSize = 0.001;

            //==如果直接操作,则原pGeometry会被改变
            //进行克隆,获取topo实例
            IClone pClone = (IClone)m_pGeometry;
            ITopologicalOperator pTopo;

            if (m_pGeometry.GeometryType != esriGeometryType.esriGeometryBag)
            {
                pTopo = pClone.Clone() as ITopologicalOperator;

                //topo非空则进行缓冲,获取缓冲后的 m_pBufferGeometry
                if (pTopo != null)
                {
                    m_pBufferGeometry = pTopo.Buffer(dBufferSize);
                }
            }
            else
            {
                IGeometryCollection pGeometryBag = (IGeometryCollection)pClone.Clone();
                pTopo = (ITopologicalOperator)pGeometryBag.get_Geometry(0);
                IGeometry pUnionGeom = pTopo.Buffer(dBufferSize);
                for (int i = 1; i < pGeometryBag.GeometryCount; i++)
                {
                    pTopo = (ITopologicalOperator)pGeometryBag.get_Geometry(i);
                    IGeometry pTempGeom = pTopo.Buffer(dBufferSize);
                    pTopo      = (ITopologicalOperator)pUnionGeom;
                    pUnionGeom = pTopo.Union(pTempGeom);
                }
                m_pBufferGeometry = pUnionGeom;
            }
            // m_pBufferGeometry为空,直接返回
            if (m_pBufferGeometry == null)
            {
                return;
            }

            //对 m_pBufferGeometry的topo进行简化再绘出
            pTopo = m_pBufferGeometry as ITopologicalOperator;
            if (pTopo != null)
            {
                pTopo.Simplify();
            }

            IPolygon pPolygon = m_pBufferGeometry as IPolygon;

            drawgeometryXOR(pPolygon, m_pScreenDisplay);
        }
Пример #23
0
        bool ESRI.ArcGIS.esriSystem.IClone.IsEqual(IClone other)
        {
            bool angle = false;
            ILogoMarkerSymbol logoMarkerSymbol  = null;
            ILogoMarkerSymbol logoMarkerSymbol1 = null;
            IMarkerSymbol     markerSymbol      = null;
            IMarkerSymbol     markerSymbol1     = null;
            ISymbol           symbol            = null;
            ISymbol           symbol1           = null;
            IDisplayName      displayName       = null;
            IDisplayName      displayName1      = null;
            ISymbolRotation   symbolRotation    = null;
            ISymbolRotation   symbolRotation1   = null;
            IMapLevel         mapLevel          = null;
            IMapLevel         mapLevel1         = null;

            if (other != null)
            {
                if (other is ILogoMarkerSymbol)
                {
                    logoMarkerSymbol  = other as ILogoMarkerSymbol;
                    logoMarkerSymbol1 = this;
                    System.Drawing.Color color =
                        ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol1.ColorBorder.RGB));
                    angle = angle &
                            color.Equals(ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol.ColorBorder.RGB)));
                    color = ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol1.ColorLeft.RGB));
                    angle = angle &
                            color.Equals(ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol.ColorLeft.RGB)));
                    color = ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol1.ColorRight.RGB));
                    angle = angle &
                            color.Equals(ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol.ColorRight.RGB)));
                    color = ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol1.ColorTop.RGB));
                    angle = angle &
                            color.Equals(ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol.ColorTop.RGB)));
                    markerSymbol    = other as IMarkerSymbol;
                    markerSymbol1   = this;
                    angle           = angle & markerSymbol1.Angle == markerSymbol.Angle;
                    color           = ColorTranslator.FromOle(Convert.ToInt32(markerSymbol1.Color.RGB));
                    angle           = angle & color.Equals(ColorTranslator.FromOle(Convert.ToInt32(markerSymbol.Color.RGB)));
                    angle           = angle & markerSymbol1.Size == markerSymbol.Size;
                    angle           = angle & markerSymbol1.XOffset == markerSymbol.XOffset;
                    angle           = angle & markerSymbol1.YOffset == markerSymbol.YOffset;
                    symbol          = other as ISymbol;
                    symbol1         = this;
                    angle           = angle & symbol1.ROP2 == symbol.ROP2;
                    displayName     = other as IDisplayName;
                    displayName1    = this;
                    angle           = angle & (displayName1.NameString == displayName.NameString);
                    symbolRotation  = other as ISymbolRotation;
                    symbolRotation1 = this;
                    angle           = angle & symbolRotation1.RotateWithTransform == symbolRotation.RotateWithTransform;
                    mapLevel        = other as IMapLevel;
                    mapLevel1       = this;
                    angle           = angle & mapLevel1.MapLevel == mapLevel.MapLevel;
                }
            }
            return(angle);
        }
Пример #24
0
        IClone ESRI.ArcGIS.esriSystem.IClone.Clone()
        {
            IClone fractionTextSymbolClass = null;

            fractionTextSymbolClass = new FractionTextSymbolClass() as IClone;
            fractionTextSymbolClass.Assign(this);
            return(fractionTextSymbolClass);
        }
Пример #25
0
        IClone ESRI.ArcGIS.esriSystem.IClone.Clone()
        {
            IClone logoMarkerSymbol = null;

            logoMarkerSymbol = new LogoMarkerSymbol() as IClone;
            logoMarkerSymbol.Assign(this);
            return(logoMarkerSymbol);
        }
Пример #26
0
        IClone ESRI.ArcGIS.esriSystem.IClone.Clone()
        {
            IClone labelSymbol = null;

            labelSymbol = new LabelSymbol();
            labelSymbol.Assign(this);
            return(labelSymbol);
        }
Пример #27
0
        public static IEnvelope Clone(this IEnvelope envelope)
        {
            IClone    clone         = (IClone)envelope;
            object    copy          = clone.Clone();
            IEnvelope envelopeClone = (IEnvelope)copy;

            return(envelopeClone);
        }
Пример #28
0
        IClone ESRI.ArcGIS.esriSystem.IClone.Clone()
        {
            IFractionTextSymbol fractionTextSymbolClass = null;
            IClone clone = null;

            fractionTextSymbolClass = new FractionTextSymbolClass();
            return(clone);
        }
Пример #29
0
        /// <summary>
        /// 算出量测计算结果,并在FormDis上进行显示
        /// </summary>
        /// <param name="ipGeo">人机交互生成的实体</param>
        public void WriteLabelText(IGeometry ipGeo)
        {
            switch (m_MeasureType)
            {
            case MeasureType.Length:              //量测长度
            {
                string strUnit = " " + (this.m_Tool as ToolMeasureLength).m_hookHelper.FocusMap.MapUnits.ToString().Substring(4);
                //this.m_LabelMeasureType.Text = "Line Measurement";
                this.m_LabelMeasureType.Text = "长度量测";
                this.m_labelArea.Visible     = true;
                if (ipGeo != null)
                {
                    IGeometryCollection ipGeoCol      = ipGeo as IGeometryCollection;
                    ISegmentCollection  ipSegmentColl = ipGeoCol.get_Geometry(0) as ISegmentCollection;
                    ILine ipLine = ipSegmentColl.get_Segment(ipSegmentColl.SegmentCount - 1) as ILine;
                    //this.m_labelSegment.Text = "段长度:" + ipLine.Length.ToString() + strUnit;
                    //this.m_labelLength.Text = "长度:" + (ipGeoCol.get_Geometry(0) as ICurve).Length.ToString() + "米";
                    this.m_labelArea.Text = "长度:" + (ipGeoCol.get_Geometry(0) as ICurve).Length.ToString("f3") + "米";
                }
                else
                {
                    this.m_labelArea.Text = "长度:" + "0" + "米";
                    //this.m_labelLength.Text = "总长度:" + "0" + strUnit;
                }
            }
            break;

            case MeasureType.Area:      //量测面积
            {
                string strUnit = " " + (this.m_Tool as ToolMeasureArea).m_hookHelper.FocusMap.MapUnits.ToString().Substring(4);
                //this.m_LabelMeasureType.Text = "Area Measurement";
                this.m_LabelMeasureType.Text = "面积量测";
                this.m_labelArea.Visible     = true;
                if (ipGeo != null)
                {
                    IGeometryCollection ipGeoCol      = ipGeo as IGeometryCollection;
                    ISegmentCollection  ipSegmentColl = ipGeoCol.get_Geometry(0) as ISegmentCollection;
                    ILine ipLine = ipSegmentColl.get_Segment(ipSegmentColl.SegmentCount - 1) as ILine;
                    //this.m_labelSegment.Text = "Segment:" + ipLine.Length.ToString() + strUnit;
                    //this.m_labelLength.Text = "Perimeter:" + (ipGeoCol.get_Geometry(0) as IRing).Length.ToString() + strUnit;
                    //this.m_labelSegment.Text = "段长度:" + ipLine.Length.ToString() + strUnit;
                    //this.m_labelLength.Text = "周长:" + (ipGeoCol.get_Geometry(0) as IRing).Length.ToString() + strUnit;

                    IClone               ipClone = ipGeo as IClone;
                    IGeometry            ipGeo1  = ipClone.Clone() as IGeometry;
                    ITopologicalOperator ipTopo  = ipGeo1 as ITopologicalOperator;
                    ipTopo.Simplify();

                    this.m_labelArea.Text = "面积:" + ((ipGeo1 as IPolygon) as IArea).Area.ToString(".###") + "平方米";
                }
                else
                {
                    this.m_labelArea.Text = "面积:" + "0" + "平方米";
                }
            }
            break;
            }
        }
Пример #30
0
        private IFeatureClass method_1(IFeatureWorkspace ifeatureWorkspace_0, string string_4, double double_0,
                                       ITextSymbol itextSymbol_0, IFields ifields_0)
        {
            IObjectClassDescription  description  = new AnnotationFeatureClassDescriptionClass();
            IFeatureClassDescription description2 = description as IFeatureClassDescription;
            IClone     requiredFields             = description.RequiredFields as IClone;
            IFields    fields = requiredFields.Clone() as IFields;
            IFieldEdit edit   = null;
            int        index  = fields.FindField(description2.ShapeFieldName);

            edit = fields.get_Field(index) as IFieldEdit;
            IGeometryDefEdit      geometryDef    = edit.GeometryDef as IGeometryDefEdit;
            IFeatureWorkspaceAnno anno           = ifeatureWorkspace_0 as IFeatureWorkspaceAnno;
            IGraphicsLayerScale   referenceScale = new GraphicsLayerScaleClass
            {
                ReferenceScale = double_0,
                Units          = esriUnits.esriMeters
            };
            UID instanceCLSID                  = description.InstanceCLSID;
            UID classExtensionCLSID            = description.ClassExtensionCLSID;
            ISymbolCollection symbolCollection = new SymbolCollectionClass();

            symbolCollection.set_Symbol(0, itextSymbol_0 as ISymbol);
            IAnnotateLayerPropertiesCollection2 annoProperties = new AnnotateLayerPropertiesCollectionClass();
            IAnnotateLayerProperties            item           = new LabelEngineLayerPropertiesClass
            {
                Class         = "要素类 1",
                FeatureLinked = false,
                AddUnplacedToGraphicsContainer = false,
                CreateUnplacedElements         = true,
                DisplayAnnotation = true,
                UseOutput         = true
            };
            ILabelEngineLayerProperties properties2 = item as ILabelEngineLayerProperties;

            properties2.Offset   = 0.0;
            properties2.SymbolID = 0;
            properties2.Symbol   = itextSymbol_0;
            annoProperties.Add(item);
            for (int i = 0; i < ifields_0.FieldCount; i++)
            {
                if (fields.FindField(ifields_0.get_Field(i).Name) == -1)
                {
                    (fields as IFieldsEdit).AddField(ifields_0.get_Field(i));
                }
            }
            try
            {
                return(anno.CreateAnnotationClass(string_4, fields, instanceCLSID, classExtensionCLSID,
                                                  description2.ShapeFieldName, "", null, null, annoProperties, referenceScale, symbolCollection, false));
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
            return(null);
        }
 IGeometry IGeometricEffect.NextGeometry()
 {
     if (m_bDone)
     {
         return null;
     }
     else
     {
         m_pCloneGeom = (IClone)m_pGeom;
         m_pGeomCopy = (IGeometry)m_pCloneGeom.Clone();
         m_pTransform = (ITransform2D)m_pGeomCopy;
         m_pTransform.Rotate(m_pCenterPoint, m_dAngle);
         m_bDone = true;
         return m_pGeomCopy;                
     }
 }
        IGeometry IGeometricEffect.NextGeometry()
        {
            if (m_bDone)
            {
                return null;
            }
            else
            {
                m_pCloneGeom = (IClone)m_pGeom;
                m_pGeomCopy = (IGeometry)m_pCloneGeom.Clone();
                m_pTransform = (ITransform2D)m_pGeomCopy;
                m_pTransform.Move(m_dOffsetX, m_dOffsetY);
                m_bDone = true;
                return m_pGeomCopy;
            }

        }
 public bool IsIdentical(IClone other)
 {
     if (this.Equals(other))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
        public bool IsEqual(IClone other)
        {
            bool equalResult = false;

            IHttpBasicGPValue httpBasicGPValue = other as IHttpBasicGPValue;

            if (httpBasicGPValue == null)
                return equalResult;

            if (httpBasicGPValue.EncodedUserNamePassWord.Equals(EncodeUserAuthentication(m_username, m_password)))
            {
                equalResult = true;
            }

            return equalResult;
        }
        public void Assign(IClone src)
        {
            IHttpBasicGPValue httpBasicGPValue = src as IHttpBasicGPValue;

            if (httpBasicGPValue == null)
                return;

            DecodeUserNamePassword(httpBasicGPValue.EncodedUserNamePassWord);
        }
 public bool IsIdentical(IClone other)
 {
     return other.Equals(this);
 }
    private ISymbol SetColorOfUnknownSymbol(IClone ClonedSymbol, IColor Color)
    {
      ISymbol tempSetColorOfUnknownSymbol = null;
      //
      // This function takes an IClone interface, works out the underlying coclass
      // (which should be some kind of symbol) and then sets the Color property
      // according to the passed in color.
      //
      tempSetColorOfUnknownSymbol = null;
      if (ClonedSymbol == null)
        return tempSetColorOfUnknownSymbol;
      //
      // Here we figure out which kind of symbol we have. For the simple symbol
      // types, simply setting the color property is OK. However, more complex
      // symbol types require further investigation.
      //
      IFillSymbol FillSymbol = null;
      IMarkerFillSymbol MarkerFillSymbol = null;
      IMarkerSymbol MarkerSymbol_A = null;
      ILineFillSymbol LineFillSymbol = null;
      ILineSymbol LineSymbol = null;
      IPictureFillSymbol PictureFillSymbol = null;
      IMarkerSymbol MarkerSymbol_B = null;
      IPictureMarkerSymbol PictureMarkerSymbol = null;
      IMarkerLineSymbol MarkerLineSymbol = null;
      IMarkerSymbol MarkerSymbol_C = null;
      ILineSymbol LineSymbol_B = null;
      if (ClonedSymbol is ISymbol)
      {
        //
        // Check for Fill symbols.
        //
        if (ClonedSymbol is IFillSymbol)
        {
          //
          // Check for SimpleFillSymbols or MultiLevelFillSymbols.
          //
          if ((ClonedSymbol is ISimpleFillSymbol) | (ClonedSymbol is IMultiLayerFillSymbol))
          {
            FillSymbol = (IFillSymbol)ClonedSymbol;
            //
            // Here we simply change the color of the Fill.
            //
            FillSymbol.Color = Color;
            tempSetColorOfUnknownSymbol = (ISymbol)FillSymbol;
            //
            // Check for MarkerFillSymbols.
            //
          }
          else if (ClonedSymbol is IMarkerFillSymbol)
          {
            MarkerFillSymbol = (IMarkerFillSymbol)ClonedSymbol;
            //
            // Here we change the color of the MarkerSymbol.
            //
            MarkerSymbol_A = (IMarkerSymbol)SetColorOfUnknownSymbol((IClone)MarkerFillSymbol.MarkerSymbol, Color);
            MarkerFillSymbol.MarkerSymbol = MarkerSymbol_A;
            tempSetColorOfUnknownSymbol = (ISymbol)MarkerFillSymbol;
            //
            // Check for LineFillSymbols.
            //
          }
          else if (ClonedSymbol is ILineFillSymbol)
          {
            LineFillSymbol = (ILineFillSymbol)ClonedSymbol;
            //
            // Here we change the color of the LineSymbol.
            //
            LineSymbol = (ILineSymbol)SetColorOfUnknownSymbol((IClone)LineFillSymbol.LineSymbol, Color);
            LineFillSymbol.LineSymbol = LineSymbol;
            tempSetColorOfUnknownSymbol = (ISymbol)LineFillSymbol;
            //
            // Check for PictureFillSymbols.
            //
          }
          else if (ClonedSymbol is IPictureFillSymbol)
          {
            PictureFillSymbol = (IPictureFillSymbol)ClonedSymbol;
            //
            // Here we simply change the color of the BackgroundColor.
            //
            PictureFillSymbol.BackgroundColor = Color;
            tempSetColorOfUnknownSymbol = (ISymbol)PictureFillSymbol;
          }
          //
          // Check for Marker symbols.
          //
        }
        else if (ClonedSymbol is IMarkerSymbol)
        {
          //
          // Check for SimpleMarkerSymbols, ArrowMarkerSymbols or
          // CharacterMarkerSymbols.
          //
          if ((ClonedSymbol is IMultiLayerMarkerSymbol) | (ClonedSymbol is ISimpleMarkerSymbol) | (ClonedSymbol is IArrowMarkerSymbol) | (ClonedSymbol is ICharacterMarkerSymbol))
          {
            MarkerSymbol_B = (IMarkerSymbol)ClonedSymbol;
            //
            // For these types, we simply change the color property.
            //
            MarkerSymbol_B.Color = Color;
            tempSetColorOfUnknownSymbol = (ISymbol)MarkerSymbol_B;
            //
            // Check for PictureMarkerSymbols.
            //
          }
          else if (ClonedSymbol is IPictureMarkerSymbol)
          {
            PictureMarkerSymbol = (IPictureMarkerSymbol)ClonedSymbol;
            //
            // Here we change the BackgroundColor property.
            //
            PictureMarkerSymbol.Color = Color;
            tempSetColorOfUnknownSymbol = (ISymbol)PictureMarkerSymbol;
          }
          //
          // Check for Line symbols.
          //
        }
        else if (ClonedSymbol is ILineSymbol)
        {
          //
          // Check for MarkerLine symbols.
          //
          if (ClonedSymbol is IMarkerLineSymbol)
          {
            MarkerLineSymbol = (IMarkerLineSymbol)ClonedSymbol;
            //
            // Here we change the color of the MarkerSymbol.
            //
            MarkerSymbol_C = (IMarkerSymbol)SetColorOfUnknownSymbol((IClone)MarkerLineSymbol.MarkerSymbol, Color);
            MarkerLineSymbol.MarkerSymbol = MarkerSymbol_C;
            tempSetColorOfUnknownSymbol = (ISymbol)MarkerLineSymbol;
            //
            // Check for other Line symbols.
            //
          }
          else if ((ClonedSymbol is ISimpleLineSymbol) | (ClonedSymbol is IHashLineSymbol) | (ClonedSymbol is ICartographicLineSymbol))
          {
            LineSymbol_B = (ILineSymbol)ClonedSymbol;
            LineSymbol_B.Color = Color;
            tempSetColorOfUnknownSymbol = (ISymbol)LineSymbol_B;
          }
        }
      }

      return tempSetColorOfUnknownSymbol;
    }
Пример #38
0
 /// <summary>
 /// Returns TRUE when the receiver and other are the same object.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool IsIdentical(IClone other)
 {
     _log.Debug("IClone IsIdentical");
       object clonedLocator = other as object;
       object thisLocator = this as object;
       return isSameObject(clonedLocator, thisLocator);
 }
Пример #39
0
 /// <summary>
 /// Returns TRUE when the receiver and other have the same properties.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool IsEqual(IClone other)
 {
     _log.Debug("IClone IsEqual");
       throw new NotImplementedException();
 }
Пример #40
0
 /// <summary>
 /// Assigns the properties of src to the receiver.
 /// </summary>
 /// <param name="src"></param>
 public void Assign(IClone src)
 {
     _log.Debug("IClone Assign");
       throw new NotImplementedException();
 }
Пример #41
0
 public void Clone(Dbvt dest, IClone iclone)
 {
     btDbvt_clone2(_native, dest._native, iclone._native);
 }
    /// <summary>
    /// Assigns the properties of src to the receiver.
    /// </summary>
    /// <param name="src"></param>
    public void Assign(IClone src)
    {
      //1. make sure that src is pointing to a valid object
      if (null == src)
      {
        throw new COMException("Invalid objact.");
      }

      //2. make sure that the type of src is of type 'ClonableObjClass'
      if (!(src is ClonableObjClass))
      {
        throw new COMException("Bad object type.");
      }

      //3. assign the properties of src to the current instance
      ClonableObjClass srcClonable = (ClonableObjClass)src;
      m_name = srcClonable.Name;
      m_version = srcClonable.Version;
      m_ID = new Guid(srcClonable.ID.ToString());

      //don't clone the spatial reference, since in this case we want both object to 
      //reference the same spatial reference (for example like features in a featureclass 
      //which share the same spatial reference)
      m_spatialRef = srcClonable.SpatialReference;

      //clone the point. Use deep cloning 
      if (null == srcClonable.Point)
        m_point = null;
      else
      {
        IObjectCopy objectCopy = new ObjectCopyClass();
        object obj = objectCopy.Copy((object)srcClonable.Point);
        m_point = (IPoint)obj;
      }

      m_arr = (ArrayList)srcClonable.ManagedArray.Clone();
    }
    public bool IsIdentical(IClone other)
    {
      //1. make sure that the 'other' object is pointing to a valid object
      if (null == other)
        throw new COMException("Invalid objact.");

      //2. verify the type of 'other'
      if (!(other is ClonableObjClass))
        throw new COMException("Bad object type.");

      //3. test if the other is the 'this'
      if ((ClonableObjClass)other == this)
        return true;

      return false;
    }
    public bool IsEqual(IClone other)
    {
      //1. make sure that the 'other' object is pointing to a valid object
      if (null == other)
        throw new COMException("Invalid object.");

      //2. verify the type of 'other'
      if (!(other is TriangleElementClass))
        throw new COMException("Bad object type.");

      TriangleElementClass otherTriangle = (TriangleElementClass)other;
      //test that all of the object's properties are the same.
      //please note the usage of IsEqual when using ArcObjects components that
      //supports cloning
      if (otherTriangle.Name == m_elementName &&
          otherTriangle.Type == m_elementType &&
          otherTriangle.AutoTransform == m_autoTrans &&
          otherTriangle.ReferenceScale == m_scaleRef &&
          otherTriangle.Angle == m_rotation &&
          otherTriangle.Size == m_size &&
          otherTriangle.AnchorPoint == m_anchorPointType &&
          ((IClone)otherTriangle.Geometry).IsEqual((IClone)m_triangle) &&
          ((IClone)otherTriangle.FillSymbol).IsEqual((IClone)m_fillSymbol) &&
          ((IClone)otherTriangle.SpatialReference).IsEqual((IClone)m_nativeSR))
        return true;

      return false;
    }
 public void Assign(IClone src)
 {
 }
    public void Assign(IClone src)
    {

      //1. make sure that src is pointing to a valid object
      if (null == src)
      {
        throw new COMException("Invalid object.");
      }

      //2. make sure that the type of src is of type 'TriangleElementClass'
      if (!(src is TriangleElementClass))
      {
        throw new COMException("Bad object type.");
      }

      //3. assign the properties of src to the current instance
      TriangleElementClass srcTriangle = (TriangleElementClass)src;
      m_elementName = srcTriangle.Name;
      m_elementType = srcTriangle.Type;
      m_autoTrans = srcTriangle.AutoTransform;
      m_scaleRef = srcTriangle.ReferenceScale;
      m_rotation = srcTriangle.Angle;
      m_size = srcTriangle.Size;
      m_anchorPointType = srcTriangle.AnchorPoint;

      IObjectCopy objCopy = new ObjectCopyClass();

      //take care of the custom property
      if (null != srcTriangle.CustomProperty)
      {
        if (srcTriangle.CustomProperty is IClone)
          m_customProperty = (object)((IClone)srcTriangle.CustomProperty).Clone();
        else if (srcTriangle.CustomProperty is IPersistStream)
        {
          m_customProperty = objCopy.Copy((object)srcTriangle.CustomProperty);
        }
        else if (srcTriangle.CustomProperty.GetType().IsSerializable)
        {
          //serialize to a memory stream
          MemoryStream memoryStream = new MemoryStream();
          BinaryFormatter binaryFormatter = new BinaryFormatter();
          binaryFormatter.Serialize(memoryStream, srcTriangle.CustomProperty);
          byte[] bytes = memoryStream.ToArray();

          memoryStream = new MemoryStream(bytes);
          m_customProperty = binaryFormatter.Deserialize(memoryStream);
        }
      }

      if (null != srcTriangle.SpatialReference)
        m_nativeSR = objCopy.Copy(srcTriangle.SpatialReference) as ISpatialReference;
      else
        m_nativeSR = null;

      if (null != srcTriangle.FillSymbol)
      {
        m_fillSymbol = objCopy.Copy(srcTriangle.FillSymbol) as ISimpleFillSymbol;
      }
      else
        m_fillSymbol = null;

      if (null != srcTriangle.Geometry)
      {
        m_triangle = objCopy.Copy(srcTriangle.Geometry) as IPolygon;
        m_pointGeometry = objCopy.Copy(((IArea)m_triangle).Centroid) as IPoint;
      }
      else
      {
        m_triangle = null;
        m_pointGeometry = null;
      }
    }
        public bool IsEqual(IClone other)
        {
            bool equalResult = false;

            IHttpBasicGPValue httpBasicGPValue = other as IHttpBasicGPValue;

            if (httpBasicGPValue == null)
                return equalResult;

            equalResult = true;

            return equalResult;
        }
    /// <summary>
    /// Returns TRUE when the receiver and the other object have the same properties.
    /// </summary>
    /// <param name="other"></param>
    /// <returns></returns>
    public bool IsEqual(IClone other)
    {
      //1. make sure that the 'other' object is pointing to a valid object
      if (null == other)
        throw new COMException("Invalid objact.");

      //2. verify the type of 'other'
      if (!(other is ClonableObjClass))
        throw new COMException("Bad object type.");

      ClonableObjClass otherClonable = (ClonableObjClass)other;

      //test that all ot the object's properties are the same.
      //please note the usage of IsEqual when using arcobjects components that
      //supports cloning
      if (otherClonable.Version == m_version &&
        otherClonable.Name == m_name &&
        otherClonable.ID == m_ID &&
        otherClonable.ManagedArray == m_arr &&
        ((IClone)otherClonable.SpatialReference).IsEqual((IClone)m_spatialRef) &&
        ((IClone)otherClonable.Point).IsEqual((IClone)m_point))

        return true;
    
      return false;
    }
 public IClone CloneMe(ref IClone OriginalClone)
 {
   IClone tempCloneMe = null;
   //
   // This function clones the input object.
   //
   tempCloneMe = null;
   if (OriginalClone != null)
     tempCloneMe = OriginalClone.Clone();
   return tempCloneMe;
 }